diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java index f447c1835..d4f5ea905 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java @@ -1,10 +1,13 @@ package com.iformall.controller; +import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; 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.WxCouponChannel; +import com.iformall.domain.po.WxOrder; import com.iformall.domain.vo.WxOrderQueryVo; import com.iformall.enums.EnumCouponChannelStatus; import com.iformall.enums.EnumCouponChannelType; @@ -12,22 +15,16 @@ import com.iformall.enums.EnumUserType; import com.iformall.exception.MallinkException; import com.iformall.service.WxCUserService; 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.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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.Map; @@ -134,15 +131,6 @@ public class WxOrderController extends BaseController { @PostMapping("save") public ResultData saveOrder(@RequestBody Map 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()); //Assert.notNull(wxOrders.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); @@ -151,6 +139,16 @@ public class WxOrderController extends BaseController { String pressStr = paramMap.get("press"); String orderGroupIdStr = paramMap.get("orderGroupId"); 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)) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); @@ -222,8 +220,8 @@ public class WxOrderController extends BaseController { } //用于标记当前操作人为A端用户 - wxCUser.setUserType(EnumUserType.MALLUSER.getCode()); - + wxCUser.setOperatorType(EnumUserType.MALLUSER.getCode()); + wxCUser.setOperatorId(getUser().getId()); try { WxOrder order = wxOrderService.saveCouponOrder(wxCUser, couponChannelId, couponId, isPress, orderGroupId, formId); return new ResultData(order); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java index 251a682fc..73b29af35 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java @@ -179,16 +179,27 @@ public class WxCUser implements Serializable { @Transient protected Date endDate; - //用户类型 枚举:EnumUserType + /**操作人类型 枚举:EnumUserType*/ @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() { 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 88047b57e..92e893b22 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -431,13 +431,14 @@ public class WxOrderServiceImpl implements WxOrderService { } //扣减积分操作记录 WxCreditHistory creditHistory = new WxCreditHistory(); - //记录操作人类型 - if (user.getUserType() == EnumUserType.MALLUSER.getCode()) { + //记录操作人类型 操作人id + if (user.getOperatorType() == EnumUserType.MALLUSER.getCode()) { creditHistory.setOperatorType(EnumUserType.MALLUSER.getCode()); + creditHistory.setOperatorId(user.getOperatorId()); } else { creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); + creditHistory.setOperatorId(user.getId()); } - creditHistory.setOperatorId(user.getId()); creditHistory.setCreditNum(coupon.getCreditPrice()); creditHistory.setCUserId(user.getId()); creditHistory.setCreateDate(new Date());