xhxu 5 лет назад
Родитель
Сommit
7f1325ecf7
8 измененных файлов: 138 добавлений и 56 удалений
  1. +2
    -0
      mallinkCApi/src/main/java/com/iformall/controller/BaseController.java
  2. +15
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxActivityController.java
  3. +20
    -4
      mallinkCApi/src/main/java/com/iformall/controller/WxActivityJoinController.java
  4. +45
    -19
      mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java
  5. +20
    -6
      mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java
  6. +12
    -7
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  7. +15
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  8. +9
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java

+ 2
- 0
mallinkCApi/src/main/java/com/iformall/controller/BaseController.java Просмотреть файл

@@ -205,4 +205,6 @@ public class BaseController {
String ipaddress = IPUtil.getIpAddr(request); String ipaddress = IPUtil.getIpAddr(request);
return ipaddress; return ipaddress;
} }


} }

+ 15
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxActivityController.java Просмотреть файл

@@ -1,12 +1,15 @@
package com.iformall.controller; package com.iformall.controller;


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.domain.po.WxActivity; import com.iformall.domain.po.WxActivity;
import com.iformall.domain.po.WxCUser;
import com.iformall.service.WxActivityService; import com.iformall.service.WxActivityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -35,15 +38,25 @@ public class WxActivityController extends BaseController {
@GetMapping("/queryStatus") @GetMapping("/queryStatus")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData queryStatus(Long id) { 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查询接口") @ApiOperation("根据id查询接口")
@GetMapping("/findById") @GetMapping("/findById")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData findById(Long id) { 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); WxActivity wxActivity = wxActivityService.getById(id);
Integer status = wxActivityService.queryStatus(id, getUserId());
Integer status = wxActivityService.queryStatus(id, user.getUserId());
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("activity", wxActivity); data.put("activity", wxActivity);
data.put("status", status); data.put("status", status);


+ 20
- 4
mallinkCApi/src/main/java/com/iformall/controller/WxActivityJoinController.java Просмотреть файл

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.WxActivity; import com.iformall.domain.po.WxActivity;
import com.iformall.domain.po.WxActivityJoin; 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 = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", 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) { 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(); if (null == wxActivityJoin) wxActivityJoin = new WxActivityJoin();
wxActivityJoin.updateTenantInfo(getTenantInfo()); wxActivityJoin.updateTenantInfo(getTenantInfo());
wxActivityJoin.setUserId(getUserId());
wxActivityJoin.setUserId(user.getUserId());
wxActivityJoin.setSortColumns(BaseEntity.SortField.CreateTime_DESC); wxActivityJoin.setSortColumns(BaseEntity.SortField.CreateTime_DESC);
final PageInfo<WxActivity> page = wxActivityJoinService.clistAsPage(wxActivityJoin, pageNum, pageSize); final PageInfo<WxActivity> page = wxActivityJoinService.clistAsPage(wxActivityJoin, pageNum, pageSize);
return new ResultData(page); return new ResultData(page);
@@ -52,12 +58,17 @@ public class WxActivityJoinController extends BaseController {
@ApiOperation("报名") @ApiOperation("报名")
@PostMapping("join") @PostMapping("join")
public ResultData join(@RequestBody WxActivityJoin wxActivityJoin) { 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) { if (wxActivityJoin.getActivityId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空");
} }
wxActivityJoin.updateTenantInfo(getTenantInfo()); wxActivityJoin.updateTenantInfo(getTenantInfo());
wxActivityJoin.setUserId(getUserId());
wxActivityJoin.setNickName(getUser().getNickName());
wxActivityJoin.setUserId(user.getUserId());
wxActivityJoin.setNickName(user.getNickName());
if (StringUtils.isNotEmpty(wxActivityJoin.getAnswer())) { if (StringUtils.isNotEmpty(wxActivityJoin.getAnswer())) {
List<WxActivityJoinQuestionAnswer> wxActivityJoinQuestionAnswers = JSONArray.parseArray(wxActivityJoin.getAnswer(), WxActivityJoinQuestionAnswer.class); List<WxActivityJoinQuestionAnswer> wxActivityJoinQuestionAnswers = JSONArray.parseArray(wxActivityJoin.getAnswer(), WxActivityJoinQuestionAnswer.class);
List<WxActivityJoinQuestionAnswer> collect = wxActivityJoinQuestionAnswers.stream().filter(answer -> answer != null).collect(Collectors.toList()); List<WxActivityJoinQuestionAnswer> collect = wxActivityJoinQuestionAnswers.stream().filter(answer -> answer != null).collect(Collectors.toList());
@@ -74,11 +85,16 @@ public class WxActivityJoinController extends BaseController {
@ApiOperation("签到") @ApiOperation("签到")
@PostMapping("sign") @PostMapping("sign")
public ResultData sign(@RequestBody WxActivityJoin wxActivityJoin) { 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) { if (wxActivityJoin.getActivityId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空");
} }
wxActivityJoin.updateTenantInfo(getTenantInfo()); wxActivityJoin.updateTenantInfo(getTenantInfo());
wxActivityJoin.setUserId(getUserId());
wxActivityJoin.setUserId(user.getUserId());
return wxActivityJoinService.sign(wxActivityJoin); return wxActivityJoinService.sign(wxActivityJoin);
} }




+ 45
- 19
mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java Просмотреть файл

@@ -70,6 +70,9 @@ public class WxCarController extends BaseController {
@Autowired @Autowired
WxCreditHistoryService wxCreditHistoryService; WxCreditHistoryService wxCreditHistoryService;


@Autowired
WxCUserBasicInfoService wxCUserBasicInfoService;

private WxPark getCurrentPark(TenantEntity tenantEntity) { private WxPark getCurrentPark(TenantEntity tenantEntity) {
WxPark parkQ = new WxPark(); WxPark parkQ = new WxPark();
parkQ.updateTenantInfo(tenantEntity); parkQ.updateTenantInfo(tenantEntity);
@@ -99,11 +102,15 @@ public class WxCarController extends BaseController {
@PostMapping("/init") @PostMapping("/init")
public ResultData init(@RequestBody Map<String, String> paramMap) { public ResultData init(@RequestBody Map<String, String> paramMap) {
WxCUser user = getUser(); WxCUser user = getUser();
if (user.getUserId() == null) {
logger.error("手机号为空,请授权手机号");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号");
}
// 1, get mall's park // 1, get mall's park
WxPark park = getCurrentPark(getTenantInfo()); WxPark park = getCurrentPark(getTenantInfo());
// 2. get vendor params // 2. get vendor params
if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { 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()) || } else if (park.getVendorType().equals(EnumCarVendor.CAR_TJD.getCode()) ||
park.getVendorType().equals(EnumCarVendor.CAR_DAHUA.getCode()) || park.getVendorType().equals(EnumCarVendor.CAR_DAHUA.getCode()) ||
park.getVendorType().equals(EnumCarVendor.CAR_SHANGAN.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(), "登录失败"); 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"); 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("手机号为空,请授权手机号"); logger.error("手机号为空,请授权手机号");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号");
} }
if (!StringUtils.isBlank(user.getPhone()) && !user.getPhone().contains("*")) { if (!StringUtils.isBlank(user.getPhone()) && !user.getPhone().contains("*")) {
phone = user.getPhone(); phone = user.getPhone();
} else {
phone = user.getVerifyCodePhone();
} }
String params = park.getVendorParams(); String params = park.getVendorParams();
JSONObject objParams = JSON.parseObject(params); 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\"}") @ApiOperation(value = "绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}, TJD:={\"carNumber\":\"string\"}")
@PostMapping("/bindCar") @PostMapping("/bindCar")
public ResultData bindCar(@RequestBody Map<String, String> paramMap) { 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 // 1, get mall's park
WxPark park = getCurrentPark(getTenantInfo()); WxPark park = getCurrentPark(getTenantInfo());
// 2. get vendor params // 2. get vendor params
if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { 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()){ } else if (park.getVendorType() == EnumCarVendor.CAE_CYF.getCode()){
return cyfBindCar(paramMap,park,getUser()); return cyfBindCar(paramMap,park,getUser());
} else { } 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(); Date curr = new Date();
WxCUserCar userCar = new WxCUserCar(); WxCUserCar userCar = new WxCUserCar();
userCar.setCUserId(getUserId());
userCar.setCUserId(cuUserId);
userCar.updateTenantInfo(park); userCar.updateTenantInfo(park);
userCar.setCarNumber(carNumber); userCar.setCarNumber(carNumber);
userCar.setVendorType(carVendor.getCode()); userCar.setVendorType(carVendor.getCode());
@@ -338,7 +349,7 @@ public class WxCarController extends BaseController {
wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar); wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar);
//增加积分 //增加积分
addCredit(park, cuUserId); 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) { 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); JSONObject objParams = JSON.parseObject(params);
String token = objParams.getString("token"); String token = objParams.getString("token");
int feeGroupId = objParams.getIntValue("feeGroupId"); 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); JSONObject retObj = JSON.parseObject(ret);
if (retObj.getIntValue("result") == 1){ if (retObj.getIntValue("result") == 1){
addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType()), park, wxCUser.getId());
addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType()), park, wxCUser.getUserId());
}else { }else {
return new ResultData(ErrorCode.CAR_BIND_FAIL.getCode(), "绑车牌失败", retObj); 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()); 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; return null;
} }


