From bb6df2735fef7606f8a197be11778146b29b21f7 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Mon, 19 Oct 2020 17:49:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BC=81=E4=B8=9A=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E5=AE=8C=E6=88=90=E6=B1=A1=E6=9F=93=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 +- .../apis/enterprise/EnterpriseController.java | 26 +- .../pojo/dtos/enterprise/EnterpriseDTO.java | 24 + .../pojo/vos/enterprise/EnterpriseVO.java | 24 + .../enterprise/IEnterpriseService.java | 22 + .../impl/EnterpriseServiceImpl.java | 17 +- .../mapper/enterprise/enterprise-mapper.xml | 92 +-- .../assets/layuiadmin/modules/restajax.js | 3 + .../route/enterprise/list-enterprise.html | 41 +- .../route/enterprise/save-enterprise.html | 44 +- .../update-enterprise-pollution.html | 536 ++++++++++++++++++ .../route/enterprise/update-enterprise.html | 56 +- 12 files changed, 826 insertions(+), 69 deletions(-) create mode 100644 src/main/resources/static/route/enterprise/update-enterprise-pollution.html diff --git a/pom.xml b/pom.xml index ad680d1..4e9086c 100644 --- a/pom.xml +++ b/pom.xml @@ -108,11 +108,11 @@ ${activiti.version} - - com.cm - cloud-central-control-client - 1.0.1-SNAPSHOT - + + + + + diff --git a/src/main/java/com/cm/inspection/controller/apis/enterprise/EnterpriseController.java b/src/main/java/com/cm/inspection/controller/apis/enterprise/EnterpriseController.java index 49e19b9..951d4b2 100644 --- a/src/main/java/com/cm/inspection/controller/apis/enterprise/EnterpriseController.java +++ b/src/main/java/com/cm/inspection/controller/apis/enterprise/EnterpriseController.java @@ -12,6 +12,8 @@ import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultList; import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO; +import com.cm.inspection.pojo.dtos.enterprise.EnterprisePollutionDTO; +import com.cm.inspection.pojo.vos.enterprise.EnterprisePollutionVO; import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO; import com.cm.inspection.service.enterprise.IEnterpriseService; import io.swagger.annotations.*; @@ -121,7 +123,7 @@ public class EnterpriseController extends AbstractController { @ApiOperation(value = "企业列表(通过用户ID)", notes = "企业列表(通过用户ID)接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "token", paramType = "userId"), + @ApiImplicitParam(name = "userId", value = "userId", paramType = "path"), }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listenterprisebyuserid/{userId}") @@ -129,4 +131,26 @@ public class EnterpriseController extends AbstractController { return enterpriseService.listEnterpriseByUserId(userId); } + @ApiOperation(value = "修改企业污染(通过企业ID)", notes = "修改企业污染(通过企业ID)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业ID", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PutMapping("updateenterprisepollution/{enterpriseId}") + @CheckRequestBodyAnnotation + public SuccessResult updateEnterprisePollution(@PathVariable("enterpriseId") String enterpriseId, @RequestBody EnterprisePollutionVO enterprisePollutionVO) throws Exception { + return enterpriseService.updateEnterprisePollution(enterpriseId, enterprisePollutionVO); + } + + @ApiOperation(value = "企业污染详情(通过企业ID)", notes = "企业污染详情(通过企业ID)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "enterpriseId", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getenterprisepollutionbyenterpriseid/{enterpriseId}") + public EnterprisePollutionDTO getEnterprisePollutionByEnterpriseId(@PathVariable("enterpriseId") String enterpriseId) { + EnterprisePollutionDTO enterprisePollutionDTO = enterpriseService.getEnterprisePollutionByEnterpriseId(enterpriseId); + return enterprisePollutionDTO == null ? new EnterprisePollutionDTO() : enterprisePollutionDTO; + } + } \ No newline at end of file diff --git a/src/main/java/com/cm/inspection/pojo/dtos/enterprise/EnterpriseDTO.java b/src/main/java/com/cm/inspection/pojo/dtos/enterprise/EnterpriseDTO.java index e823251..39b5ed6 100644 --- a/src/main/java/com/cm/inspection/pojo/dtos/enterprise/EnterpriseDTO.java +++ b/src/main/java/com/cm/inspection/pojo/dtos/enterprise/EnterpriseDTO.java @@ -78,6 +78,10 @@ public class EnterpriseDTO implements Serializable { private String bussinessRegNum; @ApiModelProperty(name = "bussinessLicense", value = "营业执照") private String bussinessLicense; + @ApiModelProperty(name = "bussinessLicenseStartDate", value = "营业执照开始日期") + private String bussinessLicenseStartDate; + @ApiModelProperty(name = "bussinessLicenseEndDate", value = "营业执照结束日期") + private String bussinessLicenseEndDate; @ApiModelProperty(name = "legalPerson", value = "法人") private String legalPerson; @ApiModelProperty(name = "legalPhone", value = "法人电话") @@ -359,6 +363,22 @@ public class EnterpriseDTO implements Serializable { this.bussinessLicense = bussinessLicense; } + public String getBussinessLicenseStartDate() { + return bussinessLicenseStartDate == null ? "" : bussinessLicenseStartDate.trim(); + } + + public void setBussinessLicenseStartDate(String bussinessLicenseStartDate) { + this.bussinessLicenseStartDate = bussinessLicenseStartDate; + } + + public String getBussinessLicenseEndDate() { + return bussinessLicenseEndDate == null ? "" : bussinessLicenseEndDate.trim(); + } + + public void setBussinessLicenseEndDate(String bussinessLicenseEndDate) { + this.bussinessLicenseEndDate = bussinessLicenseEndDate; + } + public String getLegalPerson() { return legalPerson == null ? "" : legalPerson.trim(); } @@ -552,6 +572,10 @@ public class EnterpriseDTO implements Serializable { .append(bussinessRegNum).append('\"'); sb.append(",\"bussinessLicense\":\"") .append(bussinessLicense).append('\"'); + sb.append(",\"bussinessLicenseStartDate\":\"") + .append(bussinessLicenseStartDate).append('\"'); + sb.append(",\"bussinessLicenseEndDate\":\"") + .append(bussinessLicenseEndDate).append('\"'); sb.append(",\"legalPerson\":\"") .append(legalPerson).append('\"'); sb.append(",\"legalPhone\":\"") diff --git a/src/main/java/com/cm/inspection/pojo/vos/enterprise/EnterpriseVO.java b/src/main/java/com/cm/inspection/pojo/vos/enterprise/EnterpriseVO.java index 364f743..0598e9a 100644 --- a/src/main/java/com/cm/inspection/pojo/vos/enterprise/EnterpriseVO.java +++ b/src/main/java/com/cm/inspection/pojo/vos/enterprise/EnterpriseVO.java @@ -61,6 +61,10 @@ public class EnterpriseVO { private String bussinessRegNum; @ApiModelProperty(name = "bussinessLicense", value = "营业执照") private String bussinessLicense; + @ApiModelProperty(name = "bussinessLicenseStartDate", value = "营业执照开始日期") + private String bussinessLicenseStartDate; + @ApiModelProperty(name = "bussinessLicenseEndDate", value = "营业执照结束日期") + private String bussinessLicenseEndDate; @ApiModelProperty(name = "legalPerson", value = "法人") private String legalPerson; @ApiModelProperty(name = "legalPhone", value = "法人电话") @@ -260,6 +264,22 @@ public class EnterpriseVO { this.bussinessLicense = bussinessLicense; } + public String getBussinessLicenseStartDate() { + return bussinessLicenseStartDate == null ? "" : bussinessLicenseStartDate.trim(); + } + + public void setBussinessLicenseStartDate(String bussinessLicenseStartDate) { + this.bussinessLicenseStartDate = bussinessLicenseStartDate; + } + + public String getBussinessLicenseEndDate() { + return bussinessLicenseEndDate == null ? "" : bussinessLicenseEndDate.trim(); + } + + public void setBussinessLicenseEndDate(String bussinessLicenseEndDate) { + this.bussinessLicenseEndDate = bussinessLicenseEndDate; + } + public String getLegalPerson() { return legalPerson == null ? "" : legalPerson.trim(); } @@ -425,6 +445,10 @@ public class EnterpriseVO { .append(bussinessRegNum).append('\"'); sb.append(",\"bussinessLicense\":\"") .append(bussinessLicense).append('\"'); + sb.append(",\"bussinessLicenseStartDate\":\"") + .append(bussinessLicenseStartDate).append('\"'); + sb.append(",\"bussinessLicenseEndDate\":\"") + .append(bussinessLicenseEndDate).append('\"'); sb.append(",\"legalPerson\":\"") .append(legalPerson).append('\"'); sb.append(",\"legalPhone\":\"") diff --git a/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java b/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java index b8569d6..c8e6288 100644 --- a/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java +++ b/src/main/java/com/cm/inspection/service/enterprise/IEnterpriseService.java @@ -9,8 +9,10 @@ import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO; +import com.cm.inspection.pojo.dtos.enterprise.EnterprisePollutionDTO; import com.cm.inspection.pojo.vos.enterprise.EnterpriseClassifyVO; import com.cm.inspection.pojo.vos.enterprise.EnterpriseNatureVO; +import com.cm.inspection.pojo.vos.enterprise.EnterprisePollutionVO; import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO; import java.util.List; @@ -136,6 +138,16 @@ public interface IEnterpriseService { */ void updateEnterpriseLocationByTokenAndEnterpriseId(String token, String enterpriseId, String checkLng, String checkLat); + /** + * 修改企业污染(通过企业ID) + * + * @param enterpriseId + * @param enterprisePollutionVO + * @return + * @throws Exception + */ + SuccessResult updateEnterprisePollution(String enterpriseId, EnterprisePollutionVO enterprisePollutionVO) throws Exception; + /** * 企业详情(通过ID) * @@ -217,4 +229,14 @@ public interface IEnterpriseService { */ List listEnterpriseByUserId(String userId) throws SearchException; + /** + * 企业污染详情(通过企业ID) + * + * @param enterpriseId + * @return + * @throws SearchException + */ + EnterprisePollutionDTO getEnterprisePollutionByEnterpriseId(String enterpriseId) throws SearchException; + + } diff --git a/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java b/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java index 0414a53..4420100 100644 --- a/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/enterprise/impl/EnterpriseServiceImpl.java @@ -223,6 +223,20 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer enterpriseDao.updateEnterpriseLocation(params); } + @Override + public SuccessResult updateEnterprisePollution(String enterpriseId, EnterprisePollutionVO enterprisePollutionVO) throws Exception { + EnterprisePollutionDTO enterprisePollutionDTO = getEnterprisePollutionByEnterpriseId(enterpriseId); + // 企业因子已经存在 + if (enterprisePollutionDTO != null) { + // 更新企业污染因子 + updateEnterprisePollution(null, enterpriseId, enterprisePollutionVO); + } else { + // 保存企业污染因子 + saveEnterprisePollution(null, enterpriseId, enterprisePollutionVO); + } + return new SuccessResult(); + } + /** * 修改企业 * @@ -362,7 +376,8 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer * @param enterpriseId * @return */ - private EnterprisePollutionDTO getEnterprisePollutionByEnterpriseId(String enterpriseId) { + @Override + public EnterprisePollutionDTO getEnterprisePollutionByEnterpriseId(String enterpriseId) { Map params = getHashMap(2); params.put("enterpriseId", enterpriseId); return enterpriseDao.getEnterprisePollution(params); diff --git a/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml b/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml index 5c85df0..ac11eb6 100644 --- a/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterprise/enterprise-mapper.xml @@ -36,6 +36,8 @@ + + @@ -89,6 +91,8 @@ industry_type, bussiness_reg_num, bussiness_license, + bussiness_license_start_date, + bussiness_license_end_date, legal_person, legal_phone, legal_id_card_front, @@ -140,6 +144,8 @@ #{industryType}, #{bussinessRegNum}, #{bussinessLicense}, + #{bussinessLicenseStartDate}, + #{bussinessLicenseEndDate}, #{legalPerson}, #{legalPhone}, #{legalIdCardFront}, @@ -194,28 +200,28 @@ name = #{name}, - + type = #{type}, - + area1 = #{area1}, - + area2 = #{area2}, - + area3 = #{area3}, - + area4 = #{area4}, - + area5 = #{area5}, - + address = #{address}, - + industry = #{industry}, @@ -227,85 +233,91 @@ master = #{master}, - + master_id_card_front = #{masterIdCardFront}, - + master_id_card_back = #{masterIdCardBack}, - + master_legal_certificate = #{masterLegalCertificate}, - + phone = #{phone}, - + factory_gate = #{factoryGate}, - + workplace = #{workplace}, - + industry_type = #{industryType}, - + bussiness_reg_num = #{bussinessRegNum}, - + bussiness_license = #{bussinessLicense}, - + + bussiness_license_start_date = #{bussinessLicenseStartDate}, + + + bussiness_license_end_date = #{bussinessLicenseEndDate}, + + legal_person = #{legalPerson}, - + legal_phone = #{legalPhone}, - + legal_id_card_front = #{legalIdCardFront}, - + legal_id_card_back = #{legalIdCardBack}, summary = #{summary}, - + type_dictionary_name = #{typeDictionaryName}, - + area1_dictionary_name = #{area1DictionaryName}, - + area2_dictionary_name = #{area2DictionaryName}, - + area3_dictionary_name = #{area3DictionaryName}, - + area4_dictionary_name = #{area4DictionaryName}, - + area5_dictionary_name = #{area5DictionaryName}, - + industry_type_dictionary_name = #{industryTypeDictionaryName}, - + industry_dictionary_name = #{industryDictionaryName}, - + risk_operation_dictionary_name = #{riskOperationDictionaryName}, classify = #{classify}, - + classify_dictionary_name = #{classifyDictionaryName}, nature = #{nature}, - + nature_dictionary_name = #{natureDictionaryName}, @@ -314,11 +326,11 @@ is_commercial_downstairs = #{isCommercialDownstairs}, - + enterprise_lng = #{enterpriseLng}, - - enterprise_lat = #{enterpriseLat} + + enterprise_lat = #{enterpriseLat}, modifier = #{modifier}, gmt_modified = #{gmtModified} @@ -464,6 +476,8 @@ t1.industry_type_dictionary_name, t1.bussiness_reg_num, t1.bussiness_license, + t1.bussiness_license_start_date, + t1.bussiness_license_end_date, t1.legal_person, t1.legal_phone, t1.legal_id_card_front, @@ -476,6 +490,8 @@ t1.is_log_off, t1.is_commercial_downstairs, t1.remarks, + t1.enterprise_lng, + t1.enterprise_lat, t1.enterprise_id FROM gen_enterprise t1 @@ -512,6 +528,8 @@ t1.industry_type, t1.bussiness_reg_num, t1.bussiness_license, + t1.bussiness_license_start_date, + t1.bussiness_license_end_date, t1.legal_person, t1.legal_phone, t1.legal_id_card_front, @@ -524,6 +542,8 @@ t1.is_log_off, t1.is_commercial_downstairs, t1.remarks, + t1.enterprise_lng, + t1.enterprise_lat, t1.enterprise_id FROM gen_enterprise t1 @@ -566,6 +586,8 @@ t1.industry_type_dictionary_name, t1.bussiness_reg_num, t1.bussiness_license, + t1.bussiness_license_start_date, + t1.bussiness_license_end_date, t1.legal_person, t1.legal_phone, t1.legal_id_card_front, diff --git a/src/main/resources/static/assets/layuiadmin/modules/restajax.js b/src/main/resources/static/assets/layuiadmin/modules/restajax.js index 416635a..b446d3d 100644 --- a/src/main/resources/static/assets/layuiadmin/modules/restajax.js +++ b/src/main/resources/static/assets/layuiadmin/modules/restajax.js @@ -263,6 +263,9 @@ layui.define(function(exports) { if(value !== '') { value += ','; } + if(key.indexOf('[') < 0 || key.indexOf(']') < 0) { + continue; + } value += key.substring(checkBoxKey.length + 1, key.length - 1); delete formObj[key]; } diff --git a/src/main/resources/static/route/enterprise/list-enterprise.html b/src/main/resources/static/route/enterprise/list-enterprise.html index 2e21270..a7b06dc 100644 --- a/src/main/resources/static/route/enterprise/list-enterprise.html +++ b/src/main/resources/static/route/enterprise/list-enterprise.html @@ -20,17 +20,15 @@
-
+ + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+ +
+
+
+ +
+ + +
+ +
+
+
+ +
+
+ + + + +
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/enterprise/update-enterprise.html b/src/main/resources/static/route/enterprise/update-enterprise.html index 4b8b2d4..04b5865 100644 --- a/src/main/resources/static/route/enterprise/update-enterprise.html +++ b/src/main/resources/static/route/enterprise/update-enterprise.html @@ -218,13 +218,11 @@
-
-
- -
- - -
+
+ +
+ +
@@ -290,10 +288,30 @@
组织机构信息
-
- -
- +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
@@ -566,6 +584,22 @@ parent.layer.close(parent.layer.getFrameIndex(window.name)); } + // 初始化日期 + function initDate() { + // 日期选择 + laydate.render({ + elem: '#bussinessLicenseStartDate', + format: 'yyyy-MM-dd', + trigger: 'click' + }); + laydate.render({ + elem: '#bussinessLicenseEndDate', + format: 'yyyy-MM-dd', + trigger: 'click' + }); + } + initDate(); + function refreshDownloadTemplet(fileName, file) { var dataRander = {}; dataRander[fileName] = file;