Commit 8f41fafa by kangxiaoshan

大后台

parent edebc4d9
...@@ -94,8 +94,8 @@ public class ContractController { ...@@ -94,8 +94,8 @@ public class ContractController {
// byte[] content = new byte[0]; // byte[] content = new byte[0];
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
//时间 合同编号 客户账号 我方签约主体 签约方 行业分类 销售 开始日期 结束日期 套餐类型 合同金额 签约类型 合同状态 关联合同 //录入时间 合同编号 客户账号 我方签约主体 签约方 行业分类 销售 开始日期 结束日期 套餐类型 合同金额 签约类型 合同状态 回款状态 关联合同
sb.append("录入时间,合同编号,客户账号,我方签约主体,签约方,行业分类,销售,开始日期,结束日期,套餐类型,合同金额,签约类型,合同状态,关联合同\r\n"); sb.append("录入时间,合同编号,客户账号,我方签约主体,签约方,行业分类,销售,开始日期,结束日期,套餐类型,合同金额,签约类型,合同状态,回款状态,关联合同\r\n");
if (ValidateUtil.isValid(contractList)) { if (ValidateUtil.isValid(contractList)) {
for (Contract c : contractList) { for (Contract c : contractList) {
sb.append(c.getDs()).append(","). sb.append(c.getDs()).append(",").
...@@ -109,16 +109,16 @@ public class ContractController { ...@@ -109,16 +109,16 @@ public class ContractController {
.append(c.getEndDate()).append(",") .append(c.getEndDate()).append(",")
.append(c.getPriceLevelName()).append(",") .append(c.getPriceLevelName()).append(",")
.append(c.getMoney()).append(",") .append(c.getMoney()).append(",")
// .append(c.getPayMoney()).append(",")
.append(CONTRACT_STATUS.get(c.getContractType())).append(",") .append(CONTRACT_STATUS.get(c.getContractType())).append(",")
.append(CONTRACT_STATUS.get(c.getStatus())).append(",") .append(CONTRACT_STATUS.get(c.getStatus())).append(",")
.append(CONTRACT_STATUS.get(c.getBackStatus()+"")).append(",")
.append(c.getRelationCode() == null ? "" : c.getRelationCode()).append(",") .append(c.getRelationCode() == null ? "" : c.getRelationCode()).append(",")
.append("\r\n"); .append("\r\n");
} }
} }
String fileName = "合同管理_" + new DateTime(startDate).toString("yyyyMMdd") String fileName = "合同管理_" + new DateTime(startDate).toString("yyyyMMdd")+ "_" + new DateTime(endDate).toString("yyyyMMdd")
+ "_" + new DateTime(endDate).toString("yyyyMMdd") + ".csv"; + ".csv";
this.exportWrite(fileName, sb.toString(), "合同管理", response); this.exportWrite(fileName, sb.toString(), "合同管理", response);
// InputStream in = new ByteArrayInputStream(sb.toString().getBytes()); // InputStream in = new ByteArrayInputStream(sb.toString().getBytes());
......
...@@ -83,16 +83,16 @@ public interface ContractRepository extends JpaRepository<Contract, Long> { ...@@ -83,16 +83,16 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select * from contract where contract_code =?2 and platform = ?1 ",nativeQuery = true) @Query(value = "select * from contract where contract_code =?2 and platform = ?1 ",nativeQuery = true)
Contract findOneByCode(String platform, String contractId); Contract findOneByCode(String platform, String contractId);
@Query(value = "select * from contract where (start_date <=?1 and end_date >=?2) or (start_date >=?1 and start_date <=?2) or (end_date >=?1 and end_date <=?2 ) and platform in ?3 and my_body_code in ?4 and id in ?5 and status!='del' order by ds desc",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 in ?3 and my_body_code in ?4 and id in ?5 and status!='del' order by ds desc",nativeQuery = true)
List<Contract> findByDsContractBody(String startDate, String endDate, List<String> platforms, List bodyids, List<String> ids); List<Contract> findByDsContractBody(String startDate, String endDate, List<String> platforms, List bodyids, List<String> ids);
@Query(value = "select * from contract where (start_date <=?1 and end_date >=?2) or (start_date >=?1 and start_date <=?2) or (end_date >=?1 and end_date <=?2 ) and platform = ?3 and my_body_code in ?4 and status!='del' order by ds desc",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 my_body_code in ?4 and status!='del' order by ds desc",nativeQuery = true)
List<Contract> findByDsContractBody(String startDate, String endDate, String platform, List bodyids); List<Contract> findByDsContractBody(String startDate, String endDate, String platform, List bodyids);
@Query(value = "select * from contract where (start_date <=?1 and end_date >=?2) or (start_date >=?1 and start_date <=?2) or (end_date >=?1 and end_date <=?2 ) and platform = ?3 and sale in ?4 and status!='del' order by ds desc",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 sale in ?4 and status!='del' order by ds desc",nativeQuery = true)
List<Contract> findByDsContractSalse(String startDate, String endDate, String platform, List salseid); List<Contract> findByDsContractSalse(String startDate, String endDate, String platform, List salseid);
@Query(value = "select * from contract where (start_date <=?1 and end_date >=?2) or (start_date >=?1 and start_date <=?2) or (end_date >=?1 and end_date <=?2 ) and platform in ?3 and sale in ?4 and id in ?5 and status!='del' order by ds desc",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 in ?3 and sale in ?4 and id in ?5 and status!='del' order by ds desc",nativeQuery = true)
List<Contract> findByDsContractSalse(String startDate, String endDate, List<String> platforms, List salseid, List<String> ids); List<Contract> findByDsContractSalse(String startDate, String endDate, List<String> platforms, List salseid, List<String> ids);
@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)
......
...@@ -460,7 +460,8 @@ public class ContractServiceImpl implements ContractService { ...@@ -460,7 +460,8 @@ public class ContractServiceImpl implements ContractService {
return null; return null;
} }
if (!StringUtils.isEmpty(resource.getContractCode()) && !ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) { if (!StringUtils.isEmpty(resource.getContractCode())
&& !ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
Contract contractExist = contractRepository.findByCode(resource.getContractCode().trim()); Contract contractExist = contractRepository.findByCode(resource.getContractCode().trim());
if (contractExist != null) { if (contractExist != null) {
contractExist = new Contract(); contractExist = new Contract();
...@@ -489,6 +490,8 @@ public class ContractServiceImpl implements ContractService { ...@@ -489,6 +490,8 @@ public class ContractServiceImpl implements ContractService {
if (ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) { if (ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
resource.setStartDate(new DateTime().toString("yyyy-MM-dd")); resource.setStartDate(new DateTime().toString("yyyy-MM-dd"));
} else {
resource.setStatus(ContractStatusEnum.NFORMAL.getKey());
} }
if (resource.getRelationContract() == null) { if (resource.getRelationContract() == null) {
...@@ -540,10 +543,10 @@ public class ContractServiceImpl implements ContractService { ...@@ -540,10 +543,10 @@ public class ContractServiceImpl implements ContractService {
// 自动计算分摊调整金 // 自动计算分摊调整金
//当录入时间与合同开始时间不在一个月时。自动生成调分摊输入调整金。 //当录入时间与合同开始时间不在一个月时。自动生成调分摊输入调整金。
//分摊收入调整金 = 合同金额 * 6% / 合同总天数 *[录入日期前一月最后一日(含) - 合同开始日期] //分摊收入调整金 = 合同金额 * 6% / 合同总天数 *[录入日期前一月最后一日(含) - 合同开始日期]
int day1 = Days.daysBetween(contractStart, contractEnd).getDays()+1; int day1 = Days.daysBetween(contractStart, contractEnd).getDays() + 1;
int day2 = Days.daysBetween(contractStart, new DateTime().plusMonths(-1).dayOfMonth().withMaximumValue()).getDays()+1; int day2 = Days.daysBetween(contractStart, new DateTime().plusMonths(-1).dayOfMonth().withMaximumValue()).getDays() + 1;
long resultValue = new BigDecimal(resource.getMoney() *(1-0.06)/ day1 * day2) long resultValue = new BigDecimal(resource.getMoney() * (1 - 0.06) / day1 * day2)
.setScale(2,BigDecimal.ROUND_HALF_UP) .setScale(2, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(100)).longValue(); .multiply(new BigDecimal(100)).longValue();
resource.setAdjustmentFund(resultValue); // 此处为 *100的结果 resource.setAdjustmentFund(resultValue); // 此处为 *100的结果
} else { } else {
......
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