|
@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -11,8 +12,10 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.system.domain.DoumuEvaluate;
|
|
|
import com.ruoyi.system.domain.DoumuProductFj;
|
|
|
import com.ruoyi.system.domain.vo.DoumuProductInfoVo;
|
|
|
+import com.ruoyi.system.mapper.DoumuEvaluateMapper;
|
|
|
import com.ruoyi.system.mapper.DoumuProductFjMapper;
|
|
|
import com.ruoyi.system.mapper.SysDictDataMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -39,6 +42,9 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
@Autowired
|
|
|
private SysDictDataMapper dictDataMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DoumuEvaluateMapper doumuEvaluateMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询痘姆古陶信息
|
|
|
*
|
|
@@ -54,6 +60,9 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
doumuProductFj.setProductId(productId);
|
|
|
List<DoumuProductFj> fjList = doumuProductFjMapper.selectDoumuProductFjList(doumuProductFj);
|
|
|
doumuProductInfo.setFjList(fjList);
|
|
|
+ //查询评价信息
|
|
|
+ DoumuEvaluate doumuEvaluate = doumuEvaluateMapper.selectDoumuEvaluateByProductId(productId);
|
|
|
+ doumuProductInfo.setDoumuEvaluate(doumuEvaluate);
|
|
|
return doumuProductInfo;
|
|
|
}
|
|
|
|
|
@@ -71,6 +80,7 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
//查询附件
|
|
|
DoumuProductFj doumuProductFj = new DoumuProductFj();
|
|
|
doumuProductFj.setProductId(productInfo.getProductId());
|
|
|
+ doumuProductFj.setModule("1");
|
|
|
List<DoumuProductFj> fjList = doumuProductFjMapper.selectDoumuProductFjList(doumuProductFj);
|
|
|
productInfo.setFjList(fjList);
|
|
|
}
|
|
@@ -95,6 +105,7 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
if(fjList!=null && fjList.size()>0){
|
|
|
for (DoumuProductFj doumuProductFj : fjList) {
|
|
|
doumuProductFj.setProductId(doumuProductInfo.getProductId());
|
|
|
+ doumuProductFj.setModule("1");
|
|
|
doumuProductFjMapper.insertDoumuProductFj(doumuProductFj);
|
|
|
}
|
|
|
}
|
|
@@ -118,8 +129,9 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
for (DoumuProductFj doumuProductFj : fjList) {
|
|
|
//先删除附件
|
|
|
doumuProductFjMapper.deleteDoumuProductFjByFiId(doumuProductFj.getFiId());
|
|
|
- //在保存附件
|
|
|
+ //再保存附件
|
|
|
doumuProductFj.setProductId(doumuProductInfo.getProductId());
|
|
|
+ doumuProductFj.setModule("1");
|
|
|
doumuProductFjMapper.insertDoumuProductFj(doumuProductFj);
|
|
|
}
|
|
|
}
|
|
@@ -217,7 +229,11 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
List<DoumuProductInfo> doumuProductInfoList = doumuProductInfoMapper.selectDoumuProductInfoList(doumuProductInfo);
|
|
|
if(doumuProductInfoList==null || doumuProductInfoList.size()<=0){
|
|
|
for (SysDictData sysDictData : sysDictDataList) {
|
|
|
- map.put(sysDictData.getDictValue(),"0%");
|
|
|
+ Map<String,Object> mapL = new HashMap<>();
|
|
|
+ mapL.put("zs",0);
|
|
|
+ mapL.put("lc",0);
|
|
|
+ mapL.put("bfb","0%");
|
|
|
+ map.put(sysDictData.getDictValue(),mapL);
|
|
|
}
|
|
|
return AjaxResult.success(map);
|
|
|
}
|
|
@@ -225,20 +241,111 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
int count = doumuProductInfoList.size();
|
|
|
BigDecimal num1 = new BigDecimal(count);
|
|
|
for (SysDictData sysDictData : sysDictDataList) {
|
|
|
+
|
|
|
+ Map<String,Object> mapL = new HashMap<>();
|
|
|
int num = 0;
|
|
|
for (DoumuProductInfo productInfo : doumuProductInfoList) {
|
|
|
if(sysDictData.getDictValue().equals(productInfo.getFlowType())){
|
|
|
num++;
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal num2 = new BigDecimal(num);
|
|
|
- double result = Double.parseDouble(((num1.divide(num2,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
- // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
- // 使用DecimalFormat对象进行格式化操作
|
|
|
- String percentage = decimalFormat.format((result));
|
|
|
- map.put(sysDictData.getDictValue(),percentage);
|
|
|
+ mapL.put("zs",0);
|
|
|
+ mapL.put("lc",0);
|
|
|
+ mapL.put("bfb","0%");
|
|
|
+ if(num != 0){
|
|
|
+ BigDecimal num2 = new BigDecimal(num);
|
|
|
+ double result = Double.parseDouble(((num1.divide(num2,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
+ // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
+ // 使用DecimalFormat对象进行格式化操作
|
|
|
+ String percentage = decimalFormat.format((result));
|
|
|
+
|
|
|
+ mapL.put("zs",num1.longValue());
|
|
|
+ mapL.put("lc",num);
|
|
|
+ mapL.put("bfb",percentage);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put(sysDictData.getDictValue(),mapL);
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult numAmount() {
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ //当前年第一天
|
|
|
+ String startTime = DateUtils.getTime("5");
|
|
|
+ //当天
|
|
|
+ String endTime = DateUtils.getTime("1");
|
|
|
+ //查询当前时间内数据
|
|
|
+ DoumuProductInfo doumuProductInfo = new DoumuProductInfo();
|
|
|
+ doumuProductInfo.setBeginTime(startTime);
|
|
|
+ doumuProductInfo.setEndTime(endTime);
|
|
|
+ List<DoumuProductInfo> doumuProductInfoList = doumuProductInfoMapper.selectDoumuProductInfoList(doumuProductInfo);
|
|
|
+ List<String> listX = new ArrayList<>();
|
|
|
+ //发货数
|
|
|
+ List<String> listy1 = new ArrayList<>();
|
|
|
+ //取货数
|
|
|
+ List<String> listy2 = new ArrayList<>();
|
|
|
+ //金额
|
|
|
+ List<String> listy3 = new ArrayList<>();
|
|
|
+ //获取当前年份
|
|
|
+ String year = DateUtils.dateTimeNow("yyyy");
|
|
|
+ if(doumuProductInfoList==null || doumuProductInfoList.size()<=0){
|
|
|
+ for (int i = 1; i < 13; i++) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append(i).append("月");
|
|
|
+ listX.add(sb.toString());
|
|
|
+ listy1.add("0");
|
|
|
+ listy2.add("0");
|
|
|
+ listy3.add("0");
|
|
|
+ }
|
|
|
+ map.put("x",listX);
|
|
|
+ map.put("y1",listy1);
|
|
|
+ map.put("y2",listy2);
|
|
|
+ map.put("y3",listy3);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+ for (int i = 1; i < 13; i++) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append(i).append("月");
|
|
|
+ listX.add(sb.toString());
|
|
|
+ //当前月份
|
|
|
+ String month = DateUtils.dateTimeNow("yyyy-MM");
|
|
|
+ //发货数
|
|
|
+ int y1 = 0;
|
|
|
+ //取货数
|
|
|
+ int y2 = 0;
|
|
|
+ //金额
|
|
|
+ Double y3 = 0D;
|
|
|
+ for (DoumuProductInfo productInfo : doumuProductInfoList) {
|
|
|
+ if(productInfo.getCreateTime().toString().contains(month)){
|
|
|
+ //金额
|
|
|
+ BigDecimal num1 = new BigDecimal(y3);
|
|
|
+ BigDecimal num2 = new BigDecimal(productInfo.getTotalPrice());
|
|
|
+ BigDecimal subNum1 = num1.add(num2);
|
|
|
+ y3 = subNum1.doubleValue();
|
|
|
+ //邮寄
|
|
|
+ if("1".equals(productInfo.getDeliveryType())){
|
|
|
+ y1 = y1 + Integer.parseInt(productInfo.getQuantity());
|
|
|
+
|
|
|
+ }else {
|
|
|
+ //自取
|
|
|
+ y2 = y2 + Integer.parseInt(productInfo.getQuantity());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listy1.add(String.valueOf(y1));
|
|
|
+ listy2.add(String.valueOf(y2));
|
|
|
+ listy3.add(String.valueOf(y3));
|
|
|
+
|
|
|
}
|
|
|
+ map.put("x",listX);
|
|
|
+ map.put("y1",listy1);
|
|
|
+ map.put("y2",listy2);
|
|
|
+ map.put("y3",listy3);
|
|
|
return AjaxResult.success(map);
|
|
|
}
|
|
|
}
|