@@ -460,12 +471,18 @@ public class WxCarController extends BaseController {
"TJD:={\"carNumber\":\"string\"}") "TJD:={\"carNumber\":\"string\"}")
@PostMapping("/unbindCar") @PostMapping("/unbindCar")
public ResultData unbindCar(@RequestBody Map<String, String> paramMap) { 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 // 1, get mall's park
WxPark park = getCurrentPark(getTenantInfo()); WxPark park = getCurrentPark(getTenantInfo());
if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) {
return etcpUnbindCar(paramMap, park, getUserId());
return etcpUnbindCar(paramMap, park, user.getUserId());
} else { } else {
return unbindCar(paramMap, park, getUserId());
return unbindCar(paramMap, park, user.getUserId());
} }
} }


@@ -536,7 +553,7 @@ public class WxCarController extends BaseController {
return new ResultData(); 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"); String carNumber = paramMap.get("carNumber");
if (StringUtils.isBlank(carNumber)) { if (StringUtils.isBlank(carNumber)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空");
@@ -544,7 +561,7 @@ public class WxCarController extends BaseController {
WxCUserCar queryOne = new WxCUserCar(); WxCUserCar queryOne = new WxCUserCar();
queryOne.setCarNumber(carNumber); queryOne.setCarNumber(carNumber);
queryOne.updateTenantInfo(park); queryOne.updateTenantInfo(park);
queryOne.setCUserId(getUserId());
queryOne.setCUserId(userId);
WxCUserCar userCar = wxCUserCarService.getOne(queryOne); WxCUserCar userCar = wxCUserCarService.getOne(queryOne);
if (userCar != null) { if (userCar != null) {
String params = userCar.getVendorParams(); String params = userCar.getVendorParams();
@@ -781,6 +798,11 @@ public class WxCarController extends BaseController {
) )
@PostMapping("/getCoupon") @PostMapping("/getCoupon")
public ResultData getCoupon(@RequestBody Map<String, String> paramMap) { 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 /// 1, get mall's park
WxPark park = getCurrentPark(getTenantInfo()); WxPark park = getCurrentPark(getTenantInfo());
String carNumber = paramMap.get("carNumber"); String carNumber = paramMap.get("carNumber");
@@ -802,7 +824,7 @@ public class WxCarController extends BaseController {
WxCouponOrderCarCVo userCar = null; WxCouponOrderCarCVo userCar = null;
WxCouponOrder userCarQ = new WxCouponOrder(); WxCouponOrder userCarQ = new WxCouponOrder();
userCarQ.updateTenantInfo(park); userCarQ.updateTenantInfo(park);
userCarQ.setCUserId(getUserId());
userCarQ.setCUserId(user.getUserId());
userCarQ.setId(couponOrderId); userCarQ.setId(couponOrderId);
userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode());
List<WxCouponOrderCarCVo> list = wxCouponOrderService.carListCUserVo(userCarQ); 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), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true),
}) })
public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { 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) { if (pageNum == null || pageSize == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
} }
if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderCarCVo(); if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderCarCVo();
wxCouponOrder.updateTenantInfo(getTenantInfo()); wxCouponOrder.updateTenantInfo(getTenantInfo());
wxCouponOrder.setCUserId(getUserId());
wxCouponOrder.setCUserId(user.getUserId());
if (wxCouponOrder.getCouponOrderStatus() == null) if (wxCouponOrder.getCouponOrderStatus() == null)
wxCouponOrder.setSortColumns(BaseEntity.SortField.CreateDate_DESC); wxCouponOrder.setSortColumns(BaseEntity.SortField.CreateDate_DESC);
else if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()) else if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())


