|
|
@@ -25,6 +25,8 @@ import org.springframework.stereotype.Component;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.mail.MessagingException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -71,7 +73,8 @@ public class AsyncUtils {
|
|
|
private FinanceCountMapper financeCountMapper;
|
|
|
@Resource
|
|
|
private WeChatUtils weChatUtils;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private AdminProjectStatisticsMapper adminProjectStatisticsMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -837,4 +840,59 @@ public class AsyncUtils {
|
|
|
Admin admin = adminMapper.selectByPrimaryKey(publicCarbonCopy);
|
|
|
weChatUtils.addSendCopyNotice(admin.getOpenId(), id, name, startTime, endTime, typeName, plan);
|
|
|
}
|
|
|
+ public void updateAdminByAid(String aid,String aid2) {
|
|
|
+ updateAdminByAid(aid);
|
|
|
+ updateAdminByAid(aid2);
|
|
|
+ }
|
|
|
+ public void updateAdminByAid(String aid) {
|
|
|
+ List<TOrderTaskBo> tOrderTaskBos = tOrderTaskMapper.selectAdminTaskByAid(aid);
|
|
|
+
|
|
|
+ int htSatCount = 0,htSatScoreCount = 0,htSatNotScoreCount = 0,
|
|
|
+ memberCount=0,memberScoreCount = 0,memberNotScoreCount = 0;
|
|
|
+ BigDecimal ht_satSum=new BigDecimal(0);
|
|
|
+ BigDecimal hySum=new BigDecimal(0);
|
|
|
+ for (TOrderTaskBo tOrderTaskBo : tOrderTaskBos) {
|
|
|
+ if (aid ==null) aid =tOrderTaskBo.getTaskReceiver();
|
|
|
+ if (tOrderTaskBo.getcSort()==3||tOrderTaskBo.getcSort()==9){
|
|
|
+ htSatCount++;
|
|
|
+ if (tOrderTaskBo.getScoreStatus()==1){
|
|
|
+ htSatNotScoreCount++;
|
|
|
+ }else if (tOrderTaskBo.getScoreStatus()==2){
|
|
|
+ htSatScoreCount++;
|
|
|
+ ht_satSum=ht_satSum.add(new BigDecimal(tOrderTaskBo.getScoreNumber()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if (tOrderTaskBo.getcSort()==6) {
|
|
|
+ memberCount++;
|
|
|
+ if (tOrderTaskBo.getScoreStatus()==1){
|
|
|
+ memberNotScoreCount++;
|
|
|
+ }else if (tOrderTaskBo.getScoreStatus()==2){
|
|
|
+ memberScoreCount++;
|
|
|
+ hySum=hySum.add(new BigDecimal(tOrderTaskBo.getScoreNumber()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal htSatScoreAverage = BigDecimal.ZERO;
|
|
|
+ BigDecimal memberScoreAverage = BigDecimal.ZERO;
|
|
|
+ if (htSatScoreCount>0)htSatScoreAverage=ht_satSum.divide(new BigDecimal(htSatScoreCount),2, RoundingMode.HALF_UP);
|
|
|
+ if (memberScoreCount>0)memberScoreAverage=hySum.divide(new BigDecimal(memberScoreCount),2, RoundingMode.HALF_UP);
|
|
|
+ AdminProjectStatistics adminProjectStatistics = adminProjectStatisticsMapper.queryByAid(aid);
|
|
|
+ AdminProjectStatistics aps=new AdminProjectStatistics();
|
|
|
+ aps.setAid(aid);
|
|
|
+ aps.setHtSatCount(htSatCount);
|
|
|
+ aps.setHtSatScoreAverage(htSatScoreAverage.doubleValue());
|
|
|
+ aps.setHtSatNotScoreCount(htSatNotScoreCount);
|
|
|
+ aps.setHtSatScoreCount(htSatScoreCount);
|
|
|
+ aps.setMemberScoreAverage(memberScoreAverage.doubleValue());
|
|
|
+ aps.setMemberScoreCount(memberScoreCount);
|
|
|
+ aps.setMemberNotScoreCount(memberNotScoreCount);
|
|
|
+ aps.setMemberCount(memberCount);
|
|
|
+ if (adminProjectStatistics==null){
|
|
|
+ adminProjectStatisticsMapper.insert(aps);
|
|
|
+ }else {
|
|
|
+ aps.setId(adminProjectStatistics.getId());
|
|
|
+ adminProjectStatisticsMapper.update(aps);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|