|
|
@@ -2,13 +2,11 @@ package com.poteviohealth.cgp.statistics.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.poteviohealth.cgp.common.filter.TokenContext;
|
|
|
-import com.poteviohealth.cgp.common.integrated.DateParams;
|
|
|
import com.poteviohealth.cgp.common.integrated.ListParams;
|
|
|
import com.poteviohealth.cgp.common.integrated.customer.model.CustomerServiceParams;
|
|
|
import com.poteviohealth.cgp.common.integrated.customer.model.CustomerSubsidyDTO;
|
|
|
@@ -28,20 +26,20 @@ import com.poteviohealth.cgp.statistics.constant.enums.OrderConstantEnum;
|
|
|
import com.poteviohealth.cgp.statistics.mapper.OrderMapper;
|
|
|
import com.poteviohealth.cgp.statistics.model.Order;
|
|
|
import com.poteviohealth.cgp.statistics.model.WatermarkImg;
|
|
|
-import com.poteviohealth.cgp.statistics.model.indto.*;
|
|
|
+import com.poteviohealth.cgp.statistics.model.indto.DishesOrderWebInDTO;
|
|
|
+import com.poteviohealth.cgp.statistics.model.indto.OrderCostWebInDTO;
|
|
|
+import com.poteviohealth.cgp.statistics.model.indto.OrderServiceWebInDTO;
|
|
|
+import com.poteviohealth.cgp.statistics.model.indto.OrderWebInDTO;
|
|
|
import com.poteviohealth.cgp.statistics.model.outdto.*;
|
|
|
import com.poteviohealth.cgp.statistics.service.IOrderService;
|
|
|
-import com.poteviohealth.cgp.statistics.utils.OssUtils;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.EnumUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.commons.lang3.time.DateUtils;
|
|
|
import org.apache.ibatis.builder.BuilderException;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
@@ -58,18 +56,16 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
|
|
|
@Value("${sync.dbName}")
|
|
|
private String dbName;
|
|
|
- @Resource
|
|
|
- private OssUtils ossUtils;
|
|
|
+
|
|
|
@Override
|
|
|
public void statisticsOrder(String dateTime){
|
|
|
try {
|
|
|
- TokenContext.setOperator(1);
|
|
|
//检查区域,没有的新增
|
|
|
List<Order> list = this.list();
|
|
|
- Date date = new Date();
|
|
|
+ /* Date date = new Date();
|
|
|
if(StringUtils.isNotEmpty(dateTime)){
|
|
|
date = DateUtils.parseDate(dateTime,"yyyy-MM-dd HH:mm:ss");
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
List<AreaDTO> areaList = baseMapper.areaList(dbName);
|
|
|
if(list.size() != areaList.size()){
|
|
|
@@ -111,25 +107,16 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
Map<Integer,List<Order>> maps = list.stream().collect(Collectors.groupingBy(Order::getAreaId));
|
|
|
|
|
|
if(!maps.isEmpty()){
|
|
|
- log.info("---数据清零开始---");
|
|
|
+ /* log.info("---数据清零开始---");
|
|
|
changeZero(maps,date);
|
|
|
- log.info("---数据清零结束---");
|
|
|
- Date startDate = null;
|
|
|
- for (Integer integer : maps.keySet()) {
|
|
|
- startDate = maps.get(integer).get(0).getChangeDate();
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- DateParams dateParams = new DateParams();
|
|
|
- dateParams.setStartDate(startDate);
|
|
|
- dateParams.setEndDate(date);
|
|
|
+ log.info("---数据清零结束---");*/
|
|
|
//更新服务人员数据
|
|
|
log.info("---更新服务人员数据开始---");
|
|
|
changeEmployee(maps);
|
|
|
log.info("---更新服务人员数据结束---");
|
|
|
List<Integer> operatorIds = baseMapper.getOperatorList(dbName);
|
|
|
log.info("---获取客户数据开始---");
|
|
|
- List<CustomerSubsidyDTO> customerList = this.getSubsidyCustomerList(dateParams,operatorIds);
|
|
|
+ List<CustomerSubsidyDTO> customerList = this.getSubsidyCustomerList(operatorIds);
|
|
|
log.info("---获取客户数据结束---");
|
|
|
//更新客户数据
|
|
|
if(!customerList.isEmpty()){
|
|
|
@@ -138,13 +125,13 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
log.info("---更新客户数据结束---");
|
|
|
}
|
|
|
//获取助餐服务客户数
|
|
|
- List<ListParams> mealList = this.getSubsidyCustomerMealList(dateParams,operatorIds);
|
|
|
+ List<ListParams> mealList = this.getSubsidyCustomerMealList(operatorIds);
|
|
|
if(CollectionUtils.isNotEmpty(mealList)){
|
|
|
for (Integer integer : maps.keySet()) {
|
|
|
for (ListParams params : mealList) {
|
|
|
if(params.getId().equals(integer)){
|
|
|
for (Order order : maps.get(integer)) {
|
|
|
- order.setServiceCustomerNum(order.getServiceCustomerNum()+params.getKey());
|
|
|
+ order.setServiceCustomerNum(params.getKey());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -153,7 +140,7 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
//更新工单相关数据
|
|
|
log.info("---更新工单数据开始---");
|
|
|
List<ListParams> categoryList = baseMapper.getAllCategory(dbName);
|
|
|
- changeOrder(maps,dateParams,operatorIds,categoryList);
|
|
|
+ changeOrder(maps,operatorIds,categoryList);
|
|
|
log.info("---更新工单数据结束---");
|
|
|
//更新积分相关数据
|
|
|
log.info("---更新商户积分数据开始---");
|
|
|
@@ -161,16 +148,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
log.info("---更新商户积分数据结束---");
|
|
|
|
|
|
log.info("---客户积分开始获取---");
|
|
|
- changeCustomerIntegral(maps,dateParams);
|
|
|
+ changeCustomerIntegral(maps);
|
|
|
log.info("---客户积分结束获取---");
|
|
|
log.info("---积分流水开始获取---");
|
|
|
- changeTransIntegral(maps,dateParams);
|
|
|
+ changeTransIntegral(maps);
|
|
|
log.info("---积分流水结束获取---");
|
|
|
- for (Integer integer : maps.keySet()) {
|
|
|
- for (Order order : maps.get(integer)) {
|
|
|
- order.setChangeDate(date);
|
|
|
- }
|
|
|
- }
|
|
|
this.saveOrUpdateBatch(list);
|
|
|
}
|
|
|
log.info("完成----");
|
|
|
@@ -749,18 +731,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
return orderQueryWrapper;
|
|
|
}
|
|
|
|
|
|
- private List<ListParams> getSubsidyCustomerMealList(DateParams dateParams,List<Integer> operatorIds){
|
|
|
+ private List<ListParams> getSubsidyCustomerMealList(List<Integer> operatorIds){
|
|
|
List<ListParams> returnList = Lists.newArrayList();
|
|
|
- QueryWrapper queryWrapper = new QueryWrapper<>();
|
|
|
- if(dateParams.getStartDate() != null){
|
|
|
- queryWrapper.ge("meal_date",dateParams.getStartDate());
|
|
|
- }
|
|
|
- if(dateParams.getEndDate() != null){
|
|
|
- queryWrapper.lt("meal_date",dateParams.getEndDate());
|
|
|
- }
|
|
|
for (Integer operatorId : operatorIds) {
|
|
|
//获取签约客户信息
|
|
|
- List<Customer> dto = baseMapper.getSubsidyCustomerMealList(operatorId,dbName,queryWrapper);
|
|
|
+ List<Customer> dto = baseMapper.getSubsidyCustomerMealList(operatorId,dbName);
|
|
|
if(!dto.isEmpty()){
|
|
|
Map<Integer,List<Customer>> streetMaps = dto.stream().filter(c->c.getNowStreetId() != null).collect(Collectors.groupingBy(Customer::getNowStreetId));
|
|
|
getMealData(streetMaps,returnList);
|
|
|
@@ -785,19 +760,12 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<CustomerSubsidyDTO> getSubsidyCustomerList(DateParams dateParams,List<Integer> operatorIds){
|
|
|
+ private List<CustomerSubsidyDTO> getSubsidyCustomerList(List<Integer> operatorIds){
|
|
|
|
|
|
List<CustomerSubsidyDTO> returnList = Lists.newArrayList();
|
|
|
- QueryWrapper queryWrapper = new QueryWrapper<>();
|
|
|
- if(dateParams.getStartDate() != null){
|
|
|
- queryWrapper.ge("d.created_date",dateParams.getStartDate());
|
|
|
- }
|
|
|
- if(dateParams.getEndDate() != null){
|
|
|
- queryWrapper.lt("d.created_date",dateParams.getEndDate());
|
|
|
- }
|
|
|
for (Integer operatorId : operatorIds) {
|
|
|
//获取签约客户信息
|
|
|
- List<CustomerSubsidyDTO> dto =baseMapper.getSubsidyCustomerList(operatorId,dbName,queryWrapper);
|
|
|
+ List<CustomerSubsidyDTO> dto =baseMapper.getSubsidyCustomerList(operatorId,dbName);
|
|
|
if(!dto.isEmpty()){
|
|
|
returnList.addAll(dto);
|
|
|
}
|
|
|
@@ -1057,11 +1025,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
continue;
|
|
|
}
|
|
|
for (Order order : orders) {
|
|
|
- order.setCustomerNum((order.getCustomerNum()==null?0:order.getCustomerNum())+subsidyCustomerFace.getNum());
|
|
|
- order.setCustomerGovernmentNum((order.getCustomerGovernmentNum()==null?0:order.getCustomerGovernmentNum())+subsidyCustomerFace.getCustomerGovernmentNum());
|
|
|
- order.setCustomerSocietyNum((order.getCustomerSocietyNum()==null?0:order.getCustomerSocietyNum())+subsidyCustomerFace.getCustomerSocietyNum());
|
|
|
+ order.setCustomerNum(subsidyCustomerFace.getNum());
|
|
|
+ order.setCustomerGovernmentNum(subsidyCustomerFace.getCustomerGovernmentNum());
|
|
|
+ order.setCustomerSocietyNum(subsidyCustomerFace.getCustomerSocietyNum());
|
|
|
order.setCareRate(BigDecimal.ZERO);
|
|
|
- order.setAllCustomerNum(order.getAllCustomerNum()+ subsidyCustomerFace.getAllCustomerNum());
|
|
|
+ order.setAllCustomerNum(subsidyCustomerFace.getAllCustomerNum());
|
|
|
order.setCareNum(0);
|
|
|
order.setCarePic("");
|
|
|
order.setCareMember(0);
|
|
|
@@ -1088,16 +1056,6 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
List<String> title = Lists.newArrayList();
|
|
|
List<Integer> total = Lists.newArrayList();
|
|
|
List<BigDecimal> rate = Lists.newArrayList();
|
|
|
- if(StringUtils.isNotEmpty(order.getCustomerList())){
|
|
|
- JSONObject jsonObject = new JSONObject(JSON.parseObject(order.getCustomerList()));
|
|
|
- SubsidyCustomerJsonVo vo = JSONObject.toJavaObject(jsonObject, SubsidyCustomerJsonVo.class);
|
|
|
- if(!vo.getId().isEmpty()){
|
|
|
- id.addAll(vo.getId());
|
|
|
- }
|
|
|
- title.addAll(vo.getTitle());
|
|
|
- total.addAll(vo.getTotal());
|
|
|
- rate.addAll(vo.getRate());
|
|
|
- }
|
|
|
|
|
|
for (SubsidyCustomerJsonFace face : jsonFace) {
|
|
|
Integer num = face.getTotal();
|
|
|
@@ -1111,31 +1069,14 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
sum = serviceCustomerList.stream().filter(s->s.getStreetId().equals(order.getAreaId()) && StringUtils.isNotEmpty(s.getCustomerTypeId()) && s.getCustomerTypeId().contains(","+face.getAreaId().toString()+",")).mapToLong(s->s.getCustomerNum()).sum();
|
|
|
}
|
|
|
}
|
|
|
- if(id.contains(face.getAreaId().toString())){
|
|
|
- for (int i = 0; i < id.size(); i++) {
|
|
|
- if(id.get(i).equals(face.getAreaId().toString())){
|
|
|
- total.set(i,total.get(i)+face.getTotal());
|
|
|
- num = total.get(i);
|
|
|
- if(num == 0L){
|
|
|
- rate.set(i,BigDecimal.ZERO);
|
|
|
- }else{
|
|
|
- BigDecimal val = new BigDecimal(sum).divide(new BigDecimal(num),4, BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal decimal2 = val.multiply(new BigDecimal("100.0")).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
- rate.set(i,decimal2);
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- id.add(face.getAreaId().toString());
|
|
|
- title.add(face.getTitle());
|
|
|
- total.add(face.getTotal());
|
|
|
- if(num == 0L){
|
|
|
- rate.add(BigDecimal.ZERO);
|
|
|
- }else {
|
|
|
- BigDecimal decimal2 = new BigDecimal(sum).divide(new BigDecimal(num), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- rate.add(decimal2);
|
|
|
- }
|
|
|
+ id.add(face.getAreaId().toString());
|
|
|
+ title.add(face.getTitle());
|
|
|
+ total.add(face.getTotal());
|
|
|
+ if(num == 0L){
|
|
|
+ rate.add(BigDecimal.ZERO);
|
|
|
+ }else {
|
|
|
+ BigDecimal decimal2 = new BigDecimal(sum).divide(new BigDecimal(num), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100.0)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ rate.add(decimal2);
|
|
|
}
|
|
|
}
|
|
|
SubsidyCustomerJsonVo vo = new SubsidyCustomerJsonVo();
|
|
|
@@ -1145,50 +1086,22 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
vo.setRate(rate);
|
|
|
order.setCustomerList(JSONObject.toJSONString(vo));
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(order.getCustomerAgeList()) && subsidyCustomerFace.getCustomerAgeListData() != null){
|
|
|
- MemberListData data =JSONObject.toJavaObject(JSON.parseObject(order.getCustomerAgeList()), MemberListData.class);
|
|
|
- MemberListData newData = subsidyCustomerFace.getCustomerAgeListData();
|
|
|
-
|
|
|
- data.setTotal(data.getTotal()+newData.getTotal());
|
|
|
-
|
|
|
- for (int i = 0; i < data.getMale().size(); i++) {
|
|
|
- data.getMale().set(i,data.getMale().get(i)+newData.getMale().get(i));
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < data.getWoman().size(); i++) {
|
|
|
- data.getWoman().set(i,data.getWoman().get(i)+newData.getWoman().get(i));
|
|
|
- }
|
|
|
- order.setCustomerAgeList(JSONObject.toJSONString(data));
|
|
|
- }else if(subsidyCustomerFace.getCustomerAgeListData() != null){
|
|
|
+ if(subsidyCustomerFace.getCustomerAgeListData() != null){
|
|
|
order.setCustomerAgeList(JSONObject.toJSONString(subsidyCustomerFace.getCustomerAgeListData()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<SubsidyCustomerFace> integralCustomer(DateParams dateParams){
|
|
|
+ private List<SubsidyCustomerFace> integralCustomer(){
|
|
|
List<SubsidyCustomerFace> returnList = Lists.newArrayList();
|
|
|
- QueryWrapper detailQueryWrapper = new QueryWrapper<>();
|
|
|
- if(dateParams.getStartDate() != null){
|
|
|
- detailQueryWrapper.ge("created_date",dateParams.getStartDate());
|
|
|
- }
|
|
|
- if(dateParams.getEndDate() != null){
|
|
|
- detailQueryWrapper.le("created_date",dateParams.getEndDate());
|
|
|
- }
|
|
|
- List<Integer> operationIds = baseMapper.getIntegralCardAccOperatorIdList(dbName,detailQueryWrapper);
|
|
|
+ List<Integer> operationIds = baseMapper.getIntegralCardAccOperatorIdList(dbName);
|
|
|
|
|
|
List<IntegralTrans> detailsCustomer = Lists.newArrayList();
|
|
|
- QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
- if(dateParams.getStartDate() != null){
|
|
|
- queryWrapper.ge("d.created_date",dateParams.getStartDate());
|
|
|
- }
|
|
|
- if(dateParams.getEndDate() != null){
|
|
|
- queryWrapper.le("d.created_date",dateParams.getEndDate());
|
|
|
- }
|
|
|
|
|
|
for (Integer operationId : operationIds) {
|
|
|
//获取积分数据
|
|
|
- detailsCustomer.addAll(baseMapper.integralCustomerList(queryWrapper,operationId,dbName));
|
|
|
+ detailsCustomer.addAll(baseMapper.integralCustomerList(operationId,dbName));
|
|
|
}
|
|
|
|
|
|
log.info("---处理积分客户数据开始----");
|
|
|
@@ -1238,13 +1151,8 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void changeCustomerIntegral(Map<Integer, List<Order>> maps,DateParams dateParams) {
|
|
|
- List<SubsidyCustomerFace> integralList = this.integralCustomer(dateParams);
|
|
|
- Calendar calendar2 = Calendar.getInstance();
|
|
|
- calendar2.setTime(dateParams.getEndDate());
|
|
|
- int day = calendar2.get(Calendar.DAY_OF_MONTH);
|
|
|
- int hour = calendar2.get(Calendar.HOUR_OF_DAY);
|
|
|
-
|
|
|
+ private void changeCustomerIntegral(Map<Integer, List<Order>> maps) {
|
|
|
+ List<SubsidyCustomerFace> integralList = this.integralCustomer();
|
|
|
for (SubsidyCustomerFace subsidyCustomerFace : integralList) {
|
|
|
List<Order> orders = maps.get(subsidyCustomerFace.getAreaId());
|
|
|
if (CollectionUtils.isEmpty(orders)) {
|
|
|
@@ -1256,52 +1164,21 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
order.setPointMember(0);
|
|
|
}
|
|
|
if(subsidyCustomerFace.getCustomerNum() != null){
|
|
|
- Integer num =order.getPointMember()+subsidyCustomerFace.getCustomerNum();
|
|
|
- order.setPointMember(num);
|
|
|
- }
|
|
|
-
|
|
|
- if(StringUtils.isNotEmpty(order.getMemberListData()) && subsidyCustomerFace.getMemberListData() != null){
|
|
|
- MemberListData data =JSONObject.toJavaObject(JSON.parseObject(order.getMemberListData()), MemberListData.class);
|
|
|
- MemberListData newData = subsidyCustomerFace.getMemberListData();
|
|
|
-
|
|
|
- if(day == 1 && hour == 0){
|
|
|
- data.setTotal(newData.getTotal());
|
|
|
-
|
|
|
- }else{
|
|
|
- data.setTotal(data.getTotal()+newData.getTotal());
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < data.getMale().size(); i++) {
|
|
|
- data.getMale().set(i,data.getMale().get(i)+newData.getMale().get(i));
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < data.getWoman().size(); i++) {
|
|
|
- data.getWoman().set(i,data.getWoman().get(i)+newData.getWoman().get(i));
|
|
|
- }
|
|
|
- order.setMemberListData(JSONObject.toJSONString(data));
|
|
|
- }else if(subsidyCustomerFace.getMemberListData() != null){
|
|
|
- order.setMemberListData(JSONObject.toJSONString(subsidyCustomerFace.getMemberListData()));
|
|
|
+ order.setPointMember(subsidyCustomerFace.getCustomerNum());
|
|
|
}
|
|
|
-
|
|
|
+ order.setMemberListData(JSONObject.toJSONString(subsidyCustomerFace.getMemberListData()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- private List<SubsidyCustomerFace> integralTrans(DateParams dateParams){
|
|
|
+ private List<SubsidyCustomerFace> integralTrans(){
|
|
|
List<SubsidyCustomerFace> returnList = Lists.newArrayList();
|
|
|
List<Integer> operationIds = baseMapper.getIntegralCardDetailOperatorIdList(dbName);
|
|
|
List<IntegralTrans> detailsTrans = Lists.newArrayList();
|
|
|
- QueryWrapper queryWrapper2 = new QueryWrapper();
|
|
|
- if(dateParams.getStartDate() != null){
|
|
|
- queryWrapper2.ge("t.build_time",dateParams.getStartDate());
|
|
|
- }
|
|
|
- if(dateParams.getEndDate() != null){
|
|
|
- queryWrapper2.le("t.build_time",dateParams.getEndDate());
|
|
|
- }
|
|
|
for (Integer operationId : operationIds) {
|
|
|
//获取积分数据
|
|
|
- detailsTrans.addAll(baseMapper.integralTransList(queryWrapper2,operationId,dbName));
|
|
|
+ detailsTrans.addAll(baseMapper.integralTransList(operationId,dbName));
|
|
|
}
|
|
|
|
|
|
log.info("---处理流水数据开始----");
|
|
|
@@ -1397,8 +1274,8 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
return monthList;
|
|
|
}
|
|
|
|
|
|
- private void changeTransIntegral(Map<Integer, List<Order>> maps,DateParams dateParams) {
|
|
|
- List<SubsidyCustomerFace> integralList = this.integralTrans(dateParams);
|
|
|
+ private void changeTransIntegral(Map<Integer, List<Order>> maps) {
|
|
|
+ List<SubsidyCustomerFace> integralList = this.integralTrans();
|
|
|
|
|
|
for (SubsidyCustomerFace subsidyCustomerFace : integralList) {
|
|
|
List<Order> orders = maps.get(subsidyCustomerFace.getAreaId());
|
|
|
@@ -1411,76 +1288,20 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
order.setPointGrant(0L);
|
|
|
}
|
|
|
if(subsidyCustomerFace.getGrantNum() != null){
|
|
|
- Long num = order.getPointGrant()+subsidyCustomerFace.getGrantNum();
|
|
|
- order.setPointGrant(num);
|
|
|
+ order.setPointGrant(subsidyCustomerFace.getGrantNum());
|
|
|
}
|
|
|
if(order.getPointExchange() == null){
|
|
|
order.setPointExchange(0L);
|
|
|
}
|
|
|
if(subsidyCustomerFace.getExchangeNum() != null){
|
|
|
- Long num =order.getPointExchange() + subsidyCustomerFace.getExchangeNum();
|
|
|
- order.setPointExchange(num);
|
|
|
+ order.setPointExchange(subsidyCustomerFace.getExchangeNum());
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(order.getPointGoodsData2()) && CollectionUtils.isNotEmpty(subsidyCustomerFace.getPointGoodsData2())){
|
|
|
- List<MonthData> list =JSONArray.parseArray(order.getPointGoodsData2(),MonthData.class);
|
|
|
- for (MonthData data : subsidyCustomerFace.getPointGoodsData2()) {
|
|
|
- boolean isHave = false;
|
|
|
- for (MonthData monthData : list) {
|
|
|
- if(data.getText().equals(monthData.getText())){
|
|
|
- monthData.setAddValue(monthData.getAddValue()+data.getAddValue());
|
|
|
- isHave = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(!isHave){
|
|
|
- list.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
- order.setPointGoodsData2(JSONObject.toJSONString(list));
|
|
|
- }else if(CollectionUtils.isNotEmpty(subsidyCustomerFace.getPointGoodsData2())){
|
|
|
- order.setPointGoodsData2(JSONObject.toJSONString(subsidyCustomerFace.getPointGoodsData2()));
|
|
|
- }
|
|
|
+ order.setPointGoodsData2(JSONObject.toJSONString(subsidyCustomerFace.getPointGoodsData2()));
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(order.getPointCountData()) && CollectionUtils.isNotEmpty(subsidyCustomerFace.getPointCountData())){
|
|
|
- List<MonthData> list =JSONArray.parseArray(order.getPointCountData(),MonthData.class);
|
|
|
- List<MonthData> nowList =subsidyCustomerFace.getPointCountData();
|
|
|
- int t = 0;
|
|
|
- if(list.get(0).getText().equals(nowList.get(nowList.size()-1).getText())){
|
|
|
- t = 1;
|
|
|
- }
|
|
|
- for (int i = 0; i < nowList.size(); i++) {
|
|
|
- if(t ==nowList.size()){
|
|
|
- break;
|
|
|
- }
|
|
|
- nowList.get(i).setAddValue(nowList.get(i).getAddValue()+list.get(t).getAddValue());
|
|
|
- nowList.get(i).setUseValue(nowList.get(i).getUseValue()+list.get(t).getUseValue());
|
|
|
- t++;
|
|
|
- }
|
|
|
- order.setPointCountData(JSONObject.toJSONString(nowList));
|
|
|
- }else if(CollectionUtils.isNotEmpty(subsidyCustomerFace.getPointCountData())){
|
|
|
- order.setPointCountData(JSONObject.toJSONString(subsidyCustomerFace.getPointCountData()));
|
|
|
- }
|
|
|
+ order.setPointCountData(JSONObject.toJSONString(subsidyCustomerFace.getPointCountData()));
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(order.getPointMonthData()) && CollectionUtils.isNotEmpty(subsidyCustomerFace.getPointMonthData())){
|
|
|
- List<MonthData> list =JSONArray.parseArray(order.getPointMonthData(),MonthData.class);
|
|
|
- List<MonthData> nowList =subsidyCustomerFace.getPointMonthData();
|
|
|
- int t = 0;
|
|
|
- if(list.get(0).getText().equals(nowList.get(nowList.size()-1).getText())){
|
|
|
- t = 1;
|
|
|
- }
|
|
|
- for (int i = 0; i < nowList.size(); i++) {
|
|
|
- if(t ==nowList.size()){
|
|
|
- break;
|
|
|
- }
|
|
|
- nowList.get(i).setAddValue(nowList.get(i).getAddValue()+list.get(t).getAddValue());
|
|
|
- nowList.get(i).setUseValue(nowList.get(i).getUseValue()+list.get(t).getUseValue());
|
|
|
- t++;
|
|
|
- }
|
|
|
- order.setPointMonthData(JSONObject.toJSONString(nowList));
|
|
|
- }else if(CollectionUtils.isNotEmpty(subsidyCustomerFace.getPointMonthData())){
|
|
|
- order.setPointMonthData(JSONObject.toJSONString(subsidyCustomerFace.getPointMonthData()));
|
|
|
- }
|
|
|
+ order.setPointMonthData(JSONObject.toJSONString(subsidyCustomerFace.getPointMonthData()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1661,20 +1482,13 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<OrderStatisticsData> getOrderStatisticsDataList(List<Integer> ids,DateParams dateParams,List<ListParams> categoryList){
|
|
|
+ private List<OrderStatisticsData> getOrderStatisticsDataList(List<Integer> ids,List<ListParams> categoryList){
|
|
|
List<OrderStatisticsData> returnList = Lists.newArrayList();
|
|
|
List<OrderIntegrationData> list = Lists.newArrayList();
|
|
|
|
|
|
for (Integer id : ids) {
|
|
|
- QueryWrapper queryWrapper = new QueryWrapper<>();
|
|
|
- if(dateParams.getStartDate() != null){
|
|
|
- queryWrapper.ge("o.finish_time",dateParams.getStartDate());
|
|
|
- }
|
|
|
- if(dateParams.getEndDate() != null){
|
|
|
- queryWrapper.lt("o.finish_time",dateParams.getEndDate());
|
|
|
- }
|
|
|
//获取已完成的服务工单
|
|
|
- list.addAll(baseMapper.queryOrderIntegrationData(id,dbName,queryWrapper));
|
|
|
+ list.addAll(baseMapper.queryOrderIntegrationData(id,dbName));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1782,12 +1596,9 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
returnList.add(data);
|
|
|
}
|
|
|
|
|
|
- private void changeOrder(Map<Integer, List<Order>> maps,DateParams dateParams,List<Integer> operatorIds,List<ListParams> categoryList) {
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(dateParams.getEndDate());
|
|
|
- DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ private void changeOrder(Map<Integer, List<Order>> maps,List<Integer> operatorIds,List<ListParams> categoryList) {
|
|
|
//更新工单相关数据
|
|
|
- List<OrderStatisticsData> orderList = this.getOrderStatisticsDataList(operatorIds,dateParams,categoryList);
|
|
|
+ List<OrderStatisticsData> orderList = this.getOrderStatisticsDataList(operatorIds,categoryList);
|
|
|
for (OrderStatisticsData orderStatisticsData : orderList) {
|
|
|
List<Order> orders = maps.get(orderStatisticsData.getAreaId());
|
|
|
if(orders == null || orders.isEmpty()){
|
|
|
@@ -1808,8 +1619,8 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
|
BigDecimal satisfaction = order.getSatisfactionRate().multiply(new BigDecimal(order.getOrderNum())).divide(new BigDecimal("100.0"),2,BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal qualified = order.getQualifiedRate().multiply(new BigDecimal(order.getOrderNum())).divide(new BigDecimal("100.0"),2,BigDecimal.ROUND_HALF_UP);
|
|
|
- order.setOrderNum(order.getOrderNum()+orderStatisticsData.getOrderNum());
|
|
|
- order.setVisitNum(order.getVisitNum()+orderStatisticsData.getVisitNum());
|
|
|
+ order.setOrderNum(orderStatisticsData.getOrderNum());
|
|
|
+ order.setVisitNum(orderStatisticsData.getVisitNum());
|
|
|
order.setVisitRate(orderStatisticsData.getVisitRate());
|
|
|
if(order.getOrderNum().equals(0)){
|
|
|
order.setSatisfactionRate(new BigDecimal("0.00"));
|
|
|
@@ -1831,56 +1642,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(calendar.get(Calendar.DAY_OF_MONTH) == 1 && calendar.get(Calendar.HOUR_OF_DAY) == 0){
|
|
|
- //每月1日0点清零
|
|
|
- order.setOrderNumMonth(0);
|
|
|
- }else{
|
|
|
- order.setOrderNumMonth((order.getOrderNumMonth() == null ?0:order.getOrderNumMonth())+orderStatisticsData.getOrderNumMonth());
|
|
|
- }
|
|
|
- if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY && calendar.get(Calendar.HOUR_OF_DAY) == 0) {
|
|
|
- //每周一0点清零
|
|
|
- order.setOrderNumWeek(0);
|
|
|
- }else{
|
|
|
- order.setOrderNumWeek((order.getOrderNumWeek()==null?0:order.getOrderNumWeek())+orderStatisticsData.getOrderNumWeek());
|
|
|
- }
|
|
|
- if(calendar.get(Calendar.HOUR_OF_DAY) == 0){
|
|
|
- //每天0点清零
|
|
|
- order.setOrderNumDay(0);
|
|
|
- }else{
|
|
|
- order.setOrderNumDay((order.getOrderNumDay()==null?0:order.getOrderNumDay())+orderStatisticsData.getOrderNumDay());
|
|
|
- }
|
|
|
-
|
|
|
- if(StringUtils.isEmpty(order.getServiceTypeList())){
|
|
|
- order.setServiceTypeList(orderStatisticsData.getServiceTypeList());
|
|
|
- }else if(StringUtils.isNotEmpty(orderStatisticsData.getServiceTypeList())){
|
|
|
- List<OrderServiceTypeDTO> list =JSONArray.parseArray(order.getServiceTypeList(),OrderServiceTypeDTO.class);
|
|
|
- List<OrderServiceTypeDTO> dataList = JSONArray.parseArray(orderStatisticsData.getServiceTypeList(),OrderServiceTypeDTO.class);
|
|
|
- for (OrderServiceTypeDTO orderServiceTypeDTO : dataList) {
|
|
|
- boolean have = false;
|
|
|
- for (OrderServiceTypeDTO dto : list) {
|
|
|
- if(dto.getId().equals(orderServiceTypeDTO.getId())){
|
|
|
- dto.setCount(dto.getCount()+orderServiceTypeDTO.getCount());
|
|
|
- have = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(!have){
|
|
|
- list.add(orderServiceTypeDTO);
|
|
|
- }
|
|
|
- }
|
|
|
- Long sum = list.stream().mapToLong(o->o.getCount()).sum();
|
|
|
- for (OrderServiceTypeDTO dto : list) {
|
|
|
- dto.setRate(df.format((dto.getCount().doubleValue()/sum)*100.0));
|
|
|
- }
|
|
|
- }
|
|
|
+ order.setOrderNumMonth(orderStatisticsData.getOrderNumMonth());
|
|
|
+ order.setOrderNumWeek(orderStatisticsData.getOrderNumWeek());
|
|
|
+ order.setOrderNumDay(orderStatisticsData.getOrderNumDay());
|
|
|
+ order.setServiceTypeList(orderStatisticsData.getServiceTypeList());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- String val = ",5,";
|
|
|
- for (String s : val.split(",")) {
|
|
|
- System.out.println(s);
|
|
|
- }
|
|
|
- }
|
|
|
}
|