From 3d0422c830fb9e6bd26f33f587d054a8bfb3bc05 Mon Sep 17 00:00:00 2001
From: hongguangwu <3004403350@qq.com>
Date: Thu, 13 Oct 2022 18:32:09 +0800
Subject: [PATCH] =?UTF-8?q?=E5=95=86=E9=99=A9=E5=8A=A0=E5=88=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../insurances/vo/InsuranceRefundListVo.java  |  9 +++
 .../impl/TInsuranceDetailServiceImpl.java     | 64 ++++---------------
 .../insurances/TInsuranceDetailMapper.xml     | 18 ++++++
 3 files changed, 38 insertions(+), 53 deletions(-)

diff --git a/yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/InsuranceRefundListVo.java b/yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/InsuranceRefundListVo.java
index 2c8ee8e0a..aaa523708 100644
--- a/yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/InsuranceRefundListVo.java
+++ b/yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/InsuranceRefundListVo.java
@@ -1,5 +1,9 @@
 package com.yifu.cloud.plus.v1.yifu.insurances.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.HeadFontStyle;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -187,4 +191,9 @@ public class InsuranceRefundListVo implements Serializable {
 	 */
 	@Schema(description = "封面抬头")
 	private String invoiceTitle;
+
+	@Schema(description = "派单人")
+	@HeadFontStyle(fontHeightInPoints = 11)
+	@ExcelProperty("派单人")
+	private String createName;
 }
diff --git a/yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java b/yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java
index 6878954c6..922aff46f 100644
--- a/yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java
+++ b/yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java
@@ -843,7 +843,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 				Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
 				ProjectSetInfoVo jsonObject = data.get(insuranceDetailVO.getDeptNo());
 				if (null != jsonObject){
-					insuranceDetailVO.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
 					insuranceDetailVO.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
 				}
 			}
@@ -883,7 +882,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 		}
 		param.setCreateBy(user.getId());
 		menuUtil.setAuthSql(user, param);
-		List<InsuranceExportListVO> insuranceExportList;
+		List<InsuranceExportListVO> insuranceExportList = new ArrayList<>();
 		//如勾选项不为空,则导出勾选记录;否则导出当前筛选条件下 && 「待投保」的结果集
 		if (CollectionUtils.isNotEmpty(param.getIdList())){
 			insuranceExportList =  baseMapper.getInsuranceExportListBySelect(param.getIdList());
@@ -914,7 +913,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 					if (data != null) {
 						jsonObject = data.get(record.getDeptNo());
 						if (null != jsonObject) {
-							record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
 							record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
 						}
 					}
@@ -974,6 +972,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 							vo.setBuyDay(LocalDateUtil.betweenDay(vo.getPolicyStart().toString(),vo.getPolicyEnd().toString()));
 							vo.setRemark(InsurancesConstants.QUIT);
 							vo.setBuyType(CommonConstants.FOUR_INT);
+							vo.setProjectName(vo.getProjectName());
 							list.add(vo);
 						}
 					}
@@ -989,7 +988,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 								for (InsuranceExportListVO record : list) {
 									ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
 									if (null != jsonObject) {
-										record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
 										record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
 									}
 								}
@@ -3351,22 +3349,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 		insuranceList = this.baseMapper.getInsuredListPage(page, param);
 		if (CollectionUtils.isNotEmpty(insuranceList.getRecords())){
 			//根据项目编码获取项目名称
-			List<String> collect = insuranceList.getRecords().stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
-			R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
-			if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
-				Map<String, ProjectSetInfoVo>  data = setInfoByCodes.getData().getProjectSetInfoVoMap();
-				for (InsuredListVo record : insuranceList.getRecords()) {
-					//购买月数
-					record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
-					if (data != null) {
-						ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
-						if (null != jsonObject) {
-							record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
-						}
-					}
-				}
+			for (InsuredListVo record : insuranceList.getRecords()) {
+				//购买月数
+				record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
 			}
-
 		}
 		return insuranceList;
 	}
@@ -3401,7 +3387,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 						if (data != null) {
 							ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
 							if (null != jsonObject) {
-								record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
 								record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitle()).orElse(""));
 							}
 						}
@@ -3435,26 +3420,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 		IPage<InsuranceRefundListVo> insuranceRefundPageList = this.baseMapper.getInsuranceRefundPageList(page, param);
 		if (CollectionUtils.isNotEmpty(insuranceRefundPageList.getRecords())){
 			//根据项目编码获取项目名称
-			List<String> collect = insuranceRefundPageList.getRecords().stream().map(InsuranceRefundListVo::getDeptNo).distinct().collect(Collectors.toList());
 			try {
-				R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
-				if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
-					Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
-					for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
-						//购买月数
-						record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
-						if (data != null) {
-							ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
-							if (null != jsonObject) {
-								record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
-							}
-						}
-					}
+				for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
+					//购买月数
+					record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
 				}
 			}catch (Exception e){
 				log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
 			}
-
 		}
 		return R.ok(insuranceRefundPageList);
 	}
@@ -3487,7 +3460,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 					if (data != null) {
 						ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
 						if (null != jsonObject) {
-							record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
 							record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
 						}
 					}
