diff --git a/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/mps/service/impl/MpsMarketServiceImpl.java b/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/mps/service/impl/MpsMarketServiceImpl.java index 9673750..fae08d4 100644 --- a/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/mps/service/impl/MpsMarketServiceImpl.java +++ b/cds-platform-2025.V1/cds-modules/cds-system/src/main/java/org/dromara/mps/service/impl/MpsMarketServiceImpl.java @@ -208,89 +208,7 @@ public class MpsMarketServiceImpl implements IMpsMarketService { * 数据校验 */ private void validEntityBefore(MpsMarket entity){ - /** - * 判重 - * 客户类型(1-个人,2-对公) - * (个人判断身份证号,对公判断账户号)+录入月份取entry_date前7位 - * 取暖费身份证可以重复,户号+年份不能重,年份取entry_date前四位 - * - * 公积金缴纳账户,代收交警罚没款,磁条卡更换登记,代收水费,代收电费,允许多次录入,不验重 - * - * 以下业务类型只能有一个: - * BIZ010 新开有效银行卡 - * BIZ011 新开有效社保卡 - * BIZ012 营销贷款客户社保卡 - * BIZ013 营销职工社保卡 - */ - Set set = new HashSet<>(); - set.add("BIZ032");//公积金缴纳账户 - set.add("BIZ020");//代收交警罚没款 -// set.add("BIZ022");//代收水费 - set.add("BIZ021");//代收电费 - set.add("BIZ009");//磁条卡更换登记 - Set set1 = new HashSet<>(); - set1.add("BIZ010");//新开有效银行卡 - set1.add("BIZ011");//新开有效社保卡 - set1.add("BIZ012");//营销贷款客户社保卡 - set1.add("BIZ013");//营销职工社保卡 - if (set.contains(entity.getSubcategoryId())) { - //不处理 - } else if ("BIZ034".equals(entity.getSubcategoryId())) { - //取暖费身份证可以重复,户号+年份不能重,年份取entry_date前四位 - MpsMarket mpsMarket = new MpsMarket(); - mpsMarket.setHeatingNo(entity.getHeatingNo()); - LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); - lqw.like(StringUtils.isNotEmpty(entity.getEntryDate()), MpsMarket::getEntryDate, entity.getEntryDate().substring(0,4)); - List result = baseMapper.selectVoList(lqw); - if (!result.isEmpty()) { - throw new ServiceException("当前年度该取暖费户号已存在!"); - } - } else if ("BIZ022".equals(entity.getSubcategoryId())) { - //水费 不校验身份证,户号+月份不能重 月份取entry_date前7位 - MpsMarket mpsMarket = new MpsMarket(); - mpsMarket.setHeatingNo(entity.getHeatingNo()); - LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); - lqw.like(StringUtils.isNotEmpty(entity.getEntryDate()), MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); - List result = baseMapper.selectVoList(lqw); - if (!result.isEmpty()) { - throw new ServiceException("当月水费户号已存在!"); - } - }else if (set1.contains(entity.getSubcategoryId())) { - //在set1中的业务类型身份证号+月份不能重复 - //没有对公业务,不判断custtype - MpsMarket bo = new MpsMarket(); - bo.setCustId(entity.getCustId()); - LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(bo); - lqw.like(MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); - lqw.in(MpsMarket::getSubcategoryId, set1); - List result = baseMapper.selectVoList(lqw); - if (!result.isEmpty()) { - throw new ServiceException("该营销记录已存在!"); - } - }else { - if ("1".equals(entity.getCustType())) { - MpsMarket bo = new MpsMarket(); - bo.setSubcategoryId(entity.getSubcategoryId()); - bo.setCustId(entity.getCustId()); - LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(bo); - lqw.like(MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); - List result = baseMapper.selectVoList(lqw); - if (!result.isEmpty()) { - throw new ServiceException("该营销记录已存在!"); - } - } - if ("2".equals(entity.getCustType())) { - MpsMarket bo = new MpsMarket(); - bo.setSubcategoryId(entity.getSubcategoryId()); - bo.setCustAcctNo(entity.getCustAcctNo()); - LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(bo); - lqw.like(MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); - List result = baseMapper.selectVoList(lqw); - if (!result.isEmpty()) { - throw new ServiceException("该营销记录已存在!"); - } - } - } + /** * 根据业务类型判断非空 * 处理磁条卡更换金融IC卡和代收交警罚没款表的插入 @@ -331,7 +249,7 @@ public class MpsMarketServiceImpl implements IMpsMarketService { if (CollectionUtil.isEmpty(entity.getTrafficList())) { throw new ServiceException("请填写交警处罚决定书记录"); } - //判断list中是否有重复,比较三个字段 + //判断list中是否有重复,比较编号 if (entity.getTrafficList().size() > 1) { for (int i = 0; i < entity.getTrafficList().size() - 1; i++) { for (int j = i + 1; j < entity.getTrafficList().size(); j++) { @@ -406,6 +324,148 @@ public class MpsMarketServiceImpl implements IMpsMarketService { default: break; } + /** + * 判重 + * 客户类型(1-个人,2-对公) + * (个人判断身份证号,对公判断账户号)+录入月份取entry_date前7位 + * 取暖费身份证可以重复,户号+年份不能重,年份取entry_date前四位 + * + * 公积金缴纳账户,代收交警罚没款,磁条卡更换登记,代收水费,代收电费,允许多次录入,不验重 + * + * 以下业务类型只能有一个:身份证号+月份不能重复 + * BIZ010 新开有效银行卡 + * BIZ011 新开有效社保卡 + * BIZ012 营销贷款客户社保卡 + * BIZ013 营销职工社保卡 + * + * 20251016修改: + * 新开有效银行卡:卡号不可重复,身份证可重复,一个人可能办多张卡 + * 新增综合收单:商户号不可重复 + * 磁条卡:卡号不可重复 + * 新开社保卡、贷款客户社保卡、社保卡激活并使用、 身份证当年不可重复并且银行卡不可重 + * BIZ011 新开有效社保卡 + * BIZ012 营销贷款客户社保卡 + * BIZ014 社保卡激活并使用 + * 罚没款:处罚决定书编号不可重复 + * 水费:户号当月不可重复 + * 取暖费: 户号当年不可重复 + *BIZ005 新增综合收单商户(首月) + */ + Set set0 = new HashSet<>(); + set0.add("BIZ011"); + set0.add("BIZ012"); + set0.add("BIZ014"); + if (set0.contains(entity.getSubcategoryId())) { + //新开社保卡、贷款客户社保卡、社保卡激活并使用、 身份证当年不可重复并且银行卡不可重 + MpsMarket mpsMarket = new MpsMarket(); + mpsMarket.setCustId(entity.getCustId()); + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.like(StringUtils.isNotEmpty(entity.getEntryDate()), MpsMarket::getEntryDate, entity.getEntryDate().substring(0, 4)); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("当前年度身份证号已存在!"); + } + mpsMarket=new MpsMarket(); + mpsMarket.setCustAcctNo(entity.getCustAcctNo()); + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.ne(StringUtils.isNotEmpty(entity.getCustId()), MpsMarket::getCustId, entity.getCustId()); + result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("银行卡已存在!"); + } + + } + if ("BIZ010".equals(entity.getSubcategoryId())) {//BIZ010 新开有效银行卡 + //新开有效银行卡:卡号不可重复,身份证可重复,一个人可能办多张卡 + MpsMarket mpsMarket = new MpsMarket(); + mpsMarket.setCustAcctNo(entity.getCustAcctNo()); + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("银行卡号已存在!"); + } + } + Set set = new HashSet<>(); + set.add("BIZ032");//公积金缴纳账户 + set.add("BIZ020");//代收交警罚没款 + set.add("BIZ021");//代收电费 + set.add("BIZ009");//磁条卡更换登记 + Set set1 = new HashSet<>(); + set1.add("BIZ010");//新开有效银行卡 + set1.add("BIZ011");//新开有效社保卡 + set1.add("BIZ012");//营销贷款客户社保卡 + set1.add("BIZ013");//营销职工社保卡 + MpsMarket mpsMarket = new MpsMarket(); + if (set.contains(entity.getSubcategoryId())) { + //不处理 + } else if ("BIZ005".equals(entity.getSubcategoryId())) { + //新增综合收单:商户号不可重复 + mpsMarket.setAcquiringId(entity.getAcquiringId()); + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("商户号不可重复!"); + } + }else if ("BIZ034".equals(entity.getSubcategoryId())) { + //取暖费身份证可以重复,户号+年份不能重,年份取entry_date前四位 + mpsMarket.setHeatingNo(entity.getHeatingNo()); + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.like(StringUtils.isNotEmpty(entity.getEntryDate()), MpsMarket::getEntryDate, entity.getEntryDate().substring(0,4)); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("当前年度该取暖费户号已存在!"); + } + } + else if ("BIZ022".equals(entity.getSubcategoryId())) { + //水费 不校验身份证,户号+月份不能重 月份取entry_date前7位 + mpsMarket.setHeatingNo(entity.getHeatingNo()); + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.like(StringUtils.isNotEmpty(entity.getEntryDate()), MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("当月水费户号已存在!"); + } + }else if (set1.contains(entity.getSubcategoryId())) { + //在set1中的业务类型身份证号+月份不能重复 + //没有对公业务,不判断custtype + // 排除新开有效银行卡可重复的影响 + mpsMarket.setCustId(entity.getCustId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.like(MpsMarket::getEntryDate, entity.getEntryDate().substring(0,4)); + lqw.in(MpsMarket::getSubcategoryId, set1); + lqw.ne("BIZ010".equals(entity.getSubcategoryId()),MpsMarket::getSubcategoryId, "BIZ010"); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("该营销记录(四选一)已存在!"); + } + }else { + if ("1".equals(entity.getCustType())) { + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + mpsMarket.setCustId(entity.getCustId()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.like(MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("该营销记录已存在!"); + } + } + if ("2".equals(entity.getCustType())) { + mpsMarket.setSubcategoryId(entity.getSubcategoryId()); + mpsMarket.setCustAcctNo(entity.getCustAcctNo()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(mpsMarket); + lqw.like(MpsMarket::getEntryDate, entity.getEntryDate().substring(0,7)); + List result = baseMapper.selectVoList(lqw); + if (!result.isEmpty()) { + throw new ServiceException("该营销记录已存在!"); + } + } + } } @@ -512,85 +572,76 @@ public class MpsMarketServiceImpl implements IMpsMarketService { // } private void checkMagneticCardList(List mpsMagneticCardList) { - //判断list中是否有重复,比较三个字段 - if (mpsMagneticCardList.size() > 1) { - for (int i = 0; i < mpsMagneticCardList.size() - 1; i++) { - for (int j = i + 1; j < mpsMagneticCardList.size(); j++) { - MpsMagneticcard mpsMagneticCard1 = mpsMagneticCardList.get(i); - MpsMagneticcard mpsMagneticCard2 = mpsMagneticCardList.get(j); - if (mpsMagneticCard1.getOldCardNo().equals(mpsMagneticCard2.getOldCardNo()) - && mpsMagneticCard1.getNewCardNo().equals(mpsMagneticCard2.getNewCardNo()) - && mpsMagneticCard1.getReplaceMethod().equals(mpsMagneticCard2.getReplaceMethod())) { - throw new ServiceException("请勿重复添加磁条卡更换金融IC卡记录"); - } - } - } - } - for (MpsMagneticcard mpsMagneticCard : mpsMagneticCardList) { + + for (int n = 0; n < mpsMagneticCardList.size(); n++) { + MpsMagneticcard mpsMagneticCard = mpsMagneticCardList.get(n); + String msg = "第" + (n + 1) + "行:"; //判重和校验 if(StringUtils.isEmpty(mpsMagneticCard.getReplaceMethod())){ - throw new ServiceException("请填写换卡方式"); + throw new ServiceException(msg+"请填写换卡方式"); + } + if (StringUtils.isEmpty(mpsMagneticCard.getOldCardNo()) ) { + throw new ServiceException(msg+"请填写旧磁条卡号"); } switch (mpsMagneticCard.getReplaceMethod()){ case "1":{ - if (StringUtils.isEmpty(mpsMagneticCard.getOldCardNo()) ) { - throw new ServiceException("请填写旧磁条卡号"); - } if ( StringUtils.isEmpty(mpsMagneticCard.getNewCardNo())) { - throw new ServiceException("请填写新磁条卡号"); + throw new ServiceException(msg+"请填写新磁条卡号"); } if (mpsMagneticCard.getNewCardNo().equals(mpsMagneticCard.getOldCardNo())) { - throw new ServiceException("新磁条卡号不能与旧磁条卡号相同"); - } - MpsMagneticcard bo = new MpsMagneticcard(); - bo.setNewCardNo(mpsMagneticCard.getNewCardNo()); - bo.setReplaceMethod(mpsMagneticCard.getReplaceMethod()); - LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(bo); - lqw1.ne( ObjectUtil.isNotNull(mpsMagneticCard.getMagneticCardId()), MpsMagneticcard::getMagneticCardId, mpsMagneticCard.getMagneticCardId()); - List result1 = magneticcardMapper.selectVoList(lqw1); - if (!result1.isEmpty()) { - throw new ServiceException("换卡记录已存在,新卡号:"+mpsMagneticCard.getNewCardNo()); + throw new ServiceException(msg+"新磁条卡号不能与旧磁条卡号相同"); } break; } - case "2":{ - if (StringUtils.isEmpty(mpsMagneticCard.getOldCardNo()) ) { - throw new ServiceException("请填写旧磁条卡号"); - } - MpsMagneticcard bo = new MpsMagneticcard(); - bo.setOldCardNo(mpsMagneticCard.getOldCardNo()); - bo.setReplaceMethod(mpsMagneticCard.getReplaceMethod()); - LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(bo); - lqw1.ne( ObjectUtil.isNotNull(mpsMagneticCard.getMagneticCardId()), MpsMagneticcard::getMagneticCardId, mpsMagneticCard.getMagneticCardId()); - List result1 = magneticcardMapper.selectVoList(lqw1); - if (!result1.isEmpty()) { - throw new ServiceException("销户记录已存在,卡号:"+mpsMagneticCard.getOldCardNo()); - } + case "2":{//销户 break; } case "3":{//同号换卡 - if (StringUtils.isEmpty(mpsMagneticCard.getOldCardNo()) ) { - throw new ServiceException("请填写旧磁条卡号"); - } if ( StringUtils.isEmpty(mpsMagneticCard.getNewCardNo())) { - throw new ServiceException("请填写新磁条卡号"); + throw new ServiceException(msg+"请填写新磁条卡号"); } if (!mpsMagneticCard.getNewCardNo().equals(mpsMagneticCard.getOldCardNo())) { - throw new ServiceException("新磁条卡号需要与旧磁条卡号相同"); + throw new ServiceException(msg+"新磁条卡号需要与旧磁条卡号相同"); } - MpsMagneticcard bo = new MpsMagneticcard(); - bo.setNewCardNo(mpsMagneticCard.getNewCardNo()); - bo.setReplaceMethod(mpsMagneticCard.getReplaceMethod()); - LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(bo); - lqw1.ne( ObjectUtil.isNotNull(mpsMagneticCard.getMagneticCardId()), MpsMagneticcard::getMagneticCardId, mpsMagneticCard.getMagneticCardId()); - List result1 = magneticcardMapper.selectVoList(lqw1); - if (!result1.isEmpty()) { - throw new ServiceException("同号换卡记录已存在,新卡号:"+mpsMagneticCard.getNewCardNo()); + break; + } + default: + throw new ServiceException(msg+"请选择磁条卡更换金融IC卡方式"); + } + //判断list中是否有重复,比较旧卡号和新卡号 + if (mpsMagneticCardList.size() > 1) { + for (int i = 0; i < mpsMagneticCardList.size() - 1; i++) { + for (int j = i + 1; j < mpsMagneticCardList.size(); j++) { + MpsMagneticcard mpsMagneticCard1 = mpsMagneticCardList.get(i); + MpsMagneticcard mpsMagneticCard2 = mpsMagneticCardList.get(j); + if (mpsMagneticCard1.getOldCardNo().equals(mpsMagneticCard2.getOldCardNo())) { + throw new ServiceException("旧卡号重复!"); + } + if (StringUtils.isNotEmpty(mpsMagneticCard1.getNewCardNo()) &&mpsMagneticCard1.getNewCardNo().equals(mpsMagneticCard2.getNewCardNo())) { + throw new ServiceException("新卡号重复!"); + } } } - break; - default: - throw new ServiceException("请选择磁条卡更换金融IC卡方式"); + } + if (StringUtils.isNotEmpty(mpsMagneticCard.getOldCardNo())) { + MpsMagneticcard bo = new MpsMagneticcard(); + bo.setOldCardNo(mpsMagneticCard.getOldCardNo()); + LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(bo); + lqw1.ne( ObjectUtil.isNotNull(mpsMagneticCard.getMagneticCardId()), MpsMagneticcard::getMagneticCardId, mpsMagneticCard.getMagneticCardId()); + List result1 = magneticcardMapper.selectVoList(lqw1); + if (!result1.isEmpty()) { + throw new ServiceException("旧卡号已存在:"+mpsMagneticCard.getOldCardNo()); + } + } + if (StringUtils.isNotEmpty(mpsMagneticCard.getNewCardNo())) { + MpsMagneticcard bo = new MpsMagneticcard(); + bo.setNewCardNo(mpsMagneticCard.getNewCardNo()); + LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(bo); + lqw1.ne( ObjectUtil.isNotNull(mpsMagneticCard.getMagneticCardId()), MpsMagneticcard::getMagneticCardId, mpsMagneticCard.getMagneticCardId()); + List result1 = magneticcardMapper.selectVoList(lqw1); + if (!result1.isEmpty()) { + throw new ServiceException("新卡号已存在:"+mpsMagneticCard.getNewCardNo()); + } } }