| @@ -205,4 +205,6 @@ public class BaseController { | |||
| String ipaddress = IPUtil.getIpAddr(request); | |||
| return ipaddress; | |||
| } | |||
| } | |||
| @@ -1,12 +1,15 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.service.WxActivityService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -35,15 +38,25 @@ public class WxActivityController extends BaseController { | |||
| @GetMapping("/queryStatus") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData queryStatus(Long id) { | |||
| return new ResultData(wxActivityService.queryStatus(id, getUserId())); | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| return new ResultData(wxActivityService.queryStatus(id, user.getUserId())); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| WxActivity wxActivity = wxActivityService.getById(id); | |||
| Integer status = wxActivityService.queryStatus(id, getUserId()); | |||
| Integer status = wxActivityService.queryStatus(id, user.getUserId()); | |||
| Map<String, Object> data = new HashMap<>(); | |||
| data.put("activity", wxActivity); | |||
| data.put("status", status); | |||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxActivityJoin; | |||
| @@ -41,9 +42,14 @@ public class WxActivityJoinController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxActivityJoin wxActivityJoin, Integer pageNum, Integer pageSize) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (null == wxActivityJoin) wxActivityJoin = new WxActivityJoin(); | |||
| wxActivityJoin.updateTenantInfo(getTenantInfo()); | |||
| wxActivityJoin.setUserId(getUserId()); | |||
| wxActivityJoin.setUserId(user.getUserId()); | |||
| wxActivityJoin.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| final PageInfo<WxActivity> page = wxActivityJoinService.clistAsPage(wxActivityJoin, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -52,12 +58,17 @@ public class WxActivityJoinController extends BaseController { | |||
| @ApiOperation("报名") | |||
| @PostMapping("join") | |||
| public ResultData join(@RequestBody WxActivityJoin wxActivityJoin) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (wxActivityJoin.getActivityId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); | |||
| } | |||
| wxActivityJoin.updateTenantInfo(getTenantInfo()); | |||
| wxActivityJoin.setUserId(getUserId()); | |||
| wxActivityJoin.setNickName(getUser().getNickName()); | |||
| wxActivityJoin.setUserId(user.getUserId()); | |||
| wxActivityJoin.setNickName(user.getNickName()); | |||
| if (StringUtils.isNotEmpty(wxActivityJoin.getAnswer())) { | |||
| List<WxActivityJoinQuestionAnswer> wxActivityJoinQuestionAnswers = JSONArray.parseArray(wxActivityJoin.getAnswer(), WxActivityJoinQuestionAnswer.class); | |||
| List<WxActivityJoinQuestionAnswer> collect = wxActivityJoinQuestionAnswers.stream().filter(answer -> answer != null).collect(Collectors.toList()); | |||
| @@ -74,11 +85,16 @@ public class WxActivityJoinController extends BaseController { | |||
| @ApiOperation("签到") | |||
| @PostMapping("sign") | |||
| public ResultData sign(@RequestBody WxActivityJoin wxActivityJoin) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (wxActivityJoin.getActivityId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); | |||
| } | |||
| wxActivityJoin.updateTenantInfo(getTenantInfo()); | |||
| wxActivityJoin.setUserId(getUserId()); | |||
| wxActivityJoin.setUserId(user.getUserId()); | |||
| return wxActivityJoinService.sign(wxActivityJoin); | |||
| } | |||
| @@ -70,6 +70,9 @@ public class WxCarController extends BaseController { | |||
| @Autowired | |||
| WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| private WxPark getCurrentPark(TenantEntity tenantEntity) { | |||
| WxPark parkQ = new WxPark(); | |||
| parkQ.updateTenantInfo(tenantEntity); | |||
| @@ -99,11 +102,15 @@ public class WxCarController extends BaseController { | |||
| @PostMapping("/init") | |||
| public ResultData init(@RequestBody Map<String, String> paramMap) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| // 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| // 2. get vendor params | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return initForEtcp(paramMap, user, park); | |||
| return initForEtcp(paramMap, user.getUserId(), park); | |||
| } else if (park.getVendorType().equals(EnumCarVendor.CAR_TJD.getCode()) || | |||
| park.getVendorType().equals(EnumCarVendor.CAR_DAHUA.getCode()) || | |||
| park.getVendorType().equals(EnumCarVendor.CAR_SHANGAN.getCode()) || | |||
| @@ -115,16 +122,15 @@ public class WxCarController extends BaseController { | |||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "登录失败"); | |||
| } | |||
| private ResultData initForEtcp(Map<String, String> paramMap, WxCUser user, WxPark park) { | |||
| private ResultData initForEtcp(Map<String, String> paramMap, Long userId, WxPark park) { | |||
| String phone = paramMap.get("phone"); | |||
| if (StringUtils.isBlank(phone) && StringUtils.isBlank(user.getPhone()) && StringUtils.isBlank(user.getVerifyCodePhone())) { | |||
| WxCUserBasicInfo user = wxCUserBasicInfoService.getById(userId); | |||
| if (StringUtils.isBlank(phone) && StringUtils.isBlank(user.getPhone())) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (!StringUtils.isBlank(user.getPhone()) && !user.getPhone().contains("*")) { | |||
| phone = user.getPhone(); | |||
| } else { | |||
| phone = user.getVerifyCodePhone(); | |||
| } | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| @@ -255,16 +261,21 @@ public class WxCarController extends BaseController { | |||
| @ApiOperation(value = "绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}, TJD:={\"carNumber\":\"string\"}") | |||
| @PostMapping("/bindCar") | |||
| public ResultData bindCar(@RequestBody Map<String, String> paramMap) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| // 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| // 2. get vendor params | |||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | |||
| return etcpBindCar(paramMap, park, getUserId()); | |||
| return etcpBindCar(paramMap, park, user.getUserId()); | |||
| } else if (park.getVendorType() == EnumCarVendor.CAE_CYF.getCode()){ | |||
| return cyfBindCar(paramMap,park,getUser()); | |||
| } else { | |||
| // 内部操作 | |||
| return bindCar(paramMap, park, getUserId()); | |||
| return bindCar(paramMap, park, user.getUserId()); | |||
| } | |||
| } | |||
| @@ -326,7 +337,7 @@ public class WxCarController extends BaseController { | |||
| // 插入车牌 | |||
| Date curr = new Date(); | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.setCUserId(getUserId()); | |||
| userCar.setCUserId(cuUserId); | |||
| userCar.updateTenantInfo(park); | |||
| userCar.setCarNumber(carNumber); | |||
| userCar.setVendorType(carVendor.getCode()); | |||
| @@ -338,7 +349,7 @@ public class WxCarController extends BaseController { | |||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar); | |||
| //增加积分 | |||
| addCredit(park, cuUserId); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,getUserId()); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,cuUserId); | |||
| } | |||
| private ResultData tjdBindCar(@RequestBody Map<String, String> paramMap, WxPark park, Long cuUserId) { | |||
| @@ -395,10 +406,10 @@ public class WxCarController extends BaseController { | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| int feeGroupId = objParams.getIntValue("feeGroupId"); | |||
| String ret = cyf.registerCar(token,park.getNumber(),feeGroupId,park.getParkingId(),carNumber,wxCUser.getId(),wxCUser.getNickName()); | |||
| String ret = cyf.registerCar(token,park.getNumber(),feeGroupId,park.getParkingId(),carNumber,wxCUser.getUserId(),wxCUser.getNickName()); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType()), park, wxCUser.getId()); | |||
| addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType()), park, wxCUser.getUserId()); | |||
| }else { | |||
| return new ResultData(ErrorCode.CAR_BIND_FAIL.getCode(), "绑车牌失败", retObj); | |||
| } | |||
| @@ -430,7 +441,7 @@ public class WxCarController extends BaseController { | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | |||
| } | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR, getUserId()); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR, cuUserId); | |||
| return null; | |||
| } | |||
| @@ -460,12 +471,18 @@ public class WxCarController extends BaseController { | |||
| "TJD:={\"carNumber\":\"string\"}") | |||
| @PostMapping("/unbindCar") | |||
| public ResultData unbindCar(@RequestBody Map<String, String> paramMap) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| // 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return etcpUnbindCar(paramMap, park, getUserId()); | |||
| return etcpUnbindCar(paramMap, park, user.getUserId()); | |||
| } else { | |||
| return unbindCar(paramMap, park, getUserId()); | |||
| return unbindCar(paramMap, park, user.getUserId()); | |||
| } | |||
| } | |||
| @@ -536,7 +553,7 @@ public class WxCarController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| private ResultData tjdUnbindCar(@RequestBody Map<String, String> paramMap, WxPark park) { | |||
| private ResultData tjdUnbindCar(@RequestBody Map<String, String> paramMap, WxPark park, Long userId) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| @@ -544,7 +561,7 @@ public class WxCarController extends BaseController { | |||
| WxCUserCar queryOne = new WxCUserCar(); | |||
| queryOne.setCarNumber(carNumber); | |||
| queryOne.updateTenantInfo(park); | |||
| queryOne.setCUserId(getUserId()); | |||
| queryOne.setCUserId(userId); | |||
| WxCUserCar userCar = wxCUserCarService.getOne(queryOne); | |||
| if (userCar != null) { | |||
| String params = userCar.getVendorParams(); | |||
| @@ -781,6 +798,11 @@ public class WxCarController extends BaseController { | |||
| ) | |||
| @PostMapping("/getCoupon") | |||
| public ResultData getCoupon(@RequestBody Map<String, String> paramMap) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| /// 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| String carNumber = paramMap.get("carNumber"); | |||
| @@ -802,7 +824,7 @@ public class WxCarController extends BaseController { | |||
| WxCouponOrderCarCVo userCar = null; | |||
| WxCouponOrder userCarQ = new WxCouponOrder(); | |||
| userCarQ.updateTenantInfo(park); | |||
| userCarQ.setCUserId(getUserId()); | |||
| userCarQ.setCUserId(user.getUserId()); | |||
| userCarQ.setId(couponOrderId); | |||
| userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| List<WxCouponOrderCarCVo> list = wxCouponOrderService.carListCUserVo(userCarQ); | |||
| @@ -975,13 +997,17 @@ public class WxCarController extends BaseController { | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (pageNum == null || pageSize == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderCarCVo(); | |||
| wxCouponOrder.updateTenantInfo(getTenantInfo()); | |||
| wxCouponOrder.setCUserId(getUserId()); | |||
| wxCouponOrder.setCUserId(user.getUserId()); | |||
| if (wxCouponOrder.getCouponOrderStatus() == null) | |||
| wxCouponOrder.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| else if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()) | |||
| @@ -60,7 +60,11 @@ public class WxCardPayController extends BaseController { | |||
| logger.info("saveCardPayOrder: " + ipStr + " :" + paramMap.toString()); | |||
| WxCUser user = getUser(); | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getUserId()); | |||
| if (null != wxCUserBasicInfo && EnumCreditLockedStatus.CLOSE.getCode().equals(wxCUserBasicInfo.getStatus())) { | |||
| logger.error(ErrorCode.MEMBER_IS_LOCKED.getMessage()); | |||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||
| @@ -115,7 +119,7 @@ public class WxCardPayController extends BaseController { | |||
| //查看所有者与扫码者是否为一致 | |||
| WxCouponOrder couponOrder = wxCouponOrderService.getById(cardId); | |||
| if (!couponOrder.getOwnerId().equals(getUserId())) { | |||
| if (!couponOrder.getOwnerId().equals(user.getUserId())) { | |||
| logger.error("卡已被领取: " + cardIdStr); | |||
| return new ResultData(ErrorCode.CARD_TRANSFERED); | |||
| } | |||
| @@ -134,7 +138,7 @@ public class WxCardPayController extends BaseController { | |||
| WxOrder order = null; | |||
| try { | |||
| order = wxOrderService.saveCardPayOrder(merchant, getUserId(), totalFeeStr, payment); | |||
| order = wxOrderService.saveCardPayOrder(merchant, user.getUserId(), totalFeeStr, payment); | |||
| } catch (MallinkException e) { | |||
| logger.error("saveCardPayOrder 1" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -146,7 +150,7 @@ public class WxCardPayController extends BaseController { | |||
| WxCardSpend record = new WxCardSpend(); | |||
| record.updateTenantInfo(merchant); | |||
| record.setCardId(cardId); | |||
| record.setOwnerId(getUserId()); | |||
| record.setOwnerId(user.getUserId()); | |||
| record.setMerchantId(merchantId); | |||
| record.setOrderId(order.getId()); | |||
| record.setIp(ipStr); | |||
| @@ -171,9 +175,14 @@ public class WxCardPayController extends BaseController { | |||
| public ResultData cardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend, Integer pageNum, Integer pageSize) { | |||
| String ipStr = getIpAddr(); | |||
| logger.info("list: " + ipStr + " :" + wxCardSpend.toString()); | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | |||
| wxCardSpend.updateTenantInfo(getTenantInfo()); | |||
| wxCardSpend.setOwnerId(getUserId()); | |||
| wxCardSpend.setOwnerId(user.getUserId()); | |||
| final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -183,9 +192,14 @@ public class WxCardPayController extends BaseController { | |||
| public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) { | |||
| String ipStr = getIpAddr(); | |||
| logger.info("sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString()); | |||
| WxCUser user = getUser(); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | |||
| wxCardSpend.updateTenantInfo(getTenantInfo()); | |||
| wxCardSpend.setOwnerId(getUserId()); | |||
| wxCardSpend.setOwnerId(user.getUserId()); | |||
| final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForOwner(wxCardSpend); | |||
| return new ResultData(mapList); | |||
| } | |||
| @@ -78,9 +78,13 @@ public class WxOrderController extends BaseController { | |||
| if (resultData != null) return resultData; | |||
| WxCUser user = getUser(); | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); | |||
| if (user.getUserId() == null) { | |||
| logger.error("手机号为空,请授权手机号"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||
| } | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(user.getUserId()); | |||
| if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | |||
| logger.info("会员权益被锁定:cUserId:" + user.getId()); | |||
| logger.info("会员权益被锁定:cUserId:" + user.getUserId()); | |||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||
| } | |||
| @@ -93,7 +97,7 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| //判断是否是拼团订单,如果是拼团订单,判断现在进行中的,和已完成的数量是否超出券的限制 | |||
| if (coupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode())) { | |||
| int ordercount = wxOrderService.countUserCouponGroupOrder(user.getId(),coupon.getId()); | |||
| int ordercount = wxOrderService.countUserCouponGroupOrder(user.getUserId(),coupon.getId()); | |||
| if (ordercount>=coupon.getUseLimitQuantity()) { | |||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"您当前此券的有效拼团数量达到券的限购次数。"); | |||
| } | |||
| @@ -158,8 +162,9 @@ public class WxOrderController extends BaseController { | |||
| logger.error("购买券条件判断错误:ID=" + coupon.getId() + e.getMessage()); | |||
| } | |||
| if (jo != null) { | |||
| WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getUserId()); | |||
| if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()){ | |||
| WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); | |||
| if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0) | |||
| return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); | |||
| if (wxOrderService.countCouponConditionType1(user) > 0) | |||
| @@ -168,13 +173,13 @@ public class WxOrderController extends BaseController { | |||
| int max = jo.getIntValue("max"); | |||
| int min = jo.getIntValue("min"); | |||
| if (max!=0 && min ==0 && user.getScore() > max) { | |||
| if (max!=0 && min ==0 && cUserBasicInfo.getPoins() > max) { | |||
| return new ResultData(ErrorCode.COUPON_SCORE_NOT_IN_RANGE); | |||
| } | |||
| if (max==0 && min !=0 && user.getScore() < min) { | |||
| if (max==0 && min !=0 && cUserBasicInfo.getPoins() < min) { | |||
| return new ResultData(ErrorCode.COUPON_SCORE_NOT_IN_RANGE); | |||
| } | |||
| if (max!=0 && min !=0 && (user.getScore() < min || user.getScore() > max)) { | |||
| if (max!=0 && min !=0 && (cUserBasicInfo.getPoins() < min || cUserBasicInfo.getPoins() > max)) { | |||
| return new ResultData(ErrorCode.COUPON_SCORE_NOT_IN_RANGE); | |||
| } | |||
| } | |||
| @@ -829,14 +829,16 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| } | |||
| WxCUserBasicInfo oldUserBase = null; | |||
| // WxCUserBasicInfo oldUserBase = null; | |||
| WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo(); | |||
| userBaseQ.updateTenantInfo(mallUserInfo); | |||
| // userBaseQ.updateTenantInfo(mallUserInfo); | |||
| userBaseQ.undateFinalTenantId(mallUserInfo); | |||
| userBaseQ.setPhone(userBase.getPhone()); | |||
| List<WxCUserBasicInfo> userBList = wxCUserBasicInfoMapper.selectList(new QueryWrapper(userBaseQ)); | |||
| if (userBList.size() > 0) { | |||
| oldUserBase = userBList.get(0); | |||
| } | |||
| WxCUserBasicInfo oldUserBase = wxCUserBasicInfoMapper.selectOne(new QueryWrapper(userBaseQ)); | |||
| // List<WxCUserBasicInfo> userBList = wxCUserBasicInfoMapper.selectList(new QueryWrapper(userBaseQ)); | |||
| // if (userBList.size() > 0) { | |||
| // oldUserBase = userBList.get(0); | |||
| // } | |||
| if (oldUserBase != null) { | |||
| oldUserBase.setName(userBase.getName()); | |||
| @@ -881,8 +883,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| WxCUser user = userList.get(0); | |||
| if (user != null) { | |||
| //覆盖积分 | |||
| if(credit != null) { | |||
| user.setCredit(credit); | |||
| // if(credit != null) { | |||
| // user.setCredit(credit); | |||
| // wxCUserMapper.updateById(user); | |||
| // } | |||
| if(user.getUserId() == null){ | |||
| user.setUserId(user.getId()); | |||
| wxCUserMapper.updateById(user); | |||
| } | |||
| bHaveCUser = true; | |||
| @@ -890,7 +896,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| if(oldUserBase != null) { | |||
| oldUserBase.setNickName(user.getNickName()); | |||
| } | |||
| userBase.setId(user.getId()); | |||
| userBase.setId(user.getUserId()); | |||
| userBase.setNickName(user.getNickName()); | |||
| } else { | |||
| userBase.setNickName(user.getNickName()); | |||
| @@ -395,7 +395,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| orderQ.updateTenantInfo(counpon); | |||
| orderQ.setProductId(counpon.getId()); | |||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||
| orderQ.setCUserId(user.getId()); | |||
| orderQ.setCUserId(user.getUserId()); | |||
| List<Integer> statusS = new ArrayList<>(); | |||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); | |||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); | |||
| @@ -454,7 +454,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| WxOrder orderQ = new WxOrder(); | |||
| orderQ.setTenantId(user.getTenantId()); | |||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||
| orderQ.setCUserId(user.getId()); | |||
| orderQ.setCUserId(user.getUserId()); | |||
| List<Integer> statusS = new ArrayList<>(); | |||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||
| @@ -1049,8 +1049,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| couponOrder.updateTenantInfo(order); | |||
| couponOrder.setCouponId(order.getProductId()); | |||
| couponOrder.setCouponType(coupon.getType()); | |||
| couponOrder.setCUserId(user.getId()); | |||
| couponOrder.setOwnerId(user.getId()); | |||
| couponOrder.setCUserId(user.getUserId()); | |||
| couponOrder.setOwnerId(user.getUserId()); | |||
| couponOrder.setAutoRefund(coupon.getAutoRefund()); | |||
| couponOrder.setOrderId(order.getOrderNumber()); | |||
| couponOrder.setExpiredTime(valid_date); | |||
| @@ -1363,7 +1363,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| orderSuccess.setMsgType(EnumMsgRecordType.INSIDE_ORDER_SUCCESS.getCode()); | |||
| orderSuccess.updateTenantInfo(updateOrder); | |||
| orderSuccess.setOrderId(updateOrder.getId()); | |||
| orderSuccess.setCUserId(user.getId()); | |||
| orderSuccess.setCUserId(user.getUserId()); | |||
| orderSuccess.setCouponId(coupon.getId()); | |||
| logger.info(">>>>>>>>>>>send sendInsideOrderSuccessMsg :"+orderSuccess); | |||
| mqBaseProducer.sendMessage(orderSuccess, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| @@ -1398,7 +1398,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| if (jo != null) { | |||
| if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()) { | |||
| wxCUserBasicInfoMapper.incActRecordById(user.getId()); | |||
| wxCUserBasicInfoMapper.incActRecordById(user.getUserId()); | |||
| } | |||
| } | |||
| @@ -2098,7 +2098,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| record.updateTenantInfo(coupon); | |||
| record.setOrderNumber(orderNumber); | |||
| record.setProductId(coupon.getId()); | |||
| record.setCUserId(user.getId()); | |||
| record.setCUserId(user.getUserId()); | |||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| record.setDetail(bodyStr); | |||
| record.setCreateDate(curr); | |||
| @@ -2144,10 +2144,10 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| creditHistory.setOperatorId(user.getOperatorId()); | |||
| } else { | |||
| creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | |||
| creditHistory.setOperatorId(user.getId()); | |||
| creditHistory.setOperatorId(user.getUserId()); | |||
| } | |||
| creditHistory.setCreditNum(coupon.getCreditPrice()); | |||
| creditHistory.setCUserId(user.getId()); | |||
| creditHistory.setCUserId(user.getUserId()); | |||
| creditHistory.updateTenantInfo(coupon); | |||
| creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | |||
| creditHistory.setCouponId(coupon.getId()); | |||