From bb5be7a8a6ac24fbf66f03f070751577b87c95ca Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Thu, 15 Apr 2021 17:56:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/score_shop' into score_shop

---
 zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java |    2 
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java              |    3 
 zq-erp/src/main/java/com/matrix/system/common/actions/BusParameterSettingsAction.java                |    1 
 zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java                                     |    1 
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                                      |   21 +++++++
 zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html                        |   15 +++-
 zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java                                   |    7 ++
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java                   |   47 +++++++++++++++
 zq-erp/src/main/java/com/matrix/system/hiveErp/action/DataAnalysisCustomer.java                      |    1 
 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html                          |    5 +
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java                  |    2 
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java            |   23 +++++--
 zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java                      |    2 
 13 files changed, 106 insertions(+), 24 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java
index cc168ab..82d2c05 100644
--- a/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java
+++ b/zq-erp/src/main/java/com/matrix/component/wechat/externalInterface/weixinUtil/WeixinServiceUtil.java
@@ -25,7 +25,6 @@
 import com.matrix.system.common.interceptor.HostInterceptor;
 import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
 import org.apache.log4j.Logger;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -87,7 +86,6 @@
 
 
 
-	@NotNull
 	private BrandWCPayRequestData buildBrandWCPayRequestData(String desc, String outTradeNo, int price, String openId, String attach, BusParameterSettings notifyUrl) throws Exception {
 		// 创建微信支付预付接口
 		JsApiPayBusiness jsApiPayBusiness = new JsApiPayBusiness();
diff --git a/zq-erp/src/main/java/com/matrix/system/common/actions/BusParameterSettingsAction.java b/zq-erp/src/main/java/com/matrix/system/common/actions/BusParameterSettingsAction.java
index 95d9d4b..485c148 100644
--- a/zq-erp/src/main/java/com/matrix/system/common/actions/BusParameterSettingsAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/common/actions/BusParameterSettingsAction.java
@@ -11,7 +11,6 @@
 import com.matrix.system.hive.bean.ParameterSettings;
 import com.matrix.system.hive.dao.ParameterSettingsDao;
 import org.apache.ibatis.annotations.Param;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
diff --git a/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java b/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
index 0ff4047..5e5bbcc 100644
--- a/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
+++ b/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
@@ -571,4 +571,5 @@
     String[] COLORS = { "#57c5d2", "#e3565e", "#2f343a", "#4d98db", "#4fbc9d", "#be9d4c"};
 
     String SERVICE_OVER_BEGIN_END = "SERVICE_OVER_BEGIN_END";
+    String SALE_MAN_IS_CONSUME_ACHIEVE = "SALE_MAN_IS_CONSUME_ACHIEVE";
 }
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
index d5f206e..d8421e3 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -75,4 +75,11 @@
 	List<RankingVo> selectStaffSaleAchieveRanking(@Param("record") AchieveNew achieveNew);
 
     int deleteByOrderId(@Param("orderId") Long orderId);
+
+    List<AchieveNew> selectSaleManAchieveList(@Param("saleId") Long saleId, @Param("vipId") Long vipId, @Param("date") Date date);
+
+    List<AchieveNew> selectBeautyManAchieveList(@Param("beautyId") Long beautyId, @Param("vipId") Long vipId, @Param("date") Date date);
+
+    int updateAchieveNumOfPeople(@Param("list") List<AchieveNew> list, @Param("num") Double num);
+
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
index 27ed849..bae3726 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
@@ -111,4 +111,6 @@
     List<ServiceOrderListVo> findApiServiceOrderListInPage(ServiceOrderListDto serviceOrderListDto, PaginationVO pageVo);
 
     int findApiServiceOrderListTotal(ServiceOrderListDto serviceOrderListDto);
+
+    public boolean skipServiceOrderStep(String step);
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
index 40331bd..b22fdc1 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -1,5 +1,6 @@
 package com.matrix.system.hive.service.imp;
 
+import cn.hutool.core.collection.CollUtil;
 import com.matrix.core.constance.MatrixConstance;
 import com.matrix.core.exception.GlobleException;
 import com.matrix.core.pojo.PaginationVO;
@@ -21,6 +22,8 @@
 import com.matrix.system.hive.dao.SysProjUseDao;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.hive.service.AchieveNewService;
+import com.matrix.system.hive.service.SysProjServicesService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -45,6 +48,9 @@
 
     @Autowired
     private SysProjUseDao sysProjUseDao;
