| | |
| | | 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.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.entity.*; |
| | | import com.zy.crm.manager.service.ItemService; |
| | | import com.zy.crm.manager.service.PlanService; |
| | | import com.zy.crm.manager.service.PriQuoteBudgetService; |
| | | import com.zy.crm.manager.service.PriQuoteService; |
| | | 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; |
| | |
| | | @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") |
| | |
| | | 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()); // 获取部门领导 |
| | | priQuote.setSettleMsg(JSON.toJSONString(SettleDto.init(plan, manager))); |
| | | |
| | | 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(); |