huangzhiguo vor 2 Jahren
Ursprung
Commit
c7614fecf2

+ 5 - 0
src/main/java/com/caimei365/manager/entity/caimei/CmBehaviorRecord.java

@@ -244,4 +244,9 @@ public class CmBehaviorRecord {
      */
     @ExcelIgnore
     private List<String> labels;
+    /**
+     * 导出标志
+     */
+    @ExcelIgnore
+    private Integer exportType;
 }

+ 49 - 37
src/main/java/com/caimei365/manager/service/caimei/svip/impl/CmSvipHistoryServiceImpl.java

@@ -36,9 +36,12 @@ import java.util.*;
 @Service
 public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
 
-    @Autowired private CmSvipHistoryDao historyDao;
-    @Resource private SendSmsService sendSmsService;
-    @Resource private CmCouponService cmCouponService;
+    @Autowired
+    private CmSvipHistoryDao historyDao;
+    @Resource
+    private SendSmsService sendSmsService;
+    @Resource
+    private CmCouponService cmCouponService;
 
     private CmVipCoupon get(String id) {
 
@@ -49,7 +52,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
                 Date parse = simpleDateFormat.parse(vipCoupon.getUseTime());
                 Calendar calendar = Calendar.getInstance();
                 calendar.setTime(parse);
-                calendar.add(Calendar.MONTH,2);
+                calendar.add(Calendar.MONTH, 2);
                 Date time = calendar.getTime();
                 vipCoupon.setEndTime(simpleDateFormat.format(time));
                 Date newParse = simpleDateFormat.parse("2023-02");
@@ -72,7 +75,6 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
     }
 
 
-
     @Override
     public ResponseJson<PaginationVo<CmSvipHistory>> memberList(CmSvipHistory vip, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum, pageSize);
@@ -114,7 +116,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         cmSvipHistory.setPayTime(now);
         CmSvipHistory user = historyDao.findVipUser(cmSvipGive.getUserId());
 //        Integer clubID = messageCenterDao.clubIdCule(Integer.parseInt(cmSvipGive.getUserId()));
-        Date date=new Date();
+        Date date = new Date();
         String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
         MessageCenter messageCenter = new MessageCenter();
         messageCenter.setShopId(null);
@@ -122,18 +124,18 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         messageCenter.setUserType(1);
         messageCenter.setMessageType(2);
         messageCenter.setAccountType(4);
-        messageCenter.setContent(cmSvipGive.getMonth().toString()+"个月");
+        messageCenter.setContent(cmSvipGive.getMonth().toString() + "个月");
         messageCenter.setTime(curDateStr);
         historyDao.addMessageCenter(messageCenter);
 
 //        String bindMobile= messageCenterDao.contractMobile(cmSvipGive.getUserId());
 
-        String content = "【采美365】您已获得采美平台赠送的"+cmSvipGive.getMonth()+"个月超级会员服务,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美网”可获取更多优惠和精彩资讯。";
+        String content = "【采美365】您已获得采美平台赠送的" + cmSvipGive.getMonth() + "个月超级会员服务,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美网”可获取更多优惠和精彩资讯。";
         if (null == cmSvipGive.getContractMobile()) {
-            return ResponseJson.error(-1,"手机号为空,无法发送短信",null);
+            return ResponseJson.error(-1, "手机号为空,无法发送短信", null);
         }
         boolean sendSms = sendSmsService.getSendSms(9, cmSvipGive.getContractMobile(), content);
