529473f1 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 f88cdbf7 c57a406b
......@@ -2,7 +2,6 @@ package com.skua.tool.util;
import com.skua.constant.BaseConstant;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
......
......@@ -99,8 +99,15 @@ public class EnvironmentTargetController {
public Result<EnvironmentTarget> add(@RequestBody EnvironmentTarget environmentTarget) {
Result<EnvironmentTarget> result = new Result<EnvironmentTarget>();
try {
environmentTargetService.save(environmentTarget);
result.success("添加成功!");
boolean flag = environmentTargetService.checkData(environmentTarget.getDepartId(),environmentTarget.getTargetYear());
if(flag){
environmentTargetService.save(environmentTarget);
result.success("添加成功!");
}else{
result.error500("该水厂已经提交过["+environmentTarget.getTargetYear()+"]年份数据,不能在提交!");
}
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
......
......@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@Accessors(chain = true)
@ApiModel(value="safety_environment_target对象", description="安环环保目标")
public class EnvironmentTarget {
/**主键id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键id")
......@@ -57,8 +57,16 @@ public class EnvironmentTarget {
private String newCaseNum;
/**考核分数*/
@Excel(name = "考核分数", width = 15)
@ApiModelProperty(value = "考核分数")
@ApiModelProperty(value = "考核分数:作废")
private String examScore;
@Excel(name = "约束指标评分", width = 15)
@ApiModelProperty(value = "约束指标评分")
private String constraintScore;
@Excel(name = "责任指标评分", width = 15)
@ApiModelProperty(value = "责任指标评分")
private String liabilityScore ;
/**创建人Id*/
@Excel(name = "创建人Id", width = 15)
@ApiModelProperty(value = "创建人Id")
......
......@@ -8,4 +8,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IEnvironmentTargetService extends IService<EnvironmentTarget> {
boolean checkData(String departId, String targetYear);
}
......
package com.skua.modules.safe.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.modules.safe.entity.EnvironmentTarget;
import com.skua.modules.safe.mapper.EnvironmentTargetMapper;
import com.skua.modules.safe.service.IEnvironmentTargetService;
......@@ -7,10 +8,29 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
* 安环环保目标
*/
@Service
public class EnvironmentTargetServiceImpl extends ServiceImpl<EnvironmentTargetMapper, EnvironmentTarget> implements IEnvironmentTargetService {
/***
* 校验一个水厂一年只能提交一次数据
* @param departId
* @param targetYear
* @return
*/
public boolean checkData(String departId, String targetYear){
QueryWrapper<EnvironmentTarget> queryWrapper = new QueryWrapper();
queryWrapper.eq("depart_id" ,departId ) ;
queryWrapper.eq("target_year" ,targetYear ) ;
List<EnvironmentTarget> environmentTargetList = this.baseMapper.selectList(queryWrapper);
if (environmentTargetList != null && !environmentTargetList.isEmpty()) {
return false;
}
return true;
}
}
......
......@@ -79,6 +79,7 @@ public class DrugConsumptionDisplayVO {
this.drugName = drugName;
}
public DrugConsumptionDisplayVO(Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh) {
this.CSL = CSL;
this.tbqnCsl = tbqnCsl;
......@@ -90,14 +91,16 @@ public class DrugConsumptionDisplayVO {
if(this.zyh != null ){
//计算吨水药耗
//药耗量[kg] / 处理水量[吨]
if(this.CSL != null && Double.compare(this.CSL, 0.0) != 0) this.dsyh = this.getValue(this.zyh /this.CSL );
if(this.CSL != null && Double.compare(this.CSL, 0.0) != 0) {
this.dsyh = this.getValue(this.zyh /this.CSL );
}
//同比总药耗
if(this.tbqnzyh != null){
this.tbqnzyhsl = this.getValue(this.zyh - this.tbqnzyh);
this.tbqnzyhbl = this.getValue(((this.zyh - this.tbqnzyh)/this.tbqnzyh)*100) ;
//计算吨水药耗 //同比吨水药耗
if(this.tbqnCsl != null && Double.compare(this.tbqnCsl, 0.0) != 0) this.tbqndsyh = this.getValue(this.tbqnzyh /this.tbqnCsl );
if(this.tbqndsyh != null ){
if(this.tbqndsyh != null && this.dsyh != null ){
this.tbqndsyhsl = this.getValue(dsyh-tbqndsyh);
this.tbqndsyhbl = this.getValue((dsyh-tbqndsyh)/tbqndsyh*100);
}
......@@ -108,7 +111,7 @@ public class DrugConsumptionDisplayVO {
this.hbsyzyhbl = this.getValue(((this.zyh - this.hbsyzyh)/this.hbsyzyh)*100) ;
//环比-吨水药耗
if(this.hbsyCsl != null && Double.compare(this.hbsyCsl, 0.0) != 0) this.hbsydsyh = this.getValue(this.hbsyzyh /this.hbsyCsl );
if(this.hbsydsyh != null){
if(this.hbsydsyh != null && this.dsyh != null){
this.hbsydsyhsl = this.getValue(this.dsyh - this.hbsydsyh);
this.hbsydsyhbl = this.getValue((this.dsyh - this.hbsydsyh) / this.hbsydsyh*100);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!