feat: 工作流修改

master
李小林 6 months ago
parent 71bf886eed
commit b4fb9f9d3b
  1. 12
      src/main/java/com/bellmann/controller/PlanCollectorController.java
  2. 4
      src/main/java/com/bellmann/service/PlanCollectorService.java
  3. 29
      src/main/java/com/bellmann/service/impl/PlanCollectorServiceImpl.java
  4. 12
      src/main/java/com/bellmann/service/impl/PlanFilterConfigServiceImpl.java
  5. 2
      src/main/resources/mapper/PlanFilterConfigMapper.xml

@ -27,6 +27,12 @@ public class PlanCollectorController {
boolean result = planCollectorService.addWorkflow(form);
return Result.judge(result);
}
@PostMapping("update")
@Operation(summary = "修改工作流")
public Result<String> updateWorkflow(@RequestBody PlanFilterConfigForm form){
boolean result = planCollectorService.updateWorkflow(form);
return Result.judge(result);
}
@PostMapping("page")
@Operation(summary = "工作流分页")
public PageResult<WorkFlowVO> workflowPage(@RequestBody SelectQuery query){
@ -45,4 +51,10 @@ public class PlanCollectorController {
boolean result = planCollectorService.updateWorkflowStatus(planId,status);
return Result.judge(result);
}
@GetMapping("/info/{planId}")
@Operation(summary = "获取工作流信息")
public Result<PlanFilterConfigForm> getWorkflowForm(@PathVariable Long planId){
PlanFilterConfigForm result = planCollectorService.getWorkflowForm(planId);
return Result.success(result);
}
}

@ -13,4 +13,8 @@ public interface PlanCollectorService {
boolean removeWorkflow(Long planId);
boolean updateWorkflowStatus(Long planId, Integer status);
PlanFilterConfigForm getWorkflowForm(Long planId);
boolean updateWorkflow(PlanFilterConfigForm form);
}

@ -1,5 +1,7 @@
package com.bellmann.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -39,6 +41,19 @@ public class PlanCollectorServiceImpl implements PlanCollectorService {
return rows>0;
}
@Override
public boolean updateWorkflow(PlanFilterConfigForm form) {
WorkFlowForm workFlowForm = form.getWorkFlowForm();
List<PlanFilterForm> filterFormList = form.getPlanFilterForm();
PlanCollector planCollector = new PlanCollector();
BeanUtil.copyProperties(workFlowForm,planCollector);
planCollector.setPlanFilter(filterFormList);
int rows = planCollectorMapper.update(planCollector, new LambdaQueryWrapper<PlanCollector>()
.eq(PlanCollector::getPlanId, workFlowForm.getPlanId())
);
return rows>0;
}
@Override
public Page<WorkFlowVO> workflowPage(SelectQuery query) {
int pageNum = query.getPageNum();
@ -64,4 +79,18 @@ public class PlanCollectorServiceImpl implements PlanCollectorService {
);
return rows>0;
}
@Override
public PlanFilterConfigForm getWorkflowForm(Long planId) {
PlanCollector planCollector = planCollectorMapper.selectOne(new LambdaQueryWrapper<PlanCollector>()
.eq(PlanCollector::getPlanId, planId)
);
WorkFlowForm workFlowForm = new WorkFlowForm();
BeanUtil.copyProperties(planCollector,workFlowForm);
List<PlanFilterForm> list = JSONUtil.toList((String) planCollector.getPlanFilter(), PlanFilterForm.class);
PlanFilterConfigForm form = new PlanFilterConfigForm();
form.setPlanFilterForm(list);
form.setWorkFlowForm(workFlowForm);
return form;
}
}

@ -23,15 +23,18 @@ public class PlanFilterConfigServiceImpl implements PlanFilterConfigService {
private final JdbcTemplate jdbcTemplate;
@Override
public List<PlanFilterConfigOption> configOption() {
List<String> filterNames = new ArrayList<>();
List<PlanFilterConfigOption> list = new ArrayList<>();
List<PlanFilterConfig> planFilterConfigs = planFilterConfigMapper.selectList(new LambdaQueryWrapper<>());
if (planFilterConfigs.isEmpty()){
return list;
}
for (PlanFilterConfig planFilterConfig:planFilterConfigs){
if (!planFilterConfig.getPropertyIdAndValueSql().isEmpty()){
if (filterNames.contains(planFilterConfig.getFilterName())){
continue;
}
if (planFilterConfig.getPropertyIdAndValueSql()!=null){
List<Map<String, Object>> maps = jdbcTemplate.queryForList(planFilterConfig.getPropertyIdAndValueSql());
// List<Map<String, Object>> maps = SqlRunner.db().selectList(planFilterConfig.getPropertyIdAndValueSql());
List<Option<String>> options = maps.stream().map(obj -> {
String value = obj.get("property_id").toString();
String label = obj.get("value").toString();
@ -53,8 +56,8 @@ public class PlanFilterConfigServiceImpl implements PlanFilterConfigService {
);
List<Option<String>> options = planFilterConfigList.stream().map(obj -> {
Option<String> option = new Option<>();
option.setLabel(obj.getPropertyId());
option.setValue(obj.getValue());
option.setLabel(obj.getValue());
option.setValue(obj.getPropertyId());
return option;
}).collect(Collectors.toList());
PlanFilterConfigOption planFilterConfigOption = new PlanFilterConfigOption();
@ -64,6 +67,7 @@ public class PlanFilterConfigServiceImpl implements PlanFilterConfigService {
list.add(planFilterConfigOption);
}
}
filterNames.add(planFilterConfig.getFilterName());
}
return list;
}

@ -5,6 +5,6 @@
<mapper namespace="com.bellmann.mapper.PlanFilterConfigMapper">
<select id="groupByFilterName" resultType="com.bellmann.model.entity.PlanFilterConfig">
SELECT display_name,filter_name from itms_plan_filter_config GROUP BY filter_name,display_name;
SELECT display_name,filter_name from itms_plan_filter_config where filter_name=#{filterName} GROUP BY filter_name,display_name;
</select>
</mapper>

Loading…
Cancel
Save