Commit 70849a07 by manxiaoqiang

合同

parent 95709d18
......@@ -27,8 +27,8 @@ public class ContractController {
@RequestMapping(value = "find", method = RequestMethod.GET)
@ResponseBody
public ResultModel findAll(@CurrentAccount User loginAccount, @RequestParam String startDate) {
return ResultModel.OK(service.findAll(startDate));
public ResultModel findAll(@CurrentAccount User loginAccount, @RequestParam String startDate, @RequestParam String endDate) {
return ResultModel.OK(service.findAll(startDate, endDate));
}
@RequestMapping(value = "checkAccount", method = RequestMethod.GET)
......
......@@ -29,6 +29,7 @@ public class Contract {
private String status;
private String saleName;
private String priceLevelName;
private Long payMoney;
private Long modifyAccount;
private Long createAccount;
......@@ -206,6 +207,14 @@ public class Contract {
this.status = status;
}
public Long getPayMoney() {
return payMoney;
}
public void setPayMoney(Long payMoney) {
this.payMoney = payMoney;
}
@Transient
public String getSaleName() {
return saleName;
......
......@@ -18,6 +18,6 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value="select count(*) from contract where email = ?1",nativeQuery=true)
BigInteger countNumByEmail(String email);
@Query(value="select * from contract where start_date = ?1 order by start_date desc",nativeQuery=true)
List<Contract> findByDs(String ds);
@Query(value="select * from contract where ds >= ?1 and ds <= ?2 order by ds desc",nativeQuery=true)
List<Contract> findByDs(String startDate, String endDate);
}
......@@ -29,6 +29,6 @@ public interface ContractService {
Contract update(User loginUser, Contract resource);
List<Contract> findAll(String ds);
List<Contract> findAll(String startDate, String endDate);
}
......@@ -94,7 +94,8 @@ public class ContractServiceImpl implements ContractService{
resource.setDs(DateUtil.getBeforeDays(0));
resource.setStatus("executing");
}
Double rebat = getRebat(resource.getProduct(), resource.getPriceLevel().intValue(), resource.getMoney());
resource.setRebate(rebat);
return contractRepository.save(resource);
}
......@@ -104,7 +105,7 @@ public class ContractServiceImpl implements ContractService{
}
@Override
public List<Contract> findAll(String ds) {
public List<Contract> findAll(String startDate, String endDate) {
List<Contract> result = new ArrayList<>();
List<User> sales = userRepository.findAllSales();
Map<Long, String> saleMap = new HashMap<>();
......@@ -120,7 +121,7 @@ public class ContractServiceImpl implements ContractService{
typeMap.put(s.getId(), s.getPackageName());
}
}
List<Contract> contractList = contractRepository.findByDs(ds);
List<Contract> contractList = contractRepository.findByDs(startDate, endDate);
if(ValidateUtil.isValid(contractList)){
for(Contract c : contractList){
c.setSaleName(saleMap.containsKey(c.getSale()) ? saleMap.get(c.getSale()) : "");
......
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