//club_payment_info取得項目
List<ClubPaymentInfo> selectClubPaymentInfo(@Param("bankAccountNos") List<String> bankAccountNos);
//club_group取得項目
List<ClubGroup> selectClubGroup(@Param("bankAccountNos") List<String> bankAccountNos);
// List<ClubPaymentHistory> selectInvoice();
<select id="selectClubPaymentInfo" parameterType="List"
resultType="com.sunflower.rm.web.domain.model.entity.ClubPaymentInfo">
SELECT *
FROM club_payment_info
WHERE
bank_account_no in
<foreach item="item" index="index" collection="bankAccountNos" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectClubGroup" parameterType="List"
resultType="com.sunflower.rm.web.domain.model.entity.ClubGroup">
SELECT
*
FROM
club_group
WHERE
bank_account_no in
<foreach item="item" index="index" collection="bankAccountNos" open="(" separator="," close=")">
#{item}
</foreach>
</select>
https://blog.csdn.net/qq_38157516/article/details/84036819
package com.sunflower.rm.web.domain.service;
import com.sunflower.rm.web.domain.mapper.RelateGolfCourseCodeMapper;
import com.sunflower.rm.web.domain.model.entity.ClubGroup;
import com.sunflower.rm.web.domain.model.entity.ClubPaymentHistory;
import com.sunflower.rm.web.domain.model.entity.ClubPaymentInfo;
import com.sunflower.rm.web.domain.model.request.N01_02_01_RelateGolfCourseCodeRequestDto;
import com.sunflower.rm.web.domain.model.response.N01_02_01_RelateGolfCourseCodeResponseDto;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class RelateGolfCourseCodeService {
@Resource
private RelateGolfCourseCodeMapper relateGolfCourseCodeMapper;
public ResponseEntity<N01_02_01_RelateGolfCourseCodeResponseDto> relateGolfCourseCode(N01_02_01_RelateGolfCourseCodeRequestDto n01_02_01_relateGolfCourseCodeRequestDto) {
N01_02_01_RelateGolfCourseCodeResponseDto response = new N01_02_01_RelateGolfCourseCodeResponseDto();
List<ClubPaymentHistory> clubPaymentHistories = relateGolfCourseCodeMapper.selectRelateGolfCourseCode(n01_02_01_relateGolfCourseCodeRequestDto);
if (clubPaymentHistories.size()==0){
response.setErrorCode("error.common.2002");
return new ResponseEntity(response, HttpStatus.BAD_REQUEST);
}
List<String> bankAccountNos = clubPaymentHistories.stream()//口座番号List
.map(item -> item.getBankAccountNo()).collect(Collectors.toList());
//club
List<ClubPaymentInfo> clubPaymentInfos = relateGolfCourseCodeMapper.selectClubPaymentInfo(bankAccountNos);
//group
List<ClubGroup> clubGroupInfos = relateGolfCourseCodeMapper.selectClubGroup(bankAccountNos);
for (ClubPaymentHistory clubPaymentHistory: clubPaymentHistories) {
List<ClubGroup> clubBankAccountNoList = clubGroupInfos.stream().filter(item->item.getBankAccountNo().equals(clubPaymentHistory.getBankAccountNo()) &&
item.getBankAccountName().equals(clubPaymentHistory.getBankAccountName()) &&
item.getBankName().equals(clubPaymentHistory.getBankName()) &&
item.getBankBranchName().equals(clubPaymentHistory.getBankBranchName())).collect(Collectors.toList());
List<ClubPaymentInfo> BankAccountNoList = clubPaymentInfos.stream().filter(item->item.getBankAccountNo().equals(clubPaymentHistory.getBankAccountNo()) &&
item.getBankAccountName().equals(clubPaymentHistory.getBankAccountName()) &&
item.getBankName().equals(clubPaymentHistory.getBankName()) &&
item.getBankBranchName().equals(clubPaymentHistory.getBankBranchName())).collect(Collectors.toList());
//group
if(clubBankAccountNoList.size()>0){
ClubGroup clubPaymentInfo = clubBankAccountNoList.get(0);
clubPaymentHistory.setClubGroup(clubPaymentInfo.getClubGroupId());
clubPaymentHistory.setClubGroupName(clubPaymentInfo.getClubGroupName());
//club
}else if(BankAccountNoList.size()>0){
ClubPaymentInfo PaymentInfo = BankAccountNoList.get(0);
clubPaymentHistory.setClubname(PaymentInfo.getClubname());
clubPaymentHistory.setClubcode(PaymentInfo.getClubcode());
List<ClubPaymentHistory> clubPayment = relateGolfCourseCodeMapper.selectClub(n01_02_01_relateGolfCourseCodeRequestDto);
//判断状态 入金金额
}
}
return new ResponseEntity(HttpStatus.OK);
}
}
package com.sunflower.rm.web.domain.service;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sunflower.rm.web.domain.mapper.InitQuerySendMailBillOfPGMMapper;
import com.sunflower.rm.web.domain.model.base.BaseResponseDto;
import com.sunflower.rm.web.domain.model.base.Error;
import com.sunflower.rm.web.domain.model.request.R01_05_03_01_InitQuerySendMailBillOfPGMRequestDto;
import com.sunflower.rm.web.domain.model.response.R01_05_03_01_InitQuerySendMailBillOfPGMResponseDto;
import com.sunflower.rm.web.domain.model.response.R01_05_03_01_initQuerySendMailBillDetailOfPGMResponseDto;
import com.sunflower.rm.web.utils.StringUtil;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class InitQuerySendMailBillOfPGMService {
@Resource
private InitQuerySendMailBillOfPGMMapper initQuerySendMailBillOfPGMMapper;
public ResponseEntity initQuerySendMailBillOfPGMService(R01_05_03_01_InitQuerySendMailBillOfPGMRequestDto r01_05_03_01_initQuerySendMailBillOfPGMRequestDto) {
BaseResponseDto response = new BaseResponseDto();
//入力データがないの場合、エラーとする。
if (StringUtil.isEmptyOrNull(r01_05_03_01_initQuerySendMailBillOfPGMRequestDto.getPaymentMonth())) {
response.setError(new Error("warns.itemRequired"));
return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
}
String paymentMonth = r01_05_03_01_initQuerySendMailBillOfPGMRequestDto.getPaymentMonth();
List<R01_05_03_01_InitQuerySendMailBillOfPGMResponseDto> r01_05_03_01_InitQuerySendMailBillOfPGMResponseDtoList = initQuerySendMailBillOfPGMMapper.selectInitQuerySendMailBillOfPGM(paymentMonth);
//取得データがないの場合、エラーとする
if (r01_05_03_01_InitQuerySendMailBillOfPGMResponseDtoList.size() == 0) {
response.setError(new Error("error.common.2002"));
return new ResponseEntity(response, HttpStatus.OK);
}
List<R01_05_03_01_initQuerySendMailBillDetailOfPGMResponseDto> r01_05_03_01_InitQuerySendMailBillDetailOfPGMResponseDtoList = initQuerySendMailBillOfPGMMapper.selectRequestDetail(paymentMonth);
for (R01_05_03_01_InitQuerySendMailBillOfPGMResponseDto dataInfo : r01_05_03_01_InitQuerySendMailBillOfPGMResponseDtoList) {
List<R01_05_03_01_initQuerySendMailBillDetailOfPGMResponseDto> detailList = r01_05_03_01_InitQuerySendMailBillDetailOfPGMResponseDtoList.stream()
.filter(item -> item.getGroupId().equals(dataInfo.getGroupId())).collect(Collectors.toList());
dataInfo.setDetailList(detailList);
}
return new ResponseEntity<>((new PageInfo<>(r01_05_03_01_InitQuerySendMailBillOfPGMResponseDtoList)), HttpStatus.OK);
}
}