Commit da158cd9 by kangxiaoshan

dmp收入

parent a8063e31
...@@ -101,7 +101,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> { ...@@ -101,7 +101,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select contract_code,my_body_code,sale,platform from contract where contract_code in ?1", nativeQuery = true) @Query(value = "select contract_code,my_body_code,sale,platform from contract where contract_code in ?1", nativeQuery = true)
List<Object[]> findByContractCode(List<String> codesList); List<Object[]> findByContractCode(List<String> codesList);
@Query(value = "select contract_code, my_body_name, customer_body, customer_short, business_type, agreement_type from contract where platform = 'dmp' and contract_code in ?1", nativeQuery = true) @Query(value = "select contract_code,my_body_code, my_body_name, customer_body, customer_short, business_type, agreement_type from contract where platform = 'dmp' and contract_code in ?1", nativeQuery = true)
List<Object[]> findByDmpContractCode(List<String> codesList); List<Object[]> findByDmpContractCode(List<String> codesList);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true) @Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
......
...@@ -97,15 +97,20 @@ public class DmpIncomeServiceImpl implements DmpIncomeService { ...@@ -97,15 +97,20 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
List<String> codes = dmpIncomes.stream().map(v -> v.getContractCode()).collect(Collectors.toList()); List<String> codes = dmpIncomes.stream().map(v -> v.getContractCode()).collect(Collectors.toList());
List<Object[]> contracts = contractRepository.findByDmpContractCode(codes); List<Object[]> contracts = contractRepository.findByDmpContractCode(codes);
Map<String, Object[]> names = contracts.stream().collect(Collectors.toMap(v -> v[0] + "", v -> v, (v1, v2) -> v1)); Map<String, Object[]> names = contracts.stream().collect(Collectors.toMap(v -> v[0] + "", v -> v, (v1, v2) -> v1));
Map<String, String> cBodyMap = contractBodyRepository.findAllDis()
.stream().collect(Collectors.toMap(ContractBody::getCode, ContractBody::getName, (v1, v2) -> v1));
for (DmpIncome dmpIncome : dmpIncomes) { for (DmpIncome dmpIncome : dmpIncomes) {
Object[] nameItem = names.get(dmpIncome.getContractCode()); Object[] nameItem = names.get(dmpIncome.getContractCode());
//my_body_name, customer_body, customer_short, business_type, agreement_type //my_body_name, customer_body, customer_short, business_type, agreement_type
if (nameItem != null) { if (nameItem != null) {
dmpIncome.setMyBodyName(nameItem[1] + ""); dmpIncome.setMyBodyName(nameItem[2] + "");
dmpIncome.setCustomerBody(nameItem[2] + ""); dmpIncome.setCustomerBody(nameItem[3] + "");
dmpIncome.setCustomerShort(nameItem[3] + ""); dmpIncome.setCustomerShort(nameItem[4] + "");
dmpIncome.setBusinessType(nameItem[4] + ""); dmpIncome.setBusinessType(nameItem[5] + "");
dmpIncome.setAgreementType(nameItem[5] + ""); dmpIncome.setAgreementType(nameItem[6] + "");
if (StringUtils.isEmpty(dmpIncome.getMyBodyName()) || dmpIncome.getMyBodyName().equals("null")) {
dmpIncome.setMyBodyName(cBodyMap.get(nameItem[1]));
}
} }
} }
return dmpIncomes; return dmpIncomes;
...@@ -444,7 +449,9 @@ public class DmpIncomeServiceImpl implements DmpIncomeService { ...@@ -444,7 +449,9 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
if (StringUtils.isEmpty(income.getContractCode())) { if (StringUtils.isEmpty(income.getContractCode())) {
return null; return null;
} }
income.setTaxRate(Double.parseDouble(income.getTaxRate()) * 100 + "%");
Double taxRate = new BigDecimal(income.getTaxRate()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
income.setTaxRate(taxRate * 100 + "%");
if (StringUtils.isEmpty(income.getSysSettlement())) { if (StringUtils.isEmpty(income.getSysSettlement())) {
income.setSysSettlement("0"); income.setSysSettlement("0");
} }
......
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