springcloud_k8s_panzhihuazhihuishequ/applets/pom.xml
@@ -75,12 +75,26 @@ </dependencies> <build> <resources> <resource> <directory>${project.basedir}/src/main/resources/lib</directory> <targetPath>/BOOT-INF/lib/</targetPath> <includes> <include>**/*.jar</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <targetPath>BOOT-INF/classes/</targetPath> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.panzhihua.applets.AppletsApplication</mainClass> <includeSystemScope>true</includeSystemScope> </configuration> <executions> <execution> springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxCallbackApi.java
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.panzhihua.applets.umf.MyAESUtil; import com.panzhihua.applets.umf.UmfPayUtil; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.utlis.DateUtils; @@ -154,9 +155,18 @@ out.close(); } @ApiOperation("uu洗车退款接口") @GetMapping("/uuRepay") public R uuRepay(@RequestParam("orderid") String orderid, @RequestParam("merdate") String merdate, @RequestParam("refundAmount")String refundAmount, @RequestParam("orgAmount")String orgAmount){ Map map=umfPayUtil.repay(orderid,merdate, DateUtils.getDateFormatString(new Date(),"yyMMddHHmmss")+"0001",refundAmount,orgAmount); return R.ok(map); @PostMapping("/uuRepay") public R uuRepay(@RequestBody String aesString){ try { Map<String, String> aesMap= (Map<String, String>) JSON.parse(aesString); String desString=MyAESUtil.Decrypt(aesMap.get("aesString"),"Ryo7M3n8loC5Abcd"); Map<String,String> desMap= (Map) JSON.parse(desString); Map map=umfPayUtil.repay(desMap.get("orderId"),desMap.get("merdate"), DateUtils.getDateFormatString(new Date(),"yyMMddHHmmss")+"0001",desMap.get("refundAmount"),desMap.get("orgAmount")); return R.ok(map); } catch (Exception e) { e.printStackTrace(); return R.fail("加密验证失败"); } } } springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/umf/MyAESUtil.java
New file @@ -0,0 +1,52 @@ package com.panzhihua.applets.umf; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class MyAESUtil { // 加密 public static String Encrypt(String sSrc, String sKey) throws Exception { if (sKey == null) { System.out.print("Key为空null"); return null; } // 判断Key是否为16位 if (sKey.length() != 16) { System.out.print("Key长度不是16位"); return null; } byte[] raw = sKey.getBytes("utf-8"); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式" cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8")); return new BASE64Encoder().encode(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。 } // 解密 public static String Decrypt(String sSrc, String sKey) throws Exception { try { byte[] raw = sKey.getBytes("utf-8"); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] encrypted1 = new BASE64Decoder().decodeBuffer(sSrc);//先用base64解密 try { byte[] original = cipher.doFinal(encrypted1); String originalString = new String(original,"utf-8"); return originalString; } catch (Exception e) { System.out.println(e.toString()); return null; } } catch (Exception ex) { System.out.println(ex.toString()); return null; } } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/common/AddComPbCheckUnitDto.java
@@ -114,5 +114,7 @@ private String otherRemark; @ApiModelProperty(value = "单位所属") private String belongTo; @ApiModelProperty(value = "联系人json") private String adminJson; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/common/EditComPbCheckUnitDto.java
@@ -109,5 +109,7 @@ private String otherRemark; @ApiModelProperty(value = "单位所属") private String belongTo; @ApiModelProperty(value = "联系人json") private String adminJson; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/common/ComPbCheckUnitVo.java
@@ -126,4 +126,6 @@ private String otherRemark; @ApiModelProperty(value = "单位所属") private String belongTo; @ApiModelProperty(value = "联系人json") private String adminJson; } springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/entity/ComPbCheckUnit.java
@@ -98,5 +98,7 @@ private String otherRemark; private String belongTo; private String adminJson; } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml
@@ -558,6 +558,6 @@ </select> <select id="selectOrgAdmin" resultType="Integer"> select count(*) from com_pb_check_unit where admin_phone = #{phone} select count(*) from com_pb_check_unit where admin_json like concat('%',#{phone},'%') </select> </mapper>