Browse Source

Merge branch 'developer' into developerE

JiangChongBo 2 năm trước cách đây
mục cha
commit
a13a4d3eaf
29 tập tin đã thay đổi với 598 bổ sung1104 xóa
  1. 6 0
      pom.xml
  2. 0 47
      src/main/java/com/caimei/modules/coupon/redis/RedisLearn.java
  3. 93 0
      src/main/java/com/caimei/modules/coupon/service/AsyncService.java
  4. 1 1
      src/main/java/com/caimei/modules/coupon/web/CmCouponClubTask.java
  5. 11 240
      src/main/java/com/caimei/modules/coupon/web/CmCouponController.java
  6. 2 0
      src/main/java/com/caimei/modules/order/dao/CmOfflineCollectionDao.java
  7. 3 0
      src/main/java/com/caimei/modules/order/dao/CmPayShopDao.java
  8. 31 5
      src/main/java/com/caimei/modules/order/service/CmOfflineCollectionService.java
  9. 52 7
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  10. 1 1
      src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java
  11. 31 0
      src/main/java/com/caimei/modules/product/entity/Product.java
  12. 0 14
      src/main/java/com/caimei/modules/sys/dao/NotificationDao.java
  13. 73 86
      src/main/java/com/caimei/modules/sys/utils/SMSUtils.java
  14. 36 448
      src/main/java/com/caimei/modules/sys/web/NotificationController.java
  15. 4 8
      src/main/java/com/caimei/modules/user/dao/MessageCenterDao.java
  16. 2 0
      src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java
  17. 4 1
      src/main/java/com/caimei/modules/user/entity/MessageCenter.java
  18. 27 0
      src/main/java/com/caimei/modules/user/entity/NewCmClub.java
  19. 43 129
      src/main/java/com/caimei/modules/user/web/NewCmShopController.java
  20. 1 0
      src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java
  21. 3 0
      src/main/resources/mappings/modules/order/CmOfflineCollectionMapper.xml
  22. 6 1
      src/main/resources/mappings/modules/order/CmPayShopMapper.xml
  23. 39 64
      src/main/resources/mappings/modules/sys/Notification.xml
  24. 39 39
      src/main/resources/mappings/modules/user/MessageCenter.xml
  25. 14 2
      src/main/resources/mappings/modules/user/NewCmClubMapper.xml
  26. 13 8
      src/main/resources/mappings/modules/user/NewCmShopMapper.xml
  27. 1 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp
  28. 5 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherCheck.jsp
  29. 57 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyList.jsp

+ 6 - 0
pom.xml

@@ -105,6 +105,12 @@
 	</pluginRepositories>
 	</pluginRepositories>
 	<!-- 依赖项定义 -->
 	<!-- 依赖项定义 -->
 	<dependencies>
 	<dependencies>
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<version>1.18.18</version>
+		</dependency>
+
 		<dependency>
 		<dependency>
 			<groupId>commons-httpclient</groupId>
 			<groupId>commons-httpclient</groupId>
 			<artifactId>commons-httpclient</artifactId>
 			<artifactId>commons-httpclient</artifactId>

+ 0 - 47
src/main/java/com/caimei/modules/coupon/redis/RedisLearn.java

@@ -1,47 +0,0 @@
-package com.caimei.modules.coupon.redis;
-
-import com.caimei.modules.coupon.entity.CmCoupon;
-import com.caimei.modules.user.dao.MessageCenterDao;
-import com.caimei.modules.user.entity.CmUser;
-import com.caimei.modules.user.entity.MessageCenter;
-import com.cmme.modules.product.entity.CmmeProductImage;
-import com.thinkgem.jeesite.common.web.BaseController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Controller;
-import redis.clients.jedis.Jedis;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * Description
- *
- * @author : Charles
- * @date : 2022/7/14
- */
-public class RedisLearn {
-
-
-    public static void producer( List<Integer> clubIds) {
-
-        clubIds.forEach(clubId -> {
-            Jedis jedis=null;
-            String constraint="";
-
-//                jedis=new Jedis("172.31.165.27", 6379);
-//                jedis.auth("6#xsI%b4o@5c3RoE");
-
-                jedis=new Jedis("192.168.2.100", 6379);
-
-//                jedis=new Jedis("172.31.165.23", 6379);
-
-            // 记录机构ID
-            jedis.lpush("mess"+clubId.toString(),clubId.toString());
-        });
-    }
-
-}
-

+ 93 - 0
src/main/java/com/caimei/modules/coupon/service/AsyncService.java

@@ -0,0 +1,93 @@
+package com.caimei.modules.coupon.service;
+
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.sys.utils.SMSUtils;
+import com.caimei.modules.user.dao.MessageCenterDao;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.entity.MessageCenter;
+import com.caimei.po.User;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Service
+@EnableAsync
+@Transactional(readOnly = false)
+@Slf4j
+public class AsyncService {
+
+    @Resource
+    private MessageCenterDao messageCenterDao;
+
+    //优惠券站内消息推送
+    @Async("mytask")
+    public void consumer(CmCoupon cmCoupon) {
+        log.info("优惠券异步信推送开始--------------------》");
+        String smsContent = "采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com" +
+                "或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
+        MessageCenter messageCenter = new MessageCenter();
+        Date date = new Date();
+        String now = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+        messageCenter.userType(1).couponType(cmCoupon.getCouponType()).messageType(4).time(now).couponMessageType(1).
+                couponFee(cmCoupon.getCouponAmount().doubleValue());
+        List<Integer> clubIds = messageCenterDao.ClubIds();
+        List<User> users = new ArrayList<>();
+        switch (cmCoupon.getCouponType()) {
+            // 劵类型 0活动券 1品类券 2用户专享券 3店铺券 4新用户券
+            case 0:
+                setCouponMessage(messageCenter, clubIds, smsContent, null);
+                break;
+            case 1:
+                String type = "1".equals(cmCoupon.getCategoryType()) ? "产品" : "仪器";
+                smsContent = "采美平台" + type + "类商品大优惠,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com" +
+                        "或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
+                setCouponMessage(messageCenter, clubIds, smsContent, null);
+                break;
+            case 2:
+                users = messageCenterDao.getUserInfo(cmCoupon.getUserId());
+                setCouponMessage(messageCenter, null, smsContent, users);
+                break;
+            case 3:
+                String shopName = messageCenterDao.shopName(cmCoupon.getShopId());
+                smsContent = "采美平台为了回馈客户,赠送您" + cmCoupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com" +
+                        "或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
+                messageCenter.content(shopName);
+                setCouponMessage(messageCenter, clubIds, smsContent, null);
+                break;
+            case 4:
+                smsContent = "恭喜成功注册采美平台。采美平台赠送您" + cmCoupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com" +
+                        "或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
+                users = messageCenterDao.getNewUsers();
+                setCouponMessage(messageCenter, null, smsContent, users);
+                break;
+            default:
+                throw new IllegalStateException("Unexpected value: " + cmCoupon.getCouponType());
+        }
+    }
+
+    public void setCouponMessage(MessageCenter messageCenter, List<Integer> clubIds, String sms, List<User> users) {
+        if (null != clubIds && clubIds.size() > 0) {
+            clubIds.forEach(c -> {
+                CmUser user = messageCenterDao.clubList(c);
+                messageCenter.clubId(c);
+                messageCenterDao.addMessageCenter(messageCenter);
+                SMSUtils.sendSms(3, user.getBindMobile(), sms);
+            });
+        } else if (null != users && users.size() > 0) {
+            messageCenterDao.addMessageCenter(messageCenter);
+            users.forEach(u -> {
+                messageCenter.clubId(u.getClubID());
+                messageCenterDao.addMessageCenter(messageCenter);
+                SMSUtils.sendSms(3, u.getBindMobile(), sms);
+            });
+        }
+    }
+}

+ 1 - 1
src/main/java/com/caimei/modules/coupon/web/CmCouponClubTask.java

