whyczh
2021-12-10 1ab06fa644b400182dde1621c60f904c4711f2b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.mapper.WorkflowLinkMapper;
import com.whyc.mapper.WorkflowMainMapper;
import com.whyc.pojo.WorkflowAlarm;
import com.whyc.pojo.WorkflowLink;
import com.whyc.pojo.WorkflowMain;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
 
@Service
public class WorkflowMainService {
 
    @Resource
    private WorkflowMainMapper mapper;
 
    @Resource
    private WorkflowLinkMapper linkMapper;
 
    public String getNextSequence() {
        String nextSequence = "";
        QueryWrapper<WorkflowMain> wrapper = Wrappers.query();
 
        String orderId = "WF-1-";
        String ymd = new SimpleDateFormat("yyyyMMdd").format(new Date());
        orderId = orderId+ymd+"-";
        wrapper.likeRight("order_id",orderId).orderByDesc("order_id").last(" limit 1");
        WorkflowMain workflowMain = mapper.selectOne(wrapper);
        if(workflowMain == null){
            nextSequence="00001";
        }else{
            String maxSequence = workflowMain.getOrderId().split("-")[3];
            int nextSequenceIntValue = Integer.parseInt(maxSequence) + 1;
            nextSequence = String.format("%05d", nextSequenceIntValue);
        }
        return nextSequence;
    }
 
 
 
    public static void main(String[] args) {
        int a = 110;
        System.out.println(String.format("%05d",a));
    }
 
    public void add(List<WorkflowMain> workflowMainList) {
        mapper.insertBatchSomeColumn(workflowMainList);
    }
 
    public PageInfo<WorkflowMain> getPendingWorkflowList(Long userId,Integer type,Integer pageNum,Integer pageSize,WorkflowMain main) {
        PageHelper.startPage(pageNum,pageSize,true);
        //获取系统生成,待处理的工单,获取正在工单节点表中待处理的工单
        List<WorkflowMain> workflowList = mapper.getPendingWorkflowList(userId,type,main);
        PageInfo<WorkflowMain> pageInfo = new PageInfo<>(workflowList);
 
        return pageInfo;
    }
 
 
    public WorkflowMain getBaseInfo(Integer mainId) {
        return mapper.getBaseInfo(mainId);
    }
 
    public List<WorkflowLink> getAssignReply(Integer mainId) {
        QueryWrapper<WorkflowLink> wrapper = Wrappers.query();
        //wrapper.eq("main_id",mainId)
        //return linkMapper.
        return null;
    }
}