|
|
|
@ -1,17 +1,18 @@ |
|
|
|
|
package org.jeecg.modules.demo.rulex.controller; |
|
|
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
|
import org.jeecg.modules.demo.functionx.entity.Functionx; |
|
|
|
|
import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper; |
|
|
|
|
import org.jeecg.modules.demo.functionx.service.IFunctionxService; |
|
|
|
@ -20,53 +21,43 @@ import org.jeecg.modules.demo.rulex.entity.Rulex; |
|
|
|
|
import org.jeecg.modules.demo.rulex.mapper.RulexMapper; |
|
|
|
|
import org.jeecg.modules.demo.rulex.service.IRuleVoService; |
|
|
|
|
import org.jeecg.modules.demo.rulex.service.IRulexService; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
import org.jeecg.modules.demo.rulex.util.DateValidator; |
|
|
|
|
import org.jeecg.modules.demo.rulex.util.DateValidatorUsingDateFormat; |
|
|
|
|
import org.jeecg.modules.fieldx.entity.Fieldx; |
|
|
|
|
import org.jeecg.modules.fieldx.service.IFieldxService; |
|
|
|
|
import org.jeecg.modules.modulex.entity.Modulex; |
|
|
|
|
import org.jeecg.modules.modulex.service.IModulexService; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDict; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDictItem; |
|
|
|
|
import org.jeecg.modules.system.mapper.SysDictItemMapper; |
|
|
|
|
import org.jeecg.modules.tablex.entity.Tablex; |
|
|
|
|
import org.jeecg.modules.tablex.service.ITablexService; |
|
|
|
|
import org.jeecg.modules.tablex.ws.WebSocketUtils; |
|
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: 规则管理 |
|
|
|
|
* @Author: jeecg-boot |
|
|
|
|
* @Date: 2023-04-10 |
|
|
|
|
* @Version: V1.0 |
|
|
|
|
*/ |
|
|
|
|
@Api(tags="规则管理") |
|
|
|
|
@Api(tags = "规则管理") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/rulex/rulex") |
|
|
|
|
@Slf4j |
|
|
|
|
public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
@Autowired |
|
|
|
|
private IRulexService rulexService; |
|
|
|
|
@Autowired |
|
|
|
|
private IRuleVoService iRuleVoService; |
|
|
|
|
@Autowired |
|
|
|
|
FunctionxMapper functionxMapper; |
|
|
|
|
@Autowired |
|
|
|
@ -79,13 +70,18 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
ITablexService iTablexService; |
|
|
|
|
@Autowired |
|
|
|
|
IModulexService iModulexService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
RulexController rulexController; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IRulexService rulexService; |
|
|
|
|
@Autowired |
|
|
|
|
private IRuleVoService iRuleVoService; |
|
|
|
|
@Autowired |
|
|
|
|
private SysDictItemMapper sysDictItemMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private WebSocketUtils webSocketUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
@ -97,24 +93,24 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "规则管理-分页列表查询") |
|
|
|
|
@ApiOperation(value="规则管理-分页列表查询", notes="规则管理-分页列表查询") |
|
|
|
|
@ApiOperation(value = "规则管理-分页列表查询", notes = "规则管理-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<?> queryPageList(Rulex rulex, |
|
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
|
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
|
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
// QueryWrapper<Rulex> queryWrapper = QueryGenerator.initQueryWrapper(rulex, req.getParameterMap());
|
|
|
|
|
QueryWrapper<Rulex> queryWrapper=new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("function_id",rulex.getFunctionId()); |
|
|
|
|
QueryWrapper<Rulex> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("function_id", rulex.getFunctionId()); |
|
|
|
|
queryWrapper.orderByDesc("work_level"); |
|
|
|
|
if(rulex.getRuleCode()!=null){ |
|
|
|
|
queryWrapper.eq("rule_code",rulex.getRuleCode()); |
|
|
|
|
if (rulex.getRuleCode() != null) { |
|
|
|
|
queryWrapper.eq("rule_code", rulex.getRuleCode()); |
|
|
|
|
} |
|
|
|
|
if(rulex.getTableId()!=null){ |
|
|
|
|
queryWrapper.eq("table_id",rulex.getTableId()); |
|
|
|
|
if (rulex.getTableId() != null) { |
|
|
|
|
queryWrapper.eq("table_id", rulex.getTableId()); |
|
|
|
|
} |
|
|
|
|
if(rulex.getFieldId()!=null){ |
|
|
|
|
queryWrapper.eq("field_id",rulex.getFieldId()); |
|
|
|
|
if (rulex.getFieldId() != null) { |
|
|
|
|
queryWrapper.eq("field_id", rulex.getFieldId()); |
|
|
|
|
} |
|
|
|
|
Page<Rulex> page = new Page<Rulex>(pageNo, pageSize); |
|
|
|
|
IPage<Rulex> pageList = rulexService.page(page, queryWrapper); |
|
|
|
@ -128,20 +124,20 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "规则管理-添加") |
|
|
|
|
@ApiOperation(value="规则管理-添加", notes="规则管理-添加") |
|
|
|
|
@ApiOperation(value = "规则管理-添加", notes = "规则管理-添加") |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<?> add(@RequestBody Rulex rulex) { |
|
|
|
|
if(rulex.getFunctionId()==null){ |
|
|
|
|
if (rulex.getFunctionId() == null) { |
|
|
|
|
return Result.error("功能点错误!!!"); |
|
|
|
|
} |
|
|
|
|
Functionx functionx = functionxMapper.selectById(rulex.getFunctionId()); |
|
|
|
|
if(functionx.getStartTime()!=null){ |
|
|
|
|
if (functionx.getStartTime() != null) { |
|
|
|
|
rulex.setStartTime(functionx.getStartTime()); |
|
|
|
|
} |
|
|
|
|
if(functionx.getSubmitTime()!=null){ |
|
|
|
|
if (functionx.getSubmitTime() != null) { |
|
|
|
|
rulex.setSubmitTime(functionx.getSubmitTime()); |
|
|
|
|
} |
|
|
|
|
if(functionx.getRealDuration()!=null){ |
|
|
|
|
if (functionx.getRealDuration() != null) { |
|
|
|
|
rulex.setRealDuration(functionx.getRealDuration()); |
|
|
|
|
} |
|
|
|
|
rulex.setManagerUsers(functionx.getManagerUsers()); |
|
|
|
@ -157,7 +153,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "规则管理-编辑") |
|
|
|
|
@ApiOperation(value="规则管理-编辑", notes="规则管理-编辑") |
|
|
|
|
@ApiOperation(value = "规则管理-编辑", notes = "规则管理-编辑") |
|
|
|
|
@PutMapping(value = "/edit") |
|
|
|
|
public Result<?> edit(@RequestBody Rulex rulex) { |
|
|
|
|
rulexService.updateById(rulex); |
|
|
|
@ -171,9 +167,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "规则管理-通过id删除") |
|
|
|
|
@ApiOperation(value="规则管理-通过id删除", notes="规则管理-通过id删除") |
|
|
|
|
@ApiOperation(value = "规则管理-通过id删除", notes = "规则管理-通过id删除") |
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
rulexService.removeById(id); |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
@ -185,9 +181,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "规则管理-批量删除") |
|
|
|
|
@ApiOperation(value="规则管理-批量删除", notes="规则管理-批量删除") |
|
|
|
|
@ApiOperation(value = "规则管理-批量删除", notes = "规则管理-批量删除") |
|
|
|
|
@DeleteMapping(value = "/deleteBatch") |
|
|
|
|
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
|
|
|
|
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|
|
|
|
this.rulexService.removeByIds(Arrays.asList(ids.split(","))); |
|
|
|
|
return Result.OK("批量删除成功!"); |
|
|
|
|
} |
|
|
|
@ -199,11 +195,11 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "规则管理-通过id查询") |
|
|
|
|
@ApiOperation(value="规则管理-通过id查询", notes="规则管理-通过id查询") |
|
|
|
|
@ApiOperation(value = "规则管理-通过id查询", notes = "规则管理-通过id查询") |
|
|
|
|
@GetMapping(value = "/queryById") |
|
|
|
|
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
Rulex rulex = rulexService.getById(id); |
|
|
|
|
if(rulex==null) { |
|
|
|
|
if (rulex == null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
return Result.OK(rulex); |
|
|
|
@ -223,27 +219,39 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
/** |
|
|
|
|
* 通过excel导入数据 |
|
|
|
|
* |
|
|
|
|
* @param request |
|
|
|
|
* @param response |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
public Result<?> importExcel(MultipartFile file) { |
|
|
|
|
|
|
|
|
|
return rulexController.preImportAndExcel(request); |
|
|
|
|
return rulexController.preImportAndExcel(file); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
public Result<?> preImportAndExcel(HttpServletRequest request) { |
|
|
|
|
//return super.importExcel(request, response, ScTeams.class);
|
|
|
|
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
|
|
|
|
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
|
|
|
|
public Result<?> preImportAndExcel(MultipartFile file) { |
|
|
|
|
|
|
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
Map<String, String> message = new HashMap<>(); |
|
|
|
|
message.put("isVisible", "true"); |
|
|
|
|
message.put("uploaded", "0"); |
|
|
|
|
message.put("status", "判断文件结构"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断文件是否是表格
|
|
|
|
|
String originalFilename = file.getOriginalFilename(); |
|
|
|
|
if (StringUtils.isBlank(originalFilename) || |
|
|
|
|
(!originalFilename.endsWith("xls") && |
|
|
|
|
!originalFilename.endsWith("xlsx"))) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件格式不正确"); |
|
|
|
|
} |
|
|
|
|
//校验时间
|
|
|
|
|
final DateValidator validator = new DateValidatorUsingDateFormat("yyyy-MM-dd hh:mm:ss"); |
|
|
|
|
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
|
|
|
|
System.err.println("----------------------------------------------"); |
|
|
|
|
// 获取上传文件对象
|
|
|
|
|
MultipartFile file = entity.getValue(); |
|
|
|
|
if (file==null){ |
|
|
|
|
|
|
|
|
|
if (file == null) { |
|
|
|
|
return Result.error("文件上传失败,请重新上传"); |
|
|
|
|
} |
|
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
@ -251,13 +259,14 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
params.setHeadRows(1);//表头行数,默认1
|
|
|
|
|
params.setNeedSave(true);//是否需要保存上传的Excel,默认为false
|
|
|
|
|
try { |
|
|
|
|
// List<ScTeamsDr> list = ExcelImportUtil.importExcel(file.getInputStream(), ScTeamsDr.class, params);
|
|
|
|
|
message.put("status", "数据预读入"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
List<RuleVo> list = ExcelImportUtil.importExcel(file.getInputStream(), RuleVo.class, params); |
|
|
|
|
if (list == null || list.size() <= 0) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件导入失败:模板中暂无数据"); |
|
|
|
|
} |
|
|
|
|
System.err.println("----------------------------------------------"); |
|
|
|
|
System.out.println("List<ScTeams> list = ExcelImportUtil.importExcel: " + list); |
|
|
|
|
int num = 0; |
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
|
if ( |
|
|
|
@ -277,28 +286,34 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
// list.get(i).getManagerUsers() == null &&
|
|
|
|
|
// list.get(i).getDuration() == null &&
|
|
|
|
|
// list.get(i).getSubmitTime() == null &&
|
|
|
|
|
list.get(i).getRealDuration() == null&& |
|
|
|
|
list.get(i).getStatus() == null|| |
|
|
|
|
list.get(i).getVerisonStatus() == null|| |
|
|
|
|
list.get(i).getRealDuration() == null && |
|
|
|
|
list.get(i).getStatus() == null || |
|
|
|
|
list.get(i).getVerisonStatus() == null || |
|
|
|
|
list.get(i).getVerison() == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
num++; |
|
|
|
|
if (num == 0) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件导入失败:导入模板不匹配"); |
|
|
|
|
// } else if (num!=list.size()) {
|
|
|
|
|
// return Result.error("文件导入失败:请检查填写文字");
|
|
|
|
|
} |
|
|
|
|
iRuleVoService.save(list.get(i)); |
|
|
|
|
} |
|
|
|
|
}catch (Exception e) { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
//update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
|
|
|
|
|
String msg = e.getMessage(); |
|
|
|
|
log.error(msg, e); |
|
|
|
|
//if(msg!=null && msg.contains("Duplicate entry"))
|
|
|
|
|
if (msg != null && msg.indexOf("Duplicate entry") >= 0) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件导入失败:有重复数据!"); |
|
|
|
|
} else { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件导入失败:" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
//update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
|
|
|
|
@ -309,11 +324,17 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<RuleVo> ruleVoList = iRuleVoService.list(); |
|
|
|
|
if (ruleVoList.size()<=0||ruleVoList==null){ |
|
|
|
|
if (ruleVoList.size() <= 0 || ruleVoList == null) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件导入失败,模板不匹配"); |
|
|
|
|
} |
|
|
|
|
// 将总的记录数传递给前端
|
|
|
|
|
message.put("records", String.valueOf(ruleVoList.size())); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ruleVoList.size(); i++) { |
|
|
|
|
Rulex rulex = new Rulex(); |
|
|
|
|
RuleVo ruleVo = ruleVoList.get(i); |
|
|
|
@ -324,6 +345,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
Fieldx byId = iFieldxService.getOne(rulexLambdaQueryWrapper); |
|
|
|
|
if (byId == null) { |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("字段输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setFieldId(byId.getId()); |
|
|
|
@ -334,6 +357,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
Functionx byId1 = functionxService.getOne(functionxLambdaQueryWrapper); |
|
|
|
|
if (byId1 == null) { |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("功能输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setFunctionId(byId1.getId()); |
|
|
|
@ -343,6 +368,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
modulexLambdaQueryWrapper.eq(Modulex::getModuleName, moduleName); |
|
|
|
|
Modulex byId2 = iModulexService.getOne(modulexLambdaQueryWrapper); |
|
|
|
|
if (byId2 == null) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
|
|
return Result.error("模块输入错误,请核对"); |
|
|
|
@ -354,6 +381,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
tableLambdaQueryWrapper.eq(Tablex::getTableName, tableId); |
|
|
|
|
Tablex byId3 = iTablexService.getOne(tableLambdaQueryWrapper); |
|
|
|
|
if (byId3 == null) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
|
|
return Result.error("实体输入错误,请核对"); |
|
|
|
@ -366,7 +395,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
rulex.setDuration(aDouble); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("任务时长输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -375,7 +405,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
d = Double.valueOf(ruleVo.getRealDuration()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("实际时长输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setRealDuration(d); |
|
|
|
@ -384,16 +415,19 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
integer = Integer.valueOf(ruleVo.getWorkLevel()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("任务等级输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setWorkLevel(integer); |
|
|
|
|
String workStatus = ruleVo.getWorkStatus(); |
|
|
|
|
LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId,"1645268542514421762"); |
|
|
|
|
sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762"); |
|
|
|
|
SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper); |
|
|
|
|
if (sysDictItem == null){ |
|
|
|
|
if (sysDictItem == null) { |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("任务状态输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -401,10 +435,12 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
|
|
|
|
|
String status = ruleVo.getStatus(); |
|
|
|
|
LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); |
|
|
|
|
sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId,"1645264493205491713"); |
|
|
|
|
sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713"); |
|
|
|
|
SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2); |
|
|
|
|
if (sysDictItem2 == null){ |
|
|
|
|
if (sysDictItem2 == null) { |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("规则状态输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -416,6 +452,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
SysDictItem sysDictItem3 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper3); |
|
|
|
|
if (sysDictItem3 == null) { |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("版本状态输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -427,23 +465,23 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
try { |
|
|
|
|
String startTime = ruleVo.getStartTime(); |
|
|
|
|
if (startTime != null) |
|
|
|
|
if (!validator.isValid(startTime)){ |
|
|
|
|
if (!validator.isValid(startTime)) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("开始时间输入错误"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
Date date = simpleDateFormat.parse(startTime); |
|
|
|
|
rulex.setStartTime(date); |
|
|
|
|
} |
|
|
|
|
String submitTime = ruleVo.getSubmitTime(); |
|
|
|
|
if (submitTime != null) |
|
|
|
|
if (!validator.isValid(submitTime)){ |
|
|
|
|
if (!validator.isValid(submitTime)) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("提交时间输入错误"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
Date date1 = simpleDateFormat.parse(submitTime); |
|
|
|
|
rulex.setSubmitTime(date1); |
|
|
|
|
} |
|
|
|
@ -456,6 +494,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
List<String> list = rulexMapper.checkRuleNo(byId1.getId()); |
|
|
|
|
if (list.contains(ruleNo)) { |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("规则序号已存在"); |
|
|
|
|
} |
|
|
|
|
rulex.setRuleNo(ruleNo); |
|
|
|
@ -480,7 +520,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
integer1 = Integer.valueOf(ruleVo.getVerison()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("版本号输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setVerison(String.valueOf(integer1)); |
|
|
|
@ -488,16 +529,20 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
String managerUsers = ruleVo.getManagerUsers(); |
|
|
|
|
if (managerUsers != null) |
|
|
|
|
rulex.setManagerUsers(managerUsers); |
|
|
|
|
message.put("status", "正在读取数据"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
//存入真实表
|
|
|
|
|
rulexService.save(rulex); |
|
|
|
|
rulexService.saveRule(rulex,loginUser,message,i+1); |
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
} |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/sort") |
|
|
|
|
public Result<?> sort(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<?> sort(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
return rulexService.sort(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|