Przeglądaj źródła

推送版本bugfix

Duan_xu 2 lat temu
rodzic
commit
decdf4e9f7

+ 25 - 221
src/main/java/com/caimei/modules/coupon/web/CmCouponController.java

@@ -146,227 +146,28 @@ public class CmCouponController extends BaseController {
             return "modules/coupon/couponNewUserForm";
         }
     }
-    @Scheduled(cron = "0 0/3 * * * ?")
-public void ConSumertime(){
-        logger.info("》》》》》》》》》》》开始检测优惠券是否生效");
-   List<CmCoupon>coupons=messageCenterDao.couponTime();
-   coupons.forEach(cmCoupon->{
-       List<Integer> clubIds = messageCenterDao.ClubIds();
-       new Thread(() ->  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 = Integer.parseInt(clubIdc);
-           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(clubId);
-                           messageCenter.setUserType(1);
-                           messageCenter.setMessageType(4);
-                           messageCenter.setContent(null);
-                           messageCenter.setTime(curDateStr);
-                           messageCenter.setCouponType(0);
-                           messageCenter.setCouponMessageType(1);
-                           messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                           messageCenterDao.addMessageCenter(messageCenter);
-                           String content = "【采美365】采美平台送您" + coupon.getCouponAmount() + "元优惠券,众多大牌正品等着您,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取下单吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                           boolean sendSms = false;
-                           try {
-                               sendSms = newOrderService.getSendSms(9, 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(clubId);
-                           messageCenter.setUserType(1);
-                           messageCenter.setMessageType(4);
-                           if (coupon != null && "1".equals(coupon.getCategoryType())) {
-                               catego = "产品";
-                           }
-                           if (coupon != null && "2".equals(coupon.getCategoryType())) {
-                               catego = "仪器";
-                           }
-                           messageCenter.setContent(catego);
-                           messageCenter.setTime(curDateStr);
-                           messageCenter.setCouponType(1);
-                           messageCenter.setCouponMessageType(1);
-                           messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                           messageCenterDao.addMessageCenter(messageCenter);
-                           String content = "【采美365】采美平台" + catego + "类商品大优惠,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                           boolean sendSms = false;
-                           try {
-                               sendSms = newOrderService.getSendSms(9, 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) {
-                           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(clubId);
-                               messageCenter.setUserType(1);
-                               messageCenter.setMessageType(4);
-                               messageCenter.setContent(null);
-                               messageCenter.setTime(curDateStr);
-                               messageCenter.setCouponType(2);
-                               messageCenter.setCouponMessageType(1);
-                               messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                               messageCenterDao.addMessageCenter(messageCenter);
-
-                               String content = "【采美365】为了答谢您对采美平台的支持,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                               boolean sendSms = false;
-                               try {
-                                   sendSms = newOrderService.getSendSms(9, user.getBindMobile(), content);
-                               } catch (Exception e) {
-                                   e.printStackTrace();
-                               }
-                               if (sendSms) {
-                                   logger.info(">>>>>>>发送成功");
-                               }
-
-                               jedis.del("mess"+clubIdc);
-                               coumt++;
-                           }
-                       }
-                   }
-                   if ("90".equals(user.getClubStatus()) && coumt == 0 && 3 == cmCoupon.getCouponType()) {
-                       CmCoupon coupon = messageCenterDao.CouponList(3);//查询优惠券信息
-                       if (coupon != null) {
-                           String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-                           MessageCenter messageCenter = new MessageCenter();
-                           messageCenter.setShopId(null);
-                           messageCenter.setClubId(clubId);
-                           messageCenter.setUserType(1);
-                           messageCenter.setMessageType(4);
-                           messageCenter.setContent(user.getName());
-                           messageCenter.setTime(curDateStr);
-                           messageCenter.setCouponType(3);
-                           messageCenter.setCouponMessageType(1);
-                           messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                           messageCenterDao.addMessageCenter(messageCenter);
-
-                           String content = "【采美365】采美平台为了回馈客户,赠送您" + coupon.getCouponAmount() + "元的店铺专属优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                           boolean sendSms = false;
-                           try {
-                               sendSms = newOrderService.getSendSms(9, 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());
-                           int num = startDate.compareTo(user.getRegisterTime());
-                           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(clubId);
-                                   messageCenter.setUserType(1);
-                                   messageCenter.setMessageType(4);
-                                   messageCenter.setContent(null);
-                                   messageCenter.setTime(curDateStr);
-                                   messageCenter.setCouponType(4);
-                                   messageCenter.setCouponMessageType(1);
-                                   messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
-                                   messageCenterDao.addMessageCenter(messageCenter);
-
-                                   String content = "【采美365】恭喜成功注册采美平台。采美平台赠送您" + coupon.getCouponAmount() + "元新用户优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
-                                   boolean sendSms = false;
-                                   try {
-                                       sendSms = newOrderService.getSendSms(9, 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));
-       }));
-   });
 
-}
+
+
 
 
     //优惠券站内消息推送
     private void consumer(CmCoupon cmCoupon, List<Integer> clubIds) {
         // 消费消息
-//        while (true) {
+        while (true) {
             clubIds.forEach(clubIdb -> {
-                Jedis jedis=null;
-                String constraint="";
-                if(domain.contains("-b")){
-                    jedis=new Jedis("172.31.165.27", 6379);
+                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);
+                } 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());
+                String clubIdc = jedis.rpop("mess" + clubIdb.toString());
                 Integer clubId = Integer.parseInt(clubIdc);
                 if (clubId != null) {
                     Date date = new Date();
@@ -401,7 +202,7 @@ public void ConSumertime(){
                                 if (sendSms) {
                                     logger.info(">>>>>>>发送成功");
                                 }
-                                jedis.del("mess"+clubIdc);
+                                jedis.del("mess" + clubIdc);
                                 coumt++;
                             }
                         }
@@ -437,18 +238,20 @@ public void ConSumertime(){
                                     logger.info(">>>>>>>发送成功");
                                 }
 
-                                jedis.del("mess"+clubIdc);
+                                jedis.del("mess" + clubIdc);
                                 coumt++;
                             }
                         }
                         if (coumt == 0 && 2 == cmCoupon.getCouponType()) {
                             CmCoupon coupon = messageCenterDao.CouponList(2);//查询优惠券信息
                             if (coupon != null) {
+                                if(coupon.getUserId()!=null){
+                                Integer clubc=messageCenterDao.clubIdCule(coupon.getUserId());
                                 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(clubId);
+                                    messageCenter.setClubId(clubc);
                                     messageCenter.setUserType(1);
                                     messageCenter.setMessageType(4);
                                     messageCenter.setContent(null);
@@ -457,7 +260,7 @@ public void ConSumertime(){
                                     messageCenter.setCouponMessageType(1);
                                     messageCenter.setCouponFee(coupon.getCouponAmount().doubleValue());
                                     messageCenterDao.addMessageCenter(messageCenter);
-
+                                }
                                     String content = "【采美365】为了答谢您对采美平台的支持,采美平台送您" + coupon.getCouponAmount() + "元优惠券,快戳采美网站链接www.caimei365.com/M2Tr98CG 或微信搜索“采美采购商城”小程序登录采美平台领取吧。关注公众号“采美网”获取更多优惠和精彩资讯。";
                                     boolean sendSms = false;
                                     try {
@@ -469,7 +272,7 @@ public void ConSumertime(){
                                         logger.info(">>>>>>>发送成功");
                                     }
 
-                                    jedis.del("mess"+clubIdc);
+                                    jedis.del("mess" + clubIdc);
                                     coumt++;
                                 }
                             }
@@ -501,7 +304,7 @@ public void ConSumertime(){
                                     logger.info(">>>>>>>发送成功");
                                 }
 
-                                jedis.del("mess"+clubIdc);
+                                jedis.del("mess" + clubIdc);
                                 coumt++;
                             }
                         }
@@ -510,7 +313,7 @@ public void ConSumertime(){
                             if (coupon != null) {
                                 String startDate = sdf.format(coupon.getStartDate());
                                 int num = startDate.compareTo(user.getRegisterTime());
-                                if (num > 0) {
+                                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) {
@@ -536,7 +339,7 @@ public void ConSumertime(){
                                             logger.info(">>>>>>>发送成功");
                                         }
 
-                                        jedis.del("mess"+clubIdc);
+                                        jedis.del("mess" + clubIdc);
                                         coumt++;
                                     }
                                 }
@@ -544,9 +347,10 @@ public void ConSumertime(){
                         }
                     }
                 }
-                jedis.del("mess"+clubIdc);
-                System.out.println(jedis.rpop("mess"+clubIdc));
+                jedis.del("mess" + clubIdc);
+                System.out.println(jedis.rpop("mess" + clubIdc));
             });
