From 8a299a9f1faf1bd1221628d857bd300f984ade00 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 15 Apr 2021 17:41:15 +0800
Subject: [PATCH] finish some function
---
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/shopXcx/api/action/WxShareProductAction.java | 2 -
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/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/java/com/matrix/system/hive/service/SysProjServicesService.java | 2 +
10 files changed, 78 insertions(+), 9 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/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
--
Gitblit v1.9.1