forked from angelo/java-retail-app
				
			Compare commits
	
		
			No commits in common. "ccbf6d1b3787b8a45a74fd32e227c3ba7dec0735" and "8d941689d57313c30ae2198a66500addb32286f3" have entirely different histories.
		
	
	
		
			ccbf6d1b37
			...
			8d941689d5
		
	
		| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
package com.hzs.member.base.vo;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
			
		||||
import com.hzs.common.core.annotation.BigDecimalFormat;
 | 
			
		||||
import com.hzs.common.core.annotation.Excel;
 | 
			
		||||
import com.hzs.common.core.annotation.Transaction;
 | 
			
		||||
import com.hzs.common.core.constant.EnumsPrefixConstants;
 | 
			
		||||
| 
						 | 
				
			
			@ -91,15 +90,13 @@ public class RetailMemberVO implements Serializable {
 | 
			
		|||
    /**
 | 
			
		||||
     * 消费金额 注册金额
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "注册金额", scale = 2)
 | 
			
		||||
    @BigDecimalFormat()
 | 
			
		||||
    @Excel(name = "注册金额")
 | 
			
		||||
    private BigDecimal consumeMoney;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 消费业绩 注册业绩
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "注册业绩", scale = 2)
 | 
			
		||||
    @BigDecimalFormat()
 | 
			
		||||
    @Excel(name = "注册业绩($)")
 | 
			
		||||
    private BigDecimal consumeAchieve;
 | 
			
		||||
    /**
 | 
			
		||||
     * 隶属体系
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,9 @@ import com.hzs.activity.consume.service.IAcMemberConsumeRuleService;
 | 
			
		|||
import com.hzs.activity.draw.param.PurchasedTimesParam;
 | 
			
		||||
import com.hzs.activity.draw.service.IAcDrawGiftRuleConfigService;
 | 
			
		||||
import com.hzs.activity.draw.service.IAcDrawRewardNumService;
 | 
			
		||||
 | 
			
		||||
import com.hzs.activity.pick.param.AcPickSaveDetailParam;
 | 
			
		||||
import com.hzs.activity.pick.service.IAcPickService;
 | 
			
		||||
import com.hzs.activity.pick.service.IAcRetailPickProductConfigService;
 | 
			
		||||
import com.hzs.activity.recommend.param.AcRecommendParam;
 | 
			
		||||
import com.hzs.activity.recommend.service.IAcRepurCouponsRuleConfigService;
 | 
			
		||||
| 
						 | 
				
			
			@ -18,10 +21,14 @@ import com.hzs.common.core.enums.*;
 | 
			
		|||
import com.hzs.common.core.exception.base.BaseException;
 | 
			
		||||
import com.hzs.common.core.utils.StringUtils;
 | 
			
		||||
import com.hzs.common.domain.activity.base.AcApprovalLog;
 | 
			
		||||
import com.hzs.member.base.IMemberServiceApi;
 | 
			
		||||
import com.hzs.sale.product.IProductServiceApi;
 | 
			
		||||
import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
 | 
			
		||||
import org.apache.dubbo.config.annotation.DubboReference;
 | 
			
		||||
import org.apache.dubbo.config.annotation.DubboService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +46,8 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private IAcDrawGiftRuleConfigService drawGiftConfigService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IAcPickService iAcPickService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IAcApprovalLogService iAcApprovalLogService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IAcRepurCouponsRuleConfigService acRepurCouponsRuleConfigService;
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +56,12 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private IAcRetailPickProductConfigService iAcRetailPickProductConfigService;
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IMemberServiceApi iMemberServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IProductServiceApi iProductServiceApi;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<Boolean> approvalCallback(ApprovalBusinessResultDTO approvalBusinessResultDTO) {
 | 
			
		||||
        try {
 | 
			
		||||
| 
						 | 
				
			
			@ -55,6 +70,14 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
 | 
			
		|||
            if (EApproveStatus.FINISH.getValue() == approvalBusinessResultDTO.getEApproveStatus().getValue()) {
 | 
			
		||||
                // 通过处理
 | 
			
		||||
                switch (approvalBusinessResultDTO.getEApprovalBusiness()) {
 | 
			
		||||
                    case PICK_ADD:
 | 
			
		||||
                        // 提货充值
 | 
			
		||||
                        str = iAcPickService.pickApprovalAgree(approvalBusinessResultDTO);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case PICK_ADD_DEL:
 | 
			
		||||
                        // 提货充值删除
 | 
			
		||||
                        str = iAcPickService.delpickApprovalAgree(approvalBusinessResultDTO);
 | 
			
		||||
                        break;
 | 
			
		||||
                    // 直推赠送
 | 
			
		||||
                    case DIRECT_PUSH_GIFT:
 | 
			
		||||
                        str = acRepurCouponsRuleConfigService.approvalAgree(approvalBusinessResultDTO);
 | 
			
		||||
| 
						 | 
				
			
			@ -105,6 +128,10 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
 | 
			
		|||
            } else {
 | 
			
		||||
                // 驳回处理
 | 
			
		||||
                switch (approvalBusinessResultDTO.getEApprovalBusiness()) {
 | 
			
		||||
                    case PICK_ADD:
 | 
			
		||||
                        // 提货充值
 | 
			
		||||
                        str = iAcPickService.pickApprovalReject(approvalBusinessResultDTO);
 | 
			
		||||
                        break;
 | 
			
		||||
                    // 直推赠送
 | 
			
		||||
                    case DIRECT_PUSH_GIFT:
 | 
			
		||||
                        str = acRepurCouponsRuleConfigService.approvalReject(approvalBusinessResultDTO);
 | 
			
		||||
| 
						 | 
				
			
			@ -136,6 +163,19 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
 | 
			
		|||
        try {
 | 
			
		||||
            List<AcApprovalLog> acApprovalLogList = iAcApprovalLogService.queryApprovalLogList(eApprovalBusiness, businessCode, pkCountry);
 | 
			
		||||
            switch (eApprovalBusiness) {
 | 
			
		||||
                case PICK_ADD:
 | 
			
		||||
                case PICK_ADD_DEL:
 | 
			
		||||
                    // 提货充值
 | 
			
		||||
                    List<AcPickSaveDetailParam> list = new ArrayList<>();
 | 
			
		||||
                    for (AcApprovalLog approvalLog : acApprovalLogList) {
 | 
			
		||||
                        AcPickSaveDetailParam afterData = JSONUtil.toBean(approvalLog.getAfterData(), AcPickSaveDetailParam.class);
 | 
			
		||||
                        afterData.setMemberName(iMemberServiceApi.getMember(afterData.getMemberCode()).getData().getMemberName());
 | 
			
		||||
                        if (afterData.getPkProduct() != null) {
 | 
			
		||||
                            afterData.setProductName(iProductServiceApi.getProduct(afterData.getPkProduct()).getData().getProductName() + "(" + afterData.getSpecsName() + ")");
 | 
			
		||||
                        }
 | 
			
		||||
                        list.add(afterData);
 | 
			
		||||
                    }
 | 
			
		||||
                    return R.ok(list);
 | 
			
		||||
                case DIRECT_PUSH_GIFT:
 | 
			
		||||
                case LOTTERY_DRAW:
 | 
			
		||||
                    // 抽奖
 | 
			
		||||
| 
						 | 
				
			
			@ -169,9 +209,11 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
 | 
			
		|||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private AcRecommendParam getRecommendApprovalData(AcApprovalLog acApprovalLog) {
 | 
			
		||||
        String data = acApprovalLog.getAfterData();
 | 
			
		||||
        return JSONUtil.toBean(data, AcRecommendParam.class);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private PurchasedTimesParam getRecommendApprovalDataInfo(AcApprovalLog acApprovalLog) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@ import com.hzs.activity.pick.vo.AcPickQueryDetailVO;
 | 
			
		|||
import com.hzs.activity.pick.vo.AcPickQueryVO;
 | 
			
		||||
import com.hzs.activity.wares.service.IAcGiftConfigService;
 | 
			
		||||
import com.hzs.common.core.annotation.Log;
 | 
			
		||||
import com.hzs.common.core.constant.msg.CommonMsgConstants;
 | 
			
		||||
import com.hzs.common.core.constant.msg.MemberMsgConstants;
 | 
			
		||||
import com.hzs.common.core.constant.msg.ProductMsgConstants;
 | 
			
		||||
import com.hzs.common.core.enums.*;
 | 
			
		||||
| 
						 | 
				
			
			@ -92,8 +93,7 @@ public class AcPickController extends BaseController {
 | 
			
		|||
 | 
			
		||||
                acPickQueryVO.setPickTypeVal(EPickType.getEnumByValue(acPickQueryVO.getPickType()).getLabel());
 | 
			
		||||
 | 
			
		||||
                if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()
 | 
			
		||||
                        || EPickType.COMPANY_PRODUCT.getValue() == acPickExt.getPickType()) {
 | 
			
		||||
                if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()) {
 | 
			
		||||
                    // 提货产品
 | 
			
		||||
                    acPickQueryVO.setDetailList(Collections.singletonList(AcPickQueryDetailVO.builder()
 | 
			
		||||
                            .productName(acPickExt.getProductName())
 | 
			
		||||
| 
						 | 
				
			
			@ -155,8 +155,7 @@ public class AcPickController extends BaseController {
 | 
			
		|||
 | 
			
		||||
                acPickQueryVO.setPickTypeVal(EPickType.getEnumByValue(acPickQueryVO.getPickType()).getLabel());
 | 
			
		||||
 | 
			
		||||
                if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()
 | 
			
		||||
                        || EPickType.COMPANY_PRODUCT.getValue() == acPickExt.getPickType()) {
 | 
			
		||||
                if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()) {
 | 
			
		||||
                    // 产品处理
 | 
			
		||||
                    acPickQueryVO.setDetailList(Collections.singletonList(AcPickQueryDetailVO.builder()
 | 
			
		||||
                            .productName(acPickExt.getProductName())
 | 
			
		||||
| 
						 | 
				
			
			@ -200,8 +199,7 @@ public class AcPickController extends BaseController {
 | 
			
		|||
        AcPickExt acPickExt = iAcPickService.queryDetail(pkId, pkCountry);
 | 
			
		||||
        if (null != acPickExt) {
 | 
			
		||||
            acPickQueryVO = BeanUtil.copyProperties(acPickExt, AcPickQueryVO.class);
 | 
			
		||||
            if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()
 | 
			
		||||
                    || EPickType.COMPANY_PRODUCT.getValue() == acPickExt.getPickType()) {
 | 
			
		||||
            if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()) {
 | 
			
		||||
                // 产品处理
 | 
			
		||||
                acPickQueryVO.setDetailList(Collections.singletonList(AcPickQueryDetailVO.builder()
 | 
			
		||||
                        .pkProduct(acPickExt.getPkDataId().intValue())
 | 
			
		||||
| 
						 | 
				
			
			@ -235,17 +233,23 @@ public class AcPickController extends BaseController {
 | 
			
		|||
    @Log(module = EOperationModule.RECHARGE_PICK, business = EOperationBusiness.RECHARGE_PICK, method = EOperationMethod.SUBMIT)
 | 
			
		||||
    @PostMapping("/submit")
 | 
			
		||||
    public AjaxResult submit(@RequestBody AcPickSaveParam param) {
 | 
			
		||||
        if (null == param.getSignType() || CollectionUtil.isEmpty(param.getUserIdList())
 | 
			
		||||
                || CollectionUtil.isEmpty(param.getDetailList())) {
 | 
			
		||||
            // 缺少参数
 | 
			
		||||
            return AjaxResult.error(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (AcPickSaveDetailParam detailParam : param.getDetailList()) {
 | 
			
		||||
            if (StringUtils.isAnyEmpty(detailParam.getMemberCode(), detailParam.getSpecsName(), detailParam.getSpecsNameId())
 | 
			
		||||
                    || null == detailParam.getPkProduct() || null == detailParam.getBaseQuantity() || null == detailParam.getQuantity()
 | 
			
		||||
                    || null == detailParam.getIsFreeMail()) {
 | 
			
		||||
                // 缺少参数
 | 
			
		||||
                return AjaxResult.error("缺少参数");
 | 
			
		||||
                return AjaxResult.error(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
 | 
			
		||||
            }
 | 
			
		||||
            if (EYesNo.NO.getIntValue() == detailParam.getIsFreeMail() && null == detailParam.getPkPostage()) {
 | 
			
		||||
                // 不包邮,则必须传入邮费模板
 | 
			
		||||
                // 缺少参数
 | 
			
		||||
                return AjaxResult.error("缺少参数");
 | 
			
		||||
                return AjaxResult.error(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 手动添加提货数据比较少,此处查人和产品先单次查,如果同时操作人过多可以改成批量,或者不进行校验
 | 
			
		||||
| 
						 | 
				
			
			@ -270,14 +274,19 @@ public class AcPickController extends BaseController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除充值提货卡
 | 
			
		||||
     * @description: 删除充值提货卡
 | 
			
		||||
     * @author: zhang jing
 | 
			
		||||
     * @date: 2023/10/17 17:35
 | 
			
		||||
     * @param: [anpParam]
 | 
			
		||||
     * @return: com.hzs.common.core.web.domain.AjaxResult
 | 
			
		||||
     **/
 | 
			
		||||
    @Log(module = EOperationModule.RECHARGE_PICK, business = EOperationBusiness.RECHARGE_PICK, method = EOperationMethod.DELETE)
 | 
			
		||||
    @PostMapping("/del-pick")
 | 
			
		||||
    public AjaxResult delPick(@RequestBody AcPickSaveParam anpParam) {
 | 
			
		||||
        if (CollectionUtil.isEmpty(anpParam.getDetailList())) {
 | 
			
		||||
        if (null == anpParam.getSignType() || CollectionUtil.isEmpty(anpParam.getUserIdList())
 | 
			
		||||
                || CollectionUtil.isEmpty(anpParam.getDetailList())) {
 | 
			
		||||
            // 缺少参数
 | 
			
		||||
            return AjaxResult.error("缺少参数");
 | 
			
		||||
            return AjaxResult.error(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
 | 
			
		||||
        }
 | 
			
		||||
        // 设置参数
 | 
			
		||||
        LoginUser loginUser = userTokenService.getLoginUser();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,11 @@ import java.io.Serializable;
 | 
			
		|||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 提货明细保存入参
 | 
			
		||||
 * @Description: 提货明细保存入参
 | 
			
		||||
 * @Author: jiang chao
 | 
			
		||||
 * @Time: 2023/5/10 19:06
 | 
			
		||||
 * @Classname: AcPickSaveDetailParam
 | 
			
		||||
 * @PackageName: com.hzs.activity.pick.param
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class AcPickSaveDetailParam implements Serializable {
 | 
			
		||||
| 
						 | 
				
			
			@ -72,9 +76,4 @@ public class AcPickSaveDetailParam implements Serializable {
 | 
			
		|||
     */
 | 
			
		||||
    private String productName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 提货类型
 | 
			
		||||
     */
 | 
			
		||||
    private Integer pickType;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,11 @@ import lombok.EqualsAndHashCode;
 | 
			
		|||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 提货保存入参
 | 
			
		||||
 * @Description: 提货保存入参
 | 
			
		||||
 * @Author: jiang chao
 | 
			
		||||
 * @Time: 2023/4/22 11:26
 | 
			
		||||
 * @Classname: AcPickSaveParam
 | 
			
		||||
 * @PackageName: com.hzs.activity.pick.param
 | 
			
		||||
 */
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@Data
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ import com.hzs.activity.pick.param.AcPickSaveParam;
 | 
			
		|||
import com.hzs.activity.pick.vo.ApiPickListVO;
 | 
			
		||||
import com.hzs.common.domain.activity.pick.AcPick;
 | 
			
		||||
import com.hzs.common.domain.activity.pick.ext.AcPickExt;
 | 
			
		||||
import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
 | 
			
		||||
import com.hzs.system.sys.dto.LoginUser;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +38,7 @@ public interface IAcPickService extends IService<AcPick> {
 | 
			
		|||
                              Integer usableQuantity, String pickCover, Date receiveTime, Integer pkPostage,
 | 
			
		||||
                              Long pkCreator, Integer pkCountry, Long pkBaseId);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据会员和活动类型回退使用数量
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -79,10 +81,31 @@ public interface IAcPickService extends IService<AcPick> {
 | 
			
		|||
    String pickSubmit(AcPickSaveParam param, LoginUser loginUser);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除充值提货卡
 | 
			
		||||
     * 删除充值提货卡发起签呈
 | 
			
		||||
     **/
 | 
			
		||||
    boolean delPick(AcPickSaveParam anpParam);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 提货变动审批通过
 | 
			
		||||
     *
 | 
			
		||||
     * @param resultDTO
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    String pickApprovalAgree(ApprovalBusinessResultDTO resultDTO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 审核删除充值提货卡
 | 
			
		||||
     **/
 | 
			
		||||
    String delpickApprovalAgree(ApprovalBusinessResultDTO resultDTO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 提货变动审批驳回
 | 
			
		||||
     *
 | 
			
		||||
     * @param resultDTO
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    String pickApprovalReject(ApprovalBusinessResultDTO resultDTO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 会员提货列表
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +135,7 @@ public interface IAcPickService extends IService<AcPick> {
 | 
			
		|||
     */
 | 
			
		||||
    int batchSaveOrUpdatePick(List<AcPick> pickList);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据ID更新会员提货数据
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,9 @@
 | 
			
		|||
package com.hzs.activity.pick.service.impl;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollectionUtil;
 | 
			
		||||
import cn.hutool.json.JSONUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.hzs.activity.base.service.IAcApprovalLogService;
 | 
			
		||||
import com.hzs.activity.pick.mapper.AcPickMapper;
 | 
			
		||||
import com.hzs.activity.pick.param.AcPickQueryParam;
 | 
			
		||||
import com.hzs.activity.pick.param.AcPickSaveDetailParam;
 | 
			
		||||
| 
						 | 
				
			
			@ -11,11 +13,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
			
		|||
import com.hzs.activity.pick.vo.ApiPickListVO;
 | 
			
		||||
import com.hzs.activity.wares.service.IAcGiftConfigService;
 | 
			
		||||
import com.hzs.common.core.constant.RabbitMqConstants;
 | 
			
		||||
import com.hzs.common.core.constant.msg.ActivityMsgConstants;
 | 
			
		||||
import com.hzs.common.core.constant.msg.CommonMsgConstants;
 | 
			
		||||
import com.hzs.common.core.constant.msg.DocumentMsgConstants;
 | 
			
		||||
import com.hzs.common.core.domain.R;
 | 
			
		||||
import com.hzs.common.core.enums.*;
 | 
			
		||||
import com.hzs.common.core.exception.ServiceException;
 | 
			
		||||
import com.hzs.common.core.exception.base.BaseException;
 | 
			
		||||
import com.hzs.common.core.utils.CommonUtil;
 | 
			
		||||
import com.hzs.common.core.utils.DateUtils;
 | 
			
		||||
import com.hzs.common.domain.activity.base.AcApprovalLog;
 | 
			
		||||
import com.hzs.common.domain.activity.base.AcPickUpConfig;
 | 
			
		||||
import com.hzs.common.domain.activity.base.ext.AcGiftConfigExt;
 | 
			
		||||
import com.hzs.common.domain.activity.pick.AcPick;
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +34,9 @@ import com.hzs.member.base.IMemberServiceApi;
 | 
			
		|||
import com.hzs.sale.postage.dto.PostageProductDTO;
 | 
			
		||||
import com.hzs.sale.postage.service.IPostageBusinessService;
 | 
			
		||||
import com.hzs.sale.product.service.IBdProductService;
 | 
			
		||||
import com.hzs.system.sys.IApprovalServiceApi;
 | 
			
		||||
import com.hzs.system.sys.dto.ApprovalBusinessResultDTO;
 | 
			
		||||
import com.hzs.system.sys.dto.ApprovalSubmitDTO;
 | 
			
		||||
import com.hzs.system.sys.dto.BusinessLogDTO;
 | 
			
		||||
import com.hzs.system.sys.dto.LoginUser;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
| 
						 | 
				
			
			@ -48,6 +57,8 @@ import java.util.stream.Collectors;
 | 
			
		|||
@Service
 | 
			
		||||
public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> implements IAcPickService {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IAcApprovalLogService iAcApprovalLogService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IAcPickLogService iAcPickLogService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
| 
						 | 
				
			
			@ -61,6 +72,8 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private IPostageBusinessService iPostageBusinessService;
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IApprovalServiceApi iApprovalServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IMemberServiceApi iMemberServiceApi;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -128,66 +141,24 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
        // 操作日志列表
 | 
			
		||||
        List<BusinessLogDTO> logDTOList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        // 批量保存日志
 | 
			
		||||
        List<AcApprovalLog> approvalLogList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        // 产品数据map
 | 
			
		||||
        Map<Integer, BdProduct> productMap = iBdProductService.queryProductMap(param.getDetailList().stream().map(AcPickSaveDetailParam::getPkProduct).collect(Collectors.toList()), pkCountry);
 | 
			
		||||
 | 
			
		||||
        // 新増提货列表
 | 
			
		||||
        List<AcPick> createList = new ArrayList<>();
 | 
			
		||||
        // 修改提货列表
 | 
			
		||||
        List<AcPick> updateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        for (AcPickSaveDetailParam detailParam : param.getDetailList()) {
 | 
			
		||||
            // 会员信息
 | 
			
		||||
            CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
 | 
			
		||||
            // 提货ID
 | 
			
		||||
            Long pickId = null;
 | 
			
		||||
            // 提货类型
 | 
			
		||||
            Integer pickType = null != detailParam.getPickType() ? detailParam.getPickType() : EPickType.COMPANY_PRODUCT.getValue();
 | 
			
		||||
 | 
			
		||||
            if (null == detailParam.getPkId()) {
 | 
			
		||||
                LambdaQueryWrapper<AcPick> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
                queryWrapper.eq(AcPick::getPickType, pickType);
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkBaseConfig, 0);
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkDataId, detailParam.getPkProduct());
 | 
			
		||||
                queryWrapper.eq(AcPick::getSpecsNameId, detailParam.getSpecsNameId());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkMember, cuMember.getPkId());
 | 
			
		||||
                AcPick acPick = this.getOne(queryWrapper);
 | 
			
		||||
                if (null != acPick) {
 | 
			
		||||
                    pickId = acPick.getPkId();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                pickId = detailParam.getPkId();
 | 
			
		||||
            // 活动审批日志
 | 
			
		||||
            AcApprovalLog acApprovalLog = new AcApprovalLog();
 | 
			
		||||
            acApprovalLog.setApprovalType(EApprovalBusiness.PICK_ADD.getValue());
 | 
			
		||||
            acApprovalLog.setBusinessCode(businessCode);
 | 
			
		||||
            acApprovalLog.setPkCreator(userId);
 | 
			
		||||
            acApprovalLog.setPkCountry(pkCountry);
 | 
			
		||||
            acApprovalLog.setAfterData(JSONUtil.toJsonStr(detailParam));
 | 
			
		||||
            if (null != detailParam.getPkId()) {
 | 
			
		||||
                acApprovalLog.setPkBusiness(detailParam.getPkId());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            AcPick acPick = new AcPick();
 | 
			
		||||
            if (null == pickId) {
 | 
			
		||||
                // 新增提货数据
 | 
			
		||||
                acPick.setPkMember(cuMember.getPkId());
 | 
			
		||||
                acPick.setPickType(pickType);
 | 
			
		||||
                acPick.setPkDataId(detailParam.getPkProduct().longValue());
 | 
			
		||||
                acPick.setSpecsName(detailParam.getSpecsName());
 | 
			
		||||
                acPick.setSpecsNameId(detailParam.getSpecsNameId());
 | 
			
		||||
                acPick.setUsableQuantity(detailParam.getQuantity());
 | 
			
		||||
                acPick.setBaseQuantity(detailParam.getBaseQuantity());
 | 
			
		||||
                acPick.setReceiveTime(detailParam.getReceiveTime());
 | 
			
		||||
                acPick.setIsFreeMail(detailParam.getIsFreeMail());
 | 
			
		||||
                acPick.setPkPostage(detailParam.getPkPostage());
 | 
			
		||||
                acPick.setPkCreator(userId);
 | 
			
		||||
                acPick.setPkCountry(pkCountry);
 | 
			
		||||
                createList.add(acPick);
 | 
			
		||||
            } else {
 | 
			
		||||
                // 修改提货数据
 | 
			
		||||
                acPick.setPkId(pickId);
 | 
			
		||||
                acPick.setUsableQuantity(detailParam.getQuantity());
 | 
			
		||||
                acPick.setBaseQuantity(detailParam.getBaseQuantity());
 | 
			
		||||
                acPick.setReceiveTime(detailParam.getReceiveTime());
 | 
			
		||||
                acPick.setIsFreeMail(detailParam.getIsFreeMail());
 | 
			
		||||
                acPick.setPkPostage(detailParam.getPkPostage());
 | 
			
		||||
                acPick.setPkModified(userId);
 | 
			
		||||
                acPick.setModifiedTime(new Date());
 | 
			
		||||
                updateList.add(acPick);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            approvalLogList.add(acApprovalLog);
 | 
			
		||||
 | 
			
		||||
            // 产品信息
 | 
			
		||||
            BdProduct bdProduct = productMap.get(detailParam.getPkProduct());
 | 
			
		||||
| 
						 | 
				
			
			@ -205,6 +176,9 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
            } else {
 | 
			
		||||
                content.append(",不包邮;");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 会员信息
 | 
			
		||||
            CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
 | 
			
		||||
            // 封装业务操作日志
 | 
			
		||||
            logDTOList.add(BusinessLogDTO.builder()
 | 
			
		||||
                    .businessType(EApprovalBusiness.PICK_ADD.getValue())
 | 
			
		||||
| 
						 | 
				
			
			@ -217,41 +191,32 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
                    .build());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 提货操作日志
 | 
			
		||||
        List<AcPickLog> logList = new ArrayList<>();
 | 
			
		||||
        if (iAcApprovalLogService.saveBatch(approvalLogList)) {
 | 
			
		||||
            // 保存审批日志成功,提交签呈
 | 
			
		||||
 | 
			
		||||
        // 插入提货数据
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(createList)) {
 | 
			
		||||
            for (AcPick acPick : createList) {
 | 
			
		||||
                this.baseMapper.insert(acPick);
 | 
			
		||||
            // 提交签呈处理
 | 
			
		||||
            R<String> resultR = iApprovalServiceApi.submitOrder(
 | 
			
		||||
                    ApprovalSubmitDTO.builder()
 | 
			
		||||
                            .eApprovalBusiness(EApprovalBusiness.PICK_ADD)
 | 
			
		||||
                            .businessCode(businessCode)
 | 
			
		||||
                            .signType(ESignType.getEnumByValue(param.getSignType()))
 | 
			
		||||
                            .userIdList(param.getUserIdList())
 | 
			
		||||
                            .sendIdList(param.getSendIdList())
 | 
			
		||||
                            .remark(param.getRemark())
 | 
			
		||||
                            .fileList(param.getFileList())
 | 
			
		||||
                            .build(),
 | 
			
		||||
                    loginUser,
 | 
			
		||||
                    null
 | 
			
		||||
            );
 | 
			
		||||
            if (resultR.isSuccess()) {
 | 
			
		||||
                // 推送业务操作日志
 | 
			
		||||
                rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
 | 
			
		||||
 | 
			
		||||
                AcPickLog acPickLog = new AcPickLog();
 | 
			
		||||
                acPickLog.setPkPick(acPick.getPkId());
 | 
			
		||||
                acPickLog.setQuantity(acPick.getUsableQuantity());
 | 
			
		||||
                acPickLog.setPkUser(userId);
 | 
			
		||||
                acPickLog.setPkCountry(pkCountry);
 | 
			
		||||
                logList.add(acPickLog);
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
            throw new BaseException(TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED) + ": " + resultR.getMsg());
 | 
			
		||||
        }
 | 
			
		||||
        // 更新提货数据
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(updateList)) {
 | 
			
		||||
            for (AcPick acPick : updateList) {
 | 
			
		||||
                this.baseMapper.updatePickByPkId(acPick);
 | 
			
		||||
 | 
			
		||||
                AcPickLog acPickLog = new AcPickLog();
 | 
			
		||||
                acPickLog.setPkPick(acPick.getPkId());
 | 
			
		||||
                acPickLog.setQuantity(acPick.getUsableQuantity());
 | 
			
		||||
                acPickLog.setPkUser(userId);
 | 
			
		||||
                acPickLog.setPkCountry(pkCountry);
 | 
			
		||||
                logList.add(acPickLog);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // 插入提货操作日志
 | 
			
		||||
        iAcPickLogService.insertBatch(logList);
 | 
			
		||||
 | 
			
		||||
        // 推送业务操作日志
 | 
			
		||||
        rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
 | 
			
		||||
        return null;
 | 
			
		||||
        return TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -266,51 +231,32 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
        // 操作日志列表
 | 
			
		||||
        List<BusinessLogDTO> logDTOList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        // 删除提货列表
 | 
			
		||||
        List<AcPick> updateList = new ArrayList<>();
 | 
			
		||||
        // 批量保存日志
 | 
			
		||||
        List<AcApprovalLog> approvalLogList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        for (AcPickSaveDetailParam detailParam : param.getDetailList()) {
 | 
			
		||||
            // 被操作会员
 | 
			
		||||
            CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
 | 
			
		||||
            // 提货ID
 | 
			
		||||
            Long pickId = null;
 | 
			
		||||
            if (null == detailParam.getPkId()) {
 | 
			
		||||
                LambdaQueryWrapper<AcPick> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
                queryWrapper.eq(AcPick::getPickType, EPickType.COMPANY_PRODUCT.getValue());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkBaseConfig, 0);
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkDataId, detailParam.getPkProduct());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkMember, cuMember.getPkId());
 | 
			
		||||
                AcPick acPick = this.getOne(queryWrapper);
 | 
			
		||||
                if (null != acPick) {
 | 
			
		||||
                    pickId = acPick.getPkId();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                pickId = detailParam.getPkId();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            AcPick acPick = new AcPick();
 | 
			
		||||
            if (null != pickId) {
 | 
			
		||||
                // 删除提货数据
 | 
			
		||||
                acPick.setPkId(pickId);
 | 
			
		||||
                acPick.setPkModified(userId);
 | 
			
		||||
                acPick.setModifiedTime(new Date());
 | 
			
		||||
                updateList.add(acPick);
 | 
			
		||||
            } else {
 | 
			
		||||
                log.error("提货充值同意处理失败: 更新数据失败");
 | 
			
		||||
                throw new ServiceException(TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR));
 | 
			
		||||
            // 活动审批日志
 | 
			
		||||
            AcApprovalLog acApprovalLog = new AcApprovalLog();
 | 
			
		||||
            acApprovalLog.setApprovalType(EApprovalBusiness.PICK_ADD_DEL.getValue());
 | 
			
		||||
            acApprovalLog.setBusinessCode(businessCode);
 | 
			
		||||
            acApprovalLog.setPkCreator(userId);
 | 
			
		||||
            acApprovalLog.setPkCountry(pkCountry);
 | 
			
		||||
            acApprovalLog.setAfterData(JSONUtil.toJsonStr(detailParam));
 | 
			
		||||
            if (null != detailParam.getPkId()) {
 | 
			
		||||
                acApprovalLog.setPkBusiness(detailParam.getPkId());
 | 
			
		||||
            }
 | 
			
		||||
            approvalLogList.add(acApprovalLog);
 | 
			
		||||
 | 
			
		||||
            // 操作日志内容
 | 
			
		||||
            StringBuilder content = new StringBuilder("删除会员编号 ").append(detailParam.getMemberCode()).append(" 的 ");
 | 
			
		||||
 | 
			
		||||
            // 查询提货数量
 | 
			
		||||
            AcPick delAcPick = this.getById(detailParam.getPkId());
 | 
			
		||||
            EPickType ePickType = EPickType.getEnumByValue(delAcPick.getPickType());
 | 
			
		||||
            AcPick acPick = this.getById(detailParam.getPkId());
 | 
			
		||||
            EPickType ePickType = EPickType.getEnumByValue(acPick.getPickType());
 | 
			
		||||
            switch (ePickType) {
 | 
			
		||||
                case PICK_PRODUCT:
 | 
			
		||||
                case PRIZE:
 | 
			
		||||
                case COMPANY_PRODUCT:
 | 
			
		||||
                    // 提货产品、抽奖、分公司产品
 | 
			
		||||
                    // 提货产品、抽奖
 | 
			
		||||
                    if (null != detailParam.getPkProduct()) {
 | 
			
		||||
                        BdProduct product = iBdProductService.getProduct(detailParam.getPkProduct());
 | 
			
		||||
                        content.append(ePickType.getLabel()).append(",").append(product.getProductName()).append("(").append(acPick.getSpecsName()).append(");");
 | 
			
		||||
| 
						 | 
				
			
			@ -334,6 +280,9 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 被操作会员
 | 
			
		||||
            CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
 | 
			
		||||
            // 封装业务操作日志
 | 
			
		||||
            logDTOList.add(BusinessLogDTO.builder()
 | 
			
		||||
                    .businessType(EApprovalBusiness.PICK_ADD_DEL.getValue())
 | 
			
		||||
| 
						 | 
				
			
			@ -346,16 +295,248 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
                    .build());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 更新提货数据
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(updateList)) {
 | 
			
		||||
            for (AcPick acPick : updateList) {
 | 
			
		||||
                this.baseMapper.removePickByPkId(acPick);
 | 
			
		||||
        if (iAcApprovalLogService.saveBatch(approvalLogList)) {
 | 
			
		||||
            // 保存审批日志成功,提交签呈
 | 
			
		||||
            // 提交签呈处理
 | 
			
		||||
            R<String> resultR = iApprovalServiceApi.submitOrder(
 | 
			
		||||
                    ApprovalSubmitDTO.builder()
 | 
			
		||||
                            .eApprovalBusiness(EApprovalBusiness.PICK_ADD_DEL)
 | 
			
		||||
                            .businessCode(businessCode)
 | 
			
		||||
                            .signType(ESignType.getEnumByValue(param.getSignType()))
 | 
			
		||||
                            .userIdList(param.getUserIdList())
 | 
			
		||||
                            .sendIdList(param.getSendIdList())
 | 
			
		||||
                            .remark(param.getRemark())
 | 
			
		||||
                            .fileList(param.getFileList())
 | 
			
		||||
                            .build(),
 | 
			
		||||
                    param.getLoginUser(),
 | 
			
		||||
                    null
 | 
			
		||||
            );
 | 
			
		||||
            if (resultR.isSuccess()) {
 | 
			
		||||
                // 推送业务操作日志
 | 
			
		||||
                rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
 | 
			
		||||
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            throw new BaseException(TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED) + ": " + resultR.getMsg());
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    @Override
 | 
			
		||||
    public String pickApprovalAgree(ApprovalBusinessResultDTO resultDTO) {
 | 
			
		||||
        // 用户ID
 | 
			
		||||
        Long userId = resultDTO.getLoginUser().getUserId();
 | 
			
		||||
        // 所属国家
 | 
			
		||||
        Integer pkCountry = resultDTO.getLoginUser().getDataCountry();
 | 
			
		||||
 | 
			
		||||
        List<AcApprovalLog> approvalLogList = iAcApprovalLogService.queryApprovalLogList(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry);
 | 
			
		||||
        // 一批审批可能有多个
 | 
			
		||||
        AcApprovalLog approvalLog = approvalLogList.get(0);
 | 
			
		||||
        if (null == approvalLog) {
 | 
			
		||||
            log.error("提货充值同意处理失败: 签呈不存在!");
 | 
			
		||||
            return TransactionUtils.getContent(ActivityMsgConstants.PICK_NOT_EXIST);
 | 
			
		||||
        }
 | 
			
		||||
        if (EAgentApprovalStatus.UNAPPROVED.getValue() != approvalLog.getApprovalStatus()) {
 | 
			
		||||
            log.error("提货充值同意处理失败: 签呈已处理");
 | 
			
		||||
            return TransactionUtils.getContent(ActivityMsgConstants.PICK_PROCESSED);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 新増提货列表
 | 
			
		||||
        List<AcPick> createList = new ArrayList<>();
 | 
			
		||||
        // 修改提货列表
 | 
			
		||||
        List<AcPick> updateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        for (AcApprovalLog acApprovalLog : approvalLogList) {
 | 
			
		||||
            // 存在业务ID,则为修改
 | 
			
		||||
            AcPickSaveDetailParam detailParam = JSONUtil.toBean(acApprovalLog.getAfterData(), AcPickSaveDetailParam.class);
 | 
			
		||||
            // 当前会员
 | 
			
		||||
            CuMember cuMember = iMemberServiceApi.getMember(detailParam.getMemberCode()).getData();
 | 
			
		||||
            // 提货ID
 | 
			
		||||
            Long pickId = null;
 | 
			
		||||
            if (null == detailParam.getPkId()) {
 | 
			
		||||
                LambdaQueryWrapper<AcPick> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
                queryWrapper.eq(AcPick::getPickType, EPickType.PICK_PRODUCT.getValue());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkBaseConfig, 0);
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkDataId, detailParam.getPkProduct());
 | 
			
		||||
                queryWrapper.eq(AcPick::getSpecsNameId, detailParam.getSpecsNameId());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkMember, cuMember.getPkId());
 | 
			
		||||
                AcPick acPick = this.getOne(queryWrapper);
 | 
			
		||||
                if (null != acPick) {
 | 
			
		||||
                    pickId = acPick.getPkId();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                pickId = detailParam.getPkId();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            AcPick acPick = new AcPick();
 | 
			
		||||
            if (null == pickId) {
 | 
			
		||||
                // 新增提货数据
 | 
			
		||||
                acPick.setPkMember(cuMember.getPkId());
 | 
			
		||||
                acPick.setPickType(EPickType.PICK_PRODUCT.getValue());
 | 
			
		||||
                acPick.setPkDataId(detailParam.getPkProduct().longValue());
 | 
			
		||||
                acPick.setSpecsName(detailParam.getSpecsName());
 | 
			
		||||
                acPick.setSpecsNameId(detailParam.getSpecsNameId());
 | 
			
		||||
                acPick.setUsableQuantity(detailParam.getQuantity());
 | 
			
		||||
                acPick.setBaseQuantity(detailParam.getBaseQuantity());
 | 
			
		||||
                acPick.setReceiveTime(detailParam.getReceiveTime());
 | 
			
		||||
                acPick.setIsFreeMail(detailParam.getIsFreeMail());
 | 
			
		||||
                acPick.setPkPostage(detailParam.getPkPostage());
 | 
			
		||||
                acPick.setPkCreator(userId);
 | 
			
		||||
                acPick.setPkCountry(pkCountry);
 | 
			
		||||
                createList.add(acPick);
 | 
			
		||||
            } else {
 | 
			
		||||
                // 修改提货数据
 | 
			
		||||
                acPick.setPkId(pickId);
 | 
			
		||||
                acPick.setUsableQuantity(detailParam.getQuantity());
 | 
			
		||||
                acPick.setBaseQuantity(detailParam.getBaseQuantity());
 | 
			
		||||
                acPick.setReceiveTime(detailParam.getReceiveTime());
 | 
			
		||||
                acPick.setIsFreeMail(detailParam.getIsFreeMail());
 | 
			
		||||
                acPick.setPkPostage(detailParam.getPkPostage());
 | 
			
		||||
                acPick.setPkModified(userId);
 | 
			
		||||
                acPick.setModifiedTime(new Date());
 | 
			
		||||
                updateList.add(acPick);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 推送业务操作日志
 | 
			
		||||
        rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
 | 
			
		||||
        return true;
 | 
			
		||||
        if (iAcApprovalLogService.updateApprovalLog(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry, userId, EApproveRechargeStatus.AGREE, resultDTO.getApproveRemark())) {
 | 
			
		||||
            // 更新修改记录
 | 
			
		||||
 | 
			
		||||
            // 提货操作日志
 | 
			
		||||
            List<AcPickLog> logList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
            // 插入提货数据
 | 
			
		||||
            if (CollectionUtil.isNotEmpty(createList)) {
 | 
			
		||||
                for (AcPick acPick : createList) {
 | 
			
		||||
                    this.baseMapper.insert(acPick);
 | 
			
		||||
 | 
			
		||||
                    AcPickLog acPickLog = new AcPickLog();
 | 
			
		||||
                    acPickLog.setPkPick(acPick.getPkId());
 | 
			
		||||
                    acPickLog.setQuantity(acPick.getUsableQuantity());
 | 
			
		||||
                    acPickLog.setPkUser(userId);
 | 
			
		||||
                    acPickLog.setPkCountry(pkCountry);
 | 
			
		||||
                    logList.add(acPickLog);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            // 更新提货数据
 | 
			
		||||
            if (CollectionUtil.isNotEmpty(updateList)) {
 | 
			
		||||
                for (AcPick acPick : updateList) {
 | 
			
		||||
                    this.baseMapper.updatePickByPkId(acPick);
 | 
			
		||||
 | 
			
		||||
                    AcPickLog acPickLog = new AcPickLog();
 | 
			
		||||
                    acPickLog.setPkPick(acPick.getPkId());
 | 
			
		||||
                    acPickLog.setQuantity(acPick.getUsableQuantity());
 | 
			
		||||
                    acPickLog.setPkUser(userId);
 | 
			
		||||
                    acPickLog.setPkCountry(pkCountry);
 | 
			
		||||
                    logList.add(acPickLog);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            // 插入提货操作日志
 | 
			
		||||
            iAcPickLogService.insertBatch(logList);
 | 
			
		||||
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        log.error("提货充值同意处理失败: 更新数据失败");
 | 
			
		||||
        return TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    @Override
 | 
			
		||||
    public String delpickApprovalAgree(ApprovalBusinessResultDTO resultDTO) {
 | 
			
		||||
        // 用户ID
 | 
			
		||||
        Long userId = resultDTO.getLoginUser().getUserId();
 | 
			
		||||
        // 所属国家
 | 
			
		||||
        Integer pkCountry = resultDTO.getLoginUser().getDataCountry();
 | 
			
		||||
 | 
			
		||||
        List<AcApprovalLog> approvalLogList = iAcApprovalLogService.queryApprovalLogList(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry);
 | 
			
		||||
        // 一批审批可能有多个
 | 
			
		||||
        AcApprovalLog approvalLog = approvalLogList.get(0);
 | 
			
		||||
        if (null == approvalLog) {
 | 
			
		||||
            log.error("提货充值同意处理失败: 签呈不存在!");
 | 
			
		||||
            return TransactionUtils.getContent(ActivityMsgConstants.PICK_NOT_EXIST);
 | 
			
		||||
        }
 | 
			
		||||
        if (EAgentApprovalStatus.UNAPPROVED.getValue() != approvalLog.getApprovalStatus()) {
 | 
			
		||||
            log.error("提货充值同意处理失败: 签呈已处理");
 | 
			
		||||
            return TransactionUtils.getContent(ActivityMsgConstants.PICK_PROCESSED);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 删除提货列表
 | 
			
		||||
        List<AcPick> updateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        for (AcApprovalLog acApprovalLog : approvalLogList) {
 | 
			
		||||
            // 存在业务ID,则为修改
 | 
			
		||||
            AcPickSaveDetailParam detailParam = JSONUtil.toBean(acApprovalLog.getAfterData(), AcPickSaveDetailParam.class);
 | 
			
		||||
            // 当前会员
 | 
			
		||||
            CuMember cuMember = iMemberServiceApi.getMember(detailParam.getMemberCode()).getData();
 | 
			
		||||
            // 提货ID
 | 
			
		||||
            Long pickId = null;
 | 
			
		||||
            if (null == detailParam.getPkId()) {
 | 
			
		||||
                LambdaQueryWrapper<AcPick> queryWrapper = new LambdaQueryWrapper<>();
 | 
			
		||||
                queryWrapper.eq(AcPick::getPickType, EPickType.PICK_PRODUCT.getValue());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkBaseConfig, 0);
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkDataId, detailParam.getPkProduct());
 | 
			
		||||
                queryWrapper.eq(AcPick::getPkMember, cuMember.getPkId());
 | 
			
		||||
                AcPick acPick = this.getOne(queryWrapper);
 | 
			
		||||
                if (null != acPick) {
 | 
			
		||||
                    pickId = acPick.getPkId();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                pickId = detailParam.getPkId();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            AcPick acPick = new AcPick();
 | 
			
		||||
            if (null != pickId) {
 | 
			
		||||
                // 删除提货数据
 | 
			
		||||
                acPick.setPkId(pickId);
 | 
			
		||||
                acPick.setPkModified(userId);
 | 
			
		||||
                acPick.setModifiedTime(new Date());
 | 
			
		||||
                updateList.add(acPick);
 | 
			
		||||
            } else {
 | 
			
		||||
                log.error("提货充值同意处理失败: 更新数据失败");
 | 
			
		||||
                return TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (iAcApprovalLogService.updateApprovalLog(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry, userId, EApproveRechargeStatus.AGREE, resultDTO.getApproveRemark())) {
 | 
			
		||||
            // 更新修改记录
 | 
			
		||||
 | 
			
		||||
            // 更新提货数据
 | 
			
		||||
            if (CollectionUtil.isNotEmpty(updateList)) {
 | 
			
		||||
                for (AcPick acPick : updateList) {
 | 
			
		||||
                    this.baseMapper.removePickByPkId(acPick);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        log.error("提货充值同意处理失败: 更新数据失败");
 | 
			
		||||
        return TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String pickApprovalReject(ApprovalBusinessResultDTO resultDTO) {
 | 
			
		||||
        // 用户ID
 | 
			
		||||
        Long userId = resultDTO.getLoginUser().getUserId();
 | 
			
		||||
        // 所属国家
 | 
			
		||||
        Integer pkCountry = resultDTO.getLoginUser().getDataCountry();
 | 
			
		||||
 | 
			
		||||
        List<AcApprovalLog> approvalLogList = iAcApprovalLogService.queryApprovalLogList(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry);
 | 
			
		||||
        // 一批审批可能有多个
 | 
			
		||||
        AcApprovalLog approvalLog = approvalLogList.get(0);
 | 
			
		||||
        if (null == approvalLog) {
 | 
			
		||||
            log.error("提货充值驳回处理失败: 签呈不存在!");
 | 
			
		||||
            return TransactionUtils.getContent(ActivityMsgConstants.PICK_NOT_EXIST);
 | 
			
		||||
        }
 | 
			
		||||
        if (EAgentApprovalStatus.UNAPPROVED.getValue() != approvalLog.getApprovalStatus()) {
 | 
			
		||||
            log.error("提货充值驳回处理失败: 签呈已处理");
 | 
			
		||||
            return TransactionUtils.getContent(ActivityMsgConstants.PICK_PROCESSED);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (iAcApprovalLogService.updateApprovalLog(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry, userId, EApproveRechargeStatus.REJECT, resultDTO.getApproveRemark())) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        log.error("提货充值驳回处理失败: 更新数据失败");
 | 
			
		||||
        return TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -412,6 +593,7 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
 | 
			
		|||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return iPostageBusinessService.queryPostage(acPick.getPkPostage(), productList, recProvince, recCity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -633,6 +633,7 @@ public class ApiRetailOrderController {
 | 
			
		|||
                    .channel(shoppingCartRedis.getSource())
 | 
			
		||||
                    .waresCode(shoppingCartRedis.getWaresCode())
 | 
			
		||||
                    .quantity(shoppingCartRedis.getNumber())
 | 
			
		||||
                    .pkMakerSpace(shoppingCartRedis.getPkMakerSpace())
 | 
			
		||||
                    .build();
 | 
			
		||||
            List<WaresItemsParam> waresItemsParamList = new ArrayList<>(shoppingCartRedis.getProductGroup().size());
 | 
			
		||||
            for (ProductGroup productGroup : shoppingCartRedis.getProductGroup()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -283,7 +283,7 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
 | 
			
		|||
 | 
			
		||||
                if (boxWaresList.contains(waresDetailExt.getWaresCode())) {
 | 
			
		||||
                    // 商品是盒数商品,需要累计数量
 | 
			
		||||
                    boxNum += waresDetailExt.getBoxNum() * orderItems.getWaresQuantity();
 | 
			
		||||
                    boxNum += orderItems.getWaresQuantity();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -601,6 +601,7 @@ public abstract class ParentOrderController extends BaseController {
 | 
			
		|||
                    .channel(shoppingCartRedis.getSource())
 | 
			
		||||
                    .waresCode(shoppingCartRedis.getWaresCode())
 | 
			
		||||
                    .quantity(shoppingCartRedis.getNumber())
 | 
			
		||||
                    .pkMakerSpace(shoppingCartRedis.getPkMakerSpace())
 | 
			
		||||
                    .build();
 | 
			
		||||
            List<WaresItemsParam> waresItemsParamList = new ArrayList<>(shoppingCartRedis.getProductGroup().size());
 | 
			
		||||
            for (ProductGroup productGroup : shoppingCartRedis.getProductGroup()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,9 +40,9 @@ public class OrderItemsParam implements Serializable {
 | 
			
		|||
    private Integer quantity;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品盒数
 | 
			
		||||
     * 创客空间id
 | 
			
		||||
     */
 | 
			
		||||
    private Integer boxNum;
 | 
			
		||||
    private Long pkMakerSpace;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品明细
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2157,13 +2157,11 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
 | 
			
		|||
 | 
			
		||||
        // 当前产品盒数
 | 
			
		||||
        int boxNum = 0;
 | 
			
		||||
        // 处理商品盒数
 | 
			
		||||
        this.handleWaresBoxNum(specialArea, orderItemsParams);
 | 
			
		||||
        // 判断订单明细中指定产品数量,校验等级
 | 
			
		||||
        for (OrderItemsParam orderItemsParam : orderItemsParams) {
 | 
			
		||||
            if (boxWaresList.contains(orderItemsParam.getWaresCode())) {
 | 
			
		||||
                // 存在指定商品,需要累计盒数
 | 
			
		||||
                boxNum += orderItemsParam.getBoxNum() * orderItemsParam.getQuantity();
 | 
			
		||||
                boxNum += orderItemsParam.getQuantity();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2299,29 +2297,4 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 处理商品盒数
 | 
			
		||||
     *
 | 
			
		||||
     * @param orderItemsParams
 | 
			
		||||
     */
 | 
			
		||||
    private void handleWaresBoxNum(Integer specialArea, List<OrderItemsParam> orderItemsParams) {
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(orderItemsParams)) {
 | 
			
		||||
            List<String> waresCodeList = orderItemsParams.stream().map(OrderItemsParam::getWaresCode).collect(Collectors.toList());
 | 
			
		||||
            List<BdWares> waresList = iBdWaresService.list(Wrappers.<BdWares>lambdaQuery()
 | 
			
		||||
                    .eq(BdWares::getSpecialArea, specialArea)
 | 
			
		||||
                    .in(BdWares::getWaresCode, waresCodeList)
 | 
			
		||||
            );
 | 
			
		||||
            if (CollectionUtil.isNotEmpty(waresList)) {
 | 
			
		||||
                for (OrderItemsParam orderItemsParam : orderItemsParams) {
 | 
			
		||||
                    for (BdWares bdWares : waresList) {
 | 
			
		||||
                        if (orderItemsParam.getWaresCode().equals(bdWares.getWaresCode())) {
 | 
			
		||||
                            orderItemsParam.setBoxNum(bdWares.getBoxNum());
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,6 +76,7 @@ public class ApiShoppingCartController extends BaseController {
 | 
			
		|||
                String jsonString = innerShopMap.get(innerKey.toString());
 | 
			
		||||
                ShoppingCartRedis shoppingCartRedis = JSONUtil.toBean(jsonString, ShoppingCartRedis.class);
 | 
			
		||||
                shoppingCartRedis.setNumber(shoppingCartRedis.getNumber() + scr.getNumber());
 | 
			
		||||
                shoppingCartRedis.setPkMakerSpace(scr.getPkMakerSpace());
 | 
			
		||||
 | 
			
		||||
                innerShopMap.put(innerKey.toString(), JSONUtil.toJsonStr(shoppingCartRedis));
 | 
			
		||||
            } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,11 @@ public class ShoppingCartRedis implements Serializable {
 | 
			
		|||
     */
 | 
			
		||||
    private Integer number;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创客空间id
 | 
			
		||||
     */
 | 
			
		||||
    private Long pkMakerSpace;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 产品 sku 组合
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,8 @@ import com.hzs.sale.wares.param.WaresDetailParams;
 | 
			
		|||
import com.hzs.sale.wares.param.*;
 | 
			
		||||
import com.hzs.sale.wares.service.*;
 | 
			
		||||
import com.hzs.sale.wares.vo.*;
 | 
			
		||||
import com.hzs.system.base.ICurrencyServiceApi;
 | 
			
		||||
import com.hzs.system.base.dto.CurrencyDTO;
 | 
			
		||||
import com.hzs.system.config.IRangeServiceApi;
 | 
			
		||||
import com.hzs.system.sys.dto.LoginUser;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
| 
						 | 
				
			
			@ -55,6 +57,8 @@ import java.util.stream.Collectors;
 | 
			
		|||
@RequestMapping("/manage/wares")
 | 
			
		||||
public class BdWaresController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    ICurrencyServiceApi iCurrencyServiceApi;
 | 
			
		||||
    @DubboReference
 | 
			
		||||
    IRangeServiceApi iRangeServiceApi;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +116,8 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
        startPage();
 | 
			
		||||
        List<WaresVo> resultList = iBdWaresService.selectByWaresInfo(waresParams);
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(resultList)) {
 | 
			
		||||
            R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
 | 
			
		||||
            resultList.parallelStream().forEach(waresVo -> {
 | 
			
		||||
                WaresAuthorityVo waresAuthorityVo = iBdWaresService.getWaresAuthorityFirst(waresVo.getPkWares());
 | 
			
		||||
                if (waresAuthorityVo != null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -125,6 +131,10 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
                if (waresVo.getIsMakerGift() != null) {
 | 
			
		||||
                    waresVo.setIsMakerGiftVal(EWaresType.getEnumByValue(waresVo.getIsMakerGift()).getLabel());
 | 
			
		||||
                }
 | 
			
		||||
                if (null != waresVo.getMakerIncome()) {
 | 
			
		||||
                    // 处理发起人收益
 | 
			
		||||
                    waresVo.setMakerIncome(waresVo.getMakerIncome().multiply(currencyDto.getData().getInExchangeRate()));
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        return getDataTable(resultList);
 | 
			
		||||
| 
						 | 
				
			
			@ -141,6 +151,7 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
 | 
			
		||||
        List<WaresVo> resultList = iBdWaresService.selectByWaresInfo(waresParams);
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(resultList)) {
 | 
			
		||||
            R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
            // 获取需要翻译的枚举翻译
 | 
			
		||||
            Map<String, String> transactionMap = iTransactionCommonService.exportEnumTransaction(ESpecialArea.values(), EYesNo.values(), ESupplyWay.values(), EPresaleStatus.values());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -177,6 +188,10 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
                        waresVo.setIsMakerGiftVal(EWaresType.getEnumByValue(waresVo.getIsMakerGift()).getLabel());
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                if (null != waresVo.getMakerIncome()) {
 | 
			
		||||
                    // 处理发起人收益
 | 
			
		||||
                    waresVo.setMakerIncome(waresVo.getMakerIncome().multiply(currencyDto.getData().getInExchangeRate()));
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        ExcelUtil<WaresVo> util = new ExcelUtil<>(WaresVo.class);
 | 
			
		||||
| 
						 | 
				
			
			@ -305,6 +320,7 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
        if (!isPutOn) {
 | 
			
		||||
            return AjaxResult.error("产品规格至少有一个上架");
 | 
			
		||||
        }
 | 
			
		||||
//        wares.setSort(0);
 | 
			
		||||
        iBdWaresService.saveWares(wares, userTokenService.getLoginUser());
 | 
			
		||||
        return AjaxResult.success(wares.getWaresCode());
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -434,6 +450,8 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
                return AjaxResult.error("规格图片必传");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
//        waresParams.setSort(0);
 | 
			
		||||
        iBdWaresService.updateWares(waresParams, userTokenService.getLoginUser());
 | 
			
		||||
        return AjaxResult.success(waresParams.getWaresCode());
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -517,7 +535,10 @@ public class BdWaresController extends BaseController {
 | 
			
		|||
        waresParams.setSortStatus(wares.getSortStatus());
 | 
			
		||||
        waresParams.setSystemType(waresExtend.getSystemType());
 | 
			
		||||
        waresParams.setAreaIncome(wares.getAreaIncome());
 | 
			
		||||
        waresParams.setBoxNum(wares.getBoxNum());
 | 
			
		||||
        if (waresExtend.getMakerIncome() != null) {
 | 
			
		||||
            R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
 | 
			
		||||
            waresParams.setMakerIncome(waresExtend.getMakerIncome().multiply(currencyDto.getData().getInExchangeRate()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        BdAreaClassify parentAreaClassify = areaClassifyService.getAreaClassify(wares.getPkAreaClassify());
 | 
			
		||||
        if (parentAreaClassify != null) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -394,6 +394,11 @@ public class WaresParams implements Serializable {
 | 
			
		|||
     */
 | 
			
		||||
    private Integer sortStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 发起人收益(目前复购使用)
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal makerIncome;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 系统类型(2=新零售,3=美业)
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -409,9 +414,4 @@ public class WaresParams implements Serializable {
 | 
			
		|||
     */
 | 
			
		||||
    private BigDecimal areaIncome;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品上传盒数
 | 
			
		||||
     */
 | 
			
		||||
    private Integer boxNum;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,7 @@ public class BdWaresDetailServiceImpl extends ServiceImpl<BdWaresDetailMapper, B
 | 
			
		|||
                        .waresCode(orderItemsParam.getWaresCode())
 | 
			
		||||
                        .pkWaresSpecsSku(waresItemsParam.getPkWaresSpecsSku())
 | 
			
		||||
                        .waresQuantity(orderItemsParam.getQuantity())
 | 
			
		||||
                        .pkMakerSpace(orderItemsParam.getPkMakerSpace())
 | 
			
		||||
                        .price(BigDecimal.ZERO)
 | 
			
		||||
                        .achieve(BigDecimal.ZERO)
 | 
			
		||||
                        .build();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,7 +111,9 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
 | 
			
		|||
        // 设置 wares 对象的值
 | 
			
		||||
        BdWares wares = BeanUtil.copyProperties(waresParams, BdWares.class);
 | 
			
		||||
        wares.setPkId(waresParams.getWaresId());
 | 
			
		||||
        R<Integer> transaction = transactionServiceApi.createTransaction(user.getDataCountry(), ETransactionKey.SPEC, waresParams.getWaresName(), EYesNo.NO, EYesNo.NO);
 | 
			
		||||
        wares.setWaresCode(waresParams.getWaresCode());
 | 
			
		||||
        wares.setPkTransaction(transaction.getData());
 | 
			
		||||
        wares.setPkCreator(user.getUserId());
 | 
			
		||||
        wares.setPkCountry(user.getDataCountry());
 | 
			
		||||
        wares.setSystemType(user.getSystemType());
 | 
			
		||||
| 
						 | 
				
			
			@ -125,6 +127,14 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
 | 
			
		|||
        this.save(wares);
 | 
			
		||||
        // 商品拓展表
 | 
			
		||||
        BdWaresExtend waresExtend = BeanUtil.copyProperties(waresParams, BdWaresExtend.class);
 | 
			
		||||
        // 存入要转化美金
 | 
			
		||||
        if (!waresParams.getSpecialArea().equals(ESpecialArea.REPURCHASE_AREA.getValue())) {
 | 
			
		||||
            waresParams.setMakerIncome(BigDecimal.ZERO);
 | 
			
		||||
        }
 | 
			
		||||
        if (null != waresParams.getMakerIncome()) {
 | 
			
		||||
            R<CurrencyDTO> currencyDto = currencyServiceApi.getCurrency(user.getDataCountry());
 | 
			
		||||
            waresExtend.setMakerIncome(waresParams.getMakerIncome().divide(currencyDto.getData().getInExchangeRate(), 6, BigDecimal.ROUND_HALF_UP));
 | 
			
		||||
        }
 | 
			
		||||
        // 处理系统类型
 | 
			
		||||
        waresExtend.setSystemType(user.getSystemType());
 | 
			
		||||
        waresExtend.setPkWares(wares.getPkId());
 | 
			
		||||
| 
						 | 
				
			
			@ -529,6 +539,8 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
 | 
			
		|||
    public void updateWares(WaresParams waresParams, LoginUser user) {
 | 
			
		||||
        BdWares wares = BeanUtil.copyProperties(waresParams, BdWares.class);
 | 
			
		||||
        wares.setPkId(waresParams.getWaresId());
 | 
			
		||||
        R<Integer> transaction = transactionServiceApi.createTransaction(user.getDataCountry(), ETransactionKey.SPEC, waresParams.getWaresName(), EYesNo.NO, EYesNo.NO);
 | 
			
		||||
        wares.setPkTransaction(transaction.getData());
 | 
			
		||||
        if (waresParams.getIsPutOn().equals(EYesNo.YES.getIntValue())) {
 | 
			
		||||
            wares.setListingTime(DateUtils.currentDateTime());
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -542,6 +554,14 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
 | 
			
		|||
 | 
			
		||||
        // 商品拓展表
 | 
			
		||||
        BdWaresExtend waresExtend = BeanUtil.copyProperties(waresParams, BdWaresExtend.class);
 | 
			
		||||
        // 存入要转化美金
 | 
			
		||||
        if (!waresParams.getSpecialArea().equals(ESpecialArea.REPURCHASE_AREA.getValue())) {
 | 
			
		||||
            waresParams.setMakerIncome(BigDecimal.ZERO);
 | 
			
		||||
        }
 | 
			
		||||
        if (null != waresParams.getMakerIncome()) {
 | 
			
		||||
            R<CurrencyDTO> currencyDto = currencyServiceApi.getCurrency(user.getDataCountry());
 | 
			
		||||
            waresExtend.setMakerIncome(waresParams.getMakerIncome().divide(currencyDto.getData().getInExchangeRate(), 6, BigDecimal.ROUND_HALF_UP));
 | 
			
		||||
        }
 | 
			
		||||
        // 处理系统类型
 | 
			
		||||
        waresExtend.setSystemType(user.getSystemType());
 | 
			
		||||
        waresExtend.setPkWares(wares.getPkId());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,13 @@ import java.math.BigDecimal;
 | 
			
		|||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * @Author: yuhui
 | 
			
		||||
 * @Time: 2022/11/9 11:02
 | 
			
		||||
 * @Classname: WaresVo
 | 
			
		||||
 * @PackageName: com.hzs.sale.wares.vo
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class WaresVo {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,15 +56,23 @@ public class WaresVo {
 | 
			
		|||
     * 商品价格
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "商品价格")
 | 
			
		||||
    @BigDecimalFormat("#0.00")
 | 
			
		||||
    @BigDecimalFormat("#0.0000")
 | 
			
		||||
    private BigDecimal waresPrice;
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品业绩
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "商品业绩")
 | 
			
		||||
    @BigDecimalFormat("#0.00")
 | 
			
		||||
    @BigDecimalFormat("#0.0000")
 | 
			
		||||
    private BigDecimal waresAchieve;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 发起人收益(目前复购使用)
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "发起人收益(¥)", scale = 2)
 | 
			
		||||
    @BigDecimalFormat
 | 
			
		||||
    private BigDecimal makerIncome;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 支付比例名称
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,7 +134,7 @@
 | 
			
		|||
               cm.member_code,
 | 
			
		||||
               cm.member_name,
 | 
			
		||||
               case
 | 
			
		||||
                   when ap.pick_type in (0, 20) then
 | 
			
		||||
                   when ap.pick_type = 0 then
 | 
			
		||||
                       (select bp.product_name
 | 
			
		||||
                        from bd_product bp
 | 
			
		||||
                        where bp.pk_id = PK_DATA_ID)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,6 +114,7 @@
 | 
			
		|||
            <result column="IS_MAKER_GIFT" property="isMakerGift"/>
 | 
			
		||||
            <result column="EDIT_FLAG" property="editFlag"/>
 | 
			
		||||
            <result column="WARES_CODE" property="waresCode"/>
 | 
			
		||||
            <result column="MAKER_INCOME" property="makerIncome"/>
 | 
			
		||||
            <result column="ITEM_PK_STOREHOUSE" property="pkStorehouse"/>
 | 
			
		||||
        </collection>
 | 
			
		||||
    </resultMap>
 | 
			
		||||
| 
						 | 
				
			
			@ -124,6 +125,7 @@
 | 
			
		|||
        <result column="CREATOR_CODE" property="creatorCode"/>
 | 
			
		||||
        <result column="PK_SETTLE_COUNTRY" property="pkSettleCountry"/>
 | 
			
		||||
        <result column="PK_CENTER_CODE" property="pkCenterCode"/>
 | 
			
		||||
        <result column="PK_STORE_LEVEL" property="pkStoreLevel"/>
 | 
			
		||||
        <result column="IN_EXCHANGE_RATE" property="inExchangeRate"/>
 | 
			
		||||
        <result column="PK_CORP" property="pkCorp"/>
 | 
			
		||||
        <collection property="orderWaresExtList" ofType="com.hzs.common.domain.sale.ext.SaOrderWaresExt">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,6 @@
 | 
			
		|||
        <result column="PRE_SALE_STATUS" property="preSaleStatus"/>
 | 
			
		||||
        <result column="PK_PRODUCT_BAS" property="pkProductBas"/>
 | 
			
		||||
        <result column="PK_UNIT" property="pkUnit"/>
 | 
			
		||||
        <result column="BOX_NUM" property="boxNum"/>
 | 
			
		||||
        <collection property="waresSpecsList" ofType="com.hzs.common.domain.sale.ext.WaresSpecsExt">
 | 
			
		||||
            <result column="PK_SPECS_TYPE" property="pkSpecsType"/>
 | 
			
		||||
            <result column="PK_SPECS" property="pkSpecs"/>
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +50,7 @@
 | 
			
		|||
            be.pk_special_currency,bw.wares_code, bw.wares_name,
 | 
			
		||||
            bd.is_gift is_gift,
 | 
			
		||||
            bd.pk_product,bs.price,bs.achieve,bp.pk_supplier,bp.shipping_channel,bp.product_code,
 | 
			
		||||
            bs.ass_achieve,b.specs_name,b.specs_name_id, bw.box_num
 | 
			
		||||
            bs.ass_achieve,b.specs_name,b.specs_name_id
 | 
			
		||||
            from bd_wares bw
 | 
			
		||||
            inner join bd_wares_extend be
 | 
			
		||||
            on bw.pk_id = be.pk_wares
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,6 @@
 | 
			
		|||
        <result column="PK_SPECIAL_CURRENCY" property="pkSpecialCurrency"/>
 | 
			
		||||
        <result column="SYSTEM_TYPE" property="systemType"/>
 | 
			
		||||
        <result column="AREA_INCOME" property="areaIncome"/>
 | 
			
		||||
        <result column="BOX_NUM" property="boxNum"/>
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <resultMap id="resultMap" type="com.hzs.sale.wares.vo.WaresVo">
 | 
			
		||||
| 
						 | 
				
			
			@ -82,6 +81,7 @@
 | 
			
		|||
        <result column="SORT_STATUS" property="sortStatus"/>
 | 
			
		||||
        <result column="IS_MAKER_GIFT" property="isMakerGift"/>
 | 
			
		||||
        <result column="TEMP_NAME" property="tempName"/>
 | 
			
		||||
        <result column="MAKER_INCOME" property="makerIncome"/>
 | 
			
		||||
        <result column="SYSTEM_TYPE" property="systemType"/>
 | 
			
		||||
        <result column="WARES_STATUS" property="waresStatus"/>
 | 
			
		||||
        <result column="WARES_APPROVER" property="waresApprover"/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,8 @@ import java.lang.annotation.Target;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * BigDecimal自定义序列化处理
 | 
			
		||||
 *
 | 
			
		||||
 * @author
 | 
			
		||||
 */
 | 
			
		||||
@Retention(RetentionPolicy.RUNTIME)
 | 
			
		||||
@Target(ElementType.FIELD)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,41 +1,45 @@
 | 
			
		|||
package com.hzs.common.core.constant.msg;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 公用类提示
 | 
			
		||||
 * @Description: 公用类提示
 | 
			
		||||
 * @Author: jiang chao
 | 
			
		||||
 * @Time: 2023/4/11 11:31
 | 
			
		||||
 * @Classname: CommonMsgConstants
 | 
			
		||||
 * @PackageName: com.hzs.common.core.constant.msg
 | 
			
		||||
 */
 | 
			
		||||
public class CommonMsgConstants {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 前后台数据传入中少了部分数据参数 -- 缺少参数
 | 
			
		||||
     */
 | 
			
		||||
    public static final String MISSING_PARAM = "缺少参数";
 | 
			
		||||
public static final String MISSING_PARAM = "缺少参数";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 接口数据处理因代码原因未成功 -- 操作失败
 | 
			
		||||
     */
 | 
			
		||||
    public static final String OPERATION_FAILED = "操作失败";
 | 
			
		||||
public static final String OPERATION_FAILED = "操作失败";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 一般用于三方对接,处理失败,用户刷新后可以重新进行操作提示 -- 操作失败,请刷新后重试
 | 
			
		||||
     */
 | 
			
		||||
    public static final String OPERATION_FAILED_FLUSH = "操作失败,请刷新后重试";
 | 
			
		||||
public static final String OPERATION_FAILED_FLUSH = "操作失败,请刷新后重试";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户已转结算国,不能进行处理相关操作 -- 用户已转结算国,不能进行操作
 | 
			
		||||
     */
 | 
			
		||||
    public static final String SETTLEMENT_COUNTRY_NOT_OPERATE = "用户已转结算国,不能进行操作";
 | 
			
		||||
public static final String SETTLEMENT_COUNTRY_NOT_OPERATE = "用户已转结算国,不能进行操作";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 签呈处理失败 -- 签呈处理失败
 | 
			
		||||
     */
 | 
			
		||||
    public static final String APPROVAL_ERROR = "签呈处理失败";
 | 
			
		||||
public static final String APPROVAL_ERROR = "签呈处理失败";
 | 
			
		||||
    /**
 | 
			
		||||
     * 签呈审批时,签呈数据不存在或者被删除 -- 签呈处理失败:签呈不存在
 | 
			
		||||
     */
 | 
			
		||||
    public static final String APPROVAL_NOT_EXIST = "签呈处理失败:签呈不存在";
 | 
			
		||||
public static final String APPROVAL_NOT_EXIST = "签呈处理失败:签呈不存在";
 | 
			
		||||
    /**
 | 
			
		||||
     * 签呈审批时,签呈已经被审批 -- 签呈处理失败:签呈已处理
 | 
			
		||||
     */
 | 
			
		||||
    public static final String APPROVAL_PROCESSED = "签呈处理失败:签呈已处理";
 | 
			
		||||
public static final String APPROVAL_PROCESSED = "签呈处理失败:签呈已处理";
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,9 +138,4 @@ public class BdWaresDetailExt extends BdWaresDetail {
 | 
			
		|||
     */
 | 
			
		||||
    private Integer pkUnit;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品上传盒数
 | 
			
		||||
     */
 | 
			
		||||
    private Integer boxNum;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -222,10 +222,4 @@ public class BdWares extends BaseEntity {
 | 
			
		|||
    @TableField("AREA_INCOME")
 | 
			
		||||
    private BigDecimal areaIncome;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 商品上传盒数
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("BOX_NUM")
 | 
			
		||||
    private Integer boxNum;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue