| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.mapper.DocUserMapper; |
| | | import com.whyc.mapper.WorksheetLinkMapper; |
| | | import com.whyc.mapper.WorksheetMainMapper; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.WorksheetLink; |
| | | import com.whyc.pojo.WorksheetMain; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | |
| | | @Resource |
| | | private WorksheetLinkMapper linkMapper; |
| | | |
| | | public void submit(WorksheetMain main) { |
| | | //提交工单主表 |
| | | main.setStatus(1); |
| | | mainMapper.insert(main); |
| | | //提交工单子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(1); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(0); |
| | | linkMapper.insert(link); |
| | | @Resource |
| | | private DocUserMapper userMapper; |
| | | |
| | | @Transactional |
| | | public boolean submit(WorksheetMain main, DocUser user) { |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | | if(user.getRoleId().equals("1001")){ |
| | | main.setLevel(2); |
| | | main.setStatus(1); |
| | | mainMapper.insert(main); |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(1); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(0); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1002")){ |
| | | main.setLevel(1); |
| | | main.setStatus(2); |
| | | mainMapper.insert(main); |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(2); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(1); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1003")){ |
| | | main.setLevel(0); |
| | | main.setStatus(5); |
| | | mainMapper.insert(main); |
| | | }else{ |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public WorksheetMain getInfoById(Integer id) { |
| | |
| | | mainMapper.updateById(main); |
| | | } |
| | | |
| | | public Map<String, WorksheetMain> getList() { |
| | | public void updateEndStatusById(Integer id,String endReason,Integer status) { |
| | | WorksheetMain main = new WorksheetMain(); |
| | | main.setId(id); |
| | | main.setStatus(status); |
| | | main.setEndReason(endReason); |
| | | mainMapper.updateById(main); |
| | | } |
| | | |
| | | /**用户对应的工作台数据分类 |
| | | * @param user TODO*/ |
| | | public Map<String, WorksheetMain> getList(DocUser user) { |
| | | Map<String,WorksheetMain> map = new HashMap<>(); |
| | | switch (user.getRoleId()){ |
| | | //普通员工 |
| | | case "1001": |
| | | { |
| | | //未处理/已驳回/已审批 |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | | } |
| | | break; |
| | | //项目经理 |
| | | case "1002": |
| | | { |
| | | //待处理/未处理/已驳回/已审批 |
| | | |
| | | } |
| | | break; |
| | | //总经理 |
| | | case "1003": |
| | | { |
| | | //待处理/已审批 |
| | | } |
| | | break; |
| | | } |
| | | |
| | | return null; |
| | | } |