Commit fb61fea8 by kangxiaoshan

先回款待录入

parent 942c2079
......@@ -36,6 +36,7 @@ import java.util.Map;
@Controller
@RequestMapping("{platform}/contract")
public class ContractController {
private static final Logger logger = LoggerFactory.getLogger(ContractController.class);
private static final Map<String, String> CONTRACT_STATUS = new HashMap<String, String>() {{
......@@ -55,6 +56,7 @@ public class ContractController {
putdata(this,ContractStatusEnum.MONEY_BACK_ALL);
putdata(this,ContractStatusEnum.MONEY_BACK_PART);
putdata(this,ContractStatusEnum.MONEY_BACK_NONE);
putdata(this,ContractStatusEnum.MONEY_BACK_FIRST);
putdata(this,ContractStatusEnum.DELETE);
}};
......@@ -138,8 +140,9 @@ public class ContractController {
// }
// }
sb.append("日期, 合同编号 ,客户账号 ,签约方名称 ,套餐类型, 销售, 事项 ,金额 ,日期 ,操作人 \r\n");
Long parseSum = 0L;
if(ValidateUtil.isValid(moneyList)){
for (ContractMoney c : moneyList){
sb.append(c.getDs()).append(",")
......@@ -151,9 +154,21 @@ public class ContractController {
.append(map.get(c.getType())).append(",")
.append(c.getMoney()).append(",")
.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());
try {
content = IOUtils.toByteArray(in);
......@@ -234,6 +249,7 @@ public class ContractController {
@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody
public ResultModel create(@CurrentAccount User loginAccount, @RequestBody Contract contract, HttpServletRequest request, @PathVariable String platform) {
Contract contract1 = service.create(loginAccount, contract);
NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract1.getContractCode(), "新建合同","",contract1.toString(), request, platform);
userlog.start();
......
......@@ -359,18 +359,18 @@ public class ContractServiceImpl implements ContractService {
return null;
}
Contract contractExist = contractRepository.findByCode(resource.getContractCode().trim());
if (contractExist != null) {
contractExist = new Contract();
// 合同编号已存在
contractExist.setId(-100L);
contractExist.setErroMessage("合同编号已存在");
if(!StringUtils.isEmpty(resource.getContractCode()) && !ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())){
Contract contractExist = contractRepository.findByCode(resource.getContractCode().trim());
if (contractExist != null) {
contractExist = new Contract();
// 合同编号已存在
contractExist.setId(-100L);
contractExist.setErroMessage("合同编号已存在");
return contractExist;
return contractExist;
}
}
resource.setInvoice(0L);
Long extraFlow = resource.getExtraFlow();
if (extraFlow == null) {
......@@ -380,13 +380,16 @@ public class ContractServiceImpl implements ContractService {
resource.setPayMoney(0L);
}
resource.setDs(DateUtil.getBeforeDays(0));
this.saveIncrementFlow(resource, extraFlow);
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) {
resource.setRelationContract(-1L);
}
......@@ -418,7 +421,7 @@ public class ContractServiceImpl implements ContractService {
private void saveIncrementFlow(Contract resource, Long extraFlow) {
if (resource.getType().equals("main")) {
if ("main".equals(resource.getType())) {
if (resource.getPlatform().equals("tkio")) {
if (!(extraFlow.longValue() == 0)) {
if (resource.getPlatform().equals("tkio")) {
......@@ -888,6 +891,14 @@ public class ContractServiceImpl implements ContractService {
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) {
//未回款
resource.setStatus(ContractStatusEnum.MONEY_BACK_NONE.getKey());
......@@ -910,6 +921,11 @@ public class ContractServiceImpl implements ContractService {
saveContractMoney(money, loginUser, resource, type);
}
if (!StringUtils.isEmpty(first_back)) {
//先回款待录入
resource.setStatus(first_back);
}
} else {
//未回款
......@@ -942,8 +958,11 @@ public class ContractServiceImpl implements ContractService {
saveFlowChange(resource, loginUser, type, resource.getDiscountTimeLong(), resource.getExtraFlow());
}
//处理合同编号
resource.setCodeNum(Integer.parseInt(resource.getContractCode().split("-")[3]));
if (!ContractStatusEnum.MONEY_BACK_FIRST.getKey().equals(resource.getStatus())) {
//处理合同编号
resource.setCodeNum(Integer.parseInt(resource.getContractCode().split("-")[3]));
}
}
......@@ -1659,7 +1678,7 @@ public class ContractServiceImpl implements ContractService {
Map<Long,PackageType> packageTypeMap = 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);
......@@ -1690,13 +1709,15 @@ public class ContractServiceImpl implements ContractService {
if(packageType!=null){
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{
cm.setPackageName("");
}
} 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 {
END("end", "已结束"),
MONEY_BACK_ALL("backall","已回款"),
MONEY_BACK_FIRST("backfirst","先回款待录入"),
MONEY_BACK_NONE("backnone","未回款"),
MONEY_BACK_PART("backpart","部分回款"),
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