@@ -17,7 +17,7 @@ import java.util.concurrent.ThreadPoolExecutor;
 @Configuration
 @Configuration
 @EnableAsync
 @EnableAsync
 public class CmCouponClubTask {
 public class CmCouponClubTask {
-    @Bean(name="new_coupn")
+    @Bean(name="mytask")
     public Executor taskExecutor(){
     public Executor taskExecutor(){
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
         executor.setCorePoolSize(10);
         executor.setCorePoolSize(10);

+ 11 - 240
src/main/java/com/caimei/modules/coupon/web/CmCouponController.java

@@ -3,7 +3,7 @@ package com.caimei.modules.coupon.web;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCouponAssociate;
 import com.caimei.modules.coupon.entity.CmCouponAssociate;
 import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
 import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
-import com.caimei.modules.coupon.redis.RedisLearn;
+import com.caimei.modules.coupon.service.AsyncService;
 import com.caimei.modules.coupon.service.CmCouponService;
 import com.caimei.modules.coupon.service.CmCouponService;
 import com.caimei.modules.order.dao.NewShopOrderDao;
 import com.caimei.modules.order.dao.NewShopOrderDao;
 import com.caimei.modules.order.service.NewOrderService;
 import com.caimei.modules.order.service.NewOrderService;
@@ -18,36 +18,31 @@ import com.caimei.modules.user.entity.CmUser;
 import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.NewCmClub;
 import com.caimei.modules.user.entity.NewCmClub;
 import com.caimei.modules.user.entity.NewCmShop;
 import com.caimei.modules.user.entity.NewCmShop;
+import com.caimei.po.User;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.AppUtils;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.utils.JedisUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.web.BaseController;
 import com.thinkgem.jeesite.common.web.BaseController;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
-import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-import redis.clients.jedis.Jedis;
 
 
+import javax.servlet.annotation.WebServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.*;
+
 
 
 /**
 /**
  * 优惠券管理Controller
  * 优惠券管理Controller
@@ -77,6 +72,8 @@ public class CmCouponController extends BaseController {
     private WeChatService weChatService;
     private WeChatService weChatService;
     @Value("${wwwServer}")
     @Value("${wwwServer}")
     private String domain;
     private String domain;
+    @Autowired
+    private AsyncService asyncService;
 
 
     @ModelAttribute
     @ModelAttribute
     public CmCoupon get(@RequestParam(required = false) String id) {
     public CmCoupon get(@RequestParam(required = false) String id) {
@@ -91,8 +88,6 @@ public class CmCouponController extends BaseController {
     }
     }
 
 
 
 
-
-
     @RequiresPermissions("coupon:cmCoupon:view")
     @RequiresPermissions("coupon:cmCoupon:view")
     @RequestMapping(value = {"list", ""})
     @RequestMapping(value = {"list", ""})
     public String list(CmCoupon cmCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
     public String list(CmCoupon cmCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
@@ -156,238 +151,14 @@ public class CmCouponController extends BaseController {
         }
         }
     }
     }
 
 
-
-
-
-
-    //优惠券站内消息推送
-    private void consumer(CmCoupon cmCoupon, List<Integer> clubIds) {
-        // 消费消息
-            clubIds.forEach(clubIdb -> {
-                        Jedis jedis = null;
-                        String constraint = "";
-                        if (domain.contains("-b")) {
-                            jedis = new Jedis("172.31.165.27", 6379);
-                            jedis.auth("6#xsI%b4o@5c3RoE");
-                        } else if (domain.contains("localhost")) {
-                            jedis = new Jedis("192.168.2.100", 6379);
-                        } else {
-                            jedis = new Jedis("172.31.165.23", 6379);
-                        }
-                        // 获取消息
-                        String clubIdc = jedis.rpop("mess" + clubIdb.toString());
-                        Integer clubId = clubIdb;
-                        if (clubId != null) {
-                            Date date = new Date();
-                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-                            CmUser user = messageCenterDao.clubList(clubId);
-                            int coumt = 0;//计数五种消息只推送一条
-                            String catego = "";
-                            Integer ts = (date.compareTo(cmCoupon.getStartDate()));
-                            if (ts >= 0) {
-                                if ("90".equals(user.getClubStatus()) && 0 == cmCoupon.getCouponType()) {
-                                    CmCoupon coupon = messageCenterDao.CouponList(0);//查询活动优惠券信息
-                                    if (coupon != null) {
-                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                                        MessageCenter messageCenter = new MessageCenter();
-                                        messageCenter.setShopId(null);
-                                        messageCenter.setClubId(clubIdb);
-                                        messageCenter.setUserType(1);
-                                        messageCenter.setMessageType(4);
-                                        messageCenter.setContent(null);
-                                        messageCenter.setTime(curDateStr);
-                                        messageCenter.setCouponType(0);
-                                        messageCenter.setCouponMessageType(1);
-                                        messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
-                                        messageCenterDao.addMessageCenter(messageCenter);
-                                        String content = "采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
-                                        boolean sendSms = false;
-                                        try {
-                                            sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
-                                        } catch (Exception e) {
-                                            e.printStackTrace();
-                                        }
-                                        if (sendSms) {
-                                            logger.info(">>>>>>>发送成功");
-                                        }
-                                        jedis.del("mess" + clubIdc);
-                                        coumt++;
-                                    }
-                                }
-                                if ("90".equals(user.getClubStatus()) && coumt == 0 && 1 == cmCoupon.getCouponType()) {
-                                    CmCoupon coupon = messageCenterDao.CouponList(1);//查询品类优惠券信息
-                                    if (coupon != null) {
-                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                                        MessageCenter messageCenter = new MessageCenter();
-                                        messageCenter.setShopId(null);
-                                        messageCenter.setClubId(clubIdb);
-                                        messageCenter.setUserType(1);
-                                        messageCenter.setMessageType(4);
-                                        if (cmCoupon != null && "1".equals(cmCoupon.getCategoryType())) {
-                                            catego = "产品";
-                                        }
-                                        if (cmCoupon != null && "2".equals(cmCoupon.getCategoryType())) {
-                                            catego = "仪器";
-                                        }
-                                        messageCenter.setContent(catego);
-                                        messageCenter.setTime(curDateStr);
-                                        messageCenter.setCouponType(1);
-                                        messageCenter.setCouponMessageType(1);
-                                        messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
-                                        messageCenterDao.addMessageCenter(messageCenter);
-                                        String content = "采美平台" + catego + "类商品大优惠,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
-                                        boolean sendSms = false;
-                                        try {
-                                            sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
-                                        } catch (Exception e) {
-                                            e.printStackTrace();
-                                        }
-                                        if (sendSms) {
-                                            logger.info(">>>>>>>发送成功");
-                                        }
-
-                                        jedis.del("mess" + clubIdc);
-                                        coumt++;
-                                    }
-                                }
-                                if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
-                                    CmCoupon coupon = messageCenterDao.CouponList(2);//查询用户专享优惠券信息
-                                    if (coupon != null && cmCoupon.getUserId() != null) {
-                                        if (coupon.getUserId().equals(cmCoupon.getUserId())) {
-                                            Integer clubc = messageCenterDao.clubIdCule(cmCoupon.getUserId());
-                                            String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-
-
-                                            jedis.del("mess" + clubIdc);
-                                            coumt++;
-                                        }
-                                    }
-                                }
-                                if ("90".equals(user.getClubStatus()) && coumt == 0 && 3 == cmCoupon.getCouponType()) {
-                                    CmCoupon coupon = messageCenterDao.CouponList(3);//查询店铺优惠券信息
-                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                                        String shopName = messageCenterDao.shopName(cmCoupon.getShopId());
-                                        Integer userID = messageCenterDao.userID(cmCoupon.getShopId());
-                                        Integer clubID = messageCenterDao.clubIdCule(userID);
-                                        MessageCenter messageCenter = new MessageCenter();
-                                        messageCenter.setShopId(null);
-                                        messageCenter.setClubId(clubIdb);
-                                        messageCenter.setUserType(1);
-                                        messageCenter.setMessageType(4);
-                                        messageCenter.setContent(shopName);
-                                        messageCenter.setTime(curDateStr);
-                                        messageCenter.setCouponType(3);
-                                        messageCenter.setCouponMessageType(1);
-                                        messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
-                                        messageCenterDao.addMessageCenter(messageCenter);
-                                        String content = "采美平台为了回馈客户,赠送您" + cmCoupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
-                                        boolean sendSms = false;
-                                        try {
-                                            sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
-                                        } catch (Exception e) {
-                                            e.printStackTrace();
-                                        }
-                                        if (sendSms) {
-                                            logger.info(">>>>>>>发送成功");
-                                        }
-                                    jedis.del("mess" + clubIdc);
-                                    coumt++;
-                                }
-                            if (coumt == 0 && 4 == cmCoupon.getCouponType()) {
-                                CmCoupon coupon = messageCenterDao.CouponList(4);//查询优惠券信息
-                                if (coupon != null) {
-                                    String startDate = sdf.format(coupon.getStartDate());
-                                    Calendar calendars = Calendar.getInstance();
-                                    Date receiptime = new Date();
-                                    try {
-                                        receiptime = sdf.parse(user.getRegisterTime());
-                                    } catch (ParseException e) {
-                                        e.printStackTrace();
-                                    }
-                                    calendars.setTime(receiptime);
-                                    calendars.add(Calendar.HOUR, -6);
-                                    String hTimes=sdf.format(calendars.getTime());
-                                    int num = startDate.compareTo(hTimes);
-                                    if (num >= 0) {
-                                        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                                        MessageCenter messageCenter = new MessageCenter();
-                                        if (coupon != null && coupon.getUserId() != null) {
-                                            messageCenter.setShopId(null);
-                                            messageCenter.setClubId(clubIdb);
-                                            messageCenter.setUserType(1);
-                                            messageCenter.setMessageType(4);
-                                            messageCenter.setContent(null);
-                                            messageCenter.setTime(curDateStr);
-                                            messageCenter.setCouponType(4);
-                                            messageCenter.setCouponMessageType(1);
-                                            messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
-                                            messageCenterDao.addMessageCenter(messageCenter);
-
-                                            String content = "恭喜成功注册采美平台。采美平台赠送您" + cmCoupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
-                                            boolean sendSms = false;
-                                            try {
-                                                sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
-                                            } catch (Exception e) {
-                                                e.printStackTrace();
-                                            }
-                                            if (sendSms) {
-                                                logger.info(">>>>>>>发送成功");
-                                            }
-                                            jedis.del("mess" + clubIdc);
-                                            coumt++;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                jedis.del("mess" + clubIdc);
-                System.out.println(jedis.rpop("mess" + clubIdc));
-            });
-
-        }
-
     @RequestMapping(value = "save")
     @RequestMapping(value = "save")
-    public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) throws ParseException {
+    public String save(CmCoupon cmCoupon, Model model, RedirectAttributes redirectAttributes) {
         if (!beanValidator(model, cmCoupon)) {
         if (!beanValidator(model, cmCoupon)) {
             return form(cmCoupon, model);
             return form(cmCoupon, model);
         }
         }
-        Date date=new Date();
-        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-//        ExecutorService pool = Executors.newFixedThreadPool(3);
-        List<Integer> clubIds = messageCenterDao.ClubIds();
-
-//        new Thread(() -> consumer(cmCoupon, clubIds)).start();
         //等于空就是添加否则是修改
         //等于空就是添加否则是修改
-        if("".equals(cmCoupon.getId())){
-//        consumer(cmCoupon, clubIds);
-//        RedisLearn.producer(clubIds);
-        MessageCenter messageCenter = new MessageCenter();
-        if (cmCoupon.getUserId() != null) {
-            Integer clubc = messageCenterDao.clubIdCule(cmCoupon.getUserId());
-            CmUser user = messageCenterDao.clubList(clubc);
-            messageCenter.setShopId(null);
-            messageCenter.setClubId(clubc);
-            messageCenter.setUserType(1);
-            messageCenter.setMessageType(4);
-            messageCenter.setContent(null);
-            messageCenter.setTime(curDateStr);
-            messageCenter.setCouponType(2);
-            messageCenter.setCouponMessageType(1);
-            messageCenter.setCouponFee(cmCoupon.getCouponAmount().doubleValue());
-            messageCenterDao.addMessageCenter(messageCenter);
-            String content = "为了答谢您对采美平台的支持,采美平台送您" + cmCoupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。退订回T";
-            boolean sendSms = false;
-            try {
-                sendSms = SMSUtils.sendSms(3,user.getBindMobile(), content);
-//                sendSms =  SMSUtils.sendSms( user.getBindMobile(), content);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            if (sendSms) {
-                logger.info(">>>>>>>发送成功");
-            }
-        }
+        if ("".equals(cmCoupon.getId())) {
+            asyncService.consumer(cmCoupon);
         }
         }
         cmCouponService.save(cmCoupon);
         cmCouponService.save(cmCoupon);
         addMessage(redirectAttributes, "保存优惠券成功");
         addMessage(redirectAttributes, "保存优惠券成功");

+ 2 - 0
src/main/java/com/caimei/modules/order/dao/CmOfflineCollectionDao.java

@@ -41,6 +41,8 @@ public interface CmOfflineCollectionDao extends CrudDao<CmOfflineCollection> {
     // 银行账号逻辑删除
     // 银行账号逻辑删除
     void updateBank(@Param("id") String id);
     void updateBank(@Param("id") String id);
 
 
+    // 旧表银行账号删除
+    void delReceipt(@Param("id") Integer id);
     // 获取下拉列表
     // 获取下拉列表
     List<CmOfflineCollection> downList();
     List<CmOfflineCollection> downList();
 
 

+ 3 - 0
src/main/java/com/caimei/modules/order/dao/CmPayShopDao.java

@@ -3,6 +3,7 @@ package com.caimei.modules.order.dao;
 import com.caimei.modules.order.entity.CmDiscernReceipt;
 import com.caimei.modules.order.entity.CmDiscernReceipt;
 import com.caimei.modules.order.entity.CmPayShop;
 import com.caimei.modules.order.entity.CmPayShop;
 import com.caimei.modules.order.entity.NewShopOrder;
 import com.caimei.modules.order.entity.NewShopOrder;
+import com.caimei.modules.product.entity.Product;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -30,4 +31,6 @@ public interface CmPayShopDao extends CrudDao<CmPayShop> {
     List<Integer> getShopOrderIdsList(@Param("payShopID") String payShopID);
     List<Integer> getShopOrderIdsList(@Param("payShopID") String payShopID);
 
 
     List<CmDiscernReceipt> getDiscernReceipts(Integer shopOrderId);
     List<CmDiscernReceipt> getDiscernReceipts(Integer shopOrderId);
+
+    List<Product> priceNum(@Param("orderNo") String orderNo);
 }
 }

+ 31 - 5
src/main/java/com/caimei/modules/order/service/CmOfflineCollectionService.java

@@ -46,12 +46,12 @@ public class CmOfflineCollectionService extends CrudService<CmOfflineCollectionD
         int typeMax = cmOfflineCollectionDao.typeMax();
         int typeMax = cmOfflineCollectionDao.typeMax();
         typeMax = typeMax +1;
         typeMax = typeMax +1;
         cmOfflineCollection.setType(typeMax);
         cmOfflineCollection.setType(typeMax);
-        // 酒标银行账号添加
+        // 旧表银行账号添加
         CmReceiType receiType = new CmReceiType();
         CmReceiType receiType = new CmReceiType();
         receiType.setId(cmOfflineCollection.getType());
         receiType.setId(cmOfflineCollection.getType());
         receiType.setType(cmOfflineCollection.getBankAccount());
         receiType.setType(cmOfflineCollection.getBankAccount());
-        // 线下银行账号数据添加
         cmOfflineCollectionDao.insReceipt(receiType);
         cmOfflineCollectionDao.insReceipt(receiType);
+        // 线下银行账号数据添加
         int i = cmOfflineCollectionDao.insBank(cmOfflineCollection);
         int i = cmOfflineCollectionDao.insBank(cmOfflineCollection);
         if (i > 0) {
         if (i > 0) {
             return true;
             return true;
@@ -59,6 +59,11 @@ public class CmOfflineCollectionService extends CrudService<CmOfflineCollectionD
         return false;
         return false;
     }
     }
 
 
+    /**
+     * 设置商城显示
+     * @param cmOfflineCollection
+     * @return
+     */
     @Transactional(readOnly = false)
     @Transactional(readOnly = false)
     public Boolean upBankDisplay (CmOfflineCollection cmOfflineCollection) {
     public Boolean upBankDisplay (CmOfflineCollection cmOfflineCollection) {
         int i = cmOfflineCollectionDao.upBankDisplay(cmOfflineCollection);
         int i = cmOfflineCollectionDao.upBankDisplay(cmOfflineCollection);
@@ -68,6 +73,11 @@ public class CmOfflineCollectionService extends CrudService<CmOfflineCollectionD
         return false;
         return false;
     }
     }
 
 
+    /**
+     * 设为商城不显示
+      * @param cmOfflineCollection
+     * @return
+     */
     @Transactional(readOnly = false)
     @Transactional(readOnly = false)
     public Boolean NoBankDisplay (CmOfflineCollection cmOfflineCollection) {
     public Boolean NoBankDisplay (CmOfflineCollection cmOfflineCollection) {
         int i = cmOfflineCollectionDao.upNoBankDisplay(cmOfflineCollection);
         int i = cmOfflineCollectionDao.upNoBankDisplay(cmOfflineCollection);
@@ -83,23 +93,39 @@ public class CmOfflineCollectionService extends CrudService<CmOfflineCollectionD
         return bankData;
         return bankData;
     }
     }
 
 
-    // 编辑页面修改保存
+    /**
+     * 编辑页面修改保存
+      * @param cmOfflineCollection
+     */
     @Transactional(readOnly = false)
     @Transactional(readOnly = false)
     public void editData(CmOfflineCollection cmOfflineCollection) {
     public void editData(CmOfflineCollection cmOfflineCollection) {
         cmOfflineCollectionDao.edit(cmOfflineCollection);
         cmOfflineCollectionDao.edit(cmOfflineCollection);
     }
     }
 
 
+    /**
+     * 银行账号禁用
+     * @param cmOfflineCollection
+     */
     @Transactional(readOnly = false)
     @Transactional(readOnly = false)
     public void updateBank(CmOfflineCollection cmOfflineCollection) {
     public void updateBank(CmOfflineCollection cmOfflineCollection) {
+        // 线下收款列表银行禁用
         cmOfflineCollectionDao.updateBank(cmOfflineCollection.getId());
         cmOfflineCollectionDao.updateBank(cmOfflineCollection.getId());
+        // 旧表银行删除
+        cmOfflineCollectionDao.delReceipt(cmOfflineCollection.getType());
     }
     }
 
 
-    // 线下收款账号下拉列表
+    /**
+     * 线下收款账号下拉列表
+     * @return
+     */
     public List<CmOfflineCollection> downListData() {
     public List<CmOfflineCollection> downListData() {
         return cmOfflineCollectionDao.downList();
         return cmOfflineCollectionDao.downList();
     }
     }
 
 
-    // 下拉列表获取所有线下收款账号
+    /**
+     * 下拉列表获取所有线下收款账号
+      * @return
+     */
     public List<CmReceiType> downAllListData() {
     public List<CmReceiType> downAllListData() {
         return cmOfflineCollectionDao.downAllList();
         return cmOfflineCollectionDao.downAllList();
     }
     }

+ 52 - 7
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -11,6 +11,7 @@ import com.caimei.modules.order.utils.Disguiser;
 import com.caimei.modules.order.utils.MyBeanUtils;
 import com.caimei.modules.order.utils.MyBeanUtils;
 import com.caimei.modules.order.utils.RSA;
 import com.caimei.modules.order.utils.RSA;
 import com.caimei.modules.order.utils.SettlePostFormUtil;
 import com.caimei.modules.order.utils.SettlePostFormUtil;
+import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.modules.user.entity.NewCmShop;
 import com.caimei.modules.user.entity.NewCmShop;
@@ -232,8 +233,10 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                  1. 若发生退货,数量要减去已退货和已取消的数量
                  1. 若发生退货,数量要减去已退货和已取消的数量
                  2. 有赠品的商品只能全退
                  2. 有赠品的商品只能全退
                  */
                  */
+
+                Integer returnNum = 0;
                 for (NewOrderProduct p : orderProductList) {
                 for (NewOrderProduct p : orderProductList) {
-                    Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
+                    returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
                     returnNum = returnNum == null ? 0 : returnNum;
                     returnNum = returnNum == null ? 0 : returnNum;
                     p.setReturnedNum(returnNum);
                     p.setReturnedNum(returnNum);
                 }
                 }
@@ -279,8 +282,29 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
                 List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
                 so.setShopOrderNos(strings);
                 so.setShopOrderNos(strings);
                 //主订单总佣金
                 //主订单总佣金
+                List<Product> product = cmPayShopDao.priceNum(so.getOrderNo());
+                // 计算订单总佣金
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
-                so.setIncome(income);
+                if(returnNum != null) {
+                    if(product != null) {
+                        for (Product pro : product) {
+                            Integer number = newOrderProductDao.CountReturnedPurchaseProduct(pro.getShopOrderID(), pro.getOrderProductID());
+                            Double commission = 0.0;
+                            if(number != null && number != 0) {
+                                if (pro.getTaxRate() != null && pro.getTaxRate() != 0) {
+                                    commission = (pro.getPrice() + pro.getPrice() * (pro.getTaxRate() / 100)) - (Double.parseDouble(pro.getCostPrice()) + Double.parseDouble(pro.getCostPrice()) * (pro.getTaxRate() / 100));
+                                } else {
+                                    commission = pro.getPrice() - Double.parseDouble(pro.getCostPrice());
+                                }
+                                income -= (commission * number);
+
+                            }
+                        }
+                        so.setIncome(income);
+                    }
+                } else {
+                    so.setIncome(income);
+                }
                 //若成本下降太多导致部分收款的钱,已经大于成本重新计算佣金
                 //若成本下降太多导致部分收款的钱,已经大于成本重新计算佣金
                 if ("0".equals(newOrder.getOnlinePayFlag()) && so.getShopReceiptStatus() == 2) {
                 if ("0".equals(newOrder.getOnlinePayFlag()) && so.getShopReceiptStatus() == 2) {
                     double mum = so.getProductAmount();
                     double mum = so.getProductAmount();
@@ -346,9 +370,11 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 }
                 }
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
                 /* 退货数量 */
                 /* 退货数量 */
+                Integer count = 0;
                 for (NewOrderProduct p : orderProductList) {
                 for (NewOrderProduct p : orderProductList) {
-                    Integer count = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
-                    p.setReturnedNum(count == null ? 0 : count);
+                    count = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
+                    count = count == null ? 0 : count;
+                    p.setReturnedNum(count);
                 }
                 }
                 if (so.getShopPostFee() == null) so.setShopPostFee(0D);
                 if (so.getShopPostFee() == null) so.setShopPostFee(0D);
                 if (so.getShopTaxFee() == null) so.setShopTaxFee(0D);
                 if (so.getShopTaxFee() == null) so.setShopTaxFee(0D);
@@ -392,8 +418,26 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
                 List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
                 so.setShopOrderNos(strings);
                 so.setShopOrderNos(strings);
                 //主订单总佣金
                 //主订单总佣金
+                List<Product> product = cmPayShopDao.priceNum(so.getOrderNo());
+                // 计算佣金
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
-                so.setIncome(income);
+                if(count != 0) {
+                    for(Product pro: product) {
+                        Double commission = pro.getPrice() - Double.parseDouble(pro.getCostPrice());
+                        Integer number = newOrderProductDao.CountReturnedPurchaseProduct(pro.getShopOrderID(), pro.getOrderProductID());
+                        if(number != null && number != 0) {
+                            if (pro.getTaxRate() != null && pro.getTaxRate() != 0) {
+                                commission = (pro.getPrice() + pro.getPrice() * (pro.getTaxRate() / 100)) - (Double.parseDouble(pro.getCostPrice()) + Double.parseDouble(pro.getCostPrice()) * (pro.getTaxRate() / 100));
+                            } else {
+                                commission = pro.getPrice() - Double.parseDouble(pro.getCostPrice());
+                            }
+                            income -= (commission * number);
+                        }
+                    }
+                    so.setIncome(income);
+                } else {
+                    so.setIncome(income);
+                }
             }
             }
 
 
             cmPayShop.setShopOrders(csos);
             cmPayShop.setShopOrders(csos);
@@ -1237,7 +1281,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         }
         }
     }
     }
 
 
