diff --git a/src/main/java/com/cm/tenlion/pollutantdata/pojo/dtos/enterprisepoll/EnterprisePollDTO.java b/src/main/java/com/cm/tenlion/pollutantdata/pojo/dtos/enterprisepoll/EnterprisePollDTO.java index 8608f58..a6e18b0 100644 --- a/src/main/java/com/cm/tenlion/pollutantdata/pojo/dtos/enterprisepoll/EnterprisePollDTO.java +++ b/src/main/java/com/cm/tenlion/pollutantdata/pojo/dtos/enterprisepoll/EnterprisePollDTO.java @@ -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; + } } diff --git a/src/main/java/com/cm/tenlion/pollutantdata/pojo/vos/enterprisepoll/EnterprisePollVO.java b/src/main/java/com/cm/tenlion/pollutantdata/pojo/vos/enterprisepoll/EnterprisePollVO.java index e0af866..3d4d911 100644 --- a/src/main/java/com/cm/tenlion/pollutantdata/pojo/vos/enterprisepoll/EnterprisePollVO.java +++ b/src/main/java/com/cm/tenlion/pollutantdata/pojo/vos/enterprisepoll/EnterprisePollVO.java @@ -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; + } } diff --git a/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/IEnterprisePollService.java b/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/IEnterprisePollService.java index fdf050a..4eeaa98 100644 --- a/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/IEnterprisePollService.java +++ b/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/IEnterprisePollService.java @@ -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 listByEnterpriseId(String enterpriseId); /** * 新增企业监控污染因子 diff --git a/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/impl/EnterprisePollServiceImpl.java b/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/impl/EnterprisePollServiceImpl.java index 4f1d75f..4d8a7f0 100644 --- a/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/impl/EnterprisePollServiceImpl.java +++ b/src/main/java/com/cm/tenlion/pollutantdata/service/enterprisepoll/impl/EnterprisePollServiceImpl.java @@ -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 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 listByEnterpriseId(String enterpriseId){ + if(StringUtils.isBlank(enterpriseId)){ + return new ArrayList<>(); + } + Map 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 params = new HashMap<>(); + params.put("enterpriseId",enterpriseId); + params.put("pollNo",pollNo); + return this.get(params); + } + + + } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/enterprisepoll/enterprise-poll-mapper.xml b/src/main/resources/mybatis/mapper/enterprisepoll/enterprise-poll-mapper.xml index 7ea923f..1a1d79c 100644 --- a/src/main/resources/mybatis/mapper/enterprisepoll/enterprise-poll-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterprisepoll/enterprise-poll-mapper.xml @@ -9,6 +9,8 @@ + + @@ -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} + + AND ( + t1.poll_no = #{pollNo} + OR + t1.poll_no_old = #{pollNo} + OR + t1.poll_id = #{pollNo} + ) + @@ -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