Переглянути джерело

Merge remote-tracking branch 'origin/developer' into developerA

# Conflicts:
#	src/main/java/com/caimei/modules/order/service/NewOrderService.java
zhijiezhao 1 рік тому
батько
коміт
5752fe18d7
46 змінених файлів з 1505 додано та 121 видалено
  1. 26 25
      src/main/java/com/caimei/modules/baike/service/CmBaikeProductService.java
  2. 2 24
      src/main/java/com/caimei/modules/info/service/InfoService.java
  3. 17 17
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  4. 16 4
      src/main/java/com/caimei/modules/order/service/CmRefundShopService.java
  5. 4 8
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  6. 9 0
      src/main/java/com/caimei/modules/project/model/ServiceProviderModel.java
  7. 1 0
      src/main/java/com/caimei/modules/sys/utils/SMSUtils.java
  8. 3 0
      src/main/java/com/caimei/modules/user/dao/CmSpDao.java
  9. 3 0
      src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java
  10. 9 0
      src/main/java/com/caimei/modules/user/entity/CmUser.java
  11. 40 1
      src/main/java/com/caimei/modules/user/entity/NewCmClub.java
  12. 39 1
      src/main/java/com/caimei/modules/user/entity/NewCmSp.java
  13. 4 0
      src/main/java/com/caimei/modules/user/service/CmSpService.java
  14. 6 0
      src/main/java/com/caimei/modules/user/service/NewCmClubService.java
  15. 26 1
      src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java
  16. 159 8
      src/main/java/com/caimei/modules/user/web/newUser/SpController.java
  17. 78 0
      src/main/java/com/caimei/modules/utils/MessageUtil.java
  18. 58 0
      src/main/java/com/caimei/modules/utils/RequestUtil.java
  19. 64 1
      src/main/java/com/caimei/modules/utils/message/InsideMessage.java
  20. 2 1
      src/main/resources/config/dev/caimei.properties
  21. 1 1
      src/main/resources/mappings/modules/order/CmRefundShopRecordMapper.xml
  22. 49 2
      src/main/resources/mappings/modules/user/CmSpMapper.xml
  23. 146 1
      src/main/resources/mappings/modules/user/NewCmClubMapper.xml
  24. 2 2
      src/main/webapp/WEB-INF/views/modules/consult/type/cmConsulttypeList.jsp
  25. 4 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp
  26. 14 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp
  27. 14 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp
  28. 14 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp
  29. 14 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopPrintDetail.jsp
  30. 3 1
      src/main/webapp/WEB-INF/views/modules/serviceteam/cmServiceteamRoleForm.jsp
  31. 4 2
      src/main/webapp/WEB-INF/views/modules/serviceteam/cmServiceteamRoleList.jsp
  32. 2 2
      src/main/webapp/WEB-INF/views/modules/userNew/ReportList.jsp
  33. 1 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyList.jsp
  34. 1 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyStatisticsList.jsp
  35. 2 2
      src/main/webapp/WEB-INF/views/modules/userNew/cmRegistRemarksList.jsp
  36. 2 2
      src/main/webapp/WEB-INF/views/modules/userNew/cmRemaksList.jsp
  37. 267 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpClubTrackList.jsp
  38. 2 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpForm.jsp
  39. 2 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpList.jsp
  40. 246 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpLivelyClubFrom.jsp
  41. 139 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpLivelyClubList.jsp
  42. 3 1
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpTeamList.jsp
  43. 2 2
      src/main/webapp/WEB-INF/views/modules/userNew/cmUnRegistRemarksList.jsp
  44. BIN
      src/main/webapp/static/images/left.png
  45. BIN
      src/main/webapp/static/images/right.png
  46. 5 2
      src/test/java/com/caimei/info/InfoTest.java

+ 26 - 25
src/main/java/com/caimei/modules/baike/service/CmBaikeProductService.java

@@ -12,6 +12,7 @@ import com.caimei.modules.basesetting.dao.KeywordDao;
 import com.caimei.modules.hehe.util.UploadPicUtils;
 import com.caimei.modules.info.entity.Info;
 import com.caimei.modules.order.utils.OSSUtils;
+import com.caimei.modules.utils.MessageUtil;
 import com.caimei.modules.utils.RequestUtil;
 import com.caimei.modules.utils.message.InsideMessage;
 import com.caimei.modules.utils.message.MessageModel;
@@ -178,7 +179,7 @@ public class CmBaikeProductService extends CrudService<CmBaikeProductDao, CmBaik
                                 .reasonContent(cmBaikeProduct.getFailReason()));
 
             }
-            sendExamine(insideMessageMessageModel);
+            MessageUtil.sendMessage(insideMessageMessageModel);
         }
         // 标签
         String[] labelIds = StringUtils.split(cmBaikeProduct.getLabelIds(), ",");
@@ -280,29 +281,29 @@ public class CmBaikeProductService extends CrudService<CmBaikeProductDao, CmBaik
 //		});
     }
 
-    private void sendExamine(MessageModel<InsideMessage> model) {
-        StringBuilder map = new StringBuilder("{ \"code\": \"WEB_INSIDE_MESSAGE\"," +
-                "\"mqInfo\": {\"topic\": \"MessageLine\",\"delay\": 3,\"async\":0}," +
-                "\"info\": ");
-        map.append("{ \"content\": \"" + model.info().content() + "\"" +
-                ",\"shopMessType\":" + model.info().shopMessType() +
-                ",\"userType\":" + model.info().userType() +
-                ",\"messageType\":" + model.info().messageType());
-        map.append(",\"shopId\": " + model.info().shopId());
-        if (6 != model.info().shopMessType()) {
-            map.append(",\"reasonContent\":\"" + model.info().reasonContent() + "\"");
-        }
-        map.append("}}");
-        try {
-            String post = RequestUtil.httpPost(Global.getConfig("caimei.core") + "/tools/message/send", String.valueOf(map));
-            if (null==post){
-                throw new Exception();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            logger.error("审批消息推送失败>>>"+e);
-        }
-    }
+//    private void sendExamine(MessageModel<InsideMessage> model) {
+//        StringBuilder map = new StringBuilder("{ \"code\": \"WEB_INSIDE_MESSAGE\"," +
+//                "\"mqInfo\": {\"topic\": \"MessageLine\",\"delay\": 3,\"async\":0}," +
+//                "\"info\": ");
+//        map.append("{ \"content\": \"" + model.info().content() + "\"" +
+//                ",\"shopMessType\":" + model.info().shopMessType() +
+//                ",\"userType\":" + model.info().userType() +
+//                ",\"messageType\":" + model.info().messageType());
+//        map.append(",\"shopId\": " + model.info().shopId());
+//        if (6 != model.info().shopMessType()) {
+//            map.append(",\"reasonContent\":\"" + model.info().reasonContent() + "\"");
+//        }
+//        map.append("}}");
+//        try {
+//            String post = RequestUtil.httpPost(Global.getConfig("caimei.core") + "/tools/message/send", String.valueOf(map));
+//            if (null==post){
+//                throw new Exception();
+//            }
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//            logger.error("审批消息推送失败>>>"+e);
+//        }
+//    }
 
     private void saveTime(CmBaikeProduct cmBaikeProduct) {
         Integer marketYear = cmBaikeProduct.getMarketYear();
@@ -530,4 +531,4 @@ public class CmBaikeProductService extends CrudService<CmBaikeProductDao, CmBaik
             }
         }
     }
-}
+}

+ 2 - 24
src/main/java/com/caimei/modules/info/service/InfoService.java

@@ -9,6 +9,7 @@ import com.caimei.modules.basesetting.dao.KeywordDao;
 import com.caimei.modules.hehe.entity.cmHeHeUserActivity;
 import com.caimei.modules.live.entity.NewPageLive;
 import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.modules.utils.MessageUtil;
 import com.caimei.modules.utils.RequestUtil;
 import com.caimei.modules.utils.message.InsideMessage;
 import com.caimei.modules.utils.message.MessageModel;
@@ -246,7 +247,7 @@ public class InfoService extends CrudService<InfoDao, Info> {
                                 .reasonContent(info.getFailReason()));
 
             }
-            sendExamine(insideMessageMessageModel);
+            MessageUtil.sendMessage(insideMessageMessageModel);
         }
         super.save(info);
 
@@ -261,29 +262,6 @@ public class InfoService extends CrudService<InfoDao, Info> {
         infoDao.insertInfoPage(info.getId(), sp);
     }
 
-    private void sendExamine(MessageModel<InsideMessage> model) {
-        StringBuilder map = new StringBuilder("{ \"code\": \"WEB_INSIDE_MESSAGE\"," +
-                "\"mqInfo\": {\"topic\": \"MessageLine\",\"delay\": 3,\"async\":0}," +
-                "\"info\": ");
-        map.append("{ \"content\": \"" + model.info().content() + "\"" +
-                ",\"shopMessType\":" + model.info().shopMessType() +
-                ",\"userType\":" + model.info().userType() +
-                ",\"messageType\":" + model.info().messageType());
-        map.append(",\"shopId\": " + model.info().shopId());
-        if (8 != model.info().shopMessType()) {
-            map.append(",\"reasonContent\":\"" + model.info().reasonContent() + "\"");
-        }
-        map.append("}}");
-        try {
-            String post = RequestUtil.httpPost(Global.getConfig("caimei.core") + "/tools/message/send", String.valueOf(map));
-            if (null==post){
-                throw new Exception();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            logger.error("审批消息推送失败>>>"+e);
-        }
-    }
 
     @Transactional(readOnly = false)
     public void delete(Info info) {

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

@@ -274,7 +274,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                  */
 
                 Integer returnNum = 0;
-                Double returnNumAmount = 0d;
                 // 平台服务费
                 Double allServeAmount = 0d;
                 Double brokerage = 0d;
@@ -293,14 +292,10 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                     }*/
                     // 付采美总金额
-                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
+                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(MathUtil.sub(p.getNum(),p.getReturnedNum()), p.getCmCostPrice())).doubleValue();
                     // 子订单利润
                     if (p.getReturnedNum().equals(p.getNum())) {
-                        if (p.getProductType() == 0) {
-                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
-                        } else {
-                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
-                        }
+                        brokerage = MathUtil.add(brokerage, 0).doubleValue();
                     } else if (p.getReturnedNum() < p.getNum()) {
                         if (p.getProductType() == 0) {
                             brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
@@ -314,9 +309,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                             brokerage = MathUtil.add(brokerage, 0).doubleValue();
                         }
                     }
