Commit a84613ac by lzxry

行政区域/隶属集团

parent 08972830
...@@ -603,4 +603,17 @@ public class ContractController { ...@@ -603,4 +603,17 @@ public class ContractController {
} }
} }
/**
* 功能描述:新建合同回显、获取行政区域列表
* @author liyin
* @date 2020/9/23
*/
@GetMapping("/getBarrioCities")
@ResponseBody
public ResultModel getBarrioCities(){
return ResultModel.OK(service.getBarrioCities());
}
} }
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* @author liyin
* @description
* @date
*/
@Entity
public class BarrioCity {
private Long id;
private String name;
private Long parentId;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
}
package common.model;
import java.util.List;
/**
* @author liyin
* @description
* @date
*/
public class BarrioCityVO {
private BarrioCity parentCity;
private List<BarrioCity> cities;
public BarrioCity getParentCity() {
return parentCity;
}
public void setParentCity(BarrioCity parentCity) {
this.parentCity = parentCity;
}
public List<BarrioCity> getCities() {
return cities;
}
public void setCitys(List<BarrioCity> cities) {
this.cities = cities;
}
}
...@@ -66,6 +66,9 @@ public class Contract { ...@@ -66,6 +66,9 @@ public class Contract {
private Integer shareSign;//标记是否计算分摊收入 1 计算 0 不计算 private Integer shareSign;//标记是否计算分摊收入 1 计算 0 不计算
private String searchName; private String searchName;
private List<String> customBodyNames; private List<String> customBodyNames;
...@@ -86,6 +89,9 @@ public class Contract { ...@@ -86,6 +89,9 @@ public class Contract {
private String erroMessage; private String erroMessage;
private String tradeName; private String tradeName;
private Long barrioId;//行政区域id
private String barrioName;//行政区域名称
private String belongGroup;//隶属集团
@Id @Id
@GeneratedValue @GeneratedValue
...@@ -501,32 +507,20 @@ public class Contract { ...@@ -501,32 +507,20 @@ public class Contract {
this.adjustmentFundForm = adjustmentFundForm; this.adjustmentFundForm = adjustmentFundForm;
} }
public Long getBarrioId() {
return barrioId;
}
@Override public void setBarrioId(Long barrioId) {
public String toString() { this.barrioId = barrioId;
return "Contract{" + }
"id=" + id +
", product='" + product + '\'' + public String getBelongGroup() {
", myBodyName='" + myBodyName + '\'' + return belongGroup;
", myBodyCode='" + myBodyCode + '\'' + }
", customerBody='" + customerBody + '\'' +
", email='" + email + '\'' + public void setBelongGroup(String belongGroup) {
", contractCode='" + contractCode + '\'' + this.belongGroup = belongGroup;
", contractType='" + contractType + '\'' +
", startDate='" + startDate + '\'' +
", endDate='" + endDate + '\'' +
", priceLevel=" + priceLevel +
", money=" + money +
", rebate=" + rebate +
", sale=" + sale +
", platform='" + platform + '\'' +
", status='" + status + '\'' +
", modifyAccount=" + modifyAccount +
", createAccount=" + createAccount +
", modifyTime=" + modifyTime +
", createTime=" + createTime +
", ds='" + ds + '\'' +
'}';
} }
public Integer getBackStatus() { public Integer getBackStatus() {
...@@ -563,4 +557,75 @@ public class Contract { ...@@ -563,4 +557,75 @@ public class Contract {
public void setShareSign(Integer shareSign) { public void setShareSign(Integer shareSign) {
this.shareSign = shareSign; this.shareSign = shareSign;
} }
@Transient
public String getBarrioName() {
return barrioName;
}
public void setBarrioName(String barrioName) {
this.barrioName = barrioName;
}
@Override
public String toString() {
return "Contract{" +
"id=" + id +
", product='" + product + '\'' +
", myBodyName='" + myBodyName + '\'' +
", myBodyCode='" + myBodyCode + '\'' +
", customerBody='" + customerBody + '\'' +
", email='" + email + '\'' +
", contractCode='" + contractCode + '\'' +
", codeNum=" + codeNum +
", contractType='" + contractType + '\'' +
", startDate='" + startDate + '\'' +
", endDate='" + endDate + '\'' +
", priceLevel=" + priceLevel +
", priceLevelName='" + priceLevelName + '\'' +
", money=" + money +
", rebate=" + rebate +
", sale=" + sale +
", platform='" + platform + '\'' +
", status='" + status + '\'' +
", saleName='" + saleName + '\'' +
", payMoney=" + payMoney +
", backStatus=" + backStatus +
", invoice=" + invoice +
", invoiceMoney=" + invoiceMoney +
", createName='" + createName + '\'' +
", type='" + type + '\'' +
", priceName=" + priceName +
", old=" + old +
", extraFlow=" + extraFlow +
", modifyAccount=" + modifyAccount +
", createAccount=" + createAccount +
", modifyTime=" + modifyTime +
", createTime=" + createTime +
", ds='" + ds + '\'' +
", virtual=" + virtual +
", firstBackId=" + firstBackId +
", adjustmentFund=" + adjustmentFund +
", adjustmentFundForm='" + adjustmentFundForm + '\'' +
", intervalUseDays=" + intervalUseDays +
", incomeExcludingTax=" + incomeExcludingTax +
", intervaIncomeShare=" + intervaIncomeShare +
", incomeShareAll=" + incomeShareAll +
", shareSign=" + shareSign +
", searchName='" + searchName + '\'' +
", customBodyNames=" + customBodyNames +
", discountTimeLong=" + discountTimeLong +
", customerShort='" + customerShort + '\'' +
", customerThird='" + customerThird + '\'' +
", tradeType=" + tradeType +
", relationContract=" + relationContract +
", relationCode='" + relationCode + '\'' +
", hasDiscount='" + hasDiscount + '\'' +
", typeId='" + typeId + '\'' +
", erroMessage='" + erroMessage + '\'' +
", tradeName='" + tradeName + '\'' +
", barrioId=" + barrioId +
", belongGroup='" + belongGroup + '\'' +
'}';
}
} }
...@@ -77,4 +77,5 @@ public interface ContractService { ...@@ -77,4 +77,5 @@ public interface ContractService {
ResultModel uploadBatchInfo(MultipartFile file, String platform); ResultModel uploadBatchInfo(MultipartFile file, String platform);
Object getBarrioCities();
} }
\ No newline at end of file
...@@ -50,6 +50,7 @@ import java.text.DateFormat; ...@@ -50,6 +50,7 @@ import java.text.DateFormat;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -210,6 +211,9 @@ public class ContractServiceImpl implements ContractService { ...@@ -210,6 +211,9 @@ public class ContractServiceImpl implements ContractService {
@Autowired @Autowired
QcloudAccountRepository qcloudAccountRepository; QcloudAccountRepository qcloudAccountRepository;
@Autowired
private BarrioCityRepository barrioCityRepository;
@Override @Override
public Map<String, Object> checkAccount(String email, String platfrom) { public Map<String, Object> checkAccount(String email, String platfrom) {
...@@ -1349,11 +1353,13 @@ public class ContractServiceImpl implements ContractService { ...@@ -1349,11 +1353,13 @@ public class ContractServiceImpl implements ContractService {
Map<String, String> tradeTypeMap = tradeTypeRepsitory.findAll().stream().collect(Collectors.toMap(v -> v.getId().toString(), v -> v.getName())); Map<String, String> tradeTypeMap = tradeTypeRepsitory.findAll().stream().collect(Collectors.toMap(v -> v.getId().toString(), v -> v.getName()));
if (ValidateUtil.isValid(contractList)) { if (ValidateUtil.isValid(contractList)) {
List<BarrioCity> barrioCities = barrioCityRepository.findAll();
Map<Long, BarrioCity> barrioCitiesNameMap = barrioCities.stream().collect(Collectors.toMap(BarrioCity::getId, Function.identity(), (v1, v2) -> v1));
for (Contract c : contractList) { for (Contract c : contractList) {
c.setMyBodyName(bodyMap.get(c.getMyBodyCode())); c.setMyBodyName(bodyMap.get(c.getMyBodyCode()));
c.setTradeName(tradeTypeMap.get(c.getTradeType() + "")); c.setTradeName(tradeTypeMap.get(c.getTradeType() + ""));
c.setDs(new DateTime(c.getCreateTime()).toString("yyyy-MM-dd")); c.setDs(new DateTime(c.getCreateTime()).toString("yyyy-MM-dd"));
c.setBarrioName(barrioCitiesNameMap.get(barrioCitiesNameMap.get(c.getBarrioId()).getParentId()).getName());
if ((c.getExtraFlow() != null && c.getExtraFlow() > 0) || if ((c.getExtraFlow() != null && c.getExtraFlow() > 0) ||
(c.getDiscountTimeLong() != null && c.getDiscountTimeLong() > 0)) { (c.getDiscountTimeLong() != null && c.getDiscountTimeLong() > 0)) {
...@@ -2226,6 +2232,19 @@ public class ContractServiceImpl implements ContractService { ...@@ -2226,6 +2232,19 @@ public class ContractServiceImpl implements ContractService {
} }
} }
@Override
public Object getBarrioCities() {
List<BarrioCity> barrioCities = barrioCityRepository.findByParentId(0L);
ArrayList<BarrioCityVO> objects = new ArrayList<>();
for (BarrioCity barrioCity : barrioCities) {
BarrioCityVO barrioCityVO = new BarrioCityVO();
barrioCityVO.setParentCity(barrioCity);
barrioCityVO.setCitys(barrioCityRepository.findByParentId(barrioCity.getId()));
objects.add(barrioCityVO);
}
return objects;
}
public ResultModel saveDataBySheet(Sheet sheet, int row_length, String platformexcl) { public ResultModel saveDataBySheet(Sheet sheet, int row_length, String platformexcl) {
String sheetName = sheet.getSheetName(); String sheetName = sheet.getSheetName();
......
...@@ -3,10 +3,7 @@ package common.service.impl; ...@@ -3,10 +3,7 @@ package common.service.impl;
import com.amazonaws.services.dynamodbv2.xspec.B; import com.amazonaws.services.dynamodbv2.xspec.B;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import common.model.*; import common.model.*;
import common.repository.AuthRepository; import common.repository.*;
import common.repository.ContractBodyRepository;
import common.repository.ContractChangeRepository;
import common.repository.ContractRepository;
import common.service.ShareIncomeService; import common.service.ShareIncomeService;
import dic.ContractStatusEnum; import dic.ContractStatusEnum;
import dic.RoleEnum; import dic.RoleEnum;
...@@ -24,6 +21,7 @@ import java.math.BigDecimal; ...@@ -24,6 +21,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -40,6 +38,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -40,6 +38,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
private ContractBodyRepository contractBodyRepository; private ContractBodyRepository contractBodyRepository;
@Autowired @Autowired
private ContractChangeRepository contractChangeRepository; private ContractChangeRepository contractChangeRepository;
@Autowired
private BarrioCityRepository barrioCityRepository;
@Override @Override
public List<Contract> shareIncomeList(User loginAccount, String startDate, String endDate, String platform, String bodyCode, String serchName) { public List<Contract> shareIncomeList(User loginAccount, String startDate, String endDate, String platform, String bodyCode, String serchName) {
...@@ -93,6 +93,10 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -93,6 +93,10 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
Map<String, String> bodiesNameMap = bodies.stream().collect( Map<String, String> bodiesNameMap = bodies.stream().collect(
Collectors.toMap(ContractBody::getCode, ContractBody::getName, (v1, v2) -> v1)); Collectors.toMap(ContractBody::getCode, ContractBody::getName, (v1, v2) -> v1));
List<BarrioCity> barrioCities = barrioCityRepository.findAll();
Map<Long, BarrioCity> barrioCitiesNameMap = barrioCities.stream().collect(Collectors.toMap(BarrioCity::getId, Function.identity(), (v1, v2) -> v1));
DateTime start = new DateTime(startDate); DateTime start = new DateTime(startDate);
DateTime end = new DateTime(endDate); DateTime end = new DateTime(endDate);
...@@ -106,6 +110,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -106,6 +110,8 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
streamContract.forEachOrdered(v -> { streamContract.forEachOrdered(v -> {
this.shareIncome4Contract(v, start, end); this.shareIncome4Contract(v, start, end);
v.setMyBodyName(bodiesNameMap.get(v.getMyBodyCode())); v.setMyBodyName(bodiesNameMap.get(v.getMyBodyCode()));
if(v.getBarrioId()!=null)
v.setBarrioName(barrioCitiesNameMap.get(barrioCitiesNameMap.get(v.getBarrioId()).getParentId()).getName());
}); });
} }
logger.info("计算分摊收入耗时:{}", (System.currentTimeMillis() - start_)); logger.info("计算分摊收入耗时:{}", (System.currentTimeMillis() - start_));
......
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