xiaohanzi 5 лет назад
Родитель
Сommit
f43e0e9917
8 измененных файлов: 97 добавлений и 39 удалений
  1. +17
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java
  2. +9
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxMicroPayController.java
  3. +18
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java
  4. +12
    -3
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  5. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java
  6. +22
    -25
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java
  7. +4
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  8. +4
    -4
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java

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

@@ -8,6 +8,7 @@ import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.dto.OrderSaveDto;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxOrder;
@@ -18,6 +19,7 @@ import com.iformall.enums.EnumCouponChannelStatus;
import com.iformall.enums.EnumCouponChannelType;
import com.iformall.enums.EnumUserType;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserService;
import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxCouponService;
@@ -56,6 +58,9 @@ public class WxOrderController extends BaseController {

@Autowired
private WxCouponService wxCouponService;
@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@ApiOperation("分页列表接口")
@GetMapping("list")
@@ -166,6 +171,10 @@ public class WxOrderController extends BaseController {

try {
WxCUser user = wxCUserService.getById(orderSaveDto.getUserId());
if(null == user) {
logger.error("wxcuser未找到:"+orderSaveDto.getUserId());
return new ResultData(ErrorCode.COUPON_IS_EMPTY);
}
//用于标记当前操作人为A端用户
user.setOperatorType(EnumUserType.MALLUSER.getCode());
user.setOperatorId(getUserId());
@@ -177,8 +186,15 @@ public class WxOrderController extends BaseController {
if (!wxOrderService.checkCouponIsFree(coupon)) {
return new ResultData(ErrorCode.COUPON_IS_NOT_FREE);
}
if(!user.isBasicInfo()) {
return new ResultData(ErrorCode.USER_IS_NOT_MEMBER);
}
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(orderSaveDto.getUserId());
if (null == basicInfo) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"会员用户未找到. "+orderSaveDto.getUserId());
}
// 免费券
order = wxOrderService.saveFreeOrderForCoupon(user, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null);
order = wxOrderService.saveFreeOrderForCoupon(basicInfo, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null);
return new ResultData(order);
} catch (MallinkException e) {
logger.error(e.getMessage());


+ 9
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxMicroPayController.java Просмотреть файл

@@ -342,7 +342,15 @@ public class WxMicroPayController extends BaseController {

WxOrder order = null;
try {
order = wxOrderService.saveMicroPayOrderV2(user, cUser, payment);
if (!cUser.isBasicInfo()) {
return new ResultData(ErrorCode.USER_IS_NOT_MEMBER);
}
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(cUser.getUserId());
if ( null == basicInfo) {
logger.error("会员用户未找到."+cUser.getUserId());
return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),"会员用户未找到."+cUser.getUserId());
}
order = wxOrderService.saveMicroPayOrderV2(user, basicInfo, payment);
} catch (MallinkException e) {
logger.error("saveMicopayOrder 1" + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());


+ 18
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java Просмотреть файл

@@ -32,6 +32,9 @@ public class WxCouponPasswordController extends BaseController {

@Autowired
private WxOrderService orderService;
@Autowired
private WxCUserBasicInfoService userService;

@ApiOperation(value = "根据卡密领卡", notes = "{\"password\":\"String\",\"formId\":\"String\"}")
@PostMapping("getCouponOrderByPassword")
@@ -59,6 +62,20 @@ public class WxCouponPasswordController extends BaseController {
}

WxCUser cuUser = getUser();
if (null == cuUser ) {
return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(), "用户信息失效,请重新登陆");
}
if(!cuUser.isBasicInfo()) {
return new ResultData(ErrorCode.USER_IS_NOT_MEMBER);
}
WxCUserBasicInfo user = userService.getById(cuUser.getUserId());
if(user == null) {
logger.error("会员用户未找到: " + cuUser.getUserId());
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + cuUser.getUserId());
}
WxCoupon coupon = couponService.getById(couponPassword.getCouponId());
if (coupon == null) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY);
@@ -75,7 +92,7 @@ public class WxCouponPasswordController extends BaseController {

// 3. 领取free coupon
try {
WxOrder order = orderService.saveFreeOrderForCoupon(cuUser, coupon, null, formId, couponPassword.getId());
WxOrder order = orderService.saveFreeOrderForCoupon(user, coupon, null, formId, couponPassword.getId());
} catch (MallinkException e) {
setCouponPasswordStatus(couponPassword, EnumCouponPasswordStatus.getEnum(pwdStatus));
logger.error(e.getMessage());


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

@@ -142,7 +142,7 @@ public class WxOrderController extends BaseController {
boolean isPress = orderSaveDto.getPress() != null ? orderSaveDto.getPress() : false;

try {
WxOrder order = wxOrderService.saveOrderForCoupon(user, coupon, orderSaveDto, isPress);
WxOrder order = wxOrderService.saveOrderForCoupon(wxCUserBasicInfo, coupon, orderSaveDto, isPress);
return new ResultData(order);
} catch (MallinkException e) {
logger.error(e.getMessage());
@@ -167,7 +167,7 @@ public class WxOrderController extends BaseController {

if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0)
return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER);
if (wxOrderService.countCouponConditionType1(user) > 0)
if (wxOrderService.countCouponConditionType1(cUserBasicInfo) > 0)
return new ResultData(ErrorCode.COUPON_ALREADY_IN_NEW_MEMBER);
}else if (jo.getIntValue("type") == EnumCouponConditionType.SCORE_SCOPE.getCode()){
int max = jo.getIntValue("max");
@@ -394,7 +394,16 @@ public class WxOrderController extends BaseController {

WxOrder order = null;
try {
order = wxOrderService.getUnPaidOrder(getUser(), wxCoupon);
WxCUser cuser = getUser();
if(!cuser.isBasicInfo()) {
throw new MallinkException(ErrorCode.USER_IS_NOT_MEMBER);
}
WxCUserBasicInfo user = wxCUserBasicInfoService.getById(cuser.getUserId());
if(user == null) {
logger.error("会员用户未找到: " + cuser.getUserId());
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + cuser.getUserId());
}
order = wxOrderService.getUnPaidOrder(user, wxCoupon);
if (order != null) {
return new ResultData(Result.SUCCESS, "查询成功", order);
} else {


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

@@ -155,4 +155,15 @@ public class WxCUser extends TenantEntity {
}
return this.token;
}
/**
* 是否是会员
* @return
*/
public boolean isBasicInfo() {
if(null == this.getUserId()) {
return false;
}
return true;
}
}

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

@@ -549,14 +549,14 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
return resList;
}

private List<WxTags> assignTypeId21(WxCUserBasicInfo user, WxCUser param) {
private List<WxTags> assignTypeId21(WxCUserBasicInfo user) {
List<WxTags> resList = null;
Calendar startC = Calendar.getInstance();
startC.setTime(new Date());
startC.add(Calendar.DAY_OF_YEAR, -30);

WxCouponOrder wxCouponOrder = new WxCouponOrder();
wxCouponOrder.setCUserId(param.getId());
wxCouponOrder.setCUserId(user.getId());
wxCouponOrder.setStartTime(startC.getTime());
wxCouponOrder.setEndTime(new Date());

@@ -577,7 +577,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
List<WxTags> resList = null;
int days = (int) ((new Date().getTime() - user.getCreateDate().getTime()) / (1000*3600*24));

float loginRate = (float)param.getLoginCount()/days;
float loginRate = (float)user.getLoginCount()/days;
if (loginRate > 1F/4)
resList = assign(user, EnumTag.ID_112);
else if (loginRate > 1F/7)
@@ -667,7 +667,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
//消费时段
resList = assignTypeId18(user);
//消费频度
resList = assignTypeId22(user, param);
resList = assignTypeId22(user);
}
}
break;
@@ -693,13 +693,12 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
resList = assignTypeId7(user, param.getPhone());
}
//活跃
resList = assignTypeId21(user, param);
resList = assignTypeId21(user);
}
}
break;
case ASSIGN_TAGS_TRIGGER_SCAN: {
WxCUserBasicInfo user = (WxCUserBasicInfo) obj;
WxCUser param = wxCUserMapper.selectById(user.getId());
if (user != null) {

if (user.getSex() != null) {
@@ -723,25 +722,23 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
resList = assignTypeId6(user, user.getEducation());
}

if (param != null) {
//消费类别
resList = assignTypeId14(user, param);
//饮食偏好
resList = assignTypeId17(user, param);

//消费时段
resList = assignTypeId18(user, param);
//消费频度
resList = assignTypeId22(user, param);
//活跃
resList = assignTypeId21(user, param);

//车
WxCUserCar wxCUserCar = new WxCUserCar();
wxCUserCar.setCUserId(param.getId());
if (wxCUserCarMapper.countList(wxCUserCar) > 0) {
resList = assignTypeId11(user);
}
//消费类别
resList = assignTypeId14(user);
//饮食偏好
resList = assignTypeId17(user);

//消费时段
resList = assignTypeId18(user);
//消费频度
resList = assignTypeId22(user);
//活跃
resList = assignTypeId21(user);

//车
WxCUserCar wxCUserCar = new WxCUserCar();
wxCUserCar.setCUserId(user.getId());
if (wxCUserCarMapper.countList(wxCUserCar) > 0) {
resList = assignTypeId11(user);
}
}
}


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

@@ -417,7 +417,7 @@ public class WxOrderServiceImpl implements WxOrderService {
* @param counpon
* @return
*/
public WxOrder getUnPaidOrder(WxCUser user, WxCoupon counpon) {
public WxOrder getUnPaidOrder(WxCUserBasicInfo user, WxCoupon counpon) {
// + Order 待支付
try {
WxOrder orderQ = new WxOrder();
@@ -448,13 +448,13 @@ public class WxOrderServiceImpl implements WxOrderService {
* @param user
* @return
*/
public int countCouponConditionType1(WxCUser user) {
public int countCouponConditionType1(WxCUserBasicInfo user) {
// + Order 待支付
try {
WxOrder orderQ = new WxOrder();
orderQ.setTenantId(user.getTenantId());
orderQ.setType(EnumOrderType.COUPON.getCode());
orderQ.setCUserId(user.getUserId());
orderQ.setCUserId(user.getId());
List<Integer> statusS = new ArrayList<>();
statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode());
@@ -1481,7 +1481,7 @@ public class WxOrderServiceImpl implements WxOrderService {
public int microPayOrderSuccess(WxOrder updateOrder) {
Date currentDate = new Date();
// C端用户
WxCUser user = wxCUserMapper.selectById(updateOrder.getCUserId());
WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(updateOrder.getCUserId());
if (user == null) {
logger.error("用户不存在, userId: " + updateOrder.getCUserId());
throw new MallinkException(ErrorCode.USER_IS_EMPTY);


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

@@ -1,14 +1,14 @@
package com.iformall.service.msg.impl;

import com.iformall.common.ErrorCode;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxOrder;
import com.iformall.domain.po.msg.BaseMsg;
import com.iformall.domain.po.msg.FmInsideOrderSuccessMsg;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCUserService;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxCouponService;
import com.iformall.service.WxOrderService;
@@ -31,7 +31,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService {
private WxOrderService orderService;

@Autowired
private WxCUserService userService;
private WxCUserBasicInfoService userService;

@Autowired
private WxCouponService couponService;
@@ -63,7 +63,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService {
throw new MallinkException(ErrorCode.ORDER_COUPON_NOT_MATCH.getCode(), "订单用户不一致" + msg.getOrderId());
}

WxCUser user = userService.getById(msg.getCUserId());
WxCUserBasicInfo user = userService.getById(msg.getCUserId());
if(user == null) {
logger.error("用户未找到: " + msg.getCUserId());
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getCUserId());


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