2.新增企业监控污染因子接口

This commit is contained in:
ly19960718 2021-08-15 17:39:59 +08:00
parent ca46b5065e
commit 9d02508f72
5 changed files with 106 additions and 0 deletions

View File

@ -26,6 +26,10 @@ public class EnterprisePollDTO {
private String pollName;
@ApiModelProperty(name = "enterprisePollBeyond", value = "报警值")
private Double enterprisePollBeyond;
@ApiModelProperty(name = "pollNo", value = "编码")
private String pollNo;
@ApiModelProperty(name = "pollNoOld", value = "旧编码")
private String pollNoOld;
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
private String gmtCreate;
@ -85,4 +89,20 @@ public class EnterprisePollDTO {
public void setPollName(String pollName) {
this.pollName = pollName;
}
public String getPollNo() {
return pollNo;
}
public void setPollNo(String pollNo) {
this.pollNo = pollNo;
}
public String getPollNoOld() {
return pollNoOld;
}
public void setPollNoOld(String pollNoOld) {
this.pollNoOld = pollNoOld;
}
}

View File

@ -21,6 +21,11 @@ public class EnterprisePollVO {
private String pollId;
@ApiModelProperty(name = "enterprisePollBeyond", value = "报警值")
private Double enterprisePollBeyond;
@ApiModelProperty(name = "pollNo", value = "编码")
private String pollNo;
@ApiModelProperty(name = "pollNoOld", value = "旧编码")
private String pollNoOld;
public String getEnterpriseId() {
return enterpriseId == null ? "" : enterpriseId.trim();
@ -45,4 +50,20 @@ public class EnterprisePollVO {
public void setEnterprisePollBeyond(Double enterprisePollBeyond) {
this.enterprisePollBeyond = enterprisePollBeyond;
}
public String getPollNo() {
return pollNo;
}
public void setPollNo(String pollNo) {
this.pollNo = pollNo;
}
public String getPollNoOld() {
return pollNoOld;
}
public void setPollNoOld(String pollNoOld) {
this.pollNoOld = pollNoOld;
}
}

View File

@ -19,6 +19,20 @@ import java.util.Map;
* @Version: 3.0
**/
public interface IEnterprisePollService {
/**
* 根据企业ID和污染因子编码获取监控污染因子
* @param enterpriseId
* @param pollNo
* @return
*/
public EnterprisePollDTO getByEnterpriseIdAndpollNo(String enterpriseId,String pollNo);
/**
* 根据企业ID获取监控污染因子
* @param enterpriseId
* @return
*/
List<EnterprisePollDTO> listByEnterpriseId(String enterpriseId);
/**
* 新增企业监控污染因子

View File

@ -9,10 +9,12 @@ import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.tenlion.pollutantdata.dao.enterprisepoll.IEnterprisePollDao;
import com.cm.tenlion.pollutantdata.pojo.dtos.enterprisepoll.EnterprisePollDTO;
import com.cm.tenlion.pollutantdata.pojo.dtos.poll.PollDTO;
import com.cm.tenlion.pollutantdata.pojo.vos.enterprisepoll.EnterprisePollVO;
import com.cm.tenlion.pollutantdata.pojo.bos.enterprisepoll.EnterprisePollBO;
import com.cm.tenlion.pollutantdata.pojo.pos.enterprisepoll.EnterprisePollPO;
import com.cm.tenlion.pollutantdata.service.enterprisepoll.IEnterprisePollService;
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
@ -33,6 +35,9 @@ public class EnterprisePollServiceImpl extends AbstractService implements IEnter
@Autowired
private IEnterprisePollDao enterprisePollDao;
@Autowired
private IPollService pollService;
@Override
public void save(EnterprisePollVO enterprisePollVO) throws Exception {
@ -59,6 +64,10 @@ public class EnterprisePollServiceImpl extends AbstractService implements IEnter
throw new SaveException("请勿重复添加");
}
PollDTO pollDTO = pollService.get(enterprisePollVO.getPollId());
enterprisePollVO.setPollNo(pollDTO.getPollNo());
enterprisePollVO.setPollNoOld(pollDTO.getPollNoOld());
String enterprisePollId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(enterprisePollVO);
params.put("enterprisePollId", enterprisePollId);
@ -179,4 +188,27 @@ public class EnterprisePollServiceImpl extends AbstractService implements IEnter
return count == null ? 0 : count;
}
public List<EnterprisePollDTO> listByEnterpriseId(String enterpriseId){
if(StringUtils.isBlank(enterpriseId)){
return new ArrayList<>();
}
Map<String,Object> params = new HashMap<>();
params.put("enterpriseId",enterpriseId);
return this.list(params);
}
public EnterprisePollDTO getByEnterpriseIdAndpollNo(String enterpriseId,String pollNo){
if(StringUtils.isBlank(enterpriseId) || StringUtils.isBlank(pollNo)){
return null;
}
Map<String,Object> params = new HashMap<>();
params.put("enterpriseId",enterpriseId);
params.put("pollNo",pollNo);
return this.get(params);
}
}

View File

@ -9,6 +9,8 @@
<result column="poll_id" property="pollId"/>
<result column="poll_name" property="pollName"/>
<result column="enterprise_poll_beyond" property="enterprisePollBeyond"/>
<result column="poll_no" property="pollNo"/>
<result column="poll_no_old" property="pollNoOld"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
@ -43,6 +45,8 @@
enterprise_id,
poll_id,
enterprise_poll_beyond,
poll_no,
poll_no_old,
gmt_create,
creator,
gmt_modified,
@ -53,6 +57,8 @@
#{enterpriseId},
#{pollId},
#{enterprisePollBeyond},
#{pollNo},
#{pollNoOld},
#{gmtCreate},
#{creator},
#{gmtModified},
@ -116,6 +122,8 @@
t1.enterprise_poll_beyond,
t1.enterprise_poll_id,
t2.poll_name,
t1.poll_no,
t1.poll_no_old,
t3.enterprise_name
FROM
pollute_enterprise_poll t1
@ -137,6 +145,15 @@
AND
t1.poll_id = #{pollId}
</if>
<if test="pollNo != null and pollNo != ''">
AND (
t1.poll_no = #{pollNo}
OR
t1.poll_no_old = #{pollNo}
OR
t1.poll_id = #{pollNo}
)
</if>
</select>
<!-- 企业监控污染因子详情 -->
@ -190,6 +207,8 @@
t1.enterprise_id,
t1.poll_id,
t1.enterprise_poll_beyond,
t1.poll_no,
t1.poll_no_old,
LEFT(t1.gmt_create, 19) AS gmt_create,
t2.poll_name,
t3.enterprise_name