提交 | 用户 | 时间
|
1ac2bc
|
1 |
package cn.stylefeng.guns.workflow.modular.service.impl; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; |
|
4 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; |
|
5 |
import cn.stylefeng.guns.workflow.modular.entity.Procinst; |
|
6 |
import cn.stylefeng.guns.workflow.modular.mapper.HistoryProcessMapper; |
|
7 |
import cn.stylefeng.guns.workflow.modular.model.params.ProcinstParam; |
|
8 |
import cn.stylefeng.guns.workflow.modular.model.params.TaskParam; |
|
9 |
import cn.stylefeng.guns.workflow.modular.model.result.ProcinstResult; |
|
10 |
import cn.stylefeng.guns.workflow.modular.service.HistoryProcessService; |
|
11 |
import cn.stylefeng.roses.core.util.ToolUtil; |
|
12 |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
13 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.stereotype.Service; |
|
16 |
|
|
17 |
import java.io.Serializable; |
|
18 |
import java.util.HashMap; |
|
19 |
import java.util.List; |
|
20 |
import java.util.Map; |
|
21 |
|
|
22 |
/** |
|
23 |
* <p> |
|
24 |
* 服务实现类 |
|
25 |
* </p> |
|
26 |
* |
|
27 |
* @author fengshuonan |
|
28 |
* @since 2019-08-19 |
|
29 |
*/ |
|
30 |
@Service |
|
31 |
public class HistoryProcessServiceImpl extends ServiceImpl<HistoryProcessMapper, Procinst> implements HistoryProcessService { |
|
32 |
|
|
33 |
@Autowired |
|
34 |
private HistoryProcessMapper historyProcessMapper; |
|
35 |
|
|
36 |
@Override |
|
37 |
public void add(ProcinstParam param) { |
|
38 |
Procinst entity = getEntity(param); |
|
39 |
this.save(entity); |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public void update(ProcinstParam param) { |
|
44 |
Procinst oldEntity = getOldEntity(param); |
|
45 |
Procinst newEntity = getEntity(param); |
|
46 |
ToolUtil.copyProperties(newEntity, oldEntity); |
|
47 |
this.updateById(newEntity); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public ProcinstResult findBySpec(ProcinstParam param) { |
|
52 |
return null; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public List<ProcinstResult> findListBySpec(ProcinstParam param) { |
|
57 |
return null; |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public LayuiPageInfo findPageBySpec(TaskParam param) { |
|
62 |
HashMap<String, Object> paramMap = new HashMap<>(); |
|
63 |
paramMap.put("keywords", param.getKeywords()); |
|
64 |
paramMap.put("lastStart", param.getLastStart()); |
|
65 |
paramMap.put("lastEnd", param.getLastEnd()); |
|
66 |
|
|
67 |
Page pageContext = getPageContext(); |
|
68 |
List<Map<String, Object>> maps = this.historyProcessMapper.datalistPage(pageContext, paramMap); |
|
69 |
pageContext.setRecords(maps); |
|
70 |
return LayuiPageFactory.createPageInfo(pageContext); |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public Map<String, Object> hivarList(String procInstId) { |
|
75 |
|
|
76 |
HashMap<String, Object> resultMap = new HashMap<>(); |
|
77 |
|
|
78 |
List<Map<String, Object>> maps = historyProcessMapper.hivarList(procInstId); |
|
79 |
|
|
80 |
for (Map<String, Object> item : maps) { |
|
81 |
resultMap.put((String) item.get("name_"), item.get("text_")); |
|
82 |
} |
|
83 |
|
|
84 |
return resultMap; |
|
85 |
} |
|
86 |
|
|
87 |
private Serializable getKey(ProcinstParam param) { |
|
88 |
return param.getId(); |
|
89 |
} |
|
90 |
|
|
91 |
private Page getPageContext() { |
|
92 |
return LayuiPageFactory.defaultPage(); |
|
93 |
} |
|
94 |
|
|
95 |
private Procinst getOldEntity(ProcinstParam param) { |
|
96 |
return this.getById(getKey(param)); |
|
97 |
} |
|
98 |
|
|
99 |
private Procinst getEntity(ProcinstParam param) { |
|
100 |
Procinst entity = new Procinst(); |
|
101 |
ToolUtil.copyProperties(param, entity); |
|
102 |
return entity; |
|
103 |
} |
|
104 |
|
|
105 |
} |