@@ -3522,22 +3494,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 		IPage<RefundExportListVo> insuranceRefundHandlingPageList = this.baseMapper.getInsuranceRefundHandlingPageList(page, param);
 		if (CollectionUtils.isNotEmpty(insuranceRefundHandlingPageList.getRecords())){
 			//根据项目编码获取项目名称
-			List<String> collect = insuranceRefundHandlingPageList.getRecords().stream().map(RefundExportListVo::getDeptNo).distinct().collect(Collectors.toList());
-			R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
-			if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
-				Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
-				if (data != null) {
-					for (RefundExportListVo record : insuranceRefundHandlingPageList.getRecords()) {
-						//购买月数
-						record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
-						if (data != null) {
-							ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
-							if (null != jsonObject) {
-								record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
-							}
-						}
-					}
-				}
+			for (RefundExportListVo record : insuranceRefundHandlingPageList.getRecords()) {
+				//购买月数
+				record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
 			}
 		}
 
@@ -3586,7 +3545,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
 					if (data != null) {
 						ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
 						if (null != jsonObject) {
-							record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
 							record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
 						}
 					}
diff --git a/yifu-insurances/yifu-insurances-biz/src/main/resources/mapper/insurances/TInsuranceDetailMapper.xml b/yifu-insurances/yifu-insurances-biz/src/main/resources/mapper/insurances/TInsuranceDetailMapper.xml
index b85e9dcf8..8c7ff8395 100644
--- a/yifu-insurances/yifu-insurances-biz/src/main/resources/mapper/insurances/TInsuranceDetailMapper.xml
+++ b/yifu-insurances/yifu-insurances-biz/src/main/resources/mapper/insurances/TInsuranceDetailMapper.xml
@@ -291,6 +291,7 @@
 		a.EMP_IDCARD_NO as empIdcardNo,
 		a.BUY_TYPE as buyType,
 		a.DEPT_NO as deptNo,
+		a.DEPT_NAME as projectName,
 		a.POST as post,
 		a.POLICY_START as policyStart,
 		a.POLICY_END as policyEnd,
@@ -335,6 +336,7 @@
 	<select id="getInsuranceExportListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
 		select a.id as id,
 		a.DEPT_NO as deptNo,
+		a.DEPT_NAME as projectName,
 		a.EMP_NAME as empName,
 		a.EMP_IDCARD_NO as empIdcardNo,
 		a.BUY_TYPE as buyType,
@@ -367,6 +369,7 @@
 	<select id="getInsuranceExportList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceExportListVO">
 		select a.id as id,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.EMP_NAME as empName,
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.BUY_TYPE as buyType,
@@ -442,6 +445,7 @@
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.BUY_TYPE as buyType,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.POST as post,
 			a.POLICY_START as policyStart,
 			a.POLICY_END as policyEnd,
@@ -519,6 +523,7 @@
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.BUY_TYPE as buyType,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.POST as post,
 			a.POLICY_START as policyStart,
 			a.POLICY_END as policyEnd,
@@ -607,10 +612,12 @@
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.POST as post,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.INSURANCE_COMPANY_NAME as insuranceCompanyName,
 			a.POLICY_START as policyStart,
 			a.POLICY_END as policyEnd,
 			a.POLICY_NO as policyNo,
+			a.CREATE_NAME as createName,
 			refund.CREATE_USER_DEPT_NAME as createUserDeptName,
 			refund.CREATE_TIME as refundCreateTime
 		from
@@ -625,6 +632,9 @@
 			a.REFUND_ID = refund.ID
 		and
 			a.REDUCE_HANDLE_STATUS = 4
+		<if test="param.createName != null and param.createName.trim() != ''">
+			and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
+		</if>
 		<if test="param.empName != null and param.empName.trim() != ''">
 			and a.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
 		</if>
@@ -664,6 +674,7 @@
 		select
 			a.id as id,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.EMP_NAME as empName,
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.BUY_TYPE as buyType,
@@ -679,6 +690,7 @@
 			a.BUY_STANDARD as buyStandard,
 			a.MEDICAL_QUOTA as medicalQuota,
 			a.DIE_DISABLE_QUOTA as dieDisableQuota,
+			a.CREATE_NAME as createName,
 			refund.CREATE_TIME as refundCreateTime
 		from
 			(t_insurance_detail a,
@@ -692,6 +704,9 @@
 			a.DELETE_FLAG = 0
 		and
 			a.REDUCE_HANDLE_STATUS = 4
+		<if test="param.createName != null and param.createName.trim() != ''">
+			and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
+		</if>
 		<if test="param.empName != null and param.empName.trim() != ''">
 			and a.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
 		</if>
@@ -735,6 +750,7 @@
 		a.EMP_IDCARD_NO as empIdcardNo,
 		a.BUY_TYPE as buyType,
 		a.DEPT_NO as deptNo,
+		a.DEPT_NAME as projectName,
 		a.POST as post,
 		a.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
 		a.INSURANCE_CITY_NAME as insuranceCityName,
@@ -841,6 +857,7 @@
 		select
 			a.id as id,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.EMP_NAME as empName,
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.BUY_TYPE as buyType,
@@ -875,6 +892,7 @@
 		select
 		    a.id as id,
 			a.DEPT_NO as deptNo,
+			a.DEPT_NAME as projectName,
 			a.EMP_NAME as empName,
 			a.EMP_IDCARD_NO as empIdcardNo,
 			a.BUY_TYPE as buyType,
-- 
2.18.1