Commit 2a73b1e5 by kangxiaoshan

金额改double

parent 281bd949
...@@ -263,7 +263,7 @@ public class ADIAccountServiceImpl implements ADIAccountService { ...@@ -263,7 +263,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
} }
if (payMap.containsKey(aw.getEmail())) { if (payMap.containsKey(aw.getEmail())) {
List<Contract> contractList = payMap.get(aw.getEmail()); List<Contract> contractList = payMap.get(aw.getEmail());
aw.setMoney(contractList.get(contractList.size() - 1).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1).getPayMoney());
aw.setContractStatus(contractRepository.findByPlatformAndEmailLimit1("adi", aw.getEmail(), ContractTypeEnum.MAIN.getKey()).getStatus()); aw.setContractStatus(contractRepository.findByPlatformAndEmailLimit1("adi", aw.getEmail(), ContractTypeEnum.MAIN.getKey()).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} else { } else {
......
...@@ -189,7 +189,7 @@ public class ContractController { ...@@ -189,7 +189,7 @@ public class ContractController {
byte[] content = new byte[0]; byte[] content = new byte[0];
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Long parseSum = 0L; Double parseSum = 0d;
if (ValidateUtil.isValid(moneyList)) { if (ValidateUtil.isValid(moneyList)) {
for (ContractMoney c : moneyList) { for (ContractMoney c : moneyList) {
sb.append(c.getDs()).append(",") sb.append(c.getDs()).append(",")
...@@ -279,7 +279,7 @@ public class ContractController { ...@@ -279,7 +279,7 @@ public class ContractController {
@RequestMapping(value = "find/rebat", method = RequestMethod.GET) @RequestMapping(value = "find/rebat", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResultModel rebat(@CurrentAccount User loginAccount, @RequestParam String product, @RequestParam Integer level, @RequestParam Long money) { public ResultModel rebat(@CurrentAccount User loginAccount, @RequestParam String product, @RequestParam Integer level, @RequestParam Double money) {
return ResultModel.OK(service.getRebat(product, level, money)); return ResultModel.OK(service.getRebat(product, level, money));
} }
......
...@@ -28,7 +28,7 @@ public class Contract { ...@@ -28,7 +28,7 @@ public class Contract {
//套餐 //套餐
private Long priceLevel; private Long priceLevel;
private String priceLevelName; private String priceLevelName;
private Long money; //合同金额 private Double money; //合同金额
private Double rebate; // private Double rebate; //
private Long sale; private Long sale;
...@@ -37,7 +37,7 @@ public class Contract { ...@@ -37,7 +37,7 @@ public class Contract {
private String status; // 作废 先回款待录入 private String status; // 作废 先回款待录入
private String saleName; private String saleName;
private Long payMoney; // 回款金额 private Double payMoney; // 回款金额
private Integer backStatus; // 1 未回款 2 部分回款 3 已回款 private Integer backStatus; // 1 未回款 2 部分回款 3 已回款
private Long invoice; // 开票次数 private Long invoice; // 开票次数
private BigDecimal invoiceMoney; // 发票金额 private BigDecimal invoiceMoney; // 发票金额
...@@ -84,7 +84,7 @@ public class Contract { ...@@ -84,7 +84,7 @@ public class Contract {
private String typeId;// 合同类型 (保密协议、框架合同、结算单) private String typeId;// 合同类型 (保密协议、框架合同、结算单)
private String erroMessage; private String erroMessage;
private String tradeName; private String tradeName;
@Id @Id
...@@ -193,11 +193,11 @@ public class Contract { ...@@ -193,11 +193,11 @@ public class Contract {
this.priceLevel = priceLevel; this.priceLevel = priceLevel;
} }
public Long getMoney() { public Double getMoney() {
return money; return money;
} }
public void setMoney(Long money) { public void setMoney(Double money) {
this.money = money; this.money = money;
} }
...@@ -273,11 +273,11 @@ public class Contract { ...@@ -273,11 +273,11 @@ public class Contract {
this.status = status; this.status = status;
} }
public Long getPayMoney() { public Double getPayMoney() {
return payMoney; return payMoney;
} }
public void setPayMoney(Long payMoney) { public void setPayMoney(Double payMoney) {
this.payMoney = payMoney; this.payMoney = payMoney;
} }
...@@ -346,6 +346,7 @@ public class Contract { ...@@ -346,6 +346,7 @@ public class Contract {
public void setSaleName(String saleName) { public void setSaleName(String saleName) {
this.saleName = saleName; this.saleName = saleName;
} }
@Transient @Transient
public String getPriceLevelName() { public String getPriceLevelName() {
return priceLevelName; return priceLevelName;
...@@ -555,7 +556,6 @@ public class Contract { ...@@ -555,7 +556,6 @@ public class Contract {
} }
public Integer getShareSign() { public Integer getShareSign() {
return shareSign; return shareSign;
} }
......
...@@ -18,7 +18,7 @@ public class ContractChange { ...@@ -18,7 +18,7 @@ public class ContractChange {
private String content; private String content;
private String marke; //备注 private String marke; //备注
private Long level; private Long level;
private Long money; private Double money;
private Long user; private Long user;
private String createName; private String createName;
private String platform; private String platform;
...@@ -139,11 +139,11 @@ public class ContractChange { ...@@ -139,11 +139,11 @@ public class ContractChange {
this.level = level; this.level = level;
} }
public Long getMoney() { public Double getMoney() {
return money; return money;
} }
public void setMoney(Long money) { public void setMoney(Double money) {
this.money = money; this.money = money;
} }
......
...@@ -17,7 +17,7 @@ public class ContractMoney { ...@@ -17,7 +17,7 @@ public class ContractMoney {
private String company; private String company;
private String ds; private String ds;
private String type; private String type;
private Long money; private Double money;
private Long user; private Long user;
private String createName; private String createName;
private String platform; private String platform;
...@@ -66,11 +66,11 @@ public class ContractMoney { ...@@ -66,11 +66,11 @@ public class ContractMoney {
this.type = type; this.type = type;
} }
public Long getMoney() { public Double getMoney() {
return money; return money;
} }
public void setMoney(Long money) { public void setMoney(Double money) {
this.money = money; this.money = money;
} }
......
...@@ -24,7 +24,7 @@ public interface ContractService { ...@@ -24,7 +24,7 @@ public interface ContractService {
//增值服务 //增值服务
List<ContractIncrement> findIncrement(); List<ContractIncrement> findIncrement();
Double getRebat(String product, Integer level, Long money); Double getRebat(String product, Integer level, Double money);
List<Sales> getSales(); List<Sales> getSales();
...@@ -77,5 +77,4 @@ public interface ContractService { ...@@ -77,5 +77,4 @@ public interface ContractService {
ResultModel uploadBatchInfo(MultipartFile file, String platform); ResultModel uploadBatchInfo(MultipartFile file, String platform);
List<Contract> shareIncomeList(User loginAccount, String startDate, String endDate, String platform, String bodyCode,String serchName);
} }
\ No newline at end of file
...@@ -419,7 +419,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -419,7 +419,7 @@ public class ContractServiceImpl implements ContractService {
} }
@Override @Override
public Double getRebat(String product, Integer level, Long money) { public Double getRebat(String product, Integer level, Double money) {
Double rebat = 1d; Double rebat = 1d;
try { try {
PriceLevelMoney levelMoney = priceLevelMoneyRepository.getOne(product, level); PriceLevelMoney levelMoney = priceLevelMoneyRepository.getOne(product, level);
...@@ -479,7 +479,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -479,7 +479,7 @@ public class ContractServiceImpl implements ContractService {
extraFlow = 0L; extraFlow = 0L;
} }
if (resource.getPayMoney() == null) { if (resource.getPayMoney() == null) {
resource.setPayMoney(0L); resource.setPayMoney(0d);
} }
resource.setDs(DateUtil.getBeforeDays(0)); resource.setDs(DateUtil.getBeforeDays(0));
...@@ -642,7 +642,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -642,7 +642,7 @@ public class ContractServiceImpl implements ContractService {
resource.setContractCode(contractCode); resource.setContractCode(contractCode);
} }
resource.setPayMoney(0L); resource.setPayMoney(0d);
resource.setInvoice(0L); resource.setInvoice(0L);
Long extraFlow = resource.getExtraFlow(); Long extraFlow = resource.getExtraFlow();
resource.setDs(DateUtil.getBeforeDays(0)); resource.setDs(DateUtil.getBeforeDays(0));
...@@ -1057,7 +1057,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -1057,7 +1057,7 @@ public class ContractServiceImpl implements ContractService {
if (resource.getPayMoney() != null) { if (resource.getPayMoney() != null) {
if (resource.getMoney() == null) { if (resource.getMoney() == null) {
resource.setMoney(0L); resource.setMoney(0d);
} }
if (ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) { if (ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
...@@ -1105,7 +1105,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -1105,7 +1105,7 @@ public class ContractServiceImpl implements ContractService {
} }
if (resource.getPayMoney() == null) { if (resource.getPayMoney() == null) {
resource.setPayMoney(0L); resource.setPayMoney(0d);
} }
if (resource.getInvoiceMoney() == null) { if (resource.getInvoiceMoney() == null) {
...@@ -1150,7 +1150,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -1150,7 +1150,7 @@ public class ContractServiceImpl implements ContractService {
} else if (money.getType().equals("pay")) { } else if (money.getType().equals("pay")) {
money.setMoney(contract.getMoney()); money.setMoney(contract.getMoney());
} else { } else {
money.setMoney(contract.getInvoiceMoney().longValue()); money.setMoney(contract.getInvoiceMoney().doubleValue());
} }
...@@ -2430,124 +2430,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -2430,124 +2430,7 @@ public class ContractServiceImpl implements ContractService {
return true; return true;
} }
@Deprecated
@Override
public List<Contract> shareIncomeList(User loginAccount, String startDate, String endDate, String
platform, String bodyCode, String serchName) {
List<Contract> contracts = new ArrayList<>();
if ("all".equals(bodyCode)) {
bodyCode = null;
}
List<String> financeBodies = null;
if (RoleEnum.FINANCE.getKey().equals(loginAccount.getRole())) {
Auth auth = authRepository.findByUser(loginAccount.getId());
financeBodies = JSONArray.fromObject(auth.getAuthExtend());
}
String endCreate = new DateTime(endDate).plusDays(1).toString("yyyy-MM-dd");
if (!StringUtils.isEmpty(bodyCode) && !StringUtils.isEmpty(serchName)) {
if (financeBodies != null && !financeBodies.contains(bodyCode)) {
//沒有权限查看
return contracts;
} else {
contracts = contractRepository.findShareContranctByDate1(startDate, endDate, platform, bodyCode, serchName);
}
} else if (!StringUtils.isEmpty(bodyCode)) {
if (financeBodies != null && !financeBodies.contains(bodyCode)) {
//沒有权限查看
return contracts;
} else {
contracts = contractRepository.findShareContranctByDate2(startDate, endDate, platform, bodyCode);
}
} else if (!StringUtils.isEmpty(serchName)) {
if (financeBodies != null) {
contracts = contractRepository.findShareContranctByDateSercheFinace(startDate, endDate, platform, serchName, financeBodies);
} else {
contracts = contractRepository.findShareContranctByDateSerche(startDate, endDate, platform, serchName);
}
} else {
if (financeBodies != null) {
contracts = contractRepository.findShareContranctByDateFinace(startDate, endDate, platform, financeBodies);
} else {
contracts = contractRepository.findShareContranctByDate3(startDate, endDate, platform);
}
}
List<ContractBody> bodies = contractBodyRepository.findAll();
Map<String, String> bodiesNameMap = bodies.stream().collect(
Collectors.toMap(ContractBody::getCode, ContractBody::getName, (v1, v2) -> v1));
DecimalFormat decimalFormat = new DecimalFormat("###,###.00");
contracts.forEach(v -> {
v.setMyBodyName(bodiesNameMap.get(v.getMyBodyCode()));
//不含稅收入
//以下结果统一 *100
// Long excludTax = v.getMoney() * 6 / 100;
Long excludTax = v.getMoney() * 100 - (long) (v.getMoney() * 100 * 0.06);
v.setIncomeExcludingTax(excludTax);
DateTime formStart = new DateTime(startDate);
DateTime formEnd = new DateTime(endDate);
DateTime contractStart = new DateTime(v.getStartDate());
DateTime contractEnd = new DateTime(v.getEndDate());
// 时间范围是否包含合同结束日期
boolean containEnd = formEnd.compareTo(contractEnd) >= 0;
// 时间范围是否包含合同结束开始日期
boolean containStart = formStart.compareTo(contractStart) <= 0;
//所选结束时间包含合同结束时间 取合同结束时间 反之 取所选结束时间
DateTime usedEnd = containEnd ? contractEnd : formEnd;
//所选开始时间包含合同开始时间 则取合同开始时间 反之 取所选开始时间
DateTime usedStart = containStart ? contractStart : formStart;
v.setIntervalUseDays(Days.daysBetween(contractStart, usedEnd).getDays() + 1);//区间使用天数
//合同总天数
int contracAllDays = Days.daysBetween(contractStart, contractEnd).getDays() + 1;
// 处理后的选择范围天数
int contractFormRange = Days.daysBetween(usedStart, usedEnd).getDays() + 1;
//区间分摊收入
//以下结果统一 *100
Long intervalIncome = 0L;
if (containEnd) {
//时间范围合同结束时间时 分两部分计算
//第一部分
double valuePart1 = v.getIncomeExcludingTax() * 1.0 / 100 / contracAllDays * (contractFormRange - 1);
//此处 除100 计算完成再扩大100倍
double valuePart2 = v.getIncomeExcludingTax() * 1.0 / 100 -
((v.getIncomeExcludingTax() * 1.0 / 100 / contracAllDays * (contracAllDays - 1)));
intervalIncome = new BigDecimal(valuePart1 + valuePart2).setScale(2, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(100L)).longValue();
v.setIntervaIncomeShare(intervalIncome);
} else {
intervalIncome = (new BigDecimal(v.getIncomeExcludingTax() * 1.0 / 100 / contracAllDays * contractFormRange).
setScale(2, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(100L))).longValue();
v.setIntervaIncomeShare(intervalIncome);
}
if (v.getAdjustmentFund() == null) {
v.setAdjustmentFund(0L);
}
//分摊总收入
v.setIncomeShareAll(intervalIncome + v.getAdjustmentFund());
});
return contracts;
}
public static void main(String[] args) { public static void main(String[] args) {
// String dateStr1 = "2019-04-30"; // String dateStr1 = "2019-04-30";
......
...@@ -209,7 +209,7 @@ public class TkioAccountServiceImpl implements TkioAccountService { ...@@ -209,7 +209,7 @@ public class TkioAccountServiceImpl implements TkioAccountService {
} }
if(payMap.containsKey(aw.getEmail())){ if(payMap.containsKey(aw.getEmail())){
List<Contract> contractList = payMap.get(aw.getEmail()); List<Contract> contractList = payMap.get(aw.getEmail());
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractRepository.findByPlatformAndEmailLimit1("tkio", aw.getEmail(), ContractTypeEnum.MAIN.getKey()).getStatus()); aw.setContractStatus(contractRepository.findByPlatformAndEmailLimit1("tkio", aw.getEmail(), ContractTypeEnum.MAIN.getKey()).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} else{ } else{
...@@ -274,7 +274,7 @@ public class TkioAccountServiceImpl implements TkioAccountService { ...@@ -274,7 +274,7 @@ public class TkioAccountServiceImpl implements TkioAccountService {
} }
List<Contract> contractList = contractRepository.findByPlatformAndEmail("tkio", email,ContractTypeEnum.MAIN.getKey()); List<Contract> contractList = contractRepository.findByPlatformAndEmail("tkio", email,ContractTypeEnum.MAIN.getKey());
if(ValidateUtil.isValid(contractList)){ if(ValidateUtil.isValid(contractList)){
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus()); aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} else{ } else{
......
...@@ -89,7 +89,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{ ...@@ -89,7 +89,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{
} }
if(payMap.containsKey(aw.getEmail())){ if(payMap.containsKey(aw.getEmail())){
List<Contract> contractList = payMap.get(aw.getEmail()); List<Contract> contractList = payMap.get(aw.getEmail());
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus()); aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} else{ } else{
...@@ -143,7 +143,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{ ...@@ -143,7 +143,7 @@ public class TrackAccountServiceImpl implements TrackAccountService{
} }
List<Contract> contractList = contractRepository.findByPlatformAndEmail("track", email, ContractTypeEnum.MAIN.getKey()); List<Contract> contractList = contractRepository.findByPlatformAndEmail("track", email, ContractTypeEnum.MAIN.getKey());
if(ValidateUtil.isValid(contractList)){ if(ValidateUtil.isValid(contractList)){
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus()); aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} else{ } else{
......
...@@ -203,7 +203,7 @@ public class IOAccountServiceImpl implements IOAccountService { ...@@ -203,7 +203,7 @@ public class IOAccountServiceImpl implements IOAccountService {
} }
if(payMap.containsKey(aw.getEmail())){ if(payMap.containsKey(aw.getEmail())){
List<Contract> contractList = payMap.get(aw.getEmail()); List<Contract> contractList = payMap.get(aw.getEmail());
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractRepository.findByPlatformAndEmailLimit1("io", aw.getEmail(), ContractTypeEnum.MAIN.getKey()).getStatus()); aw.setContractStatus(contractRepository.findByPlatformAndEmailLimit1("io", aw.getEmail(), ContractTypeEnum.MAIN.getKey()).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} else{ } else{
...@@ -245,7 +245,7 @@ public class IOAccountServiceImpl implements IOAccountService { ...@@ -245,7 +245,7 @@ public class IOAccountServiceImpl implements IOAccountService {
} }
List<Contract> contractList = contractRepository.findByPlatformAndEmail("io", email,ContractTypeEnum.MAIN.getKey()); List<Contract> contractList = contractRepository.findByPlatformAndEmail("io", email,ContractTypeEnum.MAIN.getKey());
if(ValidateUtil.isValid(contractList)){ if(ValidateUtil.isValid(contractList)){
aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney()); //aw.setMoney(contractList.get(contractList.size() - 1 ).getPayMoney());
aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus()); aw.setContractStatus(contractList.get(contractList.size() - 1 ).getStatus());
aw.setContractTime(contractList.size()); aw.setContractTime(contractList.size());
} 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