diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 115b30795..99d2fdfb9 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -2,7 +2,6 @@ package com.stdiet.web.controller.custom; import com.aliyun.vod20170321.models.GetPlayInfoResponseBody; import com.aliyun.vod20170321.models.GetVideoInfoResponseBody; -import com.aliyun.vod20170321.models.GetVideoListResponseBody; import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.page.TableDataInfo; @@ -79,10 +78,10 @@ public class WechatAppletController extends BaseController { */ @GetMapping("/getFileByCaseId") public AjaxResult getFileByCaseId(@RequestParam("caseId") String caseId) { - Long id = StringUtils.isNotEmpty(caseId) ? Long.parseLong(AesUtils.decrypt(caseId, null)) : null; + Long id = StringUtils.isNotEmpty(caseId) ? Long.parseLong(AesUtils.decrypt(caseId, null)) : -1L; CustomerCaseResponse customerCaseResponse = new CustomerCaseResponse(); customerCaseResponse.setId(caseId); - if (id != null) { + if (id != -1) { List list = sysCustomerCaseService.getFileListByCaseId(id); List fileUrl = new ArrayList<>(); for (SysCustomerCaseFile caseFile : list) { @@ -336,11 +335,9 @@ public class WechatAppletController extends BaseController { @GetMapping(value = "/getCustomerMessage") public TableDataInfo getCustomerMessage(SysMessageNotice sysMessageNotice) { startPage(); - if (StringUtils.isNotEmpty(sysMessageNotice.getCustomerId())) { - sysMessageNotice.setMessageCustomer(Long.parseLong(AesUtils.decrypt(sysMessageNotice.getCustomerId(), null))); - } else { - sysMessageNotice.setMessageCustomer(0L); - } + Long cusId = StringUtils.isNotEmpty(sysMessageNotice.getCustomerId()) ? Long.parseLong(AesUtils.decrypt(sysMessageNotice.getCustomerId())) : 0L; + + sysMessageNotice.setMessageCustomer(cusId); List list = sysMessageNoticeService.getCustomerMessage(sysMessageNotice); return getDataTable(list); } @@ -431,6 +428,8 @@ public class WechatAppletController extends BaseController { } } + curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString())); + // 并返回一系列登录后的数据 return AjaxResult.success(curWxUserInfo); } diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java index 28ff51491..0a2ed412d 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java @@ -18,10 +18,16 @@ public class AesUtils { private static final String DEFAULT_CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding"; //默认的加密算法 private static final String DEFAULT_KEY = "Yhokm#876OTG!c"; + + public static String encrypt(String content) { + return encrypt(content, null); + } + /** * AES 加密操作 - * @param content 待加密内容 - * @param key 加密密码 + * + * @param content 待加密内容 + * @param key 加密密码 * @return 返回Base64转码后的加密数据 */ public static String encrypt(String content, String key) { @@ -44,8 +50,14 @@ public class AesUtils { return null; } + + public static String decrypt(String content) { + return decrypt(content, null); + } + /** * AES 解密操作 + * * @param content * @param key * @return diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index e1594576f..0e7b805e0 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -129,7 +129,6 @@ update sys_customer - out_id = md5(#{id}), name = #{name}, phone = #{phone}, fans_time = #{fansTime}, diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml index f0251dab8..316e4092d 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml @@ -80,7 +80,6 @@ insert into sys_customer_physical_signs customer_id, - out_id, sex, age, tall, @@ -118,7 +117,6 @@ #{customerId}, - md5#{customerId}, #{sex}, #{age}, #{tall}, @@ -160,7 +158,6 @@ update sys_customer_physical_signs customer_id = #{customerId}, - out_id = md5(#{customerId}), sex = #{sex}, age = #{age}, tall = #{tall}, diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index b5a2a5708..3ecbb19ed 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -206,7 +206,6 @@ order_id, customer, cus_id, - out_id, phone, pay_type_id, review_status, @@ -249,7 +248,6 @@ #{orderId}, #{customer}, #{cusId}, - md5(#{cusId}), #{phone}, #{payTypeId}, #{reviewStatus}, diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml index 05cc199d9..ebf0c6e05 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml @@ -8,7 +8,6 @@ - @@ -25,7 +24,7 @@ - select id, order_id, cus_id, out_id, pause_start_date, pause_end_date, reason, remarks, create_time, create_by, update_time, update_by, del_flag from sys_recipes_pause sop + select id, order_id, cus_id, pause_start_date, pause_end_date, reason, remarks, create_time, create_by, update_time, update_by, del_flag from sys_recipes_pause sop