Browse Source

场所码代码提交

taoyuan 3 tuần trước cách đây
mục cha
commit
cbf42079c3
18 tập tin đã thay đổi với 516 bổ sung72 xóa
  1. 3 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/CsmController.java
  2. 35 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/CsmFormController.java
  3. 4 3
      technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/DictController.java
  4. 26 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/BaseDto.java
  5. 53 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/RzFjDto.java
  6. 109 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/RzfDto.java
  7. 3 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/mapper/coremapper/DictMapper.java
  8. 8 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/CsmFormService.java
  9. 2 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/CsmService.java
  10. 3 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/DictService.java
  11. 14 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/CsmFormServiceImpl.java
  12. 35 53
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/CsmServiceImpl.java
  13. 3 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/DictServiceImpl.java
  14. 11 5
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/QueryDdLevelVo.java
  15. 6 6
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/TechnologyGenerateVo.java
  16. 13 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/TechnologyListResultVo.java
  17. 180 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/zx/ZxService.java
  18. 8 0
      technology-codetj-common/src/main/java/com/technology/huahai/common/handler/GlobalExceptionHandler.java

+ 3 - 1
technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/CsmController.java

@@ -4,6 +4,7 @@ import com.technology.huahai.common.core.controller.BaseController;
 import com.technology.huahai.common.core.controller.domain.AjaxResult;
 import com.technology.huahai.common.core.page.TableDataInfo;
 import com.technology.huahai.common.utils.TokenGeneratorUtils;
+import com.technology.huahai.web.dto.RzfDto;
 import com.technology.huahai.web.dto.ScanRecordDto;
 import com.technology.huahai.web.vo.*;
 import com.technology.huahai.web.service.CsmService;
