| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/assistantPlan/add/auth") |
| | | @ManagerAuth(memo = "添加副规划申请单") |
| | | @Transactional |
| | | public R assistantPlanAdd(@RequestParam Long hostPlanId) { |
| | | Plan hostPlan = planService.selectById(hostPlanId); |
| | | if (!Cools.isEmpty(hostPlan.getAssistantPlanId()) && hostPlan.getAssistantPlanId()!=0){ |
| | | return R.error("此规划单已存在副规划单,id为"+hostPlan.getAssistantPlanId()); |
| | | } |
| | | // pre |
| | | Plan plan = new Plan(hostPlan); |
| | | // begin |
| | | Long hostId = getHostId(); |
| | | if (planService.selectByUuid(hostId, plan.getUuid()) != null) { |
| | | throw new CoolException("规划单已存在"); |
| | | } |
| | | |
| | | Order order = orderService.selectById(plan.getOrderId()); |
| | | if (Cools.isEmpty(order)) { |
| | | throw new CoolException("跟踪项目不存在"); |
| | | } |
| | | |
| | | if (!order.getDirector().equals(getUserId())){ |
| | | throw new CoolException("只允许跟踪项目负责人添加所选项目规划申请单"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | plan.setHostId(hostId); |
| | | plan.setUuid(planService.getUuid(hostId)); // 规划单代号 |
| | | plan.setDeptId(getDeptId()); // 所属部门 |
| | | plan.setUserId(getUserId()); // 所属人员 |
| | | |
| | | plan.setAppleTime(now); |
| | | plan.setCreateBy(getUserId()); |
| | | plan.setCreateTime(now); |
| | | plan.setUpdateBy(getUserId()); |
| | | plan.setUpdateTime(now); |
| | | plan.setStatus(0); |
| | | plan.setStatus2(0); |
| | | plan.setStep(1); |
| | | plan.setSettle(1); // 1.开始 |
| | | plan.setAssistantHostSign(1);//副规划单 |
| | | |
| | | User manager = new User(); |
| | | try{ |
| | | manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 获取部门领导 |
| | | }catch (Exception e){ |
| | | manager = getUser(); |
| | | } |
| | | PlanType planType = new PlanType(hostPlan.getHostId(),1);//1:货架 |
| | | User planLeader = planTypeService.findPlanLeader(planType); |
| | | plan.setSettleMsg(JSON.toJSONString(SettleDto.init(plan, manager, planLeader))); |
| | | |
| | | plan.setDirector(planLeader.getId()); |
| | | |
| | | if (!planService.insert(plan)) { |
| | | throw new CoolException("保存失败,请重试"); |
| | | } |
| | | plan.setAssistantPlanId(plan.getId()); |
| | | plan.setHostPlanId(hostPlanId); |
| | | if (!planService.updateById(plan)) { |
| | | throw new CoolException("更新失败,请重试"); |
| | | } |
| | | // 自动添加跟进人 |
| | | PlanFoll planFoll = new PlanFoll(); |
| | | planFoll.setPlanId(plan.getId()); |
| | | planFoll.setUserId(planLeader.getId()); |
| | | if (!planFollService.insert(planFoll)) { |
| | | throw new CoolException("保存失败,请重试"); |
| | | } |
| | | |
| | | hostPlan.setAssistantPlanId(plan.getId()); |
| | | hostPlan.setHostPlanId(hostPlanId); |
| | | if (!planService.updateById(hostPlan)) { |
| | | throw new CoolException("更新失败,请重试"); |
| | | } |
| | | return R.ok("保存成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/update/auth") |
| | | @ManagerAuth(memo = "更新规划申请单") |
| | | @Transactional |
| | |
| | | if (priOnline2!=0){ |
| | | return R.error("存在关联的核价单,禁止删除!!!"); |
| | | } |
| | | Plan planA = planService.selectById(id); |
| | | if (planA.getAssistantHostSign()==1){ |
| | | Plan planB = planService.selectById(planA.getHostPlanId()); |
| | | planB.setAssistantPlanId(0L); |
| | | planB.setHostPlanId(0L); |
| | | planService.updateById(planB); |
| | | }else { |
| | | if (!Cools.isEmpty(planA.getAssistantPlanId()) && planA.getAssistantPlanId()!=0){ |
| | | Plan planB = planService.selectById(planA.getAssistantPlanId()); |
| | | if (!Cools.isEmpty(planB)){ |
| | | return R.error("存在关联的副规划单,禁止删除!!! 副规划单ID:"+planB.getId()); |
| | | } |
| | | } |
| | | } |
| | | planService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | @ApiModelProperty(value= "节点负责人") |
| | | private Long director; |
| | | |
| | | public Plan() {} |
| | | /** |
| | | * 集成项目货架核价状态 |
| | | */ |
| | | @ApiModelProperty(value = "状态 3: 完成核价 2: 开始核价 1: 等待核价 0: 初始 ") |
| | | private Integer status2; |
| | | |
| | | /** |
| | | * 节点负责人 |
| | | */ |
| | | @ApiModelProperty(value = "副planId") |
| | | @TableField("assistant_plan_id") |
| | | private Long assistantPlanId; |
| | | |
| | | /** |
| | | * 节点负责人 |
| | | */ |
| | | @ApiModelProperty(value = "主planId") |
| | | @TableField("host_plan_id") |
| | | private Long hostPlanId; |
| | | |
| | | /** |
| | | * 节点负责人 |
| | | */ |
| | | @ApiModelProperty(value = "主planId") |
| | | @TableField("assistant_host_sign") |
| | | private Integer assistantHostSign; |
| | | |
| | | public Plan() { |
| | | } |
| | | |
| | | public Plan(Plan plan) { |
| | | this.hostId = plan.getHostId(); |
| | | this.deptId = plan.getDeptId(); |
| | | this.planType = plan.getPlanType(); |
| | | this.userId = plan.getUserId(); |
| | | this.orderId = plan.getOrderId(); |
| | | this.cstmrId = plan.getCstmrId(); |
| | | this.name = plan.getName(); |
| | | this.planNeed = plan.getPlanNeed(); |
| | | this.beItem = plan.getBeItem(); |
| | | this.form = plan.getForm(); |
| | | this.finishTime = plan.getFinishTime(); |
| | | this.change = plan.getChange(); |
| | | this.changeTime = plan.getChangeTime(); |
| | | this.changeReason = plan.getChangeReason(); |
| | | this.planBonus = plan.getPlanBonus(); |
| | | this.planLeaderBonus = plan.getPlanLeaderBonus(); |
| | | this.files = plan.getFiles(); |
| | | this.comment = plan.getComment(); |
| | | this.memo = plan.getMemo(); |
| | | this.userXmlSelPhone = plan.getUserXmlSelPhone(); |
| | | } |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | |
| | | } |
| | | |
| | | public String getBeItem$(){ |
| | | if (null == this.beItem){ return null; } |
| | | if (null == this.beItem) { |
| | | return null; |
| | | } |
| | | switch (this.beItem){ |
| | | case 1: |
| | | return "是"; |
| | |
| | | } |
| | | |
| | | public String getChange$(){ |
| | | if (null == this.change){ return null; } |
| | | if (null == this.change) { |
| | | return null; |
| | | } |
| | | switch (this.change){ |
| | | case 1: |
| | | return "是"; |
| | |
| | | } |
| | | |
| | | public String getSettle$(){ |
| | | if (null == this.settle){ return null; } |
| | | if (null == this.settle) { |
| | | return null; |
| | | } |
| | | switch (this.settle){ |
| | | // case 1: |
| | | // return "等待组长审核"; |
| | |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | if (null == this.status) { |
| | | return null; |
| | | } |
| | | switch (this.status){ |
| | | case 2: |
| | | return "开始核价"; |
| | |
| | | |
| | | public PlanType() {} |
| | | |
| | | public PlanType(Long hostId,Integer type) { |
| | | this.hostId = hostId; |
| | | this.type = type; |
| | | } |
| | | |
| | | public PlanType(Long hostId,String name,String flag,String formId,String data,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | this.hostId = hostId; |
| | | this.name = name; |
| | |
| | | <result column="memo" property="memo" /> |
| | | <result column="user_xml_sel_phone" property="userXmlSelPhone" /> |
| | | <result column="director" property="director" /> |
| | | <result column="status2" property="status2" /> |
| | | <result column="assistant_plan_id" property="assistantPlanId" /> |
| | | <result column="host_plan_id" property="hostPlanId" /> |
| | | <result column="assistant_host_sign" property="assistantHostSign" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | skin: 'line', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | ,{field: 'id', align: 'center',title: 'ID'} |
| | | // ,{field: 'hostId$', align: 'center',title: '所属商户'} |
| | | ,{field: 'userId$', align: 'left',title: '业务员',hide: false, width: 100} |
| | | ,{field: 'planType$', align: 'left',title: '业务类型', width: 150,hide: false} |
| | |
| | | ,{field: 'updateBy$', align: 'left',title: '修改人', width: 100} |
| | | ,{field: 'updateTime$', align: 'left',title: '修改时间', hide: true} |
| | | ,{field: 'memo', align: 'left',title: '注释', hide: true} |
| | | |
| | | ,{field: 'assistantHostSign', align: 'left',title: '主副标记', hide: false} |
| | | ,{field: 'hostPlanId', align: 'left',title: '主ID', hide: false} |
| | | ,{field: 'assistantPlanId', align: 'left',title: '副ID', hide: false} |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 340} |
| | | ]], |
| | | request: { |
| | |
| | | approvalEnd(data.id); |
| | | }); |
| | | break; |
| | | case 'assistantPlan': |
| | | assistantPlan(data); |
| | | break; |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | |
| | | }); |
| | | } |
| | | |
| | | /* 新建 */ |
| | | function assistantPlan(data) { |
| | | layer.confirm('确定要新建货架规划审批吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/plan/assistantPlan/add/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | hostPlanId: data.id |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> |
| | | {{# } }} |
| | | {{# if (d.assistantHostSign == 0) { }} |
| | | <a class="layui-btn layui-btn-xs btn-edit" lay-event="assistantPlan">创建货架规划任务</a> |
| | | {{# } }} |
| | | |
| | | </script> |
| | | |
| | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm" lay-event="addBlank">新增核价</button> |
| | | <button class="layui-btn layui-btn-sm" lay-event="addBlank2">接取集成核价任务</button> |
| | | <!-- <button class="layui-btn layui-btn-sm" lay-event="addBlank2">接取集成核价任务</button>--> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="deleteData">删除</button> |
| | | </div> |
| | | </script> |