Merge branch 'master' of http://118.89.139.230:10101/r/powerIntelligenceSystem
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * 角色:0-管理专责,1-维护组长,2-维护组员,10-领导,运维层-11,监控层-12,专员层-14 |
| | | * */ |
| | | public enum RoleEnum { |
| | | ADMIN(0,"管理专责"), |
| | | GROUP_LEADER(1,"维护组长"), |
| | | GROUP_MEMBER(2,"维护组员"), |
| | | LEADER(10,"领导"), |
| | | MAINTAINER(11,"运维层"), |
| | | MONITOR(12,"监控层"), |
| | | SPECIALIST(14,"专员层"); |
| | | |
| | | RoleEnum(Integer id, String name) { |
| | | this.id = id; |
| | | this.name = name; |
| | | } |
| | | |
| | | private Integer id; |
| | | private String name; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * 工作流相关枚举 |
| | | */ |
| | | public enum WorkflowEnum { |
| | | /**主表(main)状态*/ |
| | | MAIN_STATUS_DEALING("审批中",1), |
| | | MAIN_STATUS_END_PASS("审批结束,通过",2), |
| | | MAIN_STATUS_END_REJECT("审批结束,驳回",3), |
| | | MAIN_STATUS_END_CANCEL("审批结束,撤销",4), |
| | | MAIN_STATUS_WAIT_FOR_DEALING("审批结束,待处理",5), |
| | | MAIN_STATUS_END_DEALT("审批结束,已处理",6), |
| | | |
| | | /**处理类型 deal_type*/ |
| | | TYPE_TAKE("接单",0), |
| | | TYPE_TRANSFER_DISPATCH("转派",1), |
| | | TYPE_DELIVER("移交",2), |
| | | TYPE_ASSIGN("分派",3), |
| | | TYPE_REJECT("驳回",4), |
| | | TYPE_PASS("通过",5), |
| | | TYPE_REPLY("回复",6), |
| | | TYPE_FINISH("处理并归档",7), |
| | | |
| | | /**节点表(link)状态*/ |
| | | LINK_STATUS_PENDING("待处理",0), |
| | | LINK_STATUS_TAKING("待接单",1), |
| | | LINK_STATUS_DEALING("处理中", 2), |
| | | LINK_STATUS_WAIT_FOR_REPLY("待回复", 3), |
| | | LINK_STATUS_DEAL_WITH_REPLY("处理回复", 4), |
| | | LINK_STATUS_PASS("通过", 5), |
| | | LINK_STATUS_WAIT_FOR_APPROVE("待审批", 6), |
| | | LINK_STATUS_CANCEL("已撤销", 7), |
| | | LINK_STATUS_REJECT("驳回", 8); |
| | | |
| | | private String name; |
| | | private Integer value; |
| | | |
| | | WorkflowEnum(String name, Integer value) { |
| | | this.name = name; |
| | | this.value = value; |
| | | } |
| | | |
| | | public final String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public final Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(Integer value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * 审批流-流程节点描述 ->用于所有的审批流程 |
| | | */ |
| | | public enum WorkflowProcessEnum { |
| | | |
| | | PROCESS_SPECIALIST("P0","专员审批"), |
| | | PROCESS_COUNTERSIGN("P1","会签"), |
| | | PROCESS_MANAGER1SIGN("P2","管理审批"), |
| | | PROCESS_MANAGER2SIGN("P3","领导审批"), |
| | | ; |
| | | |
| | | WorkflowProcessEnum(String stage, String name) { |
| | | this.stage = stage; |
| | | this.name = name; |
| | | } |
| | | |
| | | private String stage; |
| | | private String name; |
| | | |
| | | public String getStage() { |
| | | return stage; |
| | | } |
| | | |
| | | public void setStage(String stage) { |
| | | this.stage = stage; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public static WorkflowProcessEnum getByName(String name) { |
| | | for (WorkflowProcessEnum workflowProcessEnum : WorkflowProcessEnum.values()) { |
| | | if (workflowProcessEnum.name.equals(name)) { |
| | | return workflowProcessEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * TODO 每次新增流程时,需要持续维护 |
| | | */ |
| | | public enum WorkflowTypeEnum { |
| | | |
| | | DEVICE_DEFAULT(0,"未定义的流程申请单","FG-WDY"), |
| | | DEVICE_REPAIR(1,"设备维修申请单","FG-WX"), |
| | | DEVICE_IN(2,"设备入库申请单","FG-RK"), |
| | | DEVICE_SCRAP(3,"设备报废申请单","FG-BF"), |
| | | DEVICE_OUT(4,"设备出库申请单","FG-CK"); |
| | | |
| | | |
| | | private Integer type; |
| | | private String name; |
| | | |
| | | private String namingPrefix; |
| | | |
| | | WorkflowTypeEnum(Integer type, String name, String namingPrefix) { |
| | | this.type = type; |
| | | this.name = name; |
| | | this.namingPrefix = namingPrefix; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getNamingPrefix() { |
| | | return namingPrefix; |
| | | } |
| | | |
| | | public void setNamingPrefix(String namingPrefix) { |
| | | this.namingPrefix = namingPrefix; |
| | | } |
| | | |
| | | public static WorkflowTypeEnum getByType(Integer type) { |
| | | for (WorkflowTypeEnum value : WorkflowTypeEnum.values()) { |
| | | if (value.getType().equals(type)) { |
| | | return value; |
| | | } |
| | | } |
| | | return DEVICE_DEFAULT; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.service.WorkflowLinkService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("workflowLink") |
| | | @Api(tags = "单据审批") |
| | | public class WorkflowLinkController extends BaseController{ |
| | | |
| | | @Autowired |
| | | private WorkflowLinkService service; |
| | | |
| | | @GetMapping("workflowInfo") |
| | | @ApiOperation(value = "工单节点列表") |
| | | public Response<List<WorkflowLink>> getWorkflowInfo(@RequestParam Integer mainId){ |
| | | return new Response<List<WorkflowLink>>().set(1, service.getWorkflowInfo(mainId)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("link") |
| | | @ApiOperation(value = "更新节点", notes = "传参link对象内,传入id,dealReason或者dealRejectReason;" + |
| | | "字段status:5-通过,8-驳回") |
| | | public Response updateLink(@RequestBody WorkflowLink link) { |
| | | return service.updateLink(link); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.service.WorkflowLinkService; |
| | | import com.whyc.service.WorkflowMainService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("workflowMain") |
| | | @Api(tags = "单据审批") |
| | | public class WorkflowMainController { |
| | | |
| | | @Autowired |
| | | private WorkflowMainService service; |
| | | |
| | | @PostMapping("submit") |
| | | @ApiOperation(value = "提交单据", notes = "传参:taskDesc,mainType,mainTypeCN,mainTypeEn,dealRoleId,processLevel") |
| | | public Response<Integer> submit(@RequestBody WorkflowMain main){ |
| | | return service.submit(main); |
| | | } |
| | | |
| | | |
| | | @GetMapping("basicInfo") |
| | | @ApiOperation(value = "工单基本状态") |
| | | public Response<WorkflowMain> getBasicInfo(@RequestParam Integer mainId){ |
| | | return new Response<WorkflowMain>().set(1,service.getBaseInfo(mainId)); |
| | | } |
| | | |
| | | //本人的单据: 已审批,审批中,已撤销,已驳回 |
| | | //接收到的单据: 待审核,(待接单审核?),已审核 |
| | | |
| | | /** |
| | | * 本人的单据: |
| | | * 已审批,审批中,已撤销,已驳回 |
| | | * */ |
| | | @GetMapping("ownStatistics") |
| | | @ApiOperation(value = "本人的单据统计",notes = "status含义:1-审批中,2-审批完成且通过,3-审批完成且驳回") |
| | | public Response<Map<Integer,Integer>> getOwnStatistics(int type){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | return service.getOwnStatistics(userId,type); |
| | | } |
| | | |
| | | /** |
| | | * 本人的单据: |
| | | * 已审批,审批中,已撤销,已驳回 |
| | | * */ |
| | | @GetMapping("ownListPage") |
| | | @ApiOperation(value = "本人的单据列表分页",notes = "status传参:0:全部,1-审批中,2-审批完成且通过,3-审批完成且驳回") |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int type,int status,int pageNum,int pageSize){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | return service.ownListPage(userId,type,status,pageNum,pageSize); |
| | | } |
| | | |
| | | /** |
| | | * 接收到的单据: |
| | | * 放电计划临时表中存在: 待审核,待接单审核,已审核 |
| | | * */ |
| | | @GetMapping("receivedStatistics") |
| | | @ApiOperation(value = "接收到的单据统计",notes = "status含义:1-待接单,6-待审核,58-已审核") |
| | | public Response<Map<Integer,Integer>> getReceivedStatistics(int type){ |
| | | User user = ActionUtil.getUser(); |
| | | return service.getReceivedStatistics(type,user); |
| | | } |
| | | |
| | | /** |
| | | * 接收到的单据: |
| | | * 放电计划临时表中存在: 待审核,待接单审核,已审核 |
| | | */ |
| | | @GetMapping("receivedListPage") |
| | | @ApiOperation(value = "接收到的单据列表分页", notes = "status传参:0-全部,1-待接单,6-待审核,5|8-已审核(通过|驳回)") |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, int pageNum, int pageSize) { |
| | | User user = ActionUtil.getUser(); |
| | | return service.getReceivedListPage(type, status, user, pageNum, pageSize); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface WorkflowLinkMapper extends CustomMapper<WorkflowLink> { |
| | | |
| | | List<WorkflowLink> getReceivedList(int type, User user); |
| | | |
| | | /**二次核容和隐患故障的统计*/ |
| | | List<WorkflowLink> getReceivedList2(int type, User user); |
| | | |
| | | //查询自己需要处理或者审批的 |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface WorkflowMainMapper extends CustomMapper<WorkflowMain> { |
| | | |
| | | List<WorkflowMain> getReceivedListByUserAndType(User user, int type, int status); |
| | | |
| | | //查询表单编号 |
| | | Integer getMaxId(); |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.ToString; |
| | | import org.apache.ibatis.type.Alias; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 工作流节点表 |
| | | */ |
| | | @ToString |
| | | @Alias("WorkflowLink") |
| | | @TableName(schema = "web_site",value = "tb_workflow_link") |
| | | @JsonIgnoreProperties(ignoreUnknown = true) |
| | | public class WorkflowLink { |
| | | |
| | | private Integer id; |
| | | @ApiModelProperty("主表id") |
| | | private Integer mainId; |
| | | @ApiModelProperty("上级id") |
| | | private Integer parentId; |
| | | @ApiModelProperty("处理层级") |
| | | private String processStage; |
| | | @ApiModelProperty("处理层级名称") |
| | | private String processName; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | @ApiModelProperty("处理人id") |
| | | private Integer dealUserId; |
| | | @ApiModelProperty("处理类型") |
| | | private Integer dealType; |
| | | @ApiModelProperty("处理描述") |
| | | private String dealDesc; |
| | | @ApiModelProperty("处理附件名称") |
| | | private String dealFileName; |
| | | @ApiModelProperty("处理附件地址") |
| | | private String dealFileUrl; |
| | | @ApiModelProperty("处理图片名称") |
| | | private String dealPicName; |
| | | @ApiModelProperty("处理图片地址") |
| | | private String dealPicUrl; |
| | | @ApiModelProperty("节点状态") |
| | | private Integer status; |
| | | @ApiModelProperty("处理角色") |
| | | private Integer dealRoleId; |
| | | @ApiModelProperty("处理完能否归档") |
| | | private Integer dealAndClose; |
| | | @ApiModelProperty("驳回原因") |
| | | private String dealRejectReason; |
| | | @ApiModelProperty("子任务数") |
| | | private Integer dealTaskNum; |
| | | @ApiModelProperty("子任务回复数") |
| | | private Integer dealTaskReplyNum; |
| | | @ApiModelProperty("处理建议") |
| | | private String dealReason; |
| | | @ApiModelProperty("处理时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date dealTime; |
| | | @ApiModelProperty("要求完成时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date requiredFinishTime; |
| | | @ApiModelProperty("审批回复内容") |
| | | private String replyContent; |
| | | @ApiModelProperty("审批回复时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date replyTime; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Integer> dealUserIdList; |
| | | |
| | | @TableField(exist = false) |
| | | private WorkflowMain workflowMain; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getMainId() { |
| | | return mainId; |
| | | } |
| | | |
| | | public void setMainId(Integer mainId) { |
| | | this.mainId = mainId; |
| | | } |
| | | |
| | | public Integer getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Integer parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getProcessStage() { |
| | | return processStage; |
| | | } |
| | | |
| | | public void setProcessStage(String processStage) { |
| | | this.processStage = processStage; |
| | | } |
| | | |
| | | public String getProcessName() { |
| | | return processName; |
| | | } |
| | | |
| | | public void setProcessName(String processName) { |
| | | this.processName = processName; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getDealUserId() { |
| | | return dealUserId; |
| | | } |
| | | |
| | | public void setDealUserId(Integer dealUserId) { |
| | | this.dealUserId = dealUserId; |
| | | } |
| | | |
| | | public Integer getDealType() { |
| | | return dealType; |
| | | } |
| | | |
| | | public void setDealType(Integer dealType) { |
| | | this.dealType = dealType; |
| | | } |
| | | |
| | | public String getDealDesc() { |
| | | return dealDesc; |
| | | } |
| | | |
| | | public void setDealDesc(String dealDesc) { |
| | | this.dealDesc = dealDesc; |
| | | } |
| | | |
| | | public String getDealFileName() { |
| | | return dealFileName; |
| | | } |
| | | |
| | | public void setDealFileName(String dealFileName) { |
| | | this.dealFileName = dealFileName; |
| | | } |
| | | |
| | | public String getDealFileUrl() { |
| | | return dealFileUrl; |
| | | } |
| | | |
| | | public void setDealFileUrl(String dealFileUrl) { |
| | | this.dealFileUrl = dealFileUrl; |
| | | } |
| | | |
| | | public String getDealPicName() { |
| | | return dealPicName; |
| | | } |
| | | |
| | | public void setDealPicName(String dealPicName) { |
| | | this.dealPicName = dealPicName; |
| | | } |
| | | |
| | | public String getDealPicUrl() { |
| | | return dealPicUrl; |
| | | } |
| | | |
| | | public void setDealPicUrl(String dealPicUrl) { |
| | | this.dealPicUrl = dealPicUrl; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getDealRoleId() { |
| | | return dealRoleId; |
| | | } |
| | | |
| | | public void setDealRoleId(Integer dealRoleId) { |
| | | this.dealRoleId = dealRoleId; |
| | | } |
| | | |
| | | public Integer getDealAndClose() { |
| | | return dealAndClose; |
| | | } |
| | | |
| | | public void setDealAndClose(Integer dealAndClose) { |
| | | this.dealAndClose = dealAndClose; |
| | | } |
| | | |
| | | public String getDealRejectReason() { |
| | | return dealRejectReason; |
| | | } |
| | | |
| | | public void setDealRejectReason(String dealRejectReason) { |
| | | this.dealRejectReason = dealRejectReason; |
| | | } |
| | | |
| | | public Integer getDealTaskNum() { |
| | | return dealTaskNum; |
| | | } |
| | | |
| | | public void setDealTaskNum(Integer dealTaskNum) { |
| | | this.dealTaskNum = dealTaskNum; |
| | | } |
| | | |
| | | public Integer getDealTaskReplyNum() { |
| | | return dealTaskReplyNum; |
| | | } |
| | | |
| | | public void setDealTaskReplyNum(Integer dealTaskReplyNum) { |
| | | this.dealTaskReplyNum = dealTaskReplyNum; |
| | | } |
| | | |
| | | public String getDealReason() { |
| | | return dealReason; |
| | | } |
| | | |
| | | public void setDealReason(String dealReason) { |
| | | this.dealReason = dealReason; |
| | | } |
| | | |
| | | public Date getDealTime() { |
| | | return dealTime; |
| | | } |
| | | |
| | | public void setDealTime(Date dealTime) { |
| | | this.dealTime = dealTime; |
| | | } |
| | | |
| | | public List<Integer> getDealUserIdList() { |
| | | return dealUserIdList; |
| | | } |
| | | |
| | | public void setDealUserIdList(List<Integer> dealUserIdList) { |
| | | this.dealUserIdList = dealUserIdList; |
| | | } |
| | | |
| | | public Date getRequiredFinishTime() { |
| | | return requiredFinishTime; |
| | | } |
| | | |
| | | public void setRequiredFinishTime(Date requiredFinishTime) { |
| | | this.requiredFinishTime = requiredFinishTime; |
| | | } |
| | | |
| | | public String getReplyContent() { |
| | | return replyContent; |
| | | } |
| | | |
| | | public void setReplyContent(String replyContent) { |
| | | this.replyContent = replyContent; |
| | | } |
| | | |
| | | public Date getReplyTime() { |
| | | return replyTime; |
| | | } |
| | | |
| | | public void setReplyTime(Date replyTime) { |
| | | this.replyTime = replyTime; |
| | | } |
| | | |
| | | public WorkflowMain getWorkflowMain() { |
| | | return workflowMain; |
| | | } |
| | | |
| | | public void setWorkflowMain(WorkflowMain workflowMain) { |
| | | this.workflowMain = workflowMain; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | import org.apache.ibatis.type.Alias; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 工作流主表 |
| | | */ |
| | | @ToString |
| | | @Data |
| | | @Alias("WorkflowMain") |
| | | @TableName(schema = "web_site",value = "tb_workflow_main") |
| | | public class WorkflowMain { |
| | | |
| | | private Integer id; |
| | | /** |
| | | * 工单id,规范:WF-1-20211101-00001 |
| | | * (Workflow)-(工单类型 告警:1 普通:2)-(年月日)-(当日编号序列) |
| | | * |
| | | * */ |
| | | @ApiModelProperty("工单id,规范:FG-GF-1-20211101-00001,(Workflow)-(工单类型 告警:1 普通:2)-(年月日)-(当日编号序列)") |
| | | private String orderId; |
| | | /**标题*/ |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | /**任务描述*/ |
| | | @ApiModelProperty("任务描述") |
| | | private String taskDesc; |
| | | /**创建人id*/ |
| | | @ApiModelProperty("创建人id") |
| | | private Integer createUserId; |
| | | /**创建时间*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | | /**任务计划开始时间*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date planBeginTime; |
| | | /**任务计划结束时间*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date planEndTime; |
| | | /**任务开始处理时间*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date beginTime; |
| | | /**任务归档时间*/ |
| | | @ApiModelProperty("归档时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date endTime; |
| | | |
| | | @ApiModelProperty("申请数量") |
| | | private Integer quantity; |
| | | @ApiModelProperty("未处理的数量.维修申请时需填入") |
| | | private Integer quantityUnprocessed; |
| | | /**任务等级*/ |
| | | @ApiModelProperty("任务等级") |
| | | private Integer taskLevel; |
| | | /**是否及时*/ |
| | | @ApiModelProperty("是否及时") |
| | | @TableField("is_in_time") |
| | | private Integer inTime; |
| | | @ApiModelProperty("流程过程阶段") |
| | | private String processStage; |
| | | @ApiModelProperty("工单状态") |
| | | private Integer status; |
| | | /**附件名称*/ |
| | | @ApiModelProperty("附件名称") |
| | | private String fileName; |
| | | /**附件地址*/ |
| | | @ApiModelProperty("附件地址") |
| | | private String fileUrl; |
| | | /**图片名称*/ |
| | | @ApiModelProperty("图片名称") |
| | | private String picName; |
| | | /**图片地址*/ |
| | | @ApiModelProperty("图片地址") |
| | | private String picUrl; |
| | | /**归档意见*/ |
| | | @ApiModelProperty("归档意见") |
| | | private String endReason; |
| | | /**是否自动派单*/ |
| | | @ApiModelProperty("是否自动派单") |
| | | @TableField("is_auto") |
| | | private Integer auto; |
| | | |
| | | @ApiModelProperty("关联工单id") |
| | | private Integer relatedId; |
| | | |
| | | /** |
| | | * @see com.whyc.constant.WorkflowTypeEnum |
| | | */ |
| | | @ApiModelProperty("工单流类型") |
| | | private Integer type; |
| | | |
| | | @TableField(exist = false) |
| | | private String createUserName; |
| | | |
| | | @TableField(exist = false) |
| | | private List<WorkflowLink> linkList; |
| | | public WorkflowMain(Integer id, Integer status, String endReason, Date endTime) { |
| | | this.id = id; |
| | | this.status = status; |
| | | this.endReason = endReason; |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public WorkflowMain() { |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.WorkflowEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.util.CommonUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class WorkflowLinkService { |
| | | |
| | | @Resource |
| | | private WorkflowLinkMapper mapper; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private WorkflowMainService mainService; |
| | | |
| | | |
| | | public void addBatch(List<WorkflowLink> links) { |
| | | mapper.insertBatchSomeColumn(links); |
| | | } |
| | | |
| | | public List<WorkflowLink> getWorkflowInfo(Integer mainId) { |
| | | QueryWrapper<WorkflowLink> wrapper = Wrappers.query(); |
| | | wrapper.eq("main_id", mainId); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Transactional |
| | | public Response updateLink(WorkflowLink link) { |
| | | //获取当前节点的记录 |
| | | WorkflowLink linkInDB = mapper.selectById(link.getId()); |
| | | User user = CommonUtil.getUser(); |
| | | Date now = new Date(); |
| | | //根据id.查询关联的主表 |
| | | WorkflowMain mainInDB = mainService.getById(linkInDB.getMainId()); |
| | | //查看申请流程类型 |
| | | switch (mainInDB.getType()) { |
| | | case 1: { //设备维修申请 |
| | | //查看主表的状态 |
| | | //因为是单个链路节点,所以不需要判断是不是待处理,肯定只有1个节点. 审批通过或者驳回 |
| | | //if(main.getStatus() == WorkflowEnum.MAIN_STATUS_DEALING.getValue().intValue()){ //待处理,下一步是审批通过,待处理 或者驳回 |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainService.updateById(mainInDB); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
| | | } |
| | | //设备入库申请 |
| | | case 2: |
| | | //设备报废申请 |
| | | case 3:{ |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainService.updateById(mainInDB); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | //检查是否有关联工单.如果有关联工单,关联工单状态重置为完结待处理,完成时间重置为空 |
| | | if(mainInDB.getRelatedId() != null){ |
| | | Integer relatedId = mainInDB.getRelatedId(); |
| | | mainService.resetRepairStatus(relatedId,mainInDB.getQuantity()); |
| | | } |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | link.setId(linkInDB.getId()); |
| | | link.setDealUserId(user.getId()); |
| | | link.setDealTime(now); |
| | | |
| | | mapper.updateById(link); |
| | | |
| | | return new Response().setII(1,"更新完成"); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param mainId 特定的单据 |
| | | * @param processLevel 特定的过程 |
| | | * @return 特定单据,特定过程,未完成的会签的数量 |
| | | */ |
| | | private int getLeftAssignNum(Integer mainId, String processLevel) { |
| | | QueryWrapper<WorkflowLink> query = Wrappers.query(); |
| | | query.select("count(*) as id").eq("main_id",mainId).eq("process_level",processLevel).ne("status",WorkflowEnum.LINK_STATUS_PASS.getValue()); |
| | | return mapper.selectOne(query).getId(); |
| | | } |
| | | |
| | | /** |
| | | * 更新节点,主节点不完结 |
| | | * @param link 参数id,status,dealReason或者dealRejectReason |
| | | */ |
| | | private void updateLinkField(WorkflowLink link) { |
| | | Date now = new Date(); |
| | | link.setDealTime(now); |
| | | mapper.updateById(link); |
| | | } |
| | | |
| | | |
| | | public Map<Integer, Integer> getReceivedStatistics(int type, User user) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(1,0); |
| | | statistics.put(6,0); |
| | | statistics.put(58,0); |
| | | List<WorkflowLink> links = mapper.getReceivedList(type,user); |
| | | Map<Integer, List<WorkflowLink>> receivedListMap = links.stream().collect(Collectors.groupingBy(WorkflowLink::getStatus)); |
| | | Set<Integer> statusSet = receivedListMap.keySet(); |
| | | for (Integer status : statusSet) { |
| | | if (status == 5 || status == 8) { |
| | | statistics.put(58, statistics.get(58) + receivedListMap.get(status).size()); |
| | | } else { |
| | | statistics.put(status, receivedListMap.get(status).size()); |
| | | } |
| | | } |
| | | return statistics; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 二次核容和隐患故障的统计 |
| | | * |
| | | * 增加了全部 0 |
| | | * 0:全部 |
| | | * 1:审批中 |
| | | * 2:通过 |
| | | * 3:驳回 |
| | | * |
| | | * status含义:1-待接单,6-待审核,58-已审核 |
| | | * @param type |
| | | * @param user |
| | | * @return |
| | | */ |
| | | public Response getReceivedStatistics2(int type, User user) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(0,0); |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | List<WorkflowLink> links = mapper.getReceivedList2(type,user); |
| | | Map<Integer, List<WorkflowLink>> receivedListMap = links.stream().collect(Collectors.groupingBy(WorkflowLink::getStatus)); |
| | | Set<Integer> statusSet = receivedListMap.keySet(); |
| | | int sum = 0; |
| | | for (Integer status : statusSet) { |
| | | int size = receivedListMap.get(status).size(); |
| | | if (status == 1 || status == 6) { //审批中 |
| | | statistics.put(1, statistics.get(1) + size); |
| | | } else if(status == 5){ //通过 |
| | | statistics.put(2, size); |
| | | }else if(status == 8){ //驳回 |
| | | statistics.put(3,size); |
| | | } |
| | | sum+=size; |
| | | } |
| | | statistics.put(0,sum); |
| | | return new Response().set(1,statistics); |
| | | } |
| | | |
| | | |
| | | public void add(WorkflowLink link) { |
| | | mapper.insert(link); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.WorkflowEnum; |
| | | import com.whyc.constant.WorkflowProcessEnum; |
| | | import com.whyc.constant.WorkflowTypeEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.WorkflowMainMapper; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletContext; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class WorkflowMainService { |
| | | |
| | | @Resource |
| | | private WorkflowMainMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private WorkflowLinkService linkService; |
| | | |
| | | |
| | | /** |
| | | * 分派单号: |
| | | * */ |
| | | public String getNextOrderId(String typeName) { |
| | | ServletContext application = ActionUtil.getApplication(); |
| | | List<String> orderIdList = (List) application.getAttribute("orderIdList"); |
| | | if(orderIdList == null){ |
| | | orderIdList = new LinkedList<>(); |
| | | } |
| | | String nextSequence = ""; |
| | | QueryWrapper<WorkflowMain> wrapper = Wrappers.query(); |
| | | |
| | | String orderId = typeName+"-"; |
| | | String ymd = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | orderId = orderId+ymd+"-"; |
| | | //先查询是否缓存中是否存在前缀相同的单号,有的话存起来 |
| | | List<Integer> sequenceList = new LinkedList<>(); |
| | | sequenceList.add(0); |
| | | for (String item : orderIdList) { |
| | | if(item.startsWith(orderId)){ |
| | | String sequence = item.split("-")[3]; |
| | | sequenceList.add(Integer.parseInt(sequence)); |
| | | } |
| | | } |
| | | wrapper.likeRight("order_id",orderId).orderByDesc("order_id").last(" limit 1"); |
| | | WorkflowMain workflowMain = mapper.selectOne(wrapper); |
| | | if(workflowMain != null){ |
| | | String sequence = workflowMain.getOrderId().split("-")[3]; |
| | | sequenceList.add(Integer.parseInt(sequence)); |
| | | } |
| | | Integer maxSequence = sequenceList.stream().max(Comparator.comparing(Integer::intValue)).get(); |
| | | nextSequence = String.format("%05d", maxSequence+1); |
| | | String nextOrderId = orderId + nextSequence; |
| | | //加入缓存中 |
| | | orderIdList.add(nextOrderId); |
| | | application.setAttribute("orderIdList",orderIdList); |
| | | return nextOrderId; |
| | | } |
| | | |
| | | public void add(WorkflowMain main) { |
| | | mapper.insert(main); |
| | | } |
| | | |
| | | public void addBatch(List<WorkflowMain> workflowMainList) { |
| | | mapper.insertBatchSomeColumn(workflowMainList); |
| | | } |
| | | |
| | | |
| | | public WorkflowMain getBaseInfo(Integer mainId) { |
| | | //根据mainId查询是哪种类型 |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("id",mainId).last(" limit 1"); |
| | | WorkflowMain workflowMain = mapper.selectOne(query); |
| | | Integer type = workflowMain.getType(); |
| | | if(type ==1){ |
| | | //List<BattDischargePlanTemp> tempList = tempService.getListByMainId(mainId); |
| | | //workflowMain.setTempList(tempList); |
| | | } |
| | | List<WorkflowLink> linkList = linkService.getWorkflowInfo(mainId); |
| | | workflowMain.setLinkList(linkList); |
| | | |
| | | return workflowMain; |
| | | } |
| | | |
| | | public List<WorkflowLink> getAssignReply(Integer mainId) { |
| | | QueryWrapper<WorkflowLink> wrapper = Wrappers.query(); |
| | | //wrapper.eq("main_id",mainId) |
| | | //return linkMapper. |
| | | return null; |
| | | } |
| | | |
| | | public void updateById(WorkflowMain main) { |
| | | mapper.updateById(main); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param userId |
| | | * @param type |
| | | * @see WorkflowEnum |
| | | * |
| | | * @return |
| | | */ |
| | | public Response<Map<Integer,Integer>> getOwnStatistics(int userId, int type) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",userId).eq("type",type); |
| | | List<WorkflowMain> mains = mapper.selectList(query); |
| | | Map<Integer, List<WorkflowMain>> statusListMap = mains.stream().collect(Collectors.groupingBy(WorkflowMain::getStatus)); |
| | | Set<Integer> statusSet = statusListMap.keySet(); |
| | | for (Integer status : statusSet) { |
| | | statistics.put(status,statusListMap.get(status).size()); |
| | | } |
| | | return new Response<Map<Integer,Integer>>().set(1,statistics); |
| | | } |
| | | |
| | | /** |
| | | * 二次核容和故障隐患的统计 |
| | | * |
| | | * 增加了全部 key=0 |
| | | * @param type ={0,2,3} 0代表二次核容和故障隐患一起 |
| | | * @see WorkflowEnum |
| | | * |
| | | * @return |
| | | */ |
| | | public Response<Map<Integer,Integer>> getOwnStatistics2(int userId, int type) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(0,0); |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id", userId); |
| | | if(type == 0){ |
| | | query.in("type",2,3); |
| | | }else { |
| | | query.eq("type", type); |
| | | } |
| | | List<WorkflowMain> mains = mapper.selectList(query); |
| | | Map<Integer, List<WorkflowMain>> statusListMap = mains.stream().collect(Collectors.groupingBy(WorkflowMain::getStatus)); |
| | | Set<Integer> statusSet = statusListMap.keySet(); |
| | | int sum = 0; |
| | | for (Integer status : statusSet) { |
| | | int size = statusListMap.get(status).size(); |
| | | statistics.put(status, size); |
| | | sum+=size; |
| | | } |
| | | statistics.put(0,sum); |
| | | return new Response<Map<Integer,Integer>>().set(1,statistics); |
| | | } |
| | | |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int userId, int type, int status, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorkflowMain> mains = getOwnListByUserAndType(userId,type,status); |
| | | if(type == 1) { |
| | | for (WorkflowMain main : mains) { |
| | | Integer id = main.getId(); |
| | | //List<BattDischargePlanTemp> tempList = tempService.getListByMainId(id); |
| | | //main.setTempList(tempList); |
| | | } |
| | | } |
| | | PageInfo<WorkflowMain> pageInfo = new PageInfo<>(mains); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | private List<WorkflowMain> getOwnListByUserAndType(int userId, int type, int status) { |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | if(status == 0){ |
| | | query.eq("create_user_id",userId).eq("type",type).orderByDesc("id"); |
| | | }else { |
| | | query.eq("create_user_id", userId).eq("type", type).eq("status", status).orderByDesc("id"); |
| | | } |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public Response<Map<Integer,Integer>> getReceivedStatistics(int type, User user) { |
| | | Map<Integer,Integer> statisticsMap = linkService.getReceivedStatistics(type,user); |
| | | return new Response<Map<Integer,Integer>>().set(1,statisticsMap); |
| | | } |
| | | |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, User user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorkflowMain> mains = getReceivedListByUserAndType(user,type,status); |
| | | if (type == 1) { |
| | | for (WorkflowMain main : mains) { |
| | | Integer id = main.getId(); |
| | | //List<BattDischargePlanTemp> tempList = tempService.getListByMainId(id); |
| | | //main.setTempList(tempList); |
| | | } |
| | | } |
| | | PageInfo<WorkflowMain> pageInfo = new PageInfo<>(mains); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1, pageInfo); |
| | | } |
| | | |
| | | private List<WorkflowMain> getReceivedListByUserAndType(User user, int type, int status) { |
| | | return mapper.getReceivedListByUserAndType(user, type, status); |
| | | } |
| | | |
| | | public WorkflowMain getById(Integer mainId) { |
| | | return mapper.selectById(mainId); |
| | | } |
| | | |
| | | //查询表单编号 |
| | | public int getMaxId() { |
| | | Integer id = mapper.getMaxId(); |
| | | if (id == null) { |
| | | id = 1; |
| | | } else { |
| | | id = id + 1; |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | /** |
| | | * 通用提交方法,提交给角色-角色层 |
| | | * 如果related_id不为空,则需要特殊处理. 证明会影响到关联单据 |
| | | */ |
| | | |
| | | @Transactional |
| | | public Response submit(WorkflowMain main){ |
| | | //1.提交到单据审批流程 |
| | | //如果存在关联单据id,首先校验提交的数量 |
| | | Date now = new Date(); |
| | | WorkflowMain mainRelated = getById(main.getRelatedId()); |
| | | if(main.getRelatedId() != null) { |
| | | if (main.getQuantity() > mainRelated.getQuantityUnprocessed()) { |
| | | return new Response().setII(1, "入库数量不能大于维修申请关联单据的未处理数量"); |
| | | } |
| | | } |
| | | //主表插入 |
| | | //初始化相关字段 |
| | | WorkflowTypeEnum typeEnum = WorkflowTypeEnum.getByType(main.getType()); |
| | | String name = typeEnum.getName(); |
| | | String namingPrefix = typeEnum.getNamingPrefix(); |
| | | String orderId = getNextOrderId(namingPrefix); |
| | | //String title = mainTypeCN+"审批单-"+ DateUtil.YYYY_MM_DD_HH_MM_SS.format(now); |
| | | |
| | | String title = name + ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS, now); |
| | | Integer mainStatus = WorkflowEnum.MAIN_STATUS_DEALING.getValue(); |
| | | User user = CommonUtil.getUser(); |
| | | WorkflowProcessEnum process = getProcessLevel(main.getType(),user.getRole()); |
| | | main.setOrderId(orderId); |
| | | main.setTitle(title); |
| | | main.setCreateUserId(user.getId()); |
| | | main.setCreateTime(now); |
| | | main.setBeginTime(now); |
| | | main.setStatus(mainStatus); |
| | | main.setProcessStage(process.getStage()); |
| | | if(main.getType() == WorkflowTypeEnum.DEVICE_REPAIR.getType().intValue()){ //维修申请单,需填入 |
| | | main.setQuantityUnprocessed(main.getQuantity()); |
| | | } |
| | | add(main); |
| | | //内存中去除已插入数据库的单号 |
| | | ServletContext application = ActionUtil.getApplication(); |
| | | List<String> orderIdList = (List<String>) application.getAttribute("orderIdList"); |
| | | //校验是否去除 |
| | | boolean remove = orderIdList.remove(orderId); |
| | | if(!remove){ |
| | | System.err.println("没有去除掉!!!!!!!!!!!!!"); |
| | | } |
| | | application.setAttribute("orderIdList",orderIdList); |
| | | |
| | | //节点表插入 |
| | | WorkflowLink link = new WorkflowLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setProcessStage(process.getStage()); |
| | | link.setProcessName(process.getName()); |
| | | link.setCreateTime(now); |
| | | link.setDealRoleId(getNextDealRoleId(process.getName())); |
| | | link.setDealType(WorkflowEnum.TYPE_DELIVER.getValue()); |
| | | link.setDealDesc(main.getTaskDesc()); |
| | | link.setStatus(WorkflowEnum.LINK_STATUS_TAKING.getValue()); |
| | | |
| | | linkService.add(link); |
| | | |
| | | //如果存在关联单据id,处理关联单据及自动生成新单据 |
| | | checkRelatedAndDone(main, now, mainRelated, user); |
| | | return new Response().setII(1,"提交完成"); |
| | | } |
| | | |
| | | private void checkRelatedAndDone(WorkflowMain main, Date now, WorkflowMain mainRelated, User user) { |
| | | if(main.getRelatedId() != null){ |
| | | //判断是申请的入库,还是报废. |
| | | if (main.getQuantity() < mainRelated.getQuantityUnprocessed()){ //说明需要自动生成入库或者报废单据 |
| | | //需要自动生成报废的申请 |
| | | WorkflowMain mainAuto = new WorkflowMain(); |
| | | WorkflowTypeEnum typeEnumAuto; |
| | | |
| | | Integer statusAuto = WorkflowEnum.MAIN_STATUS_DEALING.getValue(); |
| | | WorkflowProcessEnum processAuto = WorkflowProcessEnum.PROCESS_MANAGER1SIGN; |
| | | mainAuto.setCreateUserId(user.getId()); |
| | | mainAuto.setCreateTime(now); |
| | | mainAuto.setBeginTime(now); |
| | | mainAuto.setQuantity(mainRelated.getQuantityUnprocessed()- main.getQuantity()); |
| | | mainAuto.setProcessStage(processAuto.getStage()); |
| | | mainAuto.setStatus(statusAuto); |
| | | mainAuto.setRelatedId(main.getRelatedId()); |
| | | |
| | | if(main.getType() == WorkflowTypeEnum.DEVICE_IN.getType().intValue()) { //申请的入库 |
| | | mainAuto.setTaskDesc("提交了维修后的入库申请,系统自动生成剩余数量的报废申请"); |
| | | typeEnumAuto = WorkflowTypeEnum.DEVICE_SCRAP; |
| | | }else { //申请的报废 |
| | | mainAuto.setTaskDesc("提交了维修后的报废申请,系统自动生成剩余数量的入库申请"); |
| | | typeEnumAuto = WorkflowTypeEnum.DEVICE_IN; |
| | | } |
| | | mainAuto.setOrderId(getNextOrderId(typeEnumAuto.getNamingPrefix())); |
| | | String titleAuto = typeEnumAuto.getName() + ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS, now); |
| | | mainAuto.setTitle(titleAuto); |
| | | mainAuto.setType(typeEnumAuto.getType()); |
| | | add(mainAuto); |
| | | |
| | | //自动节点生成 |
| | | WorkflowLink linkAuto = new WorkflowLink(); |
| | | linkAuto.setParentId(0); |
| | | linkAuto.setProcessStage(processAuto.getStage()); |
| | | linkAuto.setProcessName(processAuto.getName()); |
| | | linkAuto.setCreateTime(now); |
| | | linkAuto.setDealRoleId(getNextDealRoleId(processAuto.getName())); |
| | | linkAuto.setDealType(WorkflowEnum.TYPE_DELIVER.getValue()); |
| | | linkAuto.setStatus(WorkflowEnum.LINK_STATUS_TAKING.getValue()); |
| | | linkAuto.setMainId(mainAuto.getId()); |
| | | linkAuto.setDealDesc(mainAuto.getTaskDesc()); |
| | | linkService.add(linkAuto); |
| | | |
| | | } |
| | | //关闭关联单据的状态 |
| | | WorkflowMain relatedMain = new WorkflowMain(); |
| | | relatedMain.setId(main.getRelatedId()); |
| | | relatedMain.setStatus(WorkflowEnum.MAIN_STATUS_END_DEALT.getValue()); |
| | | relatedMain.setEndTime(now); |
| | | if(main.getType() == WorkflowTypeEnum.DEVICE_IN.getType().intValue()) { |
| | | relatedMain.setEndReason("用户提交维修申请后的入库申请,维修流程结束"); |
| | | }else{ |
| | | relatedMain.setEndReason("用户提交维修申请后的报废申请,维修流程结束"); |
| | | } |
| | | relatedMain.setQuantityUnprocessed(0); |
| | | updateById(relatedMain); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * TODO 每次新增流程时,需要持续维护 |
| | | * 如果后续存在会签,则需要追加一个多type类型的同名方法 |
| | | * @param processLevelName 流程阶段名 |
| | | * @return 流程处理的下一个角色 |
| | | */ |
| | | private Integer getNextDealRoleId(String processLevelName) { |
| | | WorkflowProcessEnum processEnum = WorkflowProcessEnum.getByName(processLevelName); |
| | | switch (processEnum){ |
| | | //角色:1普通用户,2管理层,3领导层,4运维班组 |
| | | case PROCESS_MANAGER1SIGN: |
| | | return 2; |
| | | default: |
| | | return 2; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * TODO 每次新增流程时,需要持续维护 |
| | | * @param type 流程的类型 |
| | | * @param roleId 现在的角色 |
| | | * @return 流程处理的下一个角色 |
| | | */ |
| | | private WorkflowProcessEnum getProcessLevel(Integer type,Integer roleId) { |
| | | WorkflowTypeEnum typeEnum = WorkflowTypeEnum.getByType(type); |
| | | String name = typeEnum.getName(); |
| | | //角色:1普通用户,2管理层,3领导层,4运维班组 |
| | | switch (name){ |
| | | //审批顺序为 普通用户->管理员 ->普通用户(进行完结) |
| | | case "设备维修申请单": |
| | | case "设备入库申请单": |
| | | case "设备报废申请单": |
| | | case "设备出库申请单": |
| | | if (roleId == 1) { |
| | | return WorkflowProcessEnum.PROCESS_MANAGER1SIGN; |
| | | } |
| | | default: |
| | | return WorkflowProcessEnum.PROCESS_SPECIALIST; |
| | | } |
| | | } |
| | | |
| | | public void updateProcessLevel(String processLevel, Integer mainId) { |
| | | UpdateWrapper<WorkflowMain> update = Wrappers.update(); |
| | | update.set("process_level",processLevel).eq("id",mainId); |
| | | mapper.update((WorkflowMain) ActionUtil.objeNull,update); |
| | | } |
| | | |
| | | public void resetRepairStatus(Integer relatedId, Integer quantity) { |
| | | UpdateWrapper<WorkflowMain> update = Wrappers.update(); |
| | | update.set("status",WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()) |
| | | .set("end_time",null) |
| | | .set("end_reason",null) |
| | | .set("quantity_unprocessed",quantity) |
| | | .eq("id",relatedId); |
| | | mapper.update((WorkflowMain) ActionUtil.objeNull,update); |
| | | } |
| | | } |
| | |
| | | user = new User(); |
| | | user.setName("unlogged_user"); |
| | | user.setId(0); |
| | | user.setRole(1); |
| | | } |
| | | return user; |
| | | } |
| | |
| | | return timeStr; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param timeFormat |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String format(String timeFormat,Date date) { |
| | | ThreadLocal<SimpleDateFormat> formatThreadLocal = ThreadLocal.withInitial(() -> new SimpleDateFormat(timeFormat)); |
| | | SimpleDateFormat format = formatThreadLocal.get(); |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.WorkflowLinkMapper"> |
| | | <resultMap id="linkMain" type="WorkflowLink"> |
| | | <result column="lid" property="id"></result> |
| | | <result column="lmain_id" property="mainId"></result> |
| | | <result column="parent_id" property="parentId"></result> |
| | | <result column="lprocess_level" property="processLevel"></result> |
| | | <result column="process_level_name" property="processLevelName"></result> |
| | | <result column="lcreate_time" property="createTime"></result> |
| | | <result column="deal_user_id" property="dealUserId"></result> |
| | | <result column="deal_type" property="dealType"></result> |
| | | <result column="deal_desc" property="dealDesc"></result> |
| | | <result column="deal_file_name" property="dealFileName"></result> |
| | | <result column="deal_file_url" property="dealFileUrl"></result> |
| | | <result column="deal_pic_name" property="dealPicName"></result> |
| | | <result column="deal_pic_url" property="dealPicUrl"></result> |
| | | <result column="lstatus" property="status"></result> |
| | | <result column="deal_role_id" property="dealRoleId"></result> |
| | | <result column="deal_and_close" property="dealAndClose"></result> |
| | | <result column="deal_reject_reason" property="dealRejectReason"></result> |
| | | <result column="deal_task_num" property="dealTaskNum"></result> |
| | | <result column="deal_task_reply_num" property="dealTaskReplyNum"></result> |
| | | <result column="deal_reason" property="dealReason"></result> |
| | | <result column="required_finish_time" property="requiredFinishTime"></result> |
| | | <result column="deal_time" property="dealTime"></result> |
| | | <result column="reply_content" property="replyContent"></result> |
| | | <result column="reply_time" property="replyTime"></result> |
| | | <association property="workflowMain" javaType="WorkflowMain"> |
| | | <result column="mid" property="id"></result> |
| | | <result column="order_id" property="orderId"></result> |
| | | <result column="title" property="title"></result> |
| | | <result column="task_desc" property="taskDesc"></result> |
| | | <result column="create_user_id" property="createUserId"></result> |
| | | <result column="mcreate_time" property="createTime"></result> |
| | | <result column="plan_begin_time" property="planBeginTime"></result> |
| | | <result column="plan_end_time" property="planEndTime"></result> |
| | | <result column="begin_time" property="beginTime"></result> |
| | | <result column="end_time" property="endTime"></result> |
| | | <result column="task_level" property="taskLevel"></result> |
| | | <result column="is_in_time" property="inTime"></result> |
| | | <result column="mstatus" property="status"></result> |
| | | <result column="mprocess_level" property="processLevel"></result> |
| | | <result column="file_name" property="fileName"></result> |
| | | <result column="file_url" property="fileUrl"></result> |
| | | <result column="pic_name" property="picName"></result> |
| | | <result column="pic_url" property="picUrl"></result> |
| | | <result column="end_reason" property="endReason"></result> |
| | | <result column="is_auto" property="auto"></result> |
| | | <result column="type" property="type"></result> |
| | | </association> |
| | | </resultMap> |
| | | <select id="getReceivedList" resultType="com.whyc.pojo.web_site.WorkflowLink"> |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | ) |
| | | </select> |
| | | |
| | | <select id="getReceivedList2" resultType="com.whyc.pojo.web_site.WorkflowLink"> |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | <choose> |
| | | <when test="type == 0"> |
| | | and m.type in (2,3) |
| | | </when> |
| | | <otherwise> |
| | | and m.type = #{type} |
| | | </otherwise> |
| | | </choose> |
| | | and l.deal_user_id = #{user.uId} |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | <choose> |
| | | <when test="type == 0"> |
| | | and m.type in (2,3) |
| | | </when> |
| | | <otherwise> |
| | | and m.type = #{type} |
| | | </otherwise> |
| | | </choose> |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | ) |
| | | </select> |
| | | |
| | | <select id="searchTmp" resultMap="linkMain"> |
| | | ( |
| | | SELECT parent_id |
| | | , process_level_name |
| | | , deal_user_id |
| | | , deal_type |
| | | , deal_desc |
| | | , deal_file_name |
| | | , deal_file_url |
| | | , deal_pic_name |
| | | , deal_pic_url |
| | | , deal_role_id |
| | | , deal_and_close |
| | | , deal_reject_reason |
| | | , deal_task_num |
| | | , deal_task_reply_num |
| | | , deal_reason |
| | | , required_finish_time |
| | | , deal_time |
| | | , reply_content |
| | | , reply_time |
| | | , l.process_level as lprocess_level |
| | | , l.main_id as lmain_id |
| | | , l.id as lid |
| | | , l.status as lstatus |
| | | , l.create_time as lcreate_time |
| | | , order_id |
| | | , title |
| | | , task_desc |
| | | , create_user_id |
| | | , plan_begin_time |
| | | , plan_end_time |
| | | , begin_time |
| | | , end_time |
| | | , task_level |
| | | , is_in_time |
| | | , file_name |
| | | , file_url |
| | | , pic_name |
| | | , pic_url |
| | | , end_reason |
| | | , is_auto |
| | | , m.type |
| | | , m.id as mid |
| | | , m.process_level as mprocess_level |
| | | , m.status as mstatus |
| | | , m.create_time as mcreate_time |
| | | FROM web_site.tb_workflow_link l |
| | | LEFT OUTER JOIN web_site.tb_workflow_main m on m.id = l.main_id |
| | | <where> |
| | | l.deal_user_id = #{uId} |
| | | <if test="type!=0"> |
| | | and m.type = #{type} |
| | | </if> |
| | | <if test="type==0"> |
| | | and m.type != 1 |
| | | </if> |
| | | <if test="status==1"> |
| | | and m.status = #{status} |
| | | and l.status in (0,1,6) |
| | | </if> |
| | | <if test="status==2"> |
| | | and l.status =5 |
| | | </if> |
| | | <if test="status==3"> |
| | | and m.status = #{status} |
| | | and l.status =8 |
| | | </if> |
| | | </where> |
| | | |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT parent_id |
| | | , process_level_name |
| | | , deal_user_id |
| | | , deal_type |
| | | , deal_desc |
| | | , deal_file_name |
| | | , deal_file_url |
| | | , deal_pic_name |
| | | , deal_pic_url |
| | | , deal_role_id |
| | | , deal_and_close |
| | | , deal_reject_reason |
| | | , deal_task_num |
| | | , deal_task_reply_num |
| | | , deal_reason |
| | | , required_finish_time |
| | | , deal_time |
| | | , reply_content |
| | | , reply_time |
| | | , l.process_level as lprocess_level |
| | | , l.main_id as lmain_id |
| | | , l.id as lid |
| | | , l.status as lstatus |
| | | , l.create_time as lcreate_time |
| | | , order_id |
| | | , title |
| | | , task_desc |
| | | , create_user_id |
| | | , plan_begin_time |
| | | , plan_end_time |
| | | , begin_time |
| | | , end_time |
| | | , task_level |
| | | , is_in_time |
| | | , file_name |
| | | , file_url |
| | | , pic_name |
| | | , pic_url |
| | | , end_reason |
| | | , is_auto |
| | | , m.type |
| | | , m.id as mid |
| | | , m.process_level as mprocess_level |
| | | , m.status as mstatus |
| | | , m.create_time as mcreate_time |
| | | FROM web_site.tb_workflow_link l |
| | | LEFT OUTER JOIN web_site.tb_workflow_main m on m.id = l.main_id |
| | | <where> |
| | | l.deal_role_id = #{uRole} |
| | | and l.deal_user_id is null |
| | | <if test="type!=0"> |
| | | and m.type = #{type} |
| | | </if> |
| | | <if test="type==0"> |
| | | and m.type != 1 |
| | | </if> |
| | | <if test="status==1"> |
| | | and m.status = #{status} |
| | | and l.status in (0,1,6) |
| | | </if> |
| | | <if test="status==2"> |
| | | and l.status =5 |
| | | </if> |
| | | <if test="status==3"> |
| | | and m.status = #{status} |
| | | and l.status =8 |
| | | </if> |
| | | </where> |
| | | ) |
| | | ORDER BY lid |
| | | </select> |
| | | <resultMap id="Mainlink" type="WorkflowMain"> |
| | | <result column="id" property="id"></result> |
| | | <result column="order_id" property="orderId"></result> |
| | | <result column="title" property="title"></result> |
| | | <result column="task_desc" property="taskDesc"></result> |
| | | <result column="create_user_id" property="createUserId"></result> |
| | | <result column="create_time" property="createTime"></result> |
| | | <result column="plan_begin_time" property="planBeginTime"></result> |
| | | <result column="plan_end_time" property="planEndTime"></result> |
| | | <result column="begin_time" property="beginTime"></result> |
| | | <result column="end_time" property="endTime"></result> |
| | | <result column="task_level" property="taskLevel"></result> |
| | | <result column="is_in_time" property="inTime"></result> |
| | | <result column="status" property="status"></result> |
| | | <result column="file_name" property="fileName"></result> |
| | | <result column="file_url" property="fileUrl"></result> |
| | | <result column="pic_name" property="picName"></result> |
| | | <result column="pic_url" property="picUrl"></result> |
| | | <result column="end_reason" property="endReason"></result> |
| | | <result column="is_auto" property="auto"></result> |
| | | <result column="type" property="type"></result> |
| | | <result column="process_level" property="processLevel"></result> |
| | | <collection property="workflowLink" javaType="WorkflowLink" ofType="com.whyc.pojo.WorkflowLink" |
| | | column="{main_id=id}" select="selectWorkflowLink"> |
| | | </collection> |
| | | </resultMap> |
| | | <select id="getFlowMainByUid" resultMap="Mainlink"> |
| | | SELECT |
| | | id |
| | | ,order_id |
| | | , title |
| | | , task_desc |
| | | , create_user_id |
| | | , plan_begin_time |
| | | , plan_end_time |
| | | , begin_time |
| | | , end_time |
| | | , task_level |
| | | , is_in_time |
| | | , file_name |
| | | , file_url |
| | | , pic_name |
| | | , pic_url |
| | | , end_reason |
| | | , is_auto |
| | | , type |
| | | ,status |
| | | , create_time |
| | | ,process_level |
| | | FROM web_site.tb_workflow_main m |
| | | <where> |
| | | m.create_user_id=#{userId} |
| | | <if test="type!=0"> |
| | | and m.type = #{type} |
| | | </if> |
| | | <if test="type==0"> |
| | | and m.type != 1 |
| | | </if> |
| | | <if test="status!=0"> |
| | | and m.status = #{status} |
| | | </if> |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="selectWorkflowLink" resultType="workflowLink"> |
| | | SELECT * |
| | | from web_site.tb_workflow_link |
| | | where main_id = #{main_id} |
| | | order by parent_id desc limit 1 |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.WorkflowMainMapper" > |
| | | |
| | | <sql id="linkColumn"> |
| | | l.id link_id, |
| | | l.main_id, |
| | | l.parent_id, |
| | | l.process_level as lProcessLevel, |
| | | l.process_level_name, |
| | | l.create_time link_create_time, |
| | | l.deal_user_id, |
| | | l.deal_type, |
| | | l.deal_desc, |
| | | l.deal_file_name, |
| | | l.deal_file_url, |
| | | l.deal_pic_name, |
| | | l.deal_pic_url, |
| | | l.status link_status, |
| | | l.deal_role_id, |
| | | l.deal_and_close, |
| | | l.deal_reject_reason, |
| | | l.deal_task_num, |
| | | l.deal_task_reply_num, |
| | | l.deal_reason, |
| | | l.required_finish_time, |
| | | l.deal_time, |
| | | l.reply_content, |
| | | l.reply_time |
| | | </sql> |
| | | |
| | | <resultMap id="Map_WorkflowMain" type="WorkflowMain"> |
| | | <id column="id" property="id"/> |
| | | <result column="title" property="title"/> |
| | | <result column="order_id" property="orderId"/> |
| | | <result column="task_desc" property="taskDesc"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="create_user_id" property="createUserId"/> |
| | | <result column="create_user_name" property="createUserName"/> |
| | | <result column="plan_begin_time" property="planBeginTime"/> |
| | | <result column="plan_end_time" property="planEndTime"/> |
| | | <result column="begin_time" property="beginTime"/> |
| | | <result column="end_time" property="endTime"/> |
| | | <result column="task_level" property="taskLevel"/> |
| | | <result column="is_in_time" property="inTime"/> |
| | | <result column="file_name" property="fileName"/> |
| | | <result column="file_url" property="fileUrl"/> |
| | | <result column="pic_name" property="picName"/> |
| | | <result column="pic_url" property="picUrl"/> |
| | | <result column="end_reason" property="endReason"/> |
| | | <result column="status" property="status"/> |
| | | <result column="is_auto" property="auto"/> |
| | | <result column="type" property="type"/> |
| | | <collection property="linkList" ofType="WorkflowLink"> |
| | | <id column="link_id" property="id"/> |
| | | <result column="main_id" property="mainId"/> |
| | | <result column="parent_id" property="parentId"/> |
| | | <result column="lProcessLevel" property="processLevel"/> |
| | | <result column="process_level_name" property="processLevelName"/> |
| | | <result column="link_create_time" property="createTime"/> |
| | | <result column="deal_user_id" property="dealUserId"/> |
| | | <result column="deal_type" property="dealType"/> |
| | | <result column="deal_desc" property="dealDesc"/> |
| | | <result column="deal_file_name" property="dealFileName"/> |
| | | <result column="deal_file_url" property="dealFileUrl"/> |
| | | <result column="deal_pic_name" property="dealPicName"/> |
| | | <result column="deal_pic_url" property="dealPicUrl"/> |
| | | <result column="link_status" property="status"/> |
| | | <result column="deal_role_id" property="dealRoleId"/> |
| | | <result column="deal_and_close" property="dealAndClose"/> |
| | | <result column="deal_reject_reason" property="dealRejectReason"/> |
| | | <result column="deal_task_num" property="dealTaskNum"/> |
| | | <result column="deal_task_reply_num" property="dealTaskReplyNum"/> |
| | | <result column="deal_reason" property="dealReason"/> |
| | | <result column="deal_time" property="dealTime"/> |
| | | <result column="required_finish_time" property="requiredFinishTime"/> |
| | | <result column="reply_content" property="replyContent"/> |
| | | <result column="reply_time" property="replyTime"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="getReceivedListByUserAndType" resultMap="Map_WorkflowMain"> |
| | | <choose> |
| | | <!--全部--> |
| | | <when test="status==0"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | union all |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} order by id desc |
| | | </when> |
| | | <!--待接单--> |
| | | <when test="status==1"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | and l.status = #{status} order by m.id desc |
| | | </when> |
| | | <otherwise> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | and l.status = #{status} order by m.id desc |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </select> |
| | | <select id="getMaxId" resultType="java.lang.Integer"> |
| | | select max(id) |
| | | from web_site.tb_workflow_main |
| | | </select> |
| | | </mapper> |