| | |
| | | import cn.gistack.sm.resDataCheck.service.IQualityManageService; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesConditionService; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesService; |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | |
| | | @ApiIgnore |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class RulesClient implements IRulesClient { |
| | | |
| | | private IRulesService rulesService; |
| | |
| | | |
| | | @Override |
| | | public R createDataRules(Long id) { |
| | | log.info("规则匹配中......"); |
| | | // 获取规则对象 返回值有关联水库,只匹配关联水库,为空表示匹配所有水库 |
| | | Rules rules = rulesService.getById(id); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | if (StringUtil.isNotBlank(rules.getIsGate())) { |
| | | sqlStr += "a.\"is_gate\" = " + rules.getIsGate(); |
| | | } |
| | | |
| | | // 拼接条件有问题,不操作 |
| | | if (sqlStr.indexOf("-1") > 0) { |
| | | log.info("查询条件错误,请检查规则设置......:",sqlStr); |
| | | return R.fail(-1,sqlStr + "\\n 查询条件错误,请检查规则设置"); |
| | | } |
| | | |
| | | try { |
| | | qualityManageService.addQualityManage(id,sqlStr); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.info("查询条件错误,请检查规则设置......:",sqlStr); |
| | | } finally { |
| | | log.info("执行完成......:"); |
| | | } |
| | | |
| | | // 执行sql |
| | | return R.data(qualityManageService.addQualityManage(id,sqlStr)); |
| | | return R.success(""); |
| | | } |
| | | } |