mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-04 03:06:39 +08:00
adding filter coupon logic .
This commit is contained in:
parent
672738daf3
commit
9c4e7baf8c
@ -6,10 +6,15 @@ import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
|||||||
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigFindAllEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigFindAllEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
|
||||||
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
||||||
|
import net.lab1024.smartadmin.util.SmartDateUtil;
|
||||||
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -24,8 +29,15 @@ public class CouponConfigService {
|
|||||||
return SmartHttpUtil.sendPostForm(url+"get",paramMap,null);
|
return SmartHttpUtil.sendPostForm(url+"get",paramMap,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String couponConfigFindAll(CouponConfigFindAllEntity couponConfigFindAllEntity) throws Exception{
|
public String couponConfigFindAll(CouponConfigFindAllEntity couponConfigFindAllEntity){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date currentDate = SmartDateUtil.parseYMD(sdf.format(new Date()));
|
||||||
|
|
||||||
|
String storeCode = couponConfigFindAllEntity.getStoreCode();
|
||||||
|
String[] productCode = couponConfigFindAllEntity.getProductCode().split(",");
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponConfigFindAllEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponConfigFindAllEntity);
|
||||||
|
paramMap.remove("storeCode");
|
||||||
|
paramMap.remove("productCode");
|
||||||
paramMap.put("memberTagId",StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()));
|
paramMap.put("memberTagId",StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()));
|
||||||
paramMap.put("memberId",StringUtil.toString(couponConfigFindAllEntity.getMemberId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberId()));
|
paramMap.put("memberId",StringUtil.toString(couponConfigFindAllEntity.getMemberId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberId()));
|
||||||
paramMap.put("rows",StringUtil.toString(couponConfigFindAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getRows()));
|
paramMap.put("rows",StringUtil.toString(couponConfigFindAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getRows()));
|
||||||
@ -40,10 +52,21 @@ public class CouponConfigService {
|
|||||||
for(int i = 0;i < jsonArray.size();i ++){
|
for(int i = 0;i < jsonArray.size();i ++){
|
||||||
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
||||||
if(jsonResult.getString("udf2") != null) {
|
if(jsonResult.getString("udf2") != null) {
|
||||||
if (jsonResult.getString("udf2").equals("H5")) {
|
Date compareDate = SmartDateUtil.parseYMD(jsonResult.get("fPublishTo").toString());
|
||||||
|
if ("H5".equals(jsonResult.getString("udf2"))&&"".equals(storeCode)&&!"".equals(productCode)) {
|
||||||
|
for(int g = 0 ;g<productCode.length;g++) {
|
||||||
|
if (jsonResult.get("productCodes").toString().indexOf(productCode[g]) != -1&&compareDate.compareTo(currentDate)>=0) {
|
||||||
afterFilterArrary.add(jsonResult);
|
afterFilterArrary.add(jsonResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(storeCode)&&!"".equals(productCode)){
|
||||||
|
for(int g = 0 ;g<productCode.length;g++) {
|
||||||
|
if (jsonResult.get("productCodes").toString().indexOf(productCode[g]) != -1 && couponConfigFindAllEntity.getStoreCode().equals(jsonResult.get("storeCodes")!=null ?jsonResult.get("storeCodes").toString():"")&&compareDate.compareTo(currentDate)>=0) {
|
||||||
|
afterFilterArrary.add(jsonResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
JSONObject JSONResult = new JSONObject();
|
JSONObject JSONResult = new JSONObject();
|
||||||
JSONResult.put("code",jsonObjectResult.getString("code"));
|
JSONResult.put("code",jsonObjectResult.getString("code"));
|
||||||
@ -52,4 +75,16 @@ public class CouponConfigService {
|
|||||||
return JSONResult.toJSONString();
|
return JSONResult.toJSONString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// String spStr = "8110000807,811000080123";
|
||||||
|
// String str = "8110000807,81100008012,81100008024,8111000807,81110008012,81110008024,8112001007,8112001012,8112001024,8113001007,8113001012,8113001024,80230008F07,80240008F07,80250008F07,8023450008F07,8023450008F12,8026780008F07,8026780008F12,8023450008F24,8026780008F24,81220020F03,80210020F03,81220020F06,80210020F06,81220020F12,81220020F24,80210020F12,80260008F07,80270008F07,80280008F07,80290008F07,80230008F12,80240008F12,80250008F12,80230008F24,80240008F24,80250008F24,80260008F12,80270008F12,80280008F12,80290008F12,80260008F24,80270008F24,80280008F24,80290008F24,81350008F07,80330008F07,80310008F07,81350008F12,80330008F12,80310008F12";
|
||||||
|
// String[] splitStr =spStr.split(",");
|
||||||
|
// for(int i = 0 ;i < splitStr.length;i++){
|
||||||
|
// System.out.println(str.indexOf(splitStr[i]));>SmartDateUtil.formatYMD(date)
|
||||||
|
// }
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date currentDate = SmartDateUtil.parseYMD(sdf.format(new Date()));
|
||||||
|
System.out.println(SmartDateUtil.parseYMD("2022-03-9").compareTo(currentDate)>=0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,9 @@ public class CouponService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String couponGetAll(CouponGetAllEntity couponGetAllEntity) throws Exception{
|
public String couponGetAll(CouponGetAllEntity couponGetAllEntity) throws Exception{
|
||||||
|
String productCode = couponGetAllEntity.getProductCode();
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponGetAllEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponGetAllEntity);
|
||||||
|
paramMap.remove("productCode");
|
||||||
paramMap.put("status",StringUtil.toString(couponGetAllEntity.getStatus()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getStatus()));
|
paramMap.put("status",StringUtil.toString(couponGetAllEntity.getStatus()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getStatus()));
|
||||||
paramMap.put("page",StringUtil.toString(couponGetAllEntity.getPage()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getPage()));
|
paramMap.put("page",StringUtil.toString(couponGetAllEntity.getPage()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getPage()));
|
||||||
paramMap.put("rows",StringUtil.toString(couponGetAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getRows()));
|
paramMap.put("rows",StringUtil.toString(couponGetAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getRows()));
|
||||||
@ -52,9 +54,15 @@ public class CouponService {
|
|||||||
for(int i = 0;i < jsonArray.size();i ++){
|
for(int i = 0;i < jsonArray.size();i ++){
|
||||||
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
||||||
if(jsonResult.getString("udf2") != null) {
|
if(jsonResult.getString("udf2") != null) {
|
||||||
if (jsonResult.getString("udf2").equals("H5")) {
|
if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(productCode)) {
|
||||||
|
if (jsonResult.get("productCodes").toString().indexOf(productCode) != -1){
|
||||||
afterFilterArrary.add(jsonResult);
|
afterFilterArrary.add(jsonResult);
|
||||||
}
|
}
|
||||||
|
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(productCode)){
|
||||||
|
if (jsonResult.get("productCodes").toString().indexOf(productCode) != -1 && productCode.equals(jsonResult.get("storeCodes").toString())){
|
||||||
|
afterFilterArrary.add(jsonResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject JSONResult = new JSONObject();
|
JSONObject JSONResult = new JSONObject();
|
||||||
|
@ -108,4 +108,8 @@ public class CouponGetAllEntity {
|
|||||||
|
|
||||||
@ApiModelProperty(example = "1")
|
@ApiModelProperty(example = "1")
|
||||||
private int page;
|
private int page;
|
||||||
|
|
||||||
|
|
||||||
|
private String productCode = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,4 +46,8 @@ public class CouponConfigFindAllEntity {
|
|||||||
@ApiModelProperty(example = "1")
|
@ApiModelProperty(example = "1")
|
||||||
private int page;
|
private int page;
|
||||||
|
|
||||||
|
private String storeCode = "";
|
||||||
|
|
||||||
|
private String productCode = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class SmartJWTUtil {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String token = SmartJWTUtil.generateToken("884159");
|
String token = SmartJWTUtil.generateToken("884159");
|
||||||
System.out.println(token);
|
System.out.println(token);
|
||||||
System.out.println(SmartJWTUtil.decodeToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg4NDE1OSIsImV4cCI6MTY0NjM4Mzk1NH0.-ilK-e-49c88IxdkSW1QMNZQ3P2LG7iIsQRXYlrXjjo"));
|
System.out.println(SmartJWTUtil.decodeToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg4NDIzNCIsImV4cCI6MTY0ODI4MjAxNX0.itFA3bb0XNk2LSD3ey3_o33GYK3Rt0v9MXiRerhu-6A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1604,7 +1604,7 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_operate_log` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_good_orders`;
|
||||||
CREATE TABLE `t_good_orders` (
|
CREATE TABLE `t_good_orders` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`order_no` varchar(20) DEFAULT NULL COMMENT '订单号',
|
`order_no` varchar(20) DEFAULT NULL COMMENT '订单号',
|
||||||
@ -1628,6 +1628,7 @@ CREATE TABLE `t_good_orders` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_good_goods`;
|
||||||
CREATE TABLE `t_good_goods` (
|
CREATE TABLE `t_good_goods` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`product_code` VARCHAR(20) NOT NULL COMMENT '标品编码',
|
`product_code` VARCHAR(20) NOT NULL COMMENT '标品编码',
|
||||||
@ -1688,7 +1689,7 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_notify_operate_log` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_royalcanin_productsearchtag`;
|
||||||
CREATE TABLE `t_royalcanin_productsearchtag` (
|
CREATE TABLE `t_royalcanin_productsearchtag` (
|
||||||
`id` int(50) NOT NULL,
|
`id` int(50) NOT NULL,
|
||||||
`brand_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`brand_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user