c57a406b 康伟

kangwei:药耗分析,月初数据为null处理

1 个父辈 fd25a072
...@@ -2,7 +2,6 @@ package com.skua.tool.util; ...@@ -2,7 +2,6 @@ package com.skua.tool.util;
2 2
3 import com.skua.constant.BaseConstant; 3 import com.skua.constant.BaseConstant;
4 import java.math.BigDecimal; 4 import java.math.BigDecimal;
5 import java.text.ParseException;
6 import java.text.ParsePosition; 5 import java.text.ParsePosition;
7 import java.text.SimpleDateFormat; 6 import java.text.SimpleDateFormat;
8 import java.time.DayOfWeek; 7 import java.time.DayOfWeek;
......
...@@ -99,8 +99,15 @@ public class EnvironmentTargetController { ...@@ -99,8 +99,15 @@ public class EnvironmentTargetController {
99 public Result<EnvironmentTarget> add(@RequestBody EnvironmentTarget environmentTarget) { 99 public Result<EnvironmentTarget> add(@RequestBody EnvironmentTarget environmentTarget) {
100 Result<EnvironmentTarget> result = new Result<EnvironmentTarget>(); 100 Result<EnvironmentTarget> result = new Result<EnvironmentTarget>();
101 try { 101 try {
102 environmentTargetService.save(environmentTarget); 102 boolean flag = environmentTargetService.checkData(environmentTarget.getDepartId(),environmentTarget.getTargetYear());
103 result.success("添加成功!"); 103 if(flag){
104 environmentTargetService.save(environmentTarget);
105 result.success("添加成功!");
106 }else{
107 result.error500("该水厂已经提交过["+environmentTarget.getTargetYear()+"]年份数据,不能在提交!");
108 }
109
110
104 } catch (Exception e) { 111 } catch (Exception e) {
105 log.error(e.getMessage(),e); 112 log.error(e.getMessage(),e);
106 result.error500("操作失败"); 113 result.error500("操作失败");
......
...@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; ...@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
25 @Accessors(chain = true) 25 @Accessors(chain = true)
26 @ApiModel(value="safety_environment_target对象", description="安环环保目标") 26 @ApiModel(value="safety_environment_target对象", description="安环环保目标")
27 public class EnvironmentTarget { 27 public class EnvironmentTarget {
28 28
29 /**主键id*/ 29 /**主键id*/
30 @TableId(type = IdType.ID_WORKER_STR) 30 @TableId(type = IdType.ID_WORKER_STR)
31 @ApiModelProperty(value = "主键id") 31 @ApiModelProperty(value = "主键id")
...@@ -57,8 +57,16 @@ public class EnvironmentTarget { ...@@ -57,8 +57,16 @@ public class EnvironmentTarget {
57 private String newCaseNum; 57 private String newCaseNum;
58 /**考核分数*/ 58 /**考核分数*/
59 @Excel(name = "考核分数", width = 15) 59 @Excel(name = "考核分数", width = 15)
60 @ApiModelProperty(value = "考核分数") 60 @ApiModelProperty(value = "考核分数:作废")
61 private String examScore; 61 private String examScore;
62
63 @Excel(name = "约束指标评分", width = 15)
64 @ApiModelProperty(value = "约束指标评分")
65 private String constraintScore;
66 @Excel(name = "责任指标评分", width = 15)
67 @ApiModelProperty(value = "责任指标评分")
68 private String liabilityScore ;
69
62 /**创建人Id*/ 70 /**创建人Id*/
63 @Excel(name = "创建人Id", width = 15) 71 @Excel(name = "创建人Id", width = 15)
64 @ApiModelProperty(value = "创建人Id") 72 @ApiModelProperty(value = "创建人Id")
......
...@@ -8,4 +8,5 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -8,4 +8,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
8 */ 8 */
9 public interface IEnvironmentTargetService extends IService<EnvironmentTarget> { 9 public interface IEnvironmentTargetService extends IService<EnvironmentTarget> {
10 10
11 boolean checkData(String departId, String targetYear);
11 } 12 }
......
1 package com.skua.modules.safe.service.impl; 1 package com.skua.modules.safe.service.impl;
2 2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 import com.skua.modules.safe.entity.EnvironmentTarget; 4 import com.skua.modules.safe.entity.EnvironmentTarget;
4 import com.skua.modules.safe.mapper.EnvironmentTargetMapper; 5 import com.skua.modules.safe.mapper.EnvironmentTargetMapper;
5 import com.skua.modules.safe.service.IEnvironmentTargetService; 6 import com.skua.modules.safe.service.IEnvironmentTargetService;
...@@ -7,10 +8,29 @@ import org.springframework.stereotype.Service; ...@@ -7,10 +8,29 @@ import org.springframework.stereotype.Service;
7 8
8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 10
11 import java.util.List;
12
10 /** 13 /**
11 * 安环环保目标 14 * 安环环保目标
12 */ 15 */
13 @Service 16 @Service
14 public class EnvironmentTargetServiceImpl extends ServiceImpl<EnvironmentTargetMapper, EnvironmentTarget> implements IEnvironmentTargetService { 17 public class EnvironmentTargetServiceImpl extends ServiceImpl<EnvironmentTargetMapper, EnvironmentTarget> implements IEnvironmentTargetService {
15 18
19 /***
20 * 校验一个水厂一年只能提交一次数据
21 * @param departId
22 * @param targetYear
23 * @return
24 */
25 public boolean checkData(String departId, String targetYear){
26 QueryWrapper<EnvironmentTarget> queryWrapper = new QueryWrapper();
27 queryWrapper.eq("depart_id" ,departId ) ;
28 queryWrapper.eq("target_year" ,targetYear ) ;
29 List<EnvironmentTarget> environmentTargetList = this.baseMapper.selectList(queryWrapper);
30 if (environmentTargetList != null && !environmentTargetList.isEmpty()) {
31 return false;
32 }
33 return true;
34 }
16 } 35 }
36
......
...@@ -79,6 +79,7 @@ public class DrugConsumptionDisplayVO { ...@@ -79,6 +79,7 @@ public class DrugConsumptionDisplayVO {
79 this.drugName = drugName; 79 this.drugName = drugName;
80 } 80 }
81 81
82
82 public DrugConsumptionDisplayVO(Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh) { 83 public DrugConsumptionDisplayVO(Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh) {
83 this.CSL = CSL; 84 this.CSL = CSL;
84 this.tbqnCsl = tbqnCsl; 85 this.tbqnCsl = tbqnCsl;
...@@ -90,14 +91,16 @@ public class DrugConsumptionDisplayVO { ...@@ -90,14 +91,16 @@ public class DrugConsumptionDisplayVO {
90 if(this.zyh != null ){ 91 if(this.zyh != null ){
91 //计算吨水药耗 92 //计算吨水药耗
92 //药耗量[kg] / 处理水量[吨] 93 //药耗量[kg] / 处理水量[吨]
93 if(this.CSL != null && Double.compare(this.CSL, 0.0) != 0) this.dsyh = this.getValue(this.zyh /this.CSL ); 94 if(this.CSL != null && Double.compare(this.CSL, 0.0) != 0) {
95 this.dsyh = this.getValue(this.zyh /this.CSL );
96 }
94 //同比总药耗 97 //同比总药耗
95 if(this.tbqnzyh != null){ 98 if(this.tbqnzyh != null){
96 this.tbqnzyhsl = this.getValue(this.zyh - this.tbqnzyh); 99 this.tbqnzyhsl = this.getValue(this.zyh - this.tbqnzyh);
97 this.tbqnzyhbl = this.getValue(((this.zyh - this.tbqnzyh)/this.tbqnzyh)*100) ; 100 this.tbqnzyhbl = this.getValue(((this.zyh - this.tbqnzyh)/this.tbqnzyh)*100) ;
98 //计算吨水药耗 //同比吨水药耗 101 //计算吨水药耗 //同比吨水药耗
99 if(this.tbqnCsl != null && Double.compare(this.tbqnCsl, 0.0) != 0) this.tbqndsyh = this.getValue(this.tbqnzyh /this.tbqnCsl ); 102 if(this.tbqnCsl != null && Double.compare(this.tbqnCsl, 0.0) != 0) this.tbqndsyh = this.getValue(this.tbqnzyh /this.tbqnCsl );
100 if(this.tbqndsyh != null ){ 103 if(this.tbqndsyh != null && this.dsyh != null ){
101 this.tbqndsyhsl = this.getValue(dsyh-tbqndsyh); 104 this.tbqndsyhsl = this.getValue(dsyh-tbqndsyh);
102 this.tbqndsyhbl = this.getValue((dsyh-tbqndsyh)/tbqndsyh*100); 105 this.tbqndsyhbl = this.getValue((dsyh-tbqndsyh)/tbqndsyh*100);
103 } 106 }
...@@ -108,7 +111,7 @@ public class DrugConsumptionDisplayVO { ...@@ -108,7 +111,7 @@ public class DrugConsumptionDisplayVO {
108 this.hbsyzyhbl = this.getValue(((this.zyh - this.hbsyzyh)/this.hbsyzyh)*100) ; 111 this.hbsyzyhbl = this.getValue(((this.zyh - this.hbsyzyh)/this.hbsyzyh)*100) ;
109 //环比-吨水药耗 112 //环比-吨水药耗
110 if(this.hbsyCsl != null && Double.compare(this.hbsyCsl, 0.0) != 0) this.hbsydsyh = this.getValue(this.hbsyzyh /this.hbsyCsl ); 113 if(this.hbsyCsl != null && Double.compare(this.hbsyCsl, 0.0) != 0) this.hbsydsyh = this.getValue(this.hbsyzyh /this.hbsyCsl );
111 if(this.hbsydsyh != null){ 114 if(this.hbsydsyh != null && this.dsyh != null){
112 this.hbsydsyhsl = this.getValue(this.dsyh - this.hbsydsyh); 115 this.hbsydsyhsl = this.getValue(this.dsyh - this.hbsydsyh);
113 this.hbsydsyhbl = this.getValue((this.dsyh - this.hbsydsyh) / this.hbsydsyh*100); 116 this.hbsydsyhbl = this.getValue((this.dsyh - this.hbsydsyh) / this.hbsydsyh*100);
114 } 117 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!