k94314517
2024-03-29 b2bc3eb81485bc7ddb8366477b3483d4f160adaa
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -14,10 +14,7 @@
import com.doumee.dao.business.dto.SaveUnionApplyDTO;
import com.doumee.dao.business.dto.SaveUnionChangeDTO;
import com.doumee.dao.business.dto.UnionChangeBXDDTO;
import com.doumee.dao.business.join.ApplyChagneDetailJoinMapper;
import com.doumee.dao.business.join.ApplyChangeJoinMapper;
import com.doumee.dao.business.join.ApplyDetailJoinMapper;
import com.doumee.dao.business.join.MemberInsuranceJoinMapper;
import com.doumee.dao.business.join.*;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.CountCyclePriceVO;
import com.doumee.service.business.UnionChangeService;
@@ -35,6 +32,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -50,6 +48,9 @@
    @Autowired
    private UnionChangeMapper unionChangeMapper;
    @Autowired
    private UnionChangeJoinMapper unionChangeJoinMapper;
    @Autowired
    private ApplyChangeJoinMapper applyChangeJoinMapper;
@@ -315,6 +316,57 @@
    }
    public UnionChange unionChangeDetail(Integer unionChangeId){
        UnionChange unionChange = unionChangeJoinMapper.selectJoinOne(UnionChange.class,
                new MPJLambdaWrapper<UnionChange>()
                        .selectAll(UnionChange.class)
                        .selectAs(Company::getName,UnionChange::getShopName)
                        .selectAs(Solutions::getName,UnionChange::getSolutionsName)
                        .selectAs(UnionApply::getCode,UnionChange::getApplyCode)
                        .selectAs(UnionApply::getStartTime,UnionChange::getStartTime)
                        .selectAs(UnionApply::getEndTime,UnionChange::getEndTime)
                        .leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId)
                        .leftJoin(Company.class,Company::getId,UnionChange::getShopId)
                        .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId)
                        .eq(UnionChange::getId,unionChangeId)
                        .last(" limit 1 ")
        );
        //企业名称
        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,new MPJLambdaWrapper<ApplyChange>()
                .selectAs(Company::getName,ApplyChange::getCompanyName)
                .leftJoin(Company.class,Company::getId,ApplyChange::getCompanyId)
                .eq(ApplyChange::getUnionChangeId,unionChangeId)
        );
        String companyNames = String.join(",",applyChangeList.stream().map(m->m.getCompanyName()).collect(Collectors.toList()));
        List<ApplyChagneDetail> applyChagneDetailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,new MPJLambdaWrapper<ApplyChagneDetail>()
                .selectAll(ApplyChagneDetail.class)
                .selectAs(Member::getName,ApplyChagneDetail::getMemberName)
                .selectAs(Member::getIdcardNo,ApplyChagneDetail::getIdcardNo)
                .selectAs(Member::getSex,ApplyChagneDetail::getSex)
                .selectAs(Company::getName,ApplyChagneDetail::getCompanyName)
                .select("t2.name",ApplyChagneDetail::getWorkTypeName)
                .select("t3.name",ApplyChagneDetail::getDuName)
                .select("t4.name",ApplyChagneDetail::getOldWorkTypeName)
                .select("t5.name",ApplyChagneDetail::getOldDuName)
                .leftJoin(Member.class,Member::getId,ApplyChagneDetail::getMemberId)
                .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getWorktypeId)
                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getDuId)
                 .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getOldWorktypeId)
                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getOldDuId)
                .leftJoin(Company.class,Company::getId,Member::getCompanyId)
                .eq(ApplyChagneDetail::getUnionChangeId,unionChangeId)
        );
        unionChange.setCompanyNames(companyNames);
        unionChange.setApplyChagneDetailList(applyChagneDetailList);
        return unionChange;
    }
    /**
     * 合并单(加减保/换厂) - 投保申请签署
     * @param id
@@ -327,7 +379,7 @@
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        UnionChange unionChange = unionChangeMapper.selectById(id);
        UnionChange unionChange = this.unionChangeDetail(id);
        if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
@@ -350,11 +402,10 @@
        String fileUrl = null;
        if(Constants.equalsObject(unionChange.getType(), Constants.ONE)){
//            fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"换厂申请表","被保险人");
            fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeOtherUnitExcelToPdf(unionChange,"换厂申请表");
        }else{
//            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"加减保申请表","被保险人");
            fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeExcelToPdf(unionChange,"加减保申请表");
        }
        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",unionChange.getId().toString());
        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"合并单(加减保/换厂)申请签署",company.getSignId(),notifyUrl);