@@ -188,7 +189,7 @@ public class CsmController extends BaseController {
      * @return
      */
     @PostMapping("/queryLevelByLevelId")
-    public TableDataInfo queryLevelByLevelId(@RequestBody QueryDdLevelVo queryDdLevelVo){
+    public AjaxResult queryLevelByLevelId(@RequestBody QueryDdLevelVo queryDdLevelVo){
         return csmService.queryLevelByLevelId(queryDdLevelVo);
     }
 
@@ -215,4 +216,5 @@ public class CsmController extends BaseController {
 
 
 
+
 }

+ 35 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/CsmFormController.java

@@ -0,0 +1,35 @@
+package com.technology.huahai.web.controller.csm;
+
+import com.technology.huahai.common.core.controller.domain.AjaxResult;
+import com.technology.huahai.web.dto.RzfDto;
+import com.technology.huahai.web.service.CsmFormService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 场所码表单控制器
+ * @author taoyuan
+ * @date 2025/05/07
+ * 场所码
+ */
+@RestController
+@RequestMapping("/api/technology/form")
+public class CsmFormController {
+
+    @Autowired
+    private CsmFormService csmFormService;
+
+    /**
+     * 保存日租房信息
+     * @param rzfDto
+     * @return
+     */
+    @PostMapping("/saveRzfInfo")
+    public AjaxResult saveRzfInfo(@RequestBody RzfDto rzfDto){
+        return csmFormService.saveRzfInfo(rzfDto);
+    }
+
+}

+ 4 - 3
technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/DictController.java

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * @author taoyuan
@@ -24,13 +25,13 @@ public class DictController {
     private DictService dictService;
 
     /**
-     * 场所码生成接口
+     * 根据类型查询字典
      * @param dictType
      * @return
      */
     @GetMapping("/getDictInfoByType")
-    public AjaxResult getDictInfoByType(@RequestParam(name = "dictType",required = true)String dictType) {
-        Dict dict = dictService.getDictInfoByType(dictType);
+    public AjaxResult getDictInfoByType(@Valid @RequestParam(name = "dictType",required = true)String dictType) {
+        List<Dict> dict = dictService.getDictInfoByType(dictType);
         return AjaxResult.success(dict);
     }
 

+ 26 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/BaseDto.java

@@ -0,0 +1,26 @@
+package com.technology.huahai.web.dto;
+
+import java.util.Date;
+
+public class BaseDto {
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 53 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/RzFjDto.java

@@ -0,0 +1,53 @@
+package com.technology.huahai.web.dto;
+
+/**
+ * 日租房间dto
+ */
+public class RzFjDto extends BaseDto{
+
+    private String id;
+    /**
+     * 房屋门牌号
+     */
+    private String fwmph;
+    /**
+     * 床位数
+     */
+    private String cws;
+    /**
+     * 日租房ID
+     */
+    private String rzfid;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getFwmph() {
+        return fwmph;
+    }
+
+    public void setFwmph(String fwmph) {
+        this.fwmph = fwmph;
+    }
+
+    public String getCws() {
+        return cws;
+    }
+
+    public void setCws(String cws) {
+        this.cws = cws;
+    }
+
+    public String getRzfid() {
+        return rzfid;
+    }
+
+    public void setRzfid(String rzfid) {
+        this.rzfid = rzfid;
+    }
+}

+ 109 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/RzfDto.java

@@ -0,0 +1,109 @@
+package com.technology.huahai.web.dto;
+
+import java.util.List;
+
+/**
+ * 日租房dto
+ */
+public class RzfDto extends BaseDto {
+
+    private String id;
+
+    private String name;
+
+    private String tyshxydm;
+
+    private String jyxxdz;
+
+    private String jyzxm;
+
+    private String jyzlxdh;
+
+    private String jyzsfzh;
+
+    private String jymj;
+
+    private String csmId;
+
+    private List<RzFjDto> rzfjList;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTyshxydm() {
+        return tyshxydm;
+    }
+
+    public void setTyshxydm(String tyshxydm) {
+        this.tyshxydm = tyshxydm;
+    }
+
+    public String getJyxxdz() {
+        return jyxxdz;
+    }
+
+    public void setJyxxdz(String jyxxdz) {
+        this.jyxxdz = jyxxdz;
+    }
+
+    public String getJyzxm() {
+        return jyzxm;
+    }
+
+    public void setJyzxm(String jyzxm) {
+        this.jyzxm = jyzxm;
+    }
+
+    public String getJyzlxdh() {
+        return jyzlxdh;
+    }
+
+    public void setJyzlxdh(String jyzlxdh) {
+        this.jyzlxdh = jyzlxdh;
+    }
+
+    public String getJyzsfzh() {
+        return jyzsfzh;
+    }
+
+    public void setJyzsfzh(String jyzsfzh) {
+        this.jyzsfzh = jyzsfzh;
+    }
+
+    public String getJymj() {
+        return jymj;
+    }
+
+    public void setJymj(String jymj) {
+        this.jymj = jymj;
+    }
+
+    public String getCsmId() {
+        return csmId;
+    }
+
+    public void setCsmId(String csmId) {
+        this.csmId = csmId;
+    }
+
+    public List<RzFjDto> getRzfjList() {
+        return rzfjList;
+    }
+
+    public void setRzfjList(List<RzFjDto> rzfjList) {
+        this.rzfjList = rzfjList;
+    }
+}

+ 3 - 1
technology-codetj-admin/src/main/java/com/technology/huahai/web/mapper/coremapper/DictMapper.java

@@ -4,9 +4,11 @@ import com.technology.huahai.web.domain.entity.Dict;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface DictMapper {
 
-    Dict getDictInfoByType(@Param("dictType")String dictType);
+    List<Dict> getDictInfoByType(@Param("dictType")String dictType);
 
 }

+ 8 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/CsmFormService.java

@@ -0,0 +1,8 @@
+package com.technology.huahai.web.service;
+
+import com.technology.huahai.common.core.controller.domain.AjaxResult;
+import com.technology.huahai.web.dto.RzfDto;
+
+public interface CsmFormService {
+    AjaxResult saveRzfInfo(RzfDto rzfDto);
+}

+ 2 - 1
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/CsmService.java

@@ -2,6 +2,7 @@ package com.technology.huahai.web.service;
 
 import com.technology.huahai.common.core.controller.domain.AjaxResult;
 import com.technology.huahai.common.core.page.TableDataInfo;
+import com.technology.huahai.web.dto.RzfDto;
 import com.technology.huahai.web.dto.ScanRecordDto;
 import com.technology.huahai.web.vo.*;
 
@@ -27,7 +28,7 @@ public interface CsmService {
 
     void generateFeedback(FeedbackVo feedbackVo);
 
-    TableDataInfo queryLevelByLevelId(QueryDdLevelVo queryDdLevelVo);
+    AjaxResult queryLevelByLevelId(QueryDdLevelVo queryDdLevelVo);
 
     TableDataInfo queryDdByLevelAndName(QueryDdLevelVo queryDdLevelVo);
 

+ 3 - 1
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/DictService.java

@@ -2,8 +2,10 @@ package com.technology.huahai.web.service;
 
 import com.technology.huahai.web.domain.entity.Dict;
 
+import java.util.List;
+
 public interface DictService {
 
-    Dict getDictInfoByType(String dictType);
+    List<Dict> getDictInfoByType(String dictType);
 
 }

+ 14 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/CsmFormServiceImpl.java

@@ -0,0 +1,14 @@
+package com.technology.huahai.web.service.impl;
+
+import com.technology.huahai.common.core.controller.domain.AjaxResult;
+import com.technology.huahai.web.dto.RzfDto;
+import com.technology.huahai.web.service.CsmFormService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CsmFormServiceImpl implements CsmFormService {
+    @Override
+    public AjaxResult saveRzfInfo(RzfDto rzfDto) {
+        return null;
+    }
+}

+ 35 - 53
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/CsmServiceImpl.java

@@ -12,6 +12,7 @@ import com.technology.huahai.common.utils.JsonUtils;
 import com.technology.huahai.common.utils.RedisUtils;
 import com.technology.huahai.common.utils.StringUtils;
 import com.technology.huahai.common.utils.file.FileUtils;
+import com.technology.huahai.web.dto.ChannelDto;
 import com.technology.huahai.web.dto.ScanRecordDto;
 import com.technology.huahai.web.vo.*;
 import com.technology.huahai.web.mapper.coremapper.CsmMapper;
@@ -73,47 +74,15 @@ public class CsmServiceImpl implements CsmService {
     @Value("${zx.ctUrl}")
     private String ctUrl;
 
-    @Value("${zx.redirectUrl}")
-    private String redirectUrl;
-
     @Value("${zx.csmCtMethodKey}")
     private String csmCtMethodKey;
 
-    @Value("${zx.getCsmListMethodKey}")
-    private String  getCsmListMethodKey;
-
-    @Value("${zx.getDdSelectMethodKey}")
-    private String getDdSelectMethodKey;
-
-    @Value("${zx.saveCsmMethodKey}")
-    private String saveCsmMethodKey;
-
-    @Value("${zx.saveScanRecordMethodKey}")
-    private String saveScanRecordMethodKey;
-
-    @Value("${zx.getAdressByBzdzbmMethodKey}")
-    private String getAdressByBzdzbmMethodKey;
-
     @Value("${zx.gdUrl}")
     private String gdUrl;
 
-    @Value("${zx.feedbackMethodKey}")
-    private String feedbackMethodKey;
-
     @Value("${csm.mode}")
     private String mode;
 
-    @Value("${wx.xcxTokenUrl}")
-    private String xcxTokenUrl;
-    @Value("${wx.grant_type}")
-    private String grant_type;
-
-    @Value("${wx.appid}")
-    private String appid;
-
-    @Value("${wx.secret}")
-    private String secret;
-
     @Value("${wx.ewmUrl}")
     private String ewmUrl;
 
@@ -163,7 +132,7 @@ public class CsmServiceImpl implements CsmService {
     public void saveScanCodeRecord(ScanCodeRecordVo scanCodeRecordVo) {
         //本地留存一份只保留扫码时间及姓名及场所码id
         csmMapper.saveScanRecord(scanCodeRecordVo);
-        AjaxResult ajaxResult = cmsEmsInterfaceOperation(saveScanRecordMethodKey,JsonUtils.writeValueAsString(scanCodeRecordVo));
+        AjaxResult ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,scanCodeRecordVo,"saveScanRecord");
         if(0!=ajaxResult.getCode()){
             throw new CsmException(ajaxResult.getMsg());
         }
@@ -186,7 +155,7 @@ public class CsmServiceImpl implements CsmService {
             ResponseEntity<TableDataInfo> response = restTemplate.postForEntity(url, requestEntity, TableDataInfo.class);
             tableDataInfo = response.getBody();
         }else{
-            tableDataInfo = cmsEmsInterfaceQueryList(getCsmListMethodKey, JsonUtils.writeValueAsString(technologyQueryVo));
+            tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey, technologyQueryVo,"getCsmList");
         }
         return tableDataInfo;
     }
@@ -208,7 +177,7 @@ public class CsmServiceImpl implements CsmService {
             ResponseEntity<TableDataInfo> response = restTemplate.postForEntity(url, requestEntity, TableDataInfo.class);
             tableDataInfo = response.getBody();
         }else{
-            tableDataInfo = cmsEmsInterfaceQueryList(getDdSelectMethodKey, JsonUtils.writeValueAsString(technologyQueryVo));
+            tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey, technologyQueryVo,"getDdSelect");
         }
         return tableDataInfo;
     }
@@ -232,7 +201,7 @@ public class CsmServiceImpl implements CsmService {
             // 解码Base64字符串
             byte[] imageBytes = Base64.getDecoder().decode(technologyCode);
             String fileName = FileUtils.writeBytesWeekPackage(imageBytes,csmPath,technologyGenerateVo.getId()+".png");
-            technologyGenerateVo.setFileName(fileName);
+            technologyGenerateVo.setEwmwjdz(fileName);
             technologyGenerateVo.setTechnologyCode(technologyCode);
             AjaxResult ajaxResult = new AjaxResult();
             if("dev".equals(mode)){
@@ -250,7 +219,7 @@ public class CsmServiceImpl implements CsmService {
                 ajaxResult = response.getBody();*/
                 ajaxResult.setData(fileName);
             }else{
-                ajaxResult = cmsEmsInterfaceOperation(saveCsmMethodKey,JsonUtils.writeValueAsString(technologyGenerateVo));
+                ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,technologyGenerateVo,"saveCsm");
                 if(0!=ajaxResult.getCode()){
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 }
@@ -260,7 +229,7 @@ public class CsmServiceImpl implements CsmService {
         }catch (Exception e){
             logger.error("二维码生成失败:",e);
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return AjaxResult.error("二维码生成失败");
+            return AjaxResult.error("二维码生成失败");
         }
     }
 
@@ -281,14 +250,14 @@ public class CsmServiceImpl implements CsmService {
             ResponseEntity<AjaxResult> response = restTemplate.postForEntity(url, requestEntity, AjaxResult.class);
             ajaxResult = response.getBody();
         }else{
-            ajaxResult = cmsEmsInterfaceOperation(getAdressByBzdzbmMethodKey,JsonUtils.writeValueAsString(queryAdressVo));
+            ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,queryAdressVo,"getAdressByBzdzbm");
         }
         return ajaxResult;
     }
 
     @Override
     public AjaxResult getAdressByDz(QueryAdressByDzVo queryAdressByDzVo) {
-        return cmsEmsInterfaceOperation(csmCtMethodKey,JsonUtils.writeValueAsString(queryAdressByDzVo));
+        return cmsEmsInterfaceOperation(csmCtMethodKey,queryAdressByDzVo,"getAdressByDz");
     }
 
     @Override
@@ -336,7 +305,7 @@ public class CsmServiceImpl implements CsmService {
                 throw new CsmException(ajaxResult.getMsg());
             }
         }else{
-            ajaxResult = cmsEmsInterfaceOperation(feedbackMethodKey,JsonUtils.writeValueAsString(feedbackVo));
+            ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,feedbackVo,"generateFeedback");
             if(0!=ajaxResult.getCode()){
                 throw new CsmException(ajaxResult.getMsg());
             }
@@ -345,14 +314,14 @@ public class CsmServiceImpl implements CsmService {
     }
 
     @Override
-    public TableDataInfo queryLevelByLevelId(QueryDdLevelVo queryDdLevelVo) {
-        TableDataInfo tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey,JsonUtils.writeValueAsString(queryDdLevelVo));
-        return tableDataInfo;
+    public AjaxResult queryLevelByLevelId(QueryDdLevelVo queryDdLevelVo) {
+        AjaxResult ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,queryDdLevelVo,"queryLevelByLevelId");
+        return ajaxResult;
     }
 
     @Override
     public TableDataInfo queryDdByLevelAndName(QueryDdLevelVo queryDdLevelVo) {
-        TableDataInfo tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey,JsonUtils.writeValueAsString(queryDdLevelVo));
+        TableDataInfo tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey,queryDdLevelVo,"queryDdByLevelAndName");
         return tableDataInfo;
     }
 
