From 09cd29a97a50f1871238317e2047f75d993c2597 Mon Sep 17 00:00:00 2001 From: songwenxuan <1924103812@qq.com> Date: Tue, 2 Apr 2024 17:53:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E5=85=88=E5=88=A4=E6=96=AD=E6=B8=AF=E8=82=A1=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=EF=BC=8C=E5=AD=98=E5=9C=A8=E6=8B=BF=E6=B8=AF?= =?UTF-8?q?=E8=82=A1=E6=95=B0=E6=8D=AE=E8=BF=87=E6=9D=A5=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E5=88=99=E7=BB=99=E6=B8=AF=E8=82=A1=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E8=BF=87=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PersonnelManagementController.java | 33 +++++++++---- .../keyProjects/UnitsController.java | 46 ++++++++++++------- .../keyProjects/VideoResourcesController.java | 35 ++++++++++---- src/main/resources/application-dev.properties | 11 +++-- 4 files changed, 83 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/zcloud/controller/keyProjects/PersonnelManagementController.java b/src/main/java/com/zcloud/controller/keyProjects/PersonnelManagementController.java index df2838fd..40c74237 100644 --- a/src/main/java/com/zcloud/controller/keyProjects/PersonnelManagementController.java +++ b/src/main/java/com/zcloud/controller/keyProjects/PersonnelManagementController.java @@ -10,6 +10,7 @@ import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.crypto.hash.SimpleHash; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -27,6 +28,8 @@ import java.util.*; @RequestMapping("/personnelmanagement") public class PersonnelManagementController extends BaseController { + @Value("${tongbu.api.url}") + private String tongBuUrl; @Autowired private PersonnelManagementService personnelmanagementService; @@ -44,16 +47,26 @@ public class PersonnelManagementController extends BaseController { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - pd.put("PERSONNELMANAGEMENT_ID", this.get32UUID()); //主键 - pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人 - pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 - pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - pd.put("ISDELETE", "0"); //是否删除 - pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("PHONENUM"), Const.DEFAULT_PASSWORD).toString()); - personnelmanagementService.save(pd); - map.put("result", errInfo); - map.put("dockData", JSON.toJSONString(pd)); + Map result = HttpClientService.doPost(tongBuUrl + "/api/personnelmanagement/findByName", pd); + if (result.get("pd")==null){ + pd.put("PERSONNELMANAGEMENT_ID", this.get32UUID()); //主键 + pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("ISDELETE", "0"); //是否删除 + pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("PHONENUM"), Const.DEFAULT_PASSWORD).toString()); + personnelmanagementService.save(pd); + map.put("result", errInfo); + map.put("dockData", JSON.toJSONString(pd)); + }else { + HashMap hashMap = (HashMap)result.get("pd"); + PageData pageData = new PageData(); + pageData.putAll(hashMap); + pd = pageData; + personnelmanagementService.save(pd); + map.put("result", errInfo); + } return map; } diff --git a/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java b/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java index 79409ccc..f6c6f8ab 100644 --- a/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java +++ b/src/main/java/com/zcloud/controller/keyProjects/UnitsController.java @@ -10,6 +10,7 @@ import com.zcloud.service.system.DictionariesService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -28,7 +29,8 @@ import java.util.*; @Controller @RequestMapping("/units") public class UnitsController extends BaseController { - + @Value("${tongbu.api.url}") + private String tongBuUrl; @Autowired private UnitsService unitsService; @Autowired @@ -55,25 +57,35 @@ public class UnitsController extends BaseController { pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("ISDELETE", "0"); //是否删除 - if (null != file && !file.isEmpty()) { - String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); - if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { - errInfo = "fail"; - map.put("result", errInfo); - map.put("msg", "文件格式不正确!"); - return map; - } - String ffile = DateUtil.getDays(); + Map result = HttpClientService.doPost(tongBuUrl + "/api/units/findByName", pd); + if (result.get("pd")==null) { + if (null != file && !file.isEmpty()) { + String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + String ffile = DateUtil.getDays(); // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile); - pd.put("FILEPATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName); - } + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + Smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile); + pd.put("FILEPATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName); + } // List list = unitsService.listAll(pd); - unitsService.save(pd); - map.put("dockData", JSON.toJSONString(pd)); - map.put("result", errInfo); + unitsService.save(pd); + map.put("dockData", JSON.toJSONString(pd)); + map.put("result", errInfo); + }else { + HashMap hashMap = (HashMap)result.get("pd"); + PageData pageData = new PageData(); + pageData.putAll(hashMap); + pd = pageData; + unitsService.save(pd); + map.put("result", errInfo); + } return map; } diff --git a/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java b/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java index e410609b..ccfb2cee 100644 --- a/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java +++ b/src/main/java/com/zcloud/controller/keyProjects/VideoResourcesController.java @@ -7,10 +7,12 @@ import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.keyProjects.VideoResourcesService; import com.zcloud.util.DateUtil; +import com.zcloud.util.HttpClientService; import com.zcloud.util.Jurisdiction; import com.zcloud.util.Tools; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -30,6 +32,8 @@ import java.util.Map; @RequestMapping("/videoResources") public class VideoResourcesController extends BaseController { + @Value("${tongbu.api.url}") + private String tongBuUrl; @Autowired private VideoResourcesService videoResourcesService; @@ -47,16 +51,27 @@ public class VideoResourcesController extends BaseController { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); - pd.put("VIDEO_RESOURCES_ID", this.get32UUID()); //主键 - pd.put("CREATTIME", DateUtil.date2Str(new Date())); //操作日期 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //操作日期 - pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //操作人 - pd.put("CREATOR", Jurisdiction.getUSER_ID()); //操作人 - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //操作人 - pd.put("ISDELETE", "0"); //是否删除 - videoResourcesService.save(pd); - map.put("dockData", JSON.toJSONString(pd)); - map.put("result", errInfo); + Map result = HttpClientService.doPost(tongBuUrl + "/api/videoResources/findByCode", pd); + if (result.get("pd")==null){ + pd.put("VIDEO_RESOURCES_ID", this.get32UUID()); //主键 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //操作日期 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //操作日期 + pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //操作人 + pd.put("CREATOR", Jurisdiction.getUSER_ID()); //操作人 + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //操作人 + pd.put("ISDELETE", "0"); //是否删除 + videoResourcesService.save(pd); + map.put("dockData", JSON.toJSONString(pd)); + map.put("result", errInfo); + }else { + HashMap hashMap = (HashMap)result.get("pd"); + PageData pageData = new PageData(); + pageData.putAll(hashMap); + pd = pageData; + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + videoResourcesService.save(pd); + map.put("result", errInfo); + } return map; } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 8722a0aa..265519bd 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -1,13 +1,12 @@ datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver -datasource.no1.url=jdbc:mysql://192.168.0.18:3306/qa-cmt-prevention1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 +datasource.no1.url=jdbc:mysql://39.101.130.96:33068/qa-cmt-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 datasource.no1.username=root -datasource.no1.password=root - +datasource.no1.password=Mysql@zcloud88888 datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver -datasource.no2.url=jdbc:mysql://192.168.0.18:3306/qa-cmt-regulatory1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 +datasource.no2.url=jdbc:mysql://39.101.130.96:33068/qa-cmt-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 datasource.no2.username=root -datasource.no2.password=root +datasource.no2.password=Mysql@zcloud88888 datasource.no3.driver-class-name: oracle.jdbc.driver.OracleDriver datasource.no3.url=jdbc:oracle:thin:@172.16.11.75:1521:orcl @@ -60,6 +59,8 @@ spring.main.banner-mode=off preventionxgf.api.url=http://192.168.0.31:8992/qa-prevention-xgf/ # \u6E2F\u52A1\u5C40\u76D1\u7BA1\u7AEF qa-regulatory-gwj.api.url=http://192.168.0.31:8992/qa-regulatory-gwj/ +# tongbu???? +tongbu.api.url=http://192.168.0.247:8094/ #preventionxgf.api.url=https://qgxgf.qhdsafety.com/qa-prevention-xgf/ #qa-regulatory-gwj.api.url=https://qgjg.qhdsafety.com/qa-regulatory-gwj/