93798d0e by 肖初晴

【DAOP-1.0】服务商维护

【功能点】新增接口
1 parent 3cfe259f
1 package com.csbr.qingcloud.portal.controller;
2
3 import com.csbr.cloud.common.response.CommonRes;
4 import csbr.cloud.entity.annotation.SystemLog;
5 import csbr.cloud.entity.domain.base.vo.PageListVO;
6 import com.csbr.cloud.workflow.domain.dto.callback.BizCallbackDTO;
7 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainQueryVO;
8 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRQVO;
9 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO;
10 import com.csbr.qingcloud.portal.service.ServicerMaintainService;
11 import io.swagger.v3.oas.annotations.Operation;
12 import io.swagger.v3.oas.annotations.Parameter;
13 import io.swagger.v3.oas.annotations.tags.Tag;
14 import jakarta.annotation.Resource;
15 import jakarta.validation.Valid;
16 import org.springframework.web.bind.annotation.*;
17
18 import java.util.List;
19
20 /**
21 * @program: D:/git/ms-data-circulation-portal-service
22 * @description: 服务商维护-控制器
23 * @author: xcq
24 * @create: 2024-12-31 18:49
25 **/
26 @RestController
27 @RequestMapping("/servicer-maintain")
28 @Tag(name = "服务商维护-控制器")
29 public class ServicerMaintainController {
30
31 @Resource
32 private ServicerMaintainService servicerMaintainService;
33
34 //region 基本操作
35
36 @PostMapping("/save")
37 @SystemLog(value = "服务商维护-新增")
38 @Operation(summary = "服务商维护-新增")
39 public CommonRes<Boolean> saveServicerMaintain(@RequestBody @Valid ServicerMaintainRQVO vo) {
40 servicerMaintainService.saveServicerMaintain(vo);
41 return CommonRes.success(true);
42 }
43
44 @PutMapping("/update")
45 @SystemLog(value = "服务商维护-修改")
46 @Operation(summary = "服务商维护-修改")
47 public CommonRes<Boolean> updateServicerMaintain(@RequestBody @Valid ServicerMaintainRQVO vo) {
48 servicerMaintainService.updateServicerMaintain(vo);
49 return CommonRes.success(true);
50 }
51
52 @DeleteMapping("/delete")
53 @SystemLog(value = "服务商维护-批量删除")
54 @Operation(summary = "服务商维护-批量删除")
55 public CommonRes<Boolean> removeByGuids(@RequestBody List<String> guids) {
56 servicerMaintainService.removeByGuids(guids);
57 return CommonRes.success(true);
58 }
59
60 @PostMapping("/page-list")
61 @SystemLog(value = "服务商维护-分页")
62 @Operation(summary = "服务商维护-分页")
63 public CommonRes<PageListVO<ServicerMaintainRSVO>> pageList(@RequestBody @Valid ServicerMaintainQueryVO queryVO) {
64 PageListVO<ServicerMaintainRSVO> pageVO = servicerMaintainService.pageList(queryVO);
65 return CommonRes.success(pageVO);
66 }
67
68 @GetMapping("/detail")
69 @SystemLog(value = "服务商维护-详情")
70 @Operation(
71 summary = "服务商维护-详情",
72 parameters = {
73 @Parameter(name = "guid", description = "服务商维护唯一标识", required = true)}
74 )
75 public CommonRes<ServicerMaintainRSVO> getServicerMaintainDetail(@RequestParam String guid) {
76 ServicerMaintainRSVO vo = servicerMaintainService.getServicerMaintainDetail(guid);
77 return CommonRes.success(vo);
78 }
79
80 @PostMapping("/flow-call-back")
81 @SystemLog(value = "服务商维护-流程结束后进行业务回调")
82 @Operation(summary = "服务商维护-流程结束后进行业务回调", hidden = true)
83 public CommonRes<Boolean> flowCallBack(@RequestBody @Valid BizCallbackDTO dto) {
84 servicerMaintainService.flowCallBack(dto);
85 return CommonRes.success(true);
86 }
87
88 //endregion
89
90 }
1 package com.csbr.qingcloud.portal.domain.vo;
2
3 import com.csbr.cloud.workflow.domain.dto.appove.FlowBizGuidQueryDTO;
4 import io.swagger.v3.oas.annotations.media.Schema;
5 import lombok.EqualsAndHashCode;
6 import lombok.Data;
7 import java.util.Date;
8 import java.util.List;
9
10 /**
11 * @program: D:/git/ms-data-circulation-portal-service
12 * @description: 服务商维护查询参数
13 * @author: xcq
14 * @create: 2024-12-31 18:49
15 **/
16 @EqualsAndHashCode(callSuper = true)
17 @Data
18 @Schema(title = "服务商维护查询参数")
19 public class ServicerMaintainQueryVO extends FlowBizGuidQueryDTO {
20
21 /**
22 * 业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃】
23 */
24 @Schema(description = "业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃】")
25 private String bizApproveState;
26
27 /******** 自定义扩展 *****/
28
29 /**
30 * 数据唯一标识【List集合】
31 */
32 @Schema(description = "数据唯一标识", hidden = true)
33 private List<String> guidList;
34
35 /**
36 * 是否调用查询的判断
37 */
38 @Schema(description = "是否调用查询的判断", hidden = true)
39 private Boolean isNeedQuery;
40
41 }
1 package com.csbr.qingcloud.portal.domain.vo;
2
3 import com.csbr.cloud.workflow.domain.vo.appove.FlowRQBaseVO;
4 import io.swagger.v3.oas.annotations.media.Schema;
5 import com.fasterxml.jackson.annotation.JsonFormat;
6 import lombok.Data;
7 import java.util.Date;
8
9 /**
10 * @program: D:/git/ms-data-circulation-portal-service
11 * @description: 服务商维护新增、修改参数
12 * @author: xcq
13 * @create: 2024-12-31 18:49
14 **/
15 @Data
16 @Schema(title = "服务商维护新增、修改参数")
17 public class ServicerMaintainRQVO extends FlowRQBaseVO {
18
19 /**
20 * 企业唯一标识
21 */
22 @Schema(description = "企业唯一标识")
23 private String tenantGuid;
24
25 /**
26 * 公司名称
27 */
28 @Schema(description = "公司名称")
29 private String tenantName;
30
31 /**
32 * 企业类型【选择平台字典【公司类型】的选项】
33 */
34 @Schema(description = "企业类型【选择平台字典【公司类型】的选项】")
35 private String tenantType;
36
37 /**
38 * 提交时间
39 */
40 @Schema(description = "提交时间")
41 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
42 private Date submitTime;
43
44 /**
45 * 联系人
46 */
47 @Schema(description = "联系人")
48 private String contacts;
49
50 /**
51 * 联系人电话
52 */
53 @Schema(description = "联系人电话")
54 private String contactTel;
55
56 /**
57 * 业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】
58 */
59 @Schema(description = "业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】")
60 private String bizApproveState;
61
62 /**
63 * 能否继续合作【Y 能;N 不能;】
64 */
65 @Schema(description = "能否继续合作【Y 能;N 不能;】")
66 private String canContinueCollaborate;
67
68 /**
69 * 维护信息
70 */
71 @Schema(description = "维护信息")
72 private String maintainJson;
73
74 /******** 库表存储属性 需处理 *****/
75
76 /******** 自定义扩展 *****/
77
78 /******** 子对象 *****/
79
80 }
1 package com.csbr.qingcloud.portal.domain.vo;
2
3 import io.swagger.v3.oas.annotations.media.Schema;
4 import com.fasterxml.jackson.annotation.JsonFormat;
5 import lombok.Data;
6 import com.csbr.cloud.workflow.domain.vo.appove.BizApproveVO;
7 import java.util.Date;
8
9 /**
10 * @program: D:/git/ms-data-circulation-portal-service
11 * @description: 服务商维护返回参数
12 * @author: xcq
13 * @create: 2024-12-31 18:49
14 **/
15 @Data
16 @Schema(title = "服务商维护返回参数")
17 public class ServicerMaintainRSVO {
18
19 /**
20 * 系统唯一标识
21 */
22 @Schema(description = "系统唯一标识")
23 private String guid;
24
25 /**
26 * 企业唯一标识
27 */
28 @Schema(description = "企业唯一标识")
29 private String tenantGuid;
30
31 /**
32 * 公司名称
33 */
34 @Schema(description = "公司名称")
35 private String tenantName;
36
37 /**
38 * 企业类型【选择平台字典【公司类型】的选项】
39 */
40 @Schema(description = "企业类型【选择平台字典【公司类型】的选项】")
41 private String tenantType;
42
43 /**
44 * 提交时间
45 */
46 @Schema(description = "提交时间")
47 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
48 private Date submitTime;
49
50 /**
51 * 联系人
52 */
53 @Schema(description = "联系人")
54 private String contacts;
55
56 /**
57 * 联系人电话
58 */
59 @Schema(description = "联系人电话")
60 private String contactTel;
61
62 /**
63 * 业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】
64 */
65 @Schema(description = "业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】")
66 private String bizApproveState;
67
68 /**
69 * 能否继续合作【Y 能;N 不能;】
70 */
71 @Schema(description = "能否继续合作【Y 能;N 不能;】")
72 private String canContinueCollaborate;
73
74 /**
75 * 维护信息
76 */
77 @Schema(description = "维护信息")
78 private String maintainJson;
79
80 /******** 库表存储属性 需处理 *****/
81
82 /******** 自定义扩展 *****/
83
84 /**
85 * 审批信息
86 */
87 @Schema(description = "审批信息")
88 private BizApproveVO approveVO;
89
90 /******** 子对象 *****/
91
92 }
1 package com.csbr.qingcloud.portal.mybatis.entity;
2
3 import com.baomidou.mybatisplus.annotation.FieldStrategy;
4 import com.baomidou.mybatisplus.annotation.TableField;
5 import csbr.cloud.entity.domain.base.dao.BaseDO;
6 import jdk.jfr.Name;
7 import lombok.Data;
8 import lombok.EqualsAndHashCode;
9 import lombok.experimental.Accessors;
10 import java.util.Date;
11
12 /**
13 * @program: D:/git/ms-data-circulation-portal-service
14 * @description: 服务商维护实体
15 * @author: xcq
16 * @create: 2024-12-31 18:49
17 **/
18 @Data
19 @EqualsAndHashCode(callSuper = true)
20 @Accessors(chain = true)
21 @Name("服务商维护")
22 public class MfServicerMaintain extends BaseDO {
23
24 /**
25 * 企业唯一标识
26 */
27 @Name("企业唯一标识")
28 private String tenantGuid;
29
30 /**
31 * 公司名称
32 */
33 @Name("公司名称")
34 private String tenantName;
35
36 /**
37 * 企业类型【选择平台字典【公司类型】的选项】
38 */
39 @Name("企业类型【选择平台字典【公司类型】的选项】")
40 private String tenantType;
41
42 /**
43 * 提交时间
44 */
45 @Name("提交时间")
46 private Date submitTime;
47
48 /**
49 * 联系人
50 */
51 @Name("联系人")
52 private String contacts;
53
54 /**
55 * 联系人电话
56 */
57 @Name("联系人电话")
58 private String contactTel;
59
60 /**
61 * 业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】
62 */
63 @Name("业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】")
64 private String bizApproveState;
65
66 /**
67 * 能否继续合作【Y 能;N 不能;】
68 */
69 @Name("能否继续合作【Y 能;N 不能;】")
70 private String canContinueCollaborate;
71
72 /**
73 * 维护信息
74 */
75 @Name("维护信息")
76 @TableField(updateStrategy = FieldStrategy.ALWAYS)
77 private String maintainJson;
78
79 }
1 package com.csbr.qingcloud.portal.mybatis.entity;
2
3 import csbr.cloud.entity.domain.base.dao.BaseDO;
4 import jdk.jfr.Name;
5 import lombok.Data;
6 import lombok.EqualsAndHashCode;
7 import lombok.experimental.Accessors;
8 import java.util.Date;
9
10 /**
11 * @program: D:/git/ms-data-circulation-portal-service
12 * @description: 服务商维护明细实体
13 * @author: xcq
14 * @create: 2024-12-31 18:52
15 **/
16 @Data
17 @EqualsAndHashCode(callSuper = true)
18 @Accessors(chain = true)
19 @Name("服务商维护明细")
20 public class MfServicerMaintainDetail extends BaseDO {
21
22 /**
23 * 企业唯一标识
24 */
25 @Name("企业唯一标识")
26 private String tenantGuid;
27
28 /**
29 * 父唯一标识
30 */
31 @Name("父唯一标识")
32 private String parentGuid;
33
34 /**
35 * 字典唯一标识
36 */
37 @Name("字典唯一标识")
38 private String dicGuid;
39
40 /**
41 * 字典值
42 */
43 @Name("字典值")
44 private String dicValue;
45
46 }
1 package com.csbr.qingcloud.portal.mybatis.mapper;
2
3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 import org.apache.ibatis.annotations.Mapper;
5 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintainDetail;
6
7 /**
8 * @program: D:/git/ms-data-circulation-portal-service
9 * @description: 服务商维护明细 Mapper 接口
10 * @author: xcq
11 * @create: 2024-12-31 18:52
12 **/
13 @Mapper
14 public interface MfServicerMaintainDetailMapper extends BaseMapper<MfServicerMaintainDetail> {
15
16 }
1 package com.csbr.qingcloud.portal.mybatis.mapper;
2
3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 import org.apache.ibatis.annotations.Mapper;
5 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintain;
6
7 /**
8 * @program: D:/git/ms-data-circulation-portal-service
9 * @description: 服务商维护 Mapper 接口
10 * @author: xcq
11 * @create: 2024-12-31 18:49
12 **/
13 @Mapper
14 public interface MfServicerMaintainMapper extends BaseMapper<MfServicerMaintain> {
15
16 }
1 package com.csbr.qingcloud.portal.mybatis.service;
2
3 import com.csbr.cloud.base.service.CsbrService;
4 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintainDetail;
5
6 /**
7 * @program: D:/git/ms-data-circulation-portal-service
8 * @description: 服务商维护明细逻辑层接口
9 * @author: xcq
10 * @create: 2024-12-31 18:52
11 **/
12 public interface MfServicerMaintainDetailService extends CsbrService<MfServicerMaintainDetail> {
13
14 }
1 package com.csbr.qingcloud.portal.mybatis.service;
2
3 import com.csbr.cloud.base.service.CsbrService;
4 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintain;
5
6 /**
7 * @program: D:/git/ms-data-circulation-portal-service
8 * @description: 服务商维护逻辑层接口
9 * @author: xcq
10 * @create: 2024-12-31 18:49
11 **/
12 public interface MfServicerMaintainService extends CsbrService<MfServicerMaintain> {
13
14 }
1 package com.csbr.qingcloud.portal.mybatis.service.impl;
2
3 import com.csbr.cloud.mybatis.service.impl.CsbrServiceImpl;
4 import com.csbr.qingcloud.portal.mybatis.mapper.MfServicerMaintainDetailMapper;
5 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintainDetail;
6 import com.csbr.qingcloud.portal.mybatis.service.MfServicerMaintainDetailService;
7 import jakarta.annotation.Resource;
8 import org.springframework.stereotype.Service;
9
10 /**
11 * @program: D:/git/ms-data-circulation-portal-service
12 * @description: 服务商维护明细逻辑层接口实现
13 * @author: xcq
14 * @create: 2024-12-31 18:52
15 **/
16 @Service
17 public class MfServicerMaintainDetailServiceImpl extends CsbrServiceImpl<MfServicerMaintainDetailMapper, MfServicerMaintainDetail> implements MfServicerMaintainDetailService {
18
19 @Resource
20 private MfServicerMaintainDetailMapper mfServicerMaintainDetailMapper;
21
22 }
1 package com.csbr.qingcloud.portal.mybatis.service.impl;
2
3 import com.csbr.cloud.mybatis.service.impl.CsbrServiceImpl;
4 import com.csbr.qingcloud.portal.mybatis.mapper.MfServicerMaintainMapper;
5 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintain;
6 import com.csbr.qingcloud.portal.mybatis.service.MfServicerMaintainService;
7 import jakarta.annotation.Resource;
8 import org.springframework.stereotype.Service;
9
10 /**
11 * @program: D:/git/ms-data-circulation-portal-service
12 * @description: 服务商维护逻辑层接口实现
13 * @author: xcq
14 * @create: 2024-12-31 18:49
15 **/
16 @Service
17 public class MfServicerMaintainServiceImpl extends CsbrServiceImpl<MfServicerMaintainMapper, MfServicerMaintain> implements MfServicerMaintainService {
18
19 @Resource
20 private MfServicerMaintainMapper mfServicerMaintainMapper;
21
22 }
1 package com.csbr.qingcloud.portal.service;
2
3 import csbr.cloud.entity.domain.base.vo.PageListVO;
4 import com.csbr.cloud.workflow.domain.dto.callback.BizCallbackDTO;
5 import com.csbr.cloud.workflow.domain.vo.appove.FlowRQBaseVO;
6 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainQueryVO;
7 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO;
8
9 import java.util.List;
10
11 /**
12 * @program: D:/git/ms-data-circulation-portal-service
13 * @description: 服务商维护业务逻辑接口
14 * @author: xcq
15 * @create: 2024-12-31 18:49
16 **/
17 public interface ServicerMaintainService {
18
19 /**
20 * 服务商维护分页查询
21 * @author xcq
22 * @date 2024-12-31 18:49
23 * @param queryVO
24 * @return com.csbr.cloud.mybatis.entity.PageListVO<com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO>
25 */
26 PageListVO<ServicerMaintainRSVO> pageList(ServicerMaintainQueryVO queryVO);
27
28 /**
29 * 服务商维护获取详情数据
30 * @author xcq
31 * @date 2024-12-31 18:49
32 * @param guid
33 * @return com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO
34 */
35 ServicerMaintainRSVO getServicerMaintainDetail(String guid);
36
37 /**
38 * 服务商维护数据新增
39 * @author xcq
40 * @date 2024-12-31 18:49
41 * @param flowBaseVO
42 * @return void
43 */
44 void saveServicerMaintain(FlowRQBaseVO flowBaseVO);
45
46 /**
47 * 服务商维护数据修改
48 * @author xcq
49 * @date 2024-12-31 18:49
50 * @param flowBaseVO
51 * @return void
52 */
53 void updateServicerMaintain(FlowRQBaseVO flowBaseVO);
54
55 /**
56 * 服务商维护数据删除、并有相关的处理操作
57 * @author xcq
58 * @date 2024-12-31 18:49
59 * @param guids
60 * @return void
61 */
62 void removeByGuids(List<String> guids);
63
64 /**
65 * 流程结束后进行业务回调
66 * @author xcq
67 * @date 2024-12-31 18:49
68 * @param dto
69 * @return void
70 */
71 void flowCallBack(BizCallbackDTO dto);
72
73 }
1 package com.csbr.qingcloud.portal.service.impl;
2
3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
5 import com.csbr.cloud.common.enums.SystemError;
6 import com.csbr.cloud.common.enums.WorkFlowBizEnum;
7 import csbr.cloud.entity.enums.ApprovalStateEnum;
8 import com.csbr.cloud.common.exception.CsbrSystemException;
9 import com.csbr.cloud.common.util.CommonUtil;
10 import com.csbr.cloud.common.util.CsbrBeanUtil;
11 import com.csbr.cloud.workflow.util.ApprovalFlowUtil;
12 import com.csbr.cloud.workflow.util.FlowAbstractImpl;
13 import com.csbr.cloud.common.util.MessageSourceUtil;
14 import csbr.cloud.entity.domain.base.vo.PageListVO;
15 import com.csbr.cloud.workflow.domain.vo.appove.FlowRQBaseVO;
16 import com.csbr.cloud.workflow.domain.dto.appove.AddApprovalDTO;
17 import com.csbr.cloud.workflow.domain.dto.callback.BizCallbackDTO;
18 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainQueryVO;
19 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRQVO;
20 import com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO;
21 import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintain;
22 import com.csbr.qingcloud.portal.mybatis.service.MfServicerMaintainService;
23 import com.csbr.qingcloud.portal.service.ServicerMaintainService;
24 import jakarta.annotation.Resource;
25 import lombok.extern.slf4j.Slf4j;
26 import org.apache.commons.collections.CollectionUtils;
27 import org.apache.commons.lang3.StringUtils;
28 import org.springframework.stereotype.Service;
29 import io.seata.spring.annotation.GlobalTransactional;
30 import org.springframework.transaction.annotation.Transactional;
31
32 import java.util.ArrayList;
33 import java.util.Collections;
34 import java.util.List;
35
36 /**
37 * @program: D:/git/ms-data-circulation-portal-service
38 * @description: 服务商维护业务逻辑实现
39 * @author: xcq
40 * @create: 2024-12-31 18:49
41 **/
42 @Slf4j
43 @Service
44 public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements ServicerMaintainService {
45
46 /**
47 * 功能名称
48 */
49 private static final String FUNCTION_NAME = "服务商维护";
50
51 /**
52 * 流程类型
53 */
54 private static final String FLOW_TYPE = "10016";
55
56 @Resource
57 private MfServicerMaintainService mfServicerMaintainService;
58
59 @Resource
60 private CsbrBeanUtil csbrBeanUtil;
61
62 @Resource
63 private ApprovalFlowUtil approvalFlowUtil;
64
65 @Resource
66 private MessageSourceUtil messageSourceUtil;
67
68 /**
69 * 服务商维护分页查询
70 * @author xcq
71 * @date 2024-12-31 18:49
72 * @param queryVO
73 * @return com.csbr.cloud.mybatis.entity.PageListVO<com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO>
74 */
75 @Override
76 public PageListVO<ServicerMaintainRSVO> pageList(ServicerMaintainQueryVO queryVO) {
77 beforeQuery(queryVO);
78 if (queryVO.getIsNeedQuery()) {
79 LambdaQueryWrapper<MfServicerMaintain> queryWrapper = mfServicerMaintainService.csbrQueryWrapper(queryVO, MfServicerMaintain.class);
80 queryWrapper.in(CollectionUtils.isNotEmpty(queryVO.getGuidList()), MfServicerMaintain::getGuid,
81 queryVO.getGuidList());
82 queryWrapper.orderByDesc(MfServicerMaintain::getCreateTime);
83 PageListVO<MfServicerMaintain> pageList = mfServicerMaintainService.csbrPageList(queryVO, queryWrapper);
84 PageListVO<ServicerMaintainRSVO> rsPageList = csbrBeanUtil.convert(pageList, PageListVO.class);
85 afterQuery(pageList, rsPageList);
86 return rsPageList;
87 }
88 return new PageListVO<>();
89 }
90
91 /**
92 * 服务商维护获取详情数据
93 * @author xcq
94 * @date 2024-12-31 18:49
95 * @param guid
96 * @return com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO
97 */
98 @Override
99 public ServicerMaintainRSVO getServicerMaintainDetail(String guid) {
100 if (StringUtils.isBlank(guid)) {
101 // W00012 = {0}:参数[{1}]不能为空!
102 throw new CsbrSystemException(SystemError.DATA_INPUT_ERROR, messageSourceUtil.getMessage("W00010",
103 String.format("获取%s详情数据", FUNCTION_NAME), "数据唯一标识"));
104 }
105 MfServicerMaintain entity = mfServicerMaintainService.getById(guid);
106 if (entity == null) {
107 throw new CsbrSystemException(SystemError.DATA_NOT_EXISTS, messageSourceUtil.notExistsToSelectMessage(String.format("获取%s详情数据", FUNCTION_NAME)));
108 }
109 return convertToVO(entity);
110 }
111
112 /**
113 * 服务商维护数据新增
114 * @author xcq
115 * @date 2024-12-31 18:49
116 * @param flowBaseVO
117 * @return void
118 */
119 @GlobalTransactional(rollbackFor = Exception.class)
120 @Transactional(rollbackFor = Exception.class)
121 @Override
122 public void saveServicerMaintain(FlowRQBaseVO flowBaseVO) {
123 ServicerMaintainRQVO rqVO = (ServicerMaintainRQVO) flowBaseVO;
124 beforeSave(rqVO);
125 MfServicerMaintain entity = convertToEntity(rqVO);
126 // 发起审批流程或保存草稿
127 AddApprovalDTO approvalDTO = getAddApprovalDTO(entity);
128 super.startWorkFlow(rqVO, approvalDTO, entity::setBizApproveState);
129 // 业务数据保存
130 boolean flag = mfServicerMaintainService.save(entity);
131 if (!flag) {
132 throw new CsbrSystemException(SystemError.DATA_ADD_ERROR, rqVO.getImmediateApprove() ?
133 messageSourceUtil.submitMessage(FUNCTION_NAME) : messageSourceUtil.addMessage(FUNCTION_NAME));
134 }
135 afterSave(entity, rqVO);
136 }
137
138 /**
139 * 服务商维护数据修改
140 * @author xcq
141 * @date 2024-12-31 18:49
142 * @param flowBaseVO
143 * @return void
144 */
145 @GlobalTransactional(rollbackFor = Exception.class)
146 @Transactional(rollbackFor = Exception.class)
147 @Override
148 public void updateServicerMaintain(FlowRQBaseVO flowBaseVO) {
149 ServicerMaintainRQVO rqVO = (ServicerMaintainRQVO) flowBaseVO;
150 // 将修改前数据查出来缓存下来,传入到修改后方法中,用于一些特殊逻辑处理,如某个值变化才进行
151 // MfServicerMaintain oldEntity = mfServicerMaintainService.getById(rqVO.getGuid());
152 beforeUpdate(rqVO);
153 MfServicerMaintain entity = convertToEntity(rqVO);
154 // 发起审批流程或保存草稿
155 AddApprovalDTO approvalDTO = getAddApprovalDTO(entity);
156 super.startOrRestartWorkFlow(rqVO, rqVO.getBizApproveState(), approvalDTO, entity::setBizApproveState);
157 if (rqVO.getIsRestart()) {
158 // 重新提交
159 againSubmitFlow(entity, rqVO, approvalDTO);
160 } else {
161 // 修改业务数据
162 boolean flag = mfServicerMaintainService.updateById(entity);
163 if (!flag) {
164 throw new CsbrSystemException(SystemError.DATA_UPDATE_ERROR, rqVO.getImmediateApprove() ?
165 messageSourceUtil.submitMessage(FUNCTION_NAME) : messageSourceUtil.updateMessage(FUNCTION_NAME));
166 }
167 afterUpdate(entity, rqVO);
168 }
169 }
170
171 /**
172 * 重新提交服务商维护
173 * @author xcq
174 * @date 2024-12-31 18:49
175 * @param entity
176 * @param rqVO
177 * @param approvalDTO
178 * @return void
179 */
180 private void againSubmitFlow(MfServicerMaintain entity, ServicerMaintainRQVO rqVO, AddApprovalDTO approvalDTO) {
181 // 重新提交的数据重置相关字段
182 entity.setGuid(CommonUtil.newGuid());
183 mfServicerMaintainService.csbrBaseEntity(entity);
184 // 保存新数据
185 boolean flag = mfServicerMaintainService.save(entity);
186 if (!flag) {
187 throw new CsbrSystemException(SystemError.DATA_ADD_ERROR, messageSourceUtil.addMessage(String.format("重新提交%s",FUNCTION_NAME)));
188 }
189 // 发起新的流程
190 approvalDTO.setGuid(entity.getGuid());
191 approvalFlowUtil.addApproval(approvalDTO);
192 afterSave(entity, rqVO);
193 }
194
195 /**
196 * 服务商维护数据删除、并有相关的处理操作
197 * @author xcq
198 * @date 2024-12-31 18:49
199 * @param guids
200 * @return void
201 */
202 @GlobalTransactional(rollbackFor = Exception.class)
203 @Transactional(rollbackFor = Exception.class)
204 @Override
205 public void removeByGuids(List<String> guids) {
206 if (CollectionUtils.isEmpty(guids)) {
207 // W00012 = {0}:参数[{1}]不能为空!
208 throw new CsbrSystemException(SystemError.DATA_INPUT_ERROR, messageSourceUtil.getMessage("W00012",
209 String.format("删除%s数据", FUNCTION_NAME), "数据唯一标识"));
210 }
211 for (String guid : guids) {
212 MfServicerMaintain entity = mfServicerMaintainService.getById(guid);
213 beforeRemove(entity);
214 boolean flag = mfServicerMaintainService.removeById(guid);
215 if (!flag) {
216 throw new CsbrSystemException(SystemError.DATA_DEL_ERROR, messageSourceUtil.delMessage(FUNCTION_NAME));
217 }
218 afterRemove(entity);
219 }
220 // 删除流程数据
221 approvalFlowUtil.removeApproveByBizGuids(guids);
222 }
223
224 /**
225 * 流程结束后进行业务回调
226 * @author xcq
227 * @date 2024-12-31 18:49
228 * @param dto
229 * @return void
230 */
231 @Transactional(rollbackFor = Exception.class)
232 @Override
233 public void flowCallBack(BizCallbackDTO dto) {
234 MfServicerMaintain entity = mfServicerMaintainService.getById(dto.getBizGuid());
235 if (entity == null) {
236 throw new CsbrSystemException(SystemError.DATA_NOT_EXISTS, messageSourceUtil.notExistsToSelectMessage(FUNCTION_NAME));
237 }
238 if (ApprovalStateEnum.PASSED.getValue().equals(dto.getApprovalState())) {
239 // todo
240 }
241 // 同步更新审批状态
242 LambdaUpdateWrapper<MfServicerMaintain> updateWrapper = mfServicerMaintainService.csbrUpdateWrapper(MfServicerMaintain.class);
243 updateWrapper.set(MfServicerMaintain::getBizApproveState, dto.getApprovalState());
244 updateWrapper.eq(MfServicerMaintain::getGuid, dto.getBizGuid());
245 boolean flag = mfServicerMaintainService.update(updateWrapper);
246 if (!flag) {
247 throw new CsbrSystemException(SystemError.DATA_UPDATE_ERROR, messageSourceUtil.updateMessage(String.format("%s的业务审批状态", FUNCTION_NAME)));
248 }
249 }
250
251 /**
252 * 获取发起流程参数
253 * @author xcq
254 * @date 2024-12-31 18:49
255 * @param entity
256 * @return com.csbr.cloud.workflow.domain.dto.appove.AddApprovalDTO
257 */
258 private AddApprovalDTO getAddApprovalDTO(MfServicerMaintain entity) {
259 AddApprovalDTO approvalDTO = new AddApprovalDTO(FLOW_TYPE, entity.getGuid());
260 // todo
261 approvalDTO.setFuncCode("FWSWH");
262 // 流程消息中的变量替换参数
263 approvalDTO.setFlowMessageBody(null);
264 // 流程列表数据核心param参数处理
265 approvalDTO.setParam1(null);
266 approvalDTO.setParam2(null);
267 approvalDTO.setParam3(null);
268 approvalDTO.setParam4(null);
269
270 return approvalDTO;
271 }
272
273 /**
274 * 服务商维护新新增前置处理
275 * @author xcq
276 * @date 2024-12-31 18:49
277 * @param rqVO
278 * @return void
279 */
280 private void beforeSave(ServicerMaintainRQVO rqVO) {
281 //region 1.输入基础验证
282 //endregion
283
284 //region 2.数据验证特殊处理
285 //region 2.1.业务合规性验证
286 //endregion 2.1.业务合规性验证
287
288 //region 2.2.业务数据验证
289 //endregion 2.2.业务数据验证
290
291 //endregion 2.数据验证特殊处理
292
293 //region 3.数据转换处理
294
295 //region 3.1.数据过程转换
296 //endregion 3.1.数据过程转换
297
298 //endregion 3.数据转换处理
299
300 //region 4.数据过滤与补充处理
301
302 //endregion 4.数据过滤与补充处理
303
304 //region 5.过程处理
305
306 //region 5.1.计算逻辑处理
307 //endregion 5.1.计算逻辑处理
308
309 //region 5.2.业务逻辑处理
310 //endregion 5.2.业务逻辑处理
311
312 //endregion 5.过程处理
313 }
314
315 /**
316 * 服务商维护新增后置处理
317 * @author xcq
318 * @date 2024-12-31 18:49
319 * @param entity
320 * @param rqVO
321 * @return void
322 */
323 private void afterSave(MfServicerMaintain entity, ServicerMaintainRQVO rqVO) {
324 //region 1.输出特殊转换
325
326 //region 1.1.输出过滤与补充处理
327 //endregion 1.1.输出过滤与补充处理
328
329 //endregion 1.输出特殊转换
330 }
331
332 /**
333 * 服务商维护修改前置校验、处理
334 * @author xcq
335 * @date 2024-12-31 18:49
336 * @param rqVO
337 * @return void
338 */
339 private void beforeUpdate(ServicerMaintainRQVO rqVO) {
340 //region 1.输入基础验证
341 if (StringUtils.isBlank(rqVO.getGuid())) {
342 // W00012 = {0}:参数[{1}]不能为空!
343 throw new CsbrSystemException(SystemError.DATA_INPUT_ERROR, messageSourceUtil.getMessage("W00010", String.format("修改%s数据",FUNCTION_NAME), "数据唯一标识"));
344 }
345 //endregion
346
347 //region 2.数据验证特殊处理
348 //region 2.1.业务合规性验证
349 //endregion 2.1.业务合规性验证
350
351 //region 2.2.业务数据验证
352 LambdaQueryWrapper<MfServicerMaintain> queryWrapper = new LambdaQueryWrapper<>();
353 queryWrapper.eq(MfServicerMaintain::getGuid, rqVO.getGuid());
354 queryWrapper.select(MfServicerMaintain::getGuid, MfServicerMaintain::getBizApproveState);
355 MfServicerMaintain entity = mfServicerMaintainService.getOne(queryWrapper);
356 if (entity == null) {
357 throw new CsbrSystemException(SystemError.DATA_NOT_EXISTS, messageSourceUtil.notExistsToUpdateMessage(FUNCTION_NAME));
358 }
359 //endregion 2.2.业务数据验证
360
361 //endregion 2.数据验证特殊处理
362
363 //region 3.数据转换处理
364
365 //region 3.1.数据过程转换
366 rqVO.setBizApproveState(entity.getBizApproveState());
367 //endregion 3.1.数据过程转换
368
369 //endregion 3.数据转换处理
370
371 //region 4.数据过滤与补充处理
372 //endregion 4.数据过滤与补充处理
373
374 //region 5.过程处理
375
376 //region 5.1.计算逻辑处理
377 //endregion 5.1.计算逻辑处理
378
379 //region 5.2.业务逻辑处理
380 //endregion 5.2.业务逻辑处理
381
382 //endregion 5.过程处理
383 }
384
385 /**
386 * 服务商维护修改后置处理
387 * @author xcq
388 * @date 2024-12-31 18:49
389 * @param entity
390 * @param rqVO
391 * @return void
392 */
393 protected void afterUpdate(MfServicerMaintain entity, ServicerMaintainRQVO rqVO) {
394 //region 1.输出特殊转换
395
396 //region 1.1.输出过滤与补充处理
397 //endregion 1.1.输出过滤与补充处理
398
399 //endregion 1.输出特殊转换
400 }
401
402
403 /**
404 * 服务商维护删除前置处理
405 * @author xcq
406 * @date 2024-12-31 18:49
407 * @param entity
408 * @return void
409 */
410 private void beforeRemove(MfServicerMaintain entity) {
411 if (entity == null) {
412 throw new CsbrSystemException(SystemError.DATA_DEL_ERROR, messageSourceUtil.notExistsToDelMessage(FUNCTION_NAME));
413 }
414 if (ApprovalStateEnum.CHECKING.getValue().equals(entity.getBizApproveState()) ||
415 ApprovalStateEnum.PASSED.getValue().equals(entity.getBizApproveState())) {
416 throw new CsbrSystemException(SystemError.DATA_DEL_ERROR, "审批中和审批通过的数据不能删除!");
417 }
418 }
419
420 /**
421 * 服务商维护删除后置处理
422 * @author xcq
423 * @date 2024-12-31 18:49
424 * @param entity
425 * @return void
426 */
427 private void afterRemove(MfServicerMaintain entity) {
428
429 }
430
431 /**
432 * 服务商维护查询方法前置验证、处理
433 * @author xcq
434 * @date 2024-12-31 18:49
435 * @param rqQueryVO
436 * @return void
437 */
438 private void beforeQuery(ServicerMaintainQueryVO rqQueryVO) {
439 rqQueryVO.setIsNeedQuery(true);
440 if (approvalFlowUtil.isQueryBizGuid(rqQueryVO)) {
441 rqQueryVO.setFlowType(FLOW_TYPE);
442 List<String> bizGuidList = approvalFlowUtil.getApprovalBizGuids(rqQueryVO);
443 if (CollectionUtils.isEmpty(bizGuidList)) {
444 rqQueryVO.setIsNeedQuery(false);
445 } else {
446 rqQueryVO.setGuidList(bizGuidList);
447 }
448 }
449 }
450
451 /**
452 * 服务商维护查询方法后置数据转换、处理
453 * @author xcq
454 * @date 2024-12-31 18:49
455 * @param pageList 数据库查询数据
456 * @param rsPageList 返回的最终数据
457 * @return void
458 */
459 private void afterQuery(PageListVO<MfServicerMaintain> pageList, PageListVO<ServicerMaintainRSVO> rsPageList) {
460 if (CollectionUtils.isNotEmpty(pageList.getRecords())) {
461 rsPageList.setRecords(convertToVO(pageList.getRecords()));
462 }
463 // 需要特殊处理数据时使用
464 /*if(CollectionUtils.isNotEmpty(pageList.getRecords())){
465 List<ServicerMaintainRSVO> results = new ArrayList<>();
466 for (MfServicerMaintain item : pageList.getRecords()){
467 ServicerMaintainRSVO vo = convertToVO(item);
468 results.add(vo);
469 }
470 rsPageList.setRecords(results);
471 }*/
472 }
473
474 //region 辅助操作
475
476 /**
477 * 服务商维护实体数据转换为视图对象数据(多个)
478 * @author xcq
479 * @date 2024-12-31 18:49
480 * @param entityList 实体数据列表
481 * @return java.util.List<com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO> 视图对象列表
482 */
483 private List<ServicerMaintainRSVO> convertToVO(List<MfServicerMaintain> entityList) {
484 if (CollectionUtils.isEmpty(entityList)) {
485 // W00012 = {0}:参数[{1}]不能为空!
486 throw new CsbrSystemException(SystemError.DATA_INPUT_ERROR, messageSourceUtil.getMessage("W00012",
487 "实体数据转换为视图对象实体数据", "实体数据"));
488 }
489 List<ServicerMaintainRSVO> voList = new ArrayList<>(entityList.size());
490 for (MfServicerMaintain item : entityList) {
491 ServicerMaintainRSVO vo = convertToVO(item);
492 voList.add(vo);
493 }
494 return voList;
495 }
496
497 /**
498 * 服务商维护实体数据转换为视图对象数据
499 * @author xcq
500 * @date 2024-12-31 18:49
501 * @param entity
502 * @return com.csbr.qingcloud.portal.domain.vo.ServicerMaintainRSVO
503 */
504 private ServicerMaintainRSVO convertToVO(MfServicerMaintain entity) {
505 ServicerMaintainRSVO vo = csbrBeanUtil.convert(entity, ServicerMaintainRSVO.class);
506 //流程数据处理
507 vo.setApproveVO(approvalFlowUtil.getApprovalInfo(entity.getGuid()));
508 return vo;
509 }
510
511 /**
512 * 服务商维护新增、修改和其他情况的参数转换为实体
513 * @author xcq
514 * @date 2024-12-31 18:49
515 * @param vo
516 * @return com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintain
517 */
518 private MfServicerMaintain convertToEntity(ServicerMaintainRQVO vo) {
519 MfServicerMaintain entity = csbrBeanUtil.convert(vo, MfServicerMaintain.class);
520 // 新增时数据默认guid赋值,转换后该guid可能别使用
521 if (StringUtils.isBlank(vo.getGuid())) {
522 entity.setGuid(CommonUtil.newGuid());
523 }
524 return entity;
525 }
526
527 //endregion
528
529 }
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!