## 添加、修改、删除提货卡不需要处理签呈;

This commit is contained in:
cabbage 2025-05-20 11:36:14 +08:00
parent 5b687f7770
commit aed49d2a57
3 changed files with 215 additions and 107 deletions

View File

@ -238,11 +238,11 @@ 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("缺少参数");
}
// if (null == param.getSignType() || CollectionUtil.isEmpty(param.getUserIdList())
// || CollectionUtil.isEmpty(param.getDetailList())) {
// // 缺少参数
// return AjaxResult.error("缺少参数");
// }
for (AcPickSaveDetailParam detailParam : param.getDetailList()) {
if (StringUtils.isAnyEmpty(detailParam.getMemberCode(), detailParam.getSpecsName(), detailParam.getSpecsNameId())
@ -279,15 +279,12 @@ public class AcPickController extends BaseController {
}
/**
* @description: 删除充值提货卡
* @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("缺少参数");
}

View File

@ -16,9 +16,6 @@ import java.util.List;
/**
* 提货基础表 服务类
*
* @author hzs
* @since 2023-04-21
*/
public interface IAcPickService extends IService<AcPick> {
@ -75,13 +72,11 @@ public interface IAcPickService extends IService<AcPick> {
/*
* @description: 更新提货单
* @param: null null
**/
boolean updatePickUse(List<AcPickExt> acPickExtList, Integer signSource, List<AcPickMemberLog> acPickMemberLogList);
/*
* @description: 更新提货单
* @param: null null
**/
boolean updatePickUse(List<AcPickExt> acPickExtList, List<AcPickMemberLog> acPickMemberLogList);
@ -114,8 +109,6 @@ public interface IAcPickService extends IService<AcPick> {
/**
* @description: 删除充值提货卡发起签呈
* @param: [anpParam]
* @return: boolean
**/
boolean delPick(AcPickSaveParam anpParam);
@ -129,10 +122,7 @@ public interface IAcPickService extends IService<AcPick> {
/**
* @description: 审核删除充值提货卡
* @param: [resultDTO]
* @return: java.lang.String
**/
String delpickApprovalAgree(ApprovalBusinessResultDTO resultDTO);
/**

View File

@ -16,12 +16,10 @@ import com.hzs.activity.wares.service.IAcGiftConfigService;
import com.hzs.common.core.constant.RabbitMqConstants;
import com.hzs.common.core.constant.SystemFieldConstants;
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;
@ -38,9 +36,7 @@ import com.hzs.member.base.IMemberServiceApi;
import com.hzs.sale.postage.IPostageServiceApi;
import com.hzs.sale.postage.dto.PostageProductDTO;
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;
@ -56,9 +52,6 @@ import java.util.stream.Collectors;
/**
* 提货基础表 服务实现类
*
* @author hzs
* @since 2023-04-21
*/
@Slf4j
@Service
@ -79,8 +72,6 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
@Autowired
private IBdProductService iBdProductService;
@DubboReference
IApprovalServiceApi iApprovalServiceApi;
@DubboReference
IMemberServiceApi iMemberServiceApi;
@DubboReference
@ -193,24 +184,81 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
// 操作日志列表
List<BusinessLogDTO> logDTOList = new ArrayList<>();
// 批量保存日志
List<AcApprovalLog> approvalLogList = 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()) {
// 活动审批日志
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());
// // 活动审批日志
// 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);
// 会员信息
CuMember cuMember = iMemberServiceApi.queryMember(detailParam.getMemberCode()).getData();
// 提货ID
Long pickId = null;
// 提货类型
Integer pickType = null != detailParam.getPickType() ? detailParam.getPickType() : EPickType.PICK_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();
}
approvalLogList.add(acApprovalLog);
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);
}
// 产品信息
BdProduct bdProduct = productMap.get(detailParam.getPkProduct());
@ -228,9 +276,6 @@ 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())
@ -243,32 +288,68 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
.build());
}
if (iAcApprovalLogService.saveBatch(approvalLogList)) {
// 保存审批日志成功提交签呈
// 提货操作日志
List<AcPickLog> logList = new ArrayList<>();
// 提交签呈处理
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);
// 插入提货数据
if (CollectionUtil.isNotEmpty(createList)) {
for (AcPick acPick : createList) {
this.baseMapper.insert(acPick);
return null;
AcPickLog acPickLog = new AcPickLog();
acPickLog.setPkPick(acPick.getPkId());
acPickLog.setQuantity(acPick.getUsableQuantity());
acPickLog.setPkUser(userId);
acPickLog.setPkCountry(pkCountry);
logList.add(acPickLog);
}
throw new BaseException(TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED) + ": " + resultR.getMsg());
}
return TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED);
// 更新提货数据
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;
// 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
@ -283,28 +364,61 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
// 操作日志列表
List<BusinessLogDTO> logDTOList = new ArrayList<>();
// 批量保存日志
List<AcApprovalLog> approvalLogList = new ArrayList<>();
// 删除提货列表
List<AcPick> updateList = 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());
// // 活动审批日志
// 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);
// 被操作会员
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::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));
}
approvalLogList.add(acApprovalLog);
// 操作日志内容
StringBuilder content = new StringBuilder("删除会员编号 ").append(detailParam.getMemberCode()).append("");
// 查询提货数量
AcPick acPick = this.getById(detailParam.getPkId());
EPickType ePickType = EPickType.getEnumByValue(acPick.getPickType());
AcPick delAcPick = this.getById(detailParam.getPkId());
EPickType ePickType = EPickType.getEnumByValue(delAcPick.getPickType());
switch (ePickType) {
case PICK_PRODUCT:
case PRIZE:
@ -314,7 +428,7 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
// 提货产品抽奖创客沙棘提货复购提货代金券
if (null != detailParam.getPkProduct()) {
BdProduct product = iBdProductService.getProduct(detailParam.getPkProduct());
content.append(ePickType.getLabel()).append("").append(product.getProductName()).append("(").append(acPick.getSpecsName()).append(")");
content.append(ePickType.getLabel()).append("").append(product.getProductName()).append("(").append(delAcPick.getSpecsName()).append(")");
} else {
content.append(ePickType.getLabel()).append("").append("");
}
@ -326,7 +440,7 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
case LOTTERY_DRAW:
// 消费赠送直推赠送抽奖超级工作室赠送节日赠送 -- 这俩未对接
content.append(ePickType.getLabel());
List<AcGiftConfigExt> acGiftConfigList = iAcGiftConfigService.queryListByRuleIdList(acPick.getPkDataId(), acPick.getPkCountry());
List<AcGiftConfigExt> acGiftConfigList = iAcGiftConfigService.queryListByRuleIdList(delAcPick.getPkDataId(), delAcPick.getPkCountry());
if (CollectionUtil.isNotEmpty(acGiftConfigList)) {
content.append("");
for (AcGiftConfigExt acGiftConfigExt : acGiftConfigList) {
@ -337,9 +451,6 @@ 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())
@ -352,30 +463,40 @@ public class AcPickServiceImpl extends ServiceImpl<AcPickMapper, AcPick> impleme
.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;
// 更新提货数据
if (CollectionUtil.isNotEmpty(updateList)) {
for (AcPick acPick : updateList) {
this.baseMapper.removePickByPkId(acPick);
}
throw new BaseException(TransactionUtils.getContent(CommonMsgConstants.OPERATION_FAILED) + ": " + resultR.getMsg());
}
// 推送业务操作日志
rabbitTemplate.convertAndSend(RabbitMqConstants.BUSINESS_LOG_EXCHANGE, RabbitMqConstants.BUSINESS_LOG_KEY, logDTOList);
// 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;
}