|  |  |  | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.crm.common.web.BaseController; | 
|---|
|  |  |  | import com.zy.crm.manager.controller.result.FollowerTableVo; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.CstmrFoll; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.Order; | 
|---|
|  |  |  | import com.zy.crm.manager.entity.OrderFoll; | 
|---|
|  |  |  | import com.zy.crm.manager.service.OrderFollService; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam(required = false, value = "dept_id") Long deptId, | 
|---|
|  |  |  | @RequestParam(required = false, value = "user_id") Long userId){ | 
|---|
|  |  |  | @RequestParam(required = false, value = "user_id") Long userId, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | Integer status = null; | 
|---|
|  |  |  | if (param.get("status") != null) { | 
|---|
|  |  |  | status = Integer.parseInt(param.get("status").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(orderService.getPage(new Page<>(curr, limit) | 
|---|
|  |  |  | , getHostId() | 
|---|
|  |  |  | , deptId == null ? null : String.valueOf(deptId) | 
|---|
|  |  |  | , userId == null ? getUserId() : userId | 
|---|
|  |  |  | , condition) | 
|---|
|  |  |  | , condition | 
|---|
|  |  |  | , status) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", order.getId()); | 
|---|
|  |  |  | map.put("value", order.getId()); | 
|---|
|  |  |  | map.put("name", order.getName()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | 
|---|
|  |  |  | , getHostId() | 
|---|
|  |  |  | , role.judgeLeader() ? String.valueOf(user.getDeptId()) : null | 
|---|
|  |  |  | , user.getId() | 
|---|
|  |  |  | , condition); | 
|---|
|  |  |  | , condition | 
|---|
|  |  |  | , null); | 
|---|
|  |  |  | List<KeyValueVo> vos = new ArrayList<>(); | 
|---|
|  |  |  | page.getRecords().forEach(item -> vos.add(new KeyValueVo(item.getName(), item.getId()))); | 
|---|
|  |  |  | return R.ok().add(vos); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/order/followers/add/json") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public R cstmrFollowersAddJson(@RequestBody() Map map) { | 
|---|
|  |  |  | long cstmrId = Long.valueOf(String.valueOf(map.get("orderId"))); | 
|---|
|  |  |  | long followerIds = Long.valueOf(String.valueOf(map.get("followerIds"))); | 
|---|
|  |  |  | if (Cools.isEmpty(cstmrId, followerIds)) { | 
|---|
|  |  |  | return R.parse(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | OrderFoll orderFoll = new OrderFoll(); | 
|---|
|  |  |  | orderFoll.setOrderId(cstmrId); | 
|---|
|  |  |  | orderFoll.setUserId(followerIds); | 
|---|
|  |  |  | if (!orderFollService.insert(orderFoll)) { | 
|---|
|  |  |  | throw new CoolException("添加失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/order/followers/remove/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R orderFollowersRemove(@RequestParam("orderId") Long orderId, | 
|---|