Просмотр исходного кода

[积分][修改]:A端兑换停车券增加userId参数

release_toaliyun_real
hanxueda 7 лет назад
Родитель
Сommit
9594859193
3 измененных файлов: 41 добавлений и 31 удалений
  1. +20
    -22
      mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java
  2. +17
    -6
      mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java
  3. +4
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java

+ 20
- 22
mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java Просмотреть файл

@@ -1,10 +1,13 @@
package com.iformall.controller; package com.iformall.controller;


import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog; import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxOrder;
import com.iformall.domain.vo.WxOrderQueryVo; import com.iformall.domain.vo.WxOrderQueryVo;
import com.iformall.enums.EnumCouponChannelStatus; import com.iformall.enums.EnumCouponChannelStatus;
import com.iformall.enums.EnumCouponChannelType; import com.iformall.enums.EnumCouponChannelType;
@@ -12,22 +15,16 @@ import com.iformall.enums.EnumUserType;
import com.iformall.exception.MallinkException; import com.iformall.exception.MallinkException;
import com.iformall.service.WxCUserService; import com.iformall.service.WxCUserService;
import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxOrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; 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;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import com.github.pagehelper.PageInfo;
import com.iformall.common.Result;
import com.iformall.common.ResultData;

import com.iformall.domain.po.WxOrder;
import com.iformall.service.WxOrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;


@@ -134,15 +131,6 @@ public class WxOrderController extends BaseController {
@PostMapping("save") @PostMapping("save")
public ResultData saveOrder(@RequestBody Map<String, String> paramMap) { public ResultData saveOrder(@RequestBody Map<String, String> paramMap) {


MallUserInfo mallUserInfo = getUser();
WxCUser wxCUser = new WxCUser();
if (mallUserInfo != null) {
wxCUser = wxCUserService.getById(mallUserInfo.getId());
if (wxCUser == null) {
throw new MallinkException(ErrorCode.USER_NOT_MEMBER);
}
}

logger.info("OrderSave: " + paramMap.toString()); logger.info("OrderSave: " + paramMap.toString());
//Assert.notNull(wxOrders.getName(), "角色名不能为空"); //Assert.notNull(wxOrders.getName(), "角色名不能为空");
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
@@ -151,6 +139,16 @@ public class WxOrderController extends BaseController {
String pressStr = paramMap.get("press"); String pressStr = paramMap.get("press");
String orderGroupIdStr = paramMap.get("orderGroupId"); String orderGroupIdStr = paramMap.get("orderGroupId");
String formId = paramMap.get("formId"); String formId = paramMap.get("formId");
//被操作人的ID
String userIdStr = paramMap.get("userId");
Long userId = 0L;
if (StringUtils.isNotBlank(userIdStr)) {
userId = Long.valueOf(userIdStr);
}
WxCUser wxCUser = wxCUserService.getById(userId);
if (wxCUser == null) {
throw new MallinkException(ErrorCode.USER_NOT_MEMBER);
}


if (StringUtils.isBlank(couponChannelIdStr)) { if (StringUtils.isBlank(couponChannelIdStr)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空");
@@ -222,8 +220,8 @@ public class WxOrderController extends BaseController {
} }


//用于标记当前操作人为A端用户 //用于标记当前操作人为A端用户
wxCUser.setUserType(EnumUserType.MALLUSER.getCode());
wxCUser.setOperatorType(EnumUserType.MALLUSER.getCode());
wxCUser.setOperatorId(getUser().getId());
try { try {
WxOrder order = wxOrderService.saveCouponOrder(wxCUser, couponChannelId, couponId, isPress, orderGroupId, formId); WxOrder order = wxOrderService.saveCouponOrder(wxCUser, couponChannelId, couponId, isPress, orderGroupId, formId);
return new ResultData(order); return new ResultData(order);


+ 17
- 6
mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java Просмотреть файл

@@ -179,16 +179,27 @@ public class WxCUser implements Serializable {
@Transient @Transient
protected Date endDate; protected Date endDate;


//用户类型 枚举:EnumUserType
/**操作人类型 枚举:EnumUserType*/
@Transient @Transient
protected Integer userType;
private Integer operatorType;
/**操作人ID*/
@Transient
private Long operatorId;

public Integer getOperatorType() {
return operatorType;
}

public void setOperatorType(Integer operatorType) {
this.operatorType = operatorType;
}


public Integer getUserType() {
return userType;
public Long getOperatorId() {
return operatorId;
} }


public void setUserType(Integer userType) {
this.userType = userType;
public void setOperatorId(Long operatorId) {
this.operatorId = operatorId;
} }


public Date getStartDate() { public Date getStartDate() {


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

@@ -431,13 +431,14 @@ public class WxOrderServiceImpl implements WxOrderService {
} }
//扣减积分操作记录 //扣减积分操作记录
WxCreditHistory creditHistory = new WxCreditHistory(); WxCreditHistory creditHistory = new WxCreditHistory();
//记录操作人类型
if (user.getUserType() == EnumUserType.MALLUSER.getCode()) {
//记录操作人类型 操作人id
if (user.getOperatorType() == EnumUserType.MALLUSER.getCode()) {
creditHistory.setOperatorType(EnumUserType.MALLUSER.getCode()); creditHistory.setOperatorType(EnumUserType.MALLUSER.getCode());
creditHistory.setOperatorId(user.getOperatorId());
} else { } else {
creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); creditHistory.setOperatorType(EnumUserType.CUSER.getCode());
creditHistory.setOperatorId(user.getId());
} }
creditHistory.setOperatorId(user.getId());
creditHistory.setCreditNum(coupon.getCreditPrice()); creditHistory.setCreditNum(coupon.getCreditPrice());
creditHistory.setCUserId(user.getId()); creditHistory.setCUserId(user.getId());
creditHistory.setCreateDate(new Date()); creditHistory.setCreateDate(new Date());


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