Showing
17 changed files
with
432 additions
and
5 deletions
| ... | ... | @@ -9,6 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 9 | 9 | import org.springframework.boot.web.servlet.ServletComponentScan; |
| 10 | 10 | import org.springframework.context.annotation.Bean; |
| 11 | 11 | import org.springframework.context.annotation.Configuration; |
| 12 | +import org.springframework.scheduling.annotation.EnableScheduling; | |
| 12 | 13 | import springfox.documentation.builders.ApiInfoBuilder; |
| 13 | 14 | import springfox.documentation.builders.PathSelectors; |
| 14 | 15 | import springfox.documentation.builders.RequestHandlerSelectors; |
| ... | ... | @@ -19,6 +20,7 @@ import springfox.documentation.spring.web.plugins.Docket; |
| 19 | 20 | @EnableLock(type = LockType.REDIS) |
| 20 | 21 | @ServletComponentScan(basePackages = {"com.lframework.xingyun"}) |
| 21 | 22 | @SpringBootApplication(scanBasePackages = {"com.lframework.xingyun"}) |
| 23 | +@EnableScheduling | |
| 22 | 24 | @MapperScan({"com.lframework.xingyun.**.mappers"}) |
| 23 | 25 | public class XingYunApiApplication { |
| 24 | 26 | ... | ... |
| ... | ... | @@ -444,6 +444,19 @@ public class GetCustomerCreditBo extends BaseBo<CustomerCredit> implements BaseD |
| 444 | 444 | @ApiModelProperty(value = "是否展示审核按钮") |
| 445 | 445 | private Boolean showExamine; |
| 446 | 446 | |
| 447 | + | |
| 448 | + /** | |
| 449 | + * 企业操作类型 | |
| 450 | + */ | |
| 451 | + @ApiModelProperty("企业操作类型") | |
| 452 | + private String enterpriseOperationType; | |
| 453 | + | |
| 454 | + /** | |
| 455 | + * 冻结状态(正常:NORMAL,冻结:FROZEN) | |
| 456 | + */ | |
| 457 | + @ApiModelProperty(value = "冻结状态") | |
| 458 | + private String frozenStatus; | |
| 459 | + | |
| 447 | 460 | /** |
| 448 | 461 | * 核心人员 |
| 449 | 462 | */ | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/customer/CustomerCreditController.java
| ... | ... | @@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletResponse; |
| 21 | 21 | import javax.validation.constraints.NotBlank; |
| 22 | 22 | import com.lframework.xingyun.sc.excel.customerCredit.CustomerCreditImportListener; |
| 23 | 23 | import com.lframework.xingyun.sc.excel.customerCredit.CustomerCreditImportModel; |
| 24 | +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; | |
| 24 | 25 | import com.lframework.xingyun.sc.service.customer.CorePersonnelService; |
| 25 | 26 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| 26 | 27 | import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditVo; |
| ... | ... | @@ -35,6 +36,7 @@ import com.lframework.starter.common.utils.CollectionUtil; |
| 35 | 36 | import io.swagger.annotations.Api; |
| 36 | 37 | import org.springframework.beans.factory.annotation.Autowired; |
| 37 | 38 | import org.springframework.beans.factory.annotation.Value; |
| 39 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 38 | 40 | import org.springframework.validation.annotation.Validated; |
| 39 | 41 | import org.springframework.web.bind.annotation.*; |
| 40 | 42 | import org.springframework.web.multipart.MultipartFile; |
| ... | ... | @@ -43,7 +45,10 @@ import javax.validation.Valid; |
| 43 | 45 | import javax.validation.constraints.NotNull; |
| 44 | 46 | import java.io.*; |
| 45 | 47 | import java.net.URLEncoder; |
| 46 | -import java.util.List; | |
| 48 | +import java.time.LocalDate; | |
| 49 | +import java.time.LocalDateTime; | |
| 50 | +import java.time.format.DateTimeFormatter; | |
| 51 | +import java.util.*; | |
| 47 | 52 | import java.util.stream.Collectors; |
| 48 | 53 | |
| 49 | 54 | /** |
| ... | ... | @@ -68,6 +73,8 @@ public class CustomerCreditController extends DefaultBaseController { |
| 68 | 73 | private RedisHandler redisHandler; |
| 69 | 74 | @Value("${customer.credit.export:/web/service/erp/xingyun/export/templates/}") |
| 70 | 75 | private String exportTemplate; |
| 76 | + @Resource | |
| 77 | + private ContractDistributorStandardService contractDistributorStandardService; | |
| 71 | 78 | |
| 72 | 79 | /** |
| 73 | 80 | * 查询列表 |
| ... | ... | @@ -83,7 +90,32 @@ public class CustomerCreditController extends DefaultBaseController { |
| 83 | 90 | List<GetCustomerCreditBo> results = null; |
| 84 | 91 | |
| 85 | 92 | if (!CollectionUtil.isEmpty(datas)) { |
| 86 | - results = datas.stream().map(GetCustomerCreditBo::new).collect(Collectors.toList()); | |
| 93 | + results = datas.stream().map(data -> { | |
| 94 | + GetCustomerCreditBo bo = new GetCustomerCreditBo(data); | |
| 95 | + // frozenStatus 转中文 | |
| 96 | + String frozenStatus = data.getFrozenStatus(); | |
| 97 | + if ("NORMAL".equals(frozenStatus)) { | |
| 98 | + bo.setFrozenStatus("正常"); | |
| 99 | + } else if ("FROZEN".equals(frozenStatus)) { | |
| 100 | + bo.setFrozenStatus("冻结"); | |
| 101 | + } else { | |
| 102 | + bo.setFrozenStatus(""); | |
| 103 | + } | |
| 104 | + | |
| 105 | + // enterpriseOperationType 转中文 | |
| 106 | + String opType = data.getEnterpriseOperationType(); | |
| 107 | + if ("NEW_CUSTOMER".equals(opType)) { | |
| 108 | + bo.setEnterpriseOperationType("新开发客户"); | |
| 109 | + } else if ("RECONNECT_CUSTOMER".equals(opType)) { | |
| 110 | + bo.setEnterpriseOperationType("再接轨客户"); | |
| 111 | + } else if ("OLD_CUSTOMER".equals(opType)) { | |
| 112 | + bo.setEnterpriseOperationType("老客户"); | |
| 113 | + } else { | |
| 114 | + bo.setEnterpriseOperationType(""); | |
| 115 | + } | |
| 116 | + | |
| 117 | + return bo; | |
| 118 | + }).collect(Collectors.toList()); | |
| 87 | 119 | } |
| 88 | 120 | |
| 89 | 121 | return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); |
| ... | ... | @@ -308,6 +340,86 @@ public class CustomerCreditController extends DefaultBaseController { |
| 308 | 340 | } |
| 309 | 341 | } |
| 310 | 342 | |
| 343 | + /** | |
| 344 | + * 定时任务:冻结 | |
| 345 | + */ | |
| 346 | + @Scheduled(cron = "0 0 0 31 3 ?") | |
| 347 | + @GetMapping("/frozenCustomerCredit") | |
| 348 | + public void frozenCustomerCredit() { | |
| 349 | + System.out.println("===定时任务开始==="); | |
| 350 | + // 每年的3月31号去看今年1月1号之前建的资信,如果没在今年1月1号到3月31号之间申请变更并通过都给冻结 | |
| 351 | + QueryCustomerCreditVo vo = new QueryCustomerCreditVo(); | |
| 352 | + vo.setStatus("PASS"); | |
| 353 | + vo.setFrozenStatus("NORMAL"); | |
| 354 | + // 获取当前年份 | |
| 355 | + int currentYear = LocalDate.now().getYear(); | |
| 356 | + // 创建当年1月1日 00:00:00(本地时间) | |
| 357 | + LocalDateTime startOfYear = LocalDateTime.of(currentYear, 1, 1, 0, 0, 0); | |
| 358 | + // 定义格式 | |
| 359 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | |
| 360 | + // 转为字符串 | |
| 361 | + String formattedDate = startOfYear.format(formatter); | |
| 362 | + vo.setCreateTimeStr(formattedDate); | |
| 363 | + //创建时间 | |
| 364 | + List<CustomerCredit> creditList = customerCreditService.query(vo); | |
| 365 | + if (CollectionUtil.isNotEmpty(creditList)) { | |
| 366 | + List<String> idList = creditList.stream() | |
| 367 | + .map(CustomerCredit::getId) | |
| 368 | + .collect(Collectors.toList()); | |
| 369 | + List<String> needFrozenIds = customerCreditService.getNeedFrozenIds(idList, formattedDate); | |
| 370 | + //冻结客户资信 | |
| 371 | + customerCreditService.updateFrozenStatus(needFrozenIds, "FROZEN"); | |
| 372 | + } | |
| 373 | + System.out.println("===定时任务结束==="); | |
| 374 | + } | |
| 375 | + | |
| 376 | + /** | |
| 377 | + * 定时任务:更新企业操作类型 | |
| 378 | + */ | |
| 379 | + @Scheduled(cron = "0 0 1 * * ?") | |
| 380 | + @GetMapping("/updateEnterpriseOperationType") | |
| 381 | + public void updateEnterpriseOperationType() { | |
| 382 | + System.out.println("===定时任务开始==="); | |
| 383 | + //更新企业操作类型:新开发客户(在系统中未签订过合同的客户)、再接轨客户(在一年之前有签订过合同)、老客户(一年内有签订过合同) | |
| 384 | + List<CustomerCredit> customerCreditList = customerCreditService.query(new QueryCustomerCreditVo()); | |
| 385 | + if (CollectionUtil.isNotEmpty(customerCreditList)) { | |
| 386 | + Map<String, String> map = new HashMap<>(); | |
| 387 | + for (CustomerCredit customerCredit : customerCreditList) { | |
| 388 | + map.put(customerCredit.getCompanyId(), customerCredit.getId()); | |
| 389 | + } | |
| 390 | + //客户合集 | |
| 391 | + Set<String> companyIds = map.keySet(); | |
| 392 | + ArrayList<String> companyIdList = new ArrayList<>(companyIds); | |
| 393 | + //一年之内未签订合同的客户集合 | |
| 394 | + List<String> noContractSignedCompanyIds = contractDistributorStandardService.getNoContractSigned(companyIdList); | |
| 395 | + //一年之内签订过合同的客户集合 | |
| 396 | + List<String> contractSignedCompanyIds = contractDistributorStandardService.getContractSigned(companyIdList); | |
| 397 | + //移除后得到从未签订过合同的客户 | |
| 398 | + companyIdList.removeAll(noContractSignedCompanyIds); | |
| 399 | + companyIdList.removeAll(contractSignedCompanyIds); | |
| 400 | + System.out.println("companyIdList===" + companyIdList); | |
| 401 | + //一年之内未签订合同的客户资信 | |
| 402 | + List<String> noContractSignedCreditIds = noContractSignedCompanyIds.stream() | |
| 403 | + .map(map::get) // 根据 companyId 获取对应的 creditId | |
| 404 | + .filter(Objects::nonNull) // 可选:防止 map 中不存在该 key(逻辑上应该都存在) | |
| 405 | + .collect(Collectors.toList()); | |
| 406 | + customerCreditService.updateEnterpriseOperationType(noContractSignedCreditIds,"RECONNECT_CUSTOMER"); | |
| 407 | + //一年之内签订过合同的客户资信 | |
| 408 | + List<String> contractSignedCreditIds = contractSignedCompanyIds.stream() | |
| 409 | + .map(map::get) // 根据 companyId 获取对应的 creditId | |
| 410 | + .filter(Objects::nonNull) // 可选:防止 map 中不存在该 key(逻辑上应该都存在) | |
| 411 | + .collect(Collectors.toList()); | |
| 412 | + customerCreditService.updateEnterpriseOperationType(contractSignedCreditIds,"OLD_CUSTOMER"); | |
| 413 | + //从未签订过合同的客户资信 | |
| 414 | + List<String> creditIds = companyIdList.stream() | |
| 415 | + .map(map::get) // 根据 companyId 获取对应的 creditId | |
| 416 | + .filter(Objects::nonNull) // 可选:防止 map 中不存在该 key(逻辑上应该都存在) | |
| 417 | + .collect(Collectors.toList()); | |
| 418 | + customerCreditService.updateEnterpriseOperationType(creditIds,"NEW_CUSTOMER"); | |
| 419 | + } | |
| 420 | + System.out.println("===定时任务结束==="); | |
| 421 | + } | |
| 422 | + | |
| 311 | 423 | |
| 312 | 424 | |
| 313 | 425 | /** | ... | ... |
| ... | ... | @@ -9,6 +9,7 @@ import java.time.LocalDateTime; |
| 9 | 9 | import com.baomidou.mybatisplus.annotation.FieldFill; |
| 10 | 10 | import com.lframework.starter.web.core.entity.BaseEntity; |
| 11 | 11 | import com.baomidou.mybatisplus.annotation.TableField; |
| 12 | +import io.swagger.annotations.ApiModelProperty; | |
| 12 | 13 | import lombok.Data; |
| 13 | 14 | |
| 14 | 15 | /** |
| ... | ... | @@ -332,6 +333,16 @@ public class CustomerCredit extends BaseEntity implements BaseDto { |
| 332 | 333 | private String marketingCenterSupervisor; |
| 333 | 334 | |
| 334 | 335 | /** |
| 336 | + * 企业操作类型 | |
| 337 | + */ | |
| 338 | + private String enterpriseOperationType; | |
| 339 | + | |
| 340 | + /** | |
| 341 | + * 冻结状态(正常:NORMAL,冻结:FROZEN) | |
| 342 | + */ | |
| 343 | + private String frozenStatus; | |
| 344 | + | |
| 345 | + /** | |
| 335 | 346 | * 是否展示审核按钮(非持久化字段) |
| 336 | 347 | */ |
| 337 | 348 | @TableField(exist = false) | ... | ... |
| ... | ... | @@ -324,6 +324,10 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 324 | 324 | customerCreditService.updateNoFlowInstance(vo); |
| 325 | 325 | //清除缓存 |
| 326 | 326 | redisHandler.del(businessId); |
| 327 | + //更新冻结状态为正常 | |
| 328 | + List<String> list = new ArrayList<>(); | |
| 329 | + list.add(businessId); | |
| 330 | + customerCreditService.updateFrozenStatus(list, "NORMAL"); | |
| 327 | 331 | } else { |
| 328 | 332 | //非变更审核 |
| 329 | 333 | customerCreditService.updateStatus(businessId, "PASS"); | ... | ... |
| ... | ... | @@ -38,6 +38,7 @@ import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorS |
| 38 | 38 | import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractStdProcessingLineVo; |
| 39 | 39 | import org.apache.commons.collections4.CollectionUtils; |
| 40 | 40 | import org.apache.commons.lang3.StringUtils; |
| 41 | +import org.apache.ibatis.annotations.Param; | |
| 41 | 42 | import org.springframework.beans.factory.annotation.Autowired; |
| 42 | 43 | import org.springframework.cache.annotation.CacheEvict; |
| 43 | 44 | import org.springframework.cache.annotation.Cacheable; |
| ... | ... | @@ -822,6 +823,14 @@ public class ContractDistributorStandardServiceImpl extends |
| 822 | 823 | OpLogUtil.setExtra(vo); |
| 823 | 824 | } |
| 824 | 825 | |
| 826 | + public List<String> getNoContractSigned(List<String> buyerList) { | |
| 827 | + return getBaseMapper().getNoContractSigned(buyerList); | |
| 828 | + } | |
| 829 | + | |
| 830 | + public List<String> getContractSigned(List<String> buyerList) { | |
| 831 | + return getBaseMapper().getContractSigned(buyerList); | |
| 832 | + } | |
| 833 | + | |
| 825 | 834 | @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 826 | 835 | @Override |
| 827 | 836 | public void cleanCacheByKey(Serializable key) { | ... | ... |
| ... | ... | @@ -296,6 +296,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
| 296 | 296 | data.setCompanySuggestedCategory(vo.getCompanySuggestedCategory()); |
| 297 | 297 | } |
| 298 | 298 | data.setStatus(vo.getStatus()); |
| 299 | + //新增默认正常 | |
| 300 | + data.setFrozenStatus("NORMAL"); | |
| 299 | 301 | |
| 300 | 302 | getBaseMapper().insert(data); |
| 301 | 303 | |
| ... | ... | @@ -913,7 +915,7 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
| 913 | 915 | UpdateCustomerCreditVo updateCustomerCreditVo = objectMapper.readValue(json, UpdateCustomerCreditVo.class); |
| 914 | 916 | // 使用转换后的对象 |
| 915 | 917 | System.out.println(updateCustomerCreditVo); |
| 916 | - updateNoFlowInstance(updateCustomerCreditVo); | |
| 918 | + updatePartNoFlowInstance(updateCustomerCreditVo); | |
| 917 | 919 | |
| 918 | 920 | } catch (JsonProcessingException e) { |
| 919 | 921 | e.printStackTrace(); |
| ... | ... | @@ -1076,6 +1078,32 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
| 1076 | 1078 | cleanCacheByKey(vo.getId()); |
| 1077 | 1079 | } |
| 1078 | 1080 | |
| 1081 | + @OpLog(type = OtherOpLogType.class, name = "审核中修改客户资信表不走审核,ID:{}", params = {"#id"}) | |
| 1082 | + @Transactional(rollbackFor = Exception.class) | |
| 1083 | + @Override | |
| 1084 | + public void updatePartNoFlowInstance(UpdateCustomerCreditVo vo) { | |
| 1085 | + | |
| 1086 | + CustomerCredit data = customerCreditMapper.findById(vo.getId()); | |
| 1087 | + if (ObjectUtil.isNull(data)) { | |
| 1088 | + throw new DefaultClientException("客户资信表不存在!"); | |
| 1089 | + } | |
| 1090 | + LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class) | |
| 1091 | + .set(CustomerCredit::getCompanySettlementPeriod, StringUtil.isBlank(vo.getCompanySettlementPeriod()) ? null : vo.getCompanySettlementPeriod()) | |
| 1092 | + .set(CustomerCredit::getCompanyCreditLimit, StringUtil.isBlank(vo.getCompanyCreditLimit()) ? null : vo.getCompanyCreditLimit()) | |
| 1093 | + .set(CustomerCredit::getCompanyMaterialSupplyPlan, StringUtil.isBlank(vo.getCompanyMaterialSupplyPlan()) ? null : vo.getCompanyMaterialSupplyPlan()) | |
| 1094 | + .set(CustomerCredit::getCompanySuggestedCategory, vo.getCompanySuggestedCategory()) | |
| 1095 | + .set(CustomerCredit::getBusinessFileName, StringUtil.isBlank(vo.getBusinessFileName()) ? null : vo.getBusinessFileName()) | |
| 1096 | + .set(CustomerCredit::getBusinessFileId, StringUtil.isBlank(vo.getBusinessFileId()) ? null : vo.getBusinessFileId()) | |
| 1097 | + .set(CustomerCredit::getShareholderFileName, StringUtil.isBlank(vo.getShareholderFileName()) ? null : vo.getShareholderFileName()) | |
| 1098 | + .set(CustomerCredit::getShareholderFileId, StringUtil.isBlank(vo.getShareholderFileId()) ? null : vo.getShareholderFileId()) | |
| 1099 | + .eq(CustomerCredit::getId, vo.getId()); | |
| 1100 | + | |
| 1101 | + getBaseMapper().update(updateWrapper); | |
| 1102 | + OpLogUtil.setVariable("id", data.getId()); | |
| 1103 | + OpLogUtil.setExtra(vo); | |
| 1104 | + cleanCacheByKey(vo.getId()); | |
| 1105 | + } | |
| 1106 | + | |
| 1079 | 1107 | @OpLog(type = OtherOpLogType.class, name = "更新状态,ID:{}", params = {"#id"}) |
| 1080 | 1108 | @Transactional(rollbackFor = Exception.class) |
| 1081 | 1109 | @Override |
| ... | ... | @@ -1135,6 +1163,37 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
| 1135 | 1163 | cleanCacheByKey(id); |
| 1136 | 1164 | } |
| 1137 | 1165 | |
| 1166 | + @OpLog(type = OtherOpLogType.class, name = "批量更新企业操作类型,ID:{}", params = {"#id"}) | |
| 1167 | + @Transactional(rollbackFor = Exception.class) | |
| 1168 | + @Override | |
| 1169 | + public void updateEnterpriseOperationType(List<String> ids, String enterpriseOperationType) { | |
| 1170 | + if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(enterpriseOperationType)) { | |
| 1171 | + return; | |
| 1172 | + } | |
| 1173 | + getBaseMapper().updateEnterpriseOperationType(ids, enterpriseOperationType); | |
| 1174 | + } | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + @OpLog(type = OtherOpLogType.class, name = "批量更新冻结状态,ID:{}", params = {"#id"}) | |
| 1178 | + @Transactional(rollbackFor = Exception.class) | |
| 1179 | + @Override | |
| 1180 | + public void updateFrozenStatus(List<String> ids, String frozenStatus) { | |
| 1181 | + if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(frozenStatus)) { | |
| 1182 | + return; | |
| 1183 | + } | |
| 1184 | + getBaseMapper().updateFrozenStatus(ids, frozenStatus); | |
| 1185 | + } | |
| 1186 | + | |
| 1187 | + @OpLog(type = OtherOpLogType.class, name = "批量更新冻结状态,ID:{}", params = {"#id"}) | |
| 1188 | + @Transactional(rollbackFor = Exception.class) | |
| 1189 | + @Override | |
| 1190 | + public List<String> getNeedFrozenIds(List<String> ids, String createTime) { | |
| 1191 | + if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(createTime)) { | |
| 1192 | + return null; | |
| 1193 | + } | |
| 1194 | + return getBaseMapper().getNeedFrozenIds(ids, createTime); | |
| 1195 | + } | |
| 1196 | + | |
| 1138 | 1197 | @OpLog(type = OtherOpLogType.class, name = "删除客户资信表,ID:{}", params = {"#id"}) |
| 1139 | 1198 | @Transactional(rollbackFor = Exception.class) |
| 1140 | 1199 | @Override | ... | ... |
| ... | ... | @@ -37,7 +37,7 @@ public class FlowTaskServiceImpl implements FlowTaskService { |
| 37 | 37 | UpdateCustomerCreditVo updateCustomerCreditVo = JsonUtil.parseObject(json, UpdateCustomerCreditVo.class); |
| 38 | 38 | // 使用转换后的对象 |
| 39 | 39 | System.out.println(updateCustomerCreditVo); |
| 40 | - customerCreditService.updateNoFlowInstance(updateCustomerCreditVo); | |
| 40 | + customerCreditService.updatePartNoFlowInstance(updateCustomerCreditVo); | |
| 41 | 41 | customerCreditService.cleanCacheByKey(updateCustomerCreditVo.getId()); |
| 42 | 42 | } catch (JsonProcessingException e) { |
| 43 | 43 | e.printStackTrace(); | ... | ... |
| ... | ... | @@ -23,4 +23,21 @@ public interface ContractDistributorStandardMapper extends BaseMapper<ContractDi |
| 23 | 23 | List<ContractDistributorStandard> query(@Param("vo") QueryContractDistributorStandardVo vo); |
| 24 | 24 | |
| 25 | 25 | List<ContractDistributorStandard> getCustomerSpecificQualityRequirements(@Param("customerId") String customerId, @Param("productIdList") List<String> productIdList); |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 获取一年内未签订合同的企业 | |
| 29 | + * | |
| 30 | + * @param buyerList 企业id集合 | |
| 31 | + * @return 一年内未签订合同的企业 | |
| 32 | + */ | |
| 33 | + List<String> getNoContractSigned(@Param("buyerList") List<String> buyerList); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 获取一年内签订过合同的企业 | |
| 37 | + * | |
| 38 | + * @param buyerList 企业id集合 | |
| 39 | + * @return 一年内未签订合同的企业 | |
| 40 | + */ | |
| 41 | + List<String> getContractSigned(@Param("buyerList") List<String> buyerList); | |
| 42 | + | |
| 26 | 43 | } | ... | ... |
| ... | ... | @@ -38,4 +38,23 @@ public interface CustomerCreditMapper extends BaseMapper<CustomerCredit> { |
| 38 | 38 | * @return 已使用编码 |
| 39 | 39 | */ |
| 40 | 40 | Set<String> getGenerateCode(@Param("code") String code); |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 批量更新企业操作类型 | |
| 44 | + * | |
| 45 | + * @param ids 资信ids | |
| 46 | + * @param enterpriseOperationType 企业操作类型 | |
| 47 | + */ | |
| 48 | + void updateEnterpriseOperationType(@Param("ids") List<String> ids, @Param("enterpriseOperationType") String enterpriseOperationType); | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 批量更新冻结状态 | |
| 52 | + * | |
| 53 | + * @param ids 资信ids | |
| 54 | + * @param frozenStatus 冻结状态 | |
| 55 | + */ | |
| 56 | + void updateFrozenStatus(@Param("ids") List<String> ids, @Param("frozenStatus") String frozenStatus); | |
| 57 | + | |
| 58 | + | |
| 59 | + List<String> getNeedFrozenIds(@Param("ids") List<String> ids, @Param("createTime") String createTime); | |
| 41 | 60 | } | ... | ... |
| ... | ... | @@ -6,6 +6,7 @@ import com.lframework.starter.web.core.components.resp.PageResult; |
| 6 | 6 | import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo; |
| 7 | 7 | import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo; |
| 8 | 8 | import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo; |
| 9 | +import org.apache.ibatis.annotations.Param; | |
| 9 | 10 | |
| 10 | 11 | import java.util.List; |
| 11 | 12 | |
| ... | ... | @@ -104,4 +105,20 @@ public interface ContractDistributorStandardService extends BaseMpService<Contra |
| 104 | 105 | */ |
| 105 | 106 | void specificationLock(UpdateContractDistributorStandardVo vo); |
| 106 | 107 | |
| 107 | -} | |
| \ No newline at end of file | ||
| 108 | + /** | |
| 109 | + * 获取一年内未签订合同的企业 | |
| 110 | + * | |
| 111 | + * @param buyerList 企业id集合 | |
| 112 | + * @return 一年内未签订合同的企业 | |
| 113 | + */ | |
| 114 | + List<String> getNoContractSigned(List<String> buyerList); | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * 获取一年内签订过合同的企业 | |
| 118 | + * | |
| 119 | + * @param buyerList 企业id集合 | |
| 120 | + * @return 一年内未签订合同的企业 | |
| 121 | + */ | |
| 122 | + List<String> getContractSigned(List<String> buyerList); | |
| 123 | + | |
| 124 | +} | ... | ... |
| ... | ... | @@ -8,6 +8,7 @@ import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditVo; |
| 8 | 8 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo; |
| 9 | 9 | import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo; |
| 10 | 10 | import freemarker.template.TemplateException; |
| 11 | +import org.apache.ibatis.annotations.Param; | |
| 11 | 12 | |
| 12 | 13 | import java.io.IOException; |
| 13 | 14 | import java.util.List; |
| ... | ... | @@ -65,6 +66,8 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> { |
| 65 | 66 | */ |
| 66 | 67 | void updateNoFlowInstance(UpdateCustomerCreditVo vo); |
| 67 | 68 | |
| 69 | + void updatePartNoFlowInstance(UpdateCustomerCreditVo vo); | |
| 70 | + | |
| 68 | 71 | |
| 69 | 72 | /** |
| 70 | 73 | * 更新状态 |
| ... | ... | @@ -88,6 +91,31 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> { |
| 88 | 91 | void cancel(String id); |
| 89 | 92 | |
| 90 | 93 | /** |
| 94 | + * 批量更新企业操作类型 | |
| 95 | + * | |
| 96 | + * @param ids 主键 | |
| 97 | + * @param enterpriseOperationType 企业操作类型 | |
| 98 | + */ | |
| 99 | + void updateEnterpriseOperationType(List<String> ids, String enterpriseOperationType); | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 批量更新冻结状态 | |
| 103 | + * | |
| 104 | + * @param ids 主键 | |
| 105 | + * @param frozenStatus 冻结状态 | |
| 106 | + */ | |
| 107 | + void updateFrozenStatus(List<String> ids, String frozenStatus); | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * 获取需要冻结的客户资信id | |
| 111 | + * | |
| 112 | + * @param ids 资信id集合 | |
| 113 | + * @param createTime 创建时间 | |
| 114 | + * @return 需要冻结的客户资信id集合 | |
| 115 | + */ | |
| 116 | + List<String> getNeedFrozenIds(List<String> ids, String createTime); | |
| 117 | + | |
| 118 | + /** | |
| 91 | 119 | * 根据ID删除 |
| 92 | 120 | * @param id |
| 93 | 121 | * @return | ... | ... |
| ... | ... | @@ -397,4 +397,16 @@ public class CreateCustomerCreditVo implements BaseVo, Serializable { |
| 397 | 397 | @ApiModelProperty("是否为导入") |
| 398 | 398 | private String importType; |
| 399 | 399 | |
| 400 | + /** | |
| 401 | + * 企业操作类型 | |
| 402 | + */ | |
| 403 | + @ApiModelProperty("企业操作类型") | |
| 404 | + private String enterpriseOperationType; | |
| 405 | + | |
| 406 | + /** | |
| 407 | + * 冻结状态(正常:NORMAL,冻结:FROZEN) | |
| 408 | + */ | |
| 409 | + @ApiModelProperty(value = "冻结状态") | |
| 410 | + private String frozenStatus; | |
| 411 | + | |
| 400 | 412 | } | ... | ... |
| ... | ... | @@ -76,4 +76,22 @@ public class QueryCustomerCreditVo extends PageVo implements BaseVo, Serializabl |
| 76 | 76 | @ApiModelProperty("导出类型") |
| 77 | 77 | private String exportType; |
| 78 | 78 | |
| 79 | + /** | |
| 80 | + * 企业操作类型 | |
| 81 | + */ | |
| 82 | + @ApiModelProperty("企业操作类型") | |
| 83 | + private String enterpriseOperationType; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 冻结状态(正常:NORMAL,冻结:FROZEN) | |
| 87 | + */ | |
| 88 | + @ApiModelProperty(value = "冻结状态") | |
| 89 | + private String frozenStatus; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 创建时间 | |
| 93 | + */ | |
| 94 | + @ApiModelProperty(value = "创建时间") | |
| 95 | + private String createTimeStr; | |
| 96 | + | |
| 79 | 97 | } | ... | ... |
| ... | ... | @@ -458,4 +458,16 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { |
| 458 | 458 | @ApiModelProperty(value = "营销中心主管") |
| 459 | 459 | private String marketingCenterSupervisor; |
| 460 | 460 | |
| 461 | + /** | |
| 462 | + * 企业操作类型 | |
| 463 | + */ | |
| 464 | + @ApiModelProperty("企业操作类型") | |
| 465 | + private String enterpriseOperationType; | |
| 466 | + | |
| 467 | + /** | |
| 468 | + * 冻结状态(正常:NORMAL,冻结:FROZEN) | |
| 469 | + */ | |
| 470 | + @ApiModelProperty(value = "冻结状态") | |
| 471 | + private String frozenStatus; | |
| 472 | + | |
| 461 | 473 | } | ... | ... |
| ... | ... | @@ -189,4 +189,40 @@ |
| 189 | 189 | WHERE rn = 1 |
| 190 | 190 | ORDER BY create_time; |
| 191 | 191 | </select> |
| 192 | + | |
| 193 | + <select id="getNoContractSigned" resultType="java.lang.String"> | |
| 194 | + SELECT DISTINCT buyer | |
| 195 | + FROM ( | |
| 196 | + SELECT | |
| 197 | + buyer, | |
| 198 | + formalized_at, | |
| 199 | + ROW_NUMBER() OVER (PARTITION BY buyer ORDER BY formalized_at DESC) AS rn | |
| 200 | + FROM tbl_contract_distributor_standard | |
| 201 | + WHERE formalized_at is not null | |
| 202 | + and buyer in | |
| 203 | + <foreach collection="buyerList" open="(" separator="," close=")" item="item"> | |
| 204 | + #{item} | |
| 205 | + </foreach> | |
| 206 | + ) t | |
| 207 | + WHERE rn = 1 | |
| 208 | + AND DATE(formalized_at) < DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | |
| 209 | + </select> | |
| 210 | + | |
| 211 | + <select id="getContractSigned" resultType="java.lang.String"> | |
| 212 | + SELECT DISTINCT buyer | |
| 213 | + FROM ( | |
| 214 | + SELECT | |
| 215 | + buyer, | |
| 216 | + formalized_at, | |
| 217 | + ROW_NUMBER() OVER (PARTITION BY buyer ORDER BY formalized_at DESC) AS rn | |
| 218 | + FROM tbl_contract_distributor_standard | |
| 219 | + WHERE formalized_at is not null | |
| 220 | + and buyer in | |
| 221 | + <foreach collection="buyerList" open="(" separator="," close=")" item="item"> | |
| 222 | + #{item} | |
| 223 | + </foreach> | |
| 224 | + ) t | |
| 225 | + WHERE rn = 1 | |
| 226 | + AND DATE(formalized_at) >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | |
| 227 | + </select> | |
| 192 | 228 | </mapper> | ... | ... |
| ... | ... | @@ -64,6 +64,8 @@ |
| 64 | 64 | <result column="marketing_department_supervisor" property="marketingDepartmentSupervisor"/> |
| 65 | 65 | <result column="marketing_center_supervisor" property="marketingCenterSupervisor"/> |
| 66 | 66 | <result column="status" property="status"/> |
| 67 | + <result column="enterprise_operation_type" property="enterpriseOperationType"/> | |
| 68 | + <result column="frozen_status" property="frozenStatus"/> | |
| 67 | 69 | <result column="create_by_id" property="createById"/> |
| 68 | 70 | <result column="create_by" property="createBy"/> |
| 69 | 71 | <result column="update_by_id" property="updateById"/> |
| ... | ... | @@ -135,6 +137,8 @@ |
| 135 | 137 | tb.marketing_department_supervisor, |
| 136 | 138 | tb.marketing_center_supervisor, |
| 137 | 139 | tb.shareholder_file_id, |
| 140 | + tb.enterprise_operation_type, | |
| 141 | + tb.frozen_status, | |
| 138 | 142 | tb.create_by_id, |
| 139 | 143 | tb.create_by, |
| 140 | 144 | tb.update_by_id, |
| ... | ... | @@ -174,6 +178,15 @@ |
| 174 | 178 | <if test="vo.statusCancel != null and vo.statusCancel != ''"> |
| 175 | 179 | AND tb.status != #{vo.statusCancel} |
| 176 | 180 | </if> |
| 181 | + <if test="vo.enterpriseOperationType != null and vo.enterpriseOperationType != ''"> | |
| 182 | + AND tb.enterprise_operation_type = #{vo.enterpriseOperationType} | |
| 183 | + </if> | |
| 184 | + <if test="vo.frozenStatus != null and vo.frozenStatus != ''"> | |
| 185 | + AND tb.frozen_status = #{vo.frozenStatus} | |
| 186 | + </if> | |
| 187 | + <if test="vo.createTimeStr != null and vo.createTimeStr != ''"> | |
| 188 | + AND tb.create_time < #{vo.createTimeStr} | |
| 189 | + </if> | |
| 177 | 190 | </where> |
| 178 | 191 | </select> |
| 179 | 192 | |
| ... | ... | @@ -196,4 +209,49 @@ |
| 196 | 209 | </if> |
| 197 | 210 | </where> |
| 198 | 211 | </select> |
| 212 | + | |
| 213 | + <update id="updateEnterpriseOperationType"> | |
| 214 | + UPDATE customer_credit | |
| 215 | + SET enterprise_operation_type = #{enterpriseOperationType} | |
| 216 | + WHERE id in | |
| 217 | + <foreach collection="ids" open="(" separator="," close=")" item="item"> | |
| 218 | + #{item} | |
| 219 | + </foreach> | |
| 220 | + </update> | |
| 221 | + | |
| 222 | + <update id="updateFrozenStatus"> | |
| 223 | + UPDATE customer_credit | |
| 224 | + SET frozen_status = #{frozenStatus} | |
| 225 | + WHERE id in | |
| 226 | + <foreach collection="ids" open="(" separator="," close=")" item="item"> | |
| 227 | + #{item} | |
| 228 | + </foreach> | |
| 229 | + </update> | |
| 230 | + | |
| 231 | + <select id="getNeedFrozenIds" resultType="String"> | |
| 232 | + SELECT c.id | |
| 233 | + FROM customer_credit c | |
| 234 | + LEFT JOIN ( | |
| 235 | + SELECT | |
| 236 | + h.credit_id, | |
| 237 | + MAX(h.create_time) AS latest_create_time -- 直接取最大时间 | |
| 238 | + FROM customer_credit_history h | |
| 239 | + WHERE h.id LIKE '%_01' | |
| 240 | + AND h.credit_id IN | |
| 241 | + <foreach collection="ids" item="item" open="(" separator="," close=")"> | |
| 242 | + #{item} | |
| 243 | + </foreach> | |
| 244 | + GROUP BY h.credit_id | |
| 245 | + ) latest_h ON c.id = latest_h.credit_id | |
| 246 | + WHERE c.id IN | |
| 247 | + <foreach collection="ids" item="item" open="(" separator="," close=")"> | |
| 248 | + #{item} | |
| 249 | + </foreach> | |
| 250 | + AND c.status = 'PASS' | |
| 251 | + AND ( | |
| 252 | + latest_h.latest_create_time IS NULL -- 无 history 记录 | |
| 253 | + OR latest_h.latest_create_time < #{createTime} -- 有记录且最新时间小于createTime | |
| 254 | + ); | |
| 255 | + </select> | |
| 256 | + | |
| 199 | 257 | </mapper> | ... | ... |