| | |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.entity.Rule; |
| | | import com.zy.crm.manager.service.RuleService; |
| | | import com.zy.crm.manager.utils.RuleUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | if (Cools.isEmpty(rule.getRuleConnectorType())){ |
| | | rule.setRuleConnectorType(1); |
| | | } |
| | | /* |
| | | * 定义一个规则:头:String ruleHeader;体: String ruleBody;连接符:String ruleConnector;连接符是否启用(0:启用;1:不启用。:Integer ruleConnectorType;规则方式(默认1:当前日期时间戳):Integer ruleType; |
| | | * 根据规则自动生成 |
| | | * */ |
| | | rule.setRulePreview(RuleUtils.rule(rule)); |
| | | ruleService.insert(rule); |
| | | return R.ok(); |
| | | } |
| | |
| | | if (Cools.isEmpty(rule) || null==rule.getId()){ |
| | | return R.error(); |
| | | } |
| | | if (Cools.isEmpty(rule.getRuleConnector())){ |
| | | rule.setRuleConnector("-"); |
| | | rule.setRuleConnectorType(1); |
| | | } |
| | | if (Cools.isEmpty(rule.getRuleConnectorType())){ |
| | | rule.setRuleConnectorType(1); |
| | | } |
| | | rule.setRulePreview(RuleUtils.rule(rule)); |
| | | ruleService.updateById(rule); |
| | | return R.ok(); |
| | | } |