springboot客户关系管理系统 CRM 记录一次开发过程
程序员文章站
2024-01-15 22:26:22
...
介绍
隔壁公司项目做不完 吧CRM外包给我们公司做 特此在此带领大家梳理客户关系管理系统从需求分析到落地的实现过程 做一次深入的软件开发分享
开发技术
springboot
mybatis
mysql
echarts
数据库设计
模块设计
这一块是创新点,用了echarts可视化技术,这块我带大家分析下源码
@RequestMapping(value = "/findMonthlyFunnel", method = RequestMethod.POST)
@ResponseBody
public List<Map> findMonthlyFunnel(@RequestBody QueryOpportunityVo vo) {
List<Integer> userIdList = new ArrayList<>();
userIdList.add(getUser().getUserId());
vo.setUserIdList(userIdList);
return opportunityService.findMonthlyFunnel(vo);
}
具体实现代码如下:
@RequestMapping(value = "/find", method = RequestMethod.POST)
@ResponseBody
public PageInfo<Opportunity> find(@RequestBody QueryOpportunityVo vo) {
List<Integer> subordinate = orgUnitService.findSubordinate(getUser().getUserId());
vo.setUserIdList(subordinate);
return opportunityService.find(vo);
}
@RequestMapping(value = "/findMonthlyConversion", method = RequestMethod.POST)
@ResponseBody
public List<Map> findMonthlyConversion(@RequestBody QueryOpportunityVo vo) {
List<Integer> userIdList = new ArrayList<>();
userIdList.add(getUser().getUserId());
vo.setUserIdList(userIdList);
return opportunityService.findMonthlyConversion(vo);
}
package com.powerteam.controller.crm;
import com.github.pagehelper.PageInfo;
import com.powerteam.controller.AuthorizedController;
import com.powerteam.model.crm.Customer;
import com.powerteam.model.crm.CustomerCategory;
import com.powerteam.model.crm.Industry;
import com.powerteam.model.crm.Source;
import com.powerteam.service.crm.CustomerService;
import com.powerteam.vo.Result;
import com.powerteam.vo.crm.QueryCustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
@RequestMapping("/customer")
public class CustomerController extends AuthorizedController {
@Autowired
private CustomerService customerService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String customer() {
return "crm/customer";
}
@RequestMapping(value = "/find", method = RequestMethod.POST)
@ResponseBody
public PageInfo<Customer> find(@RequestBody QueryCustomerVo vo) {
return customerService.find(vo);
}
@RequestMapping(value = "/findAllCustomerCategory", method = RequestMethod.POST)
@ResponseBody
public List<CustomerCategory> findAllCustomerCategory() {
return customerService.findAllCustomerCategory();
}
@RequestMapping(value = "/findAllIndustry", method = RequestMethod.POST)
@ResponseBody
public List<Industry> findAllIndustry() {
return customerService.findAllIndustry();
}
@RequestMapping(value = "/findAllSource", method = RequestMethod.POST)
@ResponseBody
public List<Source> findAllSource() {
return customerService.findAllSource();
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Customer customer) {
customer.setCreateBy(getUser().getUserId());
return customerService.insert(customer);
}
@RequestMapping(value = "/checkCustomerName", method = RequestMethod.POST)
@ResponseBody
public Result checkCustomerName(@RequestBody Customer customer) {
return customerService.checkCustomerName(customer);
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Customer findById(@RequestBody Customer customer) {
return customerService.findById(customer.getCustomerId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Customer customer) {
return customerService.update(customer);
}
@RequestMapping(value = "/dashboard/{customerId}", method = RequestMethod.GET)
public ModelAndView dashboard(@PathVariable int customerId) {
ModelAndView vm = new ModelAndView("crm/customerDashboard");
vm.addObject("customerId", customerId);
return vm;
}
@RequestMapping(value = "/updateStar", method = RequestMethod.POST)
@ResponseBody
public Result updateStar(@RequestBody Customer customer) {
return customerService.updateStar(customer);
}
@RequestMapping(value = "/updateLocation", method = RequestMethod.POST)
@ResponseBody
public Result updateLocation(@RequestBody Customer customer) {
return customerService.updateLocation(customer);
}
}
package com.powerteam.controller.sys;
import com.github.pagehelper.PageInfo;
import com.powerteam.controller.AuthorizedController;
import com.powerteam.model.sys.User;
import com.powerteam.service.sys.UserService;
import com.powerteam.vo.Result;
import com.powerteam.vo.sys.QueryUserVo;
import com.powerteam.vo.sys.UpdatePasswordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.List;
@Controller
@RequestMapping("/user")
public class UserController extends AuthorizedController {
@Autowired
private UserService userService;
@Autowired
private HttpSession session;
@RequestMapping(value = "", method = RequestMethod.GET)
public String index() {
return "sys/user";
}
@RequestMapping(value = "/find", method = RequestMethod.POST)
@ResponseBody
public PageInfo<User> find(@RequestBody QueryUserVo vo) {
return userService.find(vo);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody User user) {
return userService.insert(user);
}
@RequestMapping(value = "/remove", method = RequestMethod.POST)
@ResponseBody
public Result delete(@RequestBody List<Integer> ids) {
return userService.deleteByIds(ids);
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public User findById(@RequestBody User user) {
return userService.findById(user.getUserId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody User user) {
Result result = userService.update(user);
if (result.isSuccess() && user.getUserId() == getUser().getUserId()) {
session.setAttribute("User", userService.findById(getUser().getUserId()));
}
return result;
}
@RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
@ResponseBody
public Result updateStatus(@RequestBody User user) {
return userService.updateStatus(user);
}
@RequestMapping(value = "/checkUserName", method = RequestMethod.POST)
@ResponseBody
public Result checkUserName(@RequestBody User user) {
return userService.checkUserName(user);
}
@RequestMapping(value = "/resetPassword", method = RequestMethod.POST)
@ResponseBody
public Result resetPassword(@RequestBody User user) {
return userService.resetPassword(user);
}
@RequestMapping(value = "/profile", method = RequestMethod.GET)
public String profile() {
return "sys/profile";
}
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
@ResponseBody
public Result updatePassword(@RequestBody UpdatePasswordVo vo) {
return userService.updatePassword(vo);
}
}
package com.powerteam.controller.crm;
import com.powerteam.controller.AuthorizedController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class DailyReportController extends AuthorizedController {
@RequestMapping(value = "/dailyReport", method = RequestMethod.GET)
public String dailyReport() {
return "crm/dailyReport";
}
@RequestMapping(value = "/teamDailyReport", method = RequestMethod.GET)
public String teamDailyReport() {
return "crm/teamDailyReport";
}
}
多说一嘴
其实从上面也可以看出来,CRM系统挺好开发的,准备个powerdesigner绘制数据库表设计,然后搭建springboot开发框架进行业务实现,其实软件开发就是这么回事
运行视频
吊炸天springboot客户关系管理系统 CRM