|  |  |  | 
|---|
|  |  |  | package com.zy.crm.manager.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.core.domain.KeyValueVo; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.crm.common.model.SettleDto; | 
|---|
|  |  |  | import com.zy.crm.common.web.BaseController; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.Item; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.PriQuote; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.PriQuoteBudget; | 
|---|
|  |  |  | import com.zy.crm.manager.service.ItemService; | 
|---|
|  |  |  | import com.zy.crm.manager.service.PriQuoteBudgetService; | 
|---|
|  |  |  | import com.zy.crm.manager.service.PriQuoteService; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.*; | 
|---|
|  |  |  | import com.zy.crm.manager.service.*; | 
|---|
|  |  |  | import com.zy.crm.system.entity.User; | 
|---|
|  |  |  | import com.zy.crm.system.service.UserService; | 
|---|
|  |  |  | import org.apache.poi.xssf.usermodel.XSSFSheet; | 
|---|
|  |  |  | import org.apache.poi.xssf.usermodel.XSSFWorkbook; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | private PriQuoteService priQuoteService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ItemService itemService; | 
|---|
|  |  |  | private PlanService planService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UserService userService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PriQuoteBudgetService priQuoteBudgetService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ProcessPermissionsService processPermissionsService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlanTypeService planTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/priQuote/{id}/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R get(@PathVariable("id") String id) { | 
|---|
|  |  |  | return R.ok(priQuoteService.selectById(String.valueOf(id))); | 
|---|
|  |  |  | PriQuote priQuote = priQuoteService.selectById(String.valueOf(id)); | 
|---|
|  |  |  | assert priQuote != null; | 
|---|
|  |  |  | JSONObject resultObj = JSON.parseObject(JSON.toJSONString(priQuote)); | 
|---|
|  |  |  | if (!Cools.isEmpty(priQuote.getForm())) { | 
|---|
|  |  |  | JSONObject formObj = JSON.parseObject(priQuote.getForm()); | 
|---|
|  |  |  | formObj.forEach(resultObj::putIfAbsent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 步骤条相关 | 
|---|
|  |  |  | resultObj.put("step", priQuote.getSettle() == 5 ? 0 : priQuote.getSettle() + 1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok().add(resultObj); | 
|---|
|  |  |  | //        return R.ok(priQuoteService.selectById(String.valueOf(id))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/priQuote/list/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false)String condition, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | EntityWrapper<PriQuote> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.setSqlSelect("id,title,create_time as createTime,filepath,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,update_user_id as updateUserId,update_time as updateTime,in_order_num as inOrderNum,member_id as memberId"); | 
|---|
|  |  |  | wrapper.setSqlSelect("id,title,create_time as createTime,filepath,item_id as itemId,order_num as orderNum,template_name as templateName,sheet_data as sheetData,user_id as userId,dept_id as deptId,settle,settle_msg as settleMsg,form,update_user_id as updateUserId,update_time as updateTime,in_order_num as inOrderNum,member_id as memberId"); | 
|---|
|  |  |  | wrapper.in("member_id", getUserRoleBelongsToUserId()); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ | 
|---|
|  |  |  | Long deptId = getDeptId(); | 
|---|
|  |  |  | boolean signUserId = false; | 
|---|
|  |  |  | boolean signDeptId = false; | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()){ | 
|---|
|  |  |  | if (entry.getKey().equals("dept_id")){ | 
|---|
|  |  |  | signDeptId = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()){ | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)){ | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); | 
|---|
|  |  |  | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); | 
|---|
|  |  |  | } else if (entry.getKey().equals("dept_id")){ | 
|---|
|  |  |  | if (!val.equals("19")){ | 
|---|
|  |  |  | wrapper.eq(entry.getKey(), val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (entry.getKey().equals("user_id") && !signDeptId){ | 
|---|
|  |  |  | signUserId = true; | 
|---|
|  |  |  | wrapper.eq(entry.getKey(), val); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.like(entry.getKey(), val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!signUserId && !signDeptId){ | 
|---|
|  |  |  | wrapper.eq("user_id", getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | priQuote.setUserId(getUserId()); | 
|---|
|  |  |  | //更新人员 | 
|---|
|  |  |  | priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | //所属部门 | 
|---|
|  |  |  | priQuote.setDeptId(getDeptId()); | 
|---|
|  |  |  | //更新时间 | 
|---|
|  |  |  | priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //业务员 | 
|---|
|  |  |  | Item item = itemService.selectById(priQuote.getItemId()); | 
|---|
|  |  |  | priQuote.setMemberId(item.getMember()); | 
|---|
|  |  |  | Plan plan = planService.selectById(priQuote.getItemId()); | 
|---|
|  |  |  | priQuote.setMemberId(plan.getUserId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //设置项目流程 | 
|---|
|  |  |  | item.setStep(5); | 
|---|
|  |  |  | itemService.updateById(item); | 
|---|
|  |  |  | plan.setStep(5); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | priQuote.setForm(JSON.toJSONString(map));     // 自定义表单内容 | 
|---|
|  |  |  | priQuote.setSettle(1);  // 1.开始 | 
|---|
|  |  |  | User manager = userService.getDeptManager(getHostId(), getUser().getDeptId());        // 获取部门领导 | 
|---|
|  |  |  | ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 2).eq("process", "3-1"));//2:报价流程 | 
|---|
|  |  |  | User president = userService.selectById(processPermissions.getUserId());       // 获取报价流程节点3-1确认人 | 
|---|
|  |  |  | priQuote.setSettleMsg(JSON.toJSONString(SettleDto.initPriQuote(plan, manager,president,getUser()))); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | planService.updateById(plan); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | priQuoteService.insert(priQuote); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | 
|---|
|  |  |  | priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //业务员 | 
|---|
|  |  |  | Item item = itemService.selectById(priQuote.getItemId()); | 
|---|
|  |  |  | priQuote.setMemberId(item.getMember()); | 
|---|
|  |  |  | Plan plan = planService.selectById(priQuote.getItemId()); | 
|---|
|  |  |  | priQuote.setMemberId(plan.getUserId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | priQuoteService.insert(priQuote); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/priQuote/approval/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R approvalPriQuote(@RequestParam Long planId, | 
|---|
|  |  |  | @RequestParam(required = false) Long plannerId){ | 
|---|
|  |  |  | PriQuote priQuote = priQuoteService.selectById(planId); | 
|---|
|  |  |  | assert priQuote != null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch (priQuote.getSettle()) { | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | // 本部门经理审核 | 
|---|
|  |  |  | User user = userService.selectById(priQuote.getUserId()); | 
|---|
|  |  |  | User manager = userService.getDeptManager(getHostId(), user.getDeptId()); | 
|---|
|  |  |  | if (manager.getId().equals(getUserId())) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 修改 settle 步骤数据 | 
|---|
|  |  |  | List<SettleDto> list = JSON.parseArray(priQuote.getSettleMsg(), SettleDto.class); | 
|---|
|  |  |  | for (SettleDto dto : list) { | 
|---|
|  |  |  | switch (dto.getStep()) { | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | dto.setCurr(Boolean.FALSE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | dto.setMsg("部门经理" + manager.getNickname() + "审批通过"); | 
|---|
|  |  |  | dto.setTime(DateUtils.convert(new Date())); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | priQuote.setSettleMsg(JSON.toJSONString(list)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 修改规划单状态 | 
|---|
|  |  |  | priQuote.setSettle(2);  // 总裁办待审 | 
|---|
|  |  |  | priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!priQuoteService.updateById(priQuote)) { | 
|---|
|  |  |  | throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 2).eq("process", "3-1"));//2:报价流程 | 
|---|
|  |  |  | User planLeader = userService.selectById(processPermissions.getUserId());       // 获取报价流程节点3确认人 | 
|---|
|  |  |  | if (Cools.isEmpty(planLeader)) { | 
|---|
|  |  |  | throw new CoolException("未查找到报价流程节点3-1确认人,请联系在审批权限添加确认人!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!getUserId().equals(planLeader.getId())) { | 
|---|
|  |  |  | return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | User planner = userService.selectById(plannerId); | 
|---|
|  |  |  | // 修改 settle 步骤数据 | 
|---|
|  |  |  | List<SettleDto> list = JSON.parseArray(priQuote.getSettleMsg(), SettleDto.class); | 
|---|
|  |  |  | for (SettleDto dto : list) { | 
|---|
|  |  |  | switch (dto.getStep()) { | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | dto.setCurr(Boolean.FALSE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | dto.setMsg("总裁办" + planLeader.getNickname() + "审批通过"); | 
|---|
|  |  |  | dto.setTime(DateUtils.convert(new Date())); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | priQuote.setSettleMsg(JSON.toJSONString(list)); | 
|---|
|  |  |  | // 修改规划单状态 | 
|---|
|  |  |  | priQuote.setSettle(3);  // 规划员待审 | 
|---|
|  |  |  | priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!priQuoteService.updateById(priQuote)) { | 
|---|
|  |  |  | throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | // 业务员 | 
|---|
|  |  |  | User salesman0 = userService.selectById(priQuote.getUserId()); | 
|---|
|  |  |  | if (!getUserId().equals(salesman0.getId())) { | 
|---|
|  |  |  | return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 修改 settle 步骤数据 | 
|---|
|  |  |  | List<SettleDto> list1 = JSON.parseArray(priQuote.getSettleMsg(), SettleDto.class); | 
|---|
|  |  |  | for (SettleDto dto : list1) { | 
|---|
|  |  |  | switch (dto.getStep()) { | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | dto.setMsg("业务员" + salesman0.getNickname() + "审批通过"); | 
|---|
|  |  |  | dto.setTime(DateUtils.convert(new Date())); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | priQuote.setSettleMsg(JSON.toJSONString(list1)); | 
|---|
|  |  |  | // 修改规划单状态 | 
|---|
|  |  |  | priQuote.setSettle(4);  // 审批通过 | 
|---|
|  |  |  | priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!priQuoteService.updateById(priQuote)) { | 
|---|
|  |  |  | throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("审批成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/priQuote/refuse/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R refusePriQuote(@RequestParam Long planId, | 
|---|
|  |  |  | @RequestParam(required = false) Long plannerId){ | 
|---|
|  |  |  | //        PriQuote priQuote = priQuoteService.selectById(planId); | 
|---|
|  |  |  | //        assert priQuote != null; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        switch (priQuote.getSettle()) { | 
|---|
|  |  |  | //            case 1: | 
|---|
|  |  |  | //                // 本部门经理审核 | 
|---|
|  |  |  | //                User user = userService.selectById(priQuote.getUserId()); | 
|---|
|  |  |  | //                User manager = userService.getDeptManager(getHostId(), user.getDeptId()); | 
|---|
|  |  |  | //                if (manager.getId().equals(getUserId())) { | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    // 修改 settle 步骤数据 | 
|---|
|  |  |  | //                    List<SettleDto> list = JSON.parseArray(priQuote.getSettleMsg(), SettleDto.class); | 
|---|
|  |  |  | //                    for (SettleDto dto : list) { | 
|---|
|  |  |  | //                        switch (dto.getStep()) { | 
|---|
|  |  |  | //                            case 1: | 
|---|
|  |  |  | //                                dto.setCurr(Boolean.FALSE); | 
|---|
|  |  |  | //                                break; | 
|---|
|  |  |  | //                            case 2: | 
|---|
|  |  |  | //                                dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | //                                dto.setMsg("部门经理" + manager.getNickname() + "审批通过"); | 
|---|
|  |  |  | //                                dto.setTime(DateUtils.convert(new Date())); | 
|---|
|  |  |  | //                                break; | 
|---|
|  |  |  | //                            default: | 
|---|
|  |  |  | //                                break; | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                    priQuote.setSettleMsg(JSON.toJSONString(list)); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    // 修改规划单状态 | 
|---|
|  |  |  | //                    priQuote.setSettle(2);  // 总裁办待审 | 
|---|
|  |  |  | //                    priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | //                    priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    if (!priQuoteService.updateById(priQuote)) { | 
|---|
|  |  |  | //                        throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                } else { | 
|---|
|  |  |  | //                    return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                break; | 
|---|
|  |  |  | //            case 2: | 
|---|
|  |  |  | //                ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 2).eq("process", "3-1"));//2:报价流程 | 
|---|
|  |  |  | //                User planLeader = userService.selectById(processPermissions.getUserId());       // 获取报价流程节点3确认人 | 
|---|
|  |  |  | //                if (Cools.isEmpty(planLeader)) { | 
|---|
|  |  |  | //                    throw new CoolException("未查找到报价流程节点3-1确认人,请联系在审批权限添加确认人!"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                if (!getUserId().equals(planLeader.getId())) { | 
|---|
|  |  |  | //                    return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                User planner = userService.selectById(plannerId); | 
|---|
|  |  |  | //                // 修改 settle 步骤数据 | 
|---|
|  |  |  | //                List<SettleDto> list = JSON.parseArray(priQuote.getSettleMsg(), SettleDto.class); | 
|---|
|  |  |  | //                for (SettleDto dto : list) { | 
|---|
|  |  |  | //                    switch (dto.getStep()) { | 
|---|
|  |  |  | //                        case 2: | 
|---|
|  |  |  | //                            dto.setCurr(Boolean.FALSE); | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                        case 3: | 
|---|
|  |  |  | //                            dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | //                            dto.setMsg("总裁办" + planLeader.getNickname() + "审批通过"); | 
|---|
|  |  |  | //                            dto.setTime(DateUtils.convert(new Date())); | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                        default: | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                priQuote.setSettleMsg(JSON.toJSONString(list)); | 
|---|
|  |  |  | //                // 修改规划单状态 | 
|---|
|  |  |  | //                priQuote.setSettle(3);  // 规划员待审 | 
|---|
|  |  |  | //                priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | //                priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                if (!priQuoteService.updateById(priQuote)) { | 
|---|
|  |  |  | //                    throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                break; | 
|---|
|  |  |  | //            case 3: | 
|---|
|  |  |  | //                // 业务员 | 
|---|
|  |  |  | //                User salesman0 = userService.selectById(priQuote.getUserId()); | 
|---|
|  |  |  | //                if (!getUserId().equals(salesman0.getId())) { | 
|---|
|  |  |  | //                    return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                // 修改 settle 步骤数据 | 
|---|
|  |  |  | //                List<SettleDto> list1 = JSON.parseArray(priQuote.getSettleMsg(), SettleDto.class); | 
|---|
|  |  |  | //                for (SettleDto dto : list1) { | 
|---|
|  |  |  | //                    switch (dto.getStep()) { | 
|---|
|  |  |  | //                        case 3: | 
|---|
|  |  |  | //                            dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                        case 4: | 
|---|
|  |  |  | //                            dto.setCurr(Boolean.TRUE); | 
|---|
|  |  |  | //                            dto.setMsg("业务员" + salesman0.getNickname() + "审批通过"); | 
|---|
|  |  |  | //                            dto.setTime(DateUtils.convert(new Date())); | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                        default: | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                priQuote.setSettleMsg(JSON.toJSONString(list1)); | 
|---|
|  |  |  | //                // 修改规划单状态 | 
|---|
|  |  |  | //                priQuote.setSettle(4);  // 审批通过 | 
|---|
|  |  |  | //                priQuote.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | //                priQuote.setUpdateTime(new Date()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                if (!priQuoteService.updateById(priQuote)) { | 
|---|
|  |  |  | //                    throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                break; | 
|---|
|  |  |  | //            default: | 
|---|
|  |  |  | //                return R.error(); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | return R.ok("审批成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|