Commit 5ae66cca by kangxiaoshan

调整金

parent 4b36d979
......@@ -2,6 +2,7 @@ package common.controller;
import common.model.*;
import common.service.ContractService;
import common.service.ShareIncomeService;
import dic.AuthMenuEnmm;
import dic.ContractStatusEnum;
import dic.OperateObjectTypeEnum;
......@@ -67,6 +68,9 @@ public class ContractController {
@Autowired
private ContractService service;
@Autowired
private ShareIncomeService shareIncomeService;
@RequestMapping(value = "find", method = RequestMethod.GET)
@ResponseBody
@AuthKey(AuthMenuEnmm.CONTRACTMNG_V)
......@@ -435,7 +439,7 @@ public class ContractController {
@RequestParam String startDate, @RequestParam String endDate,
String bodyCode, String serchName) {
return ResultModel.OK(service.shareIncomeList(loginAccount, startDate, endDate, platform, bodyCode, serchName));
return ResultModel.OK(shareIncomeService.shareIncomeList(loginAccount, startDate, endDate, platform, bodyCode, serchName));
}
......
......@@ -6,6 +6,7 @@ import javax.persistence.Id;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* Created by mxq on 2018/1/16.
......@@ -63,6 +64,10 @@ public class Contract {
private Long intervaIncomeShare;//区间分摊收入(*100的结果)
private Long incomeShareAll;//分摊总收入(*100的结果)
private String searchName;
private List<String> customBodyNames;
/**
* 新增字段 20190427
......@@ -528,4 +533,22 @@ public class Contract {
public void setBackStatus(Integer backStatus) {
this.backStatus = backStatus;
}
@Transient
public String getSearchName() {
return searchName;
}
public void setSearchName(String searchName) {
this.searchName = searchName;
}
@Transient
public List<String> getCustomBodyNames() {
return customBodyNames;
}
public void setCustomBodyNames(List<String> customBodyNames) {
this.customBodyNames = customBodyNames;
}
}
......@@ -14,6 +14,7 @@ public class ContractChange {
private String company;
private String ds;
private String type;
private String status; //合同状态
private String content;
private String marke; //备注
private Long level;
......@@ -203,4 +204,12 @@ public class ContractChange {
public void setDiscountTimeLong(Long discountTimeLong) {
this.discountTimeLong = discountTimeLong;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
......@@ -19,4 +19,6 @@ public interface ContractChangeRepository extends JpaRepository<ContractChange,
@Query(value="SELECT * from contract_change where platform = ?1 and email = ?2 and ds >= ?3 and ds <= ?4 order by ds desc",nativeQuery=true)
List<ContractChange> findByPlatformAndEmail(String platform, String email, String startDate, String endDate);
@Query(value = "select * from contract_change where content=?1 and contract_code=?2 order by create_time desc limit 1",nativeQuery = true)
ContractChange findByContentCode(String type, String contractCode);
}
package common.service;
import common.model.Contract;
import common.model.User;
import java.util.List;
public interface ShareIncomeService {
List<Contract> shareIncomeList(User loginAccount, String startDate, String endDate, String platform, String bodyCode, String serchName);
}
......@@ -1583,12 +1583,8 @@ public class ContractServiceImpl implements ContractService {
@Override
public Contract change(User loginUser, ContractChange resource, FlowChange flowChange) {
Map<Long, String> saleMap = getSaleMap();
Contract contract = contractRepository.findByCode(resource.getContractCode());
Map<Long, String> packageMap = getPackageMap(contract);
// ChangeDelInfo changeDelInfo = new ChangeDelInfo();
// changeDelInfo.setContractCode(contract.getContractCode());
// changeDelInfo.setEmail(contract.getEmail());
if (resource.getType().equals("price")) {
......@@ -1605,25 +1601,24 @@ public class ContractServiceImpl implements ContractService {
//变更优惠记录
this.saveFlowChange(contract, loginUser, "save", resource.getDiscountTimeLong(), resource.getExtraFlow());
// 累加 合同表中数据
if (resource.getExtraFlow() != null) {
contract.setExtraFlow(contract.getExtraFlow() + resource.getExtraFlow());
}
if (resource.getDiscountTimeLong() != null) {
contract.setDiscountTimeLong(contract.getDiscountTimeLong() + resource.getDiscountTimeLong());
}
} else {
// //同步修改trackingio的数据
// if (contract.getPlatform().equals("tkio") && contract.getType().equals("main")) {
// accountService.forbiden(contract);
// } else if (contract.getPlatform().equals("io") && contract.getType().equals("main")) {
// accountIOService.update(contract);
// }
//状态变更
resource.setContent("作废");
contract.setStatus("cancel");
if (ContractStatusEnum.CANCEL.getKey().equals(resource.getStatus())) {
//状态变更
resource.setContent(ContractStatusEnum.CANCEL.getValue());
contract.setStatus(ContractStatusEnum.CANCEL.getKey());
} else if (ContractStatusEnum.SUSPEND.getKey().equals(resource.getStatus())) {
resource.setContent(ContractStatusEnum.SUSPEND.getValue());
contract.setStatus(ContractStatusEnum.SUSPEND.getKey());
}
}
resource.setPlatform(contract.getPlatform());
resource.setCreateAccount(loginUser.getId());
......@@ -1631,11 +1626,27 @@ public class ContractServiceImpl implements ContractService {
resource.setDs(DateUtil.getBeforeDays(0));
resource.setUser(loginUser.getId());
if (ContractStatusEnum.SUSPEND.getKey().equals(resource.getStatus())) {
resource.setCreateTime(new DateTime(resource.getDs()).toDate());
} else {
resource.setCreateTime(new Date());
resource.setDs(DateUtil.getBeforeDays(0));
}
if (!"give".equals(resource.getType())) {
contractChangeRepository.save(resource);
}
return contractRepository.save(contract);
contractRepository.save(contract);
if (ContractStatusEnum.SUSPEND.getKey().equals(contract.getStatus())) {
//获取相关执行合同名称
List<String> codes = contractRepository.findContractBodyNames(contract.getCustomerBody());
contract.setCustomBodyNames(codes);
}
return contract;
}
......@@ -1709,7 +1720,8 @@ public class ContractServiceImpl implements ContractService {
@Override
public List<ChangeDelInfo> getChangeDelData(User loginAccount, String contranctCode, String startDate, String endDate) {
public List<ChangeDelInfo> getChangeDelData(User loginAccount, String contranctCode, String startDate, String
endDate) {
List<ChangeDelInfo> datas = changeDelInfoRepository.findOnStartDate(startDate, endDate);
return datas;
......@@ -1895,7 +1907,8 @@ public class ContractServiceImpl implements ContractService {
@Override
public List<ContractMoney> findPayAll(User loginAccount, String startDate, String endDate, String platfrom, String moneyType, String packageTypeSearch, String money_ids) {
public List<ContractMoney> findPayAll(User loginAccount, String startDate, String endDate, String
platfrom, String moneyType, String packageTypeSearch, String money_ids) {
Map<Long, PackageType> packageTypeMap = new HashMap<>();
Map<Long, String> saleMap = new HashMap<>();
......@@ -1974,7 +1987,8 @@ public class ContractServiceImpl implements ContractService {
return list;
}
private List<ContractMoney> filterContractMoney(List<String> codesList, Map<String, Object> authdata, List<ContractMoney> list, int nextIndex) {
private List<ContractMoney> filterContractMoney
(List<String> codesList, Map<String, Object> authdata, List<ContractMoney> list, int nextIndex) {
if (codesList == null || codesList.size() == 0) {
return list;
......@@ -2114,7 +2128,8 @@ public class ContractServiceImpl implements ContractService {
}
public static Map<String, String> convertBean(Object bean) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
public static Map<String, String> convertBean(Object bean) throws
IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class type = bean.getClass();
Map<String, String> returnMap = new HashMap<String, String>();
BeanInfo beanInfo = Introspector.getBeanInfo(type);
......@@ -2371,7 +2386,8 @@ public class ContractServiceImpl implements ContractService {
}
@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) {
List<Contract> contracts = new ArrayList<>();
......
......@@ -20,6 +20,7 @@ public enum ContractStatusEnum {
MONEY_BACK_FIRST("backfirst", "先回款待录入"),
CANCEL("cancel", "作废"),
SUSPEND("suspend", "中止"),
NFORMAL("normal","常规"),
DELETE("del", "已删除"),
......
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