+
+    @Autowired
+    private SysProjServicesService projServicesService;
 
     @Override
     public int add(AchieveNew achieveNew) {
@@ -164,6 +170,9 @@
 
         Long achieveId = projServices.getCreateStaffId();
 
+        // 下单人是否计算消耗业绩
+        boolean flag = projServicesService.skipServiceOrderStep(Dictionary.SALE_MAN_IS_CONSUME_ACHIEVE);
+
         for (SysBeauticianState beauticianState : beauticianStateList) {
             // 是否第一次计算改美疗师
             boolean isFirst = true;
@@ -187,7 +196,26 @@
             achieveNew.setShopId(projServices.getShopId());
             achieveNew.setCompanyId(projServices.getCompanyId());
             achieveNew.setShoppingGoodsId(projUse.getProjId());
-            achieveNew.setNumberOfPeople(1D / size);
+
+            if (flag) {
+                if (!achieveId.equals(beauticianState.getStaffId())) {
+                    AchieveNew saleMan = new AchieveNew();
+                    BeanUtils.copyProperties(achieveNew, saleMan);
+                    saleMan.setBeaultId(achieveId);
+
+                    saleAchieveNumOfPeople(saleMan);
+                    achieveNewList.add(saleMan);
+                }
+            }
+
+            List<AchieveNew> beautyList = achieveNewDao.selectBeautyManAchieveList(beauticianState.getStaffId(), projServices.getVipId(), new Date());
+            if (CollUtil.isEmpty(beautyList)) {
+                achieveNew.setNumberOfPeople(1D / size);
+            } else {
+                achieveNew.setNumberOfPeople(1D / (size + beautyList.size()));
+                achieveNewDao.updateAchieveNumOfPeople(beautyList, achieveNew.getNumberOfPeople());
+            }
+
             achieveNew.setProjNum(1);
             if (StringUtils.isNotBlank(beauticianState.getExtract())) {
                 achieveNew.setProjPercentage(Double.parseDouble(beauticianState.getExtract()));
@@ -209,6 +237,20 @@
             achieveNewDao.batchInsert(achieveNewList);
         }
 
+    }
+
+    /**
+     * 顾问人头业绩
+     * @param achieveNew
+     */
+    private void saleAchieveNumOfPeople(AchieveNew achieveNew) {
+        List<AchieveNew> saleList = achieveNewDao.selectSaleManAchieveList(achieveNew.getSaleId(), achieveNew.getVipId(), new Date());
+        if (CollUtil.isEmpty(saleList)) {
+            achieveNew.setNumberOfPeople(1D);
+        } else {
+            achieveNew.setNumberOfPeople(1D / (1D + saleList.size()));
+            achieveNewDao.updateAchieveNumOfPeople(saleList, achieveNew.getNumberOfPeople());
+        }
     }
 
     @Override
@@ -265,7 +307,8 @@
 
         }
 
-
+        // 设置顾问人头业绩
+        saleAchieveNumOfPeople(achieveNew);
 
         achieveNew.setOrderType(Dictionary.ORDER_TYPE_SEAL);
         achieveNew.setOrderId(pageOrder.getId());
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
index 57c2716..058970f 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -1021,7 +1021,8 @@
     /**
      * 跳过服务单某步骤
      */
-    private boolean skipServiceOrderStep(String step) {
+    @Override
+    public boolean skipServiceOrderStep(String step) {
         SysUsers users = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
         ParameterSettings ps = new ParameterSettings();
         ps.setCompanyId(users.getCompanyId());
diff --git a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/DataAnalysisCustomer.java b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/DataAnalysisCustomer.java
index 8b00027..5fc7ecb 100644
--- a/zq-erp/src/main/java/com/matrix/system/hiveErp/action/DataAnalysisCustomer.java
+++ b/zq-erp/src/main/java/com/matrix/system/hiveErp/action/DataAnalysisCustomer.java
@@ -11,7 +11,6 @@
 import com.matrix.system.hive.service.imp.DataAnalysisCustomerServiceImpl;
 import com.matrix.system.hiveErp.analysUtil.*;
 import com.matrix.system.hiveErp.dao.TjVipSumDao;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java
index ec2b34a..db91c07 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java
@@ -19,7 +19,6 @@
 import com.matrix.system.shopXcx.api.vo.WxActivitiesGroupBuyVO;
 import com.matrix.system.shopXcx.bean.*;
 import com.matrix.system.shopXcx.dao.*;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
@@ -237,7 +236,6 @@
         return qrcodeImgParam;
     }
 
-    @NotNull
     private QrcodeImgParam getQrcodeImgParam(SysVipInfo loginUser, QrcodeVo qrcodeVo) throws Exception {
 
         ShopProduct shopProduct = shopProductDao.selectById(qrcodeVo.getProductId());
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java
index eb8cf7e..d3d9bf5 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java
@@ -73,7 +73,14 @@
 		Long userId = loginUser.getId();
 		//获取签到活动的信息
         SignBasicInfoVo signBasicInfoVo = new SignBasicInfoVo();
+        AjaxResult ajaxResult = new AjaxResult();
+
         ShopActivities shopActivities = shopActivitiesDao.selectOneByCompanyIdAndActTypeAndActStatus(companyId,ShopActivities.ACTIVITIES_TYPE_SIGN,ShopActivities.ACTSTATUS_STATUS_ING);
+        if(ObjectUtil.isEmpty(shopActivities)){
+            ajaxResult = AjaxResult.buildFailInstance("活动还没有开始");
+            ajaxResult.setData(signBasicInfoVo);
+            return ajaxResult;
+        }
         Long actId = shopActivities.getId();
         signBasicInfoVo.setActName(shopActivities.getActName());
         signBasicInfoVo.setActCode(shopActivities.getActCode());
@@ -81,19 +88,19 @@
         String actContent = shopActivities.getActContent();
         SignBasicInfoJsonVo signBasicInfoJsonVo = JSON.parseObject(actContent, SignBasicInfoJsonVo.class);
         signBasicInfoVo.setSignBasicInfoJsonVo(signBasicInfoJsonVo);
-        
-		List<ActivitySignAwardSetVo> activitySignAwardSetVos = activitySignAwardSetDao
-				.selectListByActIDAndCompanyId(actId,companyId,ActivitySignAwardSet.AWARDSTATE_WORK);
-		signBasicInfoVo.setActivitySignAwardSetVos(activitySignAwardSetVos);
 
-		//今日是否已经参与
+        List<ActivitySignAwardSetVo> activitySignAwardSetVos = activitySignAwardSetDao
+                .selectListByActIDAndCompanyId(actId,companyId,ActivitySignAwardSet.AWARDSTATE_WORK);
+        signBasicInfoVo.setActivitySignAwardSetVos(activitySignAwardSetVos);
+
+        //今日是否已经参与
         ActivitySignRecord activitySignRecord = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,new Date());
         if(ObjectUtil.isNotEmpty(activitySignRecord)) {
-        	signBasicInfoVo.setJoinState(SignBasicInfoVo.JOINSTATE_SIGN);
+            signBasicInfoVo.setJoinState(SignBasicInfoVo.JOINSTATE_SIGN);
         }else {
-        	signBasicInfoVo.setJoinState(SignBasicInfoVo.JOINSTATE_NOTSIGN);
+            signBasicInfoVo.setJoinState(SignBasicInfoVo.JOINSTATE_NOTSIGN);
         }
-        AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+        ajaxResult = AjaxResult.buildSuccessInstance("");
         ajaxResult.setData(signBasicInfoVo);
         return ajaxResult;
     }
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
index 4d98102..fb605a0 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -1076,4 +1076,25 @@
 		group by a.shop_id
 		order by amount desc, a.shop_id
 	</select>
