|
@@ -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,6 +125,8 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @SneakyThrows
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public int updateDoumuProductInfo(DoumuProductInfo doumuProductInfo)
|
|
|
{
|
|
|
doumuProductInfo.setUpdateTime(DateUtils.getNowDate());
|
|
@@ -136,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);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除痘姆古陶信息
|
|
|
*
|
|
@@ -568,11 +586,11 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
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%");
|
|
|
+ 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();
|
|
@@ -601,56 +619,12 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
|
|
|
hc++;
|
|
|
}
|
|
|
}
|
|
|
- map.put("fch","0%");
|
|
|
- map.put("h","0%");
|
|
|
- map.put("yb","0%");
|
|
|
- map.put("c","0%");
|
|
|
- map.put("hc","0%");
|
|
|
- if(fch != 0){
|
|
|
- BigDecimal numFch = new BigDecimal(fch);
|
|
|
- double result = Double.parseDouble(((numZs.divide(numFch,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
- // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
- // 使用DecimalFormat对象进行格式化操作
|
|
|
- String fchBfb = decimalFormat.format((result));
|
|
|
- map.put("fch",fchBfb);
|
|
|
- }
|
|
|
- if(h != 0){
|
|
|
- BigDecimal numH = new BigDecimal(h);
|
|
|
- double result = Double.parseDouble(((numZs.divide(numH,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
- // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
- // 使用DecimalFormat对象进行格式化操作
|
|
|
- String HBfb = decimalFormat.format((result));
|
|
|
- map.put("h",HBfb);
|
|
|
- }
|
|
|
- if(yb != 0){
|
|
|
- BigDecimal numYb = new BigDecimal(yb);
|
|
|
- double result = Double.parseDouble(((numZs.divide(numYb,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
- // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
- // 使用DecimalFormat对象进行格式化操作
|
|
|
- String ybBfb = decimalFormat.format((result));
|
|
|
- map.put("yb",ybBfb);
|
|
|
- }
|
|
|
- if(c != 0){
|
|
|
- BigDecimal numC = new BigDecimal(c);
|
|
|
- double result = Double.parseDouble(((numZs.divide(numC,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
- // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
- // 使用DecimalFormat对象进行格式化操作
|
|
|
- String cBfb = decimalFormat.format((result));
|
|
|
- map.put("c",cBfb);
|
|
|
- }
|
|
|
- if(hc != 0){
|
|
|
- BigDecimal numHc = new BigDecimal(hc);
|
|
|
- double result = Double.parseDouble(((numZs.divide(numHc,2,BigDecimal.ROUND_HALF_UP))).toString());
|
|
|
- // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0%");
|
|
|
- // 使用DecimalFormat对象进行格式化操作
|
|
|
- String hcBfb = decimalFormat.format((result));
|
|
|
- map.put("hc",hcBfb);
|
|
|
- }
|
|
|
+ map.put("fch",fch);
|
|
|
+ map.put("h",h);
|
|
|
+ map.put("yb",yb);
|
|
|
+ map.put("c",c);
|
|
|
+ map.put("hc",hc);
|
|
|
+
|
|
|
}
|
|
|
return AjaxResult.success(map);
|
|
|
}
|