xinyb
2024-09-10 513b8e930844d01da9f74289771de1c1e1e15808
src/com/yc/crm/clues/action/CluesController.java
@@ -4,6 +4,7 @@
import com.yc.crm.clues.entity.AssignCluesEntity;
import com.yc.crm.clues.entity.CluesRequestEntity;
import com.yc.crm.clues.entity.T481101Entity;
import com.yc.crm.clues.entity.T481104Entity;
import com.yc.crm.clues.service.CluesServiceIfc;
import com.yc.exception.CallBackMessage;
import com.yc.multiData.SpObserver;
@@ -42,6 +43,91 @@
        }
    }
    /**
     * 改变线索状态
     * @param request
     * @return
     */
    @RequestMapping("/changeStatus.do")
    public @ResponseBody Object changeStatus(@RequestBody T481104Entity entity, HttpServletRequest request){
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
            entity.setOwnerCode(request.getSession().getAttribute(SessionKey.USERCODE)+"");
            cluesServiceIfc.changeStatus(entity);
            callBackMessage.sendSuccessMessageByDefault();
            return callBackMessage.toJSONObject();
        }catch (Exception e){
            callBackMessage.sendErrorMessage(this.getErrorMsg(e));
            return callBackMessage.toJSONObject();
        }finally {
            SpObserver.setDBtoInstance();
        }
    }
    /**
     * 关注线索
     * @param request
     * @return
     */
    @RequestMapping("/attention.do")
    public @ResponseBody Object attention(@RequestBody CluesRequestEntity cluesRequest, HttpServletRequest request){
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
            cluesRequest.setCreateUsercode(request.getSession().getAttribute(SessionKey.USERCODE)+"");//指定更新当前用户
            cluesServiceIfc.attention(cluesRequest);
            callBackMessage.sendSuccessMessageByDefault();
            return callBackMessage.toJSONObject();
        }catch (Exception e){
            callBackMessage.sendErrorMessage(this.getErrorMsg(e));
            return callBackMessage.toJSONObject();
        }finally {
            SpObserver.setDBtoInstance();
        }
    }
    /**
     * 删除联系人
     *
     * @param request
     * @return
     */
    @RequestMapping("/contact/del.do")
    public @ResponseBody Object scheduleDel(Integer id, HttpServletRequest request) {
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
            cluesServiceIfc.contactDel(id);
            callBackMessage.sendSuccessMessageByDefault();
            return callBackMessage.toJSONObject();
        } catch (Exception e) {
            callBackMessage.sendErrorMessage(this.getErrorMsg(e));
            return callBackMessage.toJSONObject();
        } finally {
            SpObserver.setDBtoInstance();
        }
    }
    /**
     * 获取线索
     * @param request
     * @return
     */
    @RequestMapping("/get.do")
    public @ResponseBody Object get(@RequestBody CluesRequestEntity cluesRequest, HttpServletRequest request){
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
            cluesRequest.setDbid(request.getSession().getAttribute(SessionKey.DATA_BASE_ID)+"");
            cluesRequest.setFormId(481101);
            callBackMessage.setInfo(cluesServiceIfc.get(cluesRequest));
            callBackMessage.sendSuccessMessageByDefault();
            return callBackMessage.toJSONObject();
        }catch (Exception e){
            callBackMessage.sendErrorMessage(this.getErrorMsg(e));
            return callBackMessage.toJSONObject();
        }finally {
            SpObserver.setDBtoInstance();
        }
    }
    /**
     * 线索列表
     * @param request
     * @return
@@ -51,6 +137,8 @@
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID));
            cluesRequest.setDbid(request.getSession().getAttribute(SessionKey.DATA_BASE_ID)+"");
            cluesRequest.setFormId(481101);
            callBackMessage.setInfo(cluesServiceIfc.getAllClues(cluesRequest));
            callBackMessage.sendSuccessMessageByDefault();
            return callBackMessage.toJSONObject();
@@ -77,6 +165,7 @@
            clues.setCompanyname(request.getSession().getAttribute(SessionKey.COMPANY_NAME)+"");
            clues.setCreateUsercode(request.getSession().getAttribute(SessionKey.USERCODE)+"");
            clues.setCreateUserName(request.getSession().getAttribute(SessionKey.USERNAME)+"");
            clues.setFormId(481101);
                cluesServiceIfc.save(clues);
            callBackMessage.sendSuccessMessageByDefault();
            return callBackMessage.toJSONObject();