Authored by LUOXC

refactor

... ... @@ -19,6 +19,6 @@ public interface InviteSettlementMapper {
List<InviteSettlement> selectByUidAndIds(@Param("uid") Integer uid, @Param("ids") List<Integer> ids);
List<InviteSettlement> selectBySettleCodes(@Param("settleCodes") List<Integer> settleCodes);
List<InviteSettlement> selectByIds(@Param("ids") List<Integer> ids);
}
\ No newline at end of file
... ...
... ... @@ -60,13 +60,13 @@
</foreach>
</select>
<select id="selectBySettleCodes" resultMap="BaseResultMap" >
<select id="selectByIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from invite_settlement
where settle_code in
<foreach collection="settleCodes" item="settleCode" open="(" separator="," close=")">
#{settleCode}
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
... ...
... ... @@ -61,8 +61,8 @@ public class InviteSettlementController {
}
@RequestMapping(value = "/erp/invite/settlement/help/paid")
public ApiResponse paid(@RequestBody List<Integer> settleCodes) {
inviteSettlementService.paid(settleCodes);
public ApiResponse paid(@RequestBody List<Integer> ids) {
inviteSettlementService.paid(ids);
return new ApiResponse.ApiResponseBuilder().code(200).message("ok").build();
}
... ...
... ... @@ -24,9 +24,9 @@ public interface IInviteSettlementService {
/**
* 将结算单和结算项标志成已付款
* @param settleCodes
* @param ids
*/
void paid(List<Integer> settleCodes);
void paid(List<Integer> ids);
/**
* 创建结算项
... ...
... ... @@ -198,13 +198,13 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
}
@Override
public void paid(List<Integer> settleCodes) {
if (CollectionUtils.isEmpty(settleCodes)) {
public void paid(List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
List<InviteSettlement> settlements = inviteSettlementMapper.selectBySettleCodes(settleCodes);
List<InviteSettlement> settlements = inviteSettlementMapper.selectByIds(ids);
settlements.stream().forEach(settlement -> {
log.info("mark settlement to paid, settle code is {}", settlement.getSettleCode());
log.info("mark settlement to paid, settle id is {}", settlement.getId());
settlement.setStatus(InviteSettlement.STATUS_PAID);
inviteSettlementMapper.updateByUidAndId(settlement);
inviteSettlementItemMapper.updateStatusByUidAndInviteSettlementId(settlement.getUid(), settlement.getId(), InviteSettlementItem.STATUS_PAID);
... ...