+
+	<!-- 顾问当天下单列表 -->
+	<select id="selectSaleManAchieveList" resultMap="AchieveNewMap">
+		select * from achieve_new
+		where sale_id=#{saleId} and vip_id=#{vipId} and sale_id=beault_id
+		  and date_format(datatime, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
+	</select>
+
+	<select id="selectBeautyManAchieveList" resultMap="AchieveNewMap">
+		select * from achieve_new
+		where beault_id=#{beautyId} and vip_id=#{vipId}
+		  and date_format(datatime, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
+	</select>
+
+
+	<update id="updateAchieveNumOfPeople">
+		<foreach collection="list" item="item" index="index"
+				 separator=";">
+			update achieve_new set number_of_people=#{num} where id=#{item.id}
+		</foreach>
+	</update>
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html
index ea543fc..d1658b5 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-market.html
@@ -56,7 +56,7 @@
     <el-row>
         <el-col :span="4">
             <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
-                <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
+                <img src="imageUrlqd" class="image">
                 <div style="padding: 5px;">
                     <span style="padding:5px;font-size: 30px;">每日签到</span>
                     <div class="bottom clearfix">
@@ -67,7 +67,7 @@
         </el-col>
         <el-col :span="4">
             <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
-                <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
+                <img src="imageUrlpt" class="image">
                 <div style="padding: 5px;">
                     <span style="padding:5px;font-size: 30px;">拼团</span>
                     <div class="bottom clearfix">
@@ -78,7 +78,7 @@
         </el-col>
         <el-col :span="4">
             <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
-                <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
+                <img src="imageUrlms" class="image">
                 <div style="padding: 5px;">
                     <span style="padding:5px;font-size: 30px;">秒杀</span>
                     <div class="bottom clearfix">
@@ -89,7 +89,7 @@
         </el-col>
         <el-col :span="4">
             <el-card class="box-card" :body-style="{ padding: '10px 10px'}">
-                <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
+                <img src="imageUrlsl" class="image">
                 <div style="padding: 5px;">
                     <span style="padding:5px;font-size: 30px;">沙龙</span>
                     <div class="bottom clearfix">
@@ -115,7 +115,12 @@
 <script>
     var app = new Vue({
         el: '#app',
-        data: {},
+        data: {
+            imageUrlqd: basePath + "/image/meiriqiandao.png",
+            imageUrlms: basePath + "/image/jisumiaosha.png",
+            imageUrlpt: basePath + "/image/tiantianpingtuan.png",
+            imageUrlsl: basePath + "/image/shalonghuodong.png",
+        },
         created: function () {
         },
         methods: {
diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html
index a134b2f..eba3a4c 100644
--- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html
+++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html
@@ -616,8 +616,8 @@
 
             //标题图片
             imageUrlTitle: '',
-            imageUrlHead: '',
-            imageUrlButton: '',
+            imageUrlHead: basePath + "/image/signHead.png",
+            imageUrlButton: basePath + "/image/signButton.png",
             imageUrlState: '',
 
             //字体颜色
@@ -867,6 +867,7 @@
                             message: data.info,
                             type: 'success',
                         });
+                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                     }
                 });
             },

--
Gitblit v1.9.1