+ 20
- 6
mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java Просмотреть файл

@@ -60,7 +60,11 @@ public class WxCardPayController extends BaseController {
logger.info("saveCardPayOrder: " + ipStr + " :" + paramMap.toString()); logger.info("saveCardPayOrder: " + ipStr + " :" + paramMap.toString());


WxCUser user = getUser(); 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())) { if (null != wxCUserBasicInfo && EnumCreditLockedStatus.CLOSE.getCode().equals(wxCUserBasicInfo.getStatus())) {
logger.error(ErrorCode.MEMBER_IS_LOCKED.getMessage()); logger.error(ErrorCode.MEMBER_IS_LOCKED.getMessage());
return new ResultData(ErrorCode.MEMBER_IS_LOCKED); return new ResultData(ErrorCode.MEMBER_IS_LOCKED);
@@ -115,7 +119,7 @@ public class WxCardPayController extends BaseController {


//查看所有者与扫码者是否为一致 //查看所有者与扫码者是否为一致
WxCouponOrder couponOrder = wxCouponOrderService.getById(cardId); WxCouponOrder couponOrder = wxCouponOrderService.getById(cardId);
if (!couponOrder.getOwnerId().equals(getUserId())) {
if (!couponOrder.getOwnerId().equals(user.getUserId())) {
logger.error("卡已被领取: " + cardIdStr); logger.error("卡已被领取: " + cardIdStr);
return new ResultData(ErrorCode.CARD_TRANSFERED); return new ResultData(ErrorCode.CARD_TRANSFERED);
} }
@@ -134,7 +138,7 @@ public class WxCardPayController extends BaseController {


WxOrder order = null; WxOrder order = null;
try { try {
order = wxOrderService.saveCardPayOrder(merchant, getUserId(), totalFeeStr, payment);
order = wxOrderService.saveCardPayOrder(merchant, user.getUserId(), totalFeeStr, payment);
} catch (MallinkException e) { } catch (MallinkException e) {
logger.error("saveCardPayOrder 1" + e.getMessage()); logger.error("saveCardPayOrder 1" + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage()); return new ResultData(e.getErrorCode(), e.getMessage());
@@ -146,7 +150,7 @@ public class WxCardPayController extends BaseController {
WxCardSpend record = new WxCardSpend(); WxCardSpend record = new WxCardSpend();
record.updateTenantInfo(merchant); record.updateTenantInfo(merchant);
record.setCardId(cardId); record.setCardId(cardId);
record.setOwnerId(getUserId());
record.setOwnerId(user.getUserId());
record.setMerchantId(merchantId); record.setMerchantId(merchantId);
record.setOrderId(order.getId()); record.setOrderId(order.getId());
record.setIp(ipStr); record.setIp(ipStr);
@@ -171,9 +175,14 @@ public class WxCardPayController extends BaseController {
public ResultData cardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend, Integer pageNum, Integer pageSize) { public ResultData cardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend, Integer pageNum, Integer pageSize) {
String ipStr = getIpAddr(); String ipStr = getIpAddr();
logger.info("list: " + ipStr + " :" + wxCardSpend.toString()); 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(); if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo();
wxCardSpend.updateTenantInfo(getTenantInfo()); wxCardSpend.updateTenantInfo(getTenantInfo());
wxCardSpend.setOwnerId(getUserId());
wxCardSpend.setOwnerId(user.getUserId());
final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize); final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize);
return new ResultData(page); return new ResultData(page);
} }
@@ -183,9 +192,14 @@ public class WxCardPayController extends BaseController {
public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) { public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
String ipStr = getIpAddr(); String ipStr = getIpAddr();
logger.info("sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString()); 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(); if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo();
wxCardSpend.updateTenantInfo(getTenantInfo()); wxCardSpend.updateTenantInfo(getTenantInfo());
wxCardSpend.setOwnerId(getUserId());
wxCardSpend.setOwnerId(user.getUserId());
final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForOwner(wxCardSpend); final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForOwner(wxCardSpend);
return new ResultData(mapList); return new ResultData(mapList);
} }


+ 12
- 7
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java Просмотреть файл

@@ -78,9 +78,13 @@ 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 (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())) { 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); return new ResultData(ErrorCode.MEMBER_IS_LOCKED);
} }


@@ -93,7 +97,7 @@ public class WxOrderController extends BaseController {
} }
//判断是否是拼团订单,如果是拼团订单,判断现在进行中的,和已完成的数量是否超出券的限制 //判断是否是拼团订单,如果是拼团订单,判断现在进行中的,和已完成的数量是否超出券的限制
if (coupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode())) { 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()) { if (ordercount>=coupon.getUseLimitQuantity()) {
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"您当前此券的有效拼团数量达到券的限购次数。"); 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()); logger.error("购买券条件判断错误:ID=" + coupon.getId() + e.getMessage());
} }
if (jo != null) { if (jo != null) {
WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getUserId());
if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()){ if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()){
WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getId());
if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0) if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0)
return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER);
if (wxOrderService.countCouponConditionType1(user) > 0) if (wxOrderService.countCouponConditionType1(user) > 0)
@@ -168,13 +173,13 @@ public class WxOrderController extends BaseController {
int max = jo.getIntValue("max"); int max = jo.getIntValue("max");
int min = jo.getIntValue("min"); 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); 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); 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); return new ResultData(ErrorCode.COUPON_SCORE_NOT_IN_RANGE);
} }
} }


