| @@ -2,10 +2,14 @@ package com.iformall.controller.mem; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxScoreHistory; | import com.iformall.domain.po.WxScoreHistory; | ||||
| import com.iformall.enums.EnumCUserBasicInfoStatus; | |||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxScoreHistoryService; | import com.iformall.service.WxScoreHistoryService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -23,6 +27,10 @@ public class WxScoreHistoryController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxScoreHistoryService wxScoreHistoryService; | private WxScoreHistoryService wxScoreHistoryService; | ||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -43,6 +51,9 @@ public class WxScoreHistoryController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::add"); | logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::add"); | ||||
| //Assert.notNull(wxScoreHistory.getName(), "角色名不能为空"); | //Assert.notNull(wxScoreHistory.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| if (checkMemberStatus(wxScoreHistory.getCUserId())) { | |||||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||||
| } | |||||
| wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -52,10 +63,22 @@ public class WxScoreHistoryController extends BaseController { | |||||
| @SystemControllerLog(description = "成长值-更新") | @SystemControllerLog(description = "成长值-更新") | ||||
| public ResultData update(@RequestBody WxScoreHistory wxScoreHistory) { | public ResultData update(@RequestBody WxScoreHistory wxScoreHistory) { | ||||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::update"); | logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::update"); | ||||
| if (checkMemberStatus(wxScoreHistory.getCUserId())) { | |||||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||||
| } | |||||
| wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| public boolean checkMemberStatus(Long userId) { | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(userId); | |||||
| if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||||
| logger.info("会员权益被锁定:cUserId:" + userId); | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @@ -28,8 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @@ -66,6 +64,12 @@ public class WxOrderController extends BaseController { | |||||
| if (resultData != null) return resultData; | if (resultData != null) return resultData; | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); | |||||
| if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||||
| logger.info("会员权益被锁定:cUserId:" + user.getId()); | |||||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||||
| } | |||||
| resultData = couponUserCheck(user, wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId())); | resultData = couponUserCheck(user, wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId())); | ||||
| if (resultData != null) return resultData; | if (resultData != null) return resultData; | ||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumCUserBasicInfoStatus { | |||||
| NORMAL(0, "正常"), | |||||
| LOCKED(1, "锁定"),; | |||||
| public static EnumCUserBasicInfoStatus getEnum(Integer code) { | |||||
| for (EnumCUserBasicInfoStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumCUserBasicInfoStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -849,13 +849,15 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| Date createDate = oldUserBase.getCreateDate() == null ? new Date() : oldUserBase.getCreateDate(); | Date createDate = oldUserBase.getCreateDate() == null ? new Date() : oldUserBase.getCreateDate(); | ||||
| oldUserBase.setUpdateDate(userBase.getUpdateDate() == null ? updateDate : userBase.getUpdateDate()); | oldUserBase.setUpdateDate(userBase.getUpdateDate() == null ? updateDate : userBase.getUpdateDate()); | ||||
| oldUserBase.setCreateDate(userBase.getCreateDate() == null ? createDate : userBase.getCreateDate()); | oldUserBase.setCreateDate(userBase.getCreateDate() == null ? createDate : userBase.getCreateDate()); | ||||
| // 成长值 | |||||
| if(points != null) { | |||||
| oldUserBase.setPoins(points); | |||||
| } | |||||
| // 覆盖原积分 | |||||
| if(credit != null) { | |||||
| oldUserBase.setCredit(credit); | |||||
| if (oldUserBase.getStatus().equals(EnumCUserBasicInfoStatus.NORMAL.getCode())) { | |||||
| // 成长值 | |||||
| if (points != null) { | |||||
| oldUserBase.setPoins(points); | |||||
| } | |||||
| // 覆盖原积分 | |||||
| if (credit != null) { | |||||
| oldUserBase.setCredit(credit); | |||||
| } | |||||
| } | } | ||||
| } else { | } else { | ||||
| userBase.setId(idWorker.nextId()); | userBase.setId(idWorker.nextId()); | ||||
| @@ -310,6 +310,12 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| return false; | return false; | ||||
| } | } | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId); | |||||
| if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||||
| logger.info("会员权益被锁定:cUserId:" + cUserId); | |||||
| return false; | |||||
| } | |||||
| //查询开关是否打开 | //查询开关是否打开 | ||||
| WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(); | WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(); | ||||
| wxCouponSendConfig.setSendType(type.getCode()); | wxCouponSendConfig.setSendType(type.getCode()); | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumBusiness; | import com.iformall.enums.EnumBusiness; | ||||
| import com.iformall.enums.EnumCUserBasicInfoStatus; | |||||
| import com.iformall.enums.EnumScoreRules; | import com.iformall.enums.EnumScoreRules; | ||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| @@ -555,27 +556,42 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| @Override | @Override | ||||
| public int addScore(EnumScoreType scoreType, Object param) { | public int addScore(EnumScoreType scoreType, Object param) { | ||||
| WxCUser wxCUser = null; | |||||
| WxCUserCar userCar = null; | |||||
| WxCUserBasicInfo userBasicInfo = null; | |||||
| Long userId = null; | |||||
| if (param instanceof WxCUser) { | |||||
| wxCUser = (WxCUser) param; | |||||
| userId = wxCUser.getId(); | |||||
| } | |||||
| if (param instanceof WxCUserCar) { | |||||
| userCar = (WxCUserCar) param; | |||||
| userId = userCar.getCUserId(); | |||||
| } | |||||
| if (param instanceof WxCUserBasicInfo) { | |||||
| userBasicInfo = (WxCUserBasicInfo) param; | |||||
| userId = userBasicInfo.getId(); | |||||
| } | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId); | |||||
| if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||||
| logger.info("会员权益被锁定:cUserId:" + userId); | |||||
| return 0; | |||||
| } | |||||
| switch (scoreType){ | switch (scoreType){ | ||||
| case LOGIN: { | case LOGIN: { | ||||
| WxCUser user = (WxCUser) param; | |||||
| return loginAddScore(user); | |||||
| return loginAddScore(wxCUser); | |||||
| } | } | ||||
| case BIND_CAR:{ | case BIND_CAR:{ | ||||
| WxCUserCar userCar = (WxCUserCar) param; | |||||
| return bindCarAddScore(userCar); | return bindCarAddScore(userCar); | ||||
| } | } | ||||
| case WECHAT_PERSION:{ | case WECHAT_PERSION:{ | ||||
| WxCUser user = (WxCUser) param; | |||||
| return personAddScore(user); | |||||
| return personAddScore(wxCUser); | |||||
| } | } | ||||
| case WECHAT_PHONE:{ | case WECHAT_PHONE:{ | ||||
| WxCUser user = (WxCUser) param; | |||||
| return phoneAddScore(user); | |||||
| return phoneAddScore(wxCUser); | |||||
| } | } | ||||
| case COMPLETE_INFO:{ | case COMPLETE_INFO:{ | ||||
| WxCUserBasicInfo user = (WxCUserBasicInfo) param; | |||||
| return infoAddScore(user); | |||||
| return infoAddScore(userBasicInfo); | |||||
| } | } | ||||
| default: { | default: { | ||||
| @@ -587,14 +603,30 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| @Override | @Override | ||||
| public int addScore2(EnumScoreType scoreType, Object param1, Object param2) { | public int addScore2(EnumScoreType scoreType, Object param1, Object param2) { | ||||
| WxOrder order = null; | |||||
| WxCUserBasicInfo user = null; | |||||
| Long userId = null; | |||||
| if (param1 instanceof WxOrder) { | |||||
| order = (WxOrder) param1; | |||||
| userId = order.getCUserId(); | |||||
| } | |||||
| if (param1 instanceof WxCUserBasicInfo) { | |||||
| user = (WxCUserBasicInfo) param1; | |||||
| userId = user.getId(); | |||||
| } | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId); | |||||
| if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||||
| logger.info("会员权益被锁定:cUserId:" + userId); | |||||
| return 0; | |||||
| } | |||||
| switch (scoreType){ | switch (scoreType){ | ||||
| case CONSUMPTION: { | case CONSUMPTION: { | ||||
| WxOrder order = (WxOrder) param1; | |||||
| Integer bussinessId = (Integer) param2; | Integer bussinessId = (Integer) param2; | ||||
| return payAddScore(order, bussinessId); | return payAddScore(order, bussinessId); | ||||
| } | } | ||||
| case MEM_IMPORT: { | case MEM_IMPORT: { | ||||
| WxCUserBasicInfo user = (WxCUserBasicInfo) param1; | |||||
| boolean bHaveCUser = (boolean)(param2); | boolean bHaveCUser = (boolean)(param2); | ||||
| return memResetScore(user, bHaveCUser); | return memResetScore(user, bHaveCUser); | ||||
| } | } | ||||
| @@ -606,9 +638,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| @Override | @Override | ||||
| public int reduceScore(EnumScoreType scoreType, Object param1, Object param2, Object param3) { | public int reduceScore(EnumScoreType scoreType, Object param1, Object param2, Object param3) { | ||||
| WxCUserBasicInfo user = (WxCUserBasicInfo) param1; | |||||
| if (user != null && user.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||||
| logger.info("会员权益被锁定:cUserId:" + user.getId()); | |||||
| return 0; | |||||
| } | |||||
| switch (scoreType){ | switch (scoreType){ | ||||
| case MEM_REDUCE: { | case MEM_REDUCE: { | ||||
| WxCUserBasicInfo user = (WxCUserBasicInfo)param1; | |||||
| String reason = (String)param2; | String reason = (String)param2; | ||||
| Integer scoreNum = (Integer)param3; | Integer scoreNum = (Integer)param3; | ||||
| return memReduceScore(user, reason, scoreNum); | return memReduceScore(user, reason, scoreNum); | ||||
| @@ -216,8 +216,8 @@ | |||||
| select <include refid="allColumnsOfScoreList"/> | select <include refid="allColumnsOfScoreList"/> | ||||
| from wx_c_user_basic_info cub | from wx_c_user_basic_info cub | ||||
| inner join wx_c_user cu on cu.id = cub.id | inner join wx_c_user cu on cu.id = cub.id | ||||
| where 1=1 | |||||
| where 1=1 and cub.status=0 | |||||
| <if test=" null != levelStartScore "> | <if test=" null != levelStartScore "> | ||||
| and cub.poins >= #{levelStartScore} | and cub.poins >= #{levelStartScore} | ||||
| @@ -241,7 +241,7 @@ | |||||
| select <include refid="allColumnsOfScoreList"/> | select <include refid="allColumnsOfScoreList"/> | ||||
| from wx_c_user_basic_info cub | from wx_c_user_basic_info cub | ||||
| inner join wx_c_user cu on cu.id = cub.id | inner join wx_c_user cu on cu.id = cub.id | ||||
| where cu.phone is not null | |||||
| where cub.status = 0 and cu.phone is not null | |||||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} | AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} | ||||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} | AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} | ||||
| <if test="null != tenantId"> | <if test="null != tenantId"> | ||||