Commit 693c1d6b by zhangxingmin

Merge remote-tracking branch 'origin/test' into test

parents 66cddc96 48a7df98
......@@ -51,7 +51,7 @@ public class ApiExpectedFortunePageRequest extends PageDto {
@Schema(description = "产品计划业务ID列表")
private List<String> productLaunchBizIdList;
@Schema(description = "转介人业务ID列表")
@Schema(description = "转介人(主)业务ID列表")
private List<String> brokerBizIdList;
@Schema(description = "签单员业务ID列表")
......
......@@ -35,6 +35,16 @@ public class PolicyFollow implements Serializable {
private String policyNo;
/**
* 转介人(主)
*/
private String firstBroker;
/**
* 转介人(主)业务ID
*/
private String firstBrokerBizId;
/**
* FNA 业务ID
*/
private String fnaBizId;
......
......@@ -1220,6 +1220,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 更新 fortune 的字段, 已设置的不更新,记录更新成功及跳过的条数
int updateCount = 0;
int skipCount = 0;
List<Fortune> updateFortuneList = new ArrayList<>();
List<String> expectedFortuneBizIdList = new ArrayList<>();
for (Fortune fortune : fortuneList) {
if (ObjectUtils.isEmpty(fortune.getActualPayoutDate())) {
updateCount++;
......@@ -1227,12 +1229,24 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
skipCount++;
continue;
}
this.lambdaUpdate()
.set(Fortune::getActualPayoutDate, actualPayoutDate)
.eq(Fortune::getId, fortune.getId())
.update();
Fortune updateFortune = new Fortune();
updateFortune.setId(fortune.getId());
updateFortune.setActualPayoutDate(actualPayoutDate);
updateFortuneList.add(updateFortune);
expectedFortuneBizIdList.add(fortune.getExpectedFortuneBizId());
}
// 更新 fortune 的字段
this.updateBatchById(updateFortuneList);
// 更新预计 fortune 的字段
expectedFortuneService.lambdaUpdate()
.set(ExpectedFortune::getActualPayoutDate, actualPayoutDate)
.in(ExpectedFortune::getExpectedFortuneBizId, expectedFortuneBizIdList)
.update();
return String.format("设置成功。已更新 %d 条数据,跳过 %d 条(已有实际出账年月)", updateCount, skipCount);
}
......
......@@ -1081,7 +1081,19 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
brokerList.add(policyBroker);
}
return policyBrokerService.saveBatch(brokerList);
policyBrokerService.saveBatch(brokerList);
// brokerList 根据 id 升序
brokerList.sort(Comparator.comparing(PolicyBroker::getId));
// policyFollow 表更新 first_broker_biz_id 字段
policyFollowService.lambdaUpdate()
.eq(PolicyFollow::getPolicyBizId, policyBizId)
.set(PolicyFollow::getFirstBroker, brokerList.get(0).getBrokerName())
.set(PolicyFollow::getFirstBrokerBizId, brokerList.get(0).getBrokerBizId())
.update();
return true;
}
@Override
......
......@@ -79,11 +79,12 @@
then round(100 - (ifnull(sum(ef.paid_amount), 0) / ifnull(sum(ef.hkd_amount), 0) * 100), 2)
else 100
end as unpaidRatio,
MAX(ef.broker) as broker,
MAX(ef.broker_biz_id) as brokerBizId,
pf.first_broker as broker,
pf.first_broker_biz_id as brokerBizId,
DATE_ADD(DATE_ADD(MAX(p.effective_date), INTERVAL 2 MONTH), INTERVAL (ef.fortune_period - 1) YEAR) as payoutDate
from expected_fortune ef
left join policy p on ef.policy_no = p.policy_no
left join policy_follow pf on ef.policy_no = pf.policy_no
<where>
ef.fortune_biz_type = 'R'
<if test="expectedFortuneIds != null and expectedFortuneIds.size > 0">
......@@ -122,8 +123,8 @@
then round(100 - (ifnull(ef.paid_amount, 0) / ifnull(ef.hkd_amount, 0) * 100), 2)
else 100
end as unpaidRatio,
ef.broker as broker,
ef.broker_biz_id as brokerBizId,
NULL as broker,
NULL as brokerBizId,
ef.payout_date as payoutDate
from expected_fortune ef
left join policy p on ef.policy_no = p.policy_no
......@@ -265,7 +266,7 @@
</if>
</where>
ORDER BY id ASC
ORDER BY type ASC, create_time ASC
LIMIT #{pageSize} OFFSET #{offset}
</select>
......
......@@ -8,6 +8,8 @@
<id property="id" column="id" />
<result property="policyBizId" column="policy_biz_id" />
<result property="policyNo" column="policy_no" />
<result property="firstBroker" column="first_broker" />
<result property="firstBrokerBizId" column="first_broker_biz_id" />
<result property="fnaBizId" column="fna_biz_id" />
<result property="appointmentBizId" column="appointment_biz_id" />
<result property="appointmentNo" column="appointment_no" />
......@@ -88,7 +90,7 @@
</resultMap>
<sql id="Base_Column_List">
id,policy_biz_id,policy_no,fna_biz_id,appointment_biz_id,appointment_no,customer_biz_id,
id,policy_biz_id,policy_no,first_broker,first_broker_biz_id,fna_biz_id,appointment_biz_id,appointment_no,customer_biz_id,
submit_date,customer_name,sign_date,signer,signer_biz_id,
practice_code,sign_location,issue_date,cooling_off_end_date,cooling_off_days,
underwriting_date,effective_date,renewal_date,receipt_date,receipt_status,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment