| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package com.goafanti.customer.controller;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import javax.annotation.Resource;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import com.goafanti.common.bo.Error;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.BaseController;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.customer.bo.BusinessListBo;
- import com.goafanti.customer.bo.BussinessFollowBo;
- import com.goafanti.customer.service.BusinessService;
- @RestController
- @RequestMapping("api/admin/customer")
- public class BusinessApiController extends BaseController{
- @Resource
- private BusinessService businessService;
-
- /** 查询业务列表 **/
- @RequestMapping(value = "/listBusiness", method = RequestMethod.POST)
- public Result listBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
- Result res = new Result();
- res.setData(businessService.listBusiness(blo, pageNo, pageSize));
- return res;
- }
-
- /** 查询业务字典 **/
- @RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
- public Result findBusinessGlossory(){
- Result res = new Result();
- res.setData(businessService.findBusinessGlossory());
- return res;
- }
- /** 新增客户意向 **/
- @RequestMapping(value = "/addBusinessAndFollow", method = RequestMethod.POST)
- public Result addBusinessAndFollow(BussinessFollowBo bfb){
- Result res = new Result();
- if(StringUtils.isBlank(bfb.getBusinessGlossoryId()) || StringUtils.isBlank(bfb.getUid())){
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
- return res;
- }
- if(businessService.judgeBusiness(bfb.getUid(), Integer.parseInt(bfb.getBusinessGlossoryId()))>0){
- res.getError().add(new Error("该项业务已经被跟进"));
- return res;
- }
- try {
- businessService.addBusinessAndFollow(bfb);
- } catch (ParseException e) {
- e.printStackTrace();
- }
- return res;
- }
-
- /** 进入新增意向服务 **/
- @RequestMapping(value = "/toAddBusinessAndFollow", method = RequestMethod.GET)
- public Result toAddBusinessAndFollow(){
- Result res = new Result();
- BussinessFollowBo bo = new BussinessFollowBo();
- bo.setAdminName(TokenManager.getAdminToken().getName());
- SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
- bo.setCreateTime(format.format(new Date()));
- bo.setFollowTime(bo.getCreateTime());
- res.setData(bo);
- return res;
- }
-
- /** 进入修改业务意向 **/
- @RequestMapping(value = "/toUpdateBusiness", method = RequestMethod.GET)
- public Result toUpdateBusiness(String businessId){
- Result res = new Result();
- res.setData(businessService.findBusinessDetail(businessId));
- return res;
- }
-
- /** 修改业务意向 **/
- @RequestMapping(value = "/updateBusiness", method = RequestMethod.POST)
- public Result updateBusiness(BussinessFollowBo bfb){
- Result res = new Result();
- businessService.updateBusiness(bfb);
- return res;
- }
- }
|