中扬CRM客户关系管理系统
LSH
2023-09-09 0c496c28edcfc87f4431a32f76a0569c1d939d72
src/main/java/com/zy/crm/manager/controller/OrderController.java
@@ -12,6 +12,7 @@
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;
@@ -52,12 +53,18 @@
                  @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)
        );
    }
@@ -77,7 +84,7 @@
        order.setCreateTime(new Date());
        order.setUpdateBy(getUserId());
        order.setUpdateTime(new Date());
        order.setStatus(1);
        order.setStatus(0);
        order.setStep(1);
        orderService.insert(order);
@@ -116,6 +123,7 @@
            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);
@@ -165,7 +173,8 @@
                , getHostId()
                , role.judgeLeader() ? String.valueOf(user.getDeptId()) : null
                , user.getId()
                , condition);
                , condition
                , 0);
        List<KeyValueVo> vos = new ArrayList<>();
        page.getRecords().forEach(item -> vos.add(new KeyValueVo(item.getName(), item.getId())));
        return R.ok().add(vos);
@@ -257,6 +266,24 @@
        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,