From b5f41430918c30f1923c83c6bd8d6b1e29b433ff Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 16 Dec 2020 17:27:54 +0800 Subject: [PATCH 01/56] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=98=B5=E7=A7=B0=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserGrantController.java | 22 ++++++------ .../impl/WxCreditHistoryServiceImpl.java | 18 +++++----- .../service/impl/WxScoreRulesServiceImpl.java | 36 +++++++++---------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 1d326c150..7fcd4cfef 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -549,10 +549,10 @@ public class WxUserGrantController extends BaseController { if (user != null) { logger.debug(user.toString()); - boolean bFirstNickName = false; - if(StringUtils.isNoneEmpty(user.getNickName())) { - bFirstNickName = true; - } +// boolean bFirstNickName = false; +// if(StringUtils.isNoneEmpty(user.getNickName())) { +// bFirstNickName = true; +// } WxMaService wxMaService = getWeappService(user.getAppId()); @@ -592,13 +592,13 @@ public class WxUserGrantController extends BaseController { removeCacheCUser(); - if(bFirstNickName) { - // 首次获取昵称 - // 成长值 - wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.WECHAT_PERSION, user); - //增加积分 - wxCUserService.addCredit(user, EnumScoreType.WECHAT_PERSION); - } +// if(bFirstNickName) { +// // 首次获取昵称 +// // 成长值 +// wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.WECHAT_PERSION, user); +// //增加积分 +// wxCUserService.addCredit(user, EnumScoreType.WECHAT_PERSION); +// } resultMap.put("openId", user.getOpenId()); resultMap.put("unionId", user.getUnionId()); resultMap.put("msg", "获取用户信息成功!"); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index cd7311048..c2206c0cb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -350,9 +350,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { if (record.getCreditType() == EnumScoreType.BIND_CAR.getCode()) { return bindCarAddCredit(record); } - if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) { - return personAddCredit(record); - } +// if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) { +// return personAddCredit(record); +// } if (record.getCreditType() == EnumScoreType.WECHAT_PHONE.getCode()) { return phoneAddCredit(record); } @@ -407,12 +407,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE); } - private int personAddCredit(WxCreditHistory record) { - // 1. 获取score rules - WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); - // 2. 增长的积分 - return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); - } +// private int personAddCredit(WxCreditHistory record) { +// // 1. 获取score rules +// WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); +// // 2. 增长的积分 +// return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); +// } private int phoneAddCredit(WxCreditHistory record) { // 1. 获取score rules diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java index ebc7854d2..d811e142f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java @@ -419,21 +419,21 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { return addScoreNumber; } - private int personAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { - int addScoreNumber = 0; - // 1. 获取score rules - WxScoreRules scoreRules = getScoreRules(tenantEntity); - - // 2. 获取成长值 - addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); - - // 3. 增长的成长值 - updateScore(user.getId(),tenantEntity, addScoreNumber); - - // 4. 记录历史 - recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.WECHAT_PERSION); - return addScoreNumber; - } +// private int personAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { +// int addScoreNumber = 0; +// // 1. 获取score rules +// WxScoreRules scoreRules = getScoreRules(tenantEntity); +// +// // 2. 获取成长值 +// addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); +// +// // 3. 增长的成长值 +// updateScore(user.getId(),tenantEntity, addScoreNumber); +// +// // 4. 记录历史 +// recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.WECHAT_PERSION); +// return addScoreNumber; +// } private int phoneAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { int addScoreNumber = 0; @@ -600,9 +600,9 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { case BIND_CAR:{ return bindCarAddScore(tenantEntity,wxCUserBasicInfo); } - case WECHAT_PERSION:{ - return personAddScore(tenantEntity,wxCUserBasicInfo); - } +// case WECHAT_PERSION:{ +// return personAddScore(tenantEntity,wxCUserBasicInfo); +// } case WECHAT_PHONE:{ return phoneAddScore(tenantEntity,wxCUserBasicInfo); } From ed0a486bfe61bb73cd7dd574d80906735b08f453 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 16 Dec 2020 17:39:30 +0800 Subject: [PATCH 02/56] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=98=B5=E7=A7=B0=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxScoreRulesServiceImpl.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java index d811e142f..376b599bc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java @@ -66,10 +66,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { " {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"数码家电\", \"businessId\": 11}," + " {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"其他\", \"businessId\": 6}]}," + " {\"id\": 3, \"desc\": \"绑定车牌1个\", \"step\": 1, \"limit\": 1, \"score\": 0}," + - " {\"id\": 5, \"desc\": \"授权个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}," + " {\"id\": 6, \"desc\": \"授权手机号\", \"step\": 1, \"limit\": 1, \"score\": 0}," + - " {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}," + - " {\"id\": 8, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]"); + " {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]"); wxScoreRules.setCreateDate(new Date()); wxScoreRules.setUpdateDate(new Date()); wxScoreRules.setType(2); @@ -93,7 +91,6 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { " {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"数码家电\", \"businessId\": 11}," + " {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"其他\", \"businessId\": 6}]}," + " {\"id\": 3, \"desc\": \"绑定车牌1个\", \"step\": 1, \"limit\": 1, \"score\": 0}," + - " {\"id\": 5, \"desc\": \"授权个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}," + " {\"id\": 6, \"desc\": \"授权手机号\", \"step\": 1, \"limit\": 1, \"score\": 0}," + " {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]"); wxScoreRules.setCreateDate(new Date()); From 42b320697493b7d945e90d73eb30fb0dd82cd857 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 17 Dec 2020 17:05:11 +0800 Subject: [PATCH 03/56] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=98=B5=E7=A7=B0=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/controller/BaseController.java | 119 +++++------- .../controller/WxUserGrantController.java | 34 +--- .../iformall/service/impl/PosServiceImpl.java | 172 +++++++++--------- .../service/impl/WxCUserServiceImpl.java | 6 +- .../impl/WxCreditHistoryServiceImpl.java | 6 +- 5 files changed, 145 insertions(+), 192 deletions(-) diff --git a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java index 84e3d4e95..62367cbae 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java @@ -5,7 +5,6 @@ import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.domain.po.base.BaseCUserEntity; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumAppPlat; import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.WxCUserBasicInfo; @@ -13,8 +12,6 @@ import com.iformall.exception.MallinkException; import com.iformall.service.CUserTokenService; import com.iformall.service.WxAppinfoService; import com.iformall.service.WxCUserBasicInfoService; -import com.iformall.service.WxCUserService; -import com.iformall.service.cuser.CUserServiceFactory; import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.Constant; import com.iformall.utils.IPUtil; @@ -22,10 +19,11 @@ import com.iformall.utils.MaUtil; import com.iformall.utils.RedisCacheUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.ValueOperations; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RestController; @@ -37,15 +35,14 @@ import java.beans.PropertyEditorSupport; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.concurrent.TimeUnit; @RestController public class BaseController { - @Autowired - private boolean isFmOpen; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - private WxCUserService wxCUserService; + private boolean isFmOpen; @Autowired private WxAppinfoService wxAppinfoService; @@ -104,17 +101,10 @@ public class BaseController { public String getFinalTenantId() { TenantEntity tenantEntity = getTenantInfo(); - String tenantId = tenantEntity.getTenantId(); return tenantEntity.getFinalTenantId(); } - -// public Long getUserId() { -// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); -// Long cUserId = (Long) request.getAttribute(Constant.LOGIN_USER_KEY); -// return cUserId; -// } - public Long getMemberId() throws Exception { + public Long getMemberId() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); Long memberId = (Long) request.getAttribute(Constant.LOGIN_MEMBER_KEY); if(memberId == null){ @@ -130,8 +120,7 @@ public class BaseController { public WxCUser getWxCUser() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); BaseCUserEntity baseuser = (BaseCUserEntity) request.getAttribute(Constant.REQUEST_C_USER_KEY); -// Long cUserId = getUserId(); -// WxCUser user = wxCUserService.getById(cUserId); + if (baseuser == null) { throw new MallinkException(ErrorCode.USER_IS_EMPTY); } @@ -190,14 +179,6 @@ public class BaseController { String shortKey = "webapp:short:member:"+memberId; RedisCacheUtils.removeCache(cuserBasicInfoTemplate, shortKey); } -// public WxCUserBasicInfo getMember() throws Exception { -// Long memberId = getMemberId(); -// WxCUserBasicInfo member = wxCUserBasicInfoService.getById(memberId); -// if (member == null) { -// throw new MallinkException(ErrorCode.USER_IS_EMPTY); -// } -// return member; -// } public WxAppinfo getAppInfo(String appId) { return wxAppinfoService.getByAppId(appId); @@ -236,62 +217,56 @@ public class BaseController { byId = wxCUserBasicInfoService.getById(userId,getFinalTenantId()); } -// List list = wxCUserBasicInfoService.findByPhone(tenantEntity, phone); WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, userPhone); if (basicInfo != null) { - if(byId != null && !byId.getPhone().equals(basicInfo.getPhone())){ - return Long.valueOf(-1); + if (byId != null) { + if (!byId.getId().equals(basicInfo.getId())) { + //数据库存在此手机号的会员,并且当前微信存在另一手机号会员 + logger.error("会员" + userId + "更换手机号时,当前手机号会员表已存在:" + userPhone); + return Long.valueOf(-1); + } } - if(!basicInfo.getTenantId().contains(","+tenantEntity.getTenantId()+",")){ - basicInfo.setTenantId(basicInfo.getTenantId()+tenantEntity.getTenantId()+","); - wxCUserBasicInfoService.update(basicInfo); + if (!basicInfo.getTenantId().contains("," + tenantEntity.getTenantId() + ",")) { + basicInfo.setTenantId(basicInfo.getTenantId() + tenantEntity.getTenantId() + ","); } -// WxCUserBasicInfo basicInfo = list.get(0); - // 微信名称,统一成微信昵称 -// if (!Objects.equals(basicInfo.getNickName(), user.getNickName())) { -// basicInfo.setNickName(user.getNickName()); -// } -// // 性别 -// if (basicInfo.getSex() == null) { -// basicInfo.setSex(user.getGender()); -// } -// // 成长值 -// if (Objects.nonNull(user.getScore())) { -// basicInfo.setPoins(user.getScore()); -// } -// // 积分 -// if (Objects.nonNull(user.getCredit())) { -// basicInfo.setCredit(user.getCredit()); -// } - //wxCUserBasicInfoService.updateObj(basicInfo, user); - return basicInfo.getId(); - } else if(byId != null){ - byId.setPhone(userPhone); - byId.setNickName(userName); - byId.setAvatarUrl(avatarUrl); - byId.setSex(sex); - wxCUserBasicInfoService.update(byId); - removeCacheMember(byId.getId()); - return byId.getId(); - }else{ - Date cur = new Date(); - basicInfo = new WxCUserBasicInfo(); - final IdWorker idWorker = IdWorker.get(); - basicInfo.setId(idWorker.nextId()); - basicInfo.setTenantId(","+tenantEntity.getTenantId()+","); - basicInfo.undateFinalTenantId(tenantEntity); - basicInfo.setPhone(userPhone); basicInfo.setNickName(userName); basicInfo.setAvatarUrl(avatarUrl); basicInfo.setSex(sex); - basicInfo.setLoginCount(1); - basicInfo.setActiveTime(cur); - basicInfo.setCreateDate(cur); - basicInfo.setUpdateDate(cur); - wxCUserBasicInfoService.save(basicInfo); + wxCUserBasicInfoService.update(basicInfo); removeCacheMember(basicInfo.getId()); return basicInfo.getId(); + } else { + if (byId != null) { + if (!byId.getTenantId().contains("," + tenantEntity.getTenantId() + ",")) { + byId.setTenantId(byId.getTenantId() + tenantEntity.getTenantId() + ","); + } + byId.setPhone(userPhone); + byId.setNickName(userName); + byId.setAvatarUrl(avatarUrl); + byId.setSex(sex); + wxCUserBasicInfoService.update(byId); + removeCacheMember(basicInfo.getId()); + return byId.getId(); + } else { + Date cur = new Date(); + basicInfo = new WxCUserBasicInfo(); + final IdWorker idWorker = IdWorker.get(); + basicInfo.setId(idWorker.nextId()); + basicInfo.setTenantId("," + tenantEntity.getTenantId() + ","); + basicInfo.setFinalTenantId(tenantEntity.getFinalTenantId()); + basicInfo.setPhone(userPhone); + basicInfo.setNickName(userName); + basicInfo.setAvatarUrl(avatarUrl); + basicInfo.setSex(sex); + basicInfo.setLoginCount(1); + basicInfo.setActiveTime(cur); + basicInfo.setCreateDate(cur); + basicInfo.setUpdateDate(cur); + wxCUserBasicInfoService.save(basicInfo); + removeCacheMember(basicInfo.getId()); + return basicInfo.getId(); + } } } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 7fcd4cfef..f61435b96 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -549,11 +549,6 @@ public class WxUserGrantController extends BaseController { if (user != null) { logger.debug(user.toString()); -// boolean bFirstNickName = false; -// if(StringUtils.isNoneEmpty(user.getNickName())) { -// bFirstNickName = true; -// } - WxMaService wxMaService = getWeappService(user.getAppId()); String session_key = user.getSessionKey(); @@ -592,13 +587,6 @@ public class WxUserGrantController extends BaseController { removeCacheCUser(); -// if(bFirstNickName) { -// // 首次获取昵称 -// // 成长值 -// wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.WECHAT_PERSION, user); -// //增加积分 -// wxCUserService.addCredit(user, EnumScoreType.WECHAT_PERSION); -// } resultMap.put("openId", user.getOpenId()); resultMap.put("unionId", user.getUnionId()); resultMap.put("msg", "获取用户信息成功!"); @@ -624,9 +612,9 @@ public class WxUserGrantController extends BaseController { @PostMapping("/getUserPhone") @ApiOperation(value = "授权后获取用户的手机号", notes = "{\"encryptedData\":\"string\",\"iv\":\"string\"}") public ResultData getUserPhone(@RequestBody Map map) { - logger.debug(map.toString()); + logger.info(map.toString()); TenantEntity tenantEntity = getTenantInfo(); - Map resultMap = new HashMap(); + String encryptedData = map.get("encryptedData"); String iv = map.get("iv"); @@ -638,6 +626,8 @@ public class WxUserGrantController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); } + Map resultMap = new HashMap(); + WxCUser user = getWxCUser(); if (user == null) { @@ -645,7 +635,7 @@ public class WxUserGrantController extends BaseController { } boolean isFirstPhone = false; - if(StringUtils.isBlank(user.getPhone())) { + if(user.getUserId() == null) { isFirstPhone = true; } @@ -660,18 +650,6 @@ public class WxUserGrantController extends BaseController { user.setPhone(phoneNoInfo.getPhoneNumber()); user.setPurePhone(phoneNoInfo.getPurePhoneNumber()); user.setCountryCode(phoneNoInfo.getCountryCode()); - if (isFirstPhone) { - //检查是否存在会员信息 如果有 赋值积分 -// WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, user.getPhone()); -// if (basicInfo != null ) { -// int credit = user.getCredit() == null ? 0 : user.getCredit(); -// int score = user.getScore() == null ? 0 : user.getScore(); -// int memScore = basicInfo.getPoins() == null ? 0 : basicInfo.getPoins(); -// int memCredit = basicInfo.getCredit() == null ? 0 : basicInfo.getCredit(); -// user.setCredit(memCredit + credit); -// user.setScore(memScore + score); -// } - } if (!user.getPhone().contains("*")) { // 用户手机非加密 String phone = user.getPhone(); @@ -685,6 +663,8 @@ public class WxUserGrantController extends BaseController { return new ResultData(ErrorCode.USER_PHONE_IS_FOUND); } user.setUserId(userBasicId); + }else{ + return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); } wxCUserService.saveOrUpdate(user); wxCUserService.delForUserIdOnly(user.getId(),user.getUserId(),user.getTenantId()); diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index 5bf051b72..4e588e0b3 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -1414,92 +1414,92 @@ public class PosServiceImpl implements PosService { return 0; } - /** - * 核销回退 - * @param couponOrderCVo - * @param buUserId - * @param posOrderId - */ - private void cancelVerify(WxCouponOrderCVo couponOrderCVo, Long buUserId, Long posOrderId) { - // 1. 积分历史回退 - try { - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setOperatorType(EnumUserType.BUSER.getCode()); - creditHistory.setOperatorId(buUserId); - creditHistory.setCUserId(couponOrderCVo.getcUserId()); -// creditHistory.updateTenantInfo(couponOrderCVo); - creditHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId()); - creditHistory.setTenantId(couponOrderCVo.getFinalTenantId()); - creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); - creditHistory.setCouponId(couponOrderCVo.getCouponId()); - int num = creditHistoryService.cancelCredit(creditHistory); - if (num <= 1) { - logger.warn("核销积分历史回退: " + creditHistory.toString()); - } - } catch (Exception e) { - String errMessage = "核销积分历史回退:" + e.getMessage(); - logger.error(errMessage); - throw new MallinkException(500, errMessage); - } - // 2. 成长值历史回退 - try { - WxScoreHistory scoreHistory = new WxScoreHistory(); -// scoreHistory.updateTenantInfo(couponOrderCVo); - scoreHistory.setTenantId(couponOrderCVo.getFinalTenantId()); - scoreHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId()); - scoreHistory.setScoreType(EnumScoreType.CONSUMPTION.getCode()); - scoreHistory.setCUserId(couponOrderCVo.getcUserId()); - scoreHistory.setOrderId(couponOrderCVo.getOrderId()); - int num = scoreRulesService.cancelScore(scoreHistory); - if (num <= 1) { - logger.warn("核销成长值历史回退: " + scoreHistory.toString()); - } - } catch (Exception e) { - String errMessage = "核销成长值历史回退:" + e.getMessage(); - logger.error(errMessage); - throw new MallinkException(500, errMessage); - } - - // 3. update posOrderId - PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); - posCouponOrderVerify.updateTenantInfo(couponOrderCVo); - posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); - posCouponOrderVerify.setPosOrderId(posOrderId); - posCouponOrderVerify.setState(EnumEnableType.Enable.getCode()); - List posCouponOrderVerifyList = posCouponOrderVerifyService.getList(posCouponOrderVerify); - if (posCouponOrderVerifyList.size() == 1) { - posCouponOrderVerify = posCouponOrderVerifyList.get(0); - if (posCouponOrderVerify != null) { - try { - posCouponOrderVerifyService.deleteById(posCouponOrderVerify.getId()); - } catch(Exception e){ - logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - } - } else { - logger.error(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL.getMessage() + ": " + posOrderId); - throw new MallinkException(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL); - } - // 4. update couponOrder - int num = 0; - try { - WxCouponOrder couponOrder = new WxCouponOrder(); - couponOrder.setId(couponOrderCVo.getId()); - couponOrder.updateTenantInfo(couponOrderCVo); - couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); - couponOrder.setUpdateDate(new Date()); - num = couponOrderMapper.cancelVerifyCouponOrder(couponOrder); - } catch (Exception e) { - logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - if (num != 1) { - logger.error("核销异常:updatete num " + num); - throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); - } - logger.info("核销已取消: " + couponOrderCVo.getId()); - } +// /** +// * 核销回退 +// * @param couponOrderCVo +// * @param buUserId +// * @param posOrderId +// */ +// private void cancelVerify(WxCouponOrderCVo couponOrderCVo, Long buUserId, Long posOrderId) { +// // 1. 积分历史回退 +// try { +// WxCreditHistory creditHistory = new WxCreditHistory(); +// creditHistory.setOperatorType(EnumUserType.BUSER.getCode()); +// creditHistory.setOperatorId(buUserId); +// creditHistory.setCUserId(couponOrderCVo.getcUserId()); +//// creditHistory.updateTenantInfo(couponOrderCVo); +// creditHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId()); +// creditHistory.setTenantId(couponOrderCVo.getFinalTenantId()); +// creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); +// creditHistory.setCouponId(couponOrderCVo.getCouponId()); +// int num = creditHistoryService.cancelCredit(creditHistory); +// if (num <= 1) { +// logger.warn("核销积分历史回退: " + creditHistory.toString()); +// } +// } catch (Exception e) { +// String errMessage = "核销积分历史回退:" + e.getMessage(); +// logger.error(errMessage); +// throw new MallinkException(500, errMessage); +// } +// // 2. 成长值历史回退 +// try { +// WxScoreHistory scoreHistory = new WxScoreHistory(); +//// scoreHistory.updateTenantInfo(couponOrderCVo); +// scoreHistory.setTenantId(couponOrderCVo.getFinalTenantId()); +// scoreHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId()); +// scoreHistory.setScoreType(EnumScoreType.CONSUMPTION.getCode()); +// scoreHistory.setCUserId(couponOrderCVo.getcUserId()); +// scoreHistory.setOrderId(couponOrderCVo.getOrderId()); +// int num = scoreRulesService.cancelScore(scoreHistory); +// if (num <= 1) { +// logger.warn("核销成长值历史回退: " + scoreHistory.toString()); +// } +// } catch (Exception e) { +// String errMessage = "核销成长值历史回退:" + e.getMessage(); +// logger.error(errMessage); +// throw new MallinkException(500, errMessage); +// } +// +// // 3. update posOrderId +// PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); +// posCouponOrderVerify.updateTenantInfo(couponOrderCVo); +// posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); +// posCouponOrderVerify.setPosOrderId(posOrderId); +// posCouponOrderVerify.setState(EnumEnableType.Enable.getCode()); +// List posCouponOrderVerifyList = posCouponOrderVerifyService.getList(posCouponOrderVerify); +// if (posCouponOrderVerifyList.size() == 1) { +// posCouponOrderVerify = posCouponOrderVerifyList.get(0); +// if (posCouponOrderVerify != null) { +// try { +// posCouponOrderVerifyService.deleteById(posCouponOrderVerify.getId()); +// } catch(Exception e){ +// logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +// } +// } +// } else { +// logger.error(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL.getMessage() + ": " + posOrderId); +// throw new MallinkException(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL); +// } +// // 4. update couponOrder +// int num = 0; +// try { +// WxCouponOrder couponOrder = new WxCouponOrder(); +// couponOrder.setId(couponOrderCVo.getId()); +// couponOrder.updateTenantInfo(couponOrderCVo); +// couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); +// couponOrder.setUpdateDate(new Date()); +// num = couponOrderMapper.cancelVerifyCouponOrder(couponOrder); +// } catch (Exception e) { +// logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +// } +// if (num != 1) { +// logger.error("核销异常:updatete num " + num); +// throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); +// } +// logger.info("核销已取消: " + couponOrderCVo.getId()); +// } @Override @Transactional(rollbackFor = Exception.class) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java index 5032b0eba..7ea0bb98a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java @@ -348,10 +348,10 @@ public class WxCUserServiceImpl implements WxCUserService { wxCreditHistory.setCreditType(enumScoreType.getCode()); wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); wxCreditHistory.setOperatorId(user.getUserId()); - wxCreditHistory.setCreditNum(user.getCredit()); - wxCreditHistory.setCreditAmount(user.getCredit()); +// wxCreditHistory.setCreditNum(user.getCredit()); +// wxCreditHistory.setCreditAmount(user.getCredit()); WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); - user.setCredit(record.getCreditAmount()); +// user.setCredit(record.getCreditAmount()); return record.getCreditAmount(); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index c2206c0cb..78da668bf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -212,13 +212,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); } int currentCreditAmount = 0; - //获取当前用户总积分规则:优先获取wxCUser中数据 若不存在 再获取wxCUserBasicInfo表中数据 + //获取当前用户总积分规则: if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() != null && wxCUserBasicInfo.getCredit() > 0) { currentCreditAmount = wxCUserBasicInfo.getCredit(); } - if (record.getCreditAmount() == null) { - record.setCreditAmount(currentCreditAmount); - } + record.setCreditAmount(currentCreditAmount); int creditChangeNumOrigin = creditIncrement(record); int creditChangeNum = creditChangeNumOrigin ; From 95a159e08ce907ab2a257f6e360388ff846b855c Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 18 Dec 2020 15:12:14 +0800 Subject: [PATCH 04/56] bug --- .../controller/base/BaseController.java | 2 + .../mem/WxCreditHistoryController.java | 18 ++++++++ .../controller/WxPressOrderController.java | 2 +- .../mapper/WxCreditHistoryMapper.java | 9 ++++ .../service/WxCreditHistoryService.java | 3 ++ .../impl/WxCreditHistoryServiceImpl.java | 31 +++++++++++++ .../WxMsgValidationcodeModelServiceImpl.java | 2 +- .../service/impl/WxParkServiceImpl.java | 2 +- .../impl/WxProjectConfigServiceImpl.java | 10 ++--- .../mapper/WxCreditHistoryMapper.xml | 43 +++++++++++++++++++ 10 files changed, 114 insertions(+), 8 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java index b8a9a9e29..37d7924ed 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java @@ -62,6 +62,7 @@ public class BaseController { /** * 返回租户信息 + * 集团版帐号tenantId为空,parentTenantId为集团tenantId * @return */ public TenantEntity getTenantInfo(){ @@ -76,6 +77,7 @@ public class BaseController { /** * 处理集团新增修改所需租户信息(广场独立修改,集团修改全部) + * 处理集团版 tenantId为空,parentTenantId为集团tenantId * ifParentUpdateTenantInfo */ public TenantEntity ifParentUpdateTenantInfo() { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index 177fcc784..aa40ebe74 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -2,6 +2,7 @@ package com.iformall.controller.mem; import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; +import com.iformall.annotation.TenantIgnore; import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; @@ -10,6 +11,7 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxCreditHistory; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxCreditHistoryVo; +import com.iformall.enums.EnumUserType; import com.iformall.exception.MallinkException; import com.iformall.service.WxCreditHistoryService; import io.swagger.annotations.ApiImplicitParam; @@ -146,4 +148,20 @@ public class WxCreditHistoryController extends BaseController { return wxCreditHistoryService.getCreditSummary(wxCreditHistory); } + + @TenantIgnore + @ApiOperation("积分清零计划") + @GetMapping("clearCreditByYear") + @SystemControllerLog(description = "积分清零计划") + public ResultData clearCreditByYear(@ModelAttribute WxCreditHistory wxCreditHistory) { + logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); + TenantEntity tenantInfo = getTenantInfo(); + wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); + wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId()); + wxCreditHistory.setOperatorId(getUserId()); + wxCreditHistory.setOperatorType(EnumUserType.MALLUSER.getCode()); + wxCreditHistoryService.clearCreditByYear(wxCreditHistory); + return new ResultData(Result.SUCCESS); + } + } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java index 2274a6b1e..9cf63bf74 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java @@ -68,7 +68,7 @@ public class WxPressOrderController extends BaseController { @ApiOperation(value = "参与砍价", notes = "{\"orderId\":\"String\"}") @PostMapping("pressOrderJoin") - @Transactional + @Transactional(rollbackFor = {Exception.class}) public ResultData pressOrderJoin(@RequestBody Map paramMap) { Date curDate = new Date(); String orderIdStr = paramMap.get("orderId"); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java index 0f34a83e3..65212b0e8 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java @@ -32,4 +32,13 @@ public interface WxCreditHistoryMapper extends CommonMapper wxCreditHistoryVoList = wxCreditHistoryMapper.findListMore(wxCreditHistory); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java index 66b01240e..c8fd705a8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java @@ -39,7 +39,7 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM WxMsgConfigMapper wxMsgConfigMapper; @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void wxMsgValidationcodeModelInit(String tenantId, String signature, String emailBgImg) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowTimestr = format.format(new Date()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java index 8d4560d0c..b10aaefc1 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java @@ -69,7 +69,7 @@ public class WxParkServiceImpl implements WxParkService { } @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void saveOrUpdate(WxPark record) { Date now = new Date(); if (record.getId() == null) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java index 7a873b924..3a5880555 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java @@ -69,7 +69,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { MallUserInfoService userInfoService; @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void initProjectConfig(Long id) { // WxProjectConfig wxProjectConfig = wxProjectConfigMapper.selectById(id); // if(wxProjectConfig!=null && wxProjectConfig.getDelType()<10000){ @@ -131,7 +131,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { } @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void initMall(WxMall wxMall) { if(wxMall.getId() == null){ wxMall.setTenantId("-1"); @@ -157,7 +157,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { } @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void initBuilding(List wxMallBuildings) { wxMallBuildingService.deleteByTenantId(wxMallBuildings.get(0).getTenantId()); wxMallFloorService.deleteByTenantId(wxMallBuildings.get(0).getTenantId()); @@ -185,7 +185,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { } @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void initPayAccount(WxPayAccount wxPayAccount) { wxPayAccountService.saveOrUpdate(wxPayAccount); WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxPayAccount.getTenantId()); @@ -218,7 +218,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { @Override - @Transactional + @Transactional(rollbackFor = {Exception.class}) public void initUserInfo(MallUserInfo userInfo) { userInfoService.saveOrUpdate(userInfo); //创建角色 diff --git a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml index 0d1ac2a46..de15576d3 100644 --- a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml @@ -262,4 +262,47 @@ delete from wx_credit_history where id = #{id} and tenant_id = #{tenantId} + + + + + CREATE TABLE `wx_credit_clear_md${tableSuffix}` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) DEFAULT NULL, + `final_tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `credit` int(11) DEFAULT NULL COMMENT '用户当前总积分', + `sum_credit` int(11) DEFAULT NULL COMMENT '用户当前清零截止时间后总积分', + `credit_amount` int(11) DEFAULT NULL COMMENT '用户清零扣减积分', + `cut_off_date` datetime(0) DEFAULT NULL COMMENT '清零截止时间', + PRIMARY KEY (`id`) USING BTREE + ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; + + + + insert into `wx_credit_clear_md${tableSuffix}` + (`id`, `user_id`, `final_tenant_id`, `credit`, `sum_credit`, `credit_amount`, `cut_off_date`) + select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id,wcubi.id user_id,wcubi.final_tenant_id,wcubi.credit,sum(wch.credit_amount) sum_credit,(sum(wch.credit_amount)-wcubi.credit) credit_amount,#{wxCreditHistory.endTime} cut_off_date + from wx_c_user_basic_info wcubi + left join wx_credit_history wch on wch.c_user_id = wcubi.id + where wcubi.final_tenant_id = #{wxCreditHistory.tenantId} and wch.credit_amount > 0 and wch.create_date >= #{wxCreditHistory.endTime} + group by wcubi.id + having credit > sum_credit; + + + + insert into `wx_credit_history` + (`id`, `tenant_id`, `c_user_id`, `credit_amount`, `credit_num`, `credit_type`, `create_date`, `operator_type`, `operator_id`) + select id,final_tenant_id,user_id,sum_credit,credit_amount,#{wxCreditHistory.creditType},#{wxCreditHistory.createDate},#{wxCreditHistory.operatorType},#{wxCreditHistory.operatorId} + from `wx_credit_clear_md${tableSuffix}`; + + + + + update wx_c_user_basic_info wcubi + left join `wx_credit_clear_md${tableSuffix}` wccm on wcubi.id = wccm.user_id + set wcubi.credit = (wcubi.credit + wccm.credit_amount), wcubi.update_date = now() + where wcubi.final_tenant_id = #{wxCreditHistory.tenantId} and wccm.id is not null; + + + From bebe741a94af294a7c63e6662298b8cc773a001d Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 18 Dec 2020 19:01:13 +0800 Subject: [PATCH 05/56] bug --- .../mem/WxCreditHistoryController.java | 33 +++++---------- .../mapper/WxCreditHistoryMapper.java | 8 +--- .../impl/WxCreditHistoryServiceImpl.java | 21 +++------- .../mapper/WxCUserBasicInfoMapper.xml | 2 +- .../mapper/WxCreditHistoryMapper.xml | 42 +------------------ 5 files changed, 21 insertions(+), 85 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index aa40ebe74..2d3bf8cab 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -81,10 +81,12 @@ public class WxCreditHistoryController extends BaseController { public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); MallUserInfo user = getUser(); - //wxCreditHistory.updateTenantInfo(user); + wxCreditHistory.setTenantId(user.getFinalTenantId()); wxCreditHistory.setFinalTenantId(user.getFinalTenantId()); wxCreditHistory.setOperatorId(user.getId()); + + wxCreditHistory.setOperatorType(EnumUserType.MALLUSER.getCode()); try { wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); @@ -118,13 +120,6 @@ public class WxCreditHistoryController extends BaseController { @GetMapping("exportData") @SystemControllerLog(description = "积分历史-导出数据") public void exportData(@ModelAttribute WxCreditHistory wxCreditHistory, HttpServletRequest request, HttpServletResponse response) { -// wxCreditHistory.updateTenantInfo(getTenantInfo()); -// TenantEntity tenantEntity = ifParentUpdateTenantInfo(); -// if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ -// wxCreditHistory.setTenantId(tenantEntity.getParentTenantId()); -// }else{ -// wxCreditHistory.setTenantId(tenantEntity.getTenantId()); -// } wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId()); wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId()); wxCreditHistoryService.exportData(request, response, wxCreditHistory); @@ -135,13 +130,6 @@ public class WxCreditHistoryController extends BaseController { @SystemControllerLog(description = "积分历史-积分统计概览") public ResultData getCreditSummary(@ModelAttribute WxCreditHistory wxCreditHistory) { logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::getCreditSummary"); -// wxCreditHistory.updateTenantInfo(getTenantInfo()); -// TenantEntity tenantEntity = ifParentUpdateTenantInfo(); -// if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ -// wxCreditHistory.setTenantId(tenantEntity.getParentTenantId()); -// }else{ -// wxCreditHistory.setTenantId(tenantEntity.getTenantId()); -// } TenantEntity tenantInfo = getTenantInfo(); wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId()); @@ -151,15 +139,16 @@ public class WxCreditHistoryController extends BaseController { @TenantIgnore @ApiOperation("积分清零计划") - @GetMapping("clearCreditByYear") + @PostMapping("clearCreditByYear") @SystemControllerLog(description = "积分清零计划") - public ResultData clearCreditByYear(@ModelAttribute WxCreditHistory wxCreditHistory) { + public ResultData clearCreditByYear(@RequestBody WxCreditHistory wxCreditHistory) { logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); - TenantEntity tenantInfo = getTenantInfo(); - wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); - wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId()); - wxCreditHistory.setOperatorId(getUserId()); - wxCreditHistory.setOperatorType(EnumUserType.MALLUSER.getCode()); + if(wxCreditHistory == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; + } + if(StringUtils.isBlank(wxCreditHistory.getFinalTenantId())){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; + } wxCreditHistoryService.clearCreditByYear(wxCreditHistory); return new ResultData(Result.SUCCESS); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java index 65212b0e8..4f5ec223a 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java @@ -34,11 +34,5 @@ public interface WxCreditHistoryMapper extends CommonMapper= points and tenant_id=wcubi.final_tenant_id - order by points desc limit 1 ) level,wcubi.status + order by points desc limit 1 ) level,wcubi.score_date,wcubi.status diff --git a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml index de15576d3..f99dd8ae7 100644 --- a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml @@ -263,46 +263,8 @@ - - - - CREATE TABLE `wx_credit_clear_md${tableSuffix}` ( - `id` bigint(20) NOT NULL, - `user_id` bigint(20) DEFAULT NULL, - `final_tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `credit` int(11) DEFAULT NULL COMMENT '用户当前总积分', - `sum_credit` int(11) DEFAULT NULL COMMENT '用户当前清零截止时间后总积分', - `credit_amount` int(11) DEFAULT NULL COMMENT '用户清零扣减积分', - `cut_off_date` datetime(0) DEFAULT NULL COMMENT '清零截止时间', - PRIMARY KEY (`id`) USING BTREE - ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; + + {call user_credit_clear(#{cutOffDate},#{finalTableIndex})} - - insert into `wx_credit_clear_md${tableSuffix}` - (`id`, `user_id`, `final_tenant_id`, `credit`, `sum_credit`, `credit_amount`, `cut_off_date`) - select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id,wcubi.id user_id,wcubi.final_tenant_id,wcubi.credit,sum(wch.credit_amount) sum_credit,(sum(wch.credit_amount)-wcubi.credit) credit_amount,#{wxCreditHistory.endTime} cut_off_date - from wx_c_user_basic_info wcubi - left join wx_credit_history wch on wch.c_user_id = wcubi.id - where wcubi.final_tenant_id = #{wxCreditHistory.tenantId} and wch.credit_amount > 0 and wch.create_date >= #{wxCreditHistory.endTime} - group by wcubi.id - having credit > sum_credit; - - - - insert into `wx_credit_history` - (`id`, `tenant_id`, `c_user_id`, `credit_amount`, `credit_num`, `credit_type`, `create_date`, `operator_type`, `operator_id`) - select id,final_tenant_id,user_id,sum_credit,credit_amount,#{wxCreditHistory.creditType},#{wxCreditHistory.createDate},#{wxCreditHistory.operatorType},#{wxCreditHistory.operatorId} - from `wx_credit_clear_md${tableSuffix}`; - - - - - update wx_c_user_basic_info wcubi - left join `wx_credit_clear_md${tableSuffix}` wccm on wcubi.id = wccm.user_id - set wcubi.credit = (wcubi.credit + wccm.credit_amount), wcubi.update_date = now() - where wcubi.final_tenant_id = #{wxCreditHistory.tenantId} and wccm.id is not null; - - - From 301b591934073895c6bb03b07148fec3d1c22439 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 21 Dec 2020 18:01:07 +0800 Subject: [PATCH 06/56] bug --- .../java/com/iformall/domain/po/base/BaseTenantEntity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java index 9da453fea..960255d94 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java @@ -26,7 +26,10 @@ public class BaseTenantEntity extends BaseEntity { protected String finalTenantId; public String getFinalTenantId() { - return finalTenantId; + if (!StringUtils.isBlank(parentTenantId)) { + return parentTenantId; + } + return tenantId; } public void setFinalTenantId(String finalTenantId) { From 474b07920d0830226c2250c1d61b68d77fd7f3a9 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 21 Dec 2020 18:15:54 +0800 Subject: [PATCH 07/56] bug --- .../main/java/com/iformall/mapper/WxCreditHistoryMapper.java | 2 +- .../com/iformall/service/impl/WxCreditHistoryServiceImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java index 4f5ec223a..c7511943d 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java @@ -34,5 +34,5 @@ public interface WxCreditHistoryMapper extends CommonMapper Date: Mon, 21 Dec 2020 18:20:19 +0800 Subject: [PATCH 08/56] bug --- .../com/iformall/service/impl/WxCreditHistoryServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index 706b9846f..1c3de6577 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -99,12 +99,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { * @param */ @Override - @Transactional(rollbackFor=Exception.class) public void clearCreditByYear(WxCreditHistory wxCreditHistory) { if(wxCreditHistory.getEndTime() == null){ wxCreditHistory.setEndTime(new Date()); } String tableSuffix = "_" + Integer.parseInt(wxCreditHistory.getFinalTenantId())%100; + logger.info("为什么报错-----"+dateFormat.format(wxCreditHistory.getEndTime())+"---"+tableSuffix); wxCreditHistoryMapper.userCreditClear(dateFormat.format(wxCreditHistory.getEndTime()),tableSuffix); } From cc49a7c0421d41e6a8a065d25a0a78cc80ce8b17 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 21 Dec 2020 18:20:45 +0800 Subject: [PATCH 09/56] bug --- .../com/iformall/service/impl/WxCreditHistoryServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index 1c3de6577..cc636f1f8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -104,7 +104,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { wxCreditHistory.setEndTime(new Date()); } String tableSuffix = "_" + Integer.parseInt(wxCreditHistory.getFinalTenantId())%100; - logger.info("为什么报错-----"+dateFormat.format(wxCreditHistory.getEndTime())+"---"+tableSuffix); + logger.info("---------"+dateFormat.format(wxCreditHistory.getEndTime())+"---"+tableSuffix); wxCreditHistoryMapper.userCreditClear(dateFormat.format(wxCreditHistory.getEndTime()),tableSuffix); } From 5777f1cbdc9f211d2cff3863811bc4ddf31b2bd7 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 09:53:13 +0800 Subject: [PATCH 10/56] bug --- .../controller/mem/WxCreditHistoryController.java | 4 ++-- .../iformall/service/impl/WxOrderServiceImpl.java | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index 2d3bf8cab..86539149b 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -139,9 +139,9 @@ public class WxCreditHistoryController extends BaseController { @TenantIgnore @ApiOperation("积分清零计划") - @PostMapping("clearCreditByYear") + @GetMapping("clearCreditByYear") @SystemControllerLog(description = "积分清零计划") - public ResultData clearCreditByYear(@RequestBody WxCreditHistory wxCreditHistory) { + public ResultData clearCreditByYear(@ModelAttribute WxCreditHistory wxCreditHistory) { logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); if(wxCreditHistory == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index d8f3d3a75..a9b7c601d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -460,18 +460,29 @@ public class WxOrderServiceImpl implements WxOrderService { try { WxOrder orderQ = new WxOrder(); orderQ.setTenantId(subTenantId); - orderQ.setType(EnumOrderType.COUPON.getCode()); +// orderQ.setType(EnumOrderType.COUPON.getCode()); orderQ.setCUserId(cuserId); List statusS = new ArrayList<>(); statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_REFUND_FAILD.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_CANCEL.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); + + statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_SCHEDU_REFUND.getCode()); + statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode()); + orderQ.setStatusS(statusS); return wxOrderMapper.countCouponConditionType1(orderQ); } catch (Exception e) { From b9ae7babfeeb67501b415e555778b2562dbe72c4 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 10:27:35 +0800 Subject: [PATCH 11/56] bug --- .../com/iformall/controller/mem/WxCreditHistoryController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index 86539149b..4dbf6f924 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -137,7 +137,6 @@ public class WxCreditHistoryController extends BaseController { } - @TenantIgnore @ApiOperation("积分清零计划") @GetMapping("clearCreditByYear") @SystemControllerLog(description = "积分清零计划") From ff21196dd8e07e6e4154326112f68e167fb0f065 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 10:28:45 +0800 Subject: [PATCH 12/56] bug --- mallinkService/src/main/resources/mapper/WxOrderMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index d409f1fee..c01c32150 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -149,7 +149,7 @@ select count(*) from wx_order o,wx_coupon c where o.product_id = c.id and c.conditions is not null - and JSON_EXTRACT(c.conditions, '$.type') = 1 + /*and JSON_EXTRACT(c.conditions, '$.type') = 1*/ and o.c_user_id = #{cUserId} From 28a1fd4c32432776039f71d89abf001b51f760d1 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 11:33:11 +0800 Subject: [PATCH 13/56] bug --- .../controller/basic/WxProjectConfigController.java | 8 ++++---- .../src/main/java/com/iformall/common/ErrorCode.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java index f8f4ee0ff..36a723781 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java @@ -689,10 +689,10 @@ public class WxProjectConfigController extends BaseController { }else{ subTenantIdStrs = StringUtils.join(subTenantIds, ','); } - TenantEntity TenantEntity = new TenantEntity(){{ - setTenantId(tenantId); - }}; - WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity); + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(tenantId); + + WxMall parentWxMall = wxMallService.getByTenantInfo(tenantEntity); if(parentWxMall == null || parentWxMall.getSaleType() != 100 || !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) || StringUtils.isNotBlank(parentWxMall.getParentTenantId())){ diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 2cc59dbc3..e0cd67f52 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -137,7 +137,7 @@ public enum ErrorCode{ PUSH_LIMIT_NOT_INRANG(2042, "不在疲劳度允许的时间段"), COUPON_ONLY_FOR_NEW_MEMBER(2044, "您已经参加过新会员活动"), - COUPON_ALREADY_IN_NEW_MEMBER(2045, "您正在参加别的新会员活动"), + COUPON_ALREADY_IN_NEW_MEMBER(2045, "您已经不是新用户"), COUPON_VALID_NOT_SUPPORTED(2046, "券类型不支持"), /** * 车流 2040 From 997f589efa15aea516f3c2672047b608836abbb5 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 12:19:29 +0800 Subject: [PATCH 14/56] bug --- .../com/iformall/controller/mem/WxCreditHistoryController.java | 1 + .../com/iformall/service/impl/WxCreditHistoryServiceImpl.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index 4dbf6f924..7cd88acfb 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -140,6 +140,7 @@ public class WxCreditHistoryController extends BaseController { @ApiOperation("积分清零计划") @GetMapping("clearCreditByYear") @SystemControllerLog(description = "积分清零计划") + @TenantIgnore public ResultData clearCreditByYear(@ModelAttribute WxCreditHistory wxCreditHistory) { logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); if(wxCreditHistory == null){ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index cc636f1f8..20678c6ab 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -98,6 +99,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { /** * @param */ + @Async @Override public void clearCreditByYear(WxCreditHistory wxCreditHistory) { if(wxCreditHistory.getEndTime() == null){ From b986892708fec1916322cda6aa41d9d891d7408f Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 15:55:38 +0800 Subject: [PATCH 15/56] bug CESHI --- .../basic/WxProjectConfigController.java | 93 +++++++++---------- .../mem/WxCreditHistoryController.java | 4 +- .../mapper/WxCreditHistoryMapper.java | 2 +- .../impl/WxCreditHistoryServiceImpl.java | 6 +- .../mapper/WxCreditHistoryMapper.xml | 1 - .../shard/plugin/ShardingSpherePlugin.java | 8 +- 6 files changed, 56 insertions(+), 58 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java index 36a723781..c62d18daf 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java @@ -149,10 +149,10 @@ public class WxProjectConfigController extends BaseController { if(wxMall.getId() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } - TenantEntity TenantEntity = new TenantEntity(){{ - setTenantId(wxMall.getId().toString()); - }}; - WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity); + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(wxMall.getId().toString()); + + WxMall parentWxMall = wxMallService.getByTenantInfo(tenantEntity); if(parentWxMall == null || parentWxMall.getSaleType() != 100 || !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) || StringUtils.isNotBlank(parentWxMall.getParentTenantId())){ @@ -558,74 +558,72 @@ public class WxProjectConfigController extends BaseController { map.put("wxMall",wxMall); List subWxMall = wxMallService.getSubByParentTenantId(wxMall.getTenantId()); map.put("subWxMall",subWxMall); - WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(); + wxCouponSendConfig.setTenantId(wxMall.getTenantId()); List wxCouponSendConfigList = wxCouponSendConfigService.findList(wxCouponSendConfig); map.put("wxCouponSendConfigList",wxCouponSendConfigList); - WxScoreRules wxScoreRules = new WxScoreRules(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxScoreRules wxScoreRules = new WxScoreRules(); + wxScoreRules.setTenantId(wxMall.getTenantId()); List wxScoreRulesList = wxScoreRulesService.findList(wxScoreRules); map.put("wxScoreRulesList",wxScoreRulesList); - WxTemplateMsg wxTemplateMsg = new WxTemplateMsg(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxTemplateMsg wxTemplateMsg = new WxTemplateMsg(); + wxTemplateMsg.setTenantId(wxMall.getTenantId()); + List wxTemplateMsgList = wxTemplateMsgService.findList(wxTemplateMsg); map.put("wxTemplateMsgList",wxTemplateMsgList); - WxQuestion wxQuestion = new WxQuestion(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxQuestion wxQuestion = new WxQuestion(); + wxQuestion.setTenantId(wxMall.getTenantId()); + List wxQuestionList = wxQuestionService.findList(wxQuestion); map.put("wxQuestionList",wxQuestionList); - WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); + wxMsgValidationcodeModel.setTenantId(wxMall.getTenantId()); + List wxMsgValidationcodeModelList = wxMsgValidationcodeModelService.findList(wxMsgValidationcodeModel); map.put("wxMsgValidationcodeModelList",wxMsgValidationcodeModelList); - WxFlowConfig wxFlowConfig = new WxFlowConfig(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxFlowConfig wxFlowConfig = new WxFlowConfig(); + wxFlowConfig.setTenantId(wxMall.getTenantId()); + List wxFlowConfigList = wxFlowConfigService.findList(wxFlowConfig); map.put("wxFlowConfigList",wxFlowConfigList); - TenantEntity tenantEntity = new TenantEntity() {{ - setTenantId(wxMall.getTenantId()); - }}; + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(wxMall.getTenantId()); + ResultData wxMallBuildingFloorList = wxMallBuildingService.getBuildingFloorList(tenantEntity); map.put("wxMallBuildingFloorList",wxMallBuildingFloorList.data); WxPayAccount wxPayAccount = wxPayAccountService.getByTenantId(wxMall.getTenantId()); map.put("wxPayAccount",wxPayAccount); WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxMall.getTenantId()); map.put("wxPayAccountBill",wxPayAccountBill); - WxAppinfo wxAppinfo = new WxAppinfo() {{ - setTenantId(wxMall.getTenantId()); - }}; + WxAppinfo wxAppinfo = new WxAppinfo(); + wxAppinfo.setTenantId(wxMall.getTenantId()); + List wxAppinfoList = wxAppinfoService.getList(wxAppinfo); map.put("wxAppinfoList",wxAppinfoList); - MallUserInfo mallUserInfo = new MallUserInfo() {{ - setTenantId(wxMall.getTenantId()); - setIsAdmin(1); - }}; + MallUserInfo mallUserInfo = new MallUserInfo(); + mallUserInfo.setTenantId(wxMall.getTenantId()); + mallUserInfo. setIsAdmin(1); + List mallUserInfoList = mallUserInfoService.findList(mallUserInfo); map.put("mallUserInfoList",mallUserInfoList); - WxMsgConfig wxMsgConfig = new WxMsgConfig() {{ - setTenantId(wxMall.getTenantId()); - }}; + WxMsgConfig wxMsgConfig = new WxMsgConfig(); + wxMsgConfig.setTenantId(wxMall.getTenantId()); + WxMsgConfig wxMsgConfigObject = wxMsgConfigService.findObject(wxMsgConfig); map.put("wxMsgConfig",wxMsgConfigObject); - WxPark wxPark = new WxPark(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxPark wxPark = new WxPark(); + wxPark.setTenantId(wxMall.getTenantId()); + WxPark wxParkObj = wxParkService.getByObj(wxPark); map.put("wxPark",wxParkObj); - WxWiWideInfo wxWiWideInfo = new WxWiWideInfo(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxWiWideInfo wxWiWideInfo = new WxWiWideInfo(); + wxWiWideInfo.setTenantId(wxMall.getTenantId()); + WxWiWideInfo wxWiWideInfoObject = wxWiWideInfoService.findObject(wxWiWideInfo); map.put("wxWiWideInfo",wxWiWideInfoObject); - WxWeappInfo wxWeappInfo = new WxWeappInfo(){{ - setTenantId(wxMall.getTenantId()); - }}; + WxWeappInfo wxWeappInfo = new WxWeappInfo(); + wxWeappInfo.setTenantId(wxMall.getTenantId()); + List wxAuthorizerInfoList = wxAuthorizerInfoService.getList(wxWeappInfo); map.put("wxAuthorizerInfoList",wxAuthorizerInfoList); @@ -652,10 +650,9 @@ public class WxProjectConfigController extends BaseController { // if(subTenantIds == null || subTenantIds.length == 0){ // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); // } - TenantEntity TenantEntity = new TenantEntity(){{ - setTenantId(tenantId); - }}; - WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity); + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(tenantId); + WxMall parentWxMall = wxMallService.getByTenantInfo(tenantEntity); if(parentWxMall == null || parentWxMall.getSaleType() != 100 || !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) || StringUtils.isNotBlank(parentWxMall.getParentTenantId())){ diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index 7cd88acfb..47523890e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -138,10 +138,10 @@ public class WxCreditHistoryController extends BaseController { @ApiOperation("积分清零计划") - @GetMapping("clearCreditByYear") + @PostMapping("clearCreditByYear") @SystemControllerLog(description = "积分清零计划") @TenantIgnore - public ResultData clearCreditByYear(@ModelAttribute WxCreditHistory wxCreditHistory) { + public ResultData clearCreditByYear(@RequestBody WxCreditHistory wxCreditHistory) { logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); if(wxCreditHistory == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java index c7511943d..6d8994969 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java @@ -33,6 +33,6 @@ public interface WxCreditHistoryMapper extends CommonMapper - {call user_credit_clear(#{cutOffDate},#{finalTableIndex})} diff --git a/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java b/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java index 574d6cd2c..e69fec026 100644 --- a/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java +++ b/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java @@ -94,10 +94,10 @@ public class ShardingSpherePlugin implements MyBatisPlus { //if (method != null) { // IgnoreSharding ignore = method.getAnnotation(IgnoreSharding.class); // if (null == ignore) { - Object parameterObject = metaStatementHandler.getValue("delegate.boundSql.parameterObject"); - BoundSql boundSql = statementHandler.getBoundSql(); - String newSQL = buildTable(boundSql,parameterObject,chainMap); - metaStatementHandler.setValue("delegate.boundSql.sql", newSQL); +// Object parameterObject = metaStatementHandler.getValue("delegate.boundSql.parameterObject"); +// BoundSql boundSql = statementHandler.getBoundSql(); +// String newSQL = buildTable(boundSql,parameterObject,chainMap); +// metaStatementHandler.setValue("delegate.boundSql.sql", newSQL); // } //} //没有添加字段,只是根据字段分表,没有别的需要返回 From c7a2e0a2b0a06cf90499831d197c6aadb08a3637 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 16:55:08 +0800 Subject: [PATCH 16/56] bug CESHI --- .../plugin/shard/plugin/ShardingSpherePlugin.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java b/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java index e69fec026..60927c9de 100644 --- a/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java +++ b/mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java @@ -14,6 +14,7 @@ import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.logging.LogFactory; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.StatementType; import org.apache.ibatis.plugin.*; import org.apache.ibatis.reflection.MetaObject; import org.apache.ibatis.reflection.SystemMetaObject; @@ -86,7 +87,11 @@ public class ShardingSpherePlugin implements MyBatisPlus { MetaObject metaStatementHandler = SystemMetaObject.forObject(statementHandler); MappedStatement ms = (MappedStatement) metaStatementHandler.getValue("delegate.mappedStatement"); - //String id = ms.getId(); + if(ms.getStatementType().equals(StatementType.CALLABLE)){ + return chainMap; + } + + //String id = ms.getId(); //String className = id.substring(0, id.lastIndexOf(".")); //String methodName = id.substring(id.lastIndexOf(".") + 1); //Class clazz = Class.forName(className); @@ -94,10 +99,10 @@ public class ShardingSpherePlugin implements MyBatisPlus { //if (method != null) { // IgnoreSharding ignore = method.getAnnotation(IgnoreSharding.class); // if (null == ignore) { -// Object parameterObject = metaStatementHandler.getValue("delegate.boundSql.parameterObject"); -// BoundSql boundSql = statementHandler.getBoundSql(); -// String newSQL = buildTable(boundSql,parameterObject,chainMap); -// metaStatementHandler.setValue("delegate.boundSql.sql", newSQL); + Object parameterObject = metaStatementHandler.getValue("delegate.boundSql.parameterObject"); + BoundSql boundSql = statementHandler.getBoundSql(); + String newSQL = buildTable(boundSql,parameterObject,chainMap); + metaStatementHandler.setValue("delegate.boundSql.sql", newSQL); // } //} //没有添加字段,只是根据字段分表,没有别的需要返回 From dd452a3ddcaac0d8d74ae9733c33a3c36432475d Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 22 Dec 2020 17:07:22 +0800 Subject: [PATCH 17/56] bug CESHI --- mallinkService/src/main/resources/mapper/WxMallMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxMallMapper.xml b/mallinkService/src/main/resources/mapper/WxMallMapper.xml index 4c6e4aa75..0c2af3589 100644 --- a/mallinkService/src/main/resources/mapper/WxMallMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMallMapper.xml @@ -205,7 +205,7 @@ + + + + select - from wx_c_user_car + from wx_c_user_car wcuc + left join wx_c_user_basic_info wcubi on wcubi.id = wcuc.c_user_id + + and wcubi.`phone` = like concat('%', #{userPhone},'%') + From 4496d93ea35c903a1fba67e1dafe3118995115cc Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 25 Dec 2020 18:05:17 +0800 Subject: [PATCH 21/56] chepai --- .../com/iformall/controller/WxCUserController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java index 45c182949..7a6c2f544 100755 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java @@ -119,7 +119,7 @@ public class WxCUserController extends BaseController { wxCUserBasicInfoService.update(wxCUserBasicInfo); wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); //增加积分 - addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); + addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); //新增来自B端的会员关联数据 wxCUserFromB = new WxCUserFromB(); @@ -180,7 +180,7 @@ public class WxCUserController extends BaseController { wxCUserBasicInfoService.update(wxCUserBasicInfo); wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); //增加积分 - addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); + addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); //更新B端来源会员 wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); @@ -189,12 +189,12 @@ public class WxCUserController extends BaseController { return new ResultData(); } - private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId, TenantEntity tenantEntity) { + private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId) { WxCreditHistory wxCreditHistory = new WxCreditHistory(); wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); // wxCreditHistory.updateTenantInfo(tenantEntity); - wxCreditHistory.setTenantId(tenantEntity.getFinalTenantId()); - wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId()); + wxCreditHistory.setTenantId(wxCUserBasicInfo.getFinalTenantId()); + wxCreditHistory.setFinalTenantId(wxCUserBasicInfo.getFinalTenantId()); wxCreditHistory.setCreateDate(new Date()); wxCreditHistory.setCreditType(enumScoreType.getCode()); wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); From 5e235864e1ad017bd423fb63c23d823ada8dcbca Mon Sep 17 00:00:00 2001 From: xhxu Date: Sat, 26 Dec 2020 13:05:39 +0800 Subject: [PATCH 22/56] chepai --- .../controller/WxCUserController.java | 228 +++++++++++------- .../controller/WxCreditHistoryController.java | 4 + .../iformall/domain/po/WxCUserBasicInfo.java | 2 + .../mapper/WxCUserBasicInfoMapper.xml | 21 ++ 4 files changed, 172 insertions(+), 83 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java index 7a6c2f544..e448cee9c 100755 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java @@ -13,6 +13,7 @@ import com.iformall.enums.EnumAssignTagsTrigger; import com.iformall.enums.EnumScoreType; import com.iformall.enums.EnumUserType; import com.iformall.service.*; +import com.iformall.utils.Constant; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -23,6 +24,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -35,7 +37,6 @@ import java.util.List; public class WxCUserController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired private WxCUserBasicInfoService wxCUserBasicInfoService; @@ -48,6 +49,9 @@ public class WxCUserController extends BaseController { @Autowired private WxMerchantBUserService wxMerchantBUserService; + @Autowired + private WxMerchantService wxMerchantService; + @Autowired private WxCUserFromBService wxCUserFromBService; @@ -57,7 +61,6 @@ public class WxCUserController extends BaseController { @Autowired private WxCreditHistoryService wxCreditHistoryService; - /** * 会员更新信息 * @@ -76,70 +79,126 @@ public class WxCUserController extends BaseController { if (StringUtils.isEmpty(wxCUserFromBDto.getAppId())) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端appId不能为空"); } - if (wxCUserFromBDto.getUserId() == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "bUserId不能为空"); + if (StringUtils.isEmpty(wxCUserFromBDto.getPhone())) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端手机号不能为空"); } +// if (wxCUserFromBDto.getUserId() == null) { +// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "bUserId不能为空"); +// } //根据bUserId查询B端用户是否存在 - WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getUserId()); +// WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getUserId()); + WxMerchantBUser bUser = getLoginBUser(); if (bUser == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "B端用户不存在"); } + WxMerchant wxMerchant = wxMerchantService.getById(bUser.getMerchantId()); + if (wxMerchant == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "商户不存在"); + } final IdWorker idWorker = IdWorker.get(); WxCUserFromB wxCUserFromB = wxCUserFromBService.getByOpenidAndAppId(wxCUserFromBDto); - //查询C端微信信息 WxCUser wxCUser = new WxCUser(); wxCUser.setAppId(wxCUserFromBDto.getAppId()); wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); wxCUser = wxCUserService.getByOpenId(wxCUser); - if (wxCUserFromB == null) { - //TODO phone可能为空 - String phone = wxCUser.getPhone(); - - WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.findInfoByPhone(bUser, phone); - //查询会员信息 - //List byPhone = wxCUserBasicInfoService.findByPhone(bUser, phone); - //存在会员信息 - if (wxCUserBasicInfo != null) { - //更新会员信息 - if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { - wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); - } - if (wxCUserFromBDto != null) { - wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); - } - if (wxCUserFromBDto.getSex() != null) { - wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); + + boolean isAddCredit = false; + WxCUserBasicInfo wxCUserBasicInfo = null; + + if(wxCUserFromB != null){ + wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),bUser.getFinalTenantId()); + if (!wxCUserBasicInfo.getPhone().equals(wxCUserFromBDto.getPhone())){ + wxCUser.setPhone(wxCUserFromBDto.getPhone()); + wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); + } + if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { + if(StringUtils.isEmpty(wxCUserBasicInfo.getName())){ + isAddCredit = true; } - if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { - wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); + wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); + } + if (wxCUserFromBDto.getBirthdate() != null) { + wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); + } + if (wxCUserFromBDto.getSex() != null) { + wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); + } + if (StringUtils.isNotEmpty(wxCUserFromBDto.getAddress())) { + wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); + } + wxCUserBasicInfoService.update(wxCUserBasicInfo); + + }else{ + wxCUserFromB = new WxCUserFromB(); + if(wxCUser != null){ + if(wxCUser.getUserId() != null){ + wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUser.getUserId(),wxCUser.getFinalTenantId()); + if (!wxCUserBasicInfo.getPhone().equals(wxCUserFromBDto.getPhone())){ + wxCUser.setPhone(wxCUserFromBDto.getPhone()); + wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); + } + if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { + if(StringUtils.isEmpty(wxCUserBasicInfo.getName())){ + isAddCredit = true; + } + wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); + } + if (wxCUserFromBDto.getBirthdate() != null) { + wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); + } + if (wxCUserFromBDto.getSex() != null) { + wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); + } + if (StringUtils.isNotEmpty(wxCUserFromBDto.getAddress())) { + wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); + } + wxCUserBasicInfoService.update(wxCUserBasicInfo); + + wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); + wxCUserFromB.setCUserId(wxCUserBasicInfo.getId()); + wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); + wxCUserFromB.setMerchantId(bUser.getMerchantId()); + wxCUserFromB.updateTenantInfo(bUser); + wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); + wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); + }else{ + isAddCredit = true; + wxCUserBasicInfo = new WxCUserBasicInfo(); + wxCUserBasicInfo.setId(idWorker.nextId()); + wxCUserBasicInfo.setTenantId("," + wxCUser.getTenantId() + ","); + wxCUserBasicInfo.setFinalTenantId(wxCUser.getFinalTenantId()); + wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); + if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { + wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); + } + if (wxCUserFromBDto.getBirthdate() != null) { + wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); + } + if (wxCUserFromBDto.getSex() != null) { + wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); + } + if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { + wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); + } + wxCUserBasicInfo.setLoginCount(1); + wxCUserBasicInfo.setActiveTime(new Date()); + wxCUserBasicInfo.setCreateDate(new Date()); + wxCUserBasicInfo.setUpdateDate(new Date()); + wxCUserBasicInfoService.save(wxCUserBasicInfo); + } - wxCUserBasicInfo.setPhone(wxCUser.getPhone()); - wxCUserBasicInfo.setUpdateDate(new Date()); - wxCUserBasicInfoService.update(wxCUserBasicInfo); - wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); - //增加积分 - addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); - wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); - //新增来自B端的会员关联数据 - wxCUserFromB = new WxCUserFromB(); - wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); - wxCUserFromB.setCUserId(wxCUserBasicInfo.getId()); - wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); - wxCUserFromB.setMerchantId(bUser.getMerchantId()); - wxCUserFromB.updateTenantInfo(bUser); - wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); - wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); - wxCUserFromBService.saveOrUpdate(wxCUserFromB); - } else { - //新增来自B端的会员 - long cUserId = idWorker.nextId(); + }else{ + isAddCredit = true; wxCUserBasicInfo = new WxCUserBasicInfo(); - wxCUserBasicInfo.setId(cUserId); - if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { + wxCUserBasicInfo.setId(idWorker.nextId()); + wxCUserBasicInfo.setTenantId("," + wxCUser.getTenantId() + ","); + wxCUserBasicInfo.setFinalTenantId(wxCUser.getFinalTenantId()); + wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); + if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); } - if (wxCUserFromBDto != null) { + if (wxCUserFromBDto.getBirthdate() != null) { wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); } if (wxCUserFromBDto.getSex() != null) { @@ -148,57 +207,50 @@ public class WxCUserController extends BaseController { if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); } - wxCUserBasicInfo.setPhone(wxCUser.getPhone()); + wxCUserBasicInfo.setLoginCount(1); + wxCUserBasicInfo.setActiveTime(new Date()); + wxCUserBasicInfo.setCreateDate(new Date()); wxCUserBasicInfo.setUpdateDate(new Date()); wxCUserBasicInfoService.save(wxCUserBasicInfo); - //新增来自B端的会员关联数据 - wxCUserFromB = new WxCUserFromB(); - wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); - wxCUserFromB.setCUserId(cUserId); - wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); - wxCUserFromB.setMerchantId(bUser.getMerchantId()); - wxCUserFromB.updateTenantInfo(bUser); - wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); - wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); - wxCUserFromBService.saveOrUpdate(wxCUserFromB); - } - } else { - WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),bUser.getFinalTenantId()); - if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { - wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); - } - if (wxCUserFromBDto != null) { - wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); - } - if (wxCUserFromBDto.getSex() != null) { - wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); - } - if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { - wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); + + wxCUser = new WxCUser(); + wxCUser.setTenantId(bUser.getTenantId()); + wxCUser.setParentTenantId(bUser.getParentTenantId()); + wxCUser.setAppId(wxCUserFromBDto.getAppId()); + wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); + wxCUser.setPhone(wxCUserBasicInfo.getPhone()); + wxCUser.setLoginCount(1); + wxCUser.setUserId(wxCUserBasicInfo.getId()); + } - wxCUserBasicInfo.setPhone(wxCUser.getPhone()); - wxCUserBasicInfoService.update(wxCUserBasicInfo); + } + + wxCUserService.saveOrUpdate(wxCUser); + if(isAddCredit){ wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); //增加积分 - addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); - wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); - //更新B端来源会员 - wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); - wxCUserFromBService.saveOrUpdate(wxCUserFromB); + addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, bUser,wxMerchant); } + wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); + //更新B端来源会员 + wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); + wxCUserFromBService.saveOrUpdate(wxCUserFromB); + return new ResultData(); } - private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId) { + private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, WxMerchantBUser bUser,WxMerchant wxMerchant) { WxCreditHistory wxCreditHistory = new WxCreditHistory(); wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); + wxCreditHistory.setMerchantId(wxMerchant.getId()); // wxCreditHistory.updateTenantInfo(tenantEntity); wxCreditHistory.setTenantId(wxCUserBasicInfo.getFinalTenantId()); wxCreditHistory.setFinalTenantId(wxCUserBasicInfo.getFinalTenantId()); wxCreditHistory.setCreateDate(new Date()); wxCreditHistory.setCreditType(enumScoreType.getCode()); + wxCreditHistory.setChangePurpose("B端("+wxMerchant.getName()+")("+bUser.getPhone()+")操作完善个人信息"); wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); - wxCreditHistory.setOperatorId(userId); + wxCreditHistory.setOperatorId(bUser.getId()); wxCreditHistoryService.saveOrUpdate(wxCreditHistory); } @@ -228,6 +280,16 @@ public class WxCUserController extends BaseController { if(wxCUserFromB!=null){ WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),wxCUserFromB.getFinalTenantId()); return new ResultData(wxCUserBasicInfo); + }else{ + WxCUser wxCUser = new WxCUser(); + wxCUser.updateTenantInfo(getTenantInfo()); + wxCUser.setAppId(wxCUserFromBDto.getAppId()); + wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); + WxCUser byOpenId = wxCUserService.getByOpenId(wxCUser); + if(null != byOpenId.getUserId()){ + WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(byOpenId.getUserId(), byOpenId.getFinalTenantId()); + return new ResultData(byId); + } } return new ResultData(Result.SUCCESS,"查询成功",null); } diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java index 1a0c935b0..dab36e25d 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java @@ -111,13 +111,17 @@ public class WxCreditHistoryController extends BaseController { //消费积分:取当前人的商户ID if (wxCreditHistory.getCreditType() == EnumScoreType.REDUCE_CREDIT.getCode()) { wxCreditHistory.setMerchantId(getLoginBUser().getMerchantId()); + wxCreditHistory.setChangePurpose("B端("+wxMerchant.getName()+")("+getLoginBUser().getPhone()+")消费"+wxCreditHistory.getSpendStr()); } else { //新增积分: //如果为商管商户 则消费商户按前端传入的进行记录 if (merchant != null && merchant.getIsAdmin() != null && merchant.getIsAdmin() == 1) { wxCreditHistory.setMerchantId(wxCreditHistory.getMerchantId()); + WxMerchant byId = wxMerchantService.getById(wxCreditHistory.getMerchantId()); + wxCreditHistory.setChangePurpose("B端商管商户给("+byId.getName()+")("+getLoginBUser().getPhone()+")新增积分"); } else { wxCreditHistory.setMerchantId(getLoginBUser().getMerchantId()); + wxCreditHistory.setChangePurpose("B端("+merchant.getName()+")("+getLoginBUser().getPhone()+")新增积分"); } } //B端操作用户 diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index 4edbb73e6..472bd2b8b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -106,10 +106,12 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") private Integer credit; + @Excel(name="扣减总积分",width = 20, orderNum = "12") @io.swagger.annotations.ApiModelProperty(value="扣减积分",name="lesCredit") @TableField(exist = false) private Integer lesCredit; + @Excel(name="增长总积分",width = 20, orderNum = "12") @io.swagger.annotations.ApiModelProperty(value="增加积分",name="addCredit") @TableField(exist = false) private Integer addCredit; diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index 42babbc68..1cde557ad 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -635,6 +635,9 @@ + + + @@ -819,6 +822,24 @@ + + + From 587aa5c10334b9226b1812586831d0e10f9e71f8 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 28 Dec 2020 15:02:17 +0800 Subject: [PATCH 33/56] jifen --- mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml index 0f45a1d81..6829ac4ab 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml @@ -78,7 +78,7 @@ left join wx_c_user_basic_info wcubi on wcubi.id = wcuc.c_user_id where 1 = 1 - and wcubi.`phone` = like concat('%', #{userPhone},'%') + and wcubi.`phone` like concat('%', #{userPhone},'%') From f994e4cc61669cb05bacd37d0c6d1f4acf9f6128 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 28 Dec 2020 15:12:38 +0800 Subject: [PATCH 34/56] jifen --- mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml index 6829ac4ab..c08d1f0a5 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml @@ -39,7 +39,7 @@ - and wcuc.`car_number` = #{carNumber} + and wcuc.`car_number` like concat('%', #{carNumber},'%') WHERE cal.channel_type = #{channelType} AND cs.conditions -> '$.id' = concat(#{merchantId},'') From b5d44c4dd1d2c031f26d7c38b6e53b1836e3516a Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 28 Dec 2020 18:33:44 +0800 Subject: [PATCH 39/56] zhenjuan --- .../V202012280001__wx_coupon_action_log.sql | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V202012280001__wx_coupon_action_log.sql diff --git a/mallinkAdmin/src/main/resources/db/migration/V202012280001__wx_coupon_action_log.sql b/mallinkAdmin/src/main/resources/db/migration/V202012280001__wx_coupon_action_log.sql new file mode 100644 index 000000000..bc0f4e80e --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202012280001__wx_coupon_action_log.sql @@ -0,0 +1,199 @@ +ALTER TABLE `wx_coupon_action_log_0` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_1` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_2` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_3` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_4` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_5` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_6` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_7` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_8` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_9` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_10` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_11` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_12` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_13` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_14` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_15` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_16` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_17` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_18` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_19` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_20` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_21` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_22` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_23` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_24` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_25` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_26` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_27` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_28` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_29` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_30` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_31` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_32` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_33` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_34` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_35` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_36` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_37` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_38` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_39` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_40` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_41` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_42` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_43` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_44` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_45` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_46` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_47` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_48` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_49` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_50` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_51` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_52` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_53` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_54` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_55` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_56` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_57` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_58` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_59` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_60` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_61` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_62` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_63` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_64` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_65` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_66` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_67` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_68` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_69` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_70` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_71` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_72` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_73` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_74` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_75` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_76` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_77` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_78` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_79` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_80` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_81` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_82` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_83` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_84` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_85` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_86` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_87` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_88` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_89` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_90` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_91` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_92` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_93` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_94` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_95` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_96` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_97` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_98` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; + +ALTER TABLE `wx_coupon_action_log_99` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`; From 3a1ab3d0ad7e80080748e40fef2fcf059e6cfd13 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 29 Dec 2020 11:37:37 +0800 Subject: [PATCH 40/56] zhenjuan --- .../main/java/com/iformall/controller/WxCUserController.java | 4 ++-- .../main/java/com/iformall/controller/WxGameController.java | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java index 841a93b1e..80b81da96 100755 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java @@ -211,8 +211,8 @@ public class WxCUserController extends BaseController { } }else{ TenantEntity tenantEntity = new TenantEntity(); - tenantEntity.setTenantId(wxCUser.getTenantId()); - tenantEntity.setParentTenantId(wxCUser.getParentTenantId()); + tenantEntity.setTenantId(bUser.getTenantId()); + tenantEntity.setParentTenantId(bUser.getParentTenantId()); WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, wxCUserFromBDto.getPhone()); if(infoByPhone != null){ return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在"); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java index 0cf753f33..75e85b649 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java @@ -1,15 +1,11 @@ package com.iformall.controller; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.domain.po.*; import com.iformall.enums.EnumGameStatus; import com.iformall.service.WxCouponOrderService; import com.iformall.service.WxGameService; -import com.iformall.service.WxGameTemplateService; -import com.iformall.service.WxOrderService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -18,7 +14,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.HashMap; import java.util.Map; @RestController From a1fccb07c02820178908c4340e580e9d3ede58b9 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 29 Dec 2020 11:47:05 +0800 Subject: [PATCH 41/56] zhenjuan --- .../main/java/com/iformall/controller/WxCUserController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java index 80b81da96..91ab110c4 100755 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java @@ -220,8 +220,8 @@ public class WxCUserController extends BaseController { isAddCredit = true; wxCUserBasicInfo = new WxCUserBasicInfo(); wxCUserBasicInfo.setId(idWorker.nextId()); - wxCUserBasicInfo.setTenantId("," + wxCUser.getTenantId() + ","); - wxCUserBasicInfo.setFinalTenantId(wxCUser.getFinalTenantId()); + wxCUserBasicInfo.setTenantId("," + bUser.getTenantId() + ","); + wxCUserBasicInfo.setFinalTenantId(bUser.getFinalTenantId()); wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); From 8657e07120bba02d1ac9040e4329a87a2920f002 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 29 Dec 2020 12:11:25 +0800 Subject: [PATCH 42/56] zhenjuan --- .../iformall/controller/WxCUserController.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java index 91ab110c4..32b2665b7 100755 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java @@ -169,13 +169,6 @@ public class WxCUserController extends BaseController { } wxCUserBasicInfoService.update(wxCUserBasicInfo); - wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); - wxCUserFromB.setCUserId(wxCUserBasicInfo.getId()); - wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); - wxCUserFromB.setMerchantId(bUser.getMerchantId()); - wxCUserFromB.updateTenantInfo(bUser); - wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); - wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); }else{ TenantEntity tenantEntity = new TenantEntity(); tenantEntity.setTenantId(wxCUser.getTenantId()); @@ -251,6 +244,7 @@ public class WxCUserController extends BaseController { wxCUser.setUserId(wxCUserBasicInfo.getId()); } + } wxCUserService.saveOrUpdate(wxCUser); @@ -260,6 +254,12 @@ public class WxCUserController extends BaseController { addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, bUser,wxMerchant); } wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); + wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); + wxCUserFromB.setCUserId(wxCUserBasicInfo.getId()); + wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); + wxCUserFromB.setMerchantId(bUser.getMerchantId()); + wxCUserFromB.updateTenantInfo(bUser); + wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); //更新B端来源会员 wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); wxCUserFromBService.saveOrUpdate(wxCUserFromB); @@ -314,7 +314,7 @@ public class WxCUserController extends BaseController { wxCUser.setAppId(wxCUserFromBDto.getAppId()); wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); WxCUser byOpenId = wxCUserService.getByOpenId(wxCUser); - if(null != byOpenId.getUserId()){ + if(byOpenId != null && byOpenId.getUserId() != null){ WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(byOpenId.getUserId(), byOpenId.getFinalTenantId()); return new ResultData(byId); } From 3ae5ce66be1f4cdcc71d1b47715013e2d1d115ac Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 29 Dec 2020 14:05:22 +0800 Subject: [PATCH 43/56] =?UTF-8?q?=E6=B8=B8=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/market/WxGameController.java | 17 +++++++++++++++++ .../db/migration/V202012290001__wx_game.sql | 3 +++ .../controller/WxUserGrantController.java | 2 ++ .../java/com/iformall/domain/po/WxGame.java | 8 +++++++- .../service/impl/WxGameServiceImpl.java | 4 +++- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java index ba1135ad1..0dc9d0f01 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java @@ -3,6 +3,7 @@ package com.iformall.controller.market; import com.alibaba.fastjson.JSONArray; import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; @@ -54,6 +55,14 @@ public class WxGameController extends BaseController { if (StringUtils.isBlank(wxGame.getCouponIds())) { wxGame.setCouponIds(JSONArray.toJSONString(new String[0])); } + if(wxGame.getPlayCreditLimit() != null && wxGame.getPlayCreditLimit() >= 0){ + if(wxGame.getPlayCredit() == null || wxGame.getPlayCredit() <= 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"游戏消耗积分不能为空或为0"); + } + if(wxGame.getPlayLimit() == null || wxGame.getPlayLimit() == 0){ + wxGame.setPlayLimit(-1); + } + } wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode()); wxGame.updateTenantInfo(getTenantInfo()); wxGameService.saveOrUpdate(wxGame); @@ -68,6 +77,14 @@ public class WxGameController extends BaseController { if (StringUtils.isBlank(wxGame.getCouponIds())) { wxGame.setCouponIds(JSONArray.toJSONString(new String[0])); } + if(wxGame.getPlayCreditLimit() != null && wxGame.getPlayCreditLimit() >= 0){ + if(wxGame.getPlayCredit() == null || wxGame.getPlayCredit() <= 0){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"游戏消耗积分不能为空或为0"); + } + if(wxGame.getPlayLimit() == null || wxGame.getPlayLimit() == 0){ + wxGame.setPlayLimit(-1); + } + } wxGame.updateTenantInfo(getTenantInfo()); wxGameService.saveOrUpdate(wxGame); return new ResultData(); diff --git a/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql b/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql new file mode 100644 index 000000000..6b9a69505 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql @@ -0,0 +1,3 @@ +ALTER TABLE `wx_game` +ADD COLUMN `play_credit_limit` int(11) NOT NULL DEFAULT -1 AFTER `award_limit`, +ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`; \ No newline at end of file diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index b485a006a..8bdd6397a 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -961,6 +961,8 @@ public class WxUserGrantController extends BaseController { wxCreditHistory.setOperatorId(memberId); wxCreditHistoryService.saveOrUpdate(wxCreditHistory); wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, record,tenantEntity); + + removeCacheCUser(); } return new ResultData(); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java b/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java index 6655dadde..a8a439d28 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxGame.java @@ -34,9 +34,15 @@ public class WxGame extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "触发条件(-1:不受限制,1:登录触发, 2:主页固定入口,3:购买触发,4:核销触发,5:公众号链接触发,6:二维码触发)", name = "triggleAction") private Integer triggleAction; - @io.swagger.annotations.ApiModelProperty(value = "限玩次数(0:不受限制,n:限玩次数)", name = "playLimit") + @io.swagger.annotations.ApiModelProperty(value = "限玩免费次数(-1:不能免费玩,0:不受限制,n:限玩次数)", name = "playLimit") private Integer playLimit; + @io.swagger.annotations.ApiModelProperty(value = "限玩积分次数(-1:不能积分玩法,0:不受限制,n:限玩次数)", name = "playCreditLimit") + private Integer playCreditLimit; + + @io.swagger.annotations.ApiModelProperty(value = "积分玩法消耗积分", name = "playCredit") + private Integer playCredit; + @io.swagger.annotations.ApiModelProperty(value = "限奖次数(0:不受限制,n:限奖次数)", name = "awardLimit") private Integer awardLimit; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index 8b9ae6cab..cf9a7c49b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -280,7 +280,9 @@ public class WxGameServiceImpl implements WxGameService { Long couponId = obj.getLong("couponId"); int weight = obj.getIntValue("weight"); try { - saveOrUpdateCouponChannel(couponId, wxCouponChannelsMap, record); + if(couponId != null){ + saveOrUpdateCouponChannel(couponId, wxCouponChannelsMap, record); + } } catch (MallinkException e) { logger.error(e.getMessage()); } From 0df96c6bb6d944c9e7a2f411f08068df699d19d5 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 29 Dec 2020 15:06:22 +0800 Subject: [PATCH 44/56] =?UTF-8?q?=E6=B8=B8=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V202012290001__wx_game.sql | 6 +++- .../iformall/domain/po/WxGameActionLog.java | 3 ++ .../mapper/WxGameActionLogMapper.java | 2 ++ .../service/impl/WxGameServiceImpl.java | 29 +++++++++++++++---- .../mapper/WxGameActionLogMapper.xml | 20 ++++++++++++- .../main/resources/mapper/WxGameMapper.xml | 5 +++- 6 files changed, 56 insertions(+), 9 deletions(-) diff --git a/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql b/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql index 6b9a69505..2bdcb8ce7 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql @@ -1,3 +1,7 @@ ALTER TABLE `wx_game` ADD COLUMN `play_credit_limit` int(11) NOT NULL DEFAULT -1 AFTER `award_limit`, -ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`; \ No newline at end of file +ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`; + + +ALTER TABLE `wx_game_action_log` +ADD COLUMN `type` int(11) NOT NULL DEFAULT 0 AFTER `create_time`; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java b/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java index 3ca496830..ee963434c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java @@ -33,5 +33,8 @@ public class WxGameActionLog extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="",name="createTime") private Date createTime; + @io.swagger.annotations.ApiModelProperty(value = "", name = "type") + private Integer type; + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java index c5e778152..2521c0d7d 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java @@ -10,4 +10,6 @@ public interface WxGameActionLogMapper extends CommonMapper findList(WxGameActionLog wxGameActionLog); int getPlayCount(WxGameActionLog wxGameActionLog); int getAwardCount(WxGameActionLog wxGameActionLog); + + int getPlayCreditCount(WxGameActionLog wxGameActionLog); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index cf9a7c49b..247a3f493 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -155,18 +155,35 @@ public class WxGameServiceImpl implements WxGameService { wxGameActionLog.setGameId(gameId); int playLimit = wxGame.getPlayLimit(); + int playCreditLimit = wxGame.getPlayCreditLimit(); + int playCredit = wxGame.getPlayCredit(); int AwardLimit = wxGame.getAwardLimit(); int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog); + int playCreditCount = wxGameActionLogMapper.getPlayCreditCount(wxGameActionLog); int AwardCount = wxGameActionLogMapper.getAwardCount(wxGameActionLog); - boolean playAble = !(( playLimit != 0 && playCount >= playLimit) - || (AwardLimit != 0 && AwardCount >= AwardLimit)); +// boolean playAble = !(( playLimit != 0 && playCount >= playLimit) +// || (AwardLimit != 0 && AwardCount >= AwardLimit)); Map map = new HashMap(); - map.put("playLimit",playLimit); - map.put("AwardLimit",AwardLimit); - map.put("playCount",playCount); - map.put("AwardCount",AwardCount); + map.put("playLimit",playLimit);//免费次数限制(为0是不限制次数,为-1是不能玩) + map.put("playCreditLimit",playCreditLimit);//消耗积分次数限制(为0是不限制次数,为-1是不能玩) + map.put("playCredit",playCredit);//消耗积分数量 + map.put("AwardLimit",AwardLimit);//中奖次数限制(为0是不限制次数) + map.put("playCount",playCount);//当前玩的免费次数 + map.put("playCreditCount",playCreditCount);//当前玩的消耗积分次数 + map.put("AwardCount",AwardCount);//当前中奖次数 + + boolean playAble = true; + if(AwardLimit != 0 && AwardCount >= AwardLimit){//中奖次数没了,不能完了 + playAble = false; + } + if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){//免费不能玩了 + if((playCreditLimit > 0 && playCreditCount >= playCreditLimit) || playCreditLimit < 0){//积分不能玩了 + playAble = false; + } + } + map.put("playAble",playAble); return new ResultData(map); } diff --git a/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml index 92227598a..7a38cc6f2 100644 --- a/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml @@ -9,10 +9,12 @@ + + - `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time` + `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`,`type` @@ -60,6 +62,11 @@ + + and `type` = #{type} + + + and id in @@ -121,6 +128,10 @@ and `end_time` <= #{endTime} + + and `type` = #{type} + + @@ -128,6 +139,13 @@ + + + select from wx_c_user_basic_child + + + + + update wx_c_user_basic_child set del_status = 0 where id = #{id} and tenant_id = #{tenantId} + + + From b7ed250d26b78107f5a82309496fb18f3c7e0bb3 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 15:09:24 +0800 Subject: [PATCH 48/56] =?UTF-8?q?=E5=AD=90=E5=A5=B3=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mem/WxCUserBasicInfoController.java | 12 +++ .../db/migration/V202012300001__wx_tag.sql | 8 ++ .../WxCuserFloatingLayerController.java | 2 +- .../config/BaseMyBatisConfiguration.java | 10 +- .../iformall/domain/po/WxCUserBasicInfo.java | 3 + .../main/java/com/iformall/enums/EnumTag.java | 7 ++ .../java/com/iformall/enums/EnumTagType.java | 2 + .../mapper/WxCUserBasicChildMapper.java | 2 +- .../service/WxCUserBasicChildService.java | 2 +- .../impl/WxCUserBasicChildServiceImpl.java | 2 +- .../service/impl/WxCUserTagsServiceImpl.java | 99 +++++++++++++++++++ .../java/com/iformall/utils/DateUtils.java | 30 ++++++ 12 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V202012300001__wx_tag.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java index a92f77ab4..315bab67b 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -56,6 +56,9 @@ public class WxCUserBasicInfoController extends BaseController { @Autowired private WxCUserBasicInfoService wxCUserBasicInfoService; + @Autowired + private WxCUserBasicChildService wxCUserBasicChildService; + @Autowired private WxCUserTagsService wxCUserTagsService; @@ -104,6 +107,14 @@ public class WxCUserBasicInfoController extends BaseController { } } + private void setUserChildren(WxCUserBasicInfo info) { + WxCUserBasicChild uChild = new WxCUserBasicChild(); + uChild.setTenantId(info.getFinalTenantId()); + uChild.setCUserId(info.getId()); + info.setChildrenList(wxCUserBasicChildService.findList(uChild)); + + } + private void setUserInfoTag(WxCUserBasicInfo info) { if (info.getTagId() != null) { @@ -247,6 +258,7 @@ public class WxCUserBasicInfoController extends BaseController { setUserInfoTag(info); setUserInfoLevel(info); setUserInfoCar(info); + setUserChildren(info); return new ResultData(info); } diff --git a/mallinkAdmin/src/main/resources/db/migration/V202012300001__wx_tag.sql b/mallinkAdmin/src/main/resources/db/migration/V202012300001__wx_tag.sql new file mode 100644 index 000000000..070e98e9b --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202012300001__wx_tag.sql @@ -0,0 +1,8 @@ +INSERT INTO `wx_tags_type`(`id`, `name`, `group_id`, `group_name`, `flag`) VALUES (29, '子女', 2, '生活属性', 0); + +INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (166, '婴儿', 2, '生活属性', 29, '子女'); +INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (167, '幼儿', 2, '生活属性', 29, '子女'); +INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (168, '学龄前', 2, '生活属性', 29, '子女'); +INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (169, '学龄初', 2, '生活属性', 29, '子女'); +INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (170, '学龄中', 2, '生活属性', 29, '子女'); +INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (171, '学龄晚', 2, '生活属性', 29, '子女'); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCuserFloatingLayerController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCuserFloatingLayerController.java index 88b4c7c03..3f46ef31f 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCuserFloatingLayerController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCuserFloatingLayerController.java @@ -28,7 +28,7 @@ public class WxCuserFloatingLayerController extends BaseController { @Autowired WxCuserFloatingLayerService wxCuserFloatingLayerService; - @AuthIgnore +// @AuthIgnore @ApiOperation("获取浮层") @GetMapping("/getFloatingLayer") @ApiImplicitParams({ diff --git a/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java b/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java index 2ef8b97e2..64c5ee0ec 100644 --- a/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java +++ b/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java @@ -47,8 +47,7 @@ public class BaseMyBatisConfiguration { wxCouponrSharding.setCount(100); wxCouponrSharding.setRule(EnumShardingRule.HASH.getCode()); shardingList.add(wxCouponrSharding); - - + ShardingSphere wxCouponrMerchantSharding = new ShardingSphere(); wxCouponrMerchantSharding.setColumn("tenant_id"); wxCouponrMerchantSharding.setTableName("wx_coupon_merchant"); @@ -76,6 +75,13 @@ public class BaseMyBatisConfiguration { basicInfoSharding.setCount(100); basicInfoSharding.setRule(EnumShardingRule.HASH.getCode()); shardingList.add(basicInfoSharding); + + ShardingSphere wxbasicChildSharding = new ShardingSphere(); + wxbasicChildSharding.setColumn("tenant_id"); + wxbasicChildSharding.setTableName("wx_c_user_basic_child"); + wxbasicChildSharding.setCount(100); + wxbasicChildSharding.setRule(EnumShardingRule.HASH.getCode()); + shardingList.add(wxbasicChildSharding); ShardingSphere wxOrderSharding = new ShardingSphere(); wxOrderSharding.setColumn("tenant_id"); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index 472bd2b8b..f72f07bac 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -127,6 +127,9 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { private String tagNames; + @TableField(exist = false) + private List childrenList; + @TableField(exist = false) private String tagIds; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumTag.java b/mallinkService/src/main/java/com/iformall/enums/EnumTag.java index 07fb22417..312f4b61c 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumTag.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumTag.java @@ -204,6 +204,13 @@ public enum EnumTag { ID_164(164L, EnumTagType.ID_28, "鞋尺码"), ID_165(165L, EnumTagType.ID_28, "鞋尺码"), + ID_166(166L, EnumTagType.ID_29, "婴儿"), + ID_167(167L, EnumTagType.ID_29, "幼儿"), + ID_168(168L, EnumTagType.ID_29, "学龄前"), + ID_169(169L, EnumTagType.ID_29, "学龄初"), + ID_170(170L, EnumTagType.ID_29, "学龄中"), + ID_171(171L, EnumTagType.ID_29, "学龄晚"), + ID_1000(1000L, EnumTagType.ID_50,"一天以内"), ID_1001(1001L, EnumTagType.ID_50,"一周以内"), ID_1002(1002L, EnumTagType.ID_50,"一月以内"), diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumTagType.java b/mallinkService/src/main/java/com/iformall/enums/EnumTagType.java index e14d37011..5e29be998 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumTagType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumTagType.java @@ -35,6 +35,8 @@ public enum EnumTagType { ID_27(27L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_1, "服饰尺码"), ID_28(28L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_1, "鞋尺码"), + ID_29(29L, EnumTagTypeFlag.FLAG_NORMAL, EnumTagGroup.ID_2, "子女"), + ID_0(0L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员手机"), ID_50(50L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员会龄"), ID_51(51L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员等级"), diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicChildMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicChildMapper.java index 1bf3edfc1..31a42e63d 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicChildMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicChildMapper.java @@ -8,7 +8,7 @@ import java.util.List; public interface WxCUserBasicChildMapper extends CommonMapper{ - List findList(WxCUserBasicChild record); + List findList(WxCUserBasicChild record); int updDelById(WxCUserBasicChild record); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicChildService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicChildService.java index 05eab8269..e6967e686 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicChildService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicChildService.java @@ -8,7 +8,7 @@ public interface WxCUserBasicChildService { PageInfo listAsPage(WxCUserBasicChild record, Integer pageIndex, Integer pageSize); - List findList(WxCUserBasicChild record); + List findList(WxCUserBasicChild record); WxCUserBasicChild saveOrUpdate(WxCUserBasicChild record); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicChildServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicChildServiceImpl.java index fb41382e1..000fa7302 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicChildServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicChildServiceImpl.java @@ -28,7 +28,7 @@ public class WxCUserBasicChildServiceImpl implements WxCUserBasicChildService { } @Override - public List findList(WxCUserBasicChild record) { + public List findList(WxCUserBasicChild record) { return wxCUserBasicChildMapper.findList(record); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index 14877221b..a3180479b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -13,6 +13,7 @@ import com.iformall.enums.*; import com.iformall.mapper.*; import com.iformall.service.WxCUserTagsService; import com.iformall.service.WxTagsService; +import com.iformall.utils.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -32,6 +33,9 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { @Autowired WxCUserBasicInfoMapper wxCUserBasicInfoMapper; + @Autowired + WxCUserBasicChildMapper wxCUserBasicChildMapper; + @Autowired WxCouponOrderMapper wxCouponOrderMapper; @@ -161,6 +165,50 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { return wxTagsMapper.findList(wxTags); } + //按type 替换 + private List assign(WxCUserBasicInfo user, List enumTags, EnumTagType type){ + if(user == null){ + return null; + } + WxCUserTags record = new WxCUserTags(); + record.setUserId(user.getId()); + record.setTenantId(user.getFinalTenantId()); + List cUserTagsList = wxCUserTagsMapper.findList(record); + List tagIdList; + if(cUserTagsList != null && cUserTagsList.size() > 0){ + record.setId(cUserTagsList.get(0).getId()); + record.setTags(cUserTagsList.get(0).getTags()); + } + String tags = record.getTags(); + if (tags == null){ + tagIdList = new ArrayList(); + }else{ + tagIdList = JSON.parseArray(tags, Long.class); + } + Iterator it = tagIdList.iterator(); + while(it.hasNext()){ + Long id = it.next(); + if(null != id && null != EnumTag.getEnum(id) && EnumTag.getEnum(id).getCode() == type.getCode()){ + it.remove(); + } + } + if(enumTags != null && enumTags.size() > 0){ + for (EnumTag enumTag:enumTags) { + tagIdList.add(enumTag.getCode()); + } + } + record.setTags(JSON.toJSONString(tagIdList)); + saveOrUpdate(record); + + if (user.getTagId() == null || !user.getTagId().equals(record.getId())) { + user.setTagId(record.getId()); + wxCUserBasicInfoMapper.updateById(user); + } + WxTags wxTags = new WxTags(); + wxTags.setIds(tagIdList); + return wxTagsMapper.findList(wxTags); + } + //去标 private List resign(WxCUserBasicInfo user, EnumTag tag){ if (tag == null || user == null) @@ -593,6 +641,54 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { return resList; } + private List assignTypeId29(WxCUserBasicInfo user) { + List resList = null; + WxCUserBasicChild uChild = new WxCUserBasicChild(); + uChild.setTenantId(user.getFinalTenantId()); + uChild.setCUserId(user.getId()); + List list = wxCUserBasicChildMapper.findList(uChild); + if(list != null && list.size() > 0){ + List tags = new ArrayList<>(); + for (WxCUserBasicChild child:list) { + if(child.getBirthdate() != null){ + Calendar cal = Calendar.getInstance(); + if (cal.after(child.getBirthdate())) { + int age = DateUtils.getAge(child.getBirthdate()); + if(age < 1){ + if(!tags.contains(EnumTag.ID_166)){ + tags.add(EnumTag.ID_166); + } + }else if(age >= 1 && age < 3){ + if(!tags.contains(EnumTag.ID_167)){ + tags.add(EnumTag.ID_167); + } + }else if(age >= 3 && age < 6){ + if(!tags.contains(EnumTag.ID_168)){ + tags.add(EnumTag.ID_168); + } + }else if(age >= 6 && age < 12){ + if(!tags.contains(EnumTag.ID_169)){ + tags.add(EnumTag.ID_169); + } + }else if(age >= 12 && age < 15){ + if(!tags.contains(EnumTag.ID_170)){ + tags.add(EnumTag.ID_170); + } + }else if(age >= 15 && age < 18){ + if(!tags.contains(EnumTag.ID_171)){ + tags.add(EnumTag.ID_171); + } + } + } + } + } + resList = assign(user,tags,EnumTagType.ID_29); + }else{ + resList = assign(user,null,EnumTagType.ID_29); + } + return resList; + } + //打标接口 @Override public List assignTags(List tagIdList, WxCUserBasicInfo user) { @@ -638,6 +734,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { //学历 resList = assignTypeId6(user, param.getEducation()); } + resList = assignTypeId29(user); } } break; @@ -730,6 +827,8 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { //学历 resList = assignTypeId6(user, user.getEducation()); } + + resList = assignTypeId29(user); //消费类别 resList = assignTypeId14(user,tenantEntity); diff --git a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java index e3810038f..5bc1e01e2 100755 --- a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java +++ b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java @@ -1258,4 +1258,34 @@ public class DateUtils { System.out.println(next); } */ + + + /** + * 获取多少岁 + * @param birthDay + * @return + * @throws Exception + */ + public static int getAge(Date birthDay){ + Calendar cal = Calendar.getInstance(); + if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算 + throw new IllegalArgumentException( + "The birthDay is before Now.It's unbelievable!"); + } + int yearNow = cal.get(Calendar.YEAR); //当前年份 + int monthNow = cal.get(Calendar.MONTH); //当前月份 + int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); //当前日期 + cal.setTime(birthDay); + int yearBirth = cal.get(Calendar.YEAR); + int monthBirth = cal.get(Calendar.MONTH); + int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); + int age = yearNow - yearBirth; //计算整岁数 + if (monthNow <= monthBirth) { + if (monthNow == monthBirth) { + if (dayOfMonthNow < dayOfMonthBirth) age--;//当前日期在生日之前,年龄减一 + }else{ + age--;//当前月份在生日之前,年龄减一 + } + } return age; + } } From 2a7dfa07106b21fea21748a6746a4520cae176ac Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 16:13:15 +0800 Subject: [PATCH 49/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxCUserTagsServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index a3180479b..9f0415fad 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -167,6 +167,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { //按type 替换 private List assign(WxCUserBasicInfo user, List enumTags, EnumTagType type){ + logger.info("-----" + enumTags.toString()); if(user == null){ return null; } @@ -197,6 +198,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { tagIdList.add(enumTag.getCode()); } } + logger.info("-----" + tagIdList.toString()); record.setTags(JSON.toJSONString(tagIdList)); saveOrUpdate(record); From 548d683f53224cc3e0fc842a46c01124cef52118 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 16:22:25 +0800 Subject: [PATCH 50/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxCUserTagsServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index 9f0415fad..103a106b8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -656,6 +656,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { Calendar cal = Calendar.getInstance(); if (cal.after(child.getBirthdate())) { int age = DateUtils.getAge(child.getBirthdate()); + logger.info("--------"+age); if(age < 1){ if(!tags.contains(EnumTag.ID_166)){ tags.add(EnumTag.ID_166); From a7dd01decdf7bded0ab2a2bf988e8184b552abce Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 16:31:56 +0800 Subject: [PATCH 51/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxCUserTagsServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index 103a106b8..b436d272a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -654,9 +654,10 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { for (WxCUserBasicChild child:list) { if(child.getBirthdate() != null){ Calendar cal = Calendar.getInstance(); + logger.info("--------"+child.getBirthdate()); if (cal.after(child.getBirthdate())) { int age = DateUtils.getAge(child.getBirthdate()); - logger.info("--------"+age); + logger.info("--------"+child.getBirthdate()); if(age < 1){ if(!tags.contains(EnumTag.ID_166)){ tags.add(EnumTag.ID_166); From a1ca74916de16fc6387de049b5d05d2e9441111a Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 16:35:37 +0800 Subject: [PATCH 52/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxCUserTagsServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index b436d272a..e49a6642a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -655,6 +655,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { if(child.getBirthdate() != null){ Calendar cal = Calendar.getInstance(); logger.info("--------"+child.getBirthdate()); + logger.info("--------"+cal.after(child.getBirthdate())); if (cal.after(child.getBirthdate())) { int age = DateUtils.getAge(child.getBirthdate()); logger.info("--------"+child.getBirthdate()); From 396be72d5ddf2ac8eb8858cc6a38563d725779ed Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 16:49:32 +0800 Subject: [PATCH 53/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxCUserTagsServiceImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index e49a6642a..eb6851f0e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -653,12 +653,10 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { List tags = new ArrayList<>(); for (WxCUserBasicChild child:list) { if(child.getBirthdate() != null){ - Calendar cal = Calendar.getInstance(); logger.info("--------"+child.getBirthdate()); - logger.info("--------"+cal.after(child.getBirthdate())); - if (cal.after(child.getBirthdate())) { + if (new Date().after(child.getBirthdate())) { int age = DateUtils.getAge(child.getBirthdate()); - logger.info("--------"+child.getBirthdate()); + logger.info("--------"+age); if(age < 1){ if(!tags.contains(EnumTag.ID_166)){ tags.add(EnumTag.ID_166); From 70ad43920674b104d45e810f0b40543330781e20 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 16:58:32 +0800 Subject: [PATCH 54/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/service/impl/WxCUserTagsServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index eb6851f0e..72205714c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -186,13 +186,16 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { }else{ tagIdList = JSON.parseArray(tags, Long.class); } + logger.info("-----" + tagIdList.toString()); Iterator it = tagIdList.iterator(); while(it.hasNext()){ Long id = it.next(); if(null != id && null != EnumTag.getEnum(id) && EnumTag.getEnum(id).getCode() == type.getCode()){ it.remove(); + logger.info("-----id remove" + id); } } + logger.info("-----" + tagIdList.toString()); if(enumTags != null && enumTags.size() > 0){ for (EnumTag enumTag:enumTags) { tagIdList.add(enumTag.getCode()); @@ -653,10 +656,8 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { List tags = new ArrayList<>(); for (WxCUserBasicChild child:list) { if(child.getBirthdate() != null){ - logger.info("--------"+child.getBirthdate()); if (new Date().after(child.getBirthdate())) { int age = DateUtils.getAge(child.getBirthdate()); - logger.info("--------"+age); if(age < 1){ if(!tags.contains(EnumTag.ID_166)){ tags.add(EnumTag.ID_166); From 29e18f0f6d2f897e74b1b1d185f8f5954a2b790a Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 17:06:59 +0800 Subject: [PATCH 55/56] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/service/impl/WxCUserTagsServiceImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java index 72205714c..ae79e2036 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java @@ -167,7 +167,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { //按type 替换 private List assign(WxCUserBasicInfo user, List enumTags, EnumTagType type){ - logger.info("-----" + enumTags.toString()); + if(user == null){ return null; } @@ -186,22 +186,21 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { }else{ tagIdList = JSON.parseArray(tags, Long.class); } - logger.info("-----" + tagIdList.toString()); + Iterator it = tagIdList.iterator(); while(it.hasNext()){ Long id = it.next(); - if(null != id && null != EnumTag.getEnum(id) && EnumTag.getEnum(id).getCode() == type.getCode()){ + if(null != id && null != EnumTag.getEnum(id) && EnumTag.getEnum(id).getType().equals(type)){ it.remove(); - logger.info("-----id remove" + id); } } - logger.info("-----" + tagIdList.toString()); + if(enumTags != null && enumTags.size() > 0){ for (EnumTag enumTag:enumTags) { tagIdList.add(enumTag.getCode()); } } - logger.info("-----" + tagIdList.toString()); + record.setTags(JSON.toJSONString(tagIdList)); saveOrUpdate(record); From 16c60aeaa69eedfd0491d589b9d0d2784d02182e Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 30 Dec 2020 17:23:58 +0800 Subject: [PATCH 56/56] caozuo zhe --- .../java/com/iformall/controller/WxCouponSendController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java index 1fc61603e..7c55e864b 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java @@ -102,7 +102,7 @@ public class WxCouponSendController extends BaseController { wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode()); wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); try { - wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT,getWxBuserId()); + wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT,getLoginBUser().getId()); } catch (MallinkException e) { logger.error("注券异常: ", e); return new ResultData(e.getErrorCode(), e.getMessage());