-                    allServeAmount = MathUtil.sub(allServeAmount, MathUtil.mul(returnNum, p.getCmCostPrice())).doubleValue();
-                    // 应退的成本
-                    returnNumAmount = MathUtil.mul(returnNum, p.getCostPrice()).doubleValue();
                 }
                 so.setBrokerage(brokerage);
                 so.setAllServeAmount(allServeAmount);
@@ -329,9 +321,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     BigDecimal waitPayShop = MathUtil.sub(so.getWaitPayShop(), so.getDifferencePrice());
                     so.setWaitPayShop(waitPayShop.doubleValue());
                 }
-                so.setWaitPayShop(MathUtil.sub(so.getWaitPayShop(), returnNumAmount).doubleValue());
-                so.setShopProductAmount(MathUtil.sub(so.getShopProductAmount(), returnNumAmount).doubleValue());
-                so.setShouldPayShopAmount(MathUtil.sub(so.getShouldPayShopAmount(), returnNumAmount).doubleValue());
 
                 //统计该子订单的主的收款金额和收款状态
                 NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
@@ -472,11 +461,22 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                     }*/
                     // 付采美总金额
-                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
-                    if (p.getProductType() == 0) {
-                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
-                    } else {
+                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(MathUtil.sub(p.getNum(),p.getReturnedNum()), p.getCmCostPrice())).doubleValue();
+                    // 子订单利润
+                    if (p.getReturnedNum().equals(p.getNum())) {
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    } else if (p.getReturnedNum() < p.getNum()) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
                     }
                 }
                 so.setBrokerage(brokerage);

+ 16 - 4
src/main/java/com/caimei/modules/order/service/CmRefundShopService.java

@@ -186,10 +186,20 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                     returnNum = returnNum == null ? 0 : returnNum;
                     p.setReturnedNum(returnNum);
                     // 子订单利润
-                    if (p.getProductType() == 0) {
-                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
-                    } else {
+                    if (p.getReturnedNum().equals(p.getNum())) {
                         brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    } else if (p.getReturnedNum() < p.getNum()) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
                     }
                 }
                 so.setBrokerage(brokerage);
@@ -247,7 +257,9 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                 so.setReceiptTotalFee(receiptTotalFee);
                 // 获取抹平金额
                 CmPayShopRecord PayedRecord = cmRefundShopRecordDao.getPayedRecordByShopOrderId(so.getShopOrderID());
-                so.setWipePayment(PayedRecord.getWipePayment());
+                if (null != PayedRecord) {
+                    so.setWipePayment(PayedRecord.getWipePayment());
+                }
 
                 CmRefundShopRecord record = refundRecord.stream().filter(r -> r.getShopOrderID().equals(so.getShopOrderID().toString())).findAny().get();
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());

+ 4 - 8
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -968,7 +968,6 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         newOrderDao.insertShortLink(markId, shortLink, url);
         return shortLink;
     }
