|
@@ -969,8 +969,10 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}else{
|
|
}else{
|
|
|
//按老人类型分组
|
|
//按老人类型分组
|
|
|
Map<String,List<CustomerSubsidyDTO>> typeMaps = csList.stream().filter(c->StringUtils.isNotEmpty(c.getCustomerTypeId())).collect(Collectors.groupingBy(CustomerSubsidyDTO::getCustomerTypeId));
|
|
Map<String,List<CustomerSubsidyDTO>> typeMaps = csList.stream().filter(c->StringUtils.isNotEmpty(c.getCustomerTypeId())).collect(Collectors.groupingBy(CustomerSubsidyDTO::getCustomerTypeId));
|
|
|
- Map<String,SubsidyCustomerJsonFace> faceMap = new HashMap<>();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Map<String,SubsidyCustomerJsonFace> faceMap = Maps.newHashMap();
|
|
|
for (String key : typeMaps.keySet()) {
|
|
for (String key : typeMaps.keySet()) {
|
|
|
|
|
+
|
|
|
List<CustomerSubsidyDTO> keyList = typeMaps.get(key);
|
|
List<CustomerSubsidyDTO> keyList = typeMaps.get(key);
|
|
|
List<Long> idList = keyList.stream().map(CustomerSubsidyDTO::getCustomerId).collect(Collectors.toList());
|
|
List<Long> idList = keyList.stream().map(CustomerSubsidyDTO::getCustomerId).collect(Collectors.toList());
|
|
|
String customerType = keyList.get(0).getCustomerType();
|
|
String customerType = keyList.get(0).getCustomerType();
|
|
@@ -978,12 +980,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
String[] typeIds = key.split(",");
|
|
String[] typeIds = key.split(",");
|
|
|
String[] names = customerType.split(",");
|
|
String[] names = customerType.split(",");
|
|
|
for (int i=0; i<typeIds.length; i++){
|
|
for (int i=0; i<typeIds.length; i++){
|
|
|
- if(StringUtils.isNotEmpty(typeIds[i])){
|
|
|
|
|
- mergeJsonFace(faceMap, typeIds[i], idList, names[i]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String keyType = typeIds[i];
|
|
|
|
|
+ mergeJsonFace(faceMap, keyType, idList.size(), names[i]);
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
- mergeJsonFace(faceMap, key, idList, customerType);
|
|
|
|
|
|
|
+ mergeJsonFace(faceMap, key, idList.size(), customerType);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
jsonFaceList.addAll(faceMap.values());
|
|
jsonFaceList.addAll(faceMap.values());
|
|
@@ -994,18 +995,18 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void mergeJsonFace(Map<String, SubsidyCustomerJsonFace> faceMap, String key, List<Long> idList, String customerType) {
|
|
|
|
|
|
|
+ private void mergeJsonFace(Map<String, SubsidyCustomerJsonFace> faceMap, String key, Integer idListSize, String customerType) {
|
|
|
SubsidyCustomerJsonFace jsonFace = faceMap.get(key);
|
|
SubsidyCustomerJsonFace jsonFace = faceMap.get(key);
|
|
|
if (jsonFace== null){
|
|
if (jsonFace== null){
|
|
|
jsonFace = new SubsidyCustomerJsonFace();
|
|
jsonFace = new SubsidyCustomerJsonFace();
|
|
|
jsonFace.setAreaId(Integer.parseInt(key));
|
|
jsonFace.setAreaId(Integer.parseInt(key));
|
|
|
jsonFace.setTitle(customerType);
|
|
jsonFace.setTitle(customerType);
|
|
|
- jsonFace.setTotal(idList.size());
|
|
|
|
|
- jsonFace.setCustomerIds(idList);
|
|
|
|
|
|
|
+ jsonFace.setTotal(idListSize);
|
|
|
|
|
+ //jsonFace.setCustomerIds(idList);
|
|
|
faceMap.put(key, jsonFace);
|
|
faceMap.put(key, jsonFace);
|
|
|
}else{
|
|
}else{
|
|
|
- jsonFace.getCustomerIds().addAll(idList);
|
|
|
|
|
- jsonFace.setTotal(jsonFace.getCustomerIds().size());
|
|
|
|
|
|
|
+ //jsonFace.getCustomerIds().addAll(idList);
|
|
|
|
|
+ jsonFace.setTotal(jsonFace.getTotal()+idListSize);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1051,7 +1052,6 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
order.setCustomerRate(BigDecimal.ZERO);
|
|
order.setCustomerRate(BigDecimal.ZERO);
|
|
|
}else{
|
|
}else{
|
|
|
BigDecimal decimal = new BigDecimal(order.getCustomerServiceNum()).multiply(new BigDecimal(100.0)).divide(new BigDecimal(order.getCustomerNum()),2,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal decimal = new BigDecimal(order.getCustomerServiceNum()).multiply(new BigDecimal(100.0)).divide(new BigDecimal(order.getCustomerNum()),2,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
- log.info("CustomerRate==="+decimal);
|
|
|
|
|
order.setCustomerRate(decimal);
|
|
order.setCustomerRate(decimal);
|
|
|
}
|
|
}
|
|
|
List<SubsidyCustomerJsonFace> jsonFace = subsidyCustomerFace.getJsonFace();
|
|
List<SubsidyCustomerJsonFace> jsonFace = subsidyCustomerFace.getJsonFace();
|
|
@@ -1075,11 +1075,6 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
id.add(face.getAreaId().toString());
|
|
id.add(face.getAreaId().toString());
|
|
|
title.add(face.getTitle());
|
|
title.add(face.getTitle());
|
|
|
total.add(face.getTotal());
|
|
total.add(face.getTotal());
|
|
|
- if(face.getAreaId().equals(212)){
|
|
|
|
|
- log.info("face.getAreaId()=="+face.getAreaId());
|
|
|
|
|
- log.info("num=="+num);
|
|
|
|
|
- log.info("sum=="+sum);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
if(num.equals(0)){
|
|
if(num.equals(0)){
|
|
|
rate.add(BigDecimal.ZERO);
|
|
rate.add(BigDecimal.ZERO);
|
|
@@ -1102,13 +1097,6 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
|
|
- BigDecimal a = new BigDecimal(1);
|
|
|
|
|
- BigDecimal b = new BigDecimal(918);
|
|
|
|
|
- BigDecimal decimal2 = a.multiply(new BigDecimal(100.0)).divide(b, 2, BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
- System.out.println(decimal2);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private List<SubsidyCustomerFace> integralCustomer(){
|
|
private List<SubsidyCustomerFace> integralCustomer(){
|
|
|
List<SubsidyCustomerFace> returnList = Lists.newArrayList();
|
|
List<SubsidyCustomerFace> returnList = Lists.newArrayList();
|
|
|
List<Integer> operationIds = baseMapper.getIntegralCardAccOperatorIdList(dbName);
|
|
List<Integer> operationIds = baseMapper.getIntegralCardAccOperatorIdList(dbName);
|