-        if(sendSms){
+        if (sendSms) {
             log.info(">>>>>>>获得采美平台赠送的超级会员短信推送成功");
         }
         if (null != user) {
@@ -144,13 +146,13 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
                 Date beginTime = endTimeFlag.getEndTime();
                 cmSvipHistory.setBeginTime(beginTime);
                 c.setTime(beginTime);
-                c.add(Calendar.MONTH,cmSvipGive.getMonth());
+                c.add(Calendar.MONTH, cmSvipGive.getMonth());
                 cmSvipHistory.setEndTime(c.getTime());
                 historyDao.insertHistory(cmSvipHistory);
                 //cm_svip_user的begintime不变
                 cmSvipHistory.setBeginTime(null);
                 historyDao.updateVip(cmSvipHistory);
-            }else{
+            } else {
                 historyDao.insertHistory(cmSvipHistory);
                 //正常update
                 historyDao.updateVip(cmSvipHistory);
@@ -161,7 +163,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
             //cm_svip_user无则新增
             historyDao.insertHistory(cmSvipHistory);
         }
-        return ResponseJson.success(1,"超级会员赠送成功",null);
+        return ResponseJson.success(1, "超级会员赠送成功", null);
     }
 
     /**
@@ -174,7 +176,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
     public ResponseJson<PaginationVo<CmSvipHistory>> findHistory(CmSvipHistory cmSvipHistory, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
         List<CmSvipHistory> history = historyDao.findHistory(cmSvipHistory);
-        Map<String,Object> map = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
         //1生效2过期3未生效
         for (CmSvipHistory svipHistory : history) {
             Integer packageID = svipHistory.getPackageId();
@@ -188,7 +190,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
             if (null != duration && duration.equals(12)) {
                 svipHistory.setPackageId(12);
             }
-            if(0==packageID){
+            if (0 == packageID) {
                 svipHistory.setGiveMonth(historyDao.findMonth(svipHistory.getId()));
             }
             Date beginTime = svipHistory.getBeginTime();
@@ -228,7 +230,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
                 Date parse = simpleDateFormat.parse(vipCoupon.getUseTime());
                 Calendar calendar = Calendar.getInstance();
                 calendar.setTime(parse);
-                calendar.add(Calendar.MONTH,2);
+                calendar.add(Calendar.MONTH, 2);
                 Date time = calendar.getTime();
                 vipCoupon.setEndTime(simpleDateFormat.format(time));
                 Date newParse = simpleDateFormat.parse("2023-02");
@@ -248,24 +250,26 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
             });
             vipCoupon.setCouponList(couponList);
         });
+        cmVipCouponList.removeIf(c -> null == c.getCouponList() || c.getCouponList().size() < 1);
         PaginationVo<CmVipCoupon> page = new PaginationVo<>(cmVipCouponList);
         return ResponseJson.success(page);
     }
 
     /**
      * 编辑超级会员优惠券
+     *
      * @param id
      * @param configure
      * @return
      */
     @Override
