Commit fb61fea8 by kangxiaoshan

先回款待录入

parent 942c2079
...@@ -36,6 +36,7 @@ import java.util.Map; ...@@ -36,6 +36,7 @@ import java.util.Map;
@Controller @Controller
@RequestMapping("{platform}/contract") @RequestMapping("{platform}/contract")
public class ContractController { public class ContractController {
private static final Logger logger = LoggerFactory.getLogger(ContractController.class); private static final Logger logger = LoggerFactory.getLogger(ContractController.class);
private static final Map<String, String> CONTRACT_STATUS = new HashMap<String, String>() {{ private static final Map<String, String> CONTRACT_STATUS = new HashMap<String, String>() {{
...@@ -55,6 +56,7 @@ public class ContractController { ...@@ -55,6 +56,7 @@ public class ContractController {
putdata(this,ContractStatusEnum.MONEY_BACK_ALL); putdata(this,ContractStatusEnum.MONEY_BACK_ALL);
putdata(this,ContractStatusEnum.MONEY_BACK_PART); putdata(this,ContractStatusEnum.MONEY_BACK_PART);
putdata(this,ContractStatusEnum.MONEY_BACK_NONE); putdata(this,ContractStatusEnum.MONEY_BACK_NONE);
putdata(this,ContractStatusEnum.MONEY_BACK_FIRST);
putdata(this,ContractStatusEnum.DELETE); putdata(this,ContractStatusEnum.DELETE);
}}; }};
...@@ -138,8 +140,9 @@ public class ContractController { ...@@ -138,8 +140,9 @@ public class ContractController {
// } // }
// } // }
sb.append("日期, 合同编号 ,客户账号 ,签约方名称 ,套餐类型, 销售, 事项 ,金额 ,日期 ,操作人 \r\n");
Long parseSum = 0L;
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(",")
...@@ -151,9 +154,21 @@ public class ContractController { ...@@ -151,9 +154,21 @@ public class ContractController {
.append(map.get(c.getType())).append(",") .append(map.get(c.getType())).append(",")
.append(c.getMoney()).append(",") .append(c.getMoney()).append(",")
.append(c.getCreateName()).append("\r\n"); .append(c.getCreateName()).append("\r\n");
if("pay".equals(c.getType())){
// 付款
parseSum += c.getMoney();
}else{
parseSum -= c.getMoney();
} }
} }
}
sb.append("日期, 合同编号 ,客户账号 ,签约方名称 ,套餐类型, 销售, 事项 ,金额 ,操作人 \r\n");
sb.append("汇总, - , - , - , - , - , - ,").append(parseSum).append(" , - \r\n");
InputStream in = new ByteArrayInputStream(sb.toString().getBytes()); InputStream in = new ByteArrayInputStream(sb.toString().getBytes());
try { try {
content = IOUtils.toByteArray(in); content = IOUtils.toByteArray(in);
...@@ -234,6 +249,7 @@ public class ContractController { ...@@ -234,6 +249,7 @@ public class ContractController {
@RequestMapping(value = "create", method = RequestMethod.POST) @RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public ResultModel create(@CurrentAccount User loginAccount, @RequestBody Contract contract, HttpServletRequest request, @PathVariable String platform) { public ResultModel create(@CurrentAccount User loginAccount, @RequestBody Contract contract, HttpServletRequest request, @PathVariable String platform) {
Contract contract1 = service.create(loginAccount, contract); Contract contract1 = service.create(loginAccount, contract);
NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract1.getContractCode(), "新建合同","",contract1.toString(), request, platform); NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract1.getContractCode(), "新建合同","",contract1.toString(), request, platform);
userlog.start(); userlog.start();
......
...@@ -359,8 +359,8 @@ public class ContractServiceImpl implements ContractService { ...@@ -359,8 +359,8 @@ public class ContractServiceImpl implements ContractService {
return null; return null;
} }
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();
// 合同编号已存在 // 合同编号已存在
...@@ -369,7 +369,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -369,7 +369,7 @@ public class ContractServiceImpl implements ContractService {
return contractExist; return contractExist;
} }
}
resource.setInvoice(0L); resource.setInvoice(0L);
Long extraFlow = resource.getExtraFlow(); Long extraFlow = resource.getExtraFlow();
...@@ -380,13 +380,16 @@ public class ContractServiceImpl implements ContractService { ...@@ -380,13 +380,16 @@ public class ContractServiceImpl implements ContractService {
resource.setPayMoney(0L); resource.setPayMoney(0L);
} }
resource.setDs(DateUtil.getBeforeDays(0)); resource.setDs(DateUtil.getBeforeDays(0));
this.saveIncrementFlow(resource, extraFlow); this.saveIncrementFlow(resource, extraFlow);
this.dealContractStatus(resource, loginUser, "save"); this.dealContractStatus(resource, loginUser, "save");
if (ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
resource.setStartDate(new DateTime().toString("yyyy-MM-dd"));
}
if (resource.getRelationContract() == null) { if (resource.getRelationContract() == null) {
resource.setRelationContract(-1L); resource.setRelationContract(-1L);
} }
...@@ -418,7 +421,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -418,7 +421,7 @@ public class ContractServiceImpl implements ContractService {
private void saveIncrementFlow(Contract resource, Long extraFlow) { private void saveIncrementFlow(Contract resource, Long extraFlow) {
if (resource.getType().equals("main")) { if ("main".equals(resource.getType())) {
if (resource.getPlatform().equals("tkio")) { if (resource.getPlatform().equals("tkio")) {
if (!(extraFlow.longValue() == 0)) { if (!(extraFlow.longValue() == 0)) {
if (resource.getPlatform().equals("tkio")) { if (resource.getPlatform().equals("tkio")) {
...@@ -888,6 +891,14 @@ public class ContractServiceImpl implements ContractService { ...@@ -888,6 +891,14 @@ public class ContractServiceImpl implements ContractService {
resource.setMoney(0L); resource.setMoney(0L);
} }
String first_back = null;
if (ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
first_back = resource.getStatus();
}
if (resource.getPayMoney().longValue() <= 0) { if (resource.getPayMoney().longValue() <= 0) {
//未回款 //未回款
resource.setStatus(ContractStatusEnum.MONEY_BACK_NONE.getKey()); resource.setStatus(ContractStatusEnum.MONEY_BACK_NONE.getKey());
...@@ -910,6 +921,11 @@ public class ContractServiceImpl implements ContractService { ...@@ -910,6 +921,11 @@ public class ContractServiceImpl implements ContractService {
saveContractMoney(money, loginUser, resource, type); saveContractMoney(money, loginUser, resource, type);
} }
if (!StringUtils.isEmpty(first_back)) {
//先回款待录入
resource.setStatus(first_back);
}
} else { } else {
//未回款 //未回款
...@@ -942,11 +958,14 @@ public class ContractServiceImpl implements ContractService { ...@@ -942,11 +958,14 @@ public class ContractServiceImpl implements ContractService {
saveFlowChange(resource, loginUser, type, resource.getDiscountTimeLong(), resource.getExtraFlow()); saveFlowChange(resource, loginUser, type, resource.getDiscountTimeLong(), resource.getExtraFlow());
} }
if (!ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
//处理合同编号 //处理合同编号
resource.setCodeNum(Integer.parseInt(resource.getContractCode().split("-")[3])); resource.setCodeNum(Integer.parseInt(resource.getContractCode().split("-")[3]));
} }
}
//保存开票收款记录 //保存开票收款记录
private void saveContractMoney(ContractMoney money, User loginUser, Contract contract, String type) { private void saveContractMoney(ContractMoney money, User loginUser, Contract contract, String type) {
...@@ -1659,7 +1678,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -1659,7 +1678,7 @@ public class ContractServiceImpl implements ContractService {
Map<Long,PackageType> packageTypeMap = new HashMap<>(); Map<Long,PackageType> packageTypeMap = new HashMap<>();
Map<Long, String> saleMap = new HashMap<>(); Map<Long, String> saleMap = new HashMap<>();
Map<Long, String> packageBaseMap = new HashMap<>(); Map<Long, PackageBase> packageBaseMap = new HashMap<>();
this.getDicMapDatas(saleMap,packageTypeMap,null,null,packageBaseMap,platfrom); this.getDicMapDatas(saleMap,packageTypeMap,null,null,packageBaseMap,platfrom);
...@@ -1690,13 +1709,15 @@ public class ContractServiceImpl implements ContractService { ...@@ -1690,13 +1709,15 @@ public class ContractServiceImpl implements ContractService {
if(packageType!=null){ if(packageType!=null){
String flow = packageType.getTrackFlow().intValue()<0?"无限制": packageType.getTrackFlow().intValue()/10000+"万/年"; String flow = packageType.getTrackFlow().intValue()<0?"无限制": packageType.getTrackFlow().intValue()/10000+"万/年";
cm.setPackageName(packageType.getPackageName()+" 流量"+flow+" APP"+packageType.getAppNum()+"个");
cm.setPackageName(packageType.getPackageName()+": 流量"+flow+", APP"+packageType.getAppNum()+"个");
}else{ }else{
cm.setPackageName(""); cm.setPackageName("");
} }
} else { } else {
cm.setPackageName(packageBaseMap.get(cm.getPriceLevel()) == null ? "" : packageBaseMap.get(cm.getPriceLevel())); cm.setPackageName(packageBaseMap.get(cm.getPriceLevel()) == null ? "" : packageBaseMap.get(cm.getPriceLevel()).getPackageName());
} }
} }
......
...@@ -11,6 +11,7 @@ public enum ContractStatusEnum { ...@@ -11,6 +11,7 @@ public enum ContractStatusEnum {
END("end", "已结束"), END("end", "已结束"),
MONEY_BACK_ALL("backall","已回款"), MONEY_BACK_ALL("backall","已回款"),
MONEY_BACK_FIRST("backfirst","先回款待录入"),
MONEY_BACK_NONE("backnone","未回款"), MONEY_BACK_NONE("backnone","未回款"),
MONEY_BACK_PART("backpart","部分回款"), MONEY_BACK_PART("backpart","部分回款"),
CANCEL("cancel", "作废"), CANCEL("cancel", "作废"),
......
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