From 8ec842bdf0668ce9ac90fbf1aef18e0f47b0750f Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Thu, 18 Jul 2024 10:34:26 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E8=A7=A3=E5=86=B3=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=94=AE?= =?UTF-8?q?=E5=90=8E=E9=80=9A=E7=9F=A5=E5=8D=95=E7=9A=84=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=94=AE=E5=90=8E=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8D=95=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=94=AE=E5=90=8E=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8D=95VO=E7=B1=BB=E3=80=82=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E5=94=AE=E5=90=8E=E9=80=9A=E7=9F=A5=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=90=8E=E7=AB=AF=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8D=95=E5=88=97=E8=A1=A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=E9=80=9A=E7=9F=A5=E5=8D=95?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E4=B8=BB=E7=AE=A1=E5=AE=A1=E6=A0=B8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SalesAftersalesNoticeController.java | 128 ++++++++++++-- .../domain/VO/SalesAftersalesNoticeVO.java | 33 ++++ .../mapper/SalesAftersalesNoticeMapper.java | 5 +- .../ISalesAftersalesNoticeService.java | 15 +- .../SalesAftersalesNoticeServiceImpl.java | 167 +++++++++++++++++- .../sales/SalesAftersalesNoticeMapper.xml | 26 +-- .../templates/sales/afterSalesNotice/add.html | 104 ----------- .../afterSalesNotice/afterSalesNotice.html | 113 +++++++++--- .../afterSalesNotice/taskModifyApply.html | 130 ++++++++++++++ .../afterSalesNotice/taskYwjlVerify.html | 155 ++++++++++++++++ .../afterSalesNotice/taskYwzgVerify.html | 155 ++++++++++++++++ 11 files changed, 866 insertions(+), 165 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesAftersalesNoticeVO.java create mode 100644 ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskModifyApply.html create mode 100644 ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwjlVerify.html create mode 100644 ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwzgVerify.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java index 0cf4fb4c..89e62691 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java @@ -1,15 +1,21 @@ package com.ruoyi.sales.controller; +import java.util.HashMap; import java.util.List; + +import com.ruoyi.aftersales.domain.vo.AftersalesOrderVO; +import com.ruoyi.process.general.service.IProcessService; +import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; +import org.activiti.engine.RuntimeService; +import org.activiti.engine.TaskService; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; +import org.apache.commons.lang3.BooleanUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.sales.domain.SalesAftersalesNotice; @@ -19,6 +25,9 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + /** * 售后通知单Controller * @@ -34,6 +43,16 @@ public class SalesAftersalesNoticeController extends BaseController @Autowired private ISalesAftersalesNoticeService salesAftersalesNoticeService; + @Autowired + private TaskService taskService; + + @Autowired + private RuntimeService runtimeService; + + @Autowired + private IProcessService processService; + + @RequiresPermissions("sales:afterSalesNotice:view") @GetMapping() public String afterSalesNotice() @@ -47,10 +66,10 @@ public class SalesAftersalesNoticeController extends BaseController @RequiresPermissions("sales:afterSalesNotice:list") @PostMapping("/list") @ResponseBody - public TableDataInfo list(SalesAftersalesNotice salesAftersalesNotice) + public TableDataInfo list(SalesAftersalesNoticeVO salesAftersalesNoticeVO) { startPage(); - List list = salesAftersalesNoticeService.selectSalesAftersalesNoticeList(salesAftersalesNotice); + List list = salesAftersalesNoticeService.selectSalesAftersalesNoticeList(salesAftersalesNoticeVO); return getDataTable(list); } @@ -61,10 +80,10 @@ public class SalesAftersalesNoticeController extends BaseController @Log(title = "售后通知单", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(SalesAftersalesNotice salesAftersalesNotice) + public AjaxResult export(SalesAftersalesNoticeVO salesAftersalesNoticeVO) { - List list = salesAftersalesNoticeService.selectSalesAftersalesNoticeList(salesAftersalesNotice); - ExcelUtil util = new ExcelUtil(SalesAftersalesNotice.class); + List list = salesAftersalesNoticeService.selectSalesAftersalesNoticeList(salesAftersalesNoticeVO); + ExcelUtil util = new ExcelUtil(SalesAftersalesNoticeVO.class); return util.exportExcel(list, "售后通知单数据"); } @@ -86,9 +105,96 @@ public class SalesAftersalesNoticeController extends BaseController @ResponseBody public AjaxResult addSave(SalesAftersalesNotice salesAftersalesNotice) { - return toAjax(salesAftersalesNoticeService.insertSalesAftersalesNotice(salesAftersalesNotice)); + // 审核状态-待审核 + salesAftersalesNotice.setAuditStatus("0"); + salesAftersalesNoticeService.submitApply(salesAftersalesNotice); + return AjaxResult.success(); + } + + + + /** + * 加载审批弹窗 + * @param taskId + * @param mmap + * @return + */ + @GetMapping("/showVerifyDialog/{taskId}") + public String showVerifyDialog(@PathVariable("taskId") String taskId, ModelMap mmap) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + String processInstanceId = task.getProcessInstanceId(); + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); + SalesAftersalesNoticeVO aftersalesNoticeVO = salesAftersalesNoticeService.selectSalesAftersalesNoticeById(new Long(processInstance.getBusinessKey())); + mmap.put("formData", aftersalesNoticeVO); + mmap.put("taskId", taskId); + String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1); + return prefix + "/task" + verifyName; } + /** + * 自动绑定页面字段 + */ + @ModelAttribute("preloadObj") + public SalesAftersalesNoticeVO getObj(@RequestParam(value = "aftersalesNoticeId", required = false) Long aftersalesNoticeId, HttpSession session) { + if (aftersalesNoticeId != null) { + + return salesAftersalesNoticeService.selectSalesAftersalesNoticeById(aftersalesNoticeId); + } + return new SalesAftersalesNoticeVO(); + } + + + + /** + * 完成任务 + * + * @return + */ + @RequestMapping(value = "/complete/{taskId}", method = {RequestMethod.POST, RequestMethod.GET}) + @ResponseBody + public AjaxResult complete(@PathVariable("taskId") String taskId, @RequestParam(value = "saveEntity", required = false) String saveEntity, + @ModelAttribute("preloadObj") SalesAftersalesNoticeVO aftersalesNoticeVO, HttpServletRequest request) { + boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity); + //获取实例id + String instanceId = aftersalesNoticeVO.getInstanceId(); + //获取实例类型 + String instanceType = aftersalesNoticeVO.getInstanceType(); + boolean approvedFlag = processService.complete(taskId, instanceId, aftersalesNoticeVO.getApplyTitle(), aftersalesNoticeVO.getAftersalesNoticeCode(), "aftersalesNotice", new HashMap(), request); + if(!approvedFlag){ + // 审核状态-审核拒绝 + aftersalesNoticeVO.setAuditStatus("2"); + } + // 如果任务已结束更新业务表状态 + boolean processIsFinish = processService.judgeProcessIsFinish(instanceId); + if (processIsFinish) { + // 审核通过 + aftersalesNoticeVO.setAuditStatus("1"); + // 提交 + if("submit".equals(instanceType)){ + // 使用状态-是 +// erpBomVo.setUseStatus("1"); + } + // 作废 + else if("cancel".equals(instanceType)){ + // 使用状态-已作废 +// erpBomVo.setUseStatus("2"); + } + // 恢复 + else if("restore".equals(instanceType)){ + // 使用状态-是 +// erpBomVo.setUseStatus("1"); + } + } + salesAftersalesNoticeService.updateSalesAftersalesNotice(aftersalesNoticeVO); + // 驳回申请后继续申请,可能修改表单 + if (saveEntityBoolean) { + salesAftersalesNoticeService.updateSalesAftersalesNotice(aftersalesNoticeVO); + } + return success("任务已完成"); + } + + + /** * 修改售后通知单 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesAftersalesNoticeVO.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesAftersalesNoticeVO.java new file mode 100644 index 00000000..a24f2b44 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesAftersalesNoticeVO.java @@ -0,0 +1,33 @@ +package com.ruoyi.sales.domain.VO; + +import com.ruoyi.sales.domain.SalesAftersalesNotice; +import lombok.Data; + +import java.util.Date; + +@Data +public class SalesAftersalesNoticeVO extends SalesAftersalesNotice { + private static final long serialVersionUID = -3627380777050403384L; + + /** 申请人姓名 */ + private String applyUserName; + /** 任务ID */ + private String taskId; + /** 任务名称 */ + private String taskName; + /** 办理时间 */ + private Date doneTime; + /** 创建人 */ + private String createUserName; + /** 流程实例状态 1 激活 2 挂起 */ + private String suspendState; + /** 待办用户id */ + private String todoUserId; + /** 流程实例类型名称 */ + private String instanceTypeName; + + /** + * 关键词 + */ + private String keyword; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java index 8da23e07..905ad7c6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.sales.mapper; import java.util.List; import com.ruoyi.sales.domain.SalesAftersalesNotice; +import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; /** * 售后通知单Mapper接口 @@ -17,7 +18,7 @@ public interface SalesAftersalesNoticeMapper * @param aftersalesNoticeId 售后通知单ID * @return 售后通知单 */ - public SalesAftersalesNotice selectSalesAftersalesNoticeById(Long aftersalesNoticeId); + public SalesAftersalesNoticeVO selectSalesAftersalesNoticeById(Long aftersalesNoticeId); /** * 查询售后通知单列表 @@ -25,7 +26,7 @@ public interface SalesAftersalesNoticeMapper * @param salesAftersalesNotice 售后通知单 * @return 售后通知单集合 */ - public List selectSalesAftersalesNoticeList(SalesAftersalesNotice salesAftersalesNotice); + public List selectSalesAftersalesNoticeList(SalesAftersalesNotice salesAftersalesNotice); /** * 新增售后通知单 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java index 1309fa0d..83afbf0d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java @@ -1,7 +1,11 @@ package com.ruoyi.sales.service; import java.util.List; + +import com.ruoyi.aftersales.domain.AftersalesOrder; import com.ruoyi.sales.domain.SalesAftersalesNotice; +import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; +import org.activiti.engine.runtime.ProcessInstance; /** * 售后通知单Service接口 @@ -17,7 +21,7 @@ public interface ISalesAftersalesNoticeService * @param aftersalesNoticeId 售后通知单ID * @return 售后通知单 */ - public SalesAftersalesNotice selectSalesAftersalesNoticeById(Long aftersalesNoticeId); + public SalesAftersalesNoticeVO selectSalesAftersalesNoticeById(Long aftersalesNoticeId); /** * 查询售后通知单列表 @@ -25,7 +29,7 @@ public interface ISalesAftersalesNoticeService * @param salesAftersalesNotice 售后通知单 * @return 售后通知单集合 */ - public List selectSalesAftersalesNoticeList(SalesAftersalesNotice salesAftersalesNotice); + public List selectSalesAftersalesNoticeList(SalesAftersalesNoticeVO salesAftersalesNoticeVO); /** * 新增售后通知单 @@ -72,4 +76,11 @@ public interface ISalesAftersalesNoticeService * @return */ int restoreSalesAftersalesNoticeById(Long aftersalesNoticeId); + + + + /** + * 审批流程启动 + * */ + ProcessInstance submitApply(SalesAftersalesNotice salesAftersalesNotice); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java index 48e9f2f2..a9cb7436 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java @@ -1,14 +1,36 @@ package com.ruoyi.sales.service.impl; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.github.pagehelper.Page; +import com.ruoyi.aftersales.domain.AftersalesOrder; +import com.ruoyi.aftersales.domain.vo.AftersalesOrderVO; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableSupport; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.process.general.service.IProcessService; +import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; +import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.ISysRoleService; +import org.activiti.engine.TaskService; +import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.sales.mapper.SalesAftersalesNoticeMapper; import com.ruoyi.sales.domain.SalesAftersalesNotice; import com.ruoyi.sales.service.ISalesAftersalesNoticeService; import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; /** * 售后通知单Service业务层处理 @@ -22,6 +44,25 @@ public class SalesAftersalesNoticeServiceImpl implements ISalesAftersalesNoticeS @Autowired private SalesAftersalesNoticeMapper salesAftersalesNoticeMapper; + @Autowired + private RedisCache redisCache; + + @Autowired + private IProcessService processService; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private SysUserMapper userMapper; + + @Autowired + private TaskService taskService; + + @Autowired + private BizTodoItemMapper todoItemMapper; + + /** * 查询售后通知单 * @@ -29,7 +70,7 @@ public class SalesAftersalesNoticeServiceImpl implements ISalesAftersalesNoticeS * @return 售后通知单 */ @Override - public SalesAftersalesNotice selectSalesAftersalesNoticeById(Long aftersalesNoticeId) + public SalesAftersalesNoticeVO selectSalesAftersalesNoticeById(Long aftersalesNoticeId) { return salesAftersalesNoticeMapper.selectSalesAftersalesNoticeById(aftersalesNoticeId); } @@ -37,13 +78,64 @@ public class SalesAftersalesNoticeServiceImpl implements ISalesAftersalesNoticeS /** * 查询售后通知单列表 * - * @param salesAftersalesNotice 售后通知单 + * @param salesAftersalesNoticeVO 售后通知单 * @return 售后通知单 */ @Override - public List selectSalesAftersalesNoticeList(SalesAftersalesNotice salesAftersalesNotice) + public List selectSalesAftersalesNoticeList(SalesAftersalesNoticeVO salesAftersalesNoticeVO) { - return salesAftersalesNoticeMapper.selectSalesAftersalesNoticeList(salesAftersalesNotice); + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + + // PageHelper 仅对第一个 List 分页 + Page list = (Page) salesAftersalesNoticeMapper.selectSalesAftersalesNoticeList(salesAftersalesNoticeVO); + Page returnList = new Page<>(); + for (SalesAftersalesNoticeVO tempSalesAftersalesNoticeVO: list) { + SysUser sysUser = userMapper.selectUserByLoginName(tempSalesAftersalesNoticeVO.getCreateBy()); + if (sysUser != null) { + tempSalesAftersalesNoticeVO.setCreateUserName(sysUser.getUserName()); + } + SysUser sysUser2 = userMapper.selectUserByLoginName(tempSalesAftersalesNoticeVO.getApplyUser()); + if (sysUser2 != null) { + tempSalesAftersalesNoticeVO.setApplyUserName(sysUser2.getUserName()); + } + String instanceId = tempSalesAftersalesNoticeVO.getInstanceId(); + // 当前环节 + if (StringUtils.isNotBlank(instanceId)) { + List taskList = taskService.createTaskQuery() + .processInstanceId(instanceId) +// .singleResult(); + .list(); // 例如请假会签,会同时拥有多个任务 + if (!org.springframework.util.CollectionUtils.isEmpty(taskList)) { + TaskEntityImpl task = (TaskEntityImpl) taskList.get(0); + String taskId = task.getId(); + tempSalesAftersalesNoticeVO.setTaskId(taskId); + // 设置待办用户 + List todoUserList = todoItemMapper.selectUndealTodoUserList(taskId); + if(!org.springframework.util.CollectionUtils.isEmpty(taskList)){ + tempSalesAftersalesNoticeVO.setTodoUserId(String.join(",",todoUserList)); + } + if (task.getSuspensionState() == 2) { + tempSalesAftersalesNoticeVO.setTaskName("已挂起"); + tempSalesAftersalesNoticeVO.setSuspendState("2"); + } else { + tempSalesAftersalesNoticeVO.setTaskName(task.getName()); + tempSalesAftersalesNoticeVO.setSuspendState("1"); + } + } else { + // 已办结或者已撤销 + tempSalesAftersalesNoticeVO.setTaskName("已结束"); + } + } else { + tempSalesAftersalesNoticeVO.setTaskName("未启动"); + } + returnList.add(tempSalesAftersalesNoticeVO); + } + returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); + returnList.setPageNum(pageNum); + returnList.setPageSize(pageSize); + return returnList; } /** @@ -123,4 +215,71 @@ public class SalesAftersalesNoticeServiceImpl implements ISalesAftersalesNoticeS { return salesAftersalesNoticeMapper.restoreSalesAftersalesNoticeById(aftersalesNoticeId); } + + @Transactional(rollbackFor = Exception.class) + @Override + public ProcessInstance submitApply(SalesAftersalesNotice salesAftersalesNotice) { + + + SysUser user = ShiroUtils.getSysUser(); + salesAftersalesNotice.setApplyUser(user.getLoginName()); + salesAftersalesNotice.setApplyTime(DateUtils.getNowDate()); + salesAftersalesNotice.setAftersalesNoticeCode(redisCache.generateBillNo("SH")); + // 保存 + insertSalesAftersalesNotice(salesAftersalesNotice); + // 启动流程 + String applyTitle = user.getUserName()+"发起了售后单提交审批-"+DateUtils.dateTimeNow(); + String instanceType = "submit"; + ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,salesAftersalesNotice, user); + String processInstanceId = processInstance.getProcessInstanceId(); + // 提交实例id + salesAftersalesNotice.setSubmitInstanceId(processInstanceId); + // 存在提交完就流程结束的情况 + boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); + if(processIsFinish){ + // 审核状态-审核通过 + salesAftersalesNotice.setAuditStatus("1"); + } + salesAftersalesNoticeMapper.updateSalesAftersalesNotice(salesAftersalesNotice); + return processInstance; + } + + + /** + * 创建售后单审核流程 + * @param applyTitle + * @param instanceType + * @param user + * @return + */ + private ProcessInstance startProcessInstance(String applyTitle, String instanceType, SalesAftersalesNotice salesAftersalesNotice, SysUser user) { + Long aftersalesNoticeId = salesAftersalesNotice.getAftersalesNoticeId(); + String businessKey = aftersalesNoticeId.toString(); // 实体类 ID,作为流程的业务 key + String key = "aftersalesNotice"; + Map variables = new HashMap<>(); + // 构造authority传参 + buildAuthority(user, variables); + salesAftersalesNotice.setApplyTitle(applyTitle); + // 启动流程 + ProcessInstance processInstance = processService.submitApply(user.getLoginName(), businessKey, applyTitle, salesAftersalesNotice.getAftersalesNoticeCode(), key, variables); + String processInstanceId = processInstance.getId(); + salesAftersalesNotice.setInstanceId(processInstanceId); // 建立双向关系 + salesAftersalesNotice.setInstanceType(instanceType); + return processInstance; + } + + /** + * 发起人节点判断 + * */ + private void buildAuthority(SysUser user, Map variables) { + Set roleKeys = roleService.selectRoleKeys(user.getUserId()); + // 角色不同审核人不同 + if(roleKeys.contains("ywyRole")){ + variables.put("authority",1); + }else if(roleKeys.contains("ywjlRole")){ + variables.put("authority",2); + }else if(roleKeys.contains("ywzgRole")){ + variables.put("authority",3); + } + } } diff --git a/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml b/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml index 163dfe1c..c4448fd0 100644 --- a/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -40,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select aftersales_notice_id, aftersales_notice_code, sales_order_code, user_id, audit_status, aftersales_status, business_members, aftersales_members, enterprise_code, enterprise_name, material_sum, enterprise_sum, start_time, customer_contact, contact_number, company_address, create_by, create_time, update_by, update_time, instance_id, instance_type, submit_instance_id, apply_title, apply_time, apply_user, cancel_instance_id, restore_instance_id, remark from sales_aftersales_notice - and aftersales_notice_code = #{aftersalesNoticeCode} @@ -52,24 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and aftersales_members like concat('%', #{aftersalesMembers}, '%') and enterprise_code = #{enterpriseCode} and enterprise_name like concat('%', #{enterpriseName}, '%') - and material_sum = #{materialSum} - and enterprise_sum = #{enterpriseSum} - and start_time = #{startTime} - and customer_contact = #{customerContact} - and contact_number = #{contactNumber} - and company_address = #{companyAddress} - and create_by = #{createBy} - and create_time between #{params.beginCreateTime} and #{params.endCreateTime} - and update_by = #{updateBy} and update_time between #{params.beginUpdateTime} and #{params.endUpdateTime} - and instance_id = #{instanceId} - and instance_type = #{instanceType} - and submit_instance_id = #{submitInstanceId} - and apply_title = #{applyTitle} - and apply_time = #{applyTime} - and apply_user = #{applyUser} - and cancel_instance_id = #{cancelInstanceId} - and restore_instance_id = #{restoreInstanceId} @@ -78,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where aftersales_notice_id = #{aftersalesNoticeId} - + insert into sales_aftersales_notice aftersales_notice_code, @@ -142,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + update sales_aftersales_notice aftersales_notice_code = #{aftersalesNoticeCode}, diff --git a/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/add.html b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/add.html index 7e2e1b0c..8ed2514b 100644 --- a/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/add.html +++ b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/add.html @@ -7,12 +7,6 @@
-
- -
- -
-
@@ -25,15 +19,6 @@
-
- -
-
- - -
-
-
@@ -67,95 +52,6 @@
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
diff --git a/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/afterSalesNotice.html b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/afterSalesNotice.html index 84aed7c7..ec26db66 100644 --- a/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/afterSalesNotice.html +++ b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/afterSalesNotice.html @@ -59,12 +59,6 @@ 添加 - - 修改 - - - 删除 - 导出 @@ -75,6 +69,7 @@
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwjlVerify.html b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwjlVerify.html new file mode 100644 index 00000000..ea8fcada --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwjlVerify.html @@ -0,0 +1,155 @@ + + + + + + + +
+ + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + + +
+ + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwzgVerify.html b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwzgVerify.html new file mode 100644 index 00000000..f74613a7 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/sales/afterSalesNotice/taskYwzgVerify.html @@ -0,0 +1,155 @@ + + + + + + + +
+
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+
+ + + + + + \ No newline at end of file