|  | @@ -0,0 +1,793 @@
 | 
												
													
														
															|  | 
 |  | +package com.jeeplus.ccpm.approvalInfo.service;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +import cn.hutool.core.util.ObjectUtil;
 | 
												
													
														
															|  | 
 |  | +import cn.hutool.extra.spring.SpringUtil;
 | 
												
													
														
															|  | 
 |  | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
												
													
														
															|  | 
 |  | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
												
													
														
															|  | 
 |  | +import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
												
													
														
															|  | 
 |  | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 | 
												
													
														
															|  | 
 |  | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.ccpm.approvalInfo.domain.*;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.ccpm.approvalInfo.mapper.*;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.ccpm.approvalInfo.service.dto.*;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.ccpm.approvalType.service.CcpmReimbursementTypeService;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.common.TokenProvider;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.core.query.QueryWrapperGenerator;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.domain.WorkAttachmentInfo;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.feign.IDictApi;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.feign.IOfficeApi;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.feign.IUserApi;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.feign.IWorkAttachmentApi;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.service.dto.OfficeDTO;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.sys.service.dto.UserDTO;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.utils.StringUtils;
 | 
												
													
														
															|  | 
 |  | +import org.springframework.beans.BeanUtils;
 | 
												
													
														
															|  | 
 |  | +import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +import javax.annotation.Resource;
 | 
												
													
														
															|  | 
 |  | +import java.util.ArrayList;
 | 
												
													
														
															|  | 
 |  | +import java.util.Date;
 | 
												
													
														
															|  | 
 |  | +import java.util.List;
 | 
												
													
														
															|  | 
 |  | +import java.util.UUID;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +//import com.jeeplus.finance.contractRegistration.service.ContractInfoService;
 | 
												
													
														
															|  | 
 |  | +//import com.jeeplus.finance.reimbursementApproval.approvalInfo.service.dto.QueryListDto;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +/**
 | 
												
													
														
															|  | 
 |  | + * @author: 王强
 | 
												
													
														
															|  | 
 |  | + * @create: 2022-11-24 16:11
 | 
												
													
														
															|  | 
 |  | + **/
 | 
												
													
														
															|  | 
 |  | +@Service
 | 
												
													
														
															|  | 
 |  | +public class CcpmReimbursementInfoService {
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementInfoMapper infoMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementDetailInfoContractMapper zsReimbursementDetailInfoContractMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementDetailInfoReportMapper zsReimbursementDetailInfoReportMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementDetailInfoOtherMapper zsReimbursementDetailInfoOtherMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementDetailInfoProcuredMapper zsReimbursementDetailInfoProcuredMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementDetailInfoMapper detailInfoMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementAmountInfoMapper amountInfoMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +//    @Resource
 | 
												
													
														
															|  | 
 |  | +//    private OssServiceMapper ossServiceMapper;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +//    @Resource
 | 
												
													
														
															|  | 
 |  | +//    private SerialnumTplService serialnumTplService;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +//    @Resource
 | 
												
													
														
															|  | 
 |  | +//    private ContractInfoService infoService;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +   /* @Resource
 | 
												
													
														
															|  | 
 |  | +    private MaterialBasicMapper materialBasicMapper;*/
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +//    @Resource
 | 
												
													
														
															|  | 
 |  | +//    private OfficeService officeService;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Resource
 | 
												
													
														
															|  | 
 |  | +    private CcpmReimbursementTypeService typeService;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /**
 | 
												
													
														
															|  | 
 |  | +     * 报告号查询
 | 
												
													
														
															|  | 
 |  | +     */
 | 
												
													
														
															|  | 
 |  | +    public IPage<CcpmReportNoDto> getReportNoList(Page<CcpmReportNoDto> page , CcpmReportNoDto dto) throws Exception{
 | 
												
													
														
															|  | 
 |  | +        QueryWrapper<CcpmReportNoDto> queryWrapper = QueryWrapperGenerator.buildQueryCondition(dto, CcpmReportNoDto.class);
 | 
												
													
														
															|  | 
 |  | +        /**
 | 
												
													
														
															|  | 
 |  | +         * a表是reimbursementInfo
 | 
												
													
														
															|  | 
 |  | +         * b表是reimbursementDetailInfo
 | 
												
													
														
															|  | 
 |  | +         * c表是sysUser
 | 
												
													
														
															|  | 
 |  | +         */
 | 
												
													
														
															|  | 
 |  | +        queryWrapper.eq("a.del_flag", 0);
 | 
												
													
														
															|  | 
 |  | +        queryWrapper.eq("c.id", dto.getProjectId());
 | 
												
													
														
															|  | 
 |  | +        return infoMapper.getReportNoList(page, queryWrapper);
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /**
 | 
												
													
														
															|  | 
 |  | +     * 列表查询
 | 
												
													
														
															|  | 
 |  | +     */
 | 
												
													
														
															|  | 
 |  | +    public IPage<CcpmRetureListDto> list(Page<CcpmRetureListDto> page , CcpmQueryListDto dto) throws Exception{
 | 
												
													
														
															|  | 
 |  | +        QueryWrapper<CcpmQueryListDto> queryWrapper = QueryWrapperGenerator.buildQueryCondition(dto, CcpmQueryListDto.class);
 | 
												
													
														
															|  | 
 |  | +        /**
 | 
												
													
														
															|  | 
 |  | +         * a表是reimbursementInfo
 | 
												
													
														
															|  | 
 |  | +         * b表是reimbursementDetailInfo
 | 
												
													
														
															|  | 
 |  | +         * c表是sysUser
 | 
												
													
														
															|  | 
 |  | +         */
 | 
												
													
														
															|  | 
 |  | +        queryWrapper.eq("a.del_flag", 0);
 | 
												
													
														
															|  | 
 |  | +        // 报销项目
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getProject())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("(b.project_id = {0} OR p.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("(b3.project_id = {0} OR p3.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("(b4.project_id = {0} OR b4.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("(b5.project_id = {0} OR b5.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销时间
 | 
												
													
														
															|  | 
 |  | +        if (dto.getDates() != null) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.between("a.reim_date", dto.getDates()[0], dto.getDates()[1]);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 经办人
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getHandled())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("(a.create_by_id = {0} OR c.name LIKE {1})", dto.getHandled(), "%" + dto.getHandled() + "%");
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销人
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getReimBy())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("( b.user_id = {0} OR us.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b2.user_id = {0} OR us2.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b3.user_id = {0} OR us3.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b4.user_id = {0} OR us4.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b5.user_id = {0} OR us5.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销状态
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.eq("a.type", dto.getType());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销部门
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getDepartment())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("( b.dept_id = {0} OR so.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b2.dept_id = {0} OR so2.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b3.dept_id = {0} OR so3.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b4.dept_id = {0} OR so4.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b5.dept_id = {0} OR so5.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销类别
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getRemiType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply(" (b.type_id = {0} OR t.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b2.type_id = {0} OR t2.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b3.type_id = {0} OR t3.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b4.type_id = {0} OR t4.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b5.type_id = {0} OR t5.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销金额
 | 
												
													
														
															|  | 
 |  | +        if (dto.getAmounts() != null) {
 | 
												
													
														
															|  | 
 |  | +            if (StringUtils.isNotEmpty(dto.getAmounts()[0])) {
 | 
												
													
														
															|  | 
 |  | +                queryWrapper.and(w ->
 | 
												
													
														
															|  | 
 |  | +                    w.ge("b.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                        .or().ge("b2.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                        .or().ge("b3.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                        .or().ge("b4.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                        .or().ge("b5.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                );
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +            if (StringUtils.isNotEmpty(dto.getAmounts()[1])) {
 | 
												
													
														
															|  | 
 |  | +                queryWrapper.and(w ->
 | 
												
													
														
															|  | 
 |  | +                    w.le("b.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                        .or().le("b2.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                        .or().le("b3.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                        .or().le("b4.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                        .or().le("b5.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                );
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报告号
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getReportNumber())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.like("b.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b2.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b3.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b4.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b5.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销类型
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotBlank(dto.getSourceType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.eq("a.source_type", dto.getSourceType());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销项状态
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getReimbursementType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.eq("a.reimbursement_type", dto.getReimbursementType());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        /*//获取当前登录人信息
 | 
												
													
														
															|  | 
 |  | +        UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken ( ));
 | 
												
													
														
															|  | 
 |  | +        //获取当前登录人所属角色
 | 
												
													
														
															|  | 
 |  | +        //若是中审部门主任,则仅展示部门主任信息
 | 
												
													
														
															|  | 
 |  | +        //若是中审员工,则仅展示自己的数据信息
 | 
												
													
														
															|  | 
 |  | +        List<RoleDTO> roleDTOList = userDTO.getRoleDTOList();
 | 
												
													
														
															|  | 
 |  | +        for (RoleDTO roleDTO : roleDTOList) {
 | 
												
													
														
															|  | 
 |  | +            //根据角色id查询角色信息
 | 
												
													
														
															|  | 
 |  | +            RoleDTO roleDTOById = SpringUtil.getBean(IRoleApi.class).getRoleDTOById(roleDTO.getId());
 | 
												
													
														
															|  | 
 |  | +            if("zsyg".equals(roleDTOById.getEnName()) && "中审员工".equals(roleDTOById.getName())){
 | 
												
													
														
															|  | 
 |  | +                queryWrapper.eq("a.create_by_id", userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                break;
 | 
												
													
														
															|  | 
 |  | +            }else if("zsbmzr".equals(roleDTOById.getEnName()) && "中审部门主任".equals(roleDTOById.getName())){
 | 
												
													
														
															|  | 
 |  | +                queryWrapper.eq("c.office_id", userDTO.getOfficeDTO().getId());
 | 
												
													
														
															|  | 
 |  | +                break;
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }*/
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        return infoMapper.findList(page, queryWrapper);
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public IPage<CcpmProgramProjectListInfo> projectList(Page<CcpmProgramProjectListInfo> page, CcpmProgramProjectListInfo info, String tabType) throws Exception{
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        //获取当前登录人信息
 | 
												
													
														
															|  | 
 |  | +        UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken());
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        QueryWrapper<CcpmProgramProjectListInfo> wrapper = QueryWrapperGenerator.buildQueryCondition(info, CcpmProgramProjectListInfo.class);
 | 
												
													
														
															|  | 
 |  | +        wrapper.eq("a.del_flag", "0");
 | 
												
													
														
															|  | 
 |  | +        wrapper.eq("a.tab_type", tabType);
 | 
												
													
														
															|  | 
 |  | +        wrapper.eq("b.office_id", userDTO.getOfficeDTO().getId());
 | 
												
													
														
															|  | 
 |  | +        if (info.getCreateDates() != null) {
 | 
												
													
														
															|  | 
 |  | +            wrapper.between("a.create_date", info.getCreateDates()[0], info.getCreateDates()[1]);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        IPage<CcpmProgramProjectListInfo> pageList = infoMapper.findProjectList(page, wrapper);
 | 
												
													
														
															|  | 
 |  | +        pageList.getRecords().stream().forEach(item ->{
 | 
												
													
														
															|  | 
 |  | +            String isInvoice = infoMapper.selectInvoiceFlag(item.getId());
 | 
												
													
														
															|  | 
 |  | +            item.setIsInvoice(isInvoice);
 | 
												
													
														
															|  | 
 |  | +        });
 | 
												
													
														
															|  | 
 |  | +        return pageList;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public CcpmReimbursementInfo save(CcpmSaveInfoDto dto) throws Exception{
 | 
												
													
														
															|  | 
 |  | +        // 获取当前登录人信息
 | 
												
													
														
															|  | 
 |  | +      UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken());
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getId())) {
 | 
												
													
														
															|  | 
 |  | +            return update(dto, userDTO);
 | 
												
													
														
															|  | 
 |  | +        } else {
 | 
												
													
														
															|  | 
 |  | +            return add(dto, userDTO);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public CcpmReimbursementInfo add(CcpmSaveInfoDto dto, UserDTO userDTO) throws Exception{
 | 
												
													
														
															|  | 
 |  | +        // 生成id
 | 
												
													
														
															|  | 
 |  | +        String id = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  | +        // 生成编号
 | 
												
													
														
															|  | 
 |  | +        String no = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), CcpmSaveInfoDto.BIZ_CODE,TokenProvider.getCurrentToken());
 | 
												
													
														
															|  | 
 |  | +        // 保存基础信息表信息
 | 
												
													
														
															|  | 
 |  | +        CcpmReimbursementInfo info = new CcpmReimbursementInfo();
 | 
												
													
														
															|  | 
 |  | +        BeanUtils.copyProperties(dto, info);
 | 
												
													
														
															|  | 
 |  | +        info.setId(id);
 | 
												
													
														
															|  | 
 |  | +        info.setNo(no);
 | 
												
													
														
															|  | 
 |  | +        info.setCreateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +        info.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +        info.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +        info.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +        info.setDelFlag(0);
 | 
												
													
														
															|  | 
 |  | +        infoMapper.insert(info);
 | 
												
													
														
															|  | 
 |  | +        // 保存项目详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfos())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfo detailInfo : dto.getDetailInfos()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                detailInfoMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存合同详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoContracts())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoContract detailInfo : dto.getDetailInfoContracts()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoContractMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存报告详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoReports())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoReport detailInfo : dto.getDetailInfoReports()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoReportMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存其他报销详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoOthers())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoOther detailInfo : dto.getDetailInfoOthers()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoOtherMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存采购报销详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoProcured())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoProcured detailInfo : dto.getDetailInfoProcured()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoProcuredMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        if(StringUtils.isNotBlank(dto.getReimbursementType())){
 | 
												
													
														
															|  | 
 |  | +            if("0".equals(dto.getReimbursementType())){
 | 
												
													
														
															|  | 
 |  | +                // 保存专用发票列表信息
 | 
												
													
														
															|  | 
 |  | +                if (CollectionUtils.isNotEmpty(dto.getAmountInfos())) {
 | 
												
													
														
															|  | 
 |  | +                    for (CcpmReimbursementAmountInfo amountInfo : dto.getAmountInfos()) {
 | 
												
													
														
															|  | 
 |  | +                        //普通报销 发票信息
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setReimbursementType("0");
 | 
												
													
														
															|  | 
 |  | +                        // 生成id
 | 
												
													
														
															|  | 
 |  | +                        String amountId = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setId(amountId);
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setDelFlag(0);
 | 
												
													
														
															|  | 
 |  | +                        // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                        amountInfoMapper.insert(amountInfo);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                //清除电子发票信息
 | 
												
													
														
															|  | 
 |  | +                // 删除合同列表
 | 
												
													
														
															|  | 
 |  | +                LambdaQueryWrapper<CcpmReimbursementAmountInfo> deleteInfo = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.eq(CcpmReimbursementAmountInfo::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.ne(CcpmReimbursementAmountInfo::getReimbursementType, "0");
 | 
												
													
														
															|  | 
 |  | +                amountInfoMapper.delete(deleteInfo);
 | 
												
													
														
															|  | 
 |  | +            }else if("1".equals(dto.getReimbursementType())){
 | 
												
													
														
															|  | 
 |  | +                // 保存电子发票列表信息
 | 
												
													
														
															|  | 
 |  | +                if (CollectionUtils.isNotEmpty(dto.getInvoiceReimbursements())) {
 | 
												
													
														
															|  | 
 |  | +                    for (CcpmReimbursementAmountInfo amountInfo : dto.getInvoiceReimbursements()) {
 | 
												
													
														
															|  | 
 |  | +                        //电子发票报销 发票信息
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setReimbursementType("1");
 | 
												
													
														
															|  | 
 |  | +                        // 生成id
 | 
												
													
														
															|  | 
 |  | +                        String amountId = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setId(amountId);
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setDelFlag(0);
 | 
												
													
														
															|  | 
 |  | +                        // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setInfoId(id);
 | 
												
													
														
															|  | 
 |  | +                        amountInfoMapper.insert(amountInfo);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                //清除专用发票信息
 | 
												
													
														
															|  | 
 |  | +                LambdaQueryWrapper<CcpmReimbursementAmountInfo> deleteInfo = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.eq(CcpmReimbursementAmountInfo::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.ne(CcpmReimbursementAmountInfo::getReimbursementType, "1");
 | 
												
													
														
															|  | 
 |  | +                amountInfoMapper.delete(deleteInfo);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                // 保存电子发票附件列表信息
 | 
												
													
														
															|  | 
 |  | +                if (CollectionUtils.isNotEmpty(dto.getInvoiceReimbursementFiles())) {
 | 
												
													
														
															|  | 
 |  | +                    typeService.saveFiles(dto.getInvoiceReimbursementFiles(), userDTO, id,"invoiceReimbursement");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存附件列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getFiles())) {
 | 
												
													
														
															|  | 
 |  | +            typeService.saveFiles(dto.getFiles(), userDTO, id);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return info;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public CcpmReimbursementInfo update(CcpmSaveInfoDto dto, UserDTO userDTO) {
 | 
												
													
														
															|  | 
 |  | +        // 修改基础信息
 | 
												
													
														
															|  | 
 |  | +        CcpmReimbursementInfo info = new CcpmReimbursementInfo();
 | 
												
													
														
															|  | 
 |  | +        BeanUtils.copyProperties(dto, info);
 | 
												
													
														
															|  | 
 |  | +        info.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +        info.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +        infoMapper.updateById(info);
 | 
												
													
														
															|  | 
 |  | +        // 修改报销详情列表信息
 | 
												
													
														
															|  | 
 |  | +        // 删除原有数据
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfo> detailWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapper.eq(CcpmReimbursementDetailInfo::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        detailInfoMapper.delete(detailWrapper);
 | 
												
													
														
															|  | 
 |  | +        // 删除合同列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoContract> detailWrapperContract = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperContract.eq(CcpmReimbursementDetailInfoContract::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoContractMapper.delete(detailWrapperContract);
 | 
												
													
														
															|  | 
 |  | +        // 删除报告列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoReport> detailWrapperReport = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperReport.eq(CcpmReimbursementDetailInfoReport::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoReportMapper.delete(detailWrapperReport);
 | 
												
													
														
															|  | 
 |  | +        // 删除其他报销表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoOther> detailWrapperOthers = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperOthers.eq(CcpmReimbursementDetailInfoOther::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoOtherMapper.delete(detailWrapperOthers);
 | 
												
													
														
															|  | 
 |  | +        // 删除采购报销表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoProcured> detailWrapperProcured = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperProcured.eq(CcpmReimbursementDetailInfoProcured::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoProcuredMapper.delete(detailWrapperProcured);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        // 保存项目详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfos())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfo detailInfo : dto.getDetailInfos()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setId("");
 | 
												
													
														
															|  | 
 |  | +                detailInfoMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存合同详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoContracts())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoContract detailInfo : dto.getDetailInfoContracts()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setId("");
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoContractMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存报告详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoReports())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoReport detailInfo : dto.getDetailInfoReports()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setId("");
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoReportMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存其他报销详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoOthers())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoOther detailInfo : dto.getDetailInfoOthers()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setId("");
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoOtherMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 保存采购报销详情列表信息
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getDetailInfoProcured())) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmReimbursementDetailInfoProcured detailInfo : dto.getDetailInfoProcured()) {
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                detailInfo.setId("");
 | 
												
													
														
															|  | 
 |  | +                zsReimbursementDetailInfoProcuredMapper.insert(detailInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 修改专用发票信息列表
 | 
												
													
														
															|  | 
 |  | +        // 删除原有数据
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementAmountInfo> amountWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        amountWrapper.eq(CcpmReimbursementAmountInfo::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        amountInfoMapper.delete(amountWrapper);
 | 
												
													
														
															|  | 
 |  | +        if(StringUtils.isNotBlank(dto.getReimbursementType())){
 | 
												
													
														
															|  | 
 |  | +            if("0".equals(dto.getReimbursementType())){
 | 
												
													
														
															|  | 
 |  | +                // 保存专用发票列表信息
 | 
												
													
														
															|  | 
 |  | +                if (CollectionUtils.isNotEmpty(dto.getAmountInfos())) {
 | 
												
													
														
															|  | 
 |  | +                    for (CcpmReimbursementAmountInfo amountInfo : dto.getAmountInfos()) {
 | 
												
													
														
															|  | 
 |  | +                        //普通报销 发票信息
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setReimbursementType("0");
 | 
												
													
														
															|  | 
 |  | +                        // 生成id
 | 
												
													
														
															|  | 
 |  | +                        String amountId = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setId(amountId);
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setDelFlag(0);
 | 
												
													
														
															|  | 
 |  | +                        // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfoMapper.insert(amountInfo);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                //清除电子发票信息
 | 
												
													
														
															|  | 
 |  | +                // 删除合同列表
 | 
												
													
														
															|  | 
 |  | +                LambdaQueryWrapper<CcpmReimbursementAmountInfo> deleteInfo = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.eq(CcpmReimbursementAmountInfo::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.ne(CcpmReimbursementAmountInfo::getReimbursementType, "0");
 | 
												
													
														
															|  | 
 |  | +                amountInfoMapper.delete(deleteInfo);
 | 
												
													
														
															|  | 
 |  | +            }else if("1".equals(dto.getReimbursementType())){
 | 
												
													
														
															|  | 
 |  | +                // 保存电子发票列表信息
 | 
												
													
														
															|  | 
 |  | +                if (CollectionUtils.isNotEmpty(dto.getInvoiceReimbursements())) {
 | 
												
													
														
															|  | 
 |  | +                    for (CcpmReimbursementAmountInfo amountInfo : dto.getInvoiceReimbursements()) {
 | 
												
													
														
															|  | 
 |  | +                        //电子发票报销 发票信息
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setReimbursementType("1");
 | 
												
													
														
															|  | 
 |  | +                        // 生成id
 | 
												
													
														
															|  | 
 |  | +                        String amountId = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setId(amountId);
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setDelFlag(0);
 | 
												
													
														
															|  | 
 |  | +                        // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                        amountInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                        amountInfoMapper.insert(amountInfo);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                //清除专用发票信息
 | 
												
													
														
															|  | 
 |  | +                LambdaQueryWrapper<CcpmReimbursementAmountInfo> deleteInfo = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.eq(CcpmReimbursementAmountInfo::getInfoId, dto.getId());
 | 
												
													
														
															|  | 
 |  | +                deleteInfo.ne(CcpmReimbursementAmountInfo::getReimbursementType, "1");
 | 
												
													
														
															|  | 
 |  | +                amountInfoMapper.delete(deleteInfo);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                // 保存电子发票附件列表信息
 | 
												
													
														
															|  | 
 |  | +                if (CollectionUtils.isNotEmpty(dto.getInvoiceReimbursementFiles())) {
 | 
												
													
														
															|  | 
 |  | +                    typeService.updateFiles(dto.getInvoiceReimbursementFiles(), userDTO, dto.getId(),"invoiceReimbursement");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        /*if (CollectionUtils.isNotEmpty(dto.getAmountInfos())) {
 | 
												
													
														
															|  | 
 |  | +            for (ZsReimbursementAmountInfo amountInfo : dto.getAmountInfos()) {
 | 
												
													
														
															|  | 
 |  | +                // 生成id
 | 
												
													
														
															|  | 
 |  | +                String amountId = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setId(amountId);
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setCreateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setUpdateById(userDTO.getId());
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setDelFlag(0);
 | 
												
													
														
															|  | 
 |  | +                // 保存基础表信息主键值
 | 
												
													
														
															|  | 
 |  | +                amountInfo.setInfoId(dto.getId());
 | 
												
													
														
															|  | 
 |  | +                amountInfoMapper.insert(amountInfo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }*/
 | 
												
													
														
															|  | 
 |  | +        // 修改附件信息列表
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(dto.getFiles())) {
 | 
												
													
														
															|  | 
 |  | +            typeService.updateFiles(dto.getFiles(), userDTO, dto.getId());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return info;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public String remove(String id) {
 | 
												
													
														
															|  | 
 |  | +        // 删除基础信息表
 | 
												
													
														
															|  | 
 |  | +        infoMapper.deleteById(id);
 | 
												
													
														
															|  | 
 |  | +        // 删除详情列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfo> detailWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapper.eq(CcpmReimbursementDetailInfo::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +        detailInfoMapper.delete(detailWrapper);
 | 
												
													
														
															|  | 
 |  | +        // 删除合同列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoContract> detailWrapperContract = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperContract.eq(CcpmReimbursementDetailInfoContract::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoContractMapper.delete(detailWrapperContract);
 | 
												
													
														
															|  | 
 |  | +        // 删除报告列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoReport> detailWrapperReport = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperReport.eq(CcpmReimbursementDetailInfoReport::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoReportMapper.delete(detailWrapperReport);
 | 
												
													
														
															|  | 
 |  | +        // 删除其他报销列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoOther> detailWrapperOther = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperOther.eq(CcpmReimbursementDetailInfoOther::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoOtherMapper.delete(detailWrapperOther);
 | 
												
													
														
															|  | 
 |  | +        // 删除采购报销列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementDetailInfoProcured> detailWrapperProcured = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        detailWrapperProcured.eq(CcpmReimbursementDetailInfoProcured::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +        zsReimbursementDetailInfoProcuredMapper.delete(detailWrapperProcured);
 | 
												
													
														
															|  | 
 |  | +        // 删除专用发票信息列表
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementAmountInfo> amountInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        amountInfoLambdaQueryWrapper.eq(CcpmReimbursementAmountInfo::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +        amountInfoMapper.delete(amountInfoLambdaQueryWrapper);
 | 
												
													
														
															|  | 
 |  | +        // 删除附件信息
 | 
												
													
														
															|  | 
 |  | +//        LambdaQueryWrapper<WorkAttachmentInfo> wrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +//        wrapper.eq(WorkAttachmentInfo::getAttachmentId, id);
 | 
												
													
														
															|  | 
 |  | +        SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(id);
 | 
												
													
														
															|  | 
 |  | +        return "操作成功";
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public CcpmSaveInfoDto findById(String id) {
 | 
												
													
														
															|  | 
 |  | +        CcpmSaveInfoDto dto = new CcpmSaveInfoDto();
 | 
												
													
														
															|  | 
 |  | +        // 查询基础信息表
 | 
												
													
														
															|  | 
 |  | +        CcpmReimbursementInfo info = infoMapper.selectById(id);
 | 
												
													
														
															|  | 
 |  | +        if (ObjectUtil.isNotEmpty(info)){
 | 
												
													
														
															|  | 
 |  | +            BeanUtils.copyProperties(info, dto);
 | 
												
													
														
															|  | 
 |  | +            if(StringUtils.isNotBlank(info.getDepartment())) {
 | 
												
													
														
															|  | 
 |  | +                OfficeDTO byId = SpringUtil.getBean ( IOfficeApi.class ).getOfficeById(info.getDepartment());
 | 
												
													
														
															|  | 
 |  | +                if (ObjectUtil.isNotEmpty(byId)) {
 | 
												
													
														
															|  | 
 |  | +                    dto.setDepartmentName(byId.getName());
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            // 查询详情列表
 | 
												
													
														
															|  | 
 |  | +//        LambdaQueryWrapper<ZsReimbursementDetailInfo> detailInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +//        detailInfoLambdaQueryWrapper.eq(ZsReimbursementDetailInfo::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +//        detailInfoLambdaQueryWrapper.orderByAsc(ZsReimbursementDetailInfo::getNumber);
 | 
												
													
														
															|  | 
 |  | +//        List<ZsReimbursementDetailInfo> detailInfos = detailInfoMapper.selectList(detailInfoLambdaQueryWrapper);
 | 
												
													
														
															|  | 
 |  | +            // 项目报销详情
 | 
												
													
														
															|  | 
 |  | +            dto.setDetailInfos(infoMapper.getDetailList(id));
 | 
												
													
														
															|  | 
 |  | +            // 合同报销详情
 | 
												
													
														
															|  | 
 |  | +            dto.setDetailInfoContracts(infoMapper.getContractDetailList(id));
 | 
												
													
														
															|  | 
 |  | +            // 报告报销详情
 | 
												
													
														
															|  | 
 |  | +            dto.setDetailInfoReports(infoMapper.getReportDetailList(id));
 | 
												
													
														
															|  | 
 |  | +            // 其他报销
 | 
												
													
														
															|  | 
 |  | +            dto.setDetailInfoOthers(infoMapper.getOtherDetailList(id));
 | 
												
													
														
															|  | 
 |  | +            // 采购报销
 | 
												
													
														
															|  | 
 |  | +            dto.setDetailInfoProcured(infoMapper.getProcuredDetailList(id));
 | 
												
													
														
															|  | 
 |  | +            // 查询专用发票信息列表
 | 
												
													
														
															|  | 
 |  | +            LambdaQueryWrapper<CcpmReimbursementAmountInfo> amountInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +            amountInfoLambdaQueryWrapper.eq(CcpmReimbursementAmountInfo::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +            amountInfoLambdaQueryWrapper.eq(CcpmReimbursementAmountInfo::getReimbursementType, "0");
 | 
												
													
														
															|  | 
 |  | +            List<CcpmReimbursementAmountInfo> amountInfos = amountInfoMapper.selectList(amountInfoLambdaQueryWrapper);
 | 
												
													
														
															|  | 
 |  | +            dto.setAmountInfos(amountInfos);
 | 
												
													
														
															|  | 
 |  | +            LambdaQueryWrapper<CcpmReimbursementAmountInfo> invoiceReimbursementsLambdaQueryWrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +            invoiceReimbursementsLambdaQueryWrapper.eq(CcpmReimbursementAmountInfo::getInfoId, id);
 | 
												
													
														
															|  | 
 |  | +            invoiceReimbursementsLambdaQueryWrapper.eq(CcpmReimbursementAmountInfo::getReimbursementType, "1");
 | 
												
													
														
															|  | 
 |  | +            List<CcpmReimbursementAmountInfo> invoiceReimbursements = amountInfoMapper.selectList(invoiceReimbursementsLambdaQueryWrapper);
 | 
												
													
														
															|  | 
 |  | +            dto.setInvoiceReimbursements(invoiceReimbursements);
 | 
												
													
														
															|  | 
 |  | +            // 查询附件信息
 | 
												
													
														
															|  | 
 |  | +            List<WorkAttachmentInfo> fileList = infoMapper.findFiles(id);
 | 
												
													
														
															|  | 
 |  | +            List<WorkAttachmentInfo> files = com.google.common.collect.Lists.newArrayList();
 | 
												
													
														
															|  | 
 |  | +            List<WorkAttachmentInfo> invoiceReimbursementFiles = com.google.common.collect.Lists.newArrayList();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            if (CollectionUtils.isNotEmpty(fileList)) {
 | 
												
													
														
															|  | 
 |  | +                for (WorkAttachmentInfo i : fileList) {
 | 
												
													
														
															|  | 
 |  | +                    i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
 | 
												
													
														
															|  | 
 |  | +                    if("invoiceReimbursement".equals(i.getAttachmentFlag())){
 | 
												
													
														
															|  | 
 |  | +                        invoiceReimbursementFiles.add(i);
 | 
												
													
														
															|  | 
 |  | +                    }else{
 | 
												
													
														
															|  | 
 |  | +                        files.add(i);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +            dto.setFiles(files);
 | 
												
													
														
															|  | 
 |  | +            dto.setInvoiceReimbursementFiles(invoiceReimbursementFiles);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return dto;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public Boolean checkNumber(String number) {
 | 
												
													
														
															|  | 
 |  | +        LambdaQueryWrapper<CcpmReimbursementAmountInfo> wrapper = new LambdaQueryWrapper<>();
 | 
												
													
														
															|  | 
 |  | +        wrapper.eq(CcpmReimbursementAmountInfo::getNumber, number);
 | 
												
													
														
															|  | 
 |  | +        List<CcpmReimbursementAmountInfo> infos = amountInfoMapper.selectList(wrapper);
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(infos)) {
 | 
												
													
														
															|  | 
 |  | +            return true;
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return false;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public void updateStatusById(CcpmRetureListDto dto) {
 | 
												
													
														
															|  | 
 |  | +        infoMapper.updateStatusById(dto.getId(), dto.getType());
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //用户树形
 | 
												
													
														
															|  | 
 |  | +    public List<CcpmTreeUserDto> userTree(String name) {
 | 
												
													
														
															|  | 
 |  | +        List<CcpmTreeUserDto> list = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | +        // 查询部门
 | 
												
													
														
															|  | 
 |  | +        List<CcpmTreeUserDto> officeList = infoMapper.findOfficeList();
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(officeList)) {
 | 
												
													
														
															|  | 
 |  | +            list.addAll(officeList);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 查询用户
 | 
												
													
														
															|  | 
 |  | +        List<CcpmTreeUserDto> userList = infoMapper.findUserList(name);
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(userList)) {
 | 
												
													
														
															|  | 
 |  | +            list.addAll(userList);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return list;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /**
 | 
												
													
														
															|  | 
 |  | +     * 下载列表查询
 | 
												
													
														
															|  | 
 |  | +     */
 | 
												
													
														
															|  | 
 |  | +    public List<CcpmRetureListDto> exportList(CcpmQueryListDto dto) throws Exception{
 | 
												
													
														
															|  | 
 |  | +        QueryWrapper<CcpmQueryListDto> queryWrapper = QueryWrapperGenerator.buildQueryCondition(dto, CcpmQueryListDto.class);
 | 
												
													
														
															|  | 
 |  | +        /**
 | 
												
													
														
															|  | 
 |  | +         * a表是reimbursementInfo
 | 
												
													
														
															|  | 
 |  | +         * b表是reimbursementDetailInfo
 | 
												
													
														
															|  | 
 |  | +         * c表是sysUser
 | 
												
													
														
															|  | 
 |  | +         */
 | 
												
													
														
															|  | 
 |  | +        queryWrapper.eq("a.del_flag", 0);
 | 
												
													
														
															|  | 
 |  | +        // 报销项目
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getProject())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("(b.project_id = {0} OR p.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("(b3.project_id = {0} OR p3.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("(b4.project_id = {0} OR b4.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("(b5.project_id = {0} OR b5.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销时间
 | 
												
													
														
															|  | 
 |  | +        if (dto.getDates() != null) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.between("a.reim_date", dto.getDates()[0], dto.getDates()[1]);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 经办人
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getHandled())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("(a.create_by_id = {0} OR c.name LIKE {1})", dto.getHandled(), "%" + dto.getHandled() + "%");
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销人
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getReimBy())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("( b.user_id = {0} OR us.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b2.user_id = {0} OR us2.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b3.user_id = {0} OR us3.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b4.user_id = {0} OR us4.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b5.user_id = {0} OR" +
 | 
												
													
														
															|  | 
 |  | +                    " us5.name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销状态
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.eq("a.type", dto.getType());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销部门
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getDepartment())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply("( b.dept_id = {0} OR so.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b2.dept_id = {0} OR so2.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b3.dept_id = {0} OR so3.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b4.dept_id = {0} OR so4.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply("( b5.dept_id = {0} OR so5.name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销类别
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getRemiType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.apply(" (b.type_id = {0} OR t.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b2.type_id = {0} OR t2.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b3.type_id = {0} OR t3.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b4.type_id = {0} OR t4.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().apply(" (b5.type_id = {0} OR t5.name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销金额
 | 
												
													
														
															|  | 
 |  | +        if (dto.getAmounts() != null) {
 | 
												
													
														
															|  | 
 |  | +            if (StringUtils.isNotEmpty(dto.getAmounts()[0])) {
 | 
												
													
														
															|  | 
 |  | +                queryWrapper.and(w ->
 | 
												
													
														
															|  | 
 |  | +                        w.ge("b.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                                .or().ge("b2.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                                .or().ge("b3.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                                .or().ge("b4.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                                .or().ge("b5.number", Double.parseDouble(dto.getAmounts()[0]))
 | 
												
													
														
															|  | 
 |  | +                );
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +            if (StringUtils.isNotEmpty(dto.getAmounts()[1])) {
 | 
												
													
														
															|  | 
 |  | +                queryWrapper.and(w ->
 | 
												
													
														
															|  | 
 |  | +                        w.le("b.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                                .or().le("b2.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                                .or().le("b3.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                                .or().le("b4.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                                .or().le("b5.number", Double.parseDouble(dto.getAmounts()[1]))
 | 
												
													
														
															|  | 
 |  | +                );
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报告号
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotEmpty(dto.getReportNumber())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.like("b.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b2.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b3.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b4.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.or().like("b5.report_number", dto.getReportNumber());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        // 报销类型
 | 
												
													
														
															|  | 
 |  | +        if (StringUtils.isNotBlank(dto.getSourceType())) {
 | 
												
													
														
															|  | 
 |  | +            queryWrapper.eq("a.source_type", dto.getSourceType());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        List<CcpmRetureListDto> exportList = infoMapper.findExportList(queryWrapper);
 | 
												
													
														
															|  | 
 |  | +        if (CollectionUtils.isNotEmpty(exportList)) {
 | 
												
													
														
															|  | 
 |  | +            for (CcpmRetureListDto retureListDto : exportList) {
 | 
												
													
														
															|  | 
 |  | +                if ("1".equals(retureListDto.getType())) {
 | 
												
													
														
															|  | 
 |  | +                    retureListDto.setType("暂存");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                if ("2".equals(retureListDto.getType())) {
 | 
												
													
														
															|  | 
 |  | +                    retureListDto.setType("审批中");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                if ("3".equals(retureListDto.getType())) {
 | 
												
													
														
															|  | 
 |  | +                    retureListDto.setType("撤回");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                if ("4".equals(retureListDto.getType())) {
 | 
												
													
														
															|  | 
 |  | +                    retureListDto.setType("驳回");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                if ("5".equals(retureListDto.getType())) {
 | 
												
													
														
															|  | 
 |  | +                    retureListDto.setType("已完成");
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                if (StringUtils.isNotBlank(retureListDto.getSourceType())) {
 | 
												
													
														
															|  | 
 |  | +                    if ("2".equals(retureListDto.getSourceType())) {
 | 
												
													
														
															|  | 
 |  | +                        retureListDto.setContractName(retureListDto.getProjectName());
 | 
												
													
														
															|  | 
 |  | +                        retureListDto.setProjectName("");
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                    retureListDto.setSourceType(SpringUtil.getBean ( IDictApi.class ).getDictLabel(retureListDto.getSourceType(),"cw_reimbursement_source_type",""));
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return exportList;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /**
 | 
												
													
														
															|  | 
 |  | +     * 关联报销
 | 
												
													
														
															|  | 
 |  | +     */
 | 
												
													
														
															|  | 
 |  | +    public IPage<CcpmRetureListDto> relationReimbursementList(Page<CcpmRetureListDto> page, String id) {
 | 
												
													
														
															|  | 
 |  | +        IPage<CcpmRetureListDto> iPage = infoMapper.relationReimbursementList(page, id);
 | 
												
													
														
															|  | 
 |  | +        return iPage;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /**
 | 
												
													
														
															|  | 
 |  | +     * 根据发票号查询是否已经或正在报销
 | 
												
													
														
															|  | 
 |  | +     * @param invoiceNumber
 | 
												
													
														
															|  | 
 |  | +     * @return
 | 
												
													
														
															|  | 
 |  | +     */
 | 
												
													
														
															|  | 
 |  | +    public Integer getEffectiveDataByInvoiceNumber(String invoiceNumber, String id){
 | 
												
													
														
															|  | 
 |  | +        return infoMapper.getEffectiveDataByInvoiceNumber(invoiceNumber, id);
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public List<CcpmReimbursementAmountInfoDTO> getInvoiceReimbursementAmountList(List<String> idList) {
 | 
												
													
														
															|  | 
 |  | +        List<CcpmReimbursementAmountInfoDTO> list = infoMapper.getInvoiceReimbursementAmountList(idList);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        return list;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +}
 |