+ 15
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -829,14 +829,16 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
} }
} }


WxCUserBasicInfo oldUserBase = null;
// WxCUserBasicInfo oldUserBase = null;
WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo(); WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo();
userBaseQ.updateTenantInfo(mallUserInfo);
// userBaseQ.updateTenantInfo(mallUserInfo);
userBaseQ.undateFinalTenantId(mallUserInfo);
userBaseQ.setPhone(userBase.getPhone()); 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) { if (oldUserBase != null) {
oldUserBase.setName(userBase.getName()); oldUserBase.setName(userBase.getName());
@@ -881,8 +883,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
WxCUser user = userList.get(0); WxCUser user = userList.get(0);
if (user != null) { 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); wxCUserMapper.updateById(user);
} }
bHaveCUser = true; bHaveCUser = true;
@@ -890,7 +896,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
if(oldUserBase != null) { if(oldUserBase != null) {
oldUserBase.setNickName(user.getNickName()); oldUserBase.setNickName(user.getNickName());
} }
userBase.setId(user.getId());
userBase.setId(user.getUserId());
userBase.setNickName(user.getNickName()); userBase.setNickName(user.getNickName());
} else { } else {
userBase.setNickName(user.getNickName()); userBase.setNickName(user.getNickName());


+ 9
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -395,7 +395,7 @@ public class WxOrderServiceImpl implements WxOrderService {
orderQ.updateTenantInfo(counpon); orderQ.updateTenantInfo(counpon);
orderQ.setProductId(counpon.getId()); orderQ.setProductId(counpon.getId());
orderQ.setType(EnumOrderType.COUPON.getCode()); orderQ.setType(EnumOrderType.COUPON.getCode());
orderQ.setCUserId(user.getId());
orderQ.setCUserId(user.getUserId());
List<Integer> statusS = new ArrayList<>(); List<Integer> statusS = new ArrayList<>();
statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode());
@@ -454,7 +454,7 @@ public class WxOrderServiceImpl implements WxOrderService {
WxOrder orderQ = new WxOrder(); WxOrder orderQ = new WxOrder();
orderQ.setTenantId(user.getTenantId()); orderQ.setTenantId(user.getTenantId());
orderQ.setType(EnumOrderType.COUPON.getCode()); orderQ.setType(EnumOrderType.COUPON.getCode());
orderQ.setCUserId(user.getId());
orderQ.setCUserId(user.getUserId());
List<Integer> statusS = new ArrayList<>(); List<Integer> statusS = new ArrayList<>();
statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode());
@@ -1049,8 +1049,8 @@ public class WxOrderServiceImpl implements WxOrderService {
couponOrder.updateTenantInfo(order); couponOrder.updateTenantInfo(order);
couponOrder.setCouponId(order.getProductId()); couponOrder.setCouponId(order.getProductId());
couponOrder.setCouponType(coupon.getType()); 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.setAutoRefund(coupon.getAutoRefund());
couponOrder.setOrderId(order.getOrderNumber()); couponOrder.setOrderId(order.getOrderNumber());
couponOrder.setExpiredTime(valid_date); couponOrder.setExpiredTime(valid_date);
@@ -1363,7 +1363,7 @@ public class WxOrderServiceImpl implements WxOrderService {
orderSuccess.setMsgType(EnumMsgRecordType.INSIDE_ORDER_SUCCESS.getCode()); orderSuccess.setMsgType(EnumMsgRecordType.INSIDE_ORDER_SUCCESS.getCode());
orderSuccess.updateTenantInfo(updateOrder); orderSuccess.updateTenantInfo(updateOrder);
orderSuccess.setOrderId(updateOrder.getId()); orderSuccess.setOrderId(updateOrder.getId());
orderSuccess.setCUserId(user.getId());
orderSuccess.setCUserId(user.getUserId());
orderSuccess.setCouponId(coupon.getId()); orderSuccess.setCouponId(coupon.getId());
logger.info(">>>>>>>>>>>send sendInsideOrderSuccessMsg :"+orderSuccess); logger.info(">>>>>>>>>>>send sendInsideOrderSuccessMsg :"+orderSuccess);
mqBaseProducer.sendMessage(orderSuccess, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); 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 != null) {
if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()) { 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.updateTenantInfo(coupon);
record.setOrderNumber(orderNumber); record.setOrderNumber(orderNumber);
record.setProductId(coupon.getId()); record.setProductId(coupon.getId());
record.setCUserId(user.getId());
record.setCUserId(user.getUserId());
record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode());
record.setDetail(bodyStr); record.setDetail(bodyStr);
record.setCreateDate(curr); record.setCreateDate(curr);
@@ -2144,10 +2144,10 @@ public class WxOrderServiceImpl implements WxOrderService {
creditHistory.setOperatorId(user.getOperatorId()); creditHistory.setOperatorId(user.getOperatorId());
} else { } else {
creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); creditHistory.setOperatorType(EnumUserType.CUSER.getCode());
creditHistory.setOperatorId(user.getId());
creditHistory.setOperatorId(user.getUserId());
} }
creditHistory.setCreditNum(coupon.getCreditPrice()); creditHistory.setCreditNum(coupon.getCreditPrice());
creditHistory.setCUserId(user.getId());
creditHistory.setCUserId(user.getUserId());
creditHistory.updateTenantInfo(coupon); creditHistory.updateTenantInfo(coupon);
creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode());
creditHistory.setCouponId(coupon.getId()); creditHistory.setCouponId(coupon.getId());


Загрузка…
Отмена
Сохранить