From 72278b8bf53feaff0115588c2f7dc50e1803d8fb Mon Sep 17 00:00:00 2001 From: kylin L <452061493@qq.com> Date: Mon, 22 Apr 2024 09:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A7=E6=B3=95=E7=99=BB=E8=AE=B0=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E8=8D=89=E7=A8=BF=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnforcementRegistrationController.java | 22 ++++++ .../EnterpriseLawEnforcementController.java | 12 +--- .../IEnforcementRegistrationService.java | 3 + .../EnforcementRegistrationServiceImpl.java | 68 +++++++++++++++---- .../EnterpriseLawEnforcementServiceImpl.java | 53 ++++++++------- 5 files changed, 113 insertions(+), 45 deletions(-) diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnforcementRegistrationController.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnforcementRegistrationController.java index ffcc1694..def7fc13 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnforcementRegistrationController.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnforcementRegistrationController.java @@ -5,6 +5,9 @@ import java.util.List; import java.util.Map; import com.zdxt.code.domain.EnforceRegCount; +import com.zdxt.code.domain.EnterpriseLawEnforcement; +import com.zdxt.code.domain.LinkageDict; +import com.zdxt.code.service.ILinkageDictService; import com.zdxt.common.ZDResponse; import com.zdxt.common.controller.BaseController; import com.zdxt.common.util.TableDataInfo; @@ -31,6 +34,7 @@ public class EnforcementRegistrationController extends BaseController @Autowired private IEnforcementRegistrationService enforcementRegistrationService; + @Autowired private ILinkageDictService iLinkageDictService; @RequiresPermissions("code:registration:view") @GetMapping() @@ -104,6 +108,7 @@ public class EnforcementRegistrationController extends BaseController @ResponseBody public ZDResponse editSave(@RequestBody EnforcementRegistration enforcementRegistration) { + enforcementRegistration.setIsSubmit(1); return enforcementRegistrationService.updateEnforcementRegistration(enforcementRegistration) > 0 ? ZDResponse.success("修改成功") : ZDResponse.error("修改失败"); } @@ -194,4 +199,21 @@ public class EnforcementRegistrationController extends BaseController map.put("filePreview", enforcementRegistrationService.queryFiles(key)); return ZDResponse.success("获取成功", map); } + + /** + * 查看预约记录详情 + */ + @GetMapping( "/getByUserIdAndZero") + @ResponseBody + public ZDResponse getByUserIdAndZero() + { + EnforcementRegistration registration = enforcementRegistrationService.getByUserIdAndZero(); + Map params = new HashMap<>(); + LinkageDict tmp = iLinkageDictService.selectLinkageDictById(registration.getLawEnforcementItem()); + params.put("lawEnforcementItemText", tmp.getTitle()); + tmp = iLinkageDictService.selectLinkageDictById(registration.getLawEnforcementBasis()); + params.put("lawEnforcementBasisText", tmp.getTitle()); + registration.setParams(params); + return ZDResponse.success("查询成功", registration); + } } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterpriseLawEnforcementController.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterpriseLawEnforcementController.java index e5b47435..1020a42c 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterpriseLawEnforcementController.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterpriseLawEnforcementController.java @@ -85,16 +85,7 @@ public class EnterpriseLawEnforcementController extends BaseController @ResponseBody public ZDResponse addSave(@RequestBody EnterpriseLawEnforcement enterpriseLawEnforcement) { - // 先通过用户ID 加 状态0 判断是否已经有暂存的数据了 . 有的话就更新, 没有再新增 - EnterpriseLawEnforcement keyObj = enterpriseLawEnforcementService.getByUserIdAndZero(); - int resNum = 0; - if (null!=keyObj && StringUtils.isNotEmpty(keyObj.getId())) { - resNum = enterpriseLawEnforcementService.updateEnterpriseLawEnforcement(enterpriseLawEnforcement); - } else { - resNum = enterpriseLawEnforcementService.insertEnterpriseLawEnforcement(enterpriseLawEnforcement); - } - - return resNum > 0 ? ZDResponse.success("预约成功") : ZDResponse.error("预约失败"); + return enterpriseLawEnforcementService.insertEnterpriseLawEnforcement(enterpriseLawEnforcement) > 0 ? ZDResponse.success("预约成功") : ZDResponse.error("预约失败"); } /** @@ -127,6 +118,7 @@ public class EnterpriseLawEnforcementController extends BaseController @ResponseBody public ZDResponse editSave(@RequestBody EnterpriseLawEnforcement enterpriseLawEnforcement) { + enterpriseLawEnforcement.setIsSubmit(1); return enterpriseLawEnforcementService.updateEnterpriseLawEnforcement(enterpriseLawEnforcement) > 0 ? ZDResponse.success("修改成功") : ZDResponse.error("修改失败"); } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnforcementRegistrationService.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnforcementRegistrationService.java index e8268e88..b4f7b510 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnforcementRegistrationService.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnforcementRegistrationService.java @@ -2,6 +2,7 @@ package com.zdxt.code.service; import com.zdxt.code.domain.EnforceRegCount; import com.zdxt.code.domain.EnforcementRegistration; +import com.zdxt.code.domain.EnterpriseLawEnforcement; import com.zdxt.common.zdxtFile.AttFileRespDTO; import java.util.List; @@ -75,4 +76,6 @@ public interface IEnforcementRegistrationService */ AttFileRespDTO queryFiles(String key); + public EnforcementRegistration getByUserIdAndZero(); + } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java index ad31bd5e..5688ceea 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java @@ -15,6 +15,7 @@ import com.zdxt.code.domain.*; import com.zdxt.code.mapper.LinkageDictMapper; import com.zdxt.code.service.ILawEnforcementWarningListService; import com.zdxt.code.service.IRuleItemListService; +import com.zdxt.common.config.RuoYiConfig; import com.zdxt.common.util.DateUtils; import com.zdxt.common.util.StringUtils; import com.zdxt.common.zdxtFile.AttFileRespDTO; @@ -116,28 +117,35 @@ public class EnforcementRegistrationServiceImpl implements IEnforcementRegistrat public int insertEnforcementRegistration(EnforcementRegistration enforcementRegistration) { UserBean user = userApi.getCurrentUser(); - enforcementRegistration.setId(IdUtil.simpleUUID()); - enforcementRegistration.setCreateBy(user.getUserName()); - enforcementRegistration.setCreateTime(DateUtils.getNowDate()); - enforcementRegistration.setUserId(user.getUserId()); - enforcementRegistration.setDeptId(user.getDeptId()); - //默认为登记状态 - enforcementRegistration.setStatus(0); - int i = enforcementRegistrationMapper.insertEnforcementRegistration(enforcementRegistration); - if(i > 0 && enforcementRegistration.getFileList().size() > 0){ - enforcementRegistration.getFileList().forEach(res ->{ + int resNum = 0; + if (StringUtils.isNotEmpty(enforcementRegistration.getId())) { + enforcementRegistration.setIsSubmit(0); + resNum = this.updateEnforcementRegistration(enforcementRegistration); + } else { + enforcementRegistration.setId(IdUtil.simpleUUID()); + enforcementRegistration.setCreateBy(user.getUserName()); + enforcementRegistration.setCreateTime(DateUtils.getNowDate()); + enforcementRegistration.setUserId(user.getUserId()); + enforcementRegistration.setDeptId(user.getDeptId()); + //默认为登记状态 + enforcementRegistration.setStatus(0); + resNum = enforcementRegistrationMapper.insertEnforcementRegistration(enforcementRegistration); + } + if (resNum > 0 && enforcementRegistration.getFileList().size() > 0) { + zdxtFileCommonApi.deleteZdxtFileByIds(enforcementRegistration.getId()); + enforcementRegistration.getFileList().forEach(res -> { ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon(); zdxtFileCommon.setBusinessId(enforcementRegistration.getId()); zdxtFileCommon.setGuid(IdUtil.simpleUUID()); //文件后缀 -// zdxtFileCommon.setFileSuffix("JPG"); + // zdxtFileCommon.setFileSuffix("JPG"); zdxtFileCommon.setUploadPath(res); zdxtFileCommon.setUploadPersonId(user.getUserId().toString()); zdxtFileCommon.setUploadPersonName(user.getUserName()); zdxtFileCommonApi.addZdxtFileCommon(zdxtFileCommon); }); } - return i; + return resNum; } /** @@ -149,8 +157,23 @@ public class EnforcementRegistrationServiceImpl implements IEnforcementRegistrat @Override public int updateEnforcementRegistration(EnforcementRegistration enforcementRegistration) { + UserBean user = userApi.getCurrentUser(); enforcementRegistration.setUpdateTime(DateUtils.getNowDate()); int i = enforcementRegistrationMapper.updateEnforcementRegistration(enforcementRegistration); + if (i > 0 && enforcementRegistration.getFileList().size() > 0) { + zdxtFileCommonApi.deleteZdxtFileByIds(enforcementRegistration.getId()); + enforcementRegistration.getFileList().forEach(res -> { + ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon(); + zdxtFileCommon.setBusinessId(enforcementRegistration.getId()); + zdxtFileCommon.setGuid(IdUtil.simpleUUID()); + //文件后缀 + // zdxtFileCommon.setFileSuffix("JPG"); + zdxtFileCommon.setUploadPath(res); + zdxtFileCommon.setUploadPersonId(user.getUserId().toString()); + zdxtFileCommon.setUploadPersonName(user.getUserName()); + zdxtFileCommonApi.addZdxtFileCommon(zdxtFileCommon); + }); + } //判断数据修改成功且状态为1时同步推送至 if(i > 0 && enforcementRegistration.getStatus() == 1){ //TODO 提交相对应的数据到后台管理,同时绑定对应的商户。相关的执法数据推送到其它平台 @@ -262,4 +285,25 @@ public class EnforcementRegistrationServiceImpl implements IEnforcementRegistrat FilePreviewUtilBean filePreviewUtilBean = new FilePreviewUtilBean(); return filePreviewUtilBean.attachementToAttFileRespDTO(fileList); } + + @Override + public EnforcementRegistration getByUserIdAndZero() { + EnforcementRegistration registration = new EnforcementRegistration(); + UserBean user = userApi.getCurrentUser(); + registration.setUserId(user.getUserId()); + registration.setIsSubmit(0); + List es = enforcementRegistrationMapper.selectEnforcementRegistrationList(registration); + + EnforcementRegistration result = new EnforcementRegistration(); + if (null != es && es.size() >0) { + result = es.get(0); + List files = zdxtFileCommonApi.selectZdxtFileById(result.getId()); + List fileUrls = new ArrayList<>(); + for (ZdxtFileCommon file : files) { + fileUrls.add(file.getUploadPath()); + } + result.setFileList(fileUrls); + } + return result; + } } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseLawEnforcementServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseLawEnforcementServiceImpl.java index c8d8a2dd..5a938b93 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseLawEnforcementServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseLawEnforcementServiceImpl.java @@ -13,6 +13,7 @@ import com.zdxt.code.domain.LinkageDict; import com.zdxt.code.service.IEnterpriseMerchantAuthorizationService; import com.zdxt.code.service.ILinkageDictService; import com.zdxt.common.util.DateUtils; +import com.zdxt.common.util.StringUtils; import com.zdxt.common.zdxtFile.ZdxtFileCommon; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -121,29 +122,36 @@ public class EnterpriseLawEnforcementServiceImpl implements IEnterpriseLawEnforc @Override public int insertEnterpriseLawEnforcement(EnterpriseLawEnforcement enterpriseLawEnforcement) { - enterpriseLawEnforcement.setCreateTime(DateUtils.getNowDate()); - enterpriseLawEnforcement.setId(IdUtil.simpleUUID()); - enterpriseLawEnforcement.setLawEnforcementCode(IdUtil.simpleUUID()); - UserBean user = userApi.getCurrentUser(); - enterpriseLawEnforcement.setUserId(user.getUserId()); - enterpriseLawEnforcement.setDeptId(user.getDeptId()); - enterpriseLawEnforcement.setCreateBy(user.getUserName()); - //预约记录,默认正常 - enterpriseLawEnforcement.setStatus(0); - EnterpriseMerchantAuthorization enterpriseMerchantAuthorization = - new EnterpriseMerchantAuthorization(); - //联系人手机号码 - enterpriseMerchantAuthorization.setMerchantTel(enterpriseLawEnforcement.getLinkTel()); - //查询企业信息 - List enterpriseMerchantAuthorizations = - enterpriseMerchantAuthorizationService.selectEnterpriseMerchantAuthorizationList(enterpriseMerchantAuthorization); - if(enterpriseMerchantAuthorizations.size() > 0){ - //设置企业的统一信用代码 - enterpriseLawEnforcement.setEnterpriseNumber( - enterpriseMerchantAuthorizations.get(0).getEnterpriseNumber()); + int resNum = 0; + if (StringUtils.isNotEmpty(enterpriseLawEnforcement.getId())) { + enterpriseLawEnforcement.setIsSubmit(0); + resNum = this.updateEnterpriseLawEnforcement(enterpriseLawEnforcement); + } else { + enterpriseLawEnforcement.setCreateTime(DateUtils.getNowDate()); + enterpriseLawEnforcement.setId(IdUtil.simpleUUID()); + enterpriseLawEnforcement.setLawEnforcementCode(IdUtil.simpleUUID()); + UserBean user = userApi.getCurrentUser(); + enterpriseLawEnforcement.setUserId(user.getUserId()); + enterpriseLawEnforcement.setDeptId(user.getDeptId()); + enterpriseLawEnforcement.setCreateBy(user.getUserName()); + //预约记录,默认正常 + enterpriseLawEnforcement.setStatus(0); + enterpriseLawEnforcement.setIsSubmit(0); + EnterpriseMerchantAuthorization enterpriseMerchantAuthorization = + new EnterpriseMerchantAuthorization(); + //联系人手机号码 + enterpriseMerchantAuthorization.setMerchantTel(enterpriseLawEnforcement.getLinkTel()); + //查询企业信息 + List enterpriseMerchantAuthorizations = + enterpriseMerchantAuthorizationService.selectEnterpriseMerchantAuthorizationList(enterpriseMerchantAuthorization); + if (enterpriseMerchantAuthorizations.size() > 0) { + //设置企业的统一信用代码 + enterpriseLawEnforcement.setEnterpriseNumber( + enterpriseMerchantAuthorizations.get(0).getEnterpriseNumber()); + } + resNum = enterpriseLawEnforcementMapper.insertEnterpriseLawEnforcement(enterpriseLawEnforcement); } - int i = enterpriseLawEnforcementMapper.insertEnterpriseLawEnforcement(enterpriseLawEnforcement); - return i; + return resNum; } /** @@ -155,7 +163,6 @@ public class EnterpriseLawEnforcementServiceImpl implements IEnterpriseLawEnforc @Override public int updateEnterpriseLawEnforcement(EnterpriseLawEnforcement enterpriseLawEnforcement) { - enterpriseLawEnforcement.setIsSubmit(1); enterpriseLawEnforcement.setUpdateTime(DateUtils.getNowDate()); return enterpriseLawEnforcementMapper.updateEnterpriseLawEnforcement(enterpriseLawEnforcement); }