diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/mapper/AccInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/mapper/AccInfoMapper.java index 2adcbc90..48a1fa16 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/mapper/AccInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/mapper/AccInfoMapper.java @@ -101,4 +101,6 @@ public interface AccInfoMapper extends BaseMapper { Page queryPageAccInfoForAppWork(Page page, @Param("infoParam") AppWorkAccInfoPageDTO pageDTO); Integer queryAccInfoExpiredCount(@Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime, @Param("accStatus") Integer accStatus); + + List queryAccBaseInfoList(@Param("custIdList") List custIdList); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccBatchOperateService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccBatchOperateService.java new file mode 100644 index 00000000..d8b48fdb --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccBatchOperateService.java @@ -0,0 +1,20 @@ +package com.bonus.canteen.core.account.v3.service; + + +import com.bonus.canteen.core.account.v3.web.dto.AccBatchRechargeCheckDTO; +import com.bonus.canteen.core.account.v3.web.dto.AccRepairDeductBatchDTO; +import com.bonus.canteen.core.account.v3.web.dto.AccSubClearBatchDTO; +import com.bonus.canteen.core.account.v3.web.dto.AccTransferBatchDTO; +import com.bonus.canteen.core.account.v3.web.vo.AccBatchCommonCheckVO; +import com.bonus.canteen.core.account.v3.web.vo.AccBatchRechargeCheckVO; +import com.bonus.canteen.core.account.v3.web.vo.AccBatchRepairCheckVO; + +public interface AccBatchOperateService { + AccBatchRechargeCheckVO checkAccBatchRecharge(AccBatchRechargeCheckDTO content); + + AccBatchRepairCheckVO checkAccBatchRepairDeduct(AccRepairDeductBatchDTO repairDeductBatchDTO); + + AccBatchCommonCheckVO checkAccBatchClear(AccSubClearBatchDTO content); + + AccBatchCommonCheckVO checkAccBatchTransfer(AccTransferBatchDTO content); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccInfoService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccInfoService.java index 344e141e..ec94d767 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccInfoService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/AccInfoService.java @@ -49,4 +49,6 @@ public interface AccInfoService { Long getCustIdBySerialNum(String serialNum); Page queryFrozenAccPage(Page page, AccExistFrozenPageDTO pageDTO); + + List queryAccBaseInfoList(List custIdList); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccBatchOperateServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccBatchOperateServiceImpl.java new file mode 100644 index 00000000..15a8b411 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccBatchOperateServiceImpl.java @@ -0,0 +1,220 @@ +package com.bonus.canteen.core.account.v3.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.bonus.canteen.core.account.v3.metadata.enums.AccWalletIdEnum; +import com.bonus.canteen.core.account.v3.service.*; +import com.bonus.canteen.core.account.v3.utils.AccUtils; +import com.bonus.canteen.core.account.v3.web.dto.*; +import com.bonus.canteen.core.account.v3.web.vo.*; +import com.bonus.canteen.core.allocation.api.AllocMealtimeApi; +import com.bonus.canteen.core.marketing.v2.api.MarketApi; +import com.bonus.canteen.core.marketing.v2.rule.pay.dto.RulePayComputeDTO; +import com.bonus.canteen.core.marketing.v2.rule.pay.dto.RulePayResultDTO; +import com.bonus.canteen.core.menu.model.AllocMealtimeModel; +import com.bonus.common.core.exception.ServiceException; +import com.bonus.common.houqin.constant.LeConstants; +import com.bonus.common.houqin.i18n.I18n; +import com.bonus.canteen.core.order.common.constants.OrderTypeEnum; +import org.apache.commons.compress.utils.Lists; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +@Service +public class AccBatchOperateServiceImpl implements AccBatchOperateService { + private static final Logger log = LoggerFactory.getLogger(AccBatchOperateServiceImpl.class); + @Autowired + @Lazy + private AccInfoService accInfoService; + @Autowired + @Lazy + private AllocMealtimeApi allocMealtimeApi; + @Autowired + @Lazy + private MarketApi marketApi; + @Autowired + @Lazy + private AccPayService accPayService; + @Autowired + @Lazy + private AccSubService accSubService; + @Autowired + @Lazy + private AccInfoHandleBusiness accInfoHandleBusiness; + + public AccBatchRechargeCheckVO checkAccBatchRecharge(AccBatchRechargeCheckDTO content) { + log.info("[批量充值校验]操作人数={}", content.getCustIdList().size()); + List accInfoList = this.accInfoService.queryAccBaseInfoList(content.getCustIdList()); + if (CollUtil.isEmpty(accInfoList)) { + throw new ServiceException(I18n.getMessage("acc_empty_exception")); + } else { + Map custIdToAccInfo = accInfoList.stream().collect(Collectors.toMap(AccInfoVO::getCustId, Function.identity())); + List sucVoList = new ArrayList(); + List errVOList = new ArrayList(); + BigDecimal rechargeAmount = content.getAmount(); + content.getCustIdList().forEach((custId) -> { + AccInfoVO accInfoVO = (AccInfoVO)custIdToAccInfo.get(custId); + + try { + this.accInfoService.checkAccInfoAndStatus(accInfoVO); + } catch (ServiceException var8) { + errVOList.add(AccBatchRechargeCheckErrVO.builderAccBatchRechargeCheckErrVO(custId, accInfoVO, rechargeAmount, var8.getMessage())); + return; + } + + sucVoList.add(custId); + }); + AccBatchRechargeCheckVO result = new AccBatchRechargeCheckVO(); + result.setTotalCount(content.getCustIdList().size()); + result.setSucCount(sucVoList.size()); + result.setSucTotalAmount(rechargeAmount.multiply(new BigDecimal(sucVoList.size()))); + result.setSucVOList(sucVoList); + result.setErrCount(errVOList.size()); + result.setErrVOList(errVOList); + result.setOperateAmount(rechargeAmount); + result.setRechargeType(content.getRechargeType()); + result.setRemark(content.getRemark()); + result.setValidateDay(content.getValidateDay()); + return result; + } + } + + public AccBatchRepairCheckVO checkAccBatchRepairDeduct(AccRepairDeductBatchDTO repairDeductBatchDTO) { + AccRepairDeductBaseDTO accRepairDeductBaseDTO = new AccRepairDeductBaseDTO(); + BeanUtil.copyProperties(repairDeductBatchDTO, accRepairDeductBaseDTO, new String[0]); + log.info("[批量补扣校验]_人数:{},入参={}", repairDeductBatchDTO.getCustIdList().size(), JSONUtil.toJsonStr(accRepairDeductBaseDTO)); + this.checkMealtimeType(repairDeductBatchDTO.getMealtimeType(), repairDeductBatchDTO.getCanteenId(), repairDeductBatchDTO.getShopstallId()); + List accInfoVOList = this.accInfoService.listAccInfoVoByCustIdList(repairDeductBatchDTO.getCustIdList()); + if (CollUtil.isEmpty(accInfoVOList)) { + throw new ServiceException(I18n.getMessage("acc_empty_exception")); + } else { + Map custIdToAccInfo = (Map)accInfoVOList.stream().collect(Collectors.toMap(AccInfoVO::getCustId, Function.identity())); + List sucVoList = new ArrayList(); + List errVOList = new ArrayList(); + BigDecimal deductAmount = repairDeductBatchDTO.getAmount(); + Map limitConfig = this.accInfoHandleBusiness.getMerchantLimitConfig(); + repairDeductBatchDTO.getCustIdList().forEach((custId) -> { + AccInfoVO accInfoVO = (AccInfoVO)custIdToAccInfo.get(custId); + AccBatchRepairCheckErrVO accBatchRepairCheckErrVO = AccBatchRepairCheckErrVO.builderAccBatchRepairCheckErrVO(custId, accInfoVO, deductAmount, (String)null); + + try { + this.accInfoService.checkAccInfoAndStatus(accInfoVO); + } catch (ServiceException var12) { + accBatchRepairCheckErrVO.setErrMsg(var12.getMessage()); + errVOList.add(accBatchRepairCheckErrVO); + return; + } + + List walletIdList = this.getWalletPayIdList(accInfoVO.getCustId(), accRepairDeductBaseDTO); + log.info("[批量补扣校验]获取钱包扣款顺序:{}", JSONUtil.toJsonStr(walletIdList)); + BigDecimal reduce = this.accInfoHandleBusiness.calculateCanUseTotalAmount(accInfoVO, limitConfig, walletIdList); + if (deductAmount.compareTo(reduce) > 0) { + accBatchRepairCheckErrVO.setErrMsg("账户余额不足"); + errVOList.add(accBatchRepairCheckErrVO); + } else { + sucVoList.add(custId); + } + }); + AccBatchRepairCheckVO result = new AccBatchRepairCheckVO(); + BeanUtil.copyProperties(accRepairDeductBaseDTO, result, new String[0]); + result.setTotalCount(repairDeductBatchDTO.getCustIdList().size()); + result.setSucCount(sucVoList.size()); + result.setSucTotalAmount(deductAmount.multiply(new BigDecimal(sucVoList.size()))); + result.setSucVOList(sucVoList); + result.setErrCount(errVOList.size()); + result.setErrVOList(errVOList); + return result; + } + } + + public AccBatchCommonCheckVO checkAccBatchClear(AccSubClearBatchDTO content) { + log.info("[批量清空校验]操作人数={}", content.getCustIdList().size()); + Map> batchAccInfoMap = this.getBatchAccInfoMap(content.getCustIdList()); + List sucVoList = Lists.newArrayList(); + List errVOList = Lists.newArrayList(); + List amountList = Lists.newArrayList(); + content.getCustIdList().forEach((custId) -> { + AccInfoVO accInfoVO = (AccInfoVO)Optional.ofNullable((List)batchAccInfoMap.get(custId)).map((list) -> { + return (AccInfoVO)list.get(0); + }).orElse(null); + + BigDecimal clearAmount; + try { + this.accInfoService.checkAccInfoAndStatus(accInfoVO); + clearAmount = this.accSubService.calculateClearAmount(accInfoVO, content.getClearType(), content.getAmount()); + if (clearAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw new ServiceException(I18n.getMessage("acc_sub_clear_single_exception")); + } + } catch (ServiceException var10) { + errVOList.add(AccBatchCommonCheckErrVO.builderAccBatchRechargeCheckErrVO(custId, accInfoVO, content.getAmount(), var10.getMessage())); + return; + } + + sucVoList.add(custId); + amountList.add(clearAmount); + }); + return (new AccBatchCommonCheckVO()).setTotalCount(content.getCustIdList().size()).setSucCount(sucVoList.size()).setSucVOList(sucVoList).setSucTotalAmount((BigDecimal)amountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add)).setErrCount(errVOList.size()).setErrVOList(errVOList).setOperateAmount(content.getAmount()).setClearType(content.getClearType()); + } + + public AccBatchCommonCheckVO checkAccBatchTransfer(AccTransferBatchDTO content) { + log.info("[批量转账校验]操作人数={}", content.getCustIdList().size()); + Map> batchAccInfoMap = this.getBatchAccInfoMap(content.getCustIdList()); + List sucVoList = Lists.newArrayList(); + List errVOList = Lists.newArrayList(); + content.getCustIdList().forEach((custId) -> { + AccInfoVO accInfoVO = (AccInfoVO)Optional.ofNullable((List)batchAccInfoMap.get(custId)).map((list) -> { + return (AccInfoVO)list.get(0); + }).orElse(null); + + try { + this.accInfoService.checkAccInfoAndStatus(accInfoVO); + BigDecimal walletBal = AccUtils.getWalletBal(accInfoVO.getWalletInfoList(), AccWalletIdEnum.WALLET.getKey()); + if (walletBal.compareTo(content.getAmount()) < 0) { + throw new ServiceException(I18n.getMessage("acc_wallet_not_enough_amount", new Object[0])); + } + } catch (ServiceException var8) { + errVOList.add(AccBatchCommonCheckErrVO.builderAccBatchRechargeCheckErrVO(custId, accInfoVO, content.getAmount(), var8.getMessage())); + return; + } + + sucVoList.add(custId); + }); + return (new AccBatchCommonCheckVO()).setTotalCount(content.getCustIdList().size()).setSucCount(sucVoList.size()).setSucVOList(sucVoList).setSucTotalAmount(content.getAmount().multiply(new BigDecimal(sucVoList.size()))).setErrCount(errVOList.size()).setErrVOList(errVOList).setOperateAmount(content.getAmount()).setRemark(content.getRemark()); + } + + private Map> getBatchAccInfoMap(List custIdList) { + List accInfoList = this.accInfoService.listAccInfoVoByCustIdList(custIdList); + return AccUtils.getInfoMap(accInfoList, AccInfoVO::getCustId); + } + + protected void checkMealtimeType(Integer mealtimeType, Long canteenId, Long stallId) { + AllocMealtimeModel allocMealtimeModel = this.allocMealtimeApi.getAvailableMealtimeByType(mealtimeType, canteenId, stallId); + if (ObjectUtil.isNull(allocMealtimeModel)) { + throw new ServiceException(I18n.getMessage("acc_repeal_mealtime_nonentity")); + } + } + + protected List getWalletPayIdList(Long custId, AccRepairDeductBaseDTO repairDeductBaseDTO) { + if (ObjectUtil.equals(LeConstants.COMMON_YES, repairDeductBaseDTO.getIfSetDeduction()) && CollUtil.isNotEmpty(repairDeductBaseDTO.getWalletTypeList())) { + return repairDeductBaseDTO.getWalletTypeList(); + } else { + RulePayComputeDTO rulePayComputeDTO = (new RulePayComputeDTO()).setCustId(custId).setOrderType(OrderTypeEnum.DEDUCT.getKey()).setCanteenId(repairDeductBaseDTO.getCanteenId()).setDeviceSn(repairDeductBaseDTO.getMchSn()).setConsumeDate(repairDeductBaseDTO.getOrdDateTime().toLocalDate()); + RulePayResultDTO rulePayResultDTO = this.marketApi.rulePayCompute(rulePayComputeDTO); + log.info("[账户补扣]获取规则扣款顺序:{}", JSONUtil.toJsonStr(rulePayResultDTO)); + return CollUtil.isNotEmpty(rulePayResultDTO.getWalletIds()) ? rulePayResultDTO.getWalletIds() : this.accPayService.getWalletPayDefaultOrder(); + } + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccInfoServiceImpl.java index 33404a5f..e9df4eaf 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/service/impl/AccInfoServiceImpl.java @@ -362,4 +362,8 @@ public class AccInfoServiceImpl extends ServiceImpl impl return result; } + public List queryAccBaseInfoList(List custIdList) { + return ((AccInfoMapper)this.baseMapper).queryAccBaseInfoList(custIdList); + } + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/controller/AccBatchOperateController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/controller/AccBatchOperateController.java new file mode 100644 index 00000000..e574dcdd --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/controller/AccBatchOperateController.java @@ -0,0 +1,66 @@ +package com.bonus.canteen.core.account.v3.web.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.bonus.canteen.core.account.v3.constants.AccOrdSourceTypeEnum; +import com.bonus.canteen.core.account.v3.service.AccBatchOperateService; +import com.bonus.canteen.core.account.v3.web.dto.*; +import com.bonus.canteen.core.account.v3.web.vo.AccBatchCommonCheckVO; +import com.bonus.canteen.core.account.v3.web.vo.AccBatchRechargeCheckVO; +import com.bonus.canteen.core.account.v3.web.vo.AccBatchRepairCheckVO; +import com.bonus.common.core.exception.ServiceException; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.houqin.i18n.I18n; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +@RestController +@RequestMapping({"/api/v3/acc/batch/operate"}) +@Api( + value = "ly_个人钱包控制器v3", + tags = {"ly_个人钱包控制器v3"} +) +public class AccBatchOperateController { + @Autowired + private AccBatchOperateService accBatchOperateService; + + @ApiOperation("批量充值校验(个人钱包/补贴/红包)") + @PostMapping({"/recharge/check"}) + public AjaxResult checkAccBatchRecharge(@RequestBody @Valid AccBatchRechargeCheckDTO request) { + return AjaxResult.success(this.accBatchOperateService.checkAccBatchRecharge(request)); + } + + @ApiOperation("批量补扣校验") + @PostMapping({"/repair/deduct/check"}) + public AjaxResult checkAccBatchRepairDeduct(@RequestBody @Valid AccRepairDeductBatchDTO repairDeductBatchDTO) { + this.checkAccRepairDeductParam(repairDeductBatchDTO); + return AjaxResult.success(this.accBatchOperateService.checkAccBatchRepairDeduct(repairDeductBatchDTO)); + } + + @ApiOperation("批量补贴清空校验") + @PostMapping({"/clear/sub/check"}) + public AjaxResult checkAccBatchClear(@RequestBody @Valid AccSubClearBatchDTO request) { + return AjaxResult.success(this.accBatchOperateService.checkAccBatchClear(request)); + } + + @ApiOperation("批量钱包转账校验") + @PostMapping({"/transfer/check"}) + public AjaxResult checkAccBatchTransfer(@RequestBody @Valid AccTransferBatchDTO request) { + return AjaxResult.success(this.accBatchOperateService.checkAccBatchTransfer(request)); + } + + protected void checkAccRepairDeductParam(AccRepairDeductBaseDTO accRepairDeductBaseDTO) { + if (AccOrdSourceTypeEnum.DEVICE.getKey().equals(accRepairDeductBaseDTO.getOrdWay()) && ObjectUtil.isEmpty(accRepairDeductBaseDTO.getMchSn())) { + throw new ServiceException(I18n.getMessage("acc_deduction_conf_null_mch_exception")); + } else if (accRepairDeductBaseDTO.getIfSetDeduction() == 1 && CollUtil.isEmpty(accRepairDeductBaseDTO.getWalletTypeList())) { + throw new ServiceException(I18n.getMessage("acc_deduction_conf_null_exception")); + } + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/dto/AccBatchRechargeCheckDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/dto/AccBatchRechargeCheckDTO.java new file mode 100644 index 00000000..90aec4d1 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/dto/AccBatchRechargeCheckDTO.java @@ -0,0 +1,78 @@ +package com.bonus.canteen.core.account.v3.web.dto; + +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.List; + +public class AccBatchRechargeCheckDTO { + @ApiModelProperty("人员Id") + private @NotEmpty( + message = "{acc_batch_empty_custid_exception}" +) @Size( + max = 5000, + message = "{acc_batch_operation_limit_exception}" +) List custIdList; + @ApiModelProperty("充值金额/分") + private @NotNull( + message = "{acc_operation_amount_null_exception}" +) @Min( + value = 1L, + message = "{acc_operation_amount_min_exception}" +) BigDecimal amount; + @ApiModelProperty("个人钱包充值使用,充值类型 1微信线下扫码 2支付宝线下扫码 3现金充值") + private Integer rechargeType; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("补贴到账后有效期(天)") + private Integer validateDay; + + public List getCustIdList() { + return this.custIdList; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public Integer getRechargeType() { + return this.rechargeType; + } + + public String getRemark() { + return this.remark; + } + + public Integer getValidateDay() { + return this.validateDay; + } + + public void setCustIdList(final List custIdList) { + this.custIdList = custIdList; + } + + public void setAmount(final BigDecimal amount) { + this.amount = amount; + } + + public void setRechargeType(final Integer rechargeType) { + this.rechargeType = rechargeType; + } + + public void setRemark(final String remark) { + this.remark = remark; + } + + public void setValidateDay(final Integer validateDay) { + this.validateDay = validateDay; + } + + public String toString() { + String var10000 = String.valueOf(this.getCustIdList()); + return "AccBatchRechargeCheckDTO(custIdList=" + var10000 + ", amount=" + String.valueOf(this.getAmount()) + ", rechargeType=" + this.getRechargeType() + ", remark=" + this.getRemark() + ", validateDay=" + this.getValidateDay() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchCommonCheckErrVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchCommonCheckErrVO.java new file mode 100644 index 00000000..21f280d0 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchCommonCheckErrVO.java @@ -0,0 +1,101 @@ +package com.bonus.canteen.core.account.v3.web.vo; + +import cn.hutool.core.util.ObjectUtil; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; + +public class AccBatchCommonCheckErrVO { + @ApiModelProperty("用户编号") + private String custNum; + @ApiModelProperty("用户姓名") + private String custName; + @ApiModelProperty("用户手机号") + private String mobile; + @ApiModelProperty("所属组织") + private String orgFullName; + @ApiModelProperty("用户类别") + private String psnTypeName; + @ApiModelProperty("操作金额") + private BigDecimal amount; + @ApiModelProperty("失败原因") + private String errMsg; + + public static AccBatchCommonCheckErrVO builderAccBatchRechargeCheckErrVO(Long custId, AccInfoVO accInfoVO, BigDecimal amount, String errMsg) { + AccBatchCommonCheckErrVO errVO = new AccBatchCommonCheckErrVO(); + errVO.setAmount(amount); + errVO.setErrMsg(errMsg); + if (ObjectUtil.isNotNull(accInfoVO)) { + errVO.setCustNum(accInfoVO.getCustNum()); + errVO.setCustName(accInfoVO.getCustName()); + errVO.setMobile(accInfoVO.getMobile()); +// errVO.setOrgFullName(accInfoVO.getOrgFullName()); + errVO.setPsnTypeName(accInfoVO.getPsnTypeName()); + } else { + errVO.setCustNum("用户id:" + custId); + } + + return errVO; + } + + public String getCustNum() { + return this.custNum; + } + + public String getCustName() { + return this.custName; + } + + public String getMobile() { + return this.mobile; + } + + public String getOrgFullName() { + return this.orgFullName; + } + + public String getPsnTypeName() { + return this.psnTypeName; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public String getErrMsg() { + return this.errMsg; + } + + public void setCustNum(final String custNum) { + this.custNum = custNum; + } + + public void setCustName(final String custName) { + this.custName = custName; + } + + public void setMobile(final String mobile) { + this.mobile = mobile; + } + + public void setOrgFullName(final String orgFullName) { + this.orgFullName = orgFullName; + } + + public void setPsnTypeName(final String psnTypeName) { + this.psnTypeName = psnTypeName; + } + + public void setAmount(final BigDecimal amount) { + this.amount = amount; + } + + public void setErrMsg(final String errMsg) { + this.errMsg = errMsg; + } + + public String toString() { + String var10000 = this.getCustNum(); + return "AccBatchCommonCheckErrVO(custNum=" + var10000 + ", custName=" + this.getCustName() + ", mobile=" + this.getMobile() + ", orgFullName=" + this.getOrgFullName() + ", psnTypeName=" + this.getPsnTypeName() + ", amount=" + String.valueOf(this.getAmount()) + ", errMsg=" + this.getErrMsg() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchCommonCheckVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchCommonCheckVO.java new file mode 100644 index 00000000..3d9ac2b6 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchCommonCheckVO.java @@ -0,0 +1,113 @@ +package com.bonus.canteen.core.account.v3.web.vo; + +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; +import java.util.List; + +public class AccBatchCommonCheckVO { + @ApiModelProperty("总人数") + private Integer totalCount; + @ApiModelProperty("成功人数") + private Integer sucCount; + @ApiModelProperty("成功总额") + private BigDecimal sucTotalAmount; + @ApiModelProperty("校验成功用户id集合") + private List sucVOList; + @ApiModelProperty("无效人数") + private Integer errCount; + @ApiModelProperty("校验失败用户信息集合") + private List errVOList; + @ApiModelProperty("批量操作金额(用于继续操作传参使用)") + private BigDecimal operateAmount; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("清空类型 1-清空 2-清空至,默认清空") + private Integer clearType; + + public Integer getTotalCount() { + return this.totalCount; + } + + public Integer getSucCount() { + return this.sucCount; + } + + public BigDecimal getSucTotalAmount() { + return this.sucTotalAmount; + } + + public List getSucVOList() { + return this.sucVOList; + } + + public Integer getErrCount() { + return this.errCount; + } + + public List getErrVOList() { + return this.errVOList; + } + + public BigDecimal getOperateAmount() { + return this.operateAmount; + } + + public String getRemark() { + return this.remark; + } + + public Integer getClearType() { + return this.clearType; + } + + public AccBatchCommonCheckVO setTotalCount(final Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + public AccBatchCommonCheckVO setSucCount(final Integer sucCount) { + this.sucCount = sucCount; + return this; + } + + public AccBatchCommonCheckVO setSucTotalAmount(final BigDecimal sucTotalAmount) { + this.sucTotalAmount = sucTotalAmount; + return this; + } + + public AccBatchCommonCheckVO setSucVOList(final List sucVOList) { + this.sucVOList = sucVOList; + return this; + } + + public AccBatchCommonCheckVO setErrCount(final Integer errCount) { + this.errCount = errCount; + return this; + } + + public AccBatchCommonCheckVO setErrVOList(final List errVOList) { + this.errVOList = errVOList; + return this; + } + + public AccBatchCommonCheckVO setOperateAmount(final BigDecimal operateAmount) { + this.operateAmount = operateAmount; + return this; + } + + public AccBatchCommonCheckVO setRemark(final String remark) { + this.remark = remark; + return this; + } + + public AccBatchCommonCheckVO setClearType(final Integer clearType) { + this.clearType = clearType; + return this; + } + + public String toString() { + Integer var10000 = this.getTotalCount(); + return "AccBatchCommonCheckVO(totalCount=" + var10000 + ", sucCount=" + this.getSucCount() + ", sucTotalAmount=" + String.valueOf(this.getSucTotalAmount()) + ", sucVOList=" + String.valueOf(this.getSucVOList()) + ", errCount=" + this.getErrCount() + ", errVOList=" + String.valueOf(this.getErrVOList()) + ", operateAmount=" + String.valueOf(this.getOperateAmount()) + ", remark=" + this.getRemark() + ", clearType=" + this.getClearType() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRechargeCheckVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRechargeCheckVO.java new file mode 100644 index 00000000..b65fa4af --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRechargeCheckVO.java @@ -0,0 +1,114 @@ +package com.bonus.canteen.core.account.v3.web.vo; + +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; +import java.util.List; + +public class AccBatchRechargeCheckVO { + @ApiModelProperty("总人数") + private Integer totalCount; + @ApiModelProperty("充值人数") + private Integer sucCount; + @ApiModelProperty("充值总额") + private BigDecimal sucTotalAmount; + @ApiModelProperty("校验成功用户id集合") + private List sucVOList; + @ApiModelProperty("无效人数") + private Integer errCount; + @ApiModelProperty("校验失败用户信息集合") + private List errVOList; + @ApiModelProperty("批量操作金额(用于继续充值传参使用)") + private BigDecimal operateAmount; + @ApiModelProperty("个人钱包充值使用,充值类型 1微信线下扫码 2支付宝线下扫码 3现金充值") + private Integer rechargeType; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("补贴到账后有效期(天)") + private Integer validateDay; + + public Integer getTotalCount() { + return this.totalCount; + } + + public Integer getSucCount() { + return this.sucCount; + } + + public BigDecimal getSucTotalAmount() { + return this.sucTotalAmount; + } + + public List getSucVOList() { + return this.sucVOList; + } + + public Integer getErrCount() { + return this.errCount; + } + + public List getErrVOList() { + return this.errVOList; + } + + public BigDecimal getOperateAmount() { + return this.operateAmount; + } + + public Integer getRechargeType() { + return this.rechargeType; + } + + public String getRemark() { + return this.remark; + } + + public Integer getValidateDay() { + return this.validateDay; + } + + public void setTotalCount(final Integer totalCount) { + this.totalCount = totalCount; + } + + public void setSucCount(final Integer sucCount) { + this.sucCount = sucCount; + } + + public void setSucTotalAmount(final BigDecimal sucTotalAmount) { + this.sucTotalAmount = sucTotalAmount; + } + + public void setSucVOList(final List sucVOList) { + this.sucVOList = sucVOList; + } + + public void setErrCount(final Integer errCount) { + this.errCount = errCount; + } + + public void setErrVOList(final List errVOList) { + this.errVOList = errVOList; + } + + public void setOperateAmount(final BigDecimal operateAmount) { + this.operateAmount = operateAmount; + } + + public void setRechargeType(final Integer rechargeType) { + this.rechargeType = rechargeType; + } + + public void setRemark(final String remark) { + this.remark = remark; + } + + public void setValidateDay(final Integer validateDay) { + this.validateDay = validateDay; + } + + public String toString() { + Integer var10000 = this.getTotalCount(); + return "AccBatchRechargeCheckVO(totalCount=" + var10000 + ", sucCount=" + this.getSucCount() + ", sucTotalAmount=" + String.valueOf(this.getSucTotalAmount()) + ", sucVOList=" + String.valueOf(this.getSucVOList()) + ", errCount=" + this.getErrCount() + ", errVOList=" + String.valueOf(this.getErrVOList()) + ", operateAmount=" + String.valueOf(this.getOperateAmount()) + ", rechargeType=" + this.getRechargeType() + ", remark=" + this.getRemark() + ", validateDay=" + this.getValidateDay() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRepairCheckErrVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRepairCheckErrVO.java new file mode 100644 index 00000000..89e87a47 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRepairCheckErrVO.java @@ -0,0 +1,112 @@ +package com.bonus.canteen.core.account.v3.web.vo; + +import cn.hutool.core.util.ObjectUtil; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; + +public class AccBatchRepairCheckErrVO { + @ApiModelProperty("用户id") + private Long custId; + @ApiModelProperty("用户编号") + private String custNum; + @ApiModelProperty("用户姓名") + private String custName; + @ApiModelProperty("用户手机号") + private String mobile; + @ApiModelProperty("所属组织") + private String orgFullName; + @ApiModelProperty("用户类别") + private String psnTypeName; + @ApiModelProperty("操作金额") + private BigDecimal amount; + @ApiModelProperty("失败原因") + private String errMsg; + + public static AccBatchRepairCheckErrVO builderAccBatchRepairCheckErrVO(Long custId, AccInfoVO accInfoVO, BigDecimal amount, String errMsg) { + AccBatchRepairCheckErrVO errVO = new AccBatchRepairCheckErrVO(); + errVO.setCustId(custId); + errVO.setAmount(amount); + errVO.setErrMsg(errMsg); + if (ObjectUtil.isNotNull(accInfoVO)) { + errVO.setCustNum(accInfoVO.getCustNum()); + errVO.setCustName(accInfoVO.getCustName()); + errVO.setMobile(accInfoVO.getMobile()); +// errVO.setOrgFullName(accInfoVO.getOrgFullName()); + errVO.setPsnTypeName(accInfoVO.getPsnTypeName()); + } else { + errVO.setCustNum("用户id:" + custId); + } + + return errVO; + } + + public Long getCustId() { + return this.custId; + } + + public String getCustNum() { + return this.custNum; + } + + public String getCustName() { + return this.custName; + } + + public String getMobile() { + return this.mobile; + } + + public String getOrgFullName() { + return this.orgFullName; + } + + public String getPsnTypeName() { + return this.psnTypeName; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public String getErrMsg() { + return this.errMsg; + } + + public void setCustId(final Long custId) { + this.custId = custId; + } + + public void setCustNum(final String custNum) { + this.custNum = custNum; + } + + public void setCustName(final String custName) { + this.custName = custName; + } + + public void setMobile(final String mobile) { + this.mobile = mobile; + } + + public void setOrgFullName(final String orgFullName) { + this.orgFullName = orgFullName; + } + + public void setPsnTypeName(final String psnTypeName) { + this.psnTypeName = psnTypeName; + } + + public void setAmount(final BigDecimal amount) { + this.amount = amount; + } + + public void setErrMsg(final String errMsg) { + this.errMsg = errMsg; + } + + public String toString() { + Long var10000 = this.getCustId(); + return "AccBatchRepairCheckErrVO(custId=" + var10000 + ", custNum=" + this.getCustNum() + ", custName=" + this.getCustName() + ", mobile=" + this.getMobile() + ", orgFullName=" + this.getOrgFullName() + ", psnTypeName=" + this.getPsnTypeName() + ", amount=" + String.valueOf(this.getAmount()) + ", errMsg=" + this.getErrMsg() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRepairCheckVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRepairCheckVO.java new file mode 100644 index 00000000..cfb0cebb --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/v3/web/vo/AccBatchRepairCheckVO.java @@ -0,0 +1,75 @@ +package com.bonus.canteen.core.account.v3.web.vo; + +import com.bonus.canteen.core.account.v3.web.dto.AccRepairDeductBaseDTO; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; +import java.util.List; + +public class AccBatchRepairCheckVO extends AccRepairDeductBaseDTO { + @ApiModelProperty("总人数") + private Integer totalCount; + @ApiModelProperty("补扣人数") + private Integer sucCount; + @ApiModelProperty("补扣总额") + private BigDecimal sucTotalAmount; + @ApiModelProperty("校验成功用户id集合") + private List sucVOList; + @ApiModelProperty("无效人数") + private Integer errCount; + @ApiModelProperty("校验失败用户信息集合") + private List errVOList; + + public Integer getTotalCount() { + return this.totalCount; + } + + public Integer getSucCount() { + return this.sucCount; + } + + public BigDecimal getSucTotalAmount() { + return this.sucTotalAmount; + } + + public List getSucVOList() { + return this.sucVOList; + } + + public Integer getErrCount() { + return this.errCount; + } + + public List getErrVOList() { + return this.errVOList; + } + + public void setTotalCount(final Integer totalCount) { + this.totalCount = totalCount; + } + + public void setSucCount(final Integer sucCount) { + this.sucCount = sucCount; + } + + public void setSucTotalAmount(final BigDecimal sucTotalAmount) { + this.sucTotalAmount = sucTotalAmount; + } + + public void setSucVOList(final List sucVOList) { + this.sucVOList = sucVOList; + } + + public void setErrCount(final Integer errCount) { + this.errCount = errCount; + } + + public void setErrVOList(final List errVOList) { + this.errVOList = errVOList; + } + + public String toString() { + Integer var10000 = this.getTotalCount(); + return "AccBatchRepairCheckVO(totalCount=" + var10000 + ", sucCount=" + this.getSucCount() + ", sucTotalAmount=" + String.valueOf(this.getSucTotalAmount()) + ", sucVOList=" + String.valueOf(this.getSucVOList()) + ", errCount=" + this.getErrCount() + ", errVOList=" + String.valueOf(this.getErrVOList()) + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/v3/AccInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/v3/AccInfoMapper.xml index 94853eed..8375344a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/v3/AccInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/v3/AccInfoMapper.xml @@ -787,4 +787,25 @@ + + +