|
|
@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
|
+import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlySettleDetailMapper;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlySettleHxMapper;
|
|
|
@@ -40,6 +43,7 @@ import java.sql.Wrapper;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.YearMonth;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -62,7 +66,8 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
|
|
|
private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
|
@Autowired
|
|
|
private InsPlySettleHxMapper insPlySettleHxMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private EsmInsCompanyService esmInsCompanyService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@@ -211,8 +216,52 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
|
|
|
public BasePageResult<InsPlySettleReportResVo> getInsPlySettleReport( InsPlySettleReportReqVo insPlySettleReportReqVo) {
|
|
|
Page<InsOrders> page = new Page<>(insPlySettleReportReqVo.getPageNum(), insPlySettleReportReqVo.getPageSize());
|
|
|
page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
|
|
|
+ if(StringUtils.isNotEmpty(insPlySettleReportReqVo.getIsReturnBack())&&"1".equals(insPlySettleReportReqVo.getIsReturnBack())){
|
|
|
+ //如果是返回上级时,找上级的上级往下找
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw1 = new LambdaQueryWrapper<>();
|
|
|
+ lqw1.eq(EsmInsCompany::getId, insPlySettleReportReqVo.getCompanyId());
|
|
|
+ EsmInsCompany esmInsCompany1=esmInsCompanyService.getOne(lqw1);
|
|
|
+ if(esmInsCompany1==null){
|
|
|
+ throw new SystemException("已经是最顶层机构,无法继续返回!");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw2 = new LambdaQueryWrapper<>();
|
|
|
+ lqw2.eq(EsmInsCompany::getId, esmInsCompany1.getParentId());
|
|
|
+ EsmInsCompany esmInsCompany2=esmInsCompanyService.getOne(lqw2);
|
|
|
+ if(esmInsCompany2==null){
|
|
|
+ insPlySettleReportReqVo.setCompanyId(esmInsCompany1.getParentId());
|
|
|
+ }else{
|
|
|
+ insPlySettleReportReqVo.setCompanyId(esmInsCompany2.getParentId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //正常查询,下钻查询时调整
|
|
|
+ List<String> companyArr=esmInsCompanyService.getInsCompanyNextLevel(insPlySettleReportReqVo.getCompanyId());
|
|
|
+ if(!(companyArr!=null&&companyArr.size()>0)){
|
|
|
+ throw new SystemException("已经是最底层机构,无法继续下钻!");
|
|
|
+ }
|
|
|
+ insPlySettleReportReqVo.setGroupInsCompanyArr(companyArr);
|
|
|
+
|
|
|
Page<InsPlySettleReportResVo> policyInsuranceReportResVoPage = baseMapper.getInsPlySettleReport(page,
|
|
|
insPlySettleReportReqVo);
|
|
|
+ if(policyInsuranceReportResVoPage.getRecords().size()==0){
|
|
|
+ throw new SystemException("未查询到有效数据!");
|
|
|
+ }
|
|
|
+ policyInsuranceReportResVoPage.getRecords().stream().forEach(item->{
|
|
|
+ EsmInsCompany esmInsCompany =esmInsCompanyService.getById(item.getCompanyId());
|
|
|
+ item.setCompanyName(esmInsCompany.getName());
|
|
|
+ if(StringUtils.isEmpty(item.getStatus())){
|
|
|
+ item.setStatus("全部");
|
|
|
+ }else{
|
|
|
+ if("0".equals(item.getStatus())){
|
|
|
+ item.setStatus("未核销");
|
|
|
+ }else if("1".equals(item.getStatus())){
|
|
|
+ item.setStatus("部分核销");
|
|
|
+ }else if ("2".equals(item.getStatus())){
|
|
|
+ item.setStatus("已核销");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
Long total = baseMapper.getInsPlySettleReportCount(insPlySettleReportReqVo);
|
|
|
policyInsuranceReportResVoPage.setTotal(total);
|
|
|
return new BasePageResult<>(insPlySettleReportReqVo.getPageNum(), insPlySettleReportReqVo.getPageSize(),
|
|
|
@@ -222,7 +271,50 @@ public class InsPlySettleServiceImpl extends ServiceImpl<InsPlySettleMapper, Ins
|
|
|
|
|
|
@Override
|
|
|
public HttpResult<String> exportInsPlySettleReport(InsPlySettleReportReqVo insPlySettleReportReqVo) {
|
|
|
+ if(StringUtils.isNotEmpty(insPlySettleReportReqVo.getIsReturnBack())&&"1".equals(insPlySettleReportReqVo.getIsReturnBack())){
|
|
|
+ //如果是返回上级时,找上级的上级往下找
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw1 = new LambdaQueryWrapper<>();
|
|
|
+ lqw1.eq(EsmInsCompany::getId, insPlySettleReportReqVo.getCompanyId());
|
|
|
+ EsmInsCompany esmInsCompany1=esmInsCompanyService.getOne(lqw1);
|
|
|
+ if(esmInsCompany1==null){
|
|
|
+ throw new SystemException("已经是最顶层机构,无法继续返回!");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<EsmInsCompany> lqw2 = new LambdaQueryWrapper<>();
|
|
|
+ lqw2.eq(EsmInsCompany::getId, esmInsCompany1.getParentId());
|
|
|
+ EsmInsCompany esmInsCompany2=esmInsCompanyService.getOne(lqw2);
|
|
|
+ if(esmInsCompany2==null){
|
|
|
+ insPlySettleReportReqVo.setCompanyId(esmInsCompany1.getParentId());
|
|
|
+ }else{
|
|
|
+ insPlySettleReportReqVo.setCompanyId(esmInsCompany2.getParentId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //正常查询,下钻查询时调整
|
|
|
+ List<String> companyArr=esmInsCompanyService.getInsCompanyNextLevel(insPlySettleReportReqVo.getCompanyId());
|
|
|
+ if(!(companyArr!=null&&companyArr.size()>0)){
|
|
|
+ throw new SystemException("已经是最底层机构,无法继续下钻!");
|
|
|
+ }
|
|
|
+ insPlySettleReportReqVo.setGroupInsCompanyArr(companyArr);
|
|
|
+
|
|
|
List<InsPlySettleReportResVo> insPlySettleReportResVoList = baseMapper.getInsPlySettleReport(insPlySettleReportReqVo);
|
|
|
+ if(insPlySettleReportResVoList.size()==0){
|
|
|
+ throw new SystemException("未查询到有效数据!");
|
|
|
+ }
|
|
|
+ insPlySettleReportResVoList.stream().forEach(item->{
|
|
|
+ EsmInsCompany esmInsCompany =esmInsCompanyService.getById(item.getCompanyId());
|
|
|
+ item.setCompanyName(esmInsCompany.getName());
|
|
|
+ if(StringUtils.isEmpty(item.getStatus())){
|
|
|
+ item.setStatus("全部");
|
|
|
+ }else{
|
|
|
+ if("0".equals(item.getStatus())){
|
|
|
+ item.setStatus("未核销");
|
|
|
+ }else if("1".equals(item.getStatus())){
|
|
|
+ item.setStatus("部分核销");
|
|
|
+ }else if ("2".equals(item.getStatus())){
|
|
|
+ item.setStatus("已核销");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
String s = EasyExcelUtils.downExcel(uploadFilePath, InsPlySettleReportResVo.class, insPlySettleReportResVoList);
|
|
|
return HttpResult.ok("", s);
|
|
|
}
|