forked from angelo/java-retail-app
## 充值提货卡去签呈;
This commit is contained in:
parent
b70b873412
commit
f17367b2c1
|
@ -9,9 +9,6 @@ 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;
|
||||
|
@ -21,14 +18,10 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -46,8 +39,6 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
|
|||
@Autowired
|
||||
private IAcDrawGiftRuleConfigService drawGiftConfigService;
|
||||
@Autowired
|
||||
private IAcPickService iAcPickService;
|
||||
@Autowired
|
||||
private IAcApprovalLogService iAcApprovalLogService;
|
||||
@Autowired
|
||||
private IAcRepurCouponsRuleConfigService acRepurCouponsRuleConfigService;
|
||||
|
@ -56,12 +47,6 @@ public class ActivityApprovalProvider implements IActivityApprovalServiceApi {
|
|||
@Autowired
|
||||
private IAcRetailPickProductConfigService iAcRetailPickProductConfigService;
|
||||
|
||||
@DubboReference
|
||||
IMemberServiceApi iMemberServiceApi;
|
||||
@DubboReference
|
||||
IProductServiceApi iProductServiceApi;
|
||||
|
||||
|
||||
@Override
|
||||
public R<Boolean> approvalCallback(ApprovalBusinessResultDTO approvalBusinessResultDTO) {
|
||||
try {
|
||||
|
@ -70,14 +55,6 @@ 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);
|
||||
|
@ -128,10 +105,6 @@ 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);
|
||||
|
@ -163,19 +136,6 @@ 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:
|
||||
// 抽奖
|
||||
|
@ -209,11 +169,9 @@ 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,7 +10,6 @@ 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.*;
|
||||
|
@ -93,7 +92,8 @@ public class AcPickController extends BaseController {
|
|||
|
||||
acPickQueryVO.setPickTypeVal(EPickType.getEnumByValue(acPickQueryVO.getPickType()).getLabel());
|
||||
|
||||
if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()) {
|
||||
if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()
|
||||
|| EPickType.COMPANY_PRODUCT.getValue() == acPickExt.getPickType()) {
|
||||
// 提货产品
|
||||
acPickQueryVO.setDetailList(Collections.singletonList(AcPickQueryDetailVO.builder()
|
||||
.productName(acPickExt.getProductName())
|
||||
|
@ -155,7 +155,8 @@ public class AcPickController extends BaseController {
|
|||
|
||||
acPickQueryVO.setPickTypeVal(EPickType.getEnumByValue(acPickQueryVO.getPickType()).getLabel());
|
||||
|
||||
if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()) {
|
||||
if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()
|
||||
|| EPickType.COMPANY_PRODUCT.getValue() == acPickExt.getPickType()) {
|
||||
// 产品处理
|
||||
acPickQueryVO.setDetailList(Collections.singletonList(AcPickQueryDetailVO.builder()
|
||||
.productName(acPickExt.getProductName())
|
||||
|
@ -199,7 +200,8 @@ 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()) {
|
||||
if (EPickType.PICK_PRODUCT.getValue() == acPickExt.getPickType()
|
||||
|| EPickType.COMPANY_PRODUCT.getValue() == acPickExt.getPickType()) {
|
||||
// 产品处理
|
||||
acPickQueryVO.setDetailList(Collections.singletonList(AcPickQueryDetailVO.builder()
|
||||
.pkProduct(acPickExt.getPkDataId().intValue())
|
||||
|
@ -233,23 +235,17 @@ 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(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
|
||||
return AjaxResult.error("缺少参数");
|
||||
}
|
||||
if (EYesNo.NO.getIntValue() == detailParam.getIsFreeMail() && null == detailParam.getPkPostage()) {
|
||||
// 不包邮,则必须传入邮费模板
|
||||
// 缺少参数
|
||||
return AjaxResult.error(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
|
||||
return AjaxResult.error("缺少参数");
|
||||
}
|
||||
|
||||
// 手动添加提货数据比较少,此处查人和产品先单次查,如果同时操作人过多可以改成批量,或者不进行校验
|
||||
|
@ -274,19 +270,14 @@ 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 (null == anpParam.getSignType() || CollectionUtil.isEmpty(anpParam.getUserIdList())
|
||||
|| CollectionUtil.isEmpty(anpParam.getDetailList())) {
|
||||
if (CollectionUtil.isEmpty(anpParam.getDetailList())) {
|
||||
// 缺少参数
|
||||
return AjaxResult.error(TransactionUtils.getContent(CommonMsgConstants.MISSING_PARAM));
|
||||
return AjaxResult.error("缺少参数");
|
||||
}
|
||||
// 设置参数
|
||||
LoginUser loginUser = userTokenService.getLoginUser();
|
||||
|
|
|
@ -6,11 +6,7 @@ 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 {
|
||||
|
@ -76,4 +72,9 @@ public class AcPickSaveDetailParam implements Serializable {
|
|||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 提货类型
|
||||
*/
|
||||
private Integer pickType;
|
||||
|
||||
}
|
||||
|
|
|
@ -8,11 +8,7 @@ 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,7 +6,6 @@ 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;
|
||||
|
@ -38,7 +37,6 @@ public interface IAcPickService extends IService<AcPick> {
|
|||
Integer usableQuantity, String pickCover, Date receiveTime, Integer pkPostage,
|
||||
Long pkCreator, Integer pkCountry, Long pkBaseId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据会员和活动类型回退使用数量
|
||||
*
|
||||
|
@ -81,31 +79,10 @@ 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);
|
||||
|
||||
/**
|
||||
* 会员提货列表
|
||||
*
|
||||
|
@ -135,7 +112,6 @@ public interface IAcPickService extends IService<AcPick> {
|
|||
*/
|
||||
int batchSaveOrUpdatePick(List<AcPick> pickList);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID更新会员提货数据
|
||||
*
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
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;
|
||||
|
@ -13,15 +11,11 @@ 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.base.BaseException;
|
||||
import com.hzs.common.core.exception.ServiceException;
|
||||
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;
|
||||
|
@ -34,9 +28,6 @@ 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;
|
||||
|
@ -57,8 +48,6 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> implements IAcPickService {
|
||||
|
||||
@Autowired
|
||||
private IAcApprovalLogService iAcApprovalLogService;
|
||||
@Autowired
|
||||
private IAcPickLogService iAcPickLogService;
|
||||
@Autowired
|
||||
|
@ -72,8 +61,6 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
@Autowired
|
||||
private IPostageBusinessService iPostageBusinessService;
|
||||
|
||||
@DubboReference
|
||||
IApprovalServiceApi iApprovalServiceApi;
|
||||
@DubboReference
|
||||
IMemberServiceApi iMemberServiceApi;
|
||||
|
||||
|
@ -141,222 +128,25 @@ 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);
|
||||
|
||||
for (AcPickSaveDetailParam detailParam : param.getDetailList()) {
|
||||
// 活动审批日志
|
||||
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());
|
||||
}
|
||||
approvalLogList.add(acApprovalLog);
|
||||
|
||||
// 产品信息
|
||||
BdProduct bdProduct = productMap.get(detailParam.getPkProduct());
|
||||
// 操作日志内容
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("会员编号 ").append(detailParam.getMemberCode());
|
||||
content.append(" 充值提货卡 ").append(bdProduct.getProductName()).append("(").append(detailParam.getSpecsName()).append(")");
|
||||
content.append(",提货基数 ").append(detailParam.getBaseQuantity());
|
||||
content.append(",充值数量 ").append(detailParam.getQuantity());
|
||||
if (null != detailParam.getReceiveTime()) {
|
||||
content.append(",截止日期 ").append(DateUtils.parseDateToFormat(DateUtils.YYYY_MM_DD_HH_MM_SS, detailParam.getReceiveTime()));
|
||||
}
|
||||
if (EYesNo.YES.getIntValue() == detailParam.getIsFreeMail()) {
|
||||
content.append(",包邮;");
|
||||
} else {
|
||||
content.append(",不包邮;");
|
||||
}
|
||||
|
||||
// 会员信息
|
||||
CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
|
||||
// 封装业务操作日志
|
||||
logDTOList.add(BusinessLogDTO.builder()
|
||||
.businessType(EApprovalBusiness.PICK_ADD.getValue())
|
||||
.businessCode(businessCode)
|
||||
.content(content.toString())
|
||||
.pkMember(cuMember.getPkId())
|
||||
.pkCreator(userId)
|
||||
.pkCountry(pkCountry)
|
||||
.freeSignFlag(false)
|
||||
.build());
|
||||
}
|
||||
|
||||
if (iAcApprovalLogService.saveBatch(approvalLogList)) {
|
||||
// 保存审批日志成功,提交签呈
|
||||
|
||||
// 提交签呈处理
|
||||
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);
|
||||
|
||||
return null;
|
||||
}
|
||||
throw new BaseException(TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED) + ": " + resultR.getMsg());
|
||||
}
|
||||
return TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delPick(AcPickSaveParam param) {
|
||||
// 会员ID
|
||||
Long userId = param.getLoginUser().getUserId();
|
||||
// 所属国家
|
||||
Integer pkCountry = param.getLoginUser().getDataCountry();
|
||||
// 业务编号
|
||||
String businessCode = CommonUtil.createSerialNumber(EOrderPrefix.ACTIVITY_CODE);
|
||||
|
||||
// 操作日志列表
|
||||
List<BusinessLogDTO> logDTOList = new ArrayList<>();
|
||||
|
||||
// 批量保存日志
|
||||
List<AcApprovalLog> approvalLogList = new ArrayList<>();
|
||||
|
||||
for (AcPickSaveDetailParam detailParam : param.getDetailList()) {
|
||||
// 活动审批日志
|
||||
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 acPick = this.getById(detailParam.getPkId());
|
||||
EPickType ePickType = EPickType.getEnumByValue(acPick.getPickType());
|
||||
switch (ePickType) {
|
||||
case PICK_PRODUCT:
|
||||
case PRIZE:
|
||||
// 提货产品、抽奖
|
||||
if (null != detailParam.getPkProduct()) {
|
||||
BdProduct product = iBdProductService.getProduct(detailParam.getPkProduct());
|
||||
content.append(ePickType.getLabel()).append(",").append(product.getProductName()).append("(").append(acPick.getSpecsName()).append(");");
|
||||
} else {
|
||||
content.append(ePickType.getLabel()).append(",").append(";");
|
||||
}
|
||||
break;
|
||||
case CONSUMPTION_GIFT:
|
||||
case DIRECT_PUSH_GIFT:
|
||||
case LOTTERY_DRAW:
|
||||
// 消费赠送、直推赠送、抽奖
|
||||
content.append(ePickType.getLabel());
|
||||
List<AcGiftConfigExt> acGiftConfigList = iAcGiftConfigService.queryListByRuleIdList(acPick.getPkDataId(), acPick.getPkCountry());
|
||||
if (CollectionUtil.isNotEmpty(acGiftConfigList)) {
|
||||
content.append(",");
|
||||
for (AcGiftConfigExt acGiftConfigExt : acGiftConfigList) {
|
||||
content.append(acGiftConfigExt.getProductName()).append("(").append(acGiftConfigExt.getSpecsName()).append(") ");
|
||||
}
|
||||
}
|
||||
content.append(";");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
// 被操作会员
|
||||
CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
|
||||
// 封装业务操作日志
|
||||
logDTOList.add(BusinessLogDTO.builder()
|
||||
.businessType(EApprovalBusiness.PICK_ADD_DEL.getValue())
|
||||
.businessCode(businessCode)
|
||||
.content(content.toString())
|
||||
.pkMember(cuMember.getPkId())
|
||||
.pkCreator(userId)
|
||||
.pkCountry(pkCountry)
|
||||
.freeSignFlag(false)
|
||||
.build());
|
||||
}
|
||||
|
||||
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();
|
||||
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, EPickType.PICK_PRODUCT.getValue());
|
||||
queryWrapper.eq(AcPick::getPickType, pickType);
|
||||
queryWrapper.eq(AcPick::getPkBaseConfig, 0);
|
||||
queryWrapper.eq(AcPick::getPkDataId, detailParam.getPkProduct());
|
||||
queryWrapper.eq(AcPick::getSpecsNameId, detailParam.getSpecsNameId());
|
||||
|
@ -373,7 +163,7 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
if (null == pickId) {
|
||||
// 新增提货数据
|
||||
acPick.setPkMember(cuMember.getPkId());
|
||||
acPick.setPickType(EPickType.PICK_PRODUCT.getValue());
|
||||
acPick.setPickType(pickType);
|
||||
acPick.setPkDataId(detailParam.getPkProduct().longValue());
|
||||
acPick.setSpecsName(detailParam.getSpecsName());
|
||||
acPick.setSpecsNameId(detailParam.getSpecsNameId());
|
||||
|
@ -397,10 +187,35 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
acPick.setModifiedTime(new Date());
|
||||
updateList.add(acPick);
|
||||
}
|
||||
}
|
||||
|
||||
if (iAcApprovalLogService.updateApprovalLog(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry, userId, EApproveRechargeStatus.AGREE, resultDTO.getApproveRemark())) {
|
||||
// 更新修改记录
|
||||
|
||||
// 产品信息
|
||||
BdProduct bdProduct = productMap.get(detailParam.getPkProduct());
|
||||
// 操作日志内容
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("会员编号 ").append(detailParam.getMemberCode());
|
||||
content.append(" 充值提货卡 ").append(bdProduct.getProductName()).append("(").append(detailParam.getSpecsName()).append(")");
|
||||
content.append(",提货基数 ").append(detailParam.getBaseQuantity());
|
||||
content.append(",充值数量 ").append(detailParam.getQuantity());
|
||||
if (null != detailParam.getReceiveTime()) {
|
||||
content.append(",截止日期 ").append(DateUtils.parseDateToFormat(DateUtils.YYYY_MM_DD_HH_MM_SS, detailParam.getReceiveTime()));
|
||||
}
|
||||
if (EYesNo.YES.getIntValue() == detailParam.getIsFreeMail()) {
|
||||
content.append(",包邮;");
|
||||
} else {
|
||||
content.append(",不包邮;");
|
||||
}
|
||||
// 封装业务操作日志
|
||||
logDTOList.add(BusinessLogDTO.builder()
|
||||
.businessType(EApprovalBusiness.PICK_ADD.getValue())
|
||||
.businessCode(businessCode)
|
||||
.content(content.toString())
|
||||
.pkMember(cuMember.getPkId())
|
||||
.pkCreator(userId)
|
||||
.pkCountry(pkCountry)
|
||||
.freeSignFlag(false)
|
||||
.build());
|
||||
}
|
||||
|
||||
// 提货操作日志
|
||||
List<AcPickLog> logList = new ArrayList<>();
|
||||
|
@ -434,45 +249,34 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
// 插入提货操作日志
|
||||
iAcPickLogService.insertBatch(logList);
|
||||
|
||||
// 推送业务操作日志
|
||||
rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
|
||||
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();
|
||||
public boolean delPick(AcPickSaveParam param) {
|
||||
// 会员ID
|
||||
Long userId = param.getLoginUser().getUserId();
|
||||
// 所属国家
|
||||
Integer pkCountry = resultDTO.getLoginUser().getDataCountry();
|
||||
Integer pkCountry = param.getLoginUser().getDataCountry();
|
||||
// 业务编号
|
||||
String businessCode = CommonUtil.createSerialNumber(EOrderPrefix.ACTIVITY_CODE);
|
||||
|
||||
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<BusinessLogDTO> logDTOList = 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();
|
||||
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.PICK_PRODUCT.getValue());
|
||||
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());
|
||||
|
@ -493,12 +297,54 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
updateList.add(acPick);
|
||||
} else {
|
||||
log.error("提货充值同意处理失败: 更新数据失败");
|
||||
return TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR);
|
||||
}
|
||||
throw new ServiceException(TransactionUtils.getContent(DocumentMsgConstants.DOCUMENT_ORDER_ERROR));
|
||||
}
|
||||
|
||||
if (iAcApprovalLogService.updateApprovalLog(resultDTO.getEApprovalBusiness(), resultDTO.getBusinessCode(), pkCountry, userId, EApproveRechargeStatus.AGREE, resultDTO.getApproveRemark())) {
|
||||
// 更新修改记录
|
||||
// 操作日志内容
|
||||
StringBuilder content = new StringBuilder("删除会员编号 ").append(detailParam.getMemberCode()).append(" 的 ");
|
||||
|
||||
// 查询提货数量
|
||||
AcPick delAcPick = this.getById(detailParam.getPkId());
|
||||
EPickType ePickType = EPickType.getEnumByValue(delAcPick.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(");");
|
||||
} else {
|
||||
content.append(ePickType.getLabel()).append(",").append(";");
|
||||
}
|
||||
break;
|
||||
case CONSUMPTION_GIFT:
|
||||
case DIRECT_PUSH_GIFT:
|
||||
case LOTTERY_DRAW:
|
||||
// 消费赠送、直推赠送、抽奖
|
||||
content.append(ePickType.getLabel());
|
||||
List<AcGiftConfigExt> acGiftConfigList = iAcGiftConfigService.queryListByRuleIdList(acPick.getPkDataId(), acPick.getPkCountry());
|
||||
if (CollectionUtil.isNotEmpty(acGiftConfigList)) {
|
||||
content.append(",");
|
||||
for (AcGiftConfigExt acGiftConfigExt : acGiftConfigList) {
|
||||
content.append(acGiftConfigExt.getProductName()).append("(").append(acGiftConfigExt.getSpecsName()).append(") ");
|
||||
}
|
||||
}
|
||||
content.append(";");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
// 封装业务操作日志
|
||||
logDTOList.add(BusinessLogDTO.builder()
|
||||
.businessType(EApprovalBusiness.PICK_ADD_DEL.getValue())
|
||||
.businessCode(businessCode)
|
||||
.content(content.toString())
|
||||
.pkMember(cuMember.getPkId())
|
||||
.pkCreator(userId)
|
||||
.pkCountry(pkCountry)
|
||||
.freeSignFlag(false)
|
||||
.build());
|
||||
}
|
||||
|
||||
// 更新提货数据
|
||||
if (CollectionUtil.isNotEmpty(updateList)) {
|
||||
|
@ -507,36 +353,9 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
// 推送业务操作日志
|
||||
rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -593,7 +412,6 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
|
|||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return iPostageBusinessService.queryPostage(acPick.getPkPostage(), productList, recProvince, recCity);
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
cm.member_code,
|
||||
cm.member_name,
|
||||
case
|
||||
when ap.pick_type = 0 then
|
||||
when ap.pick_type in (0, 20) then
|
||||
(select bp.product_name
|
||||
from bd_product bp
|
||||
where bp.pk_id = PK_DATA_ID)
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
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 {
|
||||
|
||||
|
|
Loading…
Reference in New Issue