|
@@ -15,15 +15,16 @@ 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.DoumuProductHistory;
|
|
|
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 com.ruoyi.system.mapper.*;
|
|
|
+import lombok.SneakyThrows;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.ruoyi.system.mapper.DoumuProductInfoMapper;
|
|
|
import com.ruoyi.system.domain.DoumuProductInfo;
|
|
|
import com.ruoyi.system.service.IDoumuProductInfoService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import utils.ClassUtils;
|
|
|
|
|
|
/**
|
|
|
* 痘姆古陶信息Service业务层处理
|
|
@@ -46,6 +47,9 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
@Autowired
|
|
|
private DoumuEvaluateMapper doumuEvaluateMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DoumuProductHistoryMapper doumuProductHistoryMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询痘姆古陶信息
|
|
|
*
|
|
@@ -95,6 +99,7 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public int insertDoumuProductInfo(DoumuProductInfo doumuProductInfo)
|
|
|
{
|
|
|
doumuProductInfo.setOrderNumber("DMGT"+System.currentTimeMillis());
|
|
@@ -120,16 +125,17 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @SneakyThrows
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public int updateDoumuProductInfo(DoumuProductInfo doumuProductInfo)
|
|
|
{
|
|
|
doumuProductInfo.setUpdateTime(DateUtils.getNowDate());
|
|
|
-
|
|
|
+ //先删除附件
|
|
|
+ doumuProductFjMapper.deleteDoumuProductFjByProductId(doumuProductInfo.getProductId(),"1");
|
|
|
//保存附件
|
|
|
List<DoumuProductFj> fjList = doumuProductInfo.getFjList();
|
|
|
if(fjList!=null && fjList.size()>0){
|
|
|
for (DoumuProductFj doumuProductFj : fjList) {
|
|
|
- //先删除附件
|
|
|
- doumuProductFjMapper.deleteDoumuProductFjByFiId(doumuProductFj.getFiId());
|
|
|
//再保存附件
|
|
|
doumuProductFj.setProductId(doumuProductInfo.getProductId());
|
|
|
doumuProductFj.setModule("1");
|
|
@@ -137,9 +143,20 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //将修改前的数据存入历史记录
|
|
|
+ DoumuProductInfo productInfo = doumuProductInfoMapper.selectDoumuProductInfoByProductId(doumuProductInfo.getProductId());
|
|
|
+ DoumuProductHistory doumuProductHistory = new DoumuProductHistory();
|
|
|
+ ClassUtils.copyProperties(productInfo, doumuProductHistory);
|
|
|
+ doumuProductHistoryMapper.insertDoumuProductHistory(doumuProductHistory);
|
|
|
+
|
|
|
+
|
|
|
return doumuProductInfoMapper.updateDoumuProductInfo(doumuProductInfo);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除痘姆古陶信息
|
|
|
*
|
|
@@ -312,8 +329,12 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.append(i).append("月");
|
|
|
listX.add(sb.toString());
|
|
|
- //当前月份
|
|
|
- String month = DateUtils.dateTimeNow("yyyy-MM");
|
|
|
+
|
|
|
+ //月份
|
|
|
+ String month = year+"-0"+i;
|
|
|
+ if(i>10){
|
|
|
+ month = year+"-"+i;
|
|
|
+ }
|
|
|
//发货数
|
|
|
int y1 = 0;
|
|
|
//取货数
|
|
@@ -432,4 +453,179 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
map.put("hc",hc);
|
|
|
return AjaxResult.success(map);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult sales() {
|
|
|
+ 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> listy = 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());
|
|
|
+ listy.add("0");
|
|
|
+ }
|
|
|
+ map.put("month",listX);
|
|
|
+ map.put("sales",listy);
|
|
|
+ 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 = year+"-0"+i;
|
|
|
+ if(i>10){
|
|
|
+ month = year+"-"+i;
|
|
|
+ }
|
|
|
+ //金额
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listy.add(String.valueOf(y3));
|
|
|
+
|
|
|
+ }
|
|
|
+ map.put("month",listX);
|
|
|
+ map.put("sales",listy);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult numberWorks() {
|
|
|
+ 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> listy = 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());
|
|
|
+ listy.add("0");
|
|
|
+
|
|
|
+ }
|
|
|
+ map.put("totality",0);
|
|
|
+ map.put("month",listX);
|
|
|
+ map.put("num",listy);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+ int totality = 0;
|
|
|
+ for (int i = 1; i < 13; i++) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append(i).append("月");
|
|
|
+ listX.add(sb.toString());
|
|
|
+
|
|
|
+ //月份
|
|
|
+ String month = year+"-0"+i;
|
|
|
+ if(i>10){
|
|
|
+ month = year+"-"+i;
|
|
|
+ }
|
|
|
+ //发货数
|
|
|
+ int y = 0;
|
|
|
+
|
|
|
+ for (DoumuProductInfo productInfo : doumuProductInfoList) {
|
|
|
+ if(productInfo.getCreateTime().toString().contains(month)){
|
|
|
+ y = y + Integer.parseInt(productInfo.getQuantity());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ totality = totality + y;
|
|
|
+ listy.add(String.valueOf(y));
|
|
|
+ }
|
|
|
+ map.put("totality",totality);
|
|
|
+ map.put("month",listX);
|
|
|
+ map.put("num",listy);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * app首页好评率统计
|
|
|
+ * dateType 1:当天,2:本周,3:本月,4:当前季度,5:年度
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult reputation(String dateType) {
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ String startTime = DateUtils.getTime(dateType);
|
|
|
+ String endTime = DateUtils.getTime("1");
|
|
|
+ DoumuEvaluate doumuEvaluate = new DoumuEvaluate();
|
|
|
+ doumuEvaluate.setBeginTime(startTime);
|
|
|
+ doumuEvaluate.setEndTime(endTime);
|
|
|
+ List<DoumuEvaluate> doumuEvaluateList = doumuEvaluateMapper.selectDoumuEvaluateList(doumuEvaluate);
|
|
|
+ if(doumuEvaluateList==null || doumuEvaluateList.size()<=0){
|
|
|
+ map.put("fch",0);
|
|
|
+ map.put("h",0);
|
|
|
+ map.put("yb",0);
|
|
|
+ map.put("c",0);
|
|
|
+ map.put("hc",0);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+ int zs = doumuEvaluateList.size();
|
|
|
+ BigDecimal numZs = new BigDecimal(zs);
|
|
|
+ //非常好
|
|
|
+ int fch = 0;
|
|
|
+ //好
|
|
|
+ int h = 0;
|
|
|
+ //一般
|
|
|
+ int yb = 0;
|
|
|
+ //差
|
|
|
+ int c = 0;
|
|
|
+ //很差
|
|
|
+ int hc = 0;
|
|
|
+ if(doumuEvaluateList!=null && doumuEvaluateList.size()>0){
|
|
|
+ for (DoumuEvaluate evaluate : doumuEvaluateList) {
|
|
|
+ if("5".equals(evaluate.getProductEvaluate())){
|
|
|
+ fch++;
|
|
|
+ }else if("4".equals(evaluate.getProductEvaluate())){
|
|
|
+ h++;
|
|
|
+ }else if("3".equals(evaluate.getProductEvaluate())){
|
|
|
+ yb++;
|
|
|
+ }else if("2".equals(evaluate.getProductEvaluate())){
|
|
|
+ c++;
|
|
|
+ }else if("1".equals(evaluate.getProductEvaluate())){
|
|
|
+ hc++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("fch",fch);
|
|
|
+ map.put("h",h);
|
|
|
+ map.put("yb",yb);
|
|
|
+ map.put("c",c);
|
|
|
+ map.put("hc",hc);
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
}
|