瀏覽代碼

场所码代码提交

taoyuan 6 天之前
父節點
當前提交
ea11519bf6
共有 17 個文件被更改,包括 250 次插入19 次删除
  1. 16 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/System/SystemLoginController.java
  2. 29 5
      technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/CsmController.java
  3. 4 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/csm/CsmFormController.java
  4. 10 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/ScanRecordDto.java
  5. 3 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/mapper/coremapper/CsmMapper.java
  6. 4 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/CsmService.java
  7. 27 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/CsmFormServiceImpl.java
  8. 40 3
      technology-codetj-admin/src/main/java/com/technology/huahai/web/service/impl/CsmServiceImpl.java
  9. 14 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/CancellationCsmDto.java
  10. 16 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/CsmAuthenticationVo.java
  11. 10 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/QueryAddressByBzdzbmVo.java
  12. 10 0
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/QueryScanRecordVo.java
  13. 14 1
      technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/TechnologyGenerateVo.java
  14. 1 1
      technology-codetj-admin/src/main/resources/application.yml
  15. 8 4
      technology-codetj-admin/src/main/resources/mapper/coremapper/CsmMapper.xml
  16. 2 2
      technology-codetj-admin/src/main/resources/mapper/coremapper/DictMapper.xml
  17. 42 0
      technology-codetj-common/src/main/java/com/technology/huahai/common/utils/AESEncryptionUtil.java

+ 16 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/controller/System/SystemLoginController.java

@@ -1,10 +1,13 @@
 package com.technology.huahai.web.controller.System;
 
 import com.technology.huahai.common.core.controller.domain.AjaxResult;
+import com.technology.huahai.web.service.CsmService;
+import com.technology.huahai.web.vo.CsmAuthenticationVo;
 import com.technology.huahai.web.vo.LoginResultVo;
 import com.technology.huahai.web.vo.LoginVo;
 import com.technology.huahai.web.service.SystemLoginService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 /**
@@ -19,6 +22,9 @@ public class SystemLoginController {
     @Autowired
     private SystemLoginService systemLoginService;
 
+    @Autowired
+    private CsmService csmService;
+
     /**
      * 登录
      * @param loginVo
@@ -31,6 +37,16 @@ public class SystemLoginController {
         return AjaxResult.success(loginMessage);
     }
 
+    /**
+     * 查询该场所是否需要人脸认证
+     * @param csmAuthenticationVo
+     * @return
+     */
+    @PostMapping("/csmAuthentication")
+    public AjaxResult csmAuthentication(@Validated @RequestBody CsmAuthenticationVo csmAuthenticationVo){
+        AjaxResult ajaxResult = csmService.csmAuthentication(csmAuthenticationVo);
+        return ajaxResult;
+    }
 
 
 }

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

@@ -4,11 +4,14 @@ import com.github.pagehelper.PageHelper;
 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.AESEncryptionUtil;