-    @Transactional(readOnly = false,rollbackFor = Exception.class)
+    @Transactional(readOnly = false, rollbackFor = Exception.class)
     public void settlement(String shopOrderId, Double settleAmount) throws Exception {
     public void settlement(String shopOrderId, Double settleAmount) throws Exception {
         // 结算付供应商
         // 结算付供应商
         String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
         String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
@@ -1252,7 +1296,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         }
         }
     }
     }
 
 
-    @Transactional(readOnly = false,rollbackFor = Exception.class)
+    @Transactional(readOnly = false, rollbackFor = Exception.class)
     public void settleOrder(String P2_orderId, Double settleAmount, String P3_customerNumber, String shopOrderId, Integer settleFlag) throws Exception {
     public void settleOrder(String P2_orderId, Double settleAmount, String P3_customerNumber, String shopOrderId, Integer settleFlag) throws Exception {
         //子订单id,结算金额
         //子订单id,结算金额
         Map<String, String> sPara = new HashMap<String, String>();
         Map<String, String> sPara = new HashMap<String, String>();
@@ -1268,6 +1312,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 .append(Constant.SPLIT).append("RSA");
                 .append(Constant.SPLIT).append("RSA");
         String sign = RSA.sign(sb.toString(), RSA.getPrivateKey(Constant.signKey_setttlement));
         String sign = RSA.sign(sb.toString(), RSA.getPrivateKey(Constant.signKey_setttlement));
         sPara.put("sign", sign);
         sPara.put("sign", sign);
+        logger.info("发送结算参数-----------------------》" + sPara);
         SettleResult settleResult = SettlePostFormUtil.postForm(sPara, Constant.JS, sign, SettleResult.class);
         SettleResult settleResult = SettlePostFormUtil.postForm(sPara, Constant.JS, sign, SettleResult.class);
         if (!"0000".equals(settleResult.getRt2_retCode())) {
         if (!"0000".equals(settleResult.getRt2_retCode())) {
             logger.info("settleResult----------------->" + settleResult.toString());
             logger.info("settleResult----------------->" + settleResult.toString());

+ 1 - 1
src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java

@@ -569,7 +569,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                 //部分退货
                 //部分退货
                 newOrder.setRefundType("1");
                 newOrder.setRefundType("1");
             }
             }
-            if (newOrder.getRechargeGoods() != null) {
+            if (newOrder.getRechargeGoods() != null && newOrder.getRechargeGoods() != 3) {
                 newOrder.setStatus(NewOrderStatus.WAIT_COMMENT.getCode());
                 newOrder.setStatus(NewOrderStatus.WAIT_COMMENT.getCode());
             }
             }
             newOrderService.update(newOrder);
             newOrderService.update(newOrder);

+ 31 - 0
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -285,6 +285,13 @@ public class Product extends DataEntity<Product> {
      */
      */
     public String qualificationLink;
     public String qualificationLink;
 
 
+    //子订单ID
+    private Integer shopOrderID;
+    //订单商品ID
+    private Integer orderProductID;
+    //税率
+    private Double taxRate;
+
     public String[] getValidFlagString() {
     public String[] getValidFlagString() {
         return validFlagString;
         return validFlagString;
     }
     }
@@ -1696,4 +1703,28 @@ public class Product extends DataEntity<Product> {
     public void setReceiptID(String receiptID) {
     public void setReceiptID(String receiptID) {
         this.receiptID = receiptID;
         this.receiptID = receiptID;
     }
     }
+
+    public Integer getShopOrderID() {
+        return shopOrderID;
+    }
+
+    public void setShopOrderID(Integer shopOrderID) {
+        this.shopOrderID = shopOrderID;
+    }
+
+    public Integer getOrderProductID() {
+        return orderProductID;
+    }
+
+    public void setOrderProductID(Integer orderProductID) {
+        this.orderProductID = orderProductID;
+    }
+
+    public Double getTaxRate() {
+        return taxRate;
+    }
+
+    public void setTaxRate(Double taxRate) {
+        this.taxRate = taxRate;
+    }
 }
 }

+ 0 - 14
src/main/java/com/caimei/modules/sys/dao/NotificationDao.java

@@ -17,15 +17,6 @@ import java.util.List;
 @MyBatisDao
 @MyBatisDao
 public interface NotificationDao extends CrudDao<Notification> {
 public interface NotificationDao extends CrudDao<Notification> {
 
 
-    //查询几月后过期
-    List<Product> productTypeCount(Integer yat);
-    //查询几日后过期
-    List<Product> productTypeCount1(Integer yat);
-   //查询上架费几月后过期
-    List<Product> productTypeCount2(Integer yat);
-    //查询上架费几日后过期
-    List<Product> productTypeCount3(Integer yat);
-
     List<Notification>notification(Notification notification);
     List<Notification>notification(Notification notification);
 
 
     String notificationId(Notification notification);
     String notificationId(Notification notification);
@@ -35,9 +26,4 @@ public interface NotificationDao extends CrudDao<Notification> {
     void hide(@Param("hide")Integer hide, @Param("Id") Integer Id);
     void hide(@Param("hide")Integer hide, @Param("Id") Integer Id);
 
 
     void hides();
     void hides();
-
-    void addNotification(Notification notification);
-
-    Integer count();
-
 }
 }

+ 73 - 86
src/main/java/com/caimei/modules/sys/utils/SMSUtils.java

@@ -2,6 +2,7 @@ package com.caimei.modules.sys.utils;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.config.Global;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.client.RestTemplate;
@@ -9,92 +10,78 @@ import org.springframework.web.client.RestTemplate;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
+@Slf4j
 public class SMSUtils {
 public class SMSUtils {
 
 
-	/**
-	 * key
-	 */
-	private static final String ACCOUNT = "account";
-	private static final String PASSWORD = "password";
-	/**
-	 * 通知短信 账户
-	 */
-	private static final String ACCOUNT_NOTICE = "N2532063";
-	private static final String PASSWORD_NOTICE = "jzVvYmuP4D7f1b";
-	/**
-	 * 验证码短信 账户
-	 */
-	private static final String ACCOUNT_YZM = "YZM6372171";
-	private static final String PASSWORD_YZM = "1L8ZaIEW7fa3ca";
-	/**
-	 * 营销短信 账户
-	 */
-	private static final String ACCOUNT_ADS = "M1666161";
-	private static final String PASSWORD_ADS = "TO3xSGvEUk6ddc";
-	/**
-	 * 请求地址
-	 */
-	private static final String SMS_URL = "http://smssh1.253.com/msg/send/json";
+    /**
+     * key
+     */
+    private static final String ACCOUNT = "account";
+    private static final String PASSWORD = "password";
+    /**
+     * 通知短信 账户
+     */
+    private static final String ACCOUNT_NOTICE = "N2532063";
+    private static final String PASSWORD_NOTICE = "jzVvYmuP4D7f1b";
+    /**
+     * 验证码短信 账户
+     */
+    private static final String ACCOUNT_YZM = "YZM6372171";
+    private static final String PASSWORD_YZM = "1L8ZaIEW7fa3ca";
+    /**
+     * 营销短信 账户
+     */
+    private static final String ACCOUNT_ADS = "M1666161";
+    private static final String PASSWORD_ADS = "TO3xSGvEUk6ddc";
+    /**
+     * 请求地址
+     */
+    private static final String SMS_URL = "http://smssh1.253.com/msg/send/json";
 
 
-
-//	private static String url = "http://47.96.109.82:9999/sms.aspx";
-//	private static String userid = "321";
-//	private static String account = "0755cmxx";
-//	private static String password = "CaimeiSMS999";
-
-	public static boolean sendSms(Integer type, String mobile, String content) {
-
-//		String res = SmsClientSend.sendSms(url, userid, account, password, mobile, content);
-//		return res.indexOf("Success") != -1;
-
-//		JSONObject params = new JSONObject();
-//		if (null != type && 2 == type) {
-//			// 验证码短信
-//			params.put(ACCOUNT, ACCOUNT_YZM);
-//			params.put(PASSWORD, PASSWORD_YZM);
-//		} else if (null != type && 3 == type) {
-//			// 营销短信
-//			params.put(ACCOUNT, ACCOUNT_ADS);
-//			params.put(PASSWORD, PASSWORD_ADS);
-//		} else {
-//			// 通知短信
-//			params.put(ACCOUNT, ACCOUNT_NOTICE);
-//			params.put(PASSWORD, PASSWORD_NOTICE);
-//		}
-
-		// 获取core服务器地址
-		List<String> list = new ArrayList<>();
-		list.add("15917362709");
-		list.add("15814011616");
-		list.add("13100721916");
-		list.add("15113936829");
-		list.add("15827317748");
-		list.add("18476937515");
-		list.add("18175515644");
-		if (list.contains(mobile)) {
-			String coreServer = Global.getConfig("caimei.core");
-			RestTemplate restTemplate = new RestTemplate();
-			String uri = coreServer + "/tools/sms/send";
-			// 发起Post请求
-			MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
-			paramMap.add("type", type.toString());
-			paramMap.add("mobile", mobile);
-			paramMap.add("content", content);
-			String result = restTemplate.postForObject(uri, paramMap, String.class);
-
-			System.out.println(result);
-			JSONObject json = (JSONObject) JSONObject.parse(result);
-			if (null != json && json.getInteger("code") == 0) {
-				return true;
-			} else {
-				return false;
-			}
-		}
-		return false;
-	}
-//		public static void main (String[]args){
-////		String e="abc";
-////		System.out.println(sendSms(3,"1817515644", "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + e + "”资质证书将于3个月后失效,请及时登录采美网站上传新证书。"));
-////		 System.out.println(sendSms("18175515644", "您短信验证码是:7895"));
-//		}
-	}
+    public static boolean sendSms(Integer type, String mobile, String content) {
+        String wwwServer = Global.getConfig("wwwServer");
+        JSONObject params = new JSONObject();
+        if (null != type && 2 == type) {
+            // 验证码短信
+            params.put(ACCOUNT, ACCOUNT_YZM);
+            params.put(PASSWORD, PASSWORD_YZM);
+        } else if (null != type && 3 == type) {
+            // 营销短信
+            params.put(ACCOUNT, ACCOUNT_ADS);
+            params.put(PASSWORD, PASSWORD_ADS);
+        } else {
+            // 通知短信
+            params.put(ACCOUNT, ACCOUNT_NOTICE);
+            params.put(PASSWORD, PASSWORD_NOTICE);
+        }
+        // 获取core服务器地址
+        List<String> list = new ArrayList<>();
+        list.add("15917362709");
+        list.add("15814011616");
+        list.add("13100721916");
+        list.add("15113936829");
+        list.add("15827317748");
+        list.add("18476937515");
+        list.add("18175515644");
+        if (list.contains(mobile) || wwwServer.contains("www.caimei365.com")) {
+            String coreServer = Global.getConfig("caimei.core");
+            RestTemplate restTemplate = new RestTemplate();
+            String uri = coreServer + "/tools/sms/send";
+            // 发起Post请求
+            MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
+            paramMap.add("type", type.toString());
+            paramMap.add("mobile", mobile);
+            paramMap.add("content", content);
+            String result = restTemplate.postForObject(uri, paramMap, String.class);
+            JSONObject json = (JSONObject) JSONObject.parse(result);
+            if (null != json && json.getInteger("code") == 0) {
+                log.info("短信发送成功------------------->" + mobile + "内容---------------->" + content);
+                return true;
+            } else {
+                log.error("短信发送失败---------------->" + result);
+                return false;
+            }
+        }
+        return false;
+    }
+}

+ 36 - 448
src/main/java/com/caimei/modules/sys/web/NotificationController.java

@@ -1,18 +1,12 @@
 package com.caimei.modules.sys.web;
 package com.caimei.modules.sys.web;
 
 
-import com.caimei.modules.basesetting.entity.Province;
 import com.caimei.modules.order.dao.NewShopOrderDao;
 import com.caimei.modules.order.dao.NewShopOrderDao;
-import com.caimei.modules.order.entity.NewShopOrder;
 import com.caimei.modules.order.service.NewOrderService;
 import com.caimei.modules.order.service.NewOrderService;
 import com.caimei.modules.order.service.WeChatService;
 import com.caimei.modules.order.service.WeChatService;
-import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.sys.dao.NotificationDao;
 import com.caimei.modules.sys.dao.NotificationDao;
 import com.caimei.modules.sys.entity.Notification;
 import com.caimei.modules.sys.entity.Notification;
 import com.caimei.modules.sys.service.NotificationService;
 import com.caimei.modules.sys.service.NotificationService;
-import com.caimei.modules.sys.utils.SMSUtils;
 import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.modules.user.dao.MessageCenterDao;
-import com.caimei.modules.user.entity.MessageCenter;
-import com.caimei.utils.StringUtils;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.web.BaseController;
 import com.thinkgem.jeesite.common.web.BaseController;
@@ -20,19 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import redis.clients.jedis.Jedis;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.soap.Addressing;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -48,469 +35,70 @@ import java.util.List;
 public class NotificationController extends BaseController {
 public class NotificationController extends BaseController {
 
 
     @Autowired
     @Autowired
-    NotificationDao notificationDao;
+    private NotificationDao notificationDao;
     @Autowired
     @Autowired
-    NotificationService notificationService;
-    @Autowired
-    MessageCenterDao messageCenterDao;
-    @Autowired
-    NewOrderService newOrderService;
-    @Autowired
-    NewShopOrderDao newShopOrderDao;
-    @Autowired
-    WeChatService weChatService;
-    @Value("${wwwServer}")
-    private String domain;
-    @RequestMapping(value = {"list", ""})
-    public String list( Notification notifi,HttpServletRequest request, HttpServletResponse response, Model model) {
+    private NotificationService notificationService;
 
 
-      List<String> content=new ArrayList<>();
+    @RequestMapping(value = {"list", ""})
+    public String list(Notification notifi, HttpServletRequest request, HttpServletResponse response, Model model) {
         Page<Notification> page = notificationService.notificationPagen(new Page<Notification>(request, response), notifi);
         Page<Notification> page = notificationService.notificationPagen(new Page<Notification>(request, response), notifi);
-
-            String[] IdArr=null;
-            String[] porductIDs=null;
-            String[] shopIDs=null;
-             for (int i = 0; i < page.getList().size(); i++) {
-                IdArr =page.getList().get(i).getShopContent().split(",");
-                if(page.getList().get(i).getPorductID()!=null){porductIDs=page.getList().get(i).getPorductID().split(",");}
-                 if(page.getList().get(i).getShopID()!=null){shopIDs=page.getList().get(i).getShopID().split(",");}
-
-                page.getList().get(i).setContents(IdArr);
-                page.getList().get(i).setPorductIDs(porductIDs);
-                 page.getList().get(i).setShopIDs(shopIDs);
+        String[] IdArr = null;
+        String[] porductIDs = null;
+        String[] shopIDs = null;
+        for (int i = 0; i < page.getList().size(); i++) {
+            IdArr = page.getList().get(i).getShopContent().split(",");
+            if (page.getList().get(i).getPorductID() != null) {
+                porductIDs = page.getList().get(i).getPorductID().split(",");
+            }
+            if (page.getList().get(i).getShopID() != null) {
+                shopIDs = page.getList().get(i).getShopID().split(",");
             }
             }
+
+            page.getList().get(i).setContents(IdArr);
+            page.getList().get(i).setPorductIDs(porductIDs);
+            page.getList().get(i).setShopIDs(shopIDs);
+        }
         notificationDao.hides();
         notificationDao.hides();
         model.addAttribute("Notification", notifi);
         model.addAttribute("Notification", notifi);
         model.addAttribute("page", page);
         model.addAttribute("page", page);
         return "modules/sys/Notification";
         return "modules/sys/Notification";
     }
     }
 
 
-
-    /**
-     *constraint加入缓存
-     */
-    @Scheduled(cron = "0 0 23 * * ?")
-    public void Open() {
-//        Jedis jedis=new Jedis("172.31.165.27", 6379);
-//        jedis.auth("6#xsI%b4o@5c3RoE");
-        Jedis jedis=new Jedis("192.168.2.100", 6379);
-        jedis.lpush("constraint","0");
-    }
-
-    @Scheduled(cron = "0 0 11 * * ?")
-//@Scheduled(cron = "0 0/10 * * * ?")
-    public void mess() throws Exception {
-        Date date=new Date();
-        String name="";
-        Integer count=0;
-        List<Product>pro=notificationDao.productTypeCount(3);
-        List<Product>pro1=notificationDao.productTypeCount(1);
-        List<Product>pro2=notificationDao.productTypeCount1(7);
-        List<Product>pro3=notificationDao.productTypeCount1(1);
-        for (int i=0;i<pro.size();i++){
-            name=pro.get(i).getName();
-            if (name.length() > 10) {
-                name = StringUtils.strip(name.substring(0, 11));
-                name += "...";
-            }
-
-            logger.info("**************************质证书失效消息推送************************************");
-                try {
-                    Integer userID = messageCenterDao.userID(pro.get(i).getShopID());
-                   String shopName= messageCenterDao.shopName(pro.get(i).getShopID());
-                    String unionid = newShopOrderDao.UnionId(userID);
-                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
-                    String accessToken = weChatService.getAccessToken();
-                    String qualificationNo = pro.get(i).getQualificationNo();
-                    String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                    String pagePath = "";
-                    for (String openid : openidList) {
-                        weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
-                        count++;
-                    }
-                } catch (Exception e) {
-                    logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
-                }
-            if(count<=0) {
-                String bindMobile = messageCenterDao.Mobile(pro.get(i).getShopID());
-                String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于3个月后失效,请及时登录采美网站上传新证书。";
-                boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
-                if (sendSms) {
-                    logger.info(">>>>>>>资质证书将于3个月后失效短信推送成功");
-                }
-            }
-        }
-
-        for (int i=0;i<pro1.size();i++){
-            name=pro1.get(i).getName();
-            if (name.length() > 10) {
-                name = StringUtils.strip(name.substring(0, 11));
-                name += "...";
-            }
-
-            logger.info("**************************质证书失效消息推送************************************");
-            try {
-                Integer userID = messageCenterDao.userID(pro1.get(i).getShopID());
-                String shopName= messageCenterDao.shopName(pro1.get(i).getShopID());
-                String unionid = newShopOrderDao.UnionId(userID);
-                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
-                String accessToken = weChatService.getAccessToken();
-                String qualificationNo = pro1.get(i).getQualificationNo();
-                String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                String pagePath = "";
-                for (String openid : openidList) {
-                    weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
-                    count++;
-                }
-            } catch (Exception e) {
-                logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
-            }
-            if(count<=0) {
-                String bindMobile = messageCenterDao.Mobile(pro1.get(i).getShopID());
-                String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于1个月后失效,请及时登录采美网站上传新证书。";
-                boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
-                if (sendSms) {
-                    logger.info(">>>>>>>资质证书将于1个月后失效短信推送成功");
-                }
-            }
-        }
-
-        for (int i=0;i<pro2.size();i++){
-            name=pro2.get(i).getName();
-            if (name.length() > 10) {
-                name = StringUtils.strip(name.substring(0, 11));
-                name += "...";
-            }
-
-            logger.info("**************************质证书失效消息推送************************************");
-            try {
-                Integer userID = messageCenterDao.userID(pro2.get(i).getShopID());
-                String shopName= messageCenterDao.shopName(pro2.get(i).getShopID());
-                String unionid = newShopOrderDao.UnionId(userID);
-                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
-                String accessToken = weChatService.getAccessToken();
-                String qualificationNo = pro2.get(i).getQualificationNo();
-                String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                String pagePath = "";
-                for (String openid : openidList) {
-                    weChatService.messteme(accessToken, openid,shopName, qualificationNo, time, name, pagePath);
-                    count++;
-                }
-            } catch (Exception e) {
-                logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
-            }
-            if(count<=0) {
-                String bindMobile = messageCenterDao.Mobile(pro2.get(i).getShopID());
-                String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“" + name + "”资质证书将于7天后失效,请及时登录采美网站上传新证书。";
-                boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
-                if (sendSms) {
-                    logger.info(">>>>>>>资质证书将于7天后失效短信推送成功");
-                }
-            }
-        }
-
-        for (int i=0;i<pro3.size();i++){
-            name=pro3.get(i).getName();
-            if (name.length() > 10) {
-                name = StringUtils.strip(name.substring(0, 11));
-                name += "...";
-            }
-
-            logger.info("**************************质证书失效消息推送************************************");
-            try {
-                Integer userID = messageCenterDao.userID(pro3.get(i).getShopID());
-                String shopName= messageCenterDao.shopName(pro3.get(i).getShopID());
-                String unionid = newShopOrderDao.UnionId(userID);
-                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
-                String accessToken = weChatService.getAccessToken();
-                String qualificationNo = pro3.get(i).getQualificationNo();
-                String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                String pagePath = "";
-                for (String openid : openidList) {
-                    weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
-                    count++;
-                }
-            } catch (Exception e) {
-                logger.error("【质证书失效消息推送】获取微信公众号access_token异常!", e);
-            }
-if(count<=0){
-            String bindMobile= messageCenterDao.Mobile(pro3.get(i).getShopID());
-            String content = "【采美365】 尊敬的采美供应商用户,您在采美上架的商品“"+name+"”资质证书将于今天后失效,请及时登录采美网站上传新证书。";
-            boolean sendSms = SMSUtils.sendSms(1,bindMobile, content);
-            if(sendSms){
-                logger.info(">>>>>>>资质证书将于今天后后失效短信推送成功");
-            }
-        }
-        }
-
-    }
-
-
     @RequestMapping(value = {"update"})
     @RequestMapping(value = {"update"})
-    public String update( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model) {
+    public String update(Notification notification, HttpServletRequest request, HttpServletResponse response, Model model) {
         notificationDao.Upnotification(notification);
         notificationDao.Upnotification(notification);
-        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
+        return "redirect:" + Global.getAdminPath() + "/sys/Notification/list";
     }
     }
 
 
     @RequestMapping(value = {"updates"})
     @RequestMapping(value = {"updates"})
-    public void updates( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model) {
+    public void updates(Notification notification, HttpServletRequest request, HttpServletResponse response, Model model) {
         notificationDao.Upnotification(notification);
         notificationDao.Upnotification(notification);
     }
     }
 
 
     @RequestMapping(value = {"Idques"})
     @RequestMapping(value = {"Idques"})
-    public String Idques( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model){
-         String c= notificationDao.notificationId(notification);
-
+    public String Idques(Notification notification, HttpServletRequest request, HttpServletResponse response, Model model) {
+        String c = notificationDao.notificationId(notification);
         model.addAttribute("shopContent", c);
         model.addAttribute("shopContent", c);
-        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list?shopContent="+c;
+        return "redirect:" + Global.getAdminPath() + "/sys/Notification/list?shopContent=" + c;
     }
     }
 
 
     @RequestMapping(value = {"hide"})
     @RequestMapping(value = {"hide"})
-    public String hide( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model){
-        Integer hide=null;
-        if(notification.getHide() == 0){
-            hide=1;
-        }else{
-            hide=0;
+    public String hide(Notification notification, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Integer hide = null;
+        if (notification.getHide() == 0) {
+            hide = 1;
+        } else {
+            hide = 0;
         }
         }
-        notificationDao.hide(hide,Integer.parseInt(notification.getId()));
-        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
+        notificationDao.hide(hide, Integer.parseInt(notification.getId()));
+        return "redirect:" + Global.getAdminPath() + "/sys/Notification/list";
     }
     }
 
 
     @RequestMapping(value = {"hides"})
     @RequestMapping(value = {"hides"})
-    public String hides( Notification notification,HttpServletRequest request, HttpServletResponse response, Model model){
-
+    public String hides(Notification notification, HttpServletRequest request, HttpServletResponse response, Model model) {
         notificationDao.hides();
         notificationDao.hides();
-        return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
+        return "redirect:" + Global.getAdminPath() + "/sys/Notification/list";
     }
     }
-    @Scheduled(cron = "0 0 11 * * ?")
-//@Scheduled(cron = "0 0/1 * * * ?")
-    public void nottime(){
-        logger.info("》》》》》》》》》》》开始检测商品资质证书和上架费是否过期");
 
 
-        //械字号资质证书3个月后过期
-        Integer count=0;
-        String name="";
-        String productID="";
-        String shopID="";
-        Date date=new Date();
-        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-        //资质证书
-        List<Product>pro=notificationDao.productTypeCount(3);
-        List<Product>pro1=notificationDao.productTypeCount(1);
-        List<Product>pro2=notificationDao.productTypeCount1(7);
-        List<Product>pro3=notificationDao.productTypeCount1(1);
-        //上架费
-        List<Product>product=notificationDao.productTypeCount2(3);
-        List<Product>product1=notificationDao.productTypeCount2(1);
-        List<Product>product2=notificationDao.productTypeCount3(7);
-        List<Product>product3=notificationDao.productTypeCount3(1);
-//
-        Jedis jedis=null;
-        String constraint="";
-        if(domain.contains("-b")){
-            jedis=new Jedis("172.31.165.27", 6379);
-            jedis.auth("6#xsI%b4o@5c3RoE");
-        }else if(domain.contains("localhost")){
-            jedis=new Jedis("192.168.2.100", 6379);
-        }else {
-            jedis=new Jedis("172.31.165.23", 6379);
-        }
-
-        if(!"1".equals(jedis.rpop("constraint"))){
-            jedis.lpush("constraint","0");
-
-        }
-        constraint=jedis.rpop("constraint");
-        System.out.println(jedis.rpop("constraint"));
-//        if("0".equals(constraint)){
-            for (int i=0;i<pro.size();i++){
-                MessageCenter messageCenter = new MessageCenter();
-                messageCenter.setShopId(pro.get(i).getShopID());
-                messageCenter.setClubId(null);
-                messageCenter.setUserType(2);
-                messageCenter.setMessageType(2);
-                messageCenter.setShopMessType(5);
-                messageCenter.setProductId(pro.get(i).getProductID());
-                messageCenter.setContent("该商品的资质证书将于3个月后失效,请及时登录采美网站上传新证书。");
-                messageCenter.setTime(curDateStr);
-                messageCenterDao.addMessageCenter(messageCenter);
-
-                if(i!=0){
-                    name+=",";
-                    productID+=",";
-                }
-                name +="("+pro.get(i).getProductID().toString()+")"+pro.get(i).getName();
-                productID+=pro.get(i).getProductID().toString();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下械字号商品的资质证书将于3个月后失效,请及时提醒供应商更换证书。");
-                notification.setShopContent(name);
-                notification.setPorductID(productID);
-                notificationDao.addNotification(notification);
-                name="";
-                productID="";
-            }
-            //械字号资质证书1个月后过期
-            for (int i=0;i<pro1.size();i++){
-                MessageCenter messageCenter = new MessageCenter();
-                messageCenter.setShopId(pro1.get(i).getShopID());
-                messageCenter.setClubId(null);
-                messageCenter.setUserType(2);
-                messageCenter.setMessageType(2);
-                messageCenter.setShopMessType(5);
-                messageCenter.setProductId(pro1.get(i).getProductID());
-                messageCenter.setContent("该商品的资质证书将于1个月后失效,请及时登录采美网站上传新证书。");
-                messageCenter.setTime(curDateStr);
-                messageCenterDao.addMessageCenter(messageCenter);
-                if(i!=0){
-                    name+=",";
-                    productID+=",";
-                }
-                name +="("+pro1.get(i).getProductID().toString()+")"+pro1.get(i).getName();
-                productID+=pro1.get(i).getProductID().toString();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下械字号商品的资质证书将于1个月后失效,请及时提醒供应商更换证书。");
-                notification.setShopContent(name);
-                notification.setPorductID(productID);
-                notificationDao.addNotification(notification);
-                name="";
-                productID="";
-            }
-//械字号资质证书7日后过期
-            for (int i=0;i<pro2.size();i++){
-                MessageCenter messageCenter = new MessageCenter();
-                messageCenter.setShopId(pro2.get(i).getShopID());
-                messageCenter.setClubId(null);
-                messageCenter.setUserType(2);
-                messageCenter.setMessageType(2);
-                messageCenter.setShopMessType(5);
-                messageCenter.setProductId(pro2.get(i).getProductID());
-                messageCenter.setContent("该商品的资质证书将于7天后失效,请及时登录采美网站上传新证书。");
-                messageCenter.setTime(curDateStr);
-                messageCenterDao.addMessageCenter(messageCenter);
-                if(i!=0){
-                    name+=",";
-                    productID+=",";
-                }
-                name +="("+pro2.get(i).getProductID().toString()+")"+pro2.get(i).getName();
-                productID+=pro2.get(i).getProductID().toString();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下械字号商品的资质证书将于7天后失效,请及时提醒供应商更换证书。");
-                notification.setShopContent(name);
-                notification.setPorductID(productID);
-                notificationDao.addNotification(notification);
-                name="";
-                productID="";
-            }
-//械字号资质证书今日后过期
-            for (int i=0;i<pro3.size();i++){
-                MessageCenter messageCenter = new MessageCenter();
-                messageCenter.setShopId(pro3.get(i).getShopID());
-                messageCenter.setClubId(null);
-                messageCenter.setUserType(2);
-                messageCenter.setMessageType(2);
-                messageCenter.setShopMessType(5);
-                messageCenter.setProductId(pro3.get(i).getProductID());
-                messageCenter.setContent("该商品的资质证书将于今天后失效,请及时登录采美网站上传新证书。");
-                messageCenter.setTime(curDateStr);
-                messageCenterDao.addMessageCenter(messageCenter);
-                if(i!=0){
-                    name+=",";
-                    productID+=",";
-                }
-                name +="("+pro3.get(i).getProductID().toString()+")"+pro3.get(i).getName();
-                productID+=pro3.get(i).getProductID().toString();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下械字号商品的资质证书将于今天后失效,请及时提醒供应商更换证书。");
-                notification.setShopContent(name);
-                notification.setPorductID(productID);
-                notificationDao.addNotification(notification);
-                name="";
-                productID="";
-            }
-            //上架费
-            for (int i=0;i<product.size();i++){
-                if(i!=0){
-                    name+=",";
-                    shopID+=",";
-                }
-                name +=product.get(i).getName();
-                shopID+=product.get(i).getShopID();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下供应商的上架费将于3个月后到期,请及时提醒供应商续费。");
-                notification.setShopContent(name);
-                notification.setShopID(shopID);
-                notificationDao.addNotification(notification);
-                name="";
-                shopID="";
-            }
-            //上架费1个月后过期
-            for (int i=0;i<product1.size();i++){
-                if(i!=0){
-                    name+=",";
-                    shopID+=",";
-                }
-                name +=product1.get(i).getName();
-                shopID+=product1.get(i).getShopID();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下供应商的上架费将于1个月后到期,请及时提醒供应商续费。");
-                notification.setShopContent(name);
-                notification.setShopID(shopID);
-                notificationDao.addNotification(notification);
-                name="";
-                shopID="";
-            }
-//上架费7日后过期
-            for (int i=0;i<product2.size();i++){
-                if(i!=0){
-                    name+=",";
-                    shopID+=",";
-                }
-                name +=product2.get(i).getName();
-                shopID+=product2.get(i).getShopID();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下供应商的上架费将于7天后到期,请及时提醒供应商续费。");
-                notification.setShopContent(name);
-                notification.setShopID(shopID);
-                notificationDao.addNotification(notification);
-                name="";
-                shopID="";
-            }
-//上架费今日后过期
-            for (int i=0;i<product3.size();i++){
-                if(i!=0){
-                    name+=",";
-                    shopID+=",";
-                }
-                name +=product3.get(i).getName();
-                shopID+=product3.get(i).getShopID();
-            }
-            if(!"".equals(name)){
-                Notification notification=new Notification();
-                notification.setTheme("以下供应商的上架费将于今天后到期,请及时提醒供应商续费。");
-                notification.setShopContent(name);
-                notification.setShopID(shopID);
-                notificationDao.addNotification(notification);
-                name="";
-                shopID="";
-            }
-//        }
-        jedis.lpush("constraint","1");
-        }
-
-    }
+}
 
 

+ 4 - 8
src/main/java/com/caimei/modules/user/dao/MessageCenterDao.java

@@ -5,9 +5,9 @@ import com.caimei.modules.user.entity.ClubChangeSp;
 import com.caimei.modules.user.entity.ClubTemporary;
 import com.caimei.modules.user.entity.ClubTemporary;
 import com.caimei.modules.user.entity.CmUser;
 import com.caimei.modules.user.entity.CmUser;
 import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.MessageCenter;
+import com.caimei.po.User;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.thinkgem.jeesite.modules.sys.entity.User;
 import com.caimei.modules.user.entity.MessageCenter;
 import com.caimei.modules.user.entity.MessageCenter;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
@@ -34,17 +34,13 @@ public interface MessageCenterDao extends CrudDao<MessageCenter> {
 
 
     List<Integer> ClubIds();
     List<Integer> ClubIds();
 
 
-    CmCoupon CouponList(Integer couponType);
-
     String contractMobile(String userID);
     String contractMobile(String userID);
-    String Mobile(Integer shopID);
-
-    Integer userID(Integer shopID);
 
 
     String shopName(Integer shopID);
     String shopName(Integer shopID);
 
 
-    List<CmCoupon> couponTime();
-
     Integer count();
     Integer count();
 
 
+    List<User> getNewUsers();
+
+    List<User> getUserInfo(Integer userId);
 }
 }

+ 2 - 0
src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java

@@ -20,6 +20,8 @@ public interface NewCmClubDao extends CrudDao<NewCmClub> {
 
 
     List<NewCmClub> findClubById(Integer clubID);
     List<NewCmClub> findClubById(Integer clubID);
 
 
+    List<NewCmClub> textUserValue();
+
     NewCmClub getclubByUserId(Integer userId);
     NewCmClub getclubByUserId(Integer userId);
 
 
     Integer findSpId(Integer spID);
     Integer findSpId(Integer spID);

+ 4 - 1
src/main/java/com/caimei/modules/user/entity/MessageCenter.java

@@ -1,8 +1,11 @@
 package com.caimei.modules.user.entity;
 package com.caimei.modules.user.entity;
 
 
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
 
 
-
+@Accessors(fluent = true)
+@Data
 public class MessageCenter extends DataEntity<MessageCenter> {
 public class MessageCenter extends DataEntity<MessageCenter> {
 
 
 
 

+ 27 - 0
src/main/java/com/caimei/modules/user/entity/NewCmClub.java

@@ -69,6 +69,9 @@ public class NewCmClub extends DataEntity<NewCmClub> {
     private String medicalPracticeLicenseImg; // 医美分类必须上传医疗执业许可证
     private String medicalPracticeLicenseImg; // 医美分类必须上传医疗执业许可证
     private String socialCreditCode;//统一社会编码
     private String socialCreditCode;//统一社会编码
 
 
+    private Integer valueID;     // 测试ID
+    private String activeState;     // 活跃状态
+    private String customerValue;   // 客户价值
     /**
     /**
      * 非持久化字段
      * 非持久化字段
      */
      */
@@ -891,6 +894,30 @@ public class NewCmClub extends DataEntity<NewCmClub> {
         this.socialCreditCode = socialCreditCode;
         this.socialCreditCode = socialCreditCode;
     }
     }
 
 
+    public Integer getValueID() {
+        return valueID;
+    }
+
+    public void setValueID(Integer valueID) {
+        this.valueID = valueID;
+    }
+
+    public String getActiveState() {
+        return activeState;
+    }
+
+    public void setActiveState(String activeState) {
+        this.activeState = activeState;
+    }
+
+    public String getCustomerValue() {
+        return customerValue;
+    }
+
+    public void setCustomerValue(String customerValue) {
+        this.customerValue = customerValue;
+    }
+
     public Integer getUserOrganizeID() {
     public Integer getUserOrganizeID() {
         return userOrganizeID;
         return userOrganizeID;
     }
     }

+ 43 - 129
src/main/java/com/caimei/modules/user/web/NewCmShopController.java

@@ -113,30 +113,30 @@ public class NewCmShopController extends BaseController {
         newCmShop.setShopType(2);
         newCmShop.setShopType(2);
         Page<NewCmShop> page = newCmShopService.findPage(new Page<NewCmShop>(request, response), newCmShop);
         Page<NewCmShop> page = newCmShopService.findPage(new Page<NewCmShop>(request, response), newCmShop);
         model.addAttribute("page", page);
         model.addAttribute("page", page);
-        model.addAttribute("newCmShop",newCmShop);
-        model.addAttribute("shopType",2);
+        model.addAttribute("newCmShop", newCmShop);
+        model.addAttribute("shopType", 2);
         return "modules/user/cmNewProductShopList";
         return "modules/user/cmNewProductShopList";
     }
     }
 
 
     @RequestMapping(value = "/special/new/edit")
     @RequestMapping(value = "/special/new/edit")
     public String specialEdit(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
     public String specialEdit(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
-        if(null!=newCmShop.getShopID()){
+        if (null != newCmShop.getShopID()) {
             newCmShop.setSplitCodes(newCmShopDao.findSplitCode(newCmShop.getShopID()));
             newCmShop.setSplitCodes(newCmShopDao.findSplitCode(newCmShop.getShopID()));
         }
         }
-        model.addAttribute("newCmShop",newCmShop);
+        model.addAttribute("newCmShop", newCmShop);
         return "modules/user/cmNewProductShopEdit";
         return "modules/user/cmNewProductShopEdit";
     }
     }
 
 
     @RequestMapping(value = "/special/new/save")
     @RequestMapping(value = "/special/new/save")
     public String specialSave(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
     public String specialSave(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
         newCmShopService.saveSpecial(newCmShop);
         newCmShopService.saveSpecial(newCmShop);
-        if(2==newCmShop.getShopType()){
-            model.addAttribute("newCmShop",newCmShop);
-            model.addAttribute("shopType",2);
+        if (2 == newCmShop.getShopType()) {
+            model.addAttribute("newCmShop", newCmShop);
+            model.addAttribute("shopType", 2);
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/new?repage";
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/new?repage";
-        }else{
-            model.addAttribute("newCmShop",newCmShop);
-            model.addAttribute("shopType",3);
+        } else {
+            model.addAttribute("newCmShop", newCmShop);
+            model.addAttribute("shopType", 3);
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/second?repage";
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/second?repage";
         }
         }
     }
     }
@@ -145,11 +145,11 @@ public class NewCmShopController extends BaseController {
     public String specialOffline(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
     public String specialOffline(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
         //下线
         //下线
         newCmShopService.offline(newCmShop);
         newCmShopService.offline(newCmShop);
-        if(2==newCmShop.getShopType()){
-            model.addAttribute("shopType",2);
+        if (2 == newCmShop.getShopType()) {
+            model.addAttribute("shopType", 2);
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/new?repage";
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/new?repage";
-        }else{
-            model.addAttribute("shopType",3);
+        } else {
+            model.addAttribute("shopType", 3);
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/second?repage";
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/second?repage";
         }
         }
     }
     }
@@ -158,11 +158,11 @@ public class NewCmShopController extends BaseController {
     public String specialOnline(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
     public String specialOnline(NewCmShop newCmShop, HttpServletRequest request, HttpServletResponse response, Model model) {
         //上线
         //上线
         newCmShopService.online(newCmShop);
         newCmShopService.online(newCmShop);
-        if(2==newCmShop.getShopType()){
-            model.addAttribute("shopType",2);
+        if (2 == newCmShop.getShopType()) {
+            model.addAttribute("shopType", 2);
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/new?repage";
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/new?repage";
-        }else{
-            model.addAttribute("shopType",3);
+        } else {
+            model.addAttribute("shopType", 3);
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/second?repage";
             return "redirect:" + Global.getAdminPath() + "/user/newCmShop/special/second?repage";
         }
         }
     }
     }
@@ -173,8 +173,8 @@ public class NewCmShopController extends BaseController {
         newCmShop.setShopType(3);
         newCmShop.setShopType(3);
         Page<NewCmShop> page = newCmShopService.findPage(new Page<NewCmShop>(request, response), newCmShop);
         Page<NewCmShop> page = newCmShopService.findPage(new Page<NewCmShop>(request, response), newCmShop);
         model.addAttribute("page", page);
         model.addAttribute("page", page);
-        model.addAttribute("shopType",3);
-        model.addAttribute("newCmShop",newCmShop);
+        model.addAttribute("shopType", 3);
+        model.addAttribute("newCmShop", newCmShop);
         return "modules/user/cmNewProductShopList";
         return "modules/user/cmNewProductShopList";
     }
     }
 
 
@@ -190,93 +190,14 @@ public class NewCmShopController extends BaseController {
 
 
     @RequestMapping(value = "maintenanceList")
     @RequestMapping(value = "maintenanceList")
     public String maintenanceList(CmDiscernReceipt cmDiscernReceipt, HttpServletRequest request, HttpServletResponse response, Model model) throws ParseException {
     public String maintenanceList(CmDiscernReceipt cmDiscernReceipt, HttpServletRequest request, HttpServletResponse response, Model model) throws ParseException {
-        //获取供应商证书信息
-        Page<CmDiscernReceipt>discernReceipt = newCmShopService.maintenanceList(new Page<CmDiscernReceipt>(request, response, 20),cmDiscernReceipt);
-        String date="";
-        int num=0;
-
-
-        Date currentTime = new Date();
-        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        Calendar calendar = Calendar.getInstance();
-        Calendar calendars = Calendar.getInstance();
-        //当前时间
-        String dateString = formatter.format(currentTime);
-        //到期时间
-        String dateStrings ="";
-        //生效时间
-        String validityDate="";
-        for(int i=0;i<discernReceipt.getList().size();i++){
-            CmDiscernReceipt cmDiscern=  newCmShopService.cmrectiptlist(discernReceipt.getList().get(i).getShopID());
-            //缴纳时间
-            String receiptDate=discernReceipt.getList().get(i).getReceiptDate();
-            if(!receiptDate.contains(":")){
-                receiptDate+=" 00:00:01";
-            }
-            Date receipttime = formatter.parse(receiptDate);
-//如果没有缴费记录
-            if(null==cmDiscern){
-                //缴纳时间加一年==到期时间
-                calendar.setTime(receipttime);
-                calendar.add(Calendar.YEAR, 1);
-                dateStrings= formatter.format(calendar.getTime());
-                calendars.setTime(receipttime);
-                calendars.add(Calendar.DATE, 1);
-                validityDate= formatter.format(calendars.getTime());
-                cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
-                logger.info("getReceiptID>>>>>"+discernReceipt.getList().get(i).getReceiptID());
-                cmDiscernReceipt.setValidityDate(receiptDate);
-                logger.info("receiptDate>>>>>"+receiptDate);
-                cmDiscernReceipt.setExpirationDate(dateStrings);
-                logger.info("dateStrings>>>>>"+dateStrings);
-                newCmShopService.cmreceipt(cmDiscernReceipt);
-            }
-            if(null!=cmDiscern && cmDiscern.getReceStatct()!=2 && cmDiscern.getReceStatct()!=1) {
-                Integer count=newCmShopService.cmrectCount(discernReceipt.getList().get(i).getShopID());
-                System.out.println("count>>"+count+"size>>"+discernReceipt.getList().size());
-                String receipt=cmDiscern.getExpirationDate();
-                if(!receipt.contains(":")){
-                    receipt+=" 00:00:01";
-                }
-                calendars.setTime(receipttime);
-                calendars.add(Calendar.DATE, -1);
-                String letdele= formatter.format(calendars.getTime());
-                Date rece = formatter.parse(receipt);
-                calendar.setTime(rece);
-                calendar.add(Calendar.YEAR, 1);
-                dateStrings= formatter.format(calendar.getTime());
-                if(!cmDiscern.getReceiptID().equals(discernReceipt.getList().get(i).getReceiptID())){
-                    if(count != discernReceipt.getList().size()){
-                        num = receipt.compareTo(dateString);
-                        logger.info(">>>>>>"+num);
-                        if(num>0){
-                            cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
-                            cmDiscernReceipt.setValidityDate(cmDiscern.getExpirationDate());
-                            cmDiscernReceipt.setExpirationDate(dateStrings);
-                            newCmShopService.cmreceipt(cmDiscernReceipt);
-                        } else {
-                            cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
-                            cmDiscernReceipt.setValidityDate(validityDate);
-                            cmDiscernReceipt.setExpirationDate(dateStrings);
-                            newCmShopService.cmreceipt(cmDiscernReceipt);
-                        }
-                    }
-                }
-            }
-
-            cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
-            cmDiscernReceipt.setLinkMan(discernReceipt.getList().get(i).getLinkMan());
-            System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+num);
-            System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+"1:"+date+"2:"+dateStrings+"3:"+dateString);
-        }
-        Page<CmDiscernReceipt>discernReceip = newCmShopService.maintenanceList(new Page<CmDiscernReceipt>(request, response, 20),cmDiscernReceipt);
-            model.addAttribute("CmDiscernReceipt", cmDiscernReceipt);
+        Page<CmDiscernReceipt> discernReceip = newCmShopService.maintenanceList(new Page<CmDiscernReceipt>(request, response, 20), cmDiscernReceipt);
+        model.addAttribute("CmDiscernReceipt", cmDiscernReceipt);
         model.addAttribute("discernReceipt", discernReceip);
         model.addAttribute("discernReceipt", discernReceip);
         return "modules/user/maintenanceList";
         return "modules/user/maintenanceList";
     }
     }
 
 
     @RequestMapping(value = "Removethelastfee")
     @RequestMapping(value = "Removethelastfee")
-    public String Removethelastfee(CmDiscernReceipt cmDiscernReceipt,Model model) {
+    public String Removethelastfee(CmDiscernReceipt cmDiscernReceipt, Model model) {
         CmOperationalLogs sysLog = new CmOperationalLogs();
         CmOperationalLogs sysLog = new CmOperationalLogs();
         Date currentTime = new Date();
         Date currentTime = new Date();
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
@@ -286,7 +207,6 @@ public class NewCmShopController extends BaseController {
         //获取操作时间
         //获取操作时间
         sysLog.setOperationtime(new Date());
         sysLog.setOperationtime(new Date());
         newCmShopService.addthelast(cmDiscernReceipt);
         newCmShopService.addthelast(cmDiscernReceipt);
-        cmDiscernReceipt.setReceiptID(newCmShopService.therectip().toString());
         newCmShopService.cmreceipt(cmDiscernReceipt);
         newCmShopService.cmreceipt(cmDiscernReceipt);
 
 
         //获取操作员
         //获取操作员
@@ -302,18 +222,16 @@ public class NewCmShopController extends BaseController {
             if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
             if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
                 int i = cmOperationalLogService.insert(sysLog);
                 int i = cmOperationalLogService.insert(sysLog);
             }
             }
-
         }
         }
-        return "redirect:" + Global.getAdminPath() + "/user/newCmShop/maintenanceList?shopID="+cmDiscernReceipt.getShopID()+"&shopName"+cmDiscernReceipt.getShopName();
+        return "redirect:" + Global.getAdminPath() + "/user/newCmShop/maintenanceList?shopID=" + cmDiscernReceipt.getShopID() + "&shopName" + cmDiscernReceipt.getShopName();
     }
     }
+
     @RequestMapping(value = "Removethelast")
     @RequestMapping(value = "Removethelast")
-    public String Removethelast(CmDiscernReceipt cmDiscernReceipt,Model model)
-    {
+    public String Removethelast(CmDiscernReceipt cmDiscernReceipt, Model model) {
         CmOperationalLogs sysLog = new CmOperationalLogs();
         CmOperationalLogs sysLog = new CmOperationalLogs();
         newCmShopService.Removethelast(cmDiscernReceipt);
         newCmShopService.Removethelast(cmDiscernReceipt);
         //获取操作时间
         //获取操作时间
         sysLog.setOperationtime(new Date());
         sysLog.setOperationtime(new Date());
-
         //获取操作员
         //获取操作员
         SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
         SystemAuthorizingRealm.Principal principal = UserUtils.getPrincipal();
         System.out.println("操作员" + principal.getName());
         System.out.println("操作员" + principal.getName());
@@ -327,10 +245,8 @@ public class NewCmShopController extends BaseController {
             if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
             if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
                 int i = cmOperationalLogService.insert(sysLog);
                 int i = cmOperationalLogService.insert(sysLog);
             }
             }
-
         }
         }
-
-        return "redirect:" + Global.getAdminPath() + "/user/newCmShop/maintenanceList?shopID="+cmDiscernReceipt.getShopID()+"&shopName"+cmDiscernReceipt.getShopName();
+        return "redirect:" + Global.getAdminPath() + "/user/newCmShop/maintenanceList?shopID=" + cmDiscernReceipt.getShopID() + "&shopName" + cmDiscernReceipt.getShopName();
     }
     }
 
 
     /**
     /**
@@ -401,7 +317,7 @@ public class NewCmShopController extends BaseController {
                 sysLog.setContact(newCmShops.getLinkMan());
                 sysLog.setContact(newCmShops.getLinkMan());
                 sysLog.setInstitutionName(newCmShops.getName());
                 sysLog.setInstitutionName(newCmShops.getName());
                 sysLog.setOperationtype("审核");
                 sysLog.setOperationtype("审核");
-                    sysLog.setActioncontent("审核失败");
+                sysLog.setActioncontent("审核失败");
                 if (!"".equals(sysLog.getActioncontent())) {
                 if (!"".equals(sysLog.getActioncontent())) {
                     if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
                     if (sysLog.getInstitutionName() != null && sysLog.getContact() != null) {
                         int i = cmOperationalLogService.insert(sysLog);
                         int i = cmOperationalLogService.insert(sysLog);
@@ -419,14 +335,13 @@ public class NewCmShopController extends BaseController {
 
 
                     String pagePath = "/pages/login/apply-supplier";
                     String pagePath = "/pages/login/apply-supplier";
                     for (String openid : openidList) {
                     for (String openid : openidList) {
-                        weChatService.sendTemplate(accessToken, openid,newCmShops.getName(),auditNote,auditTime, pagePath);
+                        weChatService.sendTemplate(accessToken, openid, newCmShops.getName(), auditNote, auditTime, pagePath);
                     }
                     }
                 } catch (Exception e) {
                 } catch (Exception e) {
                     logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
                     logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
                 }
                 }
 
 
 
 
-
             }
             }
             // 更新用户信息
             // 更新用户信息
             newCmShopService.updateUserAudit(auditStatus, auditNote, format, manufacturerStatus, userId, "1");
             newCmShopService.updateUserAudit(auditStatus, auditNote, format, manufacturerStatus, userId, "1");
@@ -438,10 +353,10 @@ public class NewCmShopController extends BaseController {
             map.put("msg", "审核成功");
             map.put("msg", "审核成功");
             if (StringUtils.isNotEmpty(mobile)) {
             if (StringUtils.isNotEmpty(mobile)) {
                 boolean sendSms = newOrderService.getSendSms(9, mobile, smsMessage);
                 boolean sendSms = newOrderService.getSendSms(9, mobile, smsMessage);
-                if(sendSms){
+                if (sendSms) {
                     logger.info(">>>>>>>获得供应商账户审核短信推送成功");
                     logger.info(">>>>>>>获得供应商账户审核短信推送成功");
-                }else {
-                    SMSUtils.sendSms(0,mobile, smsMessage);
+                } else {
+                    SMSUtils.sendSms(0, mobile, smsMessage);
                 }
                 }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
@@ -449,7 +364,6 @@ public class NewCmShopController extends BaseController {
             logger.error(e.getMessage());
             logger.error(e.getMessage());
 
 
 
 
-
             map.put("success", false);
             map.put("success", false);
             map.put("msg", "审核失败");
             map.put("msg", "审核失败");
         }
         }
@@ -672,7 +586,7 @@ public class NewCmShopController extends BaseController {
                 cmUser.setBindMobile(mobile);
                 cmUser.setBindMobile(mobile);
                 cmUserService.update(cmUser);
                 cmUserService.update(cmUser);
                 String content = "供应商企业账号绑定手机号已修改成功,可使用当前手机号进行密码修改等操作。";
                 String content = "供应商企业账号绑定手机号已修改成功,可使用当前手机号进行密码修改等操作。";
-                SMSUtils.sendSms(0,mobile, content);
+                SMSUtils.sendSms(0, mobile, content);
 
 
                 map.put("success", true);
                 map.put("success", true);
                 map.put("msg", "修改成功");
                 map.put("msg", "修改成功");
@@ -698,7 +612,7 @@ public class NewCmShopController extends BaseController {
     @RequiresPermissions("user:newCmShop:edit")
     @RequiresPermissions("user:newCmShop:edit")
     public String onLine(NewCmShop newCmShop, Model model, RedirectAttributes redirectAttributes) {
     public String onLine(NewCmShop newCmShop, Model model, RedirectAttributes redirectAttributes) {
         Integer userID = newCmShop.getUserID();
         Integer userID = newCmShop.getUserID();
-        NewCmShop newCmShops= cmOperationalLogService.userlist(userID);
+        NewCmShop newCmShops = cmOperationalLogService.userlist(userID);
         CmOperationalLogs sysLog = new CmOperationalLogs();
         CmOperationalLogs sysLog = new CmOperationalLogs();
         cmUserService.updateUserStatus("90", userID, "1");
         cmUserService.updateUserStatus("90", userID, "1");
         newCmShopService.updateShopStatus("90", userID);
         newCmShopService.updateShopStatus("90", userID);
@@ -734,9 +648,9 @@ public class NewCmShopController extends BaseController {
     @RequestMapping(value = "offline")
     @RequestMapping(value = "offline")
     @RequiresPermissions("user:newCmShop:edit")
     @RequiresPermissions("user:newCmShop:edit")
     public String offLine(NewCmShop newCmShop, Model model, RedirectAttributes redirectAttributes) {
     public String offLine(NewCmShop newCmShop, Model model, RedirectAttributes redirectAttributes) {
-        System.out.println(">>>>>>>>>>>>>>》》》》》"+newCmShop);
+        System.out.println(">>>>>>>>>>>>>>》》》》》" + newCmShop);
         Integer userID = newCmShop.getUserID();
         Integer userID = newCmShop.getUserID();
-        NewCmShop newCmShops= cmOperationalLogService.userlist(userID);
+        NewCmShop newCmShops = cmOperationalLogService.userlist(userID);
         cmUserService.updateUserStatus("91", userID, "0");
         cmUserService.updateUserStatus("91", userID, "0");
         newCmShopService.updateShopStatus("91", userID);
         newCmShopService.updateShopStatus("91", userID);
         addMessage(redirectAttributes, "供应商下线成功");
         addMessage(redirectAttributes, "供应商下线成功");
@@ -857,7 +771,7 @@ public class NewCmShopController extends BaseController {
             }
             }
         }
         }
         if (newCmShops.getRegisteredCapital() != null) {
         if (newCmShops.getRegisteredCapital() != null) {
-            if (!newCmShop.getRegisteredCapital().equals(newCmShops.getRegisteredCapital()) ) {
+            if (!newCmShop.getRegisteredCapital().equals(newCmShops.getRegisteredCapital())) {
                 list.add("修改了注册资本");
                 list.add("修改了注册资本");
             }
             }
         }
         }
@@ -907,7 +821,7 @@ public class NewCmShopController extends BaseController {
             }
             }
         }
         }
 
 
-         if (!newCmShop.getBusinessScope().equals(newCmShops.getBusinessScope())) {
+        if (!newCmShop.getBusinessScope().equals(newCmShops.getBusinessScope())) {
             list.add("修改了医疗类型");
             list.add("修改了医疗类型");
         }
         }
 
 
@@ -924,7 +838,7 @@ public class NewCmShopController extends BaseController {
                 list.add("新增了微信公众号");
                 list.add("新增了微信公众号");
             }
             }
         }
         }
-            if (!newCmShop.getWxOfficialAccount().equals(newCmShops.getWxOfficialAccount())) {
+        if (!newCmShop.getWxOfficialAccount().equals(newCmShops.getWxOfficialAccount())) {
             list.add("修改了微信公众号");
             list.add("修改了微信公众号");
         }
         }
 
 
@@ -941,7 +855,7 @@ public class NewCmShopController extends BaseController {
                 list.add("新增了营业执照编号");
                 list.add("新增了营业执照编号");
             }
             }
         }
         }
-      if (!newCmShop.getSocialCreditCode().equals(newCmShops.getSocialCreditCode())) {
+        if (!newCmShop.getSocialCreditCode().equals(newCmShops.getSocialCreditCode())) {
             list.add("修改了营业执照编号");
             list.add("修改了营业执照编号");
         }
         }
 
 
@@ -981,7 +895,6 @@ public class NewCmShopController extends BaseController {
         }
         }
 
 
 
 
-
         if (!beanValidator(model, newCmShop)) {
         if (!beanValidator(model, newCmShop)) {
             return form(newCmShop, model);
             return form(newCmShop, model);
         }
         }
@@ -1028,8 +941,9 @@ public class NewCmShopController extends BaseController {
             if (StringUtils.isEmpty(cmShop.getSecondShopType())) {
             if (StringUtils.isEmpty(cmShop.getSecondShopType())) {
                 return jsonModel.error("请选择二级分类");
                 return jsonModel.error("请选择二级分类");
             } else {
             } else {
-                if ("3".equals(cmShop.getSecondShopType()) && StringUtils.isEmpty(cmShop.getMedicalPracticeLicenseImg1())){
-                    return jsonModel.error("请上传资质");}
+                if ("3".equals(cmShop.getSecondShopType()) && StringUtils.isEmpty(cmShop.getMedicalPracticeLicenseImg1())) {
+                    return jsonModel.error("请上传资质");
+                }
             }
             }
             dbShop.setSecondShopType(cmShop.getSecondShopType());
             dbShop.setSecondShopType(cmShop.getSecondShopType());
             dbShop.setMedicalPracticeLicenseImg1(cmShop.getMedicalPracticeLicenseImg1());
             dbShop.setMedicalPracticeLicenseImg1(cmShop.getMedicalPracticeLicenseImg1());

+ 1 - 0
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -165,6 +165,7 @@ private VisitRemarkDao visitRemarkDao;
         }
         }
 
 
         Page<NewCmClub> page = newCmClubService.findPage(new Page<NewCmClub>(request, response, 20), newCmClub);
         Page<NewCmClub> page = newCmClubService.findPage(new Page<NewCmClub>(request, response, 20), newCmClub);
+
         model.addAttribute("newCmClub", newCmClub);
         model.addAttribute("newCmClub", newCmClub);
         model.addAttribute("page", page);
         model.addAttribute("page", page);
         return "modules/userNew/cmAgencyList";
         return "modules/userNew/cmAgencyList";

+ 3 - 0
src/main/resources/mappings/modules/order/CmOfflineCollectionMapper.xml

@@ -62,6 +62,9 @@
         UPDATE cm_offline_collection
         UPDATE cm_offline_collection
         SET isDisable = 0 WHERE id =#{id}
         SET isDisable = 0 WHERE id =#{id}
     </update>
     </update>
+    <delete id="delReceipt">
+        delete from cm_receipt_type where id = #{id}
+    </delete>
 
 
     <select id="downList" resultType="com.caimei.modules.order.entity.CmOfflineCollection">
     <select id="downList" resultType="com.caimei.modules.order.entity.CmOfflineCollection">
         SELECT id,bankAccount,type FROM cm_offline_collection WHERE isDisable != 0
         SELECT id,bankAccount,type FROM cm_offline_collection WHERE isDisable != 0

+ 6 - 1
src/main/resources/mappings/modules/order/CmPayShopMapper.xml

@@ -150,7 +150,12 @@
 			</otherwise>
 			</otherwise>
 		</choose>
 		</choose>
 	</select>
 	</select>
-
+	<select id="priceNum" resultType="com.caimei.modules.product.entity.Product">
+		SELECT cso.shopOrderID,cop.orderProductID,cop.taxRate,cop.discountPrice as price,cop.costPrice as costPrice FROM cm_order co
+				 LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
+				 LEFT JOIN cm_shop_order cso ON cop.shopOrderNo = cso.shopOrderNo
+				 LEFT JOIN product p ON cop.productID = p.productID WHERE co.orderNo =  #{orderNo}
+	</select>
 	<insert id="insert" parameterType="CmPayShop"  keyProperty="id" useGeneratedKeys="true">
 	<insert id="insert" parameterType="CmPayShop"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_pay_shop(
 		INSERT INTO cm_pay_shop(
 			shopID,
 			shopID,

+ 39 - 64
src/main/resources/mappings/modules/sys/Notification.xml

@@ -2,74 +2,49 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.sys.dao.NotificationDao">
 <mapper namespace="com.caimei.modules.sys.dao.NotificationDao">
 
 
-	<select id="productTypeCount" resultType="com.caimei.modules.product.entity.Product">
-		SELECT * FROM `product` WHERE productType=2 AND  DATE_ADD(NOW(), INTERVAL #{yat} MONTH) > qualificationTime AND qualificationTime > NOW()
-	</select>
-
-	<select id="productTypeCount1" resultType="com.caimei.modules.product.entity.Product">
-		SELECT * FROM `product` WHERE productType=2 AND  DATE_ADD(NOW(), INTERVAL #{yat} DAY) > qualificationTime AND qualificationTime > NOW()
-	</select>
-
-	<select id="productTypeCount2" resultType="com.caimei.modules.product.entity.Product">
-		SELECT * FROM `cm_discern_receipt` a
-						  LEFT JOIN cm_receipt s ON s.receiptID = a.id
-						  LEFT JOIN shop c ON a.shopID = c.`shopID`
-		WHERE a.newReceiptType=1 AND DATE_ADD(NOW(), INTERVAL #{yat} MONTH)>s.dateStrings  AND  s.dateStrings > NOW() AND a.receStatct=0
-	</select>
-
-	<select id="productTypeCount3" resultType="com.caimei.modules.product.entity.Product">
-		SELECT * FROM `cm_discern_receipt` a
-		LEFT JOIN cm_receipt s ON s.receiptID = a.id
-		LEFT JOIN shop c ON a.shopID = c.`shopID`
-		WHERE a.newReceiptType=1 AND DATE_ADD(NOW(), INTERVAL #{yat} DAY)>s.dateStrings  AND  s.dateStrings > NOW() AND a.receStatct=0
-	</select>
-
-	<select id="notification" resultType="com.caimei.modules.sys.entity.Notification">
-		SELECT * FROM `notification`
-		<where>
-			<if test="theme!=null and theme!=''">
-				and theme LIKE CONCAT('%',#{theme},'%')
-			</if>
-		</where>
-		ORDER BY newTime desc
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	<select id="notificationId" resultType="java.lang.String">
-		SELECT shopContent FROM `notification`
-		where id=#{id}
-	</select>
-
-	<update id="Upnotification">
-		UPDATE notification SET saved=1
-		<where>
-		    <if test="id!=null">
-		and	id=#{id}
+    <select id="notification" resultType="com.caimei.modules.sys.entity.Notification">
+        SELECT * FROM `notification`
+        <where>
+            <if test="theme!=null and theme!=''">
+                and theme LIKE CONCAT('%',#{theme},'%')
             </if>
             </if>
-	   </where>
-	</update>
-
-	<update id="hide">
-		UPDATE notification SET hide=#{hide},saved=1
-		where id=#{Id}
+        </where>
+        ORDER BY newTime desc
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+    <select id="notificationId" resultType="java.lang.String">
+        SELECT shopContent
+        FROM `notification`
+        where id = #{id}
+    </select>
+
+    <update id="Upnotification">
+        UPDATE notification SET saved=1
+        <where>
+            <if test="id!=null">
+                and id=#{id}
+            </if>
+        </where>
+    </update>
 
 
-	</update>
+    <update id="hide">
+        UPDATE notification
+        SET hide=#{hide},
+            saved=1
+        where id = #{Id}
 
 
-	<update id="hides">
-		UPDATE notification SET hide=0
-	</update>
+    </update>
 
 
-	<insert id="addNotification">
-		INSERT INTO notification(theme,newTime,shopContent,porductID,shopID) VALUES (#{theme},NOW(),#{shopContent},#{porductID},#{shopID})
-	</insert>
+    <update id="hides">
+        UPDATE notification
+        SET hide=0
+    </update>
 
 
-	<select id="count" resultType="java.lang.Integer">
-		select count(*) from notification where saved=1
-	</select>
 
 
 </mapper>
 </mapper>

+ 39 - 39
src/main/resources/mappings/modules/user/MessageCenter.xml

@@ -1,69 +1,69 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.user.dao.MessageCenterDao">
 <mapper namespace="com.caimei.modules.user.dao.MessageCenterDao">
-<!--    <insert id="addMessageCenter">-->
-<!--        INSERT INTO message_center (shopID, clubID, userType, messageType,content,time,accountType,orderID,orderMessageType,shopMessType)-->
-<!--        VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType},#{content},#{time},#{accountType},#{orderID},#{orderMessageType},#{shopMessType})-->
-<!--    </insert>-->
+
     <insert id="addMessageCenter">
     <insert id="addMessageCenter">
-        INSERT INTO message_center (shopID, clubID, userType, messageType, content,time,accountType,couponType,couponFee,couponMessageType,orderID,orderMessageType,shopMessType,productId)
-        VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType}, #{content},#{time},#{accountType},#{couponType},#{couponFee},#{couponMessageType},#{orderId},#{orderMessageType},#{shopMessType},#{productId})
+        INSERT INTO message_center (shopID, clubID, userType, messageType, content, time, accountType, couponType,
+                                    couponFee, couponMessageType, orderID, orderMessageType, shopMessType, productID)
+        VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType}, #{content}, #{time}, #{accountType}, #{couponType},
+                #{couponFee}, #{couponMessageType}, #{orderId}, #{orderMessageType}, #{shopMessType}, #{productId})
     </insert>
     </insert>
 
 
     <select id="clubIdCule" resultType="java.lang.Integer">
     <select id="clubIdCule" resultType="java.lang.Integer">
-        SELECT clubID FROM `club` WHERE userId=#{userId}
+        SELECT clubID
+        FROM `club`
+        WHERE userId = #{userId}
     </select>
     </select>
 
 
     <select id="contractMobile" resultType="java.lang.String">
     <select id="contractMobile" resultType="java.lang.String">
-        SELECT contractMobile FROM club WHERE userID=#{UserID}
-    </select>
-
-    <select id="Mobile" resultType="java.lang.String">
-        SELECT contractMobile FROM shop WHERE shopID=#{shopID}
+        SELECT contractMobile
+        FROM club
+        WHERE userID = #{UserID}
     </select>
     </select>
 
 
-
     <select id="clubList" resultType="com.caimei.modules.user.entity.CmUser">
     <select id="clubList" resultType="com.caimei.modules.user.entity.CmUser">
-        SELECT * FROM `user` WHERE clubId=#{clubId}  LIMIT 1
+        SELECT *
+        FROM `user`
+        WHERE clubId = #{clubId}
+        LIMIT 1
     </select>
     </select>
     <select id="shopID" resultType="java.lang.Integer">
     <select id="shopID" resultType="java.lang.Integer">
-        SELECT shopID FROM `product` WHERE productID=#{productID}
+        SELECT shopID
+        FROM `product`
+        WHERE productID = #{productID}
     </select>
     </select>
 
 
     <select id="shopName" resultType="java.lang.String">
     <select id="shopName" resultType="java.lang.String">
-        SELECT name FROM shop where shopID=#{shopID}
+        SELECT name
+        FROM shop
+        where shopID = #{shopID}
     </select>
     </select>
 
 
     <select id="ClubIds" resultType="java.lang.Integer">
     <select id="ClubIds" resultType="java.lang.Integer">
-        SELECT DISTINCT clubID FROM `user` WHERE YEAR(loginTime)>YEAR(NOW())-3 AND clubID IS NOT NULL
-        ORDER BY clubID DESC
+        SELECT DISTINCT clubid, loginTime
+        FROM user
+        WHERE DATE_ADD(loginTime, INTERVAL 3 YEAR) > NOW()
+          AND clubstatus = 90
+          AND clubId IS NOT NULL
+        ORDER BY logintime DESC
     </select>
     </select>
 
 
-    <select id="userID" resultType="java.lang.Integer">
-        select userID from shop where shopID=#{shopID}
-    </select>
-
-    <select id="CouponList" resultType="com.caimei.modules.coupon.entity.CmCoupon">
-        SELECT * FROM cm_coupon WHERE couponType=#{couponType}
-                                  AND NOW() >= startDate
-                                  AND endDate >= NOW()
-                                  AND status=1
-                                  AND delFlag=0
-        ORDER BY id DESC
-        LIMIT 1
+    <select id="count" resultType="integer">
+        SELECT COUNT(*)
+        FROM `notification`
+        WHERE saved = 0
     </select>
     </select>
 
 
-    <select id="couponTime" resultType="com.caimei.modules.coupon.entity.CmCoupon">
-        SELECT * FROM `cm_coupon` WHERE
-            NOW() >= startDate
-            AND endDate >= NOW()
-            AND STATUS = 1
-            AND delFlag=0
+    <select id="getNewUsers" resultType="com.caimei.po.User">
+        select userID, clubID, bindMobile
+        from user
+        where DATE_ADD(registerTime, INTERVAL 6 MONTH) > NOW()
     </select>
     </select>
 
 
-    <select id="count" resultType="integer">
-        SELECT COUNT(*) FROM `notification` WHERE saved=0
+    <select id="getUserInfo" resultType="com.caimei.po.User">
+        select userId, clubId, bindMobile
+        from user
+        where userId = #{userId}
     </select>
     </select>
 
 
-
 </mapper>
 </mapper>

+ 14 - 2
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -88,14 +88,20 @@
         WHERE a.userID = #{userID}
         WHERE a.userID = #{userID}
     </select>
     </select>
 
 
+    <select id="textUserValue" resultType="NewCmClub">
+        SELECT userID as valueID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1
+    </select>
+
 
 
     <select id="findList" resultType="NewCmClub">
     <select id="findList" resultType="NewCmClub">
         SELECT
         SELECT
         <include refid="newCmClubColumns"/>
         <include refid="newCmClubColumns"/>
-        <include refid="otherColumns"/>,u.userPermission,u.source
+        <include refid="otherColumns"/>,u.userPermission,u.source, covs.activeState,covs.customerValue
         FROM club a
         FROM club a
         <include refid="newCmClubJoins"/>
         <include refid="newCmClubJoins"/>
+        left join cm_organ_value_system covs on a.userID = covs.userID
         <where>
         <where>
+            covs.stage = 0 AND covs.delType = 1
             <if test="clubID != null and clubID != ''">
             <if test="clubID != null and clubID != ''">
                 AND a.clubID = #{clubID}
                 AND a.clubID = #{clubID}
             </if>
             </if>
@@ -147,7 +153,13 @@
             <if test="newDeal != null">
             <if test="newDeal != null">
                 AND a.newDeal =#{newDeal}
                 AND a.newDeal =#{newDeal}
             </if>
             </if>
-            AND (u.userOrganizeID IN(0,1) or u.clubStatus != 92)
+            <if test="activeState != null and activeState != ''">
+                AND covs.activeState = #{activeState}
+            </if>
+            <if test="customerValue != null and customerValue != ''">
+                AND covs.customerValue = #{customerValue}
+            </if>
+             AND (u.userOrganizeID IN(0,1) or u.clubStatus != 92)
         </where>
         </where>
         <choose>
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">

+ 13 - 8
src/main/resources/mappings/modules/user/NewCmShopMapper.xml

@@ -442,7 +442,8 @@
 
 
     <select id="maintenanceList" resultType="CmDiscernReceipt">
     <select id="maintenanceList" resultType="CmDiscernReceipt">
         SELECT
         SELECT
-        c.validityDate as validityDate, c.dateStrings as expirationDate,a.id as receiptID,a.shopID,a.receiptAmount,a.receiptDate,a.receStatct,s.linkMan
+        c.validityDate as validityDate, c.dateStrings as expirationDate,a.id as
+        receiptID,a.shopID,a.receiptAmount,a.receiptDate,a.receStatct,s.linkMan
         FROM cm_discern_receipt a
         FROM cm_discern_receipt a
         LEFT JOIN shop s ON s.shopID = a.shopID
         LEFT JOIN shop s ON s.shopID = a.shopID
         LEFT JOIN cm_receipt c ON c.receiptID = a.id
         LEFT JOIN cm_receipt c ON c.receiptID = a.id
@@ -471,7 +472,9 @@
     </insert>
     </insert>
 
 
     <select id="therectip" resultType="Integer">
     <select id="therectip" resultType="Integer">
-        SELECT id FROM cm_discern_receipt WHERE receStatct=2
+        SELECT id
+        FROM cm_discern_receipt
+        WHERE receStatct = 2
         ORDER BY id DESC
         ORDER BY id DESC
         LIMIT 1
         LIMIT 1
     </select>
     </select>
@@ -484,11 +487,11 @@
         where id = #{receiptID}
         where id = #{receiptID}
     </update>
     </update>
 
 
-    <insert id="addthelast">
+    <insert id="addthelast" keyColumn="id" keyProperty="receiptID" useGeneratedKeys="true">
         insert cm_discern_receipt
         insert cm_discern_receipt
-       (receiptDate,newReceiptType,
-            receStatct,delFlag,shopID)
-            value (now(),1,2,1,#{shopID})
+        (receiptDate, confirmDate, reviewDate, updateDate, newReceiptType,
+         receStatct, delFlag, shopID)
+            value (now(), now(), now(), now(), 1, 2, 1, #{shopID})
     </insert>
     </insert>
 
 
     <insert id="cmreceipt">
     <insert id="cmreceipt">
@@ -498,8 +501,10 @@
     </insert>
     </insert>
 
 
     <select id="cmrectiptlist" resultType="com.caimei.modules.order.entity.CmDiscernReceipt">
     <select id="cmrectiptlist" resultType="com.caimei.modules.order.entity.CmDiscernReceipt">
-        SELECT r.receiptID as receiptID,r.dateStrings  as expirationDate,
-               r.validityDate as validityDate,c.receStatct AS receStatct
+        SELECT r.receiptID    as receiptID,
+               r.dateStrings  as expirationDate,
+               r.validityDate as validityDate,
+               c.receStatct   AS receStatct
         FROM cm_receipt r
         FROM cm_receipt r
                  LEFT JOIN cm_discern_receipt c ON c.id = r.receiptID
                  LEFT JOIN cm_discern_receipt c ON c.id = r.receiptID
                  LEFT JOIN shop s ON s.shopID = c.shopID
                  LEFT JOIN shop s ON s.shopID = c.shopID

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -943,7 +943,7 @@
         });
         });
 
 
         $('.pay-table').each(function () {
         $('.pay-table').each(function () {
-            debugger
+            // debugger
             var thisEle = $(this),
             var thisEle = $(this),
                 totalComissionVal = 0,
                 totalComissionVal = 0,
                 resVal = '';
                 resVal = '';

+ 5 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherCheck.jsp

@@ -589,7 +589,10 @@
             <label style="font-weight: bold; font-size:18px">转账支付:</label>
             <label style="font-weight: bold; font-size:18px">转账支付:</label>
             <span id="transferPayFee" style="font-weight: bold; font-size:18px"><fmt:formatNumber value="${cmPayShop.transferPayFee}" pattern="#,##0.00"/> </span>
             <span id="transferPayFee" style="font-weight: bold; font-size:18px"><fmt:formatNumber value="${cmPayShop.transferPayFee}" pattern="#,##0.00"/> </span>
             <label>付款银行:</label><span>
             <label>付款银行:</label><span>
-					<select name="payType">
+            <c:forEach  items="${offlineCollections}" var="offlineCollections" varStatus="index">
+                <option value="${offlineCollections.type}">${offlineCollections.bankAccount}</option>
+            </c:forEach>
+					<%--<select name="payType">
 						<option value="1">建设银行7297</option>
 						<option value="1">建设银行7297</option>
 						<option value="2">中信银行0897</option>
 						<option value="2">中信银行0897</option>
 						<option value="3">中信银行7172</option>
 						<option value="3">中信银行7172</option>
@@ -597,7 +600,7 @@
 						<option value="5">广发银行5461</option>
 						<option value="5">广发银行5461</option>
 						<option value="7">华夏银行2400</option>
 						<option value="7">华夏银行2400</option>
 						<option value="8">中国银行9452</option>
 						<option value="8">中国银行9452</option>
-					</select>
+					</select>--%>
 				</span>
 				</span>
             <label>付款时间:</label>
             <label>付款时间:</label>
             <span>${cmPayShop.payTime}</span>
             <span>${cmPayShop.payTime}</span>

+ 57 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyList.jsp

@@ -45,6 +45,7 @@
         #alertModal .alert-content{width:260px;height:60px;padding:20px}
         #alertModal .alert-content{width:260px;height:60px;padding:20px}
         #alertModal .alertModal-btn{width:260px;height:49px;padding:0 20px;border-top:1px solid #EBEBEB}
         #alertModal .alertModal-btn{width:260px;height:49px;padding:0 20px;border-top:1px solid #EBEBEB}
         #alertModal .alertModal-btn button{float:right;margin:5px}
         #alertModal .alertModal-btn button{float:right;margin:5px}
+        .acticer_span{display: inline-block;width: 14px;height: 14px;border-radius: 50%;box-sizing: border-box;border: 1px solid #999999;text-align: center;color: #333333;font-size: 12px;line-height: 14px;float: none;margin-left: 3px;}
     </style>
     </style>
 </head>
 </head>
 <body>
 <body>
@@ -91,6 +92,34 @@
                 <form:option value="8" label="超级会员"/>
                 <form:option value="8" label="超级会员"/>
             </form:select>
             </form:select>
         </div>
         </div>
+
+
+        <br/>
+        <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <label class="control-label">活跃状态:</label>
+        <form:select path="activeState" class="input-medium">
+            <form:option value="" label="请选择"/>
+            <form:option value="新增用户" label="新增用户"/>
+            <form:option value="活跃用户" label="活跃用户"/>
+            <form:option value="不活跃用户" label="不活跃用户"/>
+            <form:option value="流失用户" label="流失用户"/>
+            <form:option value="回流用户" label="回流用户"/>
+            <form:option value="忠诚用户" label="忠诚用户"/>
+            <form:option value="沉默用户" label="沉默用户"/>
+        </form:select>
+
+        <label class="control-label">客户价值:</label>
+        <form:select path="customerValue" class="input-medium">
+            <form:option value="" label="请选择"/>
+            <form:option value="一般保持客户" label="一般保持客户"/>
+            <form:option value="一般发展客户" label="一般发展客户"/>
+            <form:option value="一般价值客户" label="一般价值客户"/>
+            <form:option value="一般挽留客户" label="一般挽留客户"/>
+            <form:option value="重要保持客户" label="重要保持客户"/>
+            <form:option value="重要发展客户" label="重要发展客户"/>
+            <form:option value="重要价值客户" label="重要价值客户"/>
+            <form:option value="重要挽留客户" label="重要挽留客户"/>
+        </form:select>
         <div class="item">
         <div class="item">
             <label>注册时间:</label>
             <label>注册时间:</label>
             <form:input path="searchStartTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
             <form:input path="searchStartTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
@@ -125,6 +154,8 @@
         <th>状态</th>
         <th>状态</th>
         <th>审核人</th>
         <th>审核人</th>
         <th>机构类别</th>
         <th>机构类别</th>
+        <th>活跃状态<span class="acticer_span" onmousemove="activeStageMessage(1)">?</span></th>
+        <th>客户价值<span class="acticer_span" onmousemove="activeStageMessage(2)">?</span></th>
         <th>注册IP</th>
         <th>注册IP</th>
         <th>注册时间</th>
         <th>注册时间</th>
         <th>审核时间</th>
         <th>审核时间</th>
@@ -220,6 +251,9 @@
                     <font color="red">(普通会员)</font>
                     <font color="red">(普通会员)</font>
                 </c:if>
                 </c:if>
             </td>
             </td>
+            <td>${newCmClubList.activeState}</td>
+            <td>${newCmClubList.customerValue}</td>
+
             <td>
             <td>
                 <c:if test="${newCmClubList.registerIP eq '192.168.1.10'}">
                 <c:if test="${newCmClubList.registerIP eq '192.168.1.10'}">
                     协销代注册
                     协销代注册
@@ -814,7 +848,30 @@
         };
         };
         $.jBox(html, {title: "审核", submit: submit});
         $.jBox(html, {title: "审核", submit: submit});
     }
     }
+    function activeStageMessage(type) {// 客户价值提示语
+        var content = '1.新增用户:30天内新注册的用户'+'<br/>'+
+        '2.活跃用户:90天内登录过商城的用户(排除新增用户和回流客户)'+'<br/>'+
+        '3.不活跃用户:90天内未登录过商城的用户(排除流失用户和沉默用户)'+'<br/>'+
+        '4.流失用户:两年内未登录且没有订单的机构'+'<br/>'+
+        '5.回流用户:上一统计阶段的流失用户中后续登录商城的用户或者后续有订单的用户'+'<br/>'+
+        '6.忠诚用户:90天内登录过商城且有订单记录的用户(排除新增用户,活跃用户)'+'<br/>'+
+        '7.沉默用户:两年内未登录过商城,但是在两年内存在订单的用户(排除回流用户)';
 
 
+        var content2 = '1. 一般保持客户,指最近一次交易距今时间大于60天,交易频率大于等于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
+            '2. 一般发展客户,指最近一次交易距今时间小于等于60天,交易频率小于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
+            '3. 一般价值客户,指最近一次交易距今时间小于等于60天,交易频率大于等于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
+            '4. 一般挽留客户,指最近一次交易距今时间大于60天,交易频率小于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
+            '5.重要保持客户,指最近一次交易距今时间大于60天,交易频率大于等于一月一次,上个月交易金额大于等于¥100000的客户'+'<br/>'+
+            '6.重要发展客户,指最近一次交易距今时间小于等于60天,交易频率小于一月一次,上个月交易金额大于等于¥100000的客户'+'<br/>'+
+            '7.重要价值客户,指最近一次交易距今时间小于等于60天,交易频率大于等于一月一次,上个月交易金额大于等于¥100000的客户'+'<br/>'+
+            '8.重要挽留客户,指最近一次交易距今时间大于60天,交易频率小于一月一次,上个月交易金额大于等于¥100000的客户';
+
+        var typeMap = {
+                1:content,
+                2:content2
+            }
+        $.jBox.alert(typeMap[type],'提示',{ width: 450 })
+    }
 </script>
 </script>
 </body>
 </body>
 </html>
 </html>