Commit 18b0e184 by 崔彦峰

modify:逻辑新增企微发送通知代码。

1 parent 87a4a3d3
...@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -29,6 +30,7 @@ import tk.mybatis.mapper.entity.Example; ...@@ -29,6 +30,7 @@ import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -42,6 +44,12 @@ public class EffectiveReferralReviewMiniProgramService { ...@@ -42,6 +44,12 @@ public class EffectiveReferralReviewMiniProgramService {
@Autowired @Autowired
private CommonProxyRemote commonProxyRemote; private CommonProxyRemote commonProxyRemote;
@Autowired
private EffectiveReferralReviewQwService effectiveReferralReviewQwService;
@Autowired
private TaskExecutor taskExecutor;
public List<EffectiveReferralReviewCommonDTO> effectiveReferralStoreList(EffectiveReferralReviewCommonDTO request) { public List<EffectiveReferralReviewCommonDTO> effectiveReferralStoreList(EffectiveReferralReviewCommonDTO request) {
//筛选项:门店名字(模糊搜索),状态:未提交、已提交,月份:2026-01, //筛选项:门店名字(模糊搜索),状态:未提交、已提交,月份:2026-01,
//特殊逻辑:根据商户门店id去重,根据门店首字母倒序。要根据门店的不同业务场景的数据判断是否已提交和未提交。 //特殊逻辑:根据商户门店id去重,根据门店首字母倒序。要根据门店的不同业务场景的数据判断是否已提交和未提交。
...@@ -196,6 +204,24 @@ public class EffectiveReferralReviewMiniProgramService { ...@@ -196,6 +204,24 @@ public class EffectiveReferralReviewMiniProgramService {
referralReviewCommonDTOS.stream().collect(Collectors.toMap(EffectiveReferralReviewCommonDTO::getId, item -> item)); referralReviewCommonDTOS.stream().collect(Collectors.toMap(EffectiveReferralReviewCommonDTO::getId, item -> item));
//3、根据id更新引荐数、上传凭证、备注、状态 //3、根据id更新引荐数、上传凭证、备注、状态
AtomicReference<Boolean> sendMessageFlag = new AtomicReference<>(false);
updateEffectiveReferralInfo(dto, referralReviewCommonDTOSMap, sendMessageFlag);
//4、异步发送企微
sendMessageAsync(sendMessageFlag, referralReviewCommonDTOS.get(0));
return true;
}
/**
* 更新引荐数、上传凭证、备注、状态
*
* @param dto
* @param referralReviewCommonDTOSMap
* @param sendMessageFlag
*/
private void updateEffectiveReferralInfo(StoreEffectiveReferralSubmitDTO dto,
Map<Integer, EffectiveReferralReviewCommonDTO> referralReviewCommonDTOSMap,
AtomicReference<Boolean> sendMessageFlag) {
dto.getEffectiveReferralCountDTOS().forEach( dto.getEffectiveReferralCountDTOS().forEach(
item -> { item -> {
EffectiveReferralReview review = new EffectiveReferralReview(); EffectiveReferralReview review = new EffectiveReferralReview();
...@@ -211,6 +237,7 @@ public class EffectiveReferralReviewMiniProgramService { ...@@ -211,6 +237,7 @@ public class EffectiveReferralReviewMiniProgramService {
&& !item.getEffectiveReferralCount().equals(referralReviewCommonDTOSMap.get(item.getId()).getTotalDeliveryCount())) { && !item.getEffectiveReferralCount().equals(referralReviewCommonDTOSMap.get(item.getId()).getTotalDeliveryCount())) {
review.setIsNeedReviewed(1); review.setIsNeedReviewed(1);
review.setIsReviewed(0); review.setIsReviewed(0);
sendMessageFlag.set(true);
} }
else { else {
review.setIsNeedReviewed(0); review.setIsNeedReviewed(0);
...@@ -225,7 +252,20 @@ public class EffectiveReferralReviewMiniProgramService { ...@@ -225,7 +252,20 @@ public class EffectiveReferralReviewMiniProgramService {
effectiveReferralReviewMapper.updateByPrimaryKeySelective(review); effectiveReferralReviewMapper.updateByPrimaryKeySelective(review);
} }
); );
return true; }
/**
* @description: 异步发送企微
* @param: [sendMessageFlag, referralReviewCommonDTOS]
* @return: void
*/
private void sendMessageAsync(AtomicReference<Boolean> sendMessageFlag, EffectiveReferralReviewCommonDTO reviewCommonDTO) {
taskExecutor.execute(() -> {
if (sendMessageFlag.get()) {
effectiveReferralReviewQwService.qwOnlineNotification(reviewCommonDTO.getReviewMonth(), reviewCommonDTO.getMerchantId(), reviewCommonDTO.getSceneType());
}
}
);
} }
/** /**
......
...@@ -3,19 +3,18 @@ package cn.com.glsx.dj.staff.service.perfSalary; ...@@ -3,19 +3,18 @@ package cn.com.glsx.dj.staff.service.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO; import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO; import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO; import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.dto.salary.StaffSalaryDetailDTO;
import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum; import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum;
import cn.com.glsx.dj.staff.mapper.perfSalary.EffectiveReferralReviewMapper; import cn.com.glsx.dj.staff.mapper.perfSalary.EffectiveReferralReviewMapper;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview; import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import cn.com.glsx.dj.staff.service.staffPerformance.PerformanceTimeCycleService; import cn.com.glsx.dj.staff.service.staffPerformance.PerformanceTimeCycleService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -36,6 +35,13 @@ public class EffectiveReferralReviewService { ...@@ -36,6 +35,13 @@ public class EffectiveReferralReviewService {
@Resource @Resource
private PerformanceTimeCycleService performanceTimeCycleService; private PerformanceTimeCycleService performanceTimeCycleService;
@Autowired
private EffectiveReferralReviewQwService effectiveReferralReviewQwService;
@Autowired
private TaskExecutor taskExecutor;
/** /**
* 查询门店有效数列表 * 查询门店有效数列表
* *
...@@ -98,9 +104,17 @@ public class EffectiveReferralReviewService { ...@@ -98,9 +104,17 @@ public class EffectiveReferralReviewService {
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void effectiveReferralAudit(EffectiveReferralReviewCommonDTO dto) { public void effectiveReferralAudit(EffectiveReferralReviewCommonDTO dto) {
//1、查询有效引荐数表关联门店表
List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(dto);
if (referralReviewCommonDTOS.isEmpty()) {
throw new RpcServiceException("无效的主键id");
}
EffectiveReferralReviewCommonDTO effectiveReferralDTO = referralReviewCommonDTOS.get(0);
//2、更新有效引荐数表
EffectiveReferralReview effectiveReferralReview = new EffectiveReferralReview(); EffectiveReferralReview effectiveReferralReview = new EffectiveReferralReview();
Date curDate = new Date(); Date curDate = new Date();
//将curDate 转化为 yyyy-MM
effectiveReferralReview.setId(dto.getId()); effectiveReferralReview.setId(dto.getId());
effectiveReferralReview.setReviewedEffectiveCount(dto.getReviewedEffectiveCount()); effectiveReferralReview.setReviewedEffectiveCount(dto.getReviewedEffectiveCount());
effectiveReferralReview.setIsReviewed(1); effectiveReferralReview.setIsReviewed(1);
...@@ -110,6 +124,11 @@ public class EffectiveReferralReviewService { ...@@ -110,6 +124,11 @@ public class EffectiveReferralReviewService {
effectiveReferralReview.setUpdatedBy(dto.getUpdatedBy()); effectiveReferralReview.setUpdatedBy(dto.getUpdatedBy());
effectiveReferralReview.setUpdatedDate(curDate); effectiveReferralReview.setUpdatedDate(curDate);
effectiveReferralReviewMapper.updateByPrimaryKeySelective(effectiveReferralReview); effectiveReferralReviewMapper.updateByPrimaryKeySelective(effectiveReferralReview);
//3、异步发送企微通知
taskExecutor.execute(() -> {
effectiveReferralReviewQwService.changeCountManagerQwNotification(effectiveReferralDTO.getMerchantName(), effectiveReferralDTO.getManagerPhone());
});
} }
/*public String effectiveReferralExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) { /*public String effectiveReferralExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
......
...@@ -145,6 +145,9 @@ ...@@ -145,6 +145,9 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="id != null ">
AND serr.id = #{id}
</if>
ORDER BY serr.id DESC ORDER BY serr.id DESC
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!