-
     @Transactional(readOnly = false)
     public boolean getSendSms(int markId, String mobile, String content) throws Exception {
         String config = Global.getConfig("cm.config");
@@ -1455,13 +1454,10 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                      * (3)来自采美平台的第三方供应商的线下转账账号为空或者为采美账号的子订单
                      * (4)商品分账号是采美信息的商品的子订单(走了线上支付才排除)
                      */
-                    if ((1161 != shopOrder.getShopID() || 2 != shopOrder.getOrderType() || !flag ||
-                            (!"E1807059160".equals(shopOrder.getSplitCode()) && null != discernPayWay && 1 == discernPayWay))) {
-                        // 线下支付的订单
-                        if (null != discernPayWay && 1 != discernPayWay) {
-                            // 订单下线收款, 付款状态与收款状态同步显示
-                            shopOrder.setPayStatus(shopOrder.getReceiptStatus());
-                        }
+                    if ((1161 != shopOrder.getShopID() && 2 != shopOrder.getOrderType() && !flag &&
+                            (!"E1807059160".equals(shopOrder.getSplitCode()) && null != discernPayWay && 1 != discernPayWay))) {
+                                // 订单下线收款, 付款状态与收款状态同步显示
+                                shopOrder.setPayStatus(shopOrder.getReceiptStatus());
                     }
                     // 订单已收款才会出现抹平或者多收退余额,(已收再退款或者撤销退款订单即使存在抹平也需要当未抹平重新计算付款)
                     String receiptStatus = shopOrder.getReceiptStatus();

+ 9 - 0
src/main/java/com/caimei/modules/project/model/ServiceProviderModel.java

@@ -10,9 +10,18 @@ public class ServiceProviderModel extends DataEntity<ServiceProviderModel> {
     private Integer serviceProviderID;
     private String name;
     private Integer userID;
+    private String contractMobile;
     private Integer mainServiceProviderID;
     private Integer teamFlag;  //协销小组编辑页面回显标记,后台取数据的时候给1
 
+    public String getContractMobile() {
+        return contractMobile;
+    }
+
+    public void setContractMobile(String contractMobile) {
+        this.contractMobile = contractMobile;
+    }
+
     public Integer getServiceProviderID() {
         return serviceProviderID;
     }

+ 1 - 0
src/main/java/com/caimei/modules/sys/utils/SMSUtils.java

@@ -63,6 +63,7 @@ public class SMSUtils {
         list.add("15827317748");
         list.add("18476937515");
         list.add("18175515644");
+        list.add("17708413951");
         if (list.contains(mobile) || wwwServer.contains("www.caimei365.com")) {
             String coreServer = Global.getConfig("caimei.core");
             RestTemplate restTemplate = new RestTemplate();

+ 3 - 0
src/main/java/com/caimei/modules/user/dao/CmSpDao.java

@@ -7,6 +7,7 @@ import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户模块重构-协销人员管理DAO接口
@@ -24,6 +25,8 @@ public interface CmSpDao extends CrudDao<NewCmSp> {
 
     NewCmSp findByUserId(Integer userId);
 
+    Map<String, Object> findSpUserLoginSum(@Param("spID")String spID);
+
     List<CmSaleMan> findTeam();
 
     void choseManager(Integer serviceProviderID);

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

@@ -4,6 +4,7 @@ import com.caimei.modules.consult.entity.type.CmConsulttype;
 import com.caimei.modules.project.model.ServiceProviderModel;
 import com.caimei.modules.user.entity.*;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
 
@@ -18,6 +19,8 @@ import java.util.List;
 @MyBatisDao
 public interface NewCmClubDao extends CrudDao<NewCmClub> {
 
+    List<NewCmClub> findProviderList(NewCmClub userClub);
+
     List<NewCmClub> findClubById(Integer clubID);
 
     List<NewCmClub> textUserValue();

+ 9 - 0
src/main/java/com/caimei/modules/user/entity/CmUser.java

@@ -59,6 +59,7 @@ public class CmUser extends DataEntity<CmUser> {
     private String openID;//微信openID
     private String bindMobile;//企业绑定手机号
     private String linkMan;//联系人
+    private Integer scanFlag;//联系人
 
     //会所用户信息
     private String town; // 区
@@ -70,6 +71,14 @@ public class CmUser extends DataEntity<CmUser> {
     private String userIds;  //用户id","隔开
     private boolean storeStatus = false; //是否存在数据库
 
+    public Integer getScanFlag() {
+        return scanFlag;
+    }
+
+    public void setScanFlag(Integer scanFlag) {
+        this.scanFlag = scanFlag;
+    }
+
     public CmUser() {
         super();
     }

+ 40 - 1
src/main/java/com/caimei/modules/user/entity/NewCmClub.java

@@ -89,9 +89,48 @@ public class NewCmClub extends DataEntity<NewCmClub> {
     private String province; //省
     private String startTime;     //注册时间开始 查询条件
     private String endTime;        //注册时间结束  查询条件
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date providerTime;     //分配协销时间 查询条件
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date loginTime;     //上次登录时间 查询条件
+    private String startLoginTime;     //登录时间开始 查询条件
+    private String endLoginTime;        //登录时间结束  查询条件
     private String userIdentity;  //用户身份
     private Integer svipUserFlag;   //超级会员用户标识,1是,2不是
     private Integer newDeal;//新分配机构状态 0.否,1.是
+
+    public Date getProviderTime() {
+        return providerTime;
+    }
+
+    public void setProviderTime(Date providerTime) {
+        this.providerTime = providerTime;
+    }
+
+    public Date getLoginTime() {
+        return loginTime;
+    }
+
+    public void setLoginTime(Date loginTime) {
+        this.loginTime = loginTime;
+    }
+
+    public String getEndLoginTime() {
+        return endLoginTime;
+    }
+
+    public void setEndLoginTime(String endLoginTime) {
+        this.endLoginTime = endLoginTime;
+    }
+
+    public String getStartLoginTime() {
+        return startLoginTime;
+    }
+
+    public void setStartLoginTime(String startLoginTime) {
+        this.startLoginTime = startLoginTime;
+    }
+
     public String getCheckMan() {
         return checkMan;
     }
@@ -229,7 +268,7 @@ public class NewCmClub extends DataEntity<NewCmClub> {
         this.inviterName = inviterName;
     }
     public Integer getSpID() {
-        return spID;
+        return this.spID;
     }
     public void setSpID(Integer spID) {
         this.spID = spID;

+ 39 - 1
src/main/java/com/caimei/modules/user/entity/NewCmSp.java

@@ -5,6 +5,7 @@ import org.hibernate.validator.constraints.Length;
 
 import javax.validation.constraints.NotNull;
 import java.beans.Transient;
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -31,6 +32,11 @@ public class NewCmSp extends DataEntity<NewCmSp> {
 	private String addTime;		// 创建时间
 	private Integer mainServiceProviderID;		// 创客经理Id
 	private List<CmSaleMan> teams;  //小组组长列表
+	//活跃比例
+	private Integer livelyClub;
+	private Integer nolivelyClub;
+	private BigDecimal livelyClubProportion;
+	private BigDecimal nolivelyClubProportion;
 //	private String nameEn;		// 英文名
 //	private String site;		// 网址
 //	private String logo;		// 头像
@@ -96,6 +102,38 @@ public class NewCmSp extends DataEntity<NewCmSp> {
 		return teams;
 	}
 
+	public Integer getLivelyClub() {
+		return livelyClub;
+	}
+
+	public void setLivelyClub(Integer livelyClub) {
+		this.livelyClub = livelyClub;
+	}
+
+	public Integer getNolivelyClub() {
+		return nolivelyClub;
+	}
+
+	public void setNolivelyClub(Integer nolivelyClub) {
+		this.nolivelyClub = nolivelyClub;
+	}
+
+	public BigDecimal getLivelyClubProportion() {
+		return livelyClubProportion;
+	}
+
+	public void setLivelyClubProportion(BigDecimal livelyClubProportion) {
+		this.livelyClubProportion = livelyClubProportion;
+	}
+
+	public BigDecimal getNolivelyClubProportion() {
+		return nolivelyClubProportion;
+	}
+
+	public void setNolivelyClubProportion(BigDecimal nolivelyClubProportion) {
+		this.nolivelyClubProportion = nolivelyClubProportion;
+	}
+
 	public void setTeams(List<CmSaleMan> teams) {
 		this.teams = teams;
 	}
@@ -635,4 +673,4 @@ public class NewCmSp extends DataEntity<NewCmSp> {
 	public void setContractMobile(String contractMobile) {
 		this.contractMobile = contractMobile;
 	}
-}
+}

+ 4 - 0
src/main/java/com/caimei/modules/user/service/CmSpService.java

@@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户模块重构-协销人员管理Service
@@ -40,6 +41,9 @@ public class CmSpService extends CrudService<CmSpDao, NewCmSp> {
     public Page<NewCmSp> findPage(Page<NewCmSp> page, NewCmSp newCmSp) {
         return super.findPage(page, newCmSp);
     }
+    public Map<String, Object> findSpUserLoginSum(String spID) {
+        return cmSpDao.findSpUserLoginSum(spID);
+    }
 
     @Transactional(readOnly = false)
     public void update(NewCmSp newCmSp) {

+ 6 - 0
src/main/java/com/caimei/modules/user/service/NewCmClubService.java

@@ -60,6 +60,12 @@ public class NewCmClubService extends CrudService<NewCmClubDao, NewCmClub> {
     public Page<NewCmClub> findPage(Page<NewCmClub> page, NewCmClub userClub) {
         return super.findPage(page, userClub);
     }
+    public Page<NewCmClub> findProviderList(Page<NewCmClub> page,NewCmClub userClub) {
+        userClub.setPage(page);
+        List<NewCmClub> providerList = newCmClubDao.findProviderList(userClub);
+        page.setList(providerList);
+        return page;
+    }
 
     @Transactional(readOnly = false)
     public void save(NewCmClub userClub) {

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

@@ -171,7 +171,32 @@ public class AgencyController extends BaseController {
         model.addAttribute("spNameList", spNameList);
         return "modules/userNew/cmAgencyList";
     }
-
+    /**
+     * 功能描述:新分配机构跟踪管理
+     *
+     * @param newCmClub
+     * @param request
+     * @param response
+     * @param model
+     * @return [newCmSp, request, response, model]
+     * @auther: Kaick
+     * @date: 2023/8/25 14:50
+     */
+    @RequestMapping(value = {"cmSpClubTrackList"})
+    public String cmSpClubTrackList(NewCmClub newCmClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (null==newCmClub.getProviderTime()) {
+            Date date = new Date();
+            date.setTime(date.getTime() - 24 * 60 * 60 * 1000);
+            newCmClub.setProviderTime(date);
+        }
+        newCmClub.setNewDeal(1);
+        Page<NewCmClub> page = newCmClubService.findProviderList(new Page<NewCmClub>(request, response, 20), newCmClub);
+        // 协销下拉
+        List<ServiceProviderModel> spNameList = newCmClubDao.spNameList();
+        model.addAttribute("spNameList", spNameList);
+        model.addAttribute("page", page);
+        return "modules/userNew/cmSpClubTrackList";
+    }
     /**
      * 查看运营人员
      *

+ 159 - 8
src/main/java/com/caimei/modules/user/web/newUser/SpController.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.user.web.newUser;
 
+import com.alibaba.fastjson.JSONObject;
 import com.caimei.constants.ServiceProviderStatus;
 import com.caimei.constants.UserIdentity;
 import com.caimei.constants.UserType;
@@ -9,13 +10,19 @@ import com.caimei.modules.project.dao.ClubDao;
 import com.caimei.modules.project.dao.ServiceProviderDao;
 import com.caimei.modules.project.model.ClubModel;
 import com.caimei.modules.project.model.ServiceProviderModel;
+import com.caimei.modules.sys.utils.SMSUtils;
 import com.caimei.modules.sys.utils.ValidateUtils;
 import com.caimei.modules.user.aop.OperationLogAnnotation;
+import com.caimei.modules.user.dao.NewCmClubDao;
 import com.caimei.modules.user.entity.*;
 import com.caimei.modules.user.service.*;
-import com.caimei.utils.AppKeys;
-import com.caimei.utils.DateUtils;
-import com.caimei.utils.MD5Utils;
+import com.caimei.modules.utils.MessageUtil;
+import com.caimei.modules.utils.RequestUtil;
+import com.caimei.modules.utils.message.InsideMessage;
+import com.caimei.modules.utils.message.MessageModel;
+import com.caimei.modules.utils.message.MqInfo;
+import com.caimei.modules.utils.message.enums.MessageType;
+import com.caimei.utils.*;
 import com.google.common.collect.Maps;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
@@ -36,11 +43,10 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Description
@@ -68,6 +74,8 @@ public class SpController extends BaseController {
     private SysLogService sysLogService;
     @Resource
     private NewCmClubService newCmClubService;
+    @Resource
+    private NewCmClubDao newCmClubDao;
 
     @ModelAttribute
     public NewCmSp get(@RequestParam(required = false) String id) {
@@ -130,6 +138,7 @@ public class SpController extends BaseController {
                     }
                     // 查询serviceprovider协销表
                     List<ServiceProviderModel> serviceprovider = serviceProviderDao.getServiceproviderById(cssp.getNewSpID());
+
                     // 查询cm_bind表
                     if (CollectionUtils.isNotEmpty(serviceprovider)) {
                         ServiceProviderModel serviceProvider = serviceprovider.get(0);
@@ -174,6 +183,68 @@ public class SpController extends BaseController {
                         if (null != serviceProvider.getServiceProviderID()) {
                             sysLogService.insetProvider(serviceProvider.getServiceProviderID(), clubId, username);
                         }
+                        //短信
+                        if (StringUtils.isNotEmpty(serviceProvider.getContractMobile())) {
+                            NewCmClub newCmClub = newCmClubService.get(clubId.toString());
+                            ServiceProviderModel oldServiceprovider = serviceProviderDao.getServiceproviderById(cssp.getOldSpID()).get(0);
+
+                            //站内信
+                            MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
+                            insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+                                    .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(1))
+                                    .info(new InsideMessage()
+                                            .userType(3)
+                                            .messageType(3)
+                                            .shopTieredType(2)
+                                            .name(newCmClub.getName())
+                                            .userName(newCmClub.getLinkMan())
+                                            .mobile(newCmClub.getContractMobile())
+                                            .superUserName(oldServiceprovider.getName())
+                                            .thisId(serviceProvider.getServiceProviderID())
+                                            .clubId(newCmClub.getClubID())
+                                    );
+                            MessageUtil.sendMessage(insideMessageMessageModel);
+                            if(1342!=serviceProvider.getServiceProviderID()){
+                                insideMessageMessageModel.info(new InsideMessage()
+                                        .userType(3)
+                                        .messageType(3)
+                                        .shopTieredType(3)
+                                        .name(newCmClub.getName())
+                                        .userName(newCmClub.getLinkMan())
+                                        .mobile(newCmClub.getContractMobile())
+                                        .superUserName(serviceProvider.getName())
+                                        .thisId(oldServiceprovider.getServiceProviderID())
+                                        .clubId(newCmClub.getClubID())
+                                );
+                                MessageUtil.sendMessage(insideMessageMessageModel);
+                                insideMessageMessageModel.info(new InsideMessage()
+                                        .userType(1)
+                                        .messageType(3)
+                                        .shopTieredType(6)
+                                        .userName(serviceProvider.getName())
+                                        .mobile(serviceProvider.getContractMobile())
+                                        .clubId(newCmClub.getClubID())
+                                );
+                                MessageUtil.sendMessage(insideMessageMessageModel);
+                                SMSUtils.sendSms(4, newCmClub.getContractMobile(), "【采美365】因公司内部人员调整需要,采美平台已为您更换客户经理。客户经理【" + serviceProvider.getName() + "】,手机号【" + serviceProvider.getContractMobile() + "】。");
+                                SMSUtils.sendSms(4, serviceProvider.getContractMobile(), "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + newCmClub.getName() + "】,联系人【" + newCmClub.getLinkMan() + "】,手机号【" + newCmClub.getContractMobile() + "】,上一任销售【" + oldServiceprovider.getName() + "】。");
+                                SMSUtils.sendSms(4, oldServiceprovider.getContractMobile(), "【采美365】系统已将你的机构客户转移给其他销售人员,你已无权管理该客户。机构名称【" + newCmClub.getName() + "】,联系人【" + newCmClub.getLinkMan() + "】,手机号【" + newCmClub.getContractMobile() + "】,下一任销售【" + serviceProvider.getName() + "】。");
+                            }else {
+                                insideMessageMessageModel.info(new InsideMessage()
+                                        .userType(3)
+                                        .messageType(3)
+                                        .shopTieredType(8)
+                                        .name(newCmClub.getName())
+                                        .userName(newCmClub.getLinkMan())
+                                        .mobile(newCmClub.getContractMobile())
+                                        .thisId(oldServiceprovider.getServiceProviderID())
+                                        .clubId(newCmClub.getClubID())
+                                );
+                                MessageUtil.sendMessage(insideMessageMessageModel);
+                                SMSUtils.sendSms(4, oldServiceprovider.getContractMobile(), "【采美365】系统已将你的机构客户进行回收,你已无权管理该客户。机构名称【" + newCmClub.getName() + "】,联系人【"+ newCmClub.getLinkMan() +"】,手机号【"+ newCmClub.getContractMobile() +"】。");
+                            }
+
+                        }
                     } else {
                         map.put("success", false);
                         map.put("msg", "操作失败");
@@ -242,6 +313,82 @@ public class SpController extends BaseController {
         return "modules/userNew/cmSpList";
     }
 
+    /**
+     * 功能描述: 机构活跃分析列表
+     *
+     * @param newCmSp
+     * @param request
+     * @param response
+     * @param model
+     * @return [newCmSp, request, response, model]
+     * @auther: Kaick
+     * @date: 2023/8/25 14:50
+     */
+    @RequestMapping(value = {"cmSpLivelyClubList"})
+    public String cmSpLivelyClubList(NewCmSp newCmSp, HttpServletRequest request, HttpServletResponse response, Model model) {
+        newCmSp.setStatus(90);
+        Page<NewCmSp> page = cmSpService.findPage(new Page<NewCmSp>(request, response), newCmSp);
+        page.getList().forEach(s->{
+            Map<String, Object> spUserLoginSum = cmSpService.findSpUserLoginSum(s.getServiceProviderID().toString());
+            Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
+            Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
+            //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
+            BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+            s.setLivelyClub(loginSum);
+            s.setNolivelyClub(not_loginSum);
+            s.setLivelyClubProportion(livelyClubProportion);
+            s.setNolivelyClubProportion(MathUtil.sub(100, livelyClubProportion).setScale(2));
+        });
+        Map<String, Object> spUserLoginSum = cmSpService.findSpUserLoginSum(null);
+        Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
+        Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
+        //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        model.addAttribute("livelyClub", loginSum);
+        model.addAttribute("nolivelyClub", not_loginSum);
+        model.addAttribute("livelyClubProportion", livelyClubProportion);
+        model.addAttribute("nolivelyClubProportion", MathUtil.sub(100, livelyClubProportion).setScale(2));
+        model.addAttribute("page", page);
+        return "modules/userNew/cmSpLivelyClubList";
+    }
+
+
+
+    /**
+     * 功能描述: 机构活跃分析查看详情
+     *
+     * @param request
+     * @param response
+     * @param model
+     * @return [newCmSp, request, response, model]
+     * @auther: Kaick
+     * @date: 2023/8/25 14:50
+     */
+    @RequestMapping(value = {"cmSpLivelyClubFrom"})
+    public String cmSpLivelyClubFrom(NewCmClub newCmClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (StringUtils.isBlank(newCmClub.getStartLoginTime())&&StringUtils.isBlank(newCmClub.getEndLoginTime())) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.MONTH, -6);
+            newCmClub.setStartLoginTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
+        }
+        newCmClub.setStatus(90);
+        Page<NewCmClub> page = newCmClubService.findPage(new Page<NewCmClub>(request, response, 20), newCmClub);
+        Map<String, Object> spUserLoginSum = cmSpService.findSpUserLoginSum(newCmClub.getSpID().toString());
+        Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
+        Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
+        //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? (double)loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        model.addAttribute("livelyClub", loginSum);
+        model.addAttribute("nolivelyClub", not_loginSum);
+        model.addAttribute("livelyClubProportion", livelyClubProportion);
+        model.addAttribute("nolivelyClubProportion", MathUtil.sub(100, livelyClubProportion).setScale(2));
+        model.addAttribute("spId", newCmClub.getSpID());
+        model.addAttribute("page", page);
+        return "modules/userNew/cmSpLivelyClubFrom";
+    }
+
+
+
     /**
      * 添加协销人员
      *
@@ -305,6 +452,7 @@ public class SpController extends BaseController {
         }
         NewCmSp cmSp = new NewCmSp();
         CmUser cmUser = new CmUser();
+        cmSp.setName(linkMan);
         cmSp.setLinkMan(linkMan);
         cmSp.setContractMobile(mobile);
         if ("1".equals(duty)) {
@@ -331,6 +479,7 @@ public class SpController extends BaseController {
         }
         cmUser.setUserOrganizeID(0);
         cmUser.setMobile(mobile);
+        cmUser.setBindMobile(mobile);
         cmUser.setUserIdentity(UserIdentity.MAKER.getCode());
         cmUser.setRegisterTime(DateUtils.getDateTime());
         cmUser.setServiceProviderStatus(ServiceProviderStatus.WAIT_CHECK_DATA.getCode() + "");
@@ -455,8 +604,9 @@ public class SpController extends BaseController {
         if ("0".equals(newCmSp.getPosition())) {
             cmUser.setRegisterUserTypeID(UserType.SERVICEEMPLOYEE.getCode() + ""); // 设置为协销员工
         }
-
+        newCmSp.setName(newCmSp.getLinkMan());
         cmUser.setMobile(newCmSp.getContractMobile());
+        cmUser.setBindMobile(newCmSp.getContractMobile());
         cmSpService.save(newCmSp);
         cmUserService.update(cmUser);
         addMessage(redirectAttributes, "保存协销人员管理成功");
@@ -483,4 +633,5 @@ public class SpController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/serviceteam/cmServiceteamRole/?repage";
     }
 
+
 }

+ 78 - 0
src/main/java/com/caimei/modules/utils/MessageUtil.java

@@ -0,0 +1,78 @@
+package com.caimei.modules.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.modules.utils.message.InsideMessage;
+import com.caimei.modules.utils.message.MessageModel;
+import com.caimei.modules.utils.message.MqInfo;
+import com.caimei.modules.utils.message.WechatTemplateMessage;
+import com.caimei.modules.utils.message.enums.MessageType;
+import com.caimei.utils.HttpRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.thinkgem.jeesite.common.config.Global;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+public class MessageUtil {
+    protected static Logger logger = LoggerFactory.getLogger(MessageUtil.class);
+
+    public static void sendMessage(MessageModel model) {
+        try {
+            String coreServer = Global.getConfig("caimei.core");
+            String url = coreServer + "/tools/message/send";
+            logger.info("url>>>>" + url);
+            String result = RequestUtil.sendPost(url, new ObjectMapper().writeValueAsString(model),"application/json");
+            JSONObject parseObject = JSONObject.parseObject(result);
+            System.out.println(parseObject);
+            Integer code = parseObject.getInteger("code");
+            if (code != 0) {
+                logger.info("审批消息推送失败>>>>" + model.info());
+            }else {
+                logger.info("审批消息推送成功>>>>" + model.info());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error("审批消息推送失败>>>" + e);
+        }
+    }
+
+    public static void main(String[] args) {
+
+        //微信模板消息
+        ArrayList<String> keyWords = new ArrayList<>();
+        keyWords.add("name"+"...等"+7+"家机构客户");
+        keyWords.add("pageLabel");
+        keyWords.add("2023-09-12");
+        MessageModel<WechatTemplateMessage> wechatTemplateMessageMessageModel = new MessageModel<WechatTemplateMessage>()
+                .code(MessageType.WECHAT_TEMPLATE_MESSAGE)
+                .mqInfo(new MqInfo().topic("MessageLine").delay(3).async(0))
+                .info(new WechatTemplateMessage()
+                        .first("")
+                        .openId("o9nzn5yD6IOcFuhG4b3OG1droVJw")
+                        .appid("wxf3cd4ae0cdd11c36")
+                        .templateId("Zd7ewJw9-bN-gIgra9flKW96W3YehikRPPkDXPfhmQ0")
+                        .keyWords(keyWords)
+                        .remark("为了更好给您服务,请及时联系采美客服!")
+                        .pagePath("pages/seller/notice/service/Institutional_visits?spId="+1340+"&accDateTime="+"2023-09-14"));
+        sendMessage(wechatTemplateMessageMessageModel);
+//        //站内信
+//        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
+//        insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+//                .mqInfo(new MqInfo().topic("MessageLine").delay(3).async(0))
+//                .info(new InsideMessage()
+//                        .userType(3)
+//                        .messageType(3)
+//                        .shopTieredType(7)
+//                        .name("机构名称")
+//                        .content("pageLabel")
+//                        .couponFee(new Double(5))
+//                        .thisId(1381)
+//                );
+//        sendMessage(insideMessageMessageModel);
+
+    }
+
+}

+ 58 - 0
src/main/java/com/caimei/modules/utils/RequestUtil.java

@@ -175,6 +175,64 @@ public class RequestUtil {
         return result.toString();
     }
 
+    public static String sendPost(String url, String param, String contentType) {
+        OutputStreamWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            conn.setRequestProperty("Content-Type", contentType);
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+
+            /*************************************************************************/
+            // 获取URLConnection对象对应的输出流
+            // out = new PrintWriter(conn.getOutputStream());
+            out = new OutputStreamWriter(conn.getOutputStream(), "utf-8"); // 8859_1
+            /*************************************************************************/
+
+            out.write(param); // post的关键所在
+            // 发送请求参数
+            // out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            int code = conn.getResponseCode();
+            if(code == 200) {
+                in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            }else{
+                in = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
+            }
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
     /**
      * 向指定 URL 发送请求
      * @param requestUrl 发送请求的 URL

+ 64 - 1
src/main/java/com/caimei/modules/utils/message/InsideMessage.java

@@ -12,7 +12,7 @@ import java.io.Serializable;
 @Data
 @Accessors(fluent = true)
 public class InsideMessage implements Serializable {
-
+    private static final long serialVersionUID = 1L;
     /**
      * 消息id
      */
@@ -116,6 +116,21 @@ public class InsideMessage implements Serializable {
      */
     private String shopName;
 
+    /** 手机号 */
+    private String mobile;
+
+    /** 名称 */
+    private String name;
+
+    /** 用户名称 */
+    private String userName;
+
+    /** 前用户名称 */
+    private String superUserName;
+
+    /** 当前id */
+    private Integer thisId;
+
     public Integer getId() {
         return id;
     }
@@ -172,6 +187,14 @@ public class InsideMessage implements Serializable {
         this.content = content;
     }
 
+    public String getReasonContent() {
+        return reasonContent;
+    }
+
+    public void setReasonContent(String reasonContent) {
+        this.reasonContent = reasonContent;
+    }
+
     public String getTime() {
         return time;
     }
@@ -307,4 +330,44 @@ public class InsideMessage implements Serializable {
     public void setShopName(String shopName) {
         this.shopName = shopName;
     }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getSuperUserName() {
+        return superUserName;
+    }
+
+    public void setSuperUserName(String superUserName) {
+        this.superUserName = superUserName;
+    }
+
+    public Integer getThisId() {
+        return thisId;
+    }
+
+    public void setThisId(Integer thisId) {
+        this.thisId = thisId;
+    }
 }

+ 2 - 1
src/main/resources/config/dev/caimei.properties

@@ -189,7 +189,8 @@ export.template=export
 
 # SPI-server\uFF08CKEditor5\u56FE\u7247\u4E0A\u4F20API\uFF0C\u641C\u7D22\u66F4\u65B0\u7D22\u5F15\uFF09
 caimei.spi=http://localhost:8008
-caimei.core=http://localhost:18002
+#caimei.core=http://localhost:18002
+caimei.core=https://core-b.caimei365.com
 caimei.manager=http://localhost:9527
 #\u963F\u91CC\u4E91oss\u5B58\u50A8
 aliyun.accessKeyId=LTAI4GBL3o4YkWnbKYgf2Xia

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

@@ -122,7 +122,7 @@
                a.shopOrderID      AS "shopOrderID",
                a.shopOrderNo      AS "shopOrderNo",
                SUM(a.payAmount)   AS "payAmount",
-               SUM(a.wipePayment) AS "wipePayment",
+               ifnull(SUM(a.wipePayment), 0) AS "wipePayment",
                a.payType          AS "payType",
                a.payTime          AS "payTime",
                a.wipeTime         AS "wipeTime",

+ 49 - 2
src/main/resources/mappings/modules/user/CmSpMapper.xml

@@ -157,6 +157,53 @@
 		JOIN user u on a.userID = u.userID
 		where u.registerUserTypeID = 2
 	</select>
+
+    <select id="findSpUserLoginSum" resultType="java.util.HashMap" parameterType="string">
+		select
+		COUNT(  CASE WHEN a.time=1 THEN 1 END) AS loginSum,
+		((SELECT count(1) from club
+		WHERE  status=90
+		<if test="spID != null">
+			and  spID=#{spID}
+		</if>
+		)-COUNT(  CASE WHEN a.time=1 THEN 1 END)) AS not_loginSum
+		FROM (select a.*
+		FROM ((
+		select
+		c.clubId,1 AS time,c.spID
+		FROM club c
+		LEFT JOIN user u ON u.userID = c.userID
+		LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+		where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+		and u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+		GROUP BY c.clubId
+		)UNION(
+		select
+		c.clubId,1 AS time,c.spID
+		FROM club c
+		LEFT JOIN user u ON u.userID = c.userID
+		LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+		LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+		where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+		and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+		GROUP BY c.clubId
+		)UNION(
+		select c.clubId,1 AS time,c.spID
+		FROM club c
+		LEFT JOIN user u ON u.userID = c.userID
+		LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+		LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+		where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+		and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+		GROUP BY c.clubId
+		)
+		) a where  1=1
+		<if test="spID != null">
+			and  a.spID=#{spID}
+		</if>
+		GROUP BY a.clubId ) a
+
+	</select>
 	<select id="findSelectList" resultType="com.caimei.modules.user.entity.NewCmSp">
 		SELECT
 		<include refid="newCmSpColumns"/>
@@ -193,8 +240,8 @@
 	</update>
 
 	<insert id="choseManager">
-		insert into cm_serviceteam_manager (serviceProviderId,delflag)
-		values (#{serviceProviderID},0)
+		insert into cm_serviceteam_manager (serviceProviderId,delflag,validFlag)
+		values (#{serviceProviderID},0,1)
 	</insert>
 
 	<select id="findByUserId" resultType="com.caimei.modules.user.entity.NewCmSp">

+ 146 - 1
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -98,7 +98,7 @@
     <select id="findList" resultType="NewCmClub">
         SELECT
         <include refid="newCmClubColumns"/>
-        <include refid="otherColumns"/>,u.userPermission,u.source, covs.activeState,covs.customerValue
+        <include refid="otherColumns"/>,u.userPermission,u.source, covs.activeState,covs.customerValue,u.loginTime
         FROM club a
         <include refid="newCmClubJoins"/>
         LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1)
@@ -150,6 +150,56 @@
             <if test="endTime != null and endTime != ''">
                 AND (u.registerTime &lt; #{endTime} OR u.registerTime = #{endTime})
             </if>
+            <if test="startLoginTime != null and startLoginTime != ''">
+                AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR a.clubId in (select a.clubId
+                FROM ((
+                select
+                c.clubId,ccr.addTime AS time,c.spID
+                FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
+                LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+                LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+                where c.status=90 and sp.status=90
+                and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+                GROUP BY c.clubId
+                )UNION(
+                select c.clubId,cr.orderTime AS time,c.spID
+                FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
+                LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+                LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+                where c.status=90 and sp.status=90
+                and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+                GROUP BY c.clubId
+                )) a where a.time is not null
+                and  a.spID=#{spID}
+                GROUP BY a.clubId ))
+            </if>
+            <if test="endLoginTime != null and endLoginTime != ''">
+                AND (u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) or u.loginTime is null) and a.clubId not in (select a.clubId
+                FROM ((
+                select
+                c.clubId,ccr.addTime AS time,c.spID
+                FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
+                LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+                LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+                where c.status=90 and sp.status=90
+                and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+                GROUP BY c.clubId
+                )UNION(
+                select c.clubId,cr.orderTime AS time,c.spID
+                FROM club c
+                LEFT JOIN user u ON u.userID = c.userID
+                LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+                LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+                where c.status=90 and sp.status=90
+                and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+                GROUP BY c.clubId
+                )) a where a.time is not null
+                and  a.spID=#{spID}
+                GROUP BY a.clubId )
+            </if>
             <if test="userIdentity != null and userIdentity != '' and userIdentity != '8'.toString()">
                 AND u.userIdentity = #{userIdentity}
             </if>
@@ -207,6 +257,101 @@
         </choose>
     </select>
 
+
+    <select id="findProviderList" resultType="NewCmClub">
+        SELECT
+        <include refid="newCmClubColumns"/>
+        ,case sp.status when 91 then '采美默认协销经理(官方账号)' else sp.linkMan end AS "spName"
+        ,u.userPermission,u.source,u.loginTime,cpr.createTime AS providerTime,
+        u.account AS  "account",
+        u.registerTime AS "registerTime",
+        u.registerIP AS "registerIP",
+        u.userName AS "userName",
+        u.bindMobile AS "bindMobile",
+        u.email AS "email",
+        u.userOrganizeID AS "userOrganizeID",
+        u.userIdentity AS "userIdentity",
+        if(csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime,1,0) as svipUserFlag
+        from cm_provider_record cpr
+        LEFT JOIN serviceprovider sp ON sp.serviceProviderID =cpr.spID
+        LEFT JOIN club a ON cpr.clubId = a.clubId
+        LEFT JOIN user u ON u.userID = a.userID
+        LEFT JOIN cm_svip_user csu ON csu.userId = u.userID
+        <where>
+            (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 and sp.status=90
+            <if test="clubID != null and clubID != ''">
+                AND a.clubID = #{clubID}
+            </if>
+            <if test="clubID == 0">
+                AND a.clubID = #{clubID}
+            </if>
+            <if test="userID != null and userID != ''">
+                AND a.userID = #{userID}
+            </if>
+            <if test="account != null and account != ''">
+                AND u.account = #{account}
+            </if>
+            <if test="name != null and name != ''">
+                AND u.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="userName != null and userName != ''">
+                AND u.userName LIKE concat('%',#{userName},'%')
+            </if>
+            <if test="status != null and status != ''">
+                AND a.status = #{status}
+            </if>
+            <if test="bindMobile != null and bindMobile != ''">
+                AND u.bindMobile LIKE concat('%',#{bindMobile},'%')
+            </if>
+            <if test="email != null and email != ''">
+                AND u.email LIKE concat('%',#{email},'%')
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                AND a.linkMan LIKE concat('%',#{linkMan},'%')
+            </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="startLoginTime != null and startLoginTime != ''">
+                AND (u.loginTime &gt; #{startLoginTime} OR u.loginTime = #{startLoginTime})
+            </if>
+            <if test="endLoginTime != null and endLoginTime != ''">
+                AND (u.loginTime &lt; #{endLoginTime} OR u.loginTime = #{endLoginTime})
+            </if>
+            <if test="providerTime != null and providerTime != ''">
+                AND cpr.id in (
+                (SELECT  max(cp.id)
+                from cm_provider_record cp
+                WHERE DATE(cp.createTime) = DATE(#{providerTime})
+                group by cp.clubId))
+            </if>
+            <if test="userIdentity != null and userIdentity != '' and userIdentity != '8'.toString()">
+                AND u.userIdentity = #{userIdentity}
+            </if>
+            <if test="userIdentity != null and userIdentity != '' and userIdentity == '8'.toString()">
+                AND csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
+            </if>
+            <if test="newDeal != null">
+                AND a.newDeal =#{newDeal}
+            </if>
+            <if test="spID != null and spID != ''">
+                AND sp.serviceProviderID = #{spID}
+            </if>
+        </where>
+        group by cpr.clubId
+        <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,  cpr.createTime DESC
+            </otherwise>
+        </choose>
+    </select>
+
     <insert id="insert" parameterType="NewCmClub" keyProperty="clubID" useGeneratedKeys="true">
         INSERT INTO club(userID,
                          name,

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/consult/type/cmConsulttypeList.jsp

@@ -73,9 +73,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li class="active"><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+    <<%--shiro:hasPermission name="user:agency:cmrenaksList">
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 <form:form id="searchForm" modelAttribute="cmConsulttype" action="${ctx}/consult/type/cmConsulttype/" method="post"
            class="breadcrumb form-search">

+ 4 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp

@@ -348,10 +348,12 @@
                         </c:forEach>
                     </td>
                     <td>
-                            ${s.income}
+                        <c:if test="${empty s.brokerage}">0.00</c:if>
+                        <c:if test="${not empty s.brokerage}">${s.brokerage}</c:if>
+                         <%--   ${s.income}
                         <c:if test="${not empty s.rebateFee}">
                             <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>
-                        </c:if>
+                        </c:if>--%>
                     </td>
                     <td>
                         <label class="clubFreight" style="display: none">

+ 14 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp

@@ -464,7 +464,19 @@
                         <td> ${s.buyer}</td>
                         <td colspan="3">${s.shopName}</td>
                         <c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-                        <c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
+                        <c:if test="${not empty s.brokerage}">
+                            <td colspan="3" class="">
+                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                            </td>
+                        </c:if>
                             <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
                         <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
 
@@ -610,7 +622,7 @@
                                     0.00
                                 </c:if>
                             </td>
-                            <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>

+ 14 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp

@@ -214,7 +214,19 @@
                         <td> ${s.buyer}</td>
                         <td colspan="3">${s.shopName}</td>
                         <c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-                        <c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
+                        <c:if test="${not empty s.brokerage}">
+                            <td colspan="3" class="">
+                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>>
+                                </c:if>
+                            </td>
+                        </c:if>
                             <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
                         <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
 
@@ -360,7 +372,7 @@
                                     0.00
                                 </c:if>
                             </td>
-                            <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>

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

@@ -546,7 +546,19 @@
                         <td> ${s.buyer}</td>
                         <td colspan="3">${s.shopName}</td>
                         <c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-                        <c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
+                        <c:if test="${not empty s.brokerage}">
+                            <td colspan="3" class="">
+                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>
+                                </c:if>
+                            </td>
+                        </c:if>
                          <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
                         <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
 
@@ -692,7 +704,7 @@
                                     0.00
                                 </c:if>
                             </td>
-                            <td><fmt:formatNumber value="${p.returnedNum == p.returnedNum ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>

+ 14 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopPrintDetail.jsp

@@ -222,7 +222,19 @@
 							<td> ${s.buyer}</td>
 							<td colspan="3">${s.shopName}</td>
 							<c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-							<c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
+							<c:if test="${not empty s.brokerage}">
+								<td colspan="3" class="">
+									<c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+										<fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+									</c:if>
+									<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+										<fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
+									</c:if>
+									<c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+										<fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>
+									</c:if>
+								</td>
+							</c:if>
 								<%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
 							<td colspan="3" class="product-fee">${s.shopProductAmount}</td>
 
@@ -368,7 +380,7 @@
 										0.00
 									</c:if>
 								</td>
-								<td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+								<td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
 								<td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
 								<td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
 								<td class="p-taxes-t"><c:choose>

+ 3 - 1
src/main/webapp/WEB-INF/views/modules/serviceteam/cmServiceteamRoleForm.jsp

@@ -86,6 +86,8 @@
     </shiro:hasPermission>
     <li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
     <li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+    <li><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+
     <li class="active"><a
             href="${ctx}/serviceteam/cmServiceteamRole/form?teamId=${cmServiceteamRole.teamId}">协销小组${not empty cmServiceteamRole.teamId?'编辑':'添加'}</a>
     </li>
@@ -166,4 +168,4 @@
     </div>
 </form:form>
 </body>
-</html>
+</html>

+ 4 - 2
src/main/webapp/WEB-INF/views/modules/serviceteam/cmServiceteamRoleList.jsp

@@ -10,7 +10,7 @@
 	</style>
 	<script type="text/javascript">
 		$(document).ready(function() {
-			
+
 		});
 		function page(n,s){
 			$("#pageNo").val(n);
@@ -26,6 +26,8 @@
 		<shiro:hasPermission name="user:newCmClub:edit"><li><a href="${ctx}/new/user/cmSp/cmSpForm">添加协销人员</a></li></shiro:hasPermission>
 		<li class="active"><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
 		<li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+		<li><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+
 	</ul>
 	<form:form id="searchForm" modelAttribute="cmServiceteamRole" action="${ctx}/serviceteam/cmServiceteamRole/" method="post" class="breadcrumb form-search">
 		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
@@ -93,4 +95,4 @@
 	</table>
 	<div class="pagination">${page}</div>
 </body>
-</html>
+</html>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/ReportList.jsp

@@ -263,9 +263,9 @@
 <shiro:hasPermission name="user:agency:cmConsulttype">
     <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
 </shiro:hasPermission>
-<shiro:hasPermission name="user:agency:cmrenaksList">
+<%--<shiro:hasPermission name="user:agency:cmrenaksList">
     <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-</shiro:hasPermission>
+</shiro:hasPermission>--%>
 </ul>
 <form:form id="searchForm" modelAttribute="cmReport" action="${ctx}/new/user/agency/ReportList" method="post"
            class="breadcrumb form-search">

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

@@ -52,6 +52,7 @@
 <ul class="nav nav-tabs">
     <li class="active"><a href="${ctx}/new/user/agency/">机构基本资料列表</a></li>
     <li><a href="${ctx}/new/user/agency/statisticsList">机构分析统计列表</a></li>
+    <li><a href="${ctx}/new/user/agency/cmSpClubTrackList">新分配机构跟踪管理</a></li>
     <li><a href="${ctx}/user/clubTemporary/">未确认机构</a></li>
     <li><a href="${ctx}/user/cmOperational/">操作日志</a></li>
 </ul>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyStatisticsList.jsp

@@ -56,6 +56,7 @@
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/new/user/agency/">机构基本资料列表</a></li>
     <li class="active"><a href="${ctx}/new/user/agency/statisticsList">机构分析统计列表</a></li>
+    <li><a href="${ctx}/new/user/agency/cmSpClubTrackList">新分配机构跟踪管理</a></li>
     <li><a href="${ctx}/user/clubTemporary/">未确认机构</a></li>
     <li><a href="${ctx}/user/cmOperational/">操作日志</a></li>
 </ul>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmRegistRemarksList.jsp

@@ -85,9 +85,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+<%--    <shiro:hasPermission name="user:agency:cmrenaksList">
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 <br/>
 <form:form id="searchForm" modelAttribute="cmClubRemarks" action="${ctx}/new/user/agency/regist" method="post"

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmRemaksList.jsp

@@ -41,9 +41,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+<%--    <shiro:hasPermission name="user:agency:cmrenaksList">
         <li class="active"><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 <form:form id="searchForm" modelAttribute="cmRemaks" action="${ctx}/new/user/agency/cmrenaksList" method="post"
            class="breadcrumb form-search">

+ 267 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmSpClubTrackList.jsp

@@ -0,0 +1,267 @@
+<%@ page import="java.util.Date" %><%--
+  Created by IntelliJ IDEA.
+  User: Administrator
+  Date: 2020/4/12
+  Time: 12:01
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>机构活跃分析管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+
+		.livelyProportion {
+			background: #f5f5f5;
+			height: 150px;
+			display: flex;
+			list-style: none;
+
+		}
+
+		.livelyProportion > li {
+			flex: 1;
+			text-align: center;
+			margin: auto 0;
+			font-size: 20px;
+			font-weight: bold;
+		}
+
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			let date = new Date().getTime()
+			let date0 = formatDate(date)
+			let date1 = formatDate(date - 24 * 60 * 60 * 1000)
+			let date2 = formatDate(date - 24 * 60 * 60 * 1000 * 2)
+			let date3 = formatDate(${newCmClub.providerTime.getTime()})
+			if (date0 == date3) {
+				$("#conlog").text("(今天)")
+			} else if (date1 == date3) {
+				$("#conlog").text("(昨天)")
+			} else if (date2 == date3) {
+				$("#conlog").text("(前天)")
+			}
+
+		})
+
+		function formatDate(date) {
+			//date为时间戳
+			var date = new Date(date);
+			var Y = date.getFullYear() + '-';
+			var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+			var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+			var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+			var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+			var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+			return Y + M + D;
+		}
+
+		function checkProviderTime(type) {
+			var date = new Date($("#providerTime").val()).getTime()
+			if (formatDate(new Date()) != formatDate(date)||type == 1) {
+				if (type != 1) {
+					date = date + 24 * 60 * 60 * 1000
+				} else {
+					date = date - 24 * 60 * 60 * 1000
+				}
+
+				$("#providerTime").val(formatDate(date))
+				$("#searchForm").submit()
+			}else {
+				$.jBox.tip("当前已经是最新的记录了!", 'info');
+			}
+
+		}
+		/**
+		 * @param obj
+		 * jquery控制input只能输入数字
+		 */
+		function onlynum(obj) {
+			obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+		}
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li><a href="${ctx}/new/user/agency/list">机构基本资料列表</a></li>
+	<li><a href="${ctx}/new/user/agency/statisticsList">机构分析统计列表</a></li>
+	<li class="active"><a href="${ctx}/new/user/agency/cmSpClubTrackList">新分配机构跟踪管理</a></li>
+	<li><a href="${ctx}/user/clubTemporary/">未确认机构</a></li>
+	<li><a href="${ctx}/user/cmOperational/">操作日志</a></li>
+</ul>
+
+<ul class="breadcrumb livelyProportion">
+	<li>
+		<div>
+			<img src="/static/images/left.png" style="width: 50px" border="none" onclick="checkProviderTime(1)">
+			<span><fmt:formatDate value="${Date(newCmClub.providerTime.getTime()- 24 * 60 * 60 * 1000)}"
+								  pattern="yyyy年M月dd日 "></fmt:formatDate></span>
+		</div>
+	</li>
+	<li>
+		<div style="font-size: 40px;">
+			<fmt:formatDate value="${newCmClub.providerTime}"
+							pattern="yyyy年M月dd日 "></fmt:formatDate>
+			<span style="font-size: 20px;color:#0bbbee;position: relative;bottom: 5px"  id="conlog"></span>
+		</div>
+	</li>
+	<li>
+		<div>
+			<span><fmt:formatDate value="${Date(newCmClub.providerTime.getTime()+ 24 * 60 * 60 * 1000)}"
+								  pattern="yyyy年M月dd日 "></fmt:formatDate></span>
+			<img src="/static/images/right.png" border="none" style="width: 50px" onclick="checkProviderTime(0)">
+		</div>
+	</li>
+</ul>
+<form:form id="searchForm" modelAttribute="newCmClub" action="${ctx}/new/user/agency/cmSpClubTrackList/" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<input id="providerTime" name="providerTime" type="hidden" value="<fmt:formatDate value="${newCmClub.providerTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
+	<div class="flex-wrap">
+		<div class="item">
+			<label>机构ID:</label>
+			<form:input path="clubID"  onkeyup="onlynum(this)"  htmlEscape="false"
+						maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>机构名称:</label>
+			<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>联系人:</label>
+			<form:input path="linkMan" htmlEscape="false" maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>手机号:</label>
+			<form:input path="bindMobile" htmlEscape="false" maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>协销:</label>
+			<form:select path="spID" class="input-medium">
+				<form:option value="" label="全部"/>
+				<form:options items="${spNameList}" itemLabel="name" itemValue="serviceProviderID" htmlEscape="false"/>
+			</form:select>
+		</div>
+		<div class="item">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		</div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>机构ID</th>
+		<th>机构名称</th>
+		<th>协销</th>
+		<th>分配时间</th>
+		<th>联系人</th>
+		<th>手机号</th>
+		<th>机构级别</th>
+		<th>状态</th>
+		<th>注册时间</th>
+		<th>上次登录时间</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="newCmClubList">
+		<tr>
+			<td>${newCmClubList.clubID}</td>
+			<td>
+				<a href="${ctx}/new/user/agency/clubPortrait?clubID=${newCmClubList.clubID}&clubName=${newCmClubList.name}&dateType=0&type=4">${newCmClubList.name}</a>
+			</td>
+			<td>
+					${newCmClubList.spName}
+			</td>
+			<td><fmt:formatDate value="${newCmClubList.providerTime}"
+								pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
+			<td>${newCmClubList.userName}</td>
+			<td>${newCmClubList.bindMobile}</td>
+
+			<td>
+				<c:if test="${newCmClubList.userIdentity eq 4}">
+					个人机构
+					<c:if test="${newCmClubList.svipUserFlag eq 1}">
+						<font color="red">(超级会员)</font>
+					</c:if>
+					<c:if test="${newCmClubList.svipUserFlag ne 1}">
+						<font color="black">(普通会员)</font>
+					</c:if>
+				</c:if>
+				<c:if test="${newCmClubList.userIdentity eq 2}">
+					资质机构
+					<c:if test="${newCmClubList.svipUserFlag eq 1}">
+						<font color="red">(超级会员)</font>
+					</c:if>
+					<c:if test="${empty newCmClubList.medicalPracticeLicenseImg and newCmClubList.svipUserFlag ne 1}">
+						<font color="red">(高级会员)</font>
+					</c:if>
+					<c:if test="${!empty newCmClubList.medicalPracticeLicenseImg and newCmClubList.svipUserFlag ne 1}">
+						<font color="red">(医美会员)</font>
+					</c:if>
+				</c:if>
+			</td>
+			<td>
+				<c:choose>
+					<c:when test="${newCmClubList.status eq 90}">
+						<font color="green">已上线</font>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 91}">
+						<font color="red">已下线</font>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 92}">
+						<a href="JavaScript:;" onclick="return alertx('不通过原因:${newCmClubList.auditNote}')"
+						   style="text-decoration:underline;"><font color="red">审核未通过</font></a>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 93}">
+						<font color="#BF826C">已确认</font>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 94}">
+						<font color="red">已冻结</font>
+					</c:when>
+					<c:otherwise>
+						${fns:getDictLabel(newCmClubList.status, 'club_status', newCmClubList.status)}
+					</c:otherwise>
+				</c:choose>
+			</td>
+			<td>
+				<fmt:formatDate value="${newCmClubList.registerTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
+			</td>
+			<td>
+				<fmt:formatDate value="${newCmClubList.loginTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
+			</td>
+			<td>
+				<a href="${ctx}/new/user/agency/regist?clubId=${newCmClubList.clubID}&clubName=${newCmClubList.name}">咨询记录</a>
+				<a href="${ctx}/new/user/agency/spLogs?clubID=${newCmClubList.clubID}">协销更换记录</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+<script>
+</script>
+</body>
+</html>
+

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmSpForm.jsp

@@ -59,6 +59,8 @@
 		<li class="active"><a href="${ctx}/new/user/cmSp/cmSpForm?id=${cmSp.id}"><shiro:hasPermission name="user:newCmClub:edit">${not empty cmSp.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="user:newCmClub:edit">查看</shiro:lacksPermission>协销人员</a></li>
 		<li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
 		<li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+		<li><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+
 	</ul><br/>
 	<form id="inputForm" onsubmit="return false" action="##" method="post" class="form-horizontal">
 		<div class="control-group">

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmSpList.jsp

@@ -34,6 +34,8 @@
 	<shiro:hasPermission name="user:newCmClub:edit"><li><a href="${ctx}/new/user/cmSp/cmSpForm">添加协销人员</a></li></shiro:hasPermission>
 	<li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
 	<li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+	<li><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+
 </ul>
 <form:form id="searchForm" modelAttribute="newCmSp" action="${ctx}/new/user/cmSp/cmSpList/" method="post" class="breadcrumb form-search">
 	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>

+ 246 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmSpLivelyClubFrom.jsp

@@ -0,0 +1,246 @@
+<%--
+  Created by IntelliJ IDEA.
+  User: Administrator
+  Date: 2020/4/12
+  Time: 12:01
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>机构活跃分析管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+
+		.livelyProportion {
+			background: #f5f5f5;
+			height: 150px;
+			display: flex;
+			list-style: none;
+
+		}
+
+		.livelyProportion > li {
+			flex: 1;
+			text-align: center;
+			margin: auto 0
+		}
+
+		.livelyBorder {
+			color: red;
+			border-bottom: red 5px solid;
+		}
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			if (${newCmClub.startLoginTime ne ''}) {
+				$("#livelyBorder>li:eq(0)").attr("class", "livelyBorder")
+			} else {
+				$("#livelyBorder>li:eq(1)").attr("class", "livelyBorder")
+			}
+			$("#livelyBorder>li").click(function (item) {
+				var dateTime = new Date();
+				$("#livelyBorder>li").attr("class", "")
+				if ($(this).index() == 0) {
+					$("#startLoginTime").attr("value", formatDate(dateTime.setMonth(dateTime.getMonth() - 6)))
+					$("#endLoginTime").attr("value", "")
+					$(this).attr("class", "livelyBorder")
+				} else {
+					$("#startLoginTime").attr("value", "")
+					$("#endLoginTime").attr("value", formatDate(dateTime.setMonth(dateTime.getMonth() - 6)))
+					$(this).attr("class", "livelyBorder")
+				}
+				$("#searchForm").submit()
+			})
+		});
+
+		function formatDate(date) {
+			//date为时间戳
+			var date = new Date(date);
+			var Y = date.getFullYear() + '-';
+			var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+			var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+			var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+			var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+			var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+			return Y + M + D + " " + h + m + s;
+		}
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li><a href="${ctx}/new/user/cmSp/cmSpList/">协销人员列表</a></li>
+	<shiro:hasPermission name="user:newCmClub:edit">
+		<li><a href="${ctx}/new/user/cmSp/cmSpForm">添加协销人员</a></li>
+	</shiro:hasPermission>
+	<li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
+	<li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+	<li><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+	<li class="active"><a href="${ctx}/new/user/cmSp/cmSpLivelyClubFrom?spID=${spId}">查看详情</a></li>
+</ul>
+
+<ul class="breadcrumb livelyProportion">
+	<li>
+		<h4>活跃机构</h4>
+		<br>
+		<p>(6个月内有登录商城等行为)</p>
+		<h2>${livelyClub}</h2>
+	</li>
+	<li>
+		<h4>不活跃机构</h4>
+		<br>
+		<p>(6个月内未登录商城等行为)</p>
+		<h2>${nolivelyClub}</h2>
+	</li>
+	<li>
+		<h4>活跃机构占比</h4>
+		<br>
+		<h2>${livelyClubProportion}%</h2>
+	</li>
+	<li>
+		<h4>不活跃机构占比</h4>
+		<br>
+		<h2>${nolivelyClubProportion}%</h2>
+	</li>
+</ul>
+<form:form id="searchForm" modelAttribute="newCmClub" action="${ctx}/new/user/cmSp/cmSpLivelyClubFrom/" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<div class="flex-wrap">
+		<form:hidden path="spID"/>
+		<form:hidden path="startLoginTime"/>
+		<form:hidden path="endLoginTime"/>
+		<div class="item">
+			<label>机构ID:</label>
+			<form:input path="clubID" onkeyup="this.value=value.replace(/[^\d]/g,'')" htmlEscape="false"
+						maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>机构名称:</label>
+			<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>联系人:</label>
+			<form:input path="linkMan" htmlEscape="false" maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<label>手机号:</label>
+			<form:input path="bindMobile" htmlEscape="false" maxlength="50" class="input-medium"/>
+		</div>
+		<div class="item">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		</div>
+	</div>
+
+</form:form>
+<sys:message content="${message}"/>
+<div>
+	<ul id="livelyBorder" class="livelyProportion" style="height: 40px;width: 200px;background: white">
+		<li>活跃机构</li>
+		<li>不活跃机构</li>
+	</ul>
+</div>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>机构ID</th>
+		<th>机构名称</th>
+		<th>联系人</th>
+		<th>手机号</th>
+		<th>机构级别</th>
+		<th>状态</th>
+		<th>注册时间</th>
+		<th>上次登录时间</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="newCmClubList">
+		<tr>
+			<td>${newCmClubList.clubID}</td>
+			<td>
+				<a href="${ctx}/new/user/agency/clubPortrait?clubID=${newCmClubList.clubID}&clubName=${newCmClubList.name}&dateType=0&type=4">${newCmClubList.name}</a>
+			</td>
+			<td>${newCmClubList.userName}</td>
+			<td>${newCmClubList.bindMobile}</td>
+
+			<td>
+				<c:if test="${newCmClubList.userIdentity eq 4}">
+					个人机构
+					<c:if test="${newCmClubList.svipUserFlag eq 1}">
+						<font color="red">(超级会员)</font>
+					</c:if>
+					<c:if test="${newCmClubList.svipUserFlag ne 1}">
+						<font color="black">(普通会员)</font>
+					</c:if>
+				</c:if>
+				<c:if test="${newCmClubList.userIdentity eq 2}">
+					资质机构
+					<c:if test="${newCmClubList.svipUserFlag eq 1}">
+						<font color="red">(超级会员)</font>
+					</c:if>
+					<c:if test="${empty newCmClubList.medicalPracticeLicenseImg and newCmClubList.svipUserFlag ne 1}">
+						<font color="red">(高级会员)</font>
+					</c:if>
+					<c:if test="${!empty newCmClubList.medicalPracticeLicenseImg and newCmClubList.svipUserFlag ne 1}">
+						<font color="red">(医美会员)</font>
+					</c:if>
+				</c:if>
+			</td>
+			<td>
+				<c:choose>
+					<c:when test="${newCmClubList.status eq 90}">
+						<font color="green">已上线</font>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 91}">
+						<font color="red">已下线</font>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 92}">
+						<a href="JavaScript:;" onclick="return alertx('不通过原因:${newCmClubList.auditNote}')"
+						   style="text-decoration:underline;"><font color="red">审核未通过</font></a>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 93}">
+						<font color="#BF826C">已确认</font>
+					</c:when>
+					<c:when test="${newCmClubList.status eq 94}">
+						<font color="red">已冻结</font>
+					</c:when>
+					<c:otherwise>
+						${fns:getDictLabel(newCmClubList.status, 'club_status', newCmClubList.status)}
+					</c:otherwise>
+				</c:choose>
+			</td>
+			<td>
+				<fmt:formatDate value="${newCmClubList.registerTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
+			</td>
+			<td>
+				<fmt:formatDate value="${newCmClubList.loginTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+<script>
+</script>
+</body>
+</html>
+

+ 139 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmSpLivelyClubList.jsp

@@ -0,0 +1,139 @@
+<%--
+  Created by IntelliJ IDEA.
+  User: Administrator
+  Date: 2020/4/12
+  Time: 12:01
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>机构活跃分析管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+
+		.livelyProportion {
+			background: #f5f5f5;
+			height: 150px;
+			display: flex;
+			list-style: none;
+
+		}
+		.livelyProportion>li {
+			flex: 1;
+			text-align: center;
+			margin:  auto 0
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li><a href="${ctx}/new/user/cmSp/cmSpList/">协销人员列表</a></li>
+	<shiro:hasPermission name="user:newCmClub:edit">
+		<li><a href="${ctx}/new/user/cmSp/cmSpForm">添加协销人员</a></li>
+	</shiro:hasPermission>
+	<li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
+	<li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+	<li class="active"><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+</ul>
+
+<ul class="breadcrumb livelyProportion" >
+	<li>
+		<h4>活跃机构</h4>
+		<br>
+		<p>(6个月内有登录商城等行为)</p>
+		<h2>${livelyClub}</h2>
+	</li>
+	<li>
+		<h4>不活跃机构</h4>
+		<br>
+		<p>(6个月内未登录商城等行为)</p>
+		<h2>${nolivelyClub}</h2>
+	</li>
+	<li>
+		<h4>活跃机构占比</h4>
+		<br>
+		<h2>${livelyClubProportion}%</h2>
+	</li>
+	<li>
+		<h4>不活跃机构占比</h4>
+		<br>
+		<h2>${nolivelyClubProportion}%</h2>
+	</li>
+</ul>
+<form:form id="searchForm" modelAttribute="newCmSp" action="${ctx}/new/user/cmSp/cmSpLivelyClubList/" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<div class="ul-form">
+			<%--		<label>协销ID:</label>--%>
+			<%--			<form:input path="serviceProviderID" htmlEscape="false" maxlength="20" class="input-medium"/>--%>
+		<label>协销姓名:</label>
+		<form:input path="linkMan" htmlEscape="false" maxlength="20" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="contractMobile" htmlEscape="false" maxlength="20" class="input-medium"/>
+		&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>协销ID</th>
+		<th>协销姓名</th>
+		<th>手机号</th>
+		<th>创建时间</th>
+		<th>活跃机构</th>
+		<th>不活跃机构</th>
+		<th>活跃机构占比</th>
+		<th>不活跃机构占比</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="newCmSp">
+		<tr>
+			<td>${newCmSp.serviceProviderID}</td>
+			<td>${newCmSp.linkMan}</td>
+			<td>${newCmSp.contractMobile}</td>
+			<td>${newCmSp.addTime}</td>
+			<td>${newCmSp.livelyClub}</td>
+			<td>${newCmSp.nolivelyClub}</td>
+			<td>${newCmSp.livelyClubProportion}%</td>
+			<td>${newCmSp.nolivelyClubProportion}%</td>
+			<td>
+				<a href="${ctx}/new/user/cmSp/cmSpLivelyClubFrom?spID=${newCmSp.serviceProviderID}">查看详情</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+<script>
+
+</script>
+</body>
+</html>
+

+ 3 - 1
src/main/webapp/WEB-INF/views/modules/userNew/cmSpTeamList.jsp

@@ -28,6 +28,8 @@
     </shiro:hasPermission>
     <li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
     <li class="active"><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
+    <li><a href="${ctx}/new/user/cmSp/cmSpLivelyClubList/">机构活跃分析</a></li>
+
 </ul>
 <br/>
 <form:form id="inputForm" modelAttribute="newCmSp" action="${ctx}/new/user/cmSp/leader/save" method="post"
@@ -58,4 +60,4 @@
 </form:form>
 </body>
 
-</html>
+</html>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmUnRegistRemarksList.jsp

@@ -56,9 +56,9 @@
     <shiro:hasPermission name="user:agency:cmConsulttype">
         <li><a href="${ctx}/consult/type/cmConsulttype/">咨询类别设置</a></li>
     </shiro:hasPermission>
-    <shiro:hasPermission name="user:agency:cmrenaksList">
+    <%--<shiro:hasPermission name="user:agency:cmrenaksList">
         <li><a href="${ctx}/new/user/agency/cmrenaksList">咨询关键词库</a></li>
-    </shiro:hasPermission>
+    </shiro:hasPermission>--%>
 </ul>
 <br/>
 <form:form id="searchForm" modelAttribute="visit" action="${ctx}/new/user/visit/unregist" method="post"

BIN
src/main/webapp/static/images/left.png


BIN
src/main/webapp/static/images/right.png


+ 5 - 2
src/test/java/com/caimei/info/InfoTest.java

@@ -7,6 +7,7 @@ import com.caimei.modules.landing.mapper.CmBrandLandingMapper;
 import com.caimei.modules.order.entity.NewShopOrder;
 import com.caimei.modules.order.service.NewShopOrderService;
 import com.caimei.modules.product.dao.CmOrganizeProductInfoMapper;
+import com.caimei.modules.sys.utils.SMSUtils;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -41,8 +42,10 @@ public class InfoTest extends SpringTransactionalContextTests {
 
 	@Test
 	public void test(){
-		NewShopOrder cmShopOrderByShopOrderID = newShopOrderService.getCmShopOrderByShopOrderID("29352");
-		System.out.println(cmShopOrderByShopOrderID);
+//		SMSUtils.sendSms(4, "17708413951", "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + "newCmClub.getName()" + "】,联系人【" + "newCmClub.getLinkMan()" + "】,手机号【" + "15600000000" + "】,上一任销售【" + "etName()" + "】。");
+
+//		NewShopOrder cmShopOrderByShopOrderID = newShopOrderService.getCmShopOrderByShopOrderID("29352");
+//		System.out.println(cmShopOrderByShopOrderID);
 
 //		CmBrandLanding cmBrandLanding = new CmBrandLanding();
 //		cmBrandLanding.setType("not=1,2");