| | |
| | | import com.core.domain.KeyValueVo; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.entity.Item; |
| | | import com.zy.crm.manager.entity.Plan; |
| | | import com.zy.crm.manager.entity.PriOnline; |
| | | import com.zy.crm.manager.entity.PriSales; |
| | | import com.zy.crm.manager.service.ItemService; |
| | | import com.zy.crm.manager.service.PlanService; |
| | | import com.zy.crm.manager.service.PriOnlineService; |
| | | import com.zy.crm.manager.service.PriSalesService; |
| | | import org.apache.poi.xssf.usermodel.XSSFSheet; |
| | |
| | | private PriOnlineService priOnlineService; |
| | | |
| | | @Autowired |
| | | private ItemService itemService; |
| | | private PlanService planService; |
| | | |
| | | @RequestMapping(value = "/priSales/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/priSales/add/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "添加产品费用明细") |
| | | public R add(@RequestBody Map<String,Object> map) { |
| | | PriOnline priOnline = priOnlineService.selectById(Long.parseLong(map.get("priOnlineId").toString())); |
| | | |
| | |
| | | priSales.setUpdateUserId(getUserId()); |
| | | //更新时间 |
| | | priSales.setUpdateTime(new Date()); |
| | | priSales.setDeptId(getDeptId()); |
| | | |
| | | //业务员 |
| | | Item item = itemService.selectById(priSales.getItemId()); |
| | | priSales.setMemberId(item.getMember()); |
| | | Plan plan = planService.selectById(priSales.getItemId()); |
| | | priSales.setMemberId(plan.getUserId()); |
| | | |
| | | //设置项目流程 |
| | | item.setStep(3); |
| | | itemService.updateById(item); |
| | | plan.setStep(3); |
| | | planService.updateById(plan); |
| | | |
| | | priSalesService.insert(priSales); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/priSales/addOther/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "另存产品费用明细") |
| | | public R addOther(@RequestBody Map<String,Object> map) { |
| | | PriSales online = priSalesService.selectById(Long.parseLong(map.get("id").toString())); |
| | | |
| | |
| | | priSales.setUpdateTime(new Date()); |
| | | |
| | | //业务员 |
| | | Item item = itemService.selectById(priSales.getItemId()); |
| | | priSales.setMemberId(item.getMember()); |
| | | Plan plan = planService.selectById(priSales.getItemId()); |
| | | priSales.setMemberId(plan.getUserId()); |
| | | |
| | | priSalesService.insert(priSales); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/priSales/update/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "更新产品费用明细") |
| | | public R update(@RequestBody Map<String,Object> map){ |
| | | PriSales priSales = priSalesService.selectById(Long.parseLong(map.get("id").toString())); |
| | | priSales.setTitle(map.get("title").toString()); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/priSales/updateForm/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "更新产品费用明细模板名和标题") |
| | | public R updateForm(Long id,String templateName,String title){ |
| | | PriSales priSales = priSalesService.selectById(id); |
| | | priSales.setTemplateName(templateName); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/priSales/delete/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "删除产品费用明细") |
| | | public R delete(Long[] ids){ |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | |
| | | for (PriSales priSales : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", priSales.getId()); |
| | | map.put("value", priSales.getInOrderNum() + "/" + priSales.getItemId$() + "/" + priSales.getMemberId$()); |
| | | map.put("value", priSales.getInOrderNum() + "/" + priSales.getPlanId$() + "/" + priSales.getMemberId$()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |