commit | author | age
|
a18bfa
|
1 |
package com.changhong.epc.count.service.format.impl; |
Z |
2 |
|
|
3 |
import com.changhong.epc.bean.count.format.ButtonInfo; |
|
4 |
import com.changhong.epc.bean.count.format.FormInfo; |
|
5 |
import com.changhong.epc.bean.count.format.FormMsgInfo; |
|
6 |
import com.changhong.epc.bean.tenant.bill.RuleMsg; |
|
7 |
import com.changhong.epc.constter.parsing.ConstRuleMsg; |
|
8 |
import com.changhong.epc.count.mapper.tenant.ruleMsg.RuleMapper; |
|
9 |
import com.changhong.epc.count.service.count.model.CountResultLast; |
|
10 |
import com.iemsoft.framework.cloud.core.tools.MsgTool; |
|
11 |
import com.iemsoft.framework.cloud.core.tools.ObjectUtil; |
|
12 |
import org.springframework.stereotype.Service; |
|
13 |
|
|
14 |
import javax.annotation.Resource; |
|
15 |
import java.util.HashSet; |
|
16 |
import java.util.List; |
|
17 |
import java.util.Set; |
|
18 |
|
|
19 |
/** |
|
20 |
* 计算费用返回规则检查信息 |
|
21 |
*/ |
|
22 |
@Service("formatRuleMsgInfoCount") |
|
23 |
public class FormatRuleMsgInfoCount extends FormatBillInfoCount implements ConstRuleMsg { |
|
24 |
|
|
25 |
@Resource |
|
26 |
private RuleMapper ruleMapper; |
|
27 |
|
|
28 |
@Override |
|
29 |
public void formatResult(FormInfo formInfo, CountResultLast countResultLast) { |
|
30 |
super.formatResult(formInfo, countResultLast); |
|
31 |
|
|
32 |
if(ObjectUtil.empty(formInfo.getOrderCode())) |
|
33 |
return; |
|
34 |
|
|
35 |
RuleMsg ruleMsgParam = new RuleMsg(); |
|
36 |
ruleMsgParam.setCouldNumber(formInfo.getOrderCode()); |
|
37 |
ruleMsgParam.setDataStart(0); |
|
38 |
List<RuleMsg> ruleMsgList = ruleMapper.select(ruleMsgParam); |
|
39 |
|
|
40 |
if(ObjectUtil.empty(ruleMsgList)) |
|
41 |
return; |
|
42 |
// 提示 |
|
43 |
Set<FormMsgInfo.GroupData> msgData = new HashSet<>(); |
|
44 |
ruleMsgList.stream() |
|
45 |
.filter(ruleMsg -> ruleMsg.getResult() == ERROR && ruleMsg.getLevel() == LEVEL_10) |
|
46 |
.forEach(ruleMsg -> { |
|
47 |
msgData.add(new FormMsgInfo.GroupData(ruleMsg.getRulename())); |
|
48 |
}); |
|
49 |
if(ObjectUtil.notEmpty(msgData)){ |
|
50 |
setFormMsgInfo(formInfo, MsgTool.get(BILL_RULE_MSG), msgData); |
|
51 |
} |
|
52 |
|
|
53 |
// 不可提交 |
|
54 |
StringBuilder msg = new StringBuilder(); |
|
55 |
ruleMsgList.stream() |
|
56 |
.filter(ruleMsg -> ruleMsg.getResult() == ERROR && ruleMsg.getLevel() == LEVEL_30) |
|
57 |
.forEach(ruleMsg -> { |
|
58 |
msg.append(ruleMsg.getRulename()).append("</br>"); |
|
59 |
}); |
|
60 |
if(msg.length() > 0){ |
|
61 |
formInfo.getButton().add(new ButtonInfo(false, msg.toString(), SUBMIT_BUTTON)); |
|
62 |
} |
|
63 |
|
|
64 |
} |
|
65 |
} |