+import com.technology.huahai.common.utils.StringUtils;
 import com.technology.huahai.common.utils.TokenGeneratorUtils;
 import com.technology.huahai.web.dto.ScanRecordDto;
 import com.technology.huahai.web.vo.*;
 import com.technology.huahai.web.service.CsmService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -63,9 +66,19 @@ public class CsmController extends BaseController {
     public AjaxResult generateTechnology(@Valid @RequestBody TechnologyGenerateVo technologyGenerateVo, HttpServletRequest httpServletRequest) throws Exception {
         String userMessage = TokenGeneratorUtils.getUserMessage(httpServletRequest);
         String message[] = userMessage.split(":");
-        technologyGenerateVo.setSfzh(message[0]);
-        technologyGenerateVo.setUserName(message[1]);
-        technologyGenerateVo.setMobile(message[2]);
+        if(StringUtils.isBlank(technologyGenerateVo.getSfzh())){
+            technologyGenerateVo.setSfzh(message[0]);
+        }
+        if(StringUtils.isBlank(technologyGenerateVo.getUserName())){
+            technologyGenerateVo.setUserName(message[1]);
+        }
+        if(StringUtils.isBlank(technologyGenerateVo.getMobile())){
+            technologyGenerateVo.setMobile(message[2]);
+        }
+        technologyGenerateVo.setCreateName(message[1]);
+        technologyGenerateVo.setCreateZjhm(message[0]);
+        technologyGenerateVo.setCreateLxdh(message[2]);
+        technologyGenerateVo.setCxsfzh(AESEncryptionUtil.encrypt(message[0]));
         AjaxResult ajaxResult = csmService.generateTechnology(technologyGenerateVo);
         return ajaxResult;
         /*if(0==ajaxResult.getCode()){
@@ -144,8 +157,11 @@ public class CsmController extends BaseController {
      * @return
      */
     @PostMapping("/queryScanCodeRecord")
-    public TableDataInfo queryScanCodeRecord(@Valid @RequestBody QueryScanRecordVo queryScanRecordVo){
+    public TableDataInfo queryScanCodeRecord(@Valid @RequestBody QueryScanRecordVo queryScanRecordVo, HttpServletRequest httpServletRequest) throws Exception {
         PageHelper.startPage(queryScanRecordVo.getPageNum(),queryScanRecordVo.getPageSize());
+        String userMessage = TokenGeneratorUtils.getUserMessage(httpServletRequest);
+        String message[] = userMessage.split(":");
+        queryScanRecordVo.setCxsfzh(AESEncryptionUtil.encrypt(message[0]));
         List<ScanRecordDto> scanRecordDto = csmService.queryScanRecord(queryScanRecordVo);
         return getDataTable(scanRecordDto);
     }
@@ -214,7 +230,15 @@ public class CsmController extends BaseController {
     }
 
 
-
+    /**
+     * 注销场所码
+     * @param cancellationCsmDto
+     * @return
+     */
+    @PostMapping("/cancellationCsm")
+    public AjaxResult cancellationCsm(@RequestBody CancellationCsmDto cancellationCsmDto){
+        return csmService.cancellationCsm(cancellationCsmDto);
+    }
 
 
 }

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

@@ -62,7 +62,11 @@ public class CsmFormController {
         String message[] = userMessage.split(":");
         if(StringUtils.isBlank(rzRzrInfoDto.getRzrZjhm())){
             rzRzrInfoDto.setRzrZjhm(message[0]);
+        }
+        if(StringUtils.isBlank(rzRzrInfoDto.getRzrName())){
             rzRzrInfoDto.setRzrName(message[1]);
+        }
+        if(StringUtils.isBlank(rzRzrInfoDto.getRzrLxdh())){
             rzRzrInfoDto.setRzrLxdh(message[2]);
         }
         rzRzrInfoDto.setCreateName(message[1]);

+ 10 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/dto/ScanRecordDto.java

@@ -15,6 +15,8 @@ public class ScanRecordDto {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
+    private String djcs;
+
     public String getId() {
         return id;
     }
@@ -46,4 +48,12 @@ public class ScanRecordDto {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public String getDjcs() {
+        return djcs;
+    }
+
+    public void setDjcs(String djcs) {
+        this.djcs = djcs;
+    }
 }

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

@@ -4,6 +4,7 @@ import com.technology.huahai.web.dto.ScanRecordDto;
 import com.technology.huahai.web.vo.QueryScanRecordVo;
 import com.technology.huahai.web.vo.ScanCodeRecordVo;
 import com.technology.huahai.web.vo.TechnologyGenerateVo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -13,8 +14,9 @@ public interface CsmMapper {
 
     void saveScanRecord(ScanCodeRecordVo scanCodeRecordVo);
 
-
     void saveCsmInfo(TechnologyGenerateVo technologyGenerateVo);
 
     List<ScanRecordDto> queryScanRecord(QueryScanRecordVo queryScanRecordVo);
+
+    void updateDjcs(@Param("smId") String smId);
 }

+ 4 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/service/CsmService.java

@@ -34,4 +34,8 @@ public interface CsmService {
     AjaxResult getAddressByBzdzbm(QueryAddressByBzdzbmVo queryAdressByDzVo);
 
     List<ScanRecordDto> queryScanRecord(QueryScanRecordVo queryScanRecordVo);
+
+    AjaxResult cancellationCsm(CancellationCsmDto cancellationCsmDto);
+
+    AjaxResult csmAuthentication(CsmAuthenticationVo csmAuthenticationVo);
 }

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

@@ -1,21 +1,32 @@
 package com.technology.huahai.web.service.impl;
 
 import com.technology.huahai.common.core.controller.domain.AjaxResult;
+import com.technology.huahai.common.exception.CsmException;
 import com.technology.huahai.web.dto.LdDto;
 import com.technology.huahai.web.dto.RzRzrInfoDto;
 import com.technology.huahai.web.dto.RzfDto;
+import com.technology.huahai.web.mapper.coremapper.CsmMapper;
 import com.technology.huahai.web.service.CsmFormService;
 import com.technology.huahai.web.vo.QueryRzfDto;
 import com.technology.huahai.web.zx.ZxService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 @Service
 public class CsmFormServiceImpl implements CsmFormService {
 
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
     @Autowired
     private ZxService zxService;
 
+    @Autowired
+    private CsmMapper csmMapper;
+
     @Override
     public AjaxResult saveRzfInfo(RzfDto rzfDto) {
         AjaxResult ajaxResult = zxService.cmsEmsInterfaceOperation(rzfDto,"saveRzfInfo");
@@ -29,8 +40,23 @@ public class CsmFormServiceImpl implements CsmFormService {
     }
 
     @Override
+    @Transactional
     public AjaxResult saveRzrInfo(RzRzrInfoDto rzRzrInfoDto) {
-        return zxService.cmsEmsInterfaceOperation(rzRzrInfoDto,"cjm/saveRzrInfo");
+        try {
+            csmMapper.updateDjcs(rzRzrInfoDto.getSmId());
+            AjaxResult ajaxResult = zxService.cmsEmsInterfaceOperation(rzRzrInfoDto,"cjm/saveRzrInfo");
+            if(0==ajaxResult.getCode()){
+                return ajaxResult;
+            }else{
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return ajaxResult;
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            logger.error("保存入住人信息出错: {}",e);
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            throw new CsmException("保存入住人信息出错");
+        }
     }
 
     @Override

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

@@ -12,6 +12,7 @@ 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.file.FileUtils;
+import com.technology.huahai.common.utils.uuid.IdUtils;
 import com.technology.huahai.web.dto.ScanRecordDto;
 import com.technology.huahai.web.vo.*;
 import com.technology.huahai.web.mapper.coremapper.CsmMapper;
@@ -131,12 +132,14 @@ public class CsmServiceImpl implements CsmService {
     }
 
     @Override
+    @Transactional
     public AjaxResult saveScanCodeRecord(ScanCodeRecordVo scanCodeRecordVo) {
         //本地留存一份只保留扫码时间及姓名及场所码id
         csmMapper.saveScanRecord(scanCodeRecordVo);
         AjaxResult ajaxResult = zxService.cmsEmsInterfaceOperation(scanCodeRecordVo,"saveScanRecord");
         if(0!=ajaxResult.getCode()){
-            throw new CsmException(ajaxResult.getMsg());
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return ajaxResult;
         }else{
             return ajaxResult;
         }
@@ -192,12 +195,14 @@ public class CsmServiceImpl implements CsmService {
         }else{
             tableDataInfo = zxService.cmsEmsInterfaceQueryList(technologyQueryVo,"getDdSelect");
             List<TechnologyListResultVo> rows = tableDataInfo.getRows();
-            for(TechnologyListResultVo technologyListResultVo:rows){
+            List<TechnologyListResultVo> rowList = JsonUtils.parseJson(JsonUtils.writeValueAsString(rows),new TypeReference<List<TechnologyListResultVo>>() {});
+            for(TechnologyListResultVo technologyListResultVo:rowList){
                 Object labelName = redisUtils.get(RedisKeyConstant.dictKey+"SCENARIO_LABEL"+"::"+technologyListResultVo.getLabelId());
                 if(labelName!=null){
                     technologyListResultVo.setLabelName(labelName.toString());
                 }
             }
+            tableDataInfo.setRows(rowList);
         }
         return tableDataInfo;
     }
@@ -271,13 +276,35 @@ public class CsmServiceImpl implements CsmService {
             ajaxResult = response.getBody();
         }else{
             ajaxResult = zxService.cmsEmsInterfaceOperation(queryAdressVo,"getAdressByBzdzbm");
+            if(0==ajaxResult.getCode()){
+                List<TechnologyListResultVo> rowList = JsonUtils.parseJson(JsonUtils.writeValueAsString(ajaxResult.getData()),new TypeReference<List<TechnologyListResultVo>>() {});
+                for(TechnologyListResultVo technologyListResultVo:rowList){
+                    Object labelName = redisUtils.get(RedisKeyConstant.dictKey+"SCENARIO_LABEL"+"::"+technologyListResultVo.getLabelId());
+                    if(labelName!=null){
+                        technologyListResultVo.setLabelName(labelName.toString());
+                    }
+                }
+                ajaxResult.setData(rowList);
+            }
         }
         return ajaxResult;
     }
 
     @Override
     public AjaxResult getAddressByBzdzbm(QueryAddressByBzdzbmVo queryAdressByDzVo) {
-        return zxService.cmsEmsInterfaceOperation(queryAdressByDzVo,"getAddressByBzdzbm");
+
+        AjaxResult ajaxResult = zxService.cmsEmsInterfaceOperation(queryAdressByDzVo,"getAddressByBzdzbm");
+        if(0==ajaxResult.getCode()){
+            List<TechnologyListResultVo> rowList = JsonUtils.parseJson(JsonUtils.writeValueAsString(ajaxResult.getData()),new TypeReference<List<TechnologyListResultVo>>() {});
+            for(TechnologyListResultVo technologyListResultVo:rowList){
+                Object labelName = redisUtils.get(RedisKeyConstant.dictKey+"SCENARIO_LABEL"+"::"+technologyListResultVo.getLabelId());
+                if(labelName!=null){
+                    technologyListResultVo.setLabelName(labelName.toString());
+                }
+            }
+            ajaxResult.setData(rowList);
+        }
+        return ajaxResult;
     }
 
     @Override
@@ -286,6 +313,16 @@ public class CsmServiceImpl implements CsmService {
         return scanRecordDto;
     }
 
+    @Override
+    public AjaxResult cancellationCsm(CancellationCsmDto cancellationCsmDto) {
+        return zxService.cmsEmsInterfaceOperation(cancellationCsmDto,"cancellationCsm");
+    }
+
+    @Override
+    public AjaxResult csmAuthentication(CsmAuthenticationVo csmAuthenticationVo) {
+        return zxService.cmsEmsInterfaceOperation(csmAuthenticationVo,"csmAuthentication");
+    }
+
 
     @Override
     public String getAmapRegeo(GdQueryDzVo gdQueryDzVo) {

+ 14 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/CancellationCsmDto.java

@@ -0,0 +1,14 @@
+package com.technology.huahai.web.vo;
+
+public class CancellationCsmDto {
+
+    private String id;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+}

+ 16 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/CsmAuthenticationVo.java

@@ -0,0 +1,16 @@
+package com.technology.huahai.web.vo;
+
+import javax.validation.constraints.NotBlank;
+
+public class CsmAuthenticationVo {
+    @NotBlank(message = "场所码ID不能为空")
+    private String csmId;
+
+    public String getCsmId() {
+        return csmId;
+    }
+
+    public void setCsmId(String csmId) {
+        this.csmId = csmId;
+    }
+}

+ 10 - 1
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/QueryAddressByBzdzbmVo.java

@@ -4,9 +4,10 @@ import javax.validation.constraints.NotBlank;
 
 public class QueryAddressByBzdzbmVo {
 
-    @NotBlank(message = "标准地址编码不能为空")
     private String bzdzbm;
 
+    private String labelId;
+
     public String getBzdzbm() {
         return bzdzbm;
     }
@@ -14,4 +15,12 @@ public class QueryAddressByBzdzbmVo {
     public void setBzdzbm(String bzdzbm) {
         this.bzdzbm = bzdzbm;
     }
+
+    public String getLabelId() {
+        return labelId;
+    }
+
+    public void setLabelId(String labelId) {
+        this.labelId = labelId;
+    }
 }

+ 10 - 0
technology-codetj-admin/src/main/java/com/technology/huahai/web/vo/QueryScanRecordVo.java

@@ -4,6 +4,8 @@ public class QueryScanRecordVo extends QueryBaseVo{
 
     private String csmId;
 
+    private String cxsfzh;
+
     public String getCsmId() {
         return csmId;
     }
@@ -11,4 +13,12 @@ public class QueryScanRecordVo extends QueryBaseVo{
     public void setCsmId(String csmId) {
         this.csmId = csmId;
     }
+
+    public String getCxsfzh() {
+        return cxsfzh;
+    }
+
+    public void setCxsfzh(String cxsfzh) {
+        this.cxsfzh = cxsfzh;
+    }
 }

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

@@ -1,7 +1,10 @@
 package com.technology.huahai.web.vo;
 
 
-public class TechnologyGenerateVo {
+import com.fasterxml.jackson.databind.ser.Serializers;
+import com.technology.huahai.web.dto.BaseDto;
+
+public class TechnologyGenerateVo extends BaseDto {
     private long id;
     /**
      * 地址持有单位ID
@@ -102,6 +105,8 @@ public class TechnologyGenerateVo {
 
     private String extra;
 
+    private String cxsfzh;
+
     public long getId() {
         return id;
     }
@@ -278,4 +283,12 @@ public class TechnologyGenerateVo {
     public void setExtra(String extra) {
         this.extra = extra;
     }
+
+    public String getCxsfzh() {
+        return cxsfzh;
+    }
+
+    public void setCxsfzh(String cxsfzh) {
+        this.cxsfzh = cxsfzh;
+    }
 }

+ 1 - 1
technology-codetj-admin/src/main/resources/application.yml

@@ -109,7 +109,7 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-    active: dev
+    active: pro
   # 文件上传
   servlet:
     multipart:

+ 8 - 4
technology-codetj-admin/src/main/resources/mapper/coremapper/CsmMapper.xml

@@ -5,16 +5,20 @@
 <mapper namespace="com.technology.huahai.web.mapper.coremapper.CsmMapper">
 
     <insert id="saveScanRecord" parameterType="com.technology.huahai.web.vo.ScanCodeRecordVo" useGeneratedKeys="true" keyProperty="id">
-        insert into CSM_SCAN_RECORD(csmId,username,createTime)
-        values(#{csmId},#{userName},CURRENT_TIME)
+        insert into CSM_SCAN_RECORD(csmId,username,createTime,djcs)
+        values(#{csmId},#{userName},CURRENT_TIME,0)
     </insert>
 
     <insert id="saveCsmInfo" parameterType="com.technology.huahai.web.vo.TechnologyGenerateVo" useGeneratedKeys="true" keyProperty="id">
-        insert into CSM_INFO_WAI(bzdzbm) values(#{bzdzbm})
+        insert into CSM_INFO_WAI(bzdzbm,cxsfzh) values(#{bzdzbm},#{cxsfzh})
     </insert>
 
     <select id="queryScanRecord" resultType="com.technology.huahai.web.dto.ScanRecordDto">
-        select id,csmId,username,createTime from CSM_SCAN_RECORD where csmId = #{csmId}
+        select a.id,a.csmId,a.username,a.createTime,a.djcs from CSM_SCAN_RECORD a left join CSM_INFO_WAI b on a.csmId=b.id where a.csmId = #{csmId} and b.cxsfzh=#{cxsfzh} order by createTime desc
     </select>
 
+    <update id="updateDjcs">
+        update CSM_SCAN_RECORD set djcs=djcs+1 where id =#{smId}
+    </update>
+
 </mapper>

+ 2 - 2
technology-codetj-admin/src/main/resources/mapper/coremapper/DictMapper.xml

@@ -5,11 +5,11 @@
 <mapper namespace="com.technology.huahai.web.mapper.coremapper.DictMapper">
 
     <select id="getDictInfoByType" resultType="com.technology.huahai.web.domain.entity.Dict">
-        select id,dict_type as dictType,dict_key as dictKey,dict_value as dictValue from CSM_DICT_INFO where dict_type = #{dictType} order by sort asc
+        select id,dict_type as dictType,dict_key as dictKey,dict_value as dictValue from CSM_DICT_INFO where dict_type = #{dictType} and enabled='1' order by sort asc
     </select>
 
     <select id="loadAll" resultType="com.technology.huahai.web.domain.entity.Dict">
-        select id,dict_type as dictType,dict_key as dictKey,dict_value as dictValue from CSM_DICT_INFO
+        select id,dict_type as dictType,dict_key as dictKey,dict_value as dictValue from CSM_DICT_INFO where enabled='1'
     </select>
 
 </mapper>

+ 42 - 0
technology-codetj-common/src/main/java/com/technology/huahai/common/utils/AESEncryptionUtil.java

@@ -0,0 +1,42 @@
+package com.technology.huahai.common.utils;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.Base64;
+
+public class AESEncryptionUtil {
+
+    // 注意:Key 必须是 16 字节(128位)、24 字节(192位)或 32 字节(256位)
+    private static final String SECRET_KEY = "jamcsm2025060416"; // 16 字符 = 128 bits
+
+    // 加密方法
+    public static String encrypt(String strToEncrypt) {
+        try {
+            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+            SecretKeySpec keySpec = new SecretKeySpec(SECRET_KEY.getBytes(), "AES");
+            cipher.init(Cipher.ENCRYPT_MODE, keySpec);
+            byte[] encryptedBytes = cipher.doFinal(strToEncrypt.getBytes("UTF-8"));
+
+            // 使用 Base64 编码以便显示或传输
+            return Base64.getEncoder().encodeToString(encryptedBytes);
+        } catch (Exception e) {
+            throw new RuntimeException("加密失败", e);
+        }
+    }
+
+    // 解密方法
+    public static String decrypt(String strToDecrypt) {
+        try {
+            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+            SecretKeySpec keySpec = new SecretKeySpec(SECRET_KEY.getBytes(), "AES");
+            cipher.init(Cipher.DECRYPT_MODE, keySpec);
+            byte[] decryptedBytes = cipher.doFinal(Base64.getDecoder().decode(strToDecrypt));
+
+            return new String(decryptedBytes, "UTF-8");
+        } catch (Exception e) {
+            throw new RuntimeException("解密失败", e);
+        }
+    }
+
+
+}