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<SysCustomerCaseFile> list = sysCustomerCaseService.getFileListByCaseId(id); List<String> 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<MessageNoticeResponse> 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 id="updateSysCustomer" parameterType="SysCustomer"> update sys_customer <trim prefix="SET" suffixOverrides=","> - <if test="id != null">out_id = md5(#{id}),</if> <if test="name != null">name = #{name},</if> <if test="phone != null">phone = #{phone},</if> <if test="fansTime != null">fans_time = #{fansTime},</if> 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 <trim prefix="(" suffix=")" suffixOverrides=","> <if test="customerId != null">customer_id,</if> - <if test="customerId != null">out_id,</if> <if test="sex != null">sex,</if> <if test="age != null">age,</if> <if test="tall != null">tall,</if> @@ -118,7 +117,6 @@ </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="customerId != null">#{customerId},</if> - <if test="customerId != null">md5#{customerId},</if> <if test="sex != null">#{sex},</if> <if test="age != null">#{age},</if> <if test="tall != null">#{tall},</if> @@ -160,7 +158,6 @@ update sys_customer_physical_signs <trim prefix="SET" suffixOverrides=","> <if test="customerId != null">customer_id = #{customerId},</if> - <if test="customerId != null">out_id = md5(#{customerId}),</if> <if test="sex != null">sex = #{sex},</if> <if test="age != null">age = #{age},</if> <if test="tall != null">tall = #{tall},</if> 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 @@ <if test="orderId != null">order_id,</if> <if test="customer != null and customer != ''">customer,</if> <if test="cusId != null">cus_id,</if> - <if test="cusId != null">out_id,</if> <if test="phone != null">phone,</if> <if test="payTypeId != null">pay_type_id,</if> <if test="reviewStatus != null">review_status,</if> @@ -249,7 +248,6 @@ <if test="orderId != null">#{orderId},</if> <if test="customer != null and customer != ''">#{customer},</if> <if test="cusId != null">#{cusId},</if> - <if test="cusId != null">md5(#{cusId}),</if> <if test="phone != null">#{phone},</if> <if test="payTypeId != null">#{payTypeId},</if> <if test="reviewStatus != null">#{reviewStatus},</if> 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 @@ <result property="id" column="id"/> <result property="orderId" column="order_id"/> <result property="cusId" column="cus_id"/> - <result property="outId" column="out_id"/> <result property="pauseStartDate" column="pause_start_date"/> <result property="pauseEndDate" column="pause_end_date"/> <result property="reason" column="reason"/> @@ -25,7 +24,7 @@ </sql> <sql id="selectSysOrderPauseVo"> - 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 </sql> <select id="selectSysOrderPauseList" parameterType="SysOrderPause" resultMap="SysOrderPauseResult"> @@ -37,7 +36,6 @@ where sop.del_flag = 0 <if test="orderId != null ">and sop.order_id = #{orderId}</if> <if test="cusId != null ">and sop.cus_id = #{cusId}</if> - <if test="outId != null ">and sop.out_id = #{outId}</if> <if test="pauseStartDate != null ">and sop.pause_start_date = #{pauseStartDate}</if> <if test="pauseEndDate != null ">and sop.pause_end_date = #{pauseEndDate}</if> <if test="reason != null and reason != ''">and sop.reason = #{reason}</if> @@ -86,7 +84,7 @@ <trim prefix="SET" suffixOverrides=","> <if test="orderId != null">order_id = #{orderId},</if> <if test="cusId != null">cus_id = #{cusId},</if> - <if test="outId != null">out_id = #{outId},</if> + <if test="cusId != null">out_id = md5(#{cusId}),</if> <if test="pauseStartDate != null">pause_start_date = #{pauseStartDate},</if> <if test="pauseEndDate != null">pause_end_date = #{pauseEndDate},</if> <if test="reason != null">reason = #{reason},</if> diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserInfoMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserInfoMapper.xml index ea240b74b..213c2a3a7 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserInfoMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserInfoMapper.xml @@ -7,7 +7,6 @@ <resultMap type="SysWxUserInfo" id="SysWxUserInfoResult"> <result property="openid" column="openid"/> <result property="cusId" column="cus_id"/> - <result property="customerId" column="out_id"/> <result property="nickName" column="nick_name"/> <result property="appid" column="appid"/> <result property="phone" column="phone"/> @@ -58,7 +57,6 @@ <if test="nickName != null">nick_name,</if> <if test="appid != null">appid,</if> <if test="cusId != null">cus_id,</if> - <if test="cusId != null">out_id,</if> <if test="phone != null">phone,</if> <if test="avatarUrl != null">avatar_url,</if> <if test="sex != null">sex,</if> @@ -77,7 +75,6 @@ <if test="nickName != null">#{nickName},</if> <if test="appid != null">#{appid},</if> <if test="cusId != null">#{cusId},</if> - <if test="cusId != null">md5(#{cusId}),</if> <if test="phone != null">#{phone},</if> <if test="avatarUrl != null">#{avatarUrl},</if> <if test="sex != null">#{sex},</if> @@ -99,7 +96,6 @@ <if test="nickName != null">nick_name = #{nickName},</if> <if test="appid != null">appid = #{appid},</if> <if test="cusId != null">cus_id = #{cusId},</if> - <if test="cusId != null">out_id = md5(#{cusId}),</if> <if test="phone != null">phone = #{phone},</if> <if test="avatarUrl != null">avatar_url = #{avatarUrl},</if> <if test="sex != null">sex = #{sex},</if>