Commit 211b316e by zhangxingmin

Merge remote-tracking branch 'origin/dev' into prod

parents 2dbc395a 492c4f21
......@@ -425,7 +425,8 @@ public class ApiCommissionExpectedController {
commissionExpectedQueryRequest.setPolicyNoList(queryPolicyNoList);
commissionExpectedQueryRequest.setQueryFlag(queryFlag);
QueryWrapper<CommissionExpected> queryWrapper = commissionExpectedService.getQueryWrapper(commissionExpectedQueryRequest);
//显式选择需要的字段
queryWrapper.select("expected_amount", "paid_amount","paid_ratio", "commission_ratio", "policy_no","status");
// 先查询所有符合条件的记录ID(用于统计)
List<CommissionExpected> allCommissionExpectedList = commissionExpectedService.list(queryWrapper);
......
......@@ -133,8 +133,8 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 查询统计信息
ApiSalarySplitStatisticsDto statisticsDto = new ApiSalarySplitStatisticsDto();
FortuneAccount fortuneAccount = fortuneAccountService.queryOne(request.getFortuneAccountBizId());
// 出账币种
statisticsDto.setBeSplitCurrency(fortuneAccount != null ? fortuneAccount.getCurrency() : "");
// 发放币种
statisticsDto.setBeSplitCurrency(fortuneAccount != null ? fortuneAccount.getPayoutCurrency() : "");
BigDecimal beSplitAmount = BigDecimal.ZERO;
if (fortuneAccount != null) {
......@@ -147,7 +147,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal fortuneAmount = fortuneAccount.getHkdAmount() != null ? fortuneAccount.getHkdAmount() : BigDecimal.ZERO;
BigDecimal fortuneAmount = fortuneAccount.getPayoutAmount() != null ? fortuneAccount.getPayoutAmount() : BigDecimal.ZERO;
beSplitAmount = fortuneAmount.subtract(splitTotal);
if (beSplitAmount.compareTo(BigDecimal.ZERO) < 0) {
beSplitAmount = BigDecimal.ZERO; // 防止负数
......@@ -231,7 +231,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
}
// 3. 计算剩余可拆金额(账户总额 - 本次拟拆分总额)
BigDecimal fortuneAmount = fortuneAccount.getHkdAmount() != null ? fortuneAccount.getHkdAmount() : BigDecimal.ZERO;
BigDecimal fortuneAmount = fortuneAccount.getPayoutAmount() != null ? fortuneAccount.getPayoutAmount() : BigDecimal.ZERO;
BigDecimal beSplitAmount = fortuneAmount.subtract(splitTotal);
if (beSplitAmount.compareTo(BigDecimal.ZERO) < 0) {
beSplitAmount = BigDecimal.ZERO; // 防止负数
......@@ -239,7 +239,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 4. 封装响应
ApiQueryRemainingResponse response = new ApiQueryRemainingResponse();
response.setCurrency(fortuneAccount.getCurrency());
response.setCurrency(fortuneAccount.getPayoutCurrency());
response.setFromAmount(beSplitAmount);
return Result.success(response);
}
......@@ -260,7 +260,7 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
//原币种金额
convertRequest.setAmount(request.getFromAmount());
//原币种
convertRequest.setFromCurrency(fortuneAccount.getCurrency());
convertRequest.setFromCurrency(fortuneAccount.getPayoutCurrency());
//目标币种
convertRequest.setToCurrency(request.getToCurrency());
//调用远程转换接口
......@@ -296,11 +296,13 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
// 查询数据
List<ApiSalarySplitSummaryPageDto> dataList = iSalarySplitService.summaryList(request);
log.info("导出-薪资拆分应发信息汇总列表:dataList,{}", JSON.toJSONString(dataList));
Map<String, String> map = getBillOrgDict();
List<ApiSalarySplitSummaryExcelDto> excelDtoList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(dataList)) {
excelDtoList = dataList.stream().map(dto -> {
ApiSalarySplitSummaryExcelDto excelDto = new ApiSalarySplitSummaryExcelDto();
BeanUtils.copyProperties(dto,excelDto);
excelDto.setBillOrg(map != null ? map.get(dto.getBillOrg()) : "");
return excelDto;
}).collect(Collectors.toList());
}
......@@ -309,9 +311,9 @@ public class ApiSalarySplitServiceImpl implements ApiSalarySplitService {
ExportParam exportParam = new ExportParam();
// 指定需要导出的字段(字段名必须与 DTO 中的属性名一致)
exportParam.setFieldNames(Arrays.asList(
"salarySplitNo","businessNo","brokerName","team","fromAmount",
"salarySplitNo","businessNo","brokerName","internalNumber","team","fromAmount",
"currency","exchangeRate","toAmount","toCurrency",
"fortuneAccountMonth","billOrg","hkdAmount"
"fortuneAccountMonth","billOrg","amount"
));
exportParam.setFileName("薪资拆分应发信息汇总");
exportParam.setUploadToOss(true);
......
......@@ -10,40 +10,40 @@ public class ApiSalarySplitSummaryExcelDto {
@Excel(name = "发放编号", orderNum = "1")
private String salarySplitNo;
@Excel(name = "业务编号", orderNum = "1")
@Excel(name = "业务编号", orderNum = "2")
private String businessNo;
@Excel(name = "转介人", orderNum = "2")
@Excel(name = "转介人", orderNum = "3")
private String brokerName;
@Excel(name = "内部编号", orderNum = "3")
@Excel(name = "内部编号", orderNum = "4")
private String internalNumber;
@Excel(name = "所属团队", orderNum = "4")
@Excel(name = "所属团队", orderNum = "5")
private String team;
@Excel(name = "原币种金额", orderNum = "5")
@Excel(name = "原币种金额", orderNum = "6")
private BigDecimal fromAmount;
@Excel(name = "原币种", orderNum = "6")
@Excel(name = "原币种", orderNum = "7")
private String currency;
@Excel(name = "汇率(原币种->目标币种)", orderNum = "7")
@Excel(name = "汇率(原币种->目标币种)", orderNum = "8")
private BigDecimal exchangeRate;
@Excel(name = "目标金额", orderNum = "8")
@Excel(name = "目标金额", orderNum = "9")
private BigDecimal toAmount;
@Excel(name = "目标币种", orderNum = "9")
@Excel(name = "目标币种", orderNum = "10")
private String toCurrency;
@Excel(name = "出账月(实)", orderNum = "10")
@Excel(name = "出账月(实)", orderNum = "11")
private String fortuneAccountMonth;
@Excel(name = "出账机构", orderNum = "11")
@Excel(name = "出账机构", orderNum = "12")
private String billOrg;
@Excel(name = "本期总出账金额(原币种)", orderNum = "12")
private BigDecimal hkdAmount;
@Excel(name = "本期总出账金额(原币种)", orderNum = "13")
private BigDecimal amount;
}
......@@ -94,7 +94,7 @@ public class ApiSalarySplitSummaryPageDto {
private String status;
/**
* 出账总额
* 出账总额(发放币种金额总额)
*/
private BigDecimal amount;
......@@ -104,7 +104,7 @@ public class ApiSalarySplitSummaryPageDto {
private BigDecimal hkdAmount;
/**
* 出账币种(币种)
* 出账币种(发放币种)
*/
private String currency;
......
......@@ -25,11 +25,14 @@ public class FortuneAccountExportDTO implements Serializable {
private String teamBizId;
@ExcelProperty("出账币种")
private String currency;
@ExcelProperty("发放币种")
private String payoutCurrency;
@ExcelProperty("出账总额")
private BigDecimal amount;
@ExcelProperty("发放金额")
private BigDecimal payoutAmount;
@ExcelProperty("出账港币总额")
private BigDecimal hkdAmount;
private List<Fortune> fortuneList;
......
......@@ -54,17 +54,17 @@ public class FortuneAccount implements Serializable {
private String teamBizId;
/**
* 出账币种
* 发放币种
*/
private String currency;
private String payoutCurrency;
/**
* 出账总
* 发放金
*/
private BigDecimal amount;
private BigDecimal payoutAmount;
/**
* 港币出账金额
* 港币金额
*/
private BigDecimal hkdAmount;
......
......@@ -167,8 +167,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
fortuneAccount.setBrokerBizId(accountExportDTO.getBrokerBizId());
fortuneAccount.setTeam(accountExportDTO.getTeam());
fortuneAccount.setTeamBizId(accountExportDTO.getTeamBizId());
fortuneAccount.setCurrency(accountExportDTO.getCurrency());
fortuneAccount.setHkdAmount(accountExportDTO.getAmount());
fortuneAccount.setPayoutCurrency(accountExportDTO.getPayoutCurrency());
fortuneAccount.setPayoutAmount(accountExportDTO.getPayoutAmount());
fortuneAccount.setHkdAmount(accountExportDTO.getHkdAmount());
fortuneAccount.setFortuneAccountDate(this.getActualPayoutDate(accountExportDTO.getActualPayoutDate()));
// 出账状态默认待出账
fortuneAccount.setStatus(FortuneStatusEnum.CHECKED.getItemValue());
......
......@@ -431,7 +431,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
for (Map.Entry<String, List<Fortune>> entry : fortuneMap.entrySet()) {
String broker = entry.getKey().split("_")[0];
String actualPayoutDate = entry.getKey().split("_")[1];
String currency = entry.getKey().split("_")[2];
String payoutCurrency = entry.getKey().split("_")[2];
List<Fortune> brokerFortunes = entry.getValue();
FortuneAccountExportDTO accountDTO = new FortuneAccountExportDTO();
......@@ -443,15 +443,19 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if (CollUtil.isNotEmpty(brokerFortunes)) {
accountDTO.setTeam(brokerFortunes.get(0).getTeam());
accountDTO.setTeamBizId(brokerFortunes.get(0).getTeamBizId());
accountDTO.setCurrency(currency);
accountDTO.setPayoutCurrency(payoutCurrency);
accountDTO.setActualPayoutDate(LocalDate.parse(actualPayoutDate));
}
// 计算出账总额
BigDecimal totalAmount = brokerFortunes.stream()
.map(Fortune::getCurrentPaymentHkdAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
accountDTO.setAmount(totalAmount);
// 计算出账港币总额、发放币种总额
BigDecimal totalHkdAmount = BigDecimal.ZERO;
BigDecimal totalPayoutAmount = BigDecimal.ZERO;
for (Fortune fortune : brokerFortunes) {
totalHkdAmount = totalHkdAmount.add(fortune.getCurrentPaymentHkdAmount());
totalPayoutAmount = totalPayoutAmount.add(fortune.getPayoutAmount());
}
accountDTO.setHkdAmount(totalHkdAmount);
accountDTO.setPayoutAmount(totalPayoutAmount);
// 按fortune项目分组并累加金额
Map<String, BigDecimal> fortuneAmountMap = brokerFortunes.stream()
......
......@@ -51,10 +51,16 @@ public class FortuneAccountVO {
private String team;
/**
* 出账币种
* 发放币种
*/
@Schema(description = "出账币种")
private String currency;
@Schema(description = "发放币种")
private String payoutCurrency;
/**
* 发放金额
*/
@Schema(description = "发放金额")
private BigDecimal payoutAmount;
/**
* 港币出账金额
......
......@@ -11,8 +11,8 @@
<result property="brokerBizId" column="broker_biz_id" />
<result property="team" column="team" />
<result property="teamBizId" column="team_biz_id" />
<result property="currency" column="currency" />
<result property="amount" column="amount" />
<result property="payoutCurrency" column="payout_currency" />
<result property="payoutAmount" column="payout_amount" />
<result property="hkdAmount" column="hkd_amount" />
<result property="status" column="status" />
<result property="fortuneAccountDate" column="fortune_account_date" />
......@@ -27,7 +27,7 @@
<sql id="Base_Column_List">
id,fortune_account_biz_id,broker,broker_biz_id,team,team_biz_id,
currency,amount,hkd_amount,status,fortune_account_date,content,remark,
payout_currency,payout_amount,hkd_amount,status,fortune_account_date,content,remark,
is_deleted,creator_id,updater_id,create_time,update_time
</sql>
</mapper>
......@@ -26,9 +26,9 @@
fa.fortune_account_date,
ss.bill_org,
fa.status,
fa.amount,
fa.payout_amount as amount,
fa.hkd_amount,
fa.currency,
fa.payout_currency as currency,
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month,
fa.business_no
from salary_split ss
......@@ -109,9 +109,9 @@
fa.fortune_account_date,
ss.bill_org,
fa.status,
fa.amount,
fa.payout_amount as amount,
fa.hkd_amount,
fa.currency,
fa.payout_currency as currency,
DATE_FORMAT(fa.fortune_account_date, '%Y%m') as fortune_account_month,
fa.business_no
from salary_split ss
......
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