@@ -457,14 +426,20 @@ public class CsmServiceImpl implements CsmService {
     /**
      * 场所码内网透传接口(操作类)
      * @param emsMethodkey
-     * @param jsonStr
+     * @param o
+     * @param o
+     * methodName
      * @return
      */
-    public AjaxResult cmsEmsInterfaceOperation(String emsMethodkey,String jsonStr){
+    public AjaxResult cmsEmsInterfaceOperation(String emsMethodkey,Object o,String methodName){
         String token = getZxTokenByRedis();
         if(StringUtils.isBlank(token)){
             throw new CsmException("总线token获取失败");
         }else{
+            ChannelDto channelDto = new ChannelDto();
+            channelDto.setMethod(methodName);
+            channelDto.setData(o);
+            String jsonStr = JsonUtils.writeValueAsString(channelDto);
             MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
             formData.add("methodkey", emsMethodkey);
             formData.add("postDataJson", jsonStr);
@@ -477,8 +452,9 @@ public class CsmServiceImpl implements CsmService {
 
             // 5. 构造请求实体(包含头和体)
             HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
-            // 6. 发送请求并获取响应(假设返回的是 String 类型)
-            //zxResultDto zxResultDto = restTemplate.postForObject(outinterfaceUrl, requestEntity, zxResultDto.class);
+            // 6. 发送请求并获取响应
+            logger.info("本次总线请求参数为:{}",jsonStr);
+            logger.info("本次总线请求token为:{}",headers.get("Authorization"));
             ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
             logger.info("总线响应结果 {}", zxResult.getBody());
             ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
@@ -495,14 +471,19 @@ public class CsmServiceImpl implements CsmService {
     /**
      * 场所码内网透传接口(查询列表类)
      * @param emsMethodkey
-     * @param jsonStr
+     * @param o
+     * @param methodName
      * @return
      */
-    public TableDataInfo cmsEmsInterfaceQueryList(String emsMethodkey,String jsonStr){
+    public TableDataInfo cmsEmsInterfaceQueryList(String emsMethodkey,Object o,String methodName){
         String token = getZxTokenByRedis();
         if(StringUtils.isBlank(token)){
             throw new CsmException("总线token获取失败");
         }else{
+            ChannelDto channelDto = new ChannelDto();
+            channelDto.setMethod(methodName);
+            channelDto.setData(o);
+            String jsonStr = JsonUtils.writeValueAsString(channelDto);
             MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
             formData.add("methodkey", emsMethodkey);
             formData.add("postDataJson", jsonStr);
@@ -515,8 +496,9 @@ public class CsmServiceImpl implements CsmService {
 
             // 5. 构造请求实体(包含头和体)
             HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
-            // 6. 发送请求并获取响应(假设返回的是 String 类型)
-            //ZxResultDto zxResultDto = restTemplate.postForObject(outinterfaceUrl, requestEntity, ZxResultDto.class);
+            // 6. 发送请求并获取响应
+            logger.info("本次总线请求参数为:{}",jsonStr);
+            logger.info("本次总线请求token为:{}",headers.get("Authorization"));
             ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
             logger.info("总线响应结果 {}", zxResult.getBody());
             ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);

+ 3 - 1
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/DictServiceImpl.java

@@ -6,6 +6,8 @@ import com.technology.huahai.web.service.DictService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class DictServiceImpl implements DictService {
 
@@ -13,7 +15,7 @@ public class DictServiceImpl implements DictService {
     private DictMapper dictMapper;
 
     @Override
-    public Dict getDictInfoByType(String dictType) {
+    public List<Dict> getDictInfoByType(String dictType) {
         return dictMapper.getDictInfoByType(dictType);
     }
 }

+ 11 - 5
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/QueryDdLevelVo.java

@@ -1,14 +1,12 @@
 package com.technology.huahai.web.vo;
 
-public class QueryDdLevelVo {
+public class QueryDdLevelVo extends QueryBaseVo{
     /**
      * 层级ID
      */
     private String levelId;
-    /**
-     * 名称
-     */
-    private String name;
+
+    private String keyWord;
 
     public String getLevelId() {
         return levelId;
@@ -17,4 +15,12 @@ public class QueryDdLevelVo {
     public void setLevelId(String levelId) {
         this.levelId = levelId;
     }
+
+    public String getKeyWord() {
+        return keyWord;
+    }
+
+    public void setKeyWord(String keyWord) {
+        this.keyWord = keyWord;
+    }
 }

+ 6 - 6
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/TechnologyGenerateVo.java

@@ -71,9 +71,9 @@ public class TechnologyGenerateVo {
     private String type;
 
     /**
-     * 文件路径
+     * 二维码地址
      */
-    private String fileName;
+    private String ewmwjdz;
 
 
     public long getId() {
@@ -197,11 +197,11 @@ public class TechnologyGenerateVo {
         this.type = type;
     }
 
-    public String getFileName() {
-        return fileName;
+    public String getEwmwjdz() {
+        return ewmwjdz;
     }
 
-    public void setFileName(String fileName) {
-        this.fileName = fileName;
+    public void setEwmwjdz(String ewmwjdz) {
+        this.ewmwjdz = ewmwjdz;
     }
 }

+ 13 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/TechnologyListResultVo.java

@@ -51,6 +51,11 @@ public class TechnologyListResultVo {
      */
     private String sjjyrxm;
 
+    /**
+     * 二维码文件地址
+     */
+    private String ewmwjdz;
+
     public String getId() {
         return id;
     }
@@ -131,6 +136,14 @@ public class TechnologyListResultVo {
         this.sjjyrxm = sjjyrxm;
     }
 
+    public String getEwmwjdz() {
+        return ewmwjdz;
+    }
+
+    public void setEwmwjdz(String ewmwjdz) {
+        this.ewmwjdz = ewmwjdz;
+    }
+
     @Override
     public String toString() {
         return "TechnologyListResultVo{" +

+ 180 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/zx/ZxService.java

@@ -0,0 +1,180 @@
+package com.technology.huahai.web.zx;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.technology.huahai.common.constant.RedisKeyConstant;
+import com.technology.huahai.common.core.controller.domain.AjaxResult;
+import com.technology.huahai.common.core.page.TableDataInfo;
+import com.technology.huahai.common.exception.CsmException;
+import com.technology.huahai.common.utils.JsonUtils;
+import com.technology.huahai.common.utils.RedisUtils;
+import com.technology.huahai.common.utils.StringUtils;
+import com.technology.huahai.web.dto.ChannelDto;
+import com.technology.huahai.web.vo.ZxResultDto;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+public class ZxService {
+
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Autowired
+    RedisUtils redisUtils;
+
+    @Value("${zx.userId}")
+    private String userId;
+
+    @Value("${zx.userKey}")
+    private String userKey;
+
+    @Value("${zx.loginUrl}")
+    private String loginUrl;
+
+    @Value("${zx.methodkey}")
+    private String methodkey;
+
+    @Value("${zx.outinterfaceUrl}")
+    private String outinterfaceUrl;
+
+
+    /**
+     * 场所码内网透传接口(操作类)
+     * @param emsMethodkey
+     * @param o
+     * @param o
+     * methodName
+     * @return
+     */
+    public  AjaxResult cmsEmsInterfaceOperation(String emsMethodkey, Object o, String methodName){
+        String token = getZxTokenByRedis();
+        if(StringUtils.isBlank(token)){
+            throw new CsmException("总线token获取失败");
+        }else{
+            ChannelDto channelDto = new ChannelDto();
+            channelDto.setMethod(methodName);
+            channelDto.setData(o);
+            String jsonStr = JsonUtils.writeValueAsString(channelDto);
+            MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
+            formData.add("methodkey", emsMethodkey);
+            formData.add("postDataJson", jsonStr);
+
+            // 4. 构造请求头,指定 Content-Type 为 application/x-www-form-urlencoded
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+            headers.set("Authorization","Bearer "+token);
+            //headers.set("X-Service-Name",methodName);
+
+            // 5. 构造请求实体(包含头和体)
+            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
+            // 6. 发送请求并获取响应
+            logger.info("本次总线请求参数为:{}",jsonStr);
+            logger.info("本次总线请求token为:{}",headers.get("Authorization"));
+            ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
+            logger.info("总线响应结果 {}", zxResult.getBody());
+            ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
+            if(0==zxResultDto.getStatus()){
+                String data = zxResultDto.getData();
+                AjaxResult ajaxResult = JsonUtils.parseJson(data, AjaxResult.class);
+                return ajaxResult;
+            }else{
+                throw new CsmException(zxResultDto.getMessage());
+            }
+        }
+    }
+
+    /**
+     * 场所码内网透传接口(查询列表类)
+     * @param emsMethodkey
+     * @param o
+     * @param methodName
+     * @return
+     */
+    public TableDataInfo cmsEmsInterfaceQueryList(String emsMethodkey, Object o, String methodName){
+        String token = getZxTokenByRedis();
+        if(StringUtils.isBlank(token)){
+            throw new CsmException("总线token获取失败");
+        }else{
+            ChannelDto channelDto = new ChannelDto();
+            channelDto.setMethod(methodName);
+            channelDto.setData(o);
+            String jsonStr = JsonUtils.writeValueAsString(channelDto);
+            MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
+            formData.add("methodkey", emsMethodkey);
+            formData.add("postDataJson", jsonStr);
+
+            // 4. 构造请求头,指定 Content-Type 为 application/x-www-form-urlencoded
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+            headers.set("Authorization","Bearer "+token);
+            //headers.set("X-Service-Name",methodName);
+
+            // 5. 构造请求实体(包含头和体)
+            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
+            // 6. 发送请求并获取响应
+            logger.info("本次总线请求参数为:{}",jsonStr);
+            logger.info("本次总线请求token为:{}",headers.get("Authorization"));
+            ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
+            logger.info("总线响应结果 {}", zxResult.getBody());
+            ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
+            if(0==zxResultDto.getStatus()){
+                String data = zxResultDto.getData();
+                TableDataInfo tableDataInfo = JsonUtils.parseJson(data, TableDataInfo.class);
+                return tableDataInfo;
+            }else{
+                throw new CsmException(zxResultDto.getMessage());
+            }
+        }
+    }
+
+    public String getZxTokenByRedis(){
+        Object o = redisUtils.get(RedisKeyConstant.zxtokenKey);
+        if(null != o && StringUtils.isNotEmpty(String.valueOf(o)) && !"null".equals(String.valueOf(o))){
+            return String.valueOf(o);
+        }else{
+            return getZxTokenByInterface();
+        }
+    }
+
+    public synchronized String getZxTokenByInterface(){
+        Object o = redisUtils.get(RedisKeyConstant.zxtokenKey);
+        if(null != o && StringUtils.isNotEmpty(String.valueOf(o)) && !"null".equals(String.valueOf(o))){
+            return String.valueOf(o);
+        }else{
+            MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
+            formData.add("userID", userId);
+            formData.add("userKey", userKey);
+
+            // 4. 构造请求头,指定 Content-Type 为 application/x-www-form-urlencoded
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+
+            // 5. 构造请求实体(包含头和体)
+            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
+
+            // 6. 发送请求并获取响应(假设返回的是 String 类型)
+            JSONObject jsonObject = restTemplate.postForObject(loginUrl, requestEntity, JSONObject.class);
+            logger.info("总线token获取结果 {}",jsonObject);
+            Object access_token = jsonObject.get("access_token");
+            if(null == access_token){
+                throw new CsmException("获取总线token失败");
+            }else{
+                String token = String.valueOf(access_token);
+                redisUtils.set(RedisKeyConstant.zxtokenKey,token,7000);
+                return token;
+            }
+        }
+    }
+}

+ 8 - 0
technology-codetj-common/src/main/java/com/technology/huahai/common/handler/GlobalExceptionHandler.java

@@ -9,6 +9,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.validation.FieldError;
 import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
 import org.springframework.web.bind.annotation.ControllerAdvice;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.client.ResourceAccessException;
@@ -34,6 +35,13 @@ public class GlobalExceptionHandler {
         return new ResponseEntity<>(AjaxResult.error(ex.getMessage()), HttpStatus.UNAUTHORIZED);
     }
 
+    @ExceptionHandler(MissingServletRequestParameterException.class)
+    public ResponseEntity<?> MissingRequestParameterException(MissingServletRequestParameterException ex, WebRequest request) {
+        logger.error("token exception occurred: ", ex);
+        String message = ex.getParameterName() + "参数缺失";
+        return new ResponseEntity<>(AjaxResult.error(message), HttpStatus.OK);
+    }
+
     @ExceptionHandler(ResourceAccessException.class)
     public ResponseEntity<?> rpcException(ResourceAccessException ex, WebRequest request) {
         logger.error("远程调用异常: ", ex);