-    public ResponseJson<Map<String, Object>> cmVipCouponForm(Integer id,Integer configure) {
+    public ResponseJson<Map<String, Object>> cmVipCouponForm(Integer id, Integer configure) {
         Map<String, Object> map = new HashMap<>();
         CmVipCoupon vipCoupon = null;
         List<CmCoupon> couponList = null;
         // 初始化优惠券信息
         SvipCouponForm svipcouponForm = new SvipCouponForm();
-        if ( 1 == configure) {
+        if (1 == configure) {
             // 专属优惠券配置
             couponList = historyDao.selconfigure();
             // 专属优惠券配置
@@ -278,7 +282,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         } else {
             // 编辑优惠券
             if (null == id) {
-                return ResponseJson.error(-1,"id不能为空",null);
+                return ResponseJson.error(-1, "id不能为空", null);
             }
             vipCoupon = get(id.toString());
             if (null != vipCoupon.getCouponList()) {
@@ -293,7 +297,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         }
         ArrayList<CmCoupon> arr = new ArrayList<>();
         // 设置券信息
-        if (null != couponList){
+        if (null != couponList) {
             for (int i = 0; i < couponList.size(); i++) {
                 CmCoupon cmCoupon = new CmCoupon();
                 cmCoupon.setId(couponList.get(i).getId());
@@ -319,8 +323,10 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
                 if (couponList.get(i).getCouponType() == 3) {
                     // 店铺券
                     NewCmShop shop = historyDao.getShopInfoByShopId(couponList.get(i).getShopId());
-                    cmCoupon.setShopName(shop.getName());
-                    cmCoupon.setShop(shop);
+                    if (null != shop) {
+                        cmCoupon.setShopName(shop.getName());
+                        cmCoupon.setShop(shop);
+                    }
                 }
                 arr.add(cmCoupon);
             }
@@ -366,7 +372,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         setVipCouponStatus(cmVipCoupon);
         // 解析 svipcouponForm -> 组装 CmCoupon 列表 保存
         boolean flag = false;
-        if(StringUtils.isNotBlank(cmVipCoupon.getId())){
+        if (StringUtils.isNotBlank(cmVipCoupon.getId())) {
             // 修改
             historyDao.updateVipCouponMonth(cmVipCoupon);
         } else {
@@ -385,7 +391,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         }
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(dateMonth);
-        calendar.add(Calendar.MONTH,2);
+        calendar.add(Calendar.MONTH, 2);
         Date time = calendar.getTime();
         String format = dateFormat.format(time);
         Date endTime = DateUtil.getMaxDay(format);
@@ -396,7 +402,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         if (null != svipcouponForm.getCoupons()) {
             List<CmCoupon> coupons = svipcouponForm.getCoupons();
             coupons.forEach(cp -> {
-                cp.setName("超级会员优惠券"+svipcouponForm.getMonth());
+                cp.setName("超级会员优惠券" + svipcouponForm.getMonth());
                 cp.setStartDate(beginTime);
                 cp.setEndDate(endTime);
                 cp.setStatus("1");
@@ -406,17 +412,17 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
                     cp.setConfigure(1);
                 }
                 // 0活动券 1品类券 3店铺券
-                if (0 == cp.getCouponType()){
+                if (0 == cp.getCouponType()) {
                     cp.setCouponType(0);
 //                    cp.setProductType(svipcouponForm.getProductType1());
-                    if ("2".equals(cp.getProductType())){
+                    if ("2".equals(cp.getProductType())) {
                         // 指定商品
                         cp.setProductInfo(cp.getProductInfo());
                     }
-                } else if (1==cp.getCouponType()) {
+                } else if (1 == cp.getCouponType()) {
                     cp.setCategoryType(cp.getCategoryType());
                     cp.setCouponType(1);
-                } else if (3==cp.getCouponType()) {
+                } else if (3 == cp.getCouponType()) {
                     cp.setShopId(cp.getShopId());
                     cp.setCouponType(3);
                 }
@@ -429,7 +435,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
          * vip优惠券月份关系
          */
         CmVipCouponRelation relation = new CmVipCouponRelation();
-        for (int i = 0; i < svipcouponForm.getCoupons().size() ; i++) {
+        for (int i = 0; i < svipcouponForm.getCoupons().size(); i++) {
             relation.setMontId(cmVipCoupon.getId());
             relation.setCouponId(svipcouponForm.getCoupons().get(i).getId());
             relation.setUpdateTime(new Date());
@@ -652,7 +658,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         //保存/修改同步处理cm_svip_product_sku表数据
         if (null == cmSvipProduct.getId()) {
             List<Product> productImage = historyDao.findProductImage(new Product());
-            for(Product p : productImage){
+            for (Product p : productImage) {
                 if (p.getProductId().equals(cmSvipProduct.getProductId())) {
                     return ResponseJson.error(-1, "该商品以是超级会员商品,请勿重复添加", null);
                 }
@@ -708,6 +714,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
 
     /**
      * 保存宣传图
+     *
      * @param adsImage
      * @return
      */
@@ -767,6 +774,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
 
     /**
      * 初始化超级会员商品数据
+     *
      * @param id
      * @return
      */
@@ -808,6 +816,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
             }
         }
     }
+
     /**
      * 设置会员优惠生效状态
      */
@@ -821,7 +830,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
                     Date parse = df.parse(vipCoupon.getUseTime());
                     Calendar calendar = Calendar.getInstance();
                     calendar.setTime(parse);
-                    calendar.add(Calendar.MONTH,2);
+                    calendar.add(Calendar.MONTH, 2);
                     Date time = calendar.getTime();
                     vipCoupon.setEndTime(df.format(time));
 
@@ -850,18 +859,20 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
             }
         }
     }
+
     /**
      * 查询条件 优惠月份季度调整
+     *
      * @param cmVipCoupon
      * @return
      */
     public CmVipCoupon quarter(CmVipCoupon cmVipCoupon) {
-        String startDate  = "";
-        String endDate  = "";
+        String startDate = "";
+        String endDate = "";
         String year = "";
         String month = "";
         if (StringUtils.isNotEmpty(cmVipCoupon.getStartDate())) {
-            year = cmVipCoupon.getStartDate().substring(0,cmVipCoupon.getStartDate().length() - 2);
+            year = cmVipCoupon.getStartDate().substring(0, cmVipCoupon.getStartDate().length() - 2);
             month = cmVipCoupon.getStartDate().substring(cmVipCoupon.getStartDate().length() - 2);
             if (month.equals("02") || month.equals("03") || month.equals("04")) {
                 month = "02";
@@ -878,7 +889,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
             startDate = year + month;
         }
         if (StringUtils.isNotEmpty(cmVipCoupon.getEndDate())) {
-            year = cmVipCoupon.getEndDate().substring(0,cmVipCoupon.getEndDate().length() - 2);
+            year = cmVipCoupon.getEndDate().substring(0, cmVipCoupon.getEndDate().length() - 2);
             month = cmVipCoupon.getEndDate().substring(cmVipCoupon.getEndDate().length() - 2);
             if (month.equals("02") || month.equals("03") || month.equals("04")) {
                 month = "02";
@@ -898,8 +909,9 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
         cmVipCoupon.setEndDate(endDate);
         return cmVipCoupon;
     }
+
     public String countMonth(String countMonth) {
-        String year = countMonth.substring(0,countMonth.length() - 2);
+        String year = countMonth.substring(0, countMonth.length() - 2);
         String month = countMonth.substring(countMonth.length() - 2);
         if (month.equals("02") || month.equals("03") || month.equals("04")) {
             month = "02";

+ 1 - 0
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java

@@ -101,6 +101,7 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
             list = cmBehaviorRecordDao.findListToday(cmBehaviorRecord);
         } else {
             // 过往数据
+            cmBehaviorRecord.setExportType(1);
             list = cmBehaviorRecordDao.findList(cmBehaviorRecord);
         }
         list.forEach(t -> {

+ 3 - 0
src/main/resources/mapper/CmBehaciorRecordDao.xml

@@ -76,6 +76,9 @@
             </if>
         </where>
         ORDER BY accessTime DESC
+        <if test="exportType == 1">
+            limit 5000
+        </if>
     </select>
     <select id="findListToday" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
         SELECT