|
@@ -643,18 +643,34 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
total = total.add(bak);
|
|
total = total.add(bak);
|
|
}
|
|
}
|
|
|
|
|
|
- ProduceReport report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
|
|
- report.setDate(date);
|
|
|
|
- report.setDataId(produceData.getId());
|
|
|
|
|
|
+ // 找到
|
|
|
|
+ Weekend<ProduceReport> weekend2 = new Weekend<>(ProduceReport.class);
|
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria2 = weekend2.weekendCriteria();
|
|
|
|
+ weekendCriteria2.andEqualTo(ProduceReport::getDataId, produceData.getId())
|
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue()).andEqualTo(ProduceReport::getDate, date);
|
|
|
|
+ ProduceReport report = mapper.selectOneByExample(weekendCriteria2);
|
|
|
|
+ if (report != null) {
|
|
|
|
+ ProduceReportDTO dto = BeanConverterUtil.copyObjectProperties(report, ProduceReportDTO.class);
|
|
|
|
+ // 数据除以1000,换算成吨
|
|
|
|
+ total = total.divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
+ dto.setValue(total.toString());
|
|
|
|
+ dto.setUpdateTime(LocalDateTime.now());
|
|
|
|
+ this.modModelByDTO(dto);
|
|
|
|
+ } else {
|
|
|
|
+ report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
|
|
+ report.setDate(date);
|
|
|
|
+ report.setDataId(produceData.getId());
|
|
|
|
|
|
- // 数据除以1000,换算成吨
|
|
|
|
- total = total.divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
- report.setValue(total.toString());
|
|
|
|
- report.setYear(date.getYear());
|
|
|
|
- report.setMonth(date.getMonthValue());
|
|
|
|
- report.setDay(date.getDayOfMonth());
|
|
|
|
- report.setCreatedTime(LocalDateTime.now());
|
|
|
|
- this.saveModel(report);
|
|
|
|
|
|
+ // 数据除以1000,换算成吨
|
|
|
|
+ total = total.divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
+ report.setValue(total.toString());
|
|
|
|
+ report.setYear(date.getYear());
|
|
|
|
+ report.setMonth(date.getMonthValue());
|
|
|
|
+ report.setDay(date.getDayOfMonth());
|
|
|
|
+ report.setCreatedTime(LocalDateTime.now());
|
|
|
|
+ this.saveModel(report);
|
|
|
|
+ }
|
|
return total;
|
|
return total;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1795,7 +1811,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public Function getSinFunction(){
|
|
|
|
|
|
+ public Function getSinFunction() {
|
|
Function sinFunction = new CommonFunction() {
|
|
Function sinFunction = new CommonFunction() {
|
|
@Override
|
|
@Override
|
|
public String getName() {
|
|
public String getName() {
|
|
@@ -1825,7 +1841,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public Function getAcosFunction(){
|
|
|
|
|
|
+ public Function getAcosFunction() {
|
|
// 注册自定义 ACOS 函数
|
|
// 注册自定义 ACOS 函数
|
|
Function acosFunction = new CommonFunction() {
|
|
Function acosFunction = new CommonFunction() {
|
|
@Override
|
|
@Override
|