+        }
 
         }
 

+ 3 - 2
src/main/java/com/caimei/modules/order/entity/CmDiscernReceipt.java

@@ -79,8 +79,9 @@ public class CmDiscernReceipt extends DataEntity<CmDiscernReceipt> {
     private String jgName;//机构名称
     private String paYee;//收款方(虚拟字段)
     private Integer shopID;//收款方关联供应商id
-    private String  validityDate;//生效时间期(没存库)
-    private String expirationDate;//到期时间(没存库)
+
+    private String  validityDate;//生效时间期
+    private String expirationDate;//到期时间
     private Integer receStatct;//免除上架费标识0,正常1,免除
     private String receiptID;//收款id
     private String linkMan;

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

@@ -927,6 +927,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         list.add("13100721916");
         list.add("15113936829");
         list.add("18175515644");
+        list.add("18476937515");
         if (config.equals("product") || list.contains(mobile)) {
             if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
                 String regex = "^(1[3-9]\\d{9}$)";

+ 16 - 19
src/main/java/com/caimei/modules/order/service/WeChatService.java

@@ -209,17 +209,15 @@ public class WeChatService {
      */
     public void sendTemplate(String accessToken, String openid,String shopName,String auditNote,String auditTime, String pagePath) {
         JSONObject first = new JSONObject();
-        first.put("value", "审核失败通知");
+        first.put("value", "您提交的供应商账号注册申请审核失败。");
         JSONObject keyword1 = new JSONObject();
-        keyword1.put("value", "您提交的供应商账号注册申请审核失败。");
+        keyword1.put("value", shopName);
         JSONObject keyword2 = new JSONObject();
-        keyword2.put("value", shopName);
+        keyword2.put("value", "账号注册");
         JSONObject keyword3 = new JSONObject();
-        keyword3.put("value", "账号注册");
+        keyword3.put("value", auditNote);
         JSONObject keyword4 = new JSONObject();
-        keyword4.put("value", auditNote);
-        JSONObject keyword5 = new JSONObject();
-        keyword5.put("value", auditTime);
+        keyword4.put("value", auditTime);
         JSONObject remark = new JSONObject();
         remark.put("value", "请修改重新提交审核。");
 
@@ -229,7 +227,6 @@ public class WeChatService {
         data.put("keyword2", keyword2);
         data.put("keyword3", keyword3);
         data.put("keyword4", keyword4);
-        data.put("keyword5", keyword5);
         data.put("remark", remark);
 
         JSONObject miniProgram = new JSONObject();
@@ -238,7 +235,7 @@ public class WeChatService {
 
         JSONObject json = new JSONObject();
         json.put("touser", openid);
-        json.put("template_id", "ph3XjF5o2QPuANQW2XlO7PRYU7Y9t-3fAX5TSqwTftk");
+        json.put("template_id", "QogD0Mu5zvNo51hqJXXNYiVByuDmYLxg2kxHUMqlyCI");
         json.put("url", "https://www.caimei365.com/");
         json.put("miniprogram", miniProgram);
         json.put("data", data);
@@ -272,6 +269,8 @@ public class WeChatService {
         keyword3.put("value", auditTime);
         JSONObject keyword4 = new JSONObject();
         keyword4.put("value", name);
+        JSONObject remark = new JSONObject();
+        remark.put("value", "请前往采美网站修改商品信息重新发布");
 
         JSONObject data = new JSONObject();
         data.put("first", first);
@@ -279,6 +278,7 @@ public class WeChatService {
         data.put("keyword2", keyword2);
         data.put("keyword3", keyword3);
         data.put("keyword4", keyword4);
+        data.put("remark", remark);
 
         JSONObject miniProgram = new JSONObject();
         miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
@@ -311,19 +311,17 @@ public class WeChatService {
      */
     public void messteme(String accessToken, String openid,String name,String qualificationNo,String auditTime,String proName, String pagePath) {
         JSONObject first = new JSONObject();
-        first.put("value", "证书到期提醒");
+        first.put("value", "您好,您有商品资质证书即将到期。");
         JSONObject keyword1 = new JSONObject();
-        keyword1.put("value", "您好,您有商品资质证书即将到期。");
+        keyword1.put("value", name);
         JSONObject keyword2 = new JSONObject();
-        keyword2.put("value", name);
+        keyword2.put("value", "医疗器械注册证");
         JSONObject keyword3 = new JSONObject();
-        keyword3.put("value", "医疗器械注册证");
+        keyword3.put("value", qualificationNo);
         JSONObject keyword4 = new JSONObject();
-        keyword4.put("value", qualificationNo);
-        JSONObject keyword5 = new JSONObject();
         keyword4.put("value", auditTime);
-        JSONObject keyword6 = new JSONObject();
-        keyword4.put("value", proName);
+        JSONObject remark = new JSONObject();
+        remark.put("value", proName);
 
         JSONObject data = new JSONObject();
         data.put("first", first);
@@ -331,8 +329,7 @@ public class WeChatService {
         data.put("keyword2", keyword2);
         data.put("keyword3", keyword3);
         data.put("keyword4", keyword4);
-        data.put("keyword5", keyword5);
-        data.put("keyword6", keyword6);
+        data.put("remark", remark);
 
         JSONObject miniProgram = new JSONObject();
         miniProgram.put("appid", "wxf3cd4ae0cdd11c36");

+ 0 - 29
src/main/java/com/caimei/modules/product/service/ProductNewService.java

@@ -232,35 +232,6 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         SimpleDateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String createDates = formatters.format(new Date());
         product.setNewshowTime(createDates);
-        Product pro=new Product();
-        pro=productNewDao.validIList(productID);
-        if("8".equals(validFlag)){
-            if("1".equals(pro.getValidFlag())){
-                String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
-               boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
-               if(sendSms){
-                   logger.info(">>>>>>>发送成功");
-               }
-            }
-            try {
-                logger.info("********供应商审核失败微信公众号推送********");
-                String unionid = newShopOrderDao.UnionId(pro.getUserId());
-                List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
-                logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
-                String accessToken = weChatService.getAccessToken();
-                Date date=new Date();
-                String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
-
-                String pagePath = "https://www.caimei365.com/";
-                for (String openid : openidList) {
-                    weChatService.sendTemp(accessToken, openid,pro.getName(),auditTime, pagePath);
-                }
-            } catch (Exception e) {
-                logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
-            }
-        }
-
-
         NewPageFloorImage floorImage=new NewPageFloorImage();
         floorImage.setFloorId(productNewDao.newFloorId());
         floorImage.setImage(product.getMainImage());

+ 36 - 0
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -8,6 +8,9 @@ import com.caimei.modules.common.service.AreaService;
 import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.opensearch.CoreServiceUitls;
 import com.caimei.modules.opensearch.GenerateUtils;
+import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.WeChatService;
 import com.caimei.modules.product.dao.ProductNewDao;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.service.*;
@@ -88,6 +91,14 @@ public class ProductNewController extends BaseController {
     private ProductNewDao productNewDao;
     @Autowired
     private MessageCenterDao messageCenterDao;
+    @Autowired
+    private NewOrderService newOrderService;
+    @Autowired
+    private WeChatService weChatService;
+    @Autowired
+    private NewShopOrderDao newShopOrderDao;
+
+
     @ModelAttribute
     public Product get(@RequestParam(required = false) String id) {
         Product entity = null;
@@ -903,6 +914,30 @@ public class ProductNewController extends BaseController {
                messageCenter.setProductId(productID);
                messageCenter.setTime(current);
                messageCenterDao.addMessageCenter(messageCenter);
+               Product pro=new Product();
+               pro=productNewDao.validIList(productID);
+                   String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
+                   boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
+                   if(sendSms){
+                       logger.info(">>>>>>>发送成功");
+                   }
+               try {
+                   logger.info("********供应商审核失败微信公众号推送********");
+                   String unionid = newShopOrderDao.UnionId(pro.getUserId());
+                   logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid);
+                   List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+
+                   String accessToken = weChatService.getAccessToken();
+                   Date date=new Date();
+                   String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+
+                   String pagePath = "/pages/login/apply-supplier";
+                   for (String openid : openidList) {
+                       weChatService.sendTemp(accessToken, openid,pro.getName(),auditTime, pagePath);
+                   }
+               } catch (Exception e) {
+                   logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
+               }
            }
             if(newvalidFlag!=null){
                 if(newvalidFlag ==2) {
@@ -918,6 +953,7 @@ public class ProductNewController extends BaseController {
                 }
             }
 
+
             map.put("success", true);
             map.put("msg", "操作成功");
             int valid = new Integer(validFlag);

+ 1 - 1
src/main/java/com/caimei/modules/supervip/service/CmSvipGiveService.java

@@ -51,7 +51,7 @@ Integer clubID=messageCenterDao.clubIdCule(Integer.parseInt(cmSvipGive.getUserId
         messageCenter.setUserType(1);
         messageCenter.setMessageType(2);
         messageCenter.setAccountType(4);
-        messageCenter.setContent(cmSvipGive.getMonth().toString());
+        messageCenter.setContent(cmSvipGive.getMonth().toString()+"个月");
         messageCenter.setTime(curDateStr);
         messageCenterDao.addMessageCenter(messageCenter);
 

+ 11 - 6
src/main/java/com/caimei/modules/sys/web/NotificationController.java

@@ -313,7 +313,8 @@ public class NotificationController extends BaseController {
         jedis.lpush("constraint","0");
     }
 
-    @Scheduled(cron = "0 0 11 * * ?")
+//    @Scheduled(cron = "0 0 11 * * ?")
+//@Scheduled(cron = "0 0/2 * * * ?")
     public void mess() throws Exception {
         Date date=new Date();
         String name="";
@@ -332,6 +333,7 @@ public class NotificationController extends BaseController {
             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();
@@ -339,7 +341,7 @@ public class NotificationController extends BaseController {
                     String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
                     String pagePath = "";
                     for (String openid : openidList) {
-                        weChatService.messteme(accessToken, openid,pro.get(i).getShopName() , qualificationNo, time, name, pagePath);
+                        weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
                         count++;
                     }
                 } catch (Exception e) {
@@ -365,6 +367,7 @@ public class NotificationController extends BaseController {
             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();
@@ -372,7 +375,7 @@ public class NotificationController extends BaseController {
                 String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
                 String pagePath = "";
                 for (String openid : openidList) {
-                    weChatService.messteme(accessToken, openid,pro1.get(i).getShopName() , qualificationNo, time, name, pagePath);
+                    weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
                     count++;
                 }
             } catch (Exception e) {
@@ -398,6 +401,7 @@ public class NotificationController extends BaseController {
             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();
@@ -405,7 +409,7 @@ public class NotificationController extends BaseController {
                 String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
                 String pagePath = "";
                 for (String openid : openidList) {
-                    weChatService.messteme(accessToken, openid,pro2.get(i).getShopName() , qualificationNo, time, name, pagePath);
+                    weChatService.messteme(accessToken, openid,shopName, qualificationNo, time, name, pagePath);
                     count++;
                 }
             } catch (Exception e) {
@@ -431,6 +435,7 @@ public class NotificationController extends BaseController {
             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();
@@ -438,7 +443,7 @@ public class NotificationController extends BaseController {
                 String time = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
                 String pagePath = "";
                 for (String openid : openidList) {
-                    weChatService.messteme(accessToken, openid,pro3.get(i).getShopName() , qualificationNo, time, name, pagePath);
+                    weChatService.messteme(accessToken, openid,shopName , qualificationNo, time, name, pagePath);
                     count++;
                 }
             } catch (Exception e) {
@@ -489,7 +494,7 @@ if(count<=0){
         notificationDao.hides();
         return "redirect:"+Global.getAdminPath()+"/sys/Notification/list";
     }
-    @Scheduled(cron = "0 0/2 * * * ?")
+//    @Scheduled(cron = "0 0/2 * * * ?")
     public void time(){
         logger.info("》》》》》》》》》》》开始检测商品资质证书和上架费是否过期");
         //械字号资质证书3个月后过期

+ 5 - 0
src/main/java/com/caimei/modules/user/dao/MessageCenterDao.java

@@ -41,5 +41,10 @@ public interface MessageCenterDao extends CrudDao<MessageCenter> {
 
     Integer userID(Integer shopID);
 
+    String shopName(Integer shopID);
+
     List<CmCoupon> couponTime();
+
+    Integer count();
+
 }

+ 4 - 0
src/main/java/com/caimei/modules/user/dao/NewCmShopDao.java

@@ -50,4 +50,8 @@ public interface NewCmShopDao extends CrudDao<NewCmShop> {
     void Removethelastfee(CmDiscernReceipt cmDiscernReceipt);
 
     void Removethelast(CmDiscernReceipt cmDiscernReceipt);
+
+    void cmreceipt(CmDiscernReceipt cmDiscernReceipt);
+
+    CmDiscernReceipt cmrectiptlist(Integer shopID);
 }

+ 10 - 0
src/main/java/com/caimei/modules/user/service/NewCmShopService.java

@@ -358,4 +358,14 @@ public class NewCmShopService extends CrudService<NewCmShopDao, NewCmShop> {
     public void Removethelast(CmDiscernReceipt cmDiscernReceipt) {
         newCmShopDao.Removethelast(cmDiscernReceipt);
     }
+
+    @Transactional(readOnly = false)
+    public void cmreceipt(CmDiscernReceipt cmDiscernReceipt) {
+        newCmShopDao.cmreceipt(cmDiscernReceipt);
+    }
+
+    @Transactional(readOnly = false)
+    public CmDiscernReceipt cmrectiptlist(Integer shopID) {
+       return newCmShopDao.cmrectiptlist(shopID);
+    }
 }

+ 53 - 28
src/main/java/com/caimei/modules/user/web/NewCmShopController.java

@@ -194,9 +194,12 @@ public class NewCmShopController extends BaseController {
         Page<CmDiscernReceipt>discernReceipt = newCmShopService.maintenanceList(new Page<CmDiscernReceipt>(request, response, 20),cmDiscernReceipt);
         String date="";
         int num=0;
-        Calendar calendar = Calendar.getInstance();
+
+
         Date currentTime = new Date();
-        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar calendar = Calendar.getInstance();
+        Calendar calendars = Calendar.getInstance();
         //当前时间
         String dateString = formatter.format(currentTime);
         //到期时间
@@ -204,33 +207,55 @@ public class NewCmShopController extends BaseController {
         //生效时间
         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();
-            Date time = formatter.parse(receiptDate);
-             validityDate = formatter.format(time);
-            calendar.setTime(time);
-            calendar.add(Calendar.YEAR, 1);
+            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());
+            num = dateStrings.compareTo(dateString);
+            }else {
+                String receipt=cmDiscern.getExpirationDate();
+                if(!receipt.contains(":")){
+                    receipt+=" 00:00:01";
+                }
+                Date rece = formatter.parse(receipt);
+                calendar.setTime(rece);
+                calendar.add(Calendar.YEAR, 1);
+                dateStrings= formatter.format(calendar.getTime());
+                num = dateStrings.compareTo(dateString);
+            }
+            //到期时间如果小于当前时间就是过期了生效时间需要加1天
+            if (num < 0) {
+                calendars.setTime(receipttime);
+                calendars.add(Calendar.DATE, 1);
+                validityDate= formatter.format(calendars.getTime());
+                cmDiscernReceipt.setValidityDate(validityDate);
+                cmDiscernReceipt.setExpirationDate(dateStrings);
+            }
+            //到期时间如果大于当前时间就是续费了生效是到期时间需要加1年
+            if (num > 0) {
+                Date times = formatter.parse(receiptDate);
+                calendars.setTime(times);
+                calendars.add(Calendar.DATE, 1);
+                validityDate= formatter.format(calendars.getTime());
+                cmDiscernReceipt.setValidityDate(validityDate);
+
+                Date timed = formatter.parse(dateStrings);
+                calendar.setTime(timed);
+                calendar.add(Calendar.DATE, 1);
+                dateStrings= formatter.format(calendar.getTime());
+                cmDiscernReceipt.setExpirationDate(dateStrings);
+            }
+            newCmShopService.cmreceipt(cmDiscernReceipt);
 
 
-                num = dateStrings.compareTo(dateString);
-                if (num < 0) {
-                    cmDiscernReceipt.setValidityDate(validityDate);
-                    cmDiscernReceipt.setExpirationDate(dateStrings);
-                }
-                if (num > 0) {
-                    Date times = formatter.parse(receiptDate);
-                    calendar.setTime(times);
-                    calendar.add(Calendar.DATE, 1);
-                    validityDate= formatter.format(calendar.getTime());
-                    cmDiscernReceipt.setValidityDate(validityDate);
-                    Date timed = formatter.parse(dateStrings);
-                    calendar.setTime(timed);
-                    calendar.add(Calendar.DATE, 1);
-                    dateStrings= formatter.format(calendar.getTime());
-                    cmDiscernReceipt.setExpirationDate(dateStrings);
-                }
             discernReceipt.getList().get(i).setValidityDate(cmDiscernReceipt.getValidityDate());
             discernReceipt.getList().get(i).setExpirationDate(cmDiscernReceipt.getExpirationDate());
             cmDiscernReceipt.setReceiptID(discernReceipt.getList().get(i).getReceiptID());
@@ -345,7 +370,7 @@ public class NewCmShopController extends BaseController {
                     }
                 }
                 manufacturerStatus = "90";
-                smsMessage = "【采美365】您提供的资料已审核通过,恭喜您成为采美平台供应商用户。您可通过申请时填写的手机号和密码登录采美平台管理您的账户。";
+                smsMessage = "您提供的资料已审核通过,恭喜您成为采美平台供应商用户。您可通过申请时填写的手机号和密码登录采美平台管理您的账户。";
             }
             if (StringUtils.equals("2", auditStatus)) {
                 //获取操作时间
@@ -366,11 +391,11 @@ public class NewCmShopController extends BaseController {
                     }
                 }
                 manufacturerStatus = "92";
-                smsMessage = "【采美365】您提供的资料未通过审核,申请采美平台供应商账户失败。请使用申请时填写的手机号和密码登录采美平台进行信息修改后,重新提交审核。";
+                smsMessage = "您提供的资料未通过审核,申请采美平台供应商账户失败。请使用申请时填写的手机号和密码登录采美平台进行信息修改后,重新提交审核。";
                 try {
                     logger.info("********供应商审核失败微信公众号推送********");
                     String unionid = newShopOrderDao.UnionId(userId);
-                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission("ox_1SwWx9u-HFIAZkQVFsE4NBRE0");
                     logger.info("userid>>>>>>>>>>>>>>>" + userId + "unionid》》》》》》》》》》" + unionid + "openid》》》》》》》》》" + openidList);
                     String accessToken = weChatService.getAccessToken();
                     String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
@@ -400,14 +425,14 @@ public class NewCmShopController extends BaseController {
             messageCenter.setClubId(null);
             messageCenter.setUserType(2);
             messageCenter.setMessageType(2);
-            messageCenter.setShopMessType(2);
+            messageCenter.setShopMessType(1);
             messageCenter.setContent(null);
             messageCenter.setTime(curDateStr);
             messageCenterDao.addMessageCenter(messageCenter);
             if (StringUtils.isNotEmpty(mobile)) {
                 boolean sendSms = newOrderService.getSendSms(9, mobile, smsMessage);
                 if(sendSms){
-                    logger.info(">>>>>>>获得采美平台赠送的超级会员短信推送成功");
+                    logger.info(">>>>>>>获得供应商账户审核短信推送成功");
                 }else {
                     SMSUtils.sendSms(mobile, smsMessage);
                 }

+ 23 - 19
src/main/java/com/thinkgem/jeesite/modules/sys/web/LoginController.java

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.redis.RedisService;
 import org.apache.shiro.authz.UnauthorizedException;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -46,7 +47,8 @@ public class LoginController extends BaseController{
 	private RedisService redisService;
 	@Autowired
 	private SessionDAO sessionDAO;
-	
+	@Autowired
+	MessageCenterDao messageCenterDao;
 	/**
 	 * 管理登录
 	 */
@@ -59,16 +61,16 @@ public class LoginController extends BaseController{
 //		if (tabmode == null){
 //			CookieUtils.setCookie(response, "tabmode", "1");
 //		}
-		
+
 		if (logger.isDebugEnabled()){
 			logger.debug("login, active session size: {}", sessionDAO.getActiveSessions(false).size());
 		}
-		
+
 		// 如果已登录,再次访问主页,则退出原账号。
 		if (Global.TRUE.equals(Global.getConfig("notAllowRefreshIndex"))){
 			CookieUtils.setCookie(response, "LOGINED", "false");
 		}
-		
+
 		// 如果已经登录,则跳转到管理首页
 		if(principal != null && !principal.isMobileLogin()){
 			return "redirect:" + adminPath;
@@ -88,7 +90,7 @@ public class LoginController extends BaseController{
 	@RequestMapping(value = "${adminPath}/login", method = RequestMethod.POST)
 	public String loginFail(HttpServletRequest request, HttpServletResponse response, Model model) {
 		Principal principal = UserUtils.getPrincipal();
-		
+
 		// 如果已经登录,则跳转到管理首页
 		if(principal != null){
 			return "redirect:" + adminPath;
@@ -99,7 +101,7 @@ public class LoginController extends BaseController{
 		boolean mobile = WebUtils.isTrue(request, FormAuthenticationFilter.DEFAULT_MOBILE_PARAM);
 		String exception = (String)request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
 		String message = (String)request.getAttribute(FormAuthenticationFilter.DEFAULT_MESSAGE_PARAM);
-		
+
 		if (StringUtils.isBlank(message) || StringUtils.equals(message, "null")){
 			message = "用户或密码错误, 请重试.";
 		}
@@ -109,25 +111,25 @@ public class LoginController extends BaseController{
 		model.addAttribute(FormAuthenticationFilter.DEFAULT_MOBILE_PARAM, mobile);
 		model.addAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME, exception);
 		model.addAttribute(FormAuthenticationFilter.DEFAULT_MESSAGE_PARAM, message);
-		
+
 		if (logger.isDebugEnabled()){
-			logger.debug("login fail, active session size: {}, message: {}, exception: {}", 
+			logger.debug("login fail, active session size: {}, message: {}, exception: {}",
 					sessionDAO.getActiveSessions(false).size(), message, exception);
 		}
-		
+
 		// 非授权异常,登录失败,验证码加1。
 		if (!UnauthorizedException.class.getName().equals(exception)){
 			model.addAttribute("isValidateCodeLogin", isValidateCodeLogin(username, true, false));
 		}
-		
+
 		// 验证失败清空验证码
 		request.getSession().setAttribute(ValidateCodeServlet.VALIDATE_CODE, IdGen.uuid());
-		
+
 		// 如果是手机登录,则返回JSON字符串
 		if (mobile){
 	        return renderString(response, model);
 		}
-		
+
 		return "modules/sys/sysLogin";
 	}
 
@@ -136,17 +138,19 @@ public class LoginController extends BaseController{
 	 */
 	@RequiresPermissions("user")
 	@RequestMapping(value = "${adminPath}")
-	public String index(HttpServletRequest request, HttpServletResponse response) {
+	public String index(HttpServletRequest request, HttpServletResponse response,Model model) {
 		redisService.set("onLineFlag","online",36000l);//设置10小时有效(提供老admin系统免登入)
 		Principal principal = UserUtils.getPrincipal();
+		Integer count=messageCenterDao.count();
+		model.addAttribute("count",count);
 
 		// 登录成功后,验证码计算器清零
 		isValidateCodeLogin(principal.getLoginName(), false, true);
-		
+
 		if (logger.isDebugEnabled()){
 			logger.debug("show index, active session size: {}", sessionDAO.getActiveSessions(false).size());
 		}
-		
+
 		// 如果已登录,再次访问主页,则退出原账号。
 		if (Global.TRUE.equals(Global.getConfig("notAllowRefreshIndex"))){
 			String logined = CookieUtils.getCookie(request, "LOGINED");
@@ -157,7 +161,7 @@ public class LoginController extends BaseController{
 				return "redirect:" + adminPath + "/login";
 			}
 		}
-		
+
 		// 如果是手机登录,则返回JSON字符串
 		if (principal.isMobileLogin()){
 			if (request.getParameter("login") != null){
@@ -168,7 +172,7 @@ public class LoginController extends BaseController{
 			}
 			return "redirect:" + adminPath + "/login";
 		}
-		
+
 //		// 登录成功后,获取上次登录的当前站点ID
 //		UserUtils.putCache("siteId", StringUtils.toLong(CookieUtils.getCookie(request, "siteId")));
 
@@ -188,7 +192,7 @@ public class LoginController extends BaseController{
 //		System.out.println("==========================b");
 		return "modules/sys/sysIndex";
 	}
-	
+
 	/**
 	 * 获取主题方案
 	 */
@@ -201,7 +205,7 @@ public class LoginController extends BaseController{
 		}
 		return "redirect:"+request.getParameter("url");
 	}
-	
+
 	/**
 	 * 是否是验证码登录
 	 * @param useruame 用户名

+ 2 - 0
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -1164,6 +1164,8 @@
 
     <select id="UnionId" resultType="java.lang.String">
         SELECT unionID FROM `cm_order` WHERE userID=#{userID}
+        ORDER BY orderID DESC
+        LIMIT 1
     </select>
 
     <select id="getProductOrder" resultType="java.lang.String">

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

@@ -19,7 +19,7 @@
     </select>
 
     <select id="Mobile" resultType="java.lang.String">
-        SELECT contractMobile FROM shop WHERE shoprID=#{shopID}
+        SELECT contractMobile FROM shop WHERE shopID=#{shopID}
     </select>
 
 
@@ -30,6 +30,10 @@
         SELECT shopID FROM `product` WHERE productID=#{productID}
     </select>
 
+    <select id="shopName" resultType="java.lang.String">
+        SELECT name FROM shop where shopID=#{shopID}
+    </select>
+
     <select id="ClubIds" resultType="java.lang.Integer">
         SELECT clubID FROM `user` WHERE YEAR(loginTime)>YEAR(NOW())-3 AND clubID IS NOT NULL
 #         ORDER BY clubID DESC
@@ -57,4 +61,9 @@
             AND delFlag=0
     </select>
 
+    <select id="count" resultType="integer">
+        SELECT COUNT(*) FROM `notification` WHERE saved=0
+    </select>
+
+
 </mapper>

+ 415 - 389
src/main/resources/mappings/modules/user/NewCmShopMapper.xml

@@ -2,8 +2,8 @@
 <!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.NewCmShopDao">
 
-	<sql id="newCmShopColumns">
-		a.shopID AS "shopID",
+    <sql id="newCmShopColumns">
+        a.shopID AS "shopID",
 		a.checkMan as "checkMan",
 		a.userID AS "userID",
 		a.name AS "name",
@@ -61,411 +61,437 @@
 		a.cardNumber AS "cardNumber",
 		a.chargeSupport AS "chargeSupport",
 		d.name AS "province",c.name AS "city",b.name AS "town"
-	</sql>
+    </sql>
 
-	<sql id="newCmShopJoins">
-		LEFT JOIN user u ON u.userID = a.userID
+    <sql id="newCmShopJoins">
+        LEFT JOIN user u ON u.userID = a.userID
 		LEFT JOIN town b ON b.townID=a.townID
 		LEFT JOIN city c ON c.cityID=b.cityID
 		LEFT JOIN province d ON d.provinceID=c.provinceID
-	</sql>
+    </sql>
 
-	<select id="get" resultType="NewCmShop">
-		SELECT
-			<include refid="newCmShopColumns"/>
-		FROM shop a
-		<include refid="newCmShopJoins"/>
-		WHERE a.shopID = #{id}
-	</select>
+    <select id="get" resultType="NewCmShop">
+        SELECT
+        <include refid="newCmShopColumns"/>
+        FROM shop a
+        <include refid="newCmShopJoins"/>
+        WHERE a.shopID = #{id}
+    </select>
 
-	<select id="getShopcert" resultType="com.caimei.modules.cibe.entity.ShopCert">
-		SELECT
-			*
-		FROM shopcert s
-		WHERE s.shopID = #{shopId}
-		and s.shopCertTypeID = #{type}
-	</select>
+    <select id="getShopcert" resultType="com.caimei.modules.cibe.entity.ShopCert">
+        SELECT *
+        FROM shopcert s
+        WHERE s.shopID = #{shopId}
+          and s.shopCertTypeID = #{type}
+    </select>
 
-	<select id="findList" resultType="NewCmShop">
-		SELECT
-			<include refid="newCmShopColumns"/>
-		FROM shop a
-		<include refid="newCmShopJoins"/>
-		<where>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="status != null and status != ''">
-				AND a.status = #{status}
-			</if>
-			<if test="contractMobile != null and contractMobile != ''">
-				AND a.contractMobile = #{contractMobile}
-			</if>
-			<if test="linkMan != null and linkMan != ''">
-				AND a.linkMan LIKE concat('%',#{linkMan},'%')
-			</if>
-			<if test="shopType !=null">
-				AND a.shopType = #{shopType}
-			</if>
-			<if test="startTime != null and startTime != ''">
-				AND (u.registerTime &gt; #{startTime} OR  u.registerTime = #{startTime})
-			</if>
-			<if test="endTime != null and endTime != ''">
-				AND (u.registerTime &lt; #{endTime} OR  u.registerTime = #{endTime})
-			</if>
-			<if test="email != null and email != ''">
-				AND u.email = #{email}
-			</if>
-			<if test="source != null and source != ''">
-				AND u.source = #{source}
-			</if>
-			<if test="shopID != null and shopID>0">
-				AND a.shopID = #{shopID}
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY case when a.status = 91 then 0 else 1 end desc, a.shopID DESC
-			</otherwise>
-		</choose>
-	</select>
+    <select id="findList" resultType="NewCmShop">
+        SELECT
+        <include refid="newCmShopColumns"/>
+        FROM shop a
+        <include refid="newCmShopJoins"/>
+        <where>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="status != null and status != ''">
+                AND a.status = #{status}
+            </if>
+            <if test="contractMobile != null and contractMobile != ''">
+                AND a.contractMobile = #{contractMobile}
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                AND a.linkMan LIKE concat('%',#{linkMan},'%')
+            </if>
+            <if test="shopType !=null">
+                AND a.shopType = #{shopType}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND (u.registerTime &gt; #{startTime} OR u.registerTime = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (u.registerTime &lt; #{endTime} OR u.registerTime = #{endTime})
+            </if>
+            <if test="email != null and email != ''">
+                AND u.email = #{email}
+            </if>
+            <if test="source != null and source != ''">
+                AND u.source = #{source}
+            </if>
+            <if test="shopID != null and shopID>0">
+                AND a.shopID = #{shopID}
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY case when a.status = 91 then 0 else 1 end desc, a.shopID DESC
+            </otherwise>
+        </choose>
+    </select>
 
-	<select id="findAllList" resultType="NewCmShop">
-		SELECT
-			<include refid="newCmShopColumns"/>
-		FROM shop a
-		<include refid="newCmShopJoins"/>
-		<where>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
-		select shopId,commercialCode as splitCode,codeDetail as codeRemark,email as email,weChatFlag
-		from cm_shop_splitcode
-		where shopId = #{shopID}
-	</select>
+    <select id="findAllList" resultType="NewCmShop">
+        SELECT
+        <include refid="newCmShopColumns"/>
+        FROM shop a
+        <include refid="newCmShopJoins"/>
+        <where>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
+        select shopId, commercialCode as splitCode, codeDetail as codeRemark, email as email, weChatFlag
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </select>
 
-	<insert id="saveShopcert" parameterType="com.caimei.modules.cibe.entity.ShopCert" keyProperty="shopCertID" useGeneratedKeys="true">
-        INSERT INTO `shopcert` (
-        `shopID`,
-        `shopCertTypeID`,
-        `name`,
-        `image`,
-        `organization`,
-        `effectDate`,
-        `loseEfficacyDate`
-        )
-        VALUES(
-        #{shopID},
-        #{shopCertTypeID},
-        #{name},
-        #{image},
-        #{organization},
-        #{effectDate},
-        #{loseEfficacyDate}
-        )
+    <insert id="saveShopcert" parameterType="com.caimei.modules.cibe.entity.ShopCert" keyProperty="shopCertID"
+            useGeneratedKeys="true">
+        INSERT INTO `shopcert` (`shopID`,
+                                `shopCertTypeID`,
+                                `name`,
+                                `image`,
+                                `organization`,
+                                `effectDate`,
+                                `loseEfficacyDate`)
+        VALUES (#{shopID},
+                #{shopCertTypeID},
+                #{name},
+                #{image},
+                #{organization},
+                #{effectDate},
+                #{loseEfficacyDate})
     </insert>
 
 
-	<insert id="insert" parameterType="NewCmShop"  keyProperty="shopID" useGeneratedKeys="true">
-		INSERT INTO shop(
-			userID,
-			name,
-			sname,
-			logo,
-			legalPerson,
-			businessLicense,
-			businessLicenseImage,
-			taxCertificate,
-			taxCertificateImage,
-			provinceID,
-			cityID,
-			townID,
-			address,
-			registeredCapital,
-			nature,
-			turnover,
-			linkMan,
-			contractPhone,
-			contractMobile,
-			contractEmail,
-			fax,
-			zipCode,
-			info,
-			productDesc,
-			addTime,
-			auditStatus,
-			auditTime,
-			auditNote,
-			validFlag,
-			status,
-			maintenanceFee,
-			maintenanceDate,
-			businessScope,
-			firstShopType,
-			secondShopType,
-			medicalPracticeLicenseImg1,
-			medicalPracticeLicenseImg2,
-			medicalPracticeLicenseImg3,
-			mainpro,
-			socialCreditCode,
-		    shopType
-		) VALUES (
-			#{userID},
-			#{name},
-			#{sname},
-			#{logo},
-			#{legalPerson},
-			#{businessLicense},
-			#{businessLicenseImage},
-			#{taxCertificate},
-			#{taxCertificateImage},
-			#{provinceID},
-			#{cityID},
-			#{townID},
-			#{address},
-			#{registeredCapital},
-			#{nature},
-			#{turnover},
-			#{linkMan},
-			#{contractPhone},
-			#{contractMobile},
-		    #{contractEmail},
-			#{fax},
-			#{zipCode},
-			#{info},
-			#{productDesc},
-			#{addTime},
-			#{auditStatus},
-			#{auditTime},
-			#{auditNote},
-			#{validFlag},
-			#{status},
-			#{maintenanceFee},
-			#{maintenanceDate},
-			#{businessScope},
-			#{firstShopType},
-			#{secondShopType},
-			#{medicalPracticeLicenseImg1},
-			#{medicalPracticeLicenseImg2},
-			#{medicalPracticeLicenseImg3},
-			#{mainpro},
-			#{socialCreditCode},
-		    #{shopType}
-		)
-	</insert>
-	<insert id="insertSplitCode">
-		insert into cm_shop_splitcode
-		(shopId, commercialCode, codeDetail,email,weChatFlag)
-		values (#{shopId},#{splitCode},#{codeRemark},#{email},#{weChatFlag})
-	</insert>
-	<insert id="insertSepcial" parameterType="NewCmShop"  keyProperty="shopID" useGeneratedKeys="true">
-		insert into shop(name,linkMan,contractMobile,status,addTime,shopType)
-		VALUES (#{name},#{linkMan},#{contractMobile},#{status},now(),2)
-	</insert>
-	<update id="update">
-		UPDATE shop
-		<set>
-			<if test="name != null and name != ''" >
-			name = #{name},
-			</if>
-		    website = #{website},
-			wxOfficialAccount = #{wxOfficialAccount},
-			wxApplets = #{wxApplets},
-			<if test="chargeSupport != null" >
-				chargeSupport=#{chargeSupport},
-			</if>
-			<if test="sname != null and sname != ''" >
-				sname = #{sname},
-			</if>
-			<if test="logo != null and logo != ''" >
-				logo = #{logo},
-			</if>
-			<if test="legalPerson != null and legalPerson != ''" >
-				legalPerson = #{legalPerson},
-			</if>
-			<if test="businessLicense != null and businessLicense != ''" >
-				businessLicense = #{businessLicense},
-			</if>
-			<if test="businessLicenseImage != null and businessLicenseImage != ''" >
-				businessLicenseImage = #{businessLicenseImage},
-			</if>
-			<if test="taxCertificate != null and taxCertificate != ''" >
-				taxCertificate = #{taxCertificate},
-			</if>
-			<if test="taxCertificateImage != null and taxCertificateImage != ''" >
-				taxCertificateImage = #{taxCertificateImage},
-			</if>
-			<if test="address != null and address != ''" >
-				address = #{address},
-			</if>
-			<if test="registeredCapital != null and registeredCapital != ''" >
-				registeredCapital = #{registeredCapital},
-			</if>
-			<if test="nature != null and nature != ''" >
-				nature = #{nature},
-			</if>
-			<if test="turnover != null and turnover != ''" >
-				turnover = #{turnover},
-			</if>
-			<if test="linkMan != null and linkMan != ''" >
-				linkMan = #{linkMan},
-			</if>
-			<if test="contractPhone != null and contractPhone != ''" >
-				contractPhone = #{contractPhone},
-			</if>
-			<if test="contractMobile != null and contractMobile != ''" >
-				contractMobile = #{contractMobile},
-			</if>
-			<if test="contractEmail != null and contractEmail != ''" >
-				contractEmail = #{contractEmail},
-			</if>
-			<if test="fax != null and fax != ''" >
-				fax = #{fax},
-			</if>
-			<if test="zipCode != null and zipCode != ''" >
-				zipCode = #{zipCode},
-			</if>
-			<if test="info != null and info != ''" >
-				info = #{info},
-			</if>
-			<if test="productDesc != null and productDesc != ''" >
-				productDesc = #{productDesc},
-			</if>
-			<if test="status != null and status != ''" >
-				status = #{status},
-			</if>
-			<if test="provinceID != null and provinceID != ''" >
-				provinceID = #{provinceID},
-			</if>
-			<if test="cityID != null and cityID != ''" >
-				cityID = #{cityID},
-			</if>
-			<if test="townID != null and townID != ''" >
-				townID = #{townID},
-			</if>
-			<if test="maintenanceFee != null and maintenanceFee != ''" >
-				maintenanceFee = #{maintenanceFee},
-			</if>
-			<if test="maintenanceDate != null and maintenanceDate != ''" >
-				maintenanceDate = #{maintenanceDate},
-			</if>
-			<if test="businessScope != null and businessScope != ''" >
-				businessScope = #{businessScope},
-			</if>
-			<if test="firstShopType != null and firstShopType != ''" >
-				firstShopType=#{firstShopType},
-			</if>
-			<if test="secondShopType != null and secondShopType != ''" >
-				secondShopType=#{secondShopType},
-			</if>
-			<if test="medicalPracticeLicenseImg1 != null and medicalPracticeLicenseImg1 != ''" >
-				medicalPracticeLicenseImg1=#{medicalPracticeLicenseImg1},
-			</if>
-			<if test="medicalPracticeLicenseImg2 != null and medicalPracticeLicenseImg2 != ''" >
-				medicalPracticeLicenseImg2=#{medicalPracticeLicenseImg2},
-			</if>
-			<if test="medicalPracticeLicenseImg3 != null and medicalPracticeLicenseImg3 != ''" >
-				medicalPracticeLicenseImg3=#{medicalPracticeLicenseImg3},
-			</if>
-			<if test="mainpro != null and mainpro != ''">
-				mainpro=#{mainpro},
-			</if>
-			<if test="ableRebateAmount != null">
-				ableRebateAmount=#{ableRebateAmount},
-			</if>
-			<if test="rebateAmount != null">
-				rebateAmount=#{rebateAmount},
-			</if>
-			<if test="bankAccount != null">
-				bankAccount=#{bankAccount},
-			</if>
-			<if test="bankAccountName != null">
-				bankAccountName=#{bankAccountName},
-			</if>
-			<if test="bankName != null">
-				bankName=#{bankName},
-			</if>
-			<if test="socialCreditCode != null">
-				socialCreditCode = #{socialCreditCode}
-			</if>
-		</set>
-		WHERE shopID = #{shopID}
-	</update>
+    <insert id="insert" parameterType="NewCmShop" keyProperty="shopID" useGeneratedKeys="true">
+        INSERT INTO shop(userID,
+                         name,
+                         sname,
+                         logo,
+                         legalPerson,
+                         businessLicense,
+                         businessLicenseImage,
+                         taxCertificate,
+                         taxCertificateImage,
+                         provinceID,
+                         cityID,
+                         townID,
+                         address,
+                         registeredCapital,
+                         nature,
+                         turnover,
+                         linkMan,
+                         contractPhone,
+                         contractMobile,
+                         contractEmail,
+                         fax,
+                         zipCode,
+                         info,
+                         productDesc,
+                         addTime,
+                         auditStatus,
+                         auditTime,
+                         auditNote,
+                         validFlag,
+                         status,
+                         maintenanceFee,
+                         maintenanceDate,
+                         businessScope,
+                         firstShopType,
+                         secondShopType,
+                         medicalPracticeLicenseImg1,
+                         medicalPracticeLicenseImg2,
+                         medicalPracticeLicenseImg3,
+                         mainpro,
+                         socialCreditCode,
+                         shopType)
+        VALUES (#{userID},
+                #{name},
+                #{sname},
+                #{logo},
+                #{legalPerson},
+                #{businessLicense},
+                #{businessLicenseImage},
+                #{taxCertificate},
+                #{taxCertificateImage},
+                #{provinceID},
+                #{cityID},
+                #{townID},
+                #{address},
+                #{registeredCapital},
+                #{nature},
+                #{turnover},
+                #{linkMan},
+                #{contractPhone},
+                #{contractMobile},
+                #{contractEmail},
+                #{fax},
+                #{zipCode},
+                #{info},
+                #{productDesc},
+                #{addTime},
+                #{auditStatus},
+                #{auditTime},
+                #{auditNote},
+                #{validFlag},
+                #{status},
+                #{maintenanceFee},
+                #{maintenanceDate},
+                #{businessScope},
+                #{firstShopType},
+                #{secondShopType},
+                #{medicalPracticeLicenseImg1},
+                #{medicalPracticeLicenseImg2},
+                #{medicalPracticeLicenseImg3},
+                #{mainpro},
+                #{socialCreditCode},
+                #{shopType})
+    </insert>
+    <insert id="insertSplitCode">
+        insert into cm_shop_splitcode
+            (shopId, commercialCode, codeDetail, email, weChatFlag)
+        values (#{shopId}, #{splitCode}, #{codeRemark}, #{email}, #{weChatFlag})
+    </insert>
+    <insert id="insertSepcial" parameterType="NewCmShop" keyProperty="shopID" useGeneratedKeys="true">
+        insert into shop(name, linkMan, contractMobile, status, addTime, shopType)
+        VALUES (#{name}, #{linkMan}, #{contractMobile}, #{status}, now(), 2)
+    </insert>
+    <update id="update">
+        UPDATE shop
+        <set>
+            <if test="name != null and name != ''">
+                name = #{name},
+            </if>
+            website = #{website},
+            wxOfficialAccount = #{wxOfficialAccount},
+            wxApplets = #{wxApplets},
+            <if test="chargeSupport != null">
+                chargeSupport=#{chargeSupport},
+            </if>
+            <if test="sname != null and sname != ''">
+                sname = #{sname},
+            </if>
+            <if test="logo != null and logo != ''">
+                logo = #{logo},
+            </if>
+            <if test="legalPerson != null and legalPerson != ''">
+                legalPerson = #{legalPerson},
+            </if>
+            <if test="businessLicense != null and businessLicense != ''">
+                businessLicense = #{businessLicense},
+            </if>
+            <if test="businessLicenseImage != null and businessLicenseImage != ''">
+                businessLicenseImage = #{businessLicenseImage},
+            </if>
+            <if test="taxCertificate != null and taxCertificate != ''">
+                taxCertificate = #{taxCertificate},
+            </if>
+            <if test="taxCertificateImage != null and taxCertificateImage != ''">
+                taxCertificateImage = #{taxCertificateImage},
+            </if>
+            <if test="address != null and address != ''">
+                address = #{address},
+            </if>
+            <if test="registeredCapital != null and registeredCapital != ''">
+                registeredCapital = #{registeredCapital},
+            </if>
+            <if test="nature != null and nature != ''">
+                nature = #{nature},
+            </if>
+            <if test="turnover != null and turnover != ''">
+                turnover = #{turnover},
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                linkMan = #{linkMan},
+            </if>
+            <if test="contractPhone != null and contractPhone != ''">
+                contractPhone = #{contractPhone},
+            </if>
+            <if test="contractMobile != null and contractMobile != ''">
+                contractMobile = #{contractMobile},
+            </if>
+            <if test="contractEmail != null and contractEmail != ''">
+                contractEmail = #{contractEmail},
+            </if>
+            <if test="fax != null and fax != ''">
+                fax = #{fax},
+            </if>
+            <if test="zipCode != null and zipCode != ''">
+                zipCode = #{zipCode},
+            </if>
+            <if test="info != null and info != ''">
+                info = #{info},
+            </if>
+            <if test="productDesc != null and productDesc != ''">
+                productDesc = #{productDesc},
+            </if>
+            <if test="status != null and status != ''">
+                status = #{status},
+            </if>
+            <if test="provinceID != null and provinceID != ''">
+                provinceID = #{provinceID},
+            </if>
+            <if test="cityID != null and cityID != ''">
+                cityID = #{cityID},
+            </if>
+            <if test="townID != null and townID != ''">
+                townID = #{townID},
+            </if>
+            <if test="maintenanceFee != null and maintenanceFee != ''">
+                maintenanceFee = #{maintenanceFee},
+            </if>
+            <if test="maintenanceDate != null and maintenanceDate != ''">
+                maintenanceDate = #{maintenanceDate},
+            </if>
+            <if test="businessScope != null and businessScope != ''">
+                businessScope = #{businessScope},
+            </if>
+            <if test="firstShopType != null and firstShopType != ''">
+                firstShopType=#{firstShopType},
+            </if>
+            <if test="secondShopType != null and secondShopType != ''">
+                secondShopType=#{secondShopType},
+            </if>
+            <if test="medicalPracticeLicenseImg1 != null and medicalPracticeLicenseImg1 != ''">
+                medicalPracticeLicenseImg1=#{medicalPracticeLicenseImg1},
+            </if>
+            <if test="medicalPracticeLicenseImg2 != null and medicalPracticeLicenseImg2 != ''">
+                medicalPracticeLicenseImg2=#{medicalPracticeLicenseImg2},
+            </if>
+            <if test="medicalPracticeLicenseImg3 != null and medicalPracticeLicenseImg3 != ''">
+                medicalPracticeLicenseImg3=#{medicalPracticeLicenseImg3},
+            </if>
+            <if test="mainpro != null and mainpro != ''">
+                mainpro=#{mainpro},
+            </if>
+            <if test="ableRebateAmount != null">
+                ableRebateAmount=#{ableRebateAmount},
+            </if>
+            <if test="rebateAmount != null">
+                rebateAmount=#{rebateAmount},
+            </if>
+            <if test="bankAccount != null">
+                bankAccount=#{bankAccount},
+            </if>
+            <if test="bankAccountName != null">
+                bankAccountName=#{bankAccountName},
+            </if>
+            <if test="bankName != null">
+                bankName=#{bankName},
+            </if>
+            <if test="socialCreditCode != null">
+                socialCreditCode = #{socialCreditCode}
+            </if>
+        </set>
+        WHERE shopID = #{shopID}
+    </update>
 
-	<delete id="delete">
-		DELETE FROM shop
-		WHERE shopID = #{id}
-	</delete>
+    <delete id="delete">
+        DELETE
+        FROM shop
+        WHERE shopID = #{id}
+    </delete>
 
-	<delete id="deleteCert">
-		DELETE FROM shopcert
-		WHERE shopID = #{shopID}
-	</delete>
-	<delete id="deleteSplitCode">
-		delete from cm_shop_splitcode
-		where shopId = #{shopID}
-	</delete>
+    <delete id="deleteCert">
+        DELETE
+        FROM shopcert
+        WHERE shopID = #{shopID}
+    </delete>
+    <delete id="deleteSplitCode">
+        delete
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </delete>
 
-	<update id="updateAbleRebateAmount" parameterType="NewCmShop">
-		update shop set ableRebateAmount = #{ableRebateAmount} where shopID = #{shopID}
-	</update>
+    <update id="updateAbleRebateAmount" parameterType="NewCmShop">
+        update shop
+        set ableRebateAmount = #{ableRebateAmount}
+        where shopID = #{shopID}
+    </update>
 
-	<update id="backAbleRebateAmount" parameterType="NewCmShop">
-		update shop set ableRebateAmount = (ableRebateAmount + #{balancePayFee}) where shopID = #{shopID}
-	</update>
+    <update id="backAbleRebateAmount" parameterType="NewCmShop">
+        update shop
+        set ableRebateAmount = (ableRebateAmount + #{balancePayFee})
+        where shopID = #{shopID}
+    </update>
 
-	<update id="updateRebateAmount">
-		update shop set rebateAmount = (rebateAmount - #{balancePayFee})
-		where shopID = #{shopID}
-	</update>
-	<update id="offline">
-		update shop set status = 91 where shopID = #{shopID}
-	</update>
-	<update id="online">
-		update shop set status = 90 where shopID= #{shopID}
-	</update>
+    <update id="updateRebateAmount">
+        update shop
+        set rebateAmount = (rebateAmount - #{balancePayFee})
+        where shopID = #{shopID}
+    </update>
+    <update id="offline">
+        update shop
+        set status = 91
+        where shopID = #{shopID}
+    </update>
+    <update id="online">
+        update shop
+        set status = 90
+        where shopID = #{shopID}
+    </update>
 
-	<select id="maintenanceList" resultType="CmDiscernReceipt">
-		SELECT
-			a.id as receiptID,a.shopID,a.receiptAmount,a.receiptDate,a.receStatct,s.linkMan
-		FROM cm_discern_receipt a
-		LEFT JOIN shop s ON s.shopID = a.shopID
-		<where>
-		 AND a.shopID=#{shopID}
-		 AND a.newReceiptType=1
-		<if test="startTime != null and startTime != ''">
-			AND (a.receiptDate &gt; #{startTime} OR  a.receiptDate = #{startTime})
-		</if>
-		<if test="endTime != null and endTime != ''">
-			AND (a.receiptDate &lt; #{endTime} OR  a.receiptDate = #{endTime})
-		</if>
-		 and a.receStatct is not null
-			ORDER BY a.receiptDate DESC
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-		</choose>
-	</select>
-	<insert id="Removethelastfee">
-		insert into cm_discern_receipt
-			(shopID, receStatct, receiptDate,delFlag,newReceiptType)
-		values (#{shopID},#{receStatct}, #{receiptDate},1,1)
-	</insert>
+    <select id="maintenanceList" resultType="CmDiscernReceipt">
+        SELECT
+        a.id as receiptID,a.shopID,a.receiptAmount,a.receiptDate,a.receStatct,s.linkMan
+        FROM cm_discern_receipt a
+        LEFT JOIN shop s ON s.shopID = a.shopID
+        <where>
+            AND a.shopID=#{shopID}
+            AND a.newReceiptType=1
+            <if test="startTime != null and startTime != ''">
+                AND (a.receiptDate &gt; #{startTime} OR a.receiptDate = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (a.receiptDate &lt; #{endTime} OR a.receiptDate = #{endTime})
+            </if>
+            and a.receStatct is not null
+            ORDER BY a.receiptDate DESC
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+        </choose>
+    </select>
+    <insert id="Removethelastfee">
+        insert into cm_discern_receipt
+            (shopID, receStatct, receiptDate, delFlag, newReceiptType)
+        values (#{shopID}, #{receStatct}, #{receiptDate}, 1, 1)
+    </insert>
+
+    <update id="Removethelast">
+        update cm_discern_receipt
+        set newReceiptType=1,
+            receStatct    = 1
+        where id = #{receiptID}
+    </update>
+
+    <insert id="cmreceipt">
+        insert into cm_receipt
+            (validityDate, dateStrings, receiptID)
+        values (#{validityDate}, #{expirationDate}, #{receiptID})
+    </insert>
 
-	<update id="Removethelast">
-		update cm_discern_receipt set newReceiptType=1,receStatct = 1 where id= #{receiptID}
-	</update>
+    <select id="cmrectiptlist" resultType="com.caimei.modules.order.entity.CmDiscernReceipt">
+        SELECT r.dateStrings  as expirationDate,
+               r.validityDate as validityDate
+        FROM cm_receipt r
+                 LEFT JOIN cm_discern_receipt c ON c.id = r.receiptID
+                 LEFT JOIN shop s ON s.shopID = c.shopID
+        WHERE c.shopID = #{shopID}
+          AND c.newReceiptType = 1
+        ORDER BY r.id DESC
+        LIMIT 1
+    </select>
 
 </mapper>

+ 13 - 11
src/main/webapp/WEB-INF/views/modules/sys/Notification.jsp

@@ -44,8 +44,8 @@
             return false;
         }
 
-        function connct(id,hide) {
-            window.location.href = "${ctx}/sys/Notification/hide?id=" + id+"&hide="+hide;
+        function connct(id, hide) {
+            window.location.href = "${ctx}/sys/Notification/hide?id=" + id + "&hide=" + hide;
         }
 
         function butt() {
@@ -88,15 +88,17 @@
             <input type="hidden" value="${list.id}">
             <td colspan="2">
                 <c:if test="${list.saved eq 1}">
-					<span style="float: left; background: dimgrey" id="redi"></span>
-					<span style="float: left; color: dimgrey">${list.theme}</span><span style="float: right">${list.newTime}</span>
-				</c:if>
+                    <span style="float: left; background: dimgrey" id="redi"></span>
+                    <span style="float: left; color: dimgrey">${list.theme}</span><span
+                        style="float: right">${list.newTime}</span>
+                </c:if>
                 <c:if test="${list.saved eq 0}">
-					<span style="float: left; background: red" id="redi"></span>
-					<span style="float: left; color: #0d0d0d">${list.theme}</span><span style="float: right">${list.newTime}</span>
-				</c:if>
-              <br>
-                <c:if test="${list.hide eq 1}">
+                    <span style="float: left; background: red" id="redi"></span>
+                    <span style="float: left; color: #0d0d0d">${list.theme}</span><span
+                        style="float: right">${list.newTime}</span>
+                </c:if>
+                <br>
+<%--                <c:if test="${list.hide eq 1}">--%>
                 <c:if test="${not empty list.porductID}">
                     <c:forEach items="${list.contents}" var="age" varStatus="loop">
                         <c:forEach items="${list.porductIDs}" var="age1" varStatus="s">
@@ -122,7 +124,7 @@
                     </c:forEach>
                 </c:if>
             </td>
-            </c:if>
+<%--            </c:if>--%>
             <td><a onclick="connct(${list.id},${list.hide})" style="float: right">></a></td>
 
                 <%--			<td>--%>

+ 8 - 1
src/main/webapp/WEB-INF/views/modules/sys/sysIndex.jsp

@@ -23,6 +23,8 @@
 			right: 6px;
 			top: 15px;
 			height: 10px;
+			color: #f1f1f1;
+			font-size: 3px;
 		}
 	</style>
 	<script type="text/javascript">
@@ -174,7 +176,12 @@
 					<li>
 						<a href="${ctx}/sys/Notification/list" target="mainFrame" style="position: relative;">
 							<i class="icon-bell"></i>
-							<span id="redi"></span>
+							<c:if test="${count != 0}">
+								<span id="redi">${count}</span>
+								<c:if test="${count > 99}">
+							<span id="redi">99</span>
+								</c:if>
+							</c:if>
 						</a>
 					</li>
 					<li id="userInfo" class="dropdown">