基于javaweb+mysql的springboot销售团队后台管理系统(java+springboot+freemarker+bootstrap+echarts+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot销售团队后台管理系统(java+springboot+freemarker+bootstrap+echarts+mysql)
项目介绍
该项目为后管系统,主要功能包括:
看板、业务机会管理、客户管理、联系人管理、我的日报、团队日报、主数据管理:组织架构管理;系统管理:用户管理、角色管理、菜单管理等;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;
6.是否Maven项目:是;
技术栈
-
后端:SpringBoot+mybatis
-
前端:FreeMarker+Angular+bootstrap+echarts+jQuery
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
- 将项目中application-powerteam.yml配置文件中的数据库配置改为自己的配置; 4. 前台访问路径:http://localhost:8080/ 登录账号:admin 登录密码:admin
@Controller
@RequestMapping("/role")
public class RoleController extends AuthorizedController {
@Autowired
private RoleService roleService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String index() {
return "sys/role";
}
@RequestMapping(value = "/findAll", method = RequestMethod.POST)
@ResponseBody
public List<Role> findAll() {
return roleService.findAll();
}
@RequestMapping(value = "/checkRoleName", method = RequestMethod.POST)
@ResponseBody
public Result existRoleName(@RequestBody Role role) {
return roleService.checkRoleName(role);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Role role) {
return roleService.insert(role);
}
@RequestMapping(value = "/remove", method = RequestMethod.POST)
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);
}
dateStyle.setDataFormat(createHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss"));
cell.setCellStyle(dateStyle);
cell.setCellValue((Date) value);
}
} else if (fieldType == Integer.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Integer) value);
}
} else if (fieldType == Double.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Double) value);
}
} else if (fieldType == Float.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Float) value);
}
} else if (fieldType == Boolean.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Boolean) value);
}
} else if (fieldType == Byte.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Byte) value);
}
} else if (fieldType == Long.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Long) value);
}
} else if (fieldType == Short.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Short) value);
}
}
}
}
response.setContentType("application/vnd.ms-excel");
@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
@ResponseBody
public Result add(@RequestBody Menu menu) {
return menuService.insert(menu);
}
@RequestMapping(value = "/remove", method = RequestMethod.POST)
@ResponseBody
public Result remove(@RequestBody Menu menu) {
return menuService.delete(menu.getMenuId());
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Menu findById(@RequestBody Menu menu) {
return menuService.findById(menu.getMenuId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Menu menu) {
return menuService.update(menu);
}
@RequestMapping(value = "/up", method = RequestMethod.POST)
@ResponseBody
public Result up(@RequestBody Menu menu) {
return menuService.up(menu.getMenuId());
}
@RequestMapping(value = "/down", method = RequestMethod.POST)
@ResponseBody
public Result down(@RequestBody Menu menu) {
return menuService.down(menu.getMenuId());
}
}
}
@RequestMapping(value = "/findRoleMenu", method = RequestMethod.POST)
@ResponseBody
public List<Menu> findRoleMenu(@RequestBody Role role) {
return menuService.findRoleMenu(role.getRoleId());
}
@RequestMapping(value = "/checkMenuName", method = RequestMethod.POST)
@ResponseBody
public Result checkMenuName(@RequestBody Menu menu) {
return menuService.checkMenuName(menu);
}
@RequestMapping(value = "/checkMenuCode", method = RequestMethod.POST)
@ResponseBody
public Result checkMenuCode(@RequestBody Menu menu) {
return menuService.checkMenuCode(menu);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Menu menu) {
return menuService.insert(menu);
}
@RequestMapping(value = "/remove", method = RequestMethod.POST)
@ResponseBody
public Result remove(@RequestBody Menu menu) {
return menuService.delete(menu.getMenuId());
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Menu findById(@RequestBody Menu menu) {
return menuService.findById(menu.getMenuId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Menu menu) {
return menuService.update(menu);
}
public PageInfo<User> findUserInRole(@RequestBody QueryRoleUserVo vo) {
return roleService.findUserInRole(vo);
}
@RequestMapping(value = "/user/remove", method = RequestMethod.POST)
@ResponseBody
public Result deleteRoleUser(@RequestBody RoleUser roleUser) {
return roleService.deleteRoleUser(roleUser);
}
@RequestMapping(value = "/user/findUserNotInRole", method = RequestMethod.POST)
@ResponseBody
public PageInfo<User> findUserNotInRole(@RequestBody QueryRoleUserVo vo) {
return roleService.findUserNotInRole(vo);
}
@RequestMapping(value = "/user/add", method = RequestMethod.POST)
@ResponseBody
public Result addRoleUser(@RequestBody RoleUser roleUser) {
return roleService.insertRoleUser(roleUser);
}
@RequestMapping(value = "/menu/{roleId}", method = RequestMethod.GET)
public ModelAndView roleMenu(@PathVariable Integer roleId) {
ModelAndView mv = new ModelAndView("sys/roleMenu");
mv.addObject("roleId", roleId);
return mv;
}
@RequestMapping(value = "/menu/saveMenu", method = RequestMethod.POST)
@ResponseBody
public Result saveMenu(@RequestBody Map map) {
return roleService.saveRoleMenu((Integer) map.get("roleId"), (List<Integer>) map.get("menuIdList"));
}
@RequestMapping(value = "/fun/{roleId}", method = RequestMethod.GET)
public ModelAndView roleFun(@PathVariable int roleId) {
ModelAndView vm = new ModelAndView("sys/roleFun");
vm.addObject("roleId", roleId);
return vm;
}
}
@Controller
@RequestMapping("/orgUnit")
public class OrgUnitController extends AuthorizedController {
@Autowired
private OrgUnitService orgUnitService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String index() {
return "masterData/orgUnit";
}
@RequestMapping(value = "/findAllOrgUnit", method = RequestMethod.POST)
@ResponseBody
public List<OrgUnit> findAllOrgUnit() {
return orgUnitService.findAllOrgUnit();
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody OrgUnit orgUnit) {
return orgUnitService.insert(orgUnit);
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody OrgUnit orgUnit) {
return orgUnitService.update(orgUnit);
}
}
@Controller
@RequestMapping("/role")
public class RoleController extends AuthorizedController {
@Autowired
private RoleService roleService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String index() {
return "sys/role";
}
@RequestMapping(value = "/findAll", method = RequestMethod.POST)
@ResponseBody
public List<Role> findAll() {
return roleService.findAll();
}
@RequestMapping(value = "/checkRoleName", method = RequestMethod.POST)
@ResponseBody
public Result existRoleName(@RequestBody Role role) {
return roleService.checkRoleName(role);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Role role) {
return roleService.insert(role);
}
@Controller
@RequestMapping("/opportunity")
public class OpportunityController extends AuthorizedController {
@Autowired
private OpportunityService opportunityService;
@Autowired
private OrgUnitService orgUnitService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String customer() {
return "crm/opportunity";
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Opportunity opportunity) {
opportunity.setCreateBy(getUser().getUserId());
return opportunityService.insert(opportunity);
}
@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 = "/detail/{opportunityId}", method = RequestMethod.GET)
public ModelAndView detail(@PathVariable int opportunityId) {
ModelAndView vm = new ModelAndView("crm/opportunityDetail");
vm.addObject("opportunityId", opportunityId);
return vm;
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Opportunity findById(@RequestBody Opportunity opportunity) {
return opportunityService.findById(opportunity.getOpportunityId());
public Result saveMenu(@RequestBody Map map) {
return funService.saveRoleFun((Integer) map.get("roleId"), (List<Integer>) map.get("funIdList"));
}
}
@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";
}
}
@Controller
@RequestMapping("/dashboard")
public class DashboardController extends AuthorizedController {
@RequestMapping(value = "", method = RequestMethod.GET)
public String dashboard() {
return "sys/dashboard";
}
}
return menuService.findRoleMenu(role.getRoleId());
}
@RequestMapping(value = "/checkMenuName", method = RequestMethod.POST)
@ResponseBody
public Result checkMenuName(@RequestBody Menu menu) {
return menuService.checkMenuName(menu);
}
@RequestMapping(value = "/checkMenuCode", method = RequestMethod.POST)
@ResponseBody
public Result checkMenuCode(@RequestBody Menu menu) {
return menuService.checkMenuCode(menu);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Menu menu) {
return menuService.insert(menu);
}
@RequestMapping(value = "/remove", method = RequestMethod.POST)
@ResponseBody
public Result remove(@RequestBody Menu menu) {
return menuService.delete(menu.getMenuId());
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Menu findById(@RequestBody Menu menu) {
return menuService.findById(menu.getMenuId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Menu menu) {
return menuService.update(menu);
}
@RequestMapping(value = "/up", method = RequestMethod.POST)
@ResponseBody
public Result up(@RequestBody Menu menu) {
return menuService.up(menu.getMenuId());
}
@RequestMapping(value = "/down", method = RequestMethod.POST)
@ResponseBody
public Result down(@RequestBody Menu menu) {
return menuService.down(menu.getMenuId());
}
}
}
} else if (fieldType == Long.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Long) value);
}
} else if (fieldType == Short.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Short) value);
}
}
}
}
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
workbook.write(response.getOutputStream());
response.flushBuffer();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
for (int j = 0; j < fields.size(); j++) {
HSSFCell cell = row.createCell(j);
Field field = fields.get(j);
Class<?> fieldType = field.getType();
if (fieldType == String.class) {
cell.setCellValue(field.get(item).toString());
} else if (fieldType == int.class) {
cell.setCellValue(field.getInt(item));
} else if (fieldType == double.class) {
cell.setCellValue(field.getDouble(item));
} else if (fieldType == float.class) {
cell.setCellValue(field.getFloat(item));
} else if (fieldType == boolean.class) {
cell.setCellValue(field.getBoolean(item));
} else if (fieldType == byte.class) {
cell.setCellValue(field.getByte(item));
} else if (fieldType == long.class) {
cell.setCellValue(field.getLong(item));
} else if (fieldType == short.class) {
cell.setCellValue(field.getShort(item));
} else if (fieldType == char.class) {
cell.setCellValue(field.getChar(item));
} else if (fieldType == Date.class) {
Object value = field.get(item);
if (value != null) {
CellStyle dateStyle = workbook.createCellStyle();
CreationHelper createHelper = workbook.getCreationHelper();
dateStyle.setDataFormat(createHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss"));
cell.setCellStyle(dateStyle);
cell.setCellValue((Date) value);
}
} else if (fieldType == Integer.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Integer) value);
}
} else if (fieldType == Double.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Double) value);
}
} else if (fieldType == Float.class) {
Object value = field.get(item);
if (value != null) {
cell.setCellValue((Float) value);
}
} else if (fieldType == Boolean.class) {
Object value = field.get(item);
return contactsService.find(vo);
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Contacts findById(@RequestBody Contacts contacts) {
return contactsService.findById(contacts.getContactsId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Contacts contacts) {
return contactsService.update(contacts);
}
}
@Controller
public class HomeController {
@Autowired
private HttpSession session;
@Autowired
private UserService userService;
@Autowired
private PowerTeamConfig powerTeamConfig;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String signIn() {
return "sys/home";
}
@RequestMapping(value = "/signIn", method = RequestMethod.POST)
return roleService.deleteRoleUser(roleUser);
}
@RequestMapping(value = "/user/findUserNotInRole", method = RequestMethod.POST)
@ResponseBody
public PageInfo<User> findUserNotInRole(@RequestBody QueryRoleUserVo vo) {
return roleService.findUserNotInRole(vo);
}
@RequestMapping(value = "/user/add", method = RequestMethod.POST)
@ResponseBody
public Result addRoleUser(@RequestBody RoleUser roleUser) {
return roleService.insertRoleUser(roleUser);
}
@RequestMapping(value = "/menu/{roleId}", method = RequestMethod.GET)
public ModelAndView roleMenu(@PathVariable Integer roleId) {
ModelAndView mv = new ModelAndView("sys/roleMenu");
mv.addObject("roleId", roleId);
return mv;
}
@RequestMapping(value = "/menu/saveMenu", method = RequestMethod.POST)
@ResponseBody
public Result saveMenu(@RequestBody Map map) {
return roleService.saveRoleMenu((Integer) map.get("roleId"), (List<Integer>) map.get("menuIdList"));
}
@RequestMapping(value = "/fun/{roleId}", method = RequestMethod.GET)
public ModelAndView roleFun(@PathVariable int roleId) {
ModelAndView vm = new ModelAndView("sys/roleFun");
vm.addObject("roleId", roleId);
return vm;
}
}
public String customer() {
return "crm/opportunity";
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Result add(@RequestBody Opportunity opportunity) {
opportunity.setCreateBy(getUser().getUserId());
return opportunityService.insert(opportunity);
}
@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 = "/detail/{opportunityId}", method = RequestMethod.GET)
public ModelAndView detail(@PathVariable int opportunityId) {
ModelAndView vm = new ModelAndView("crm/opportunityDetail");
vm.addObject("opportunityId", opportunityId);
return vm;
}
@RequestMapping(value = "/findById", method = RequestMethod.POST)
@ResponseBody
public Opportunity findById(@RequestBody Opportunity opportunity) {
return opportunityService.findById(opportunity.getOpportunityId());
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(@RequestBody Opportunity opportunity) {
return opportunityService.update(opportunity);
}
@RequestMapping(value = "/addContactsRole", method = RequestMethod.POST)
@ResponseBody
public Result addContactsRole(@RequestBody ContactsRole contactsRole) {
return opportunityService.insertContactsRole(contactsRole);
}
@RequestMapping(value = "/updateContactsRole", method = RequestMethod.POST)
@ResponseBody
public Result updateContactsRole(@RequestBody ContactsRole contactsRole) {
return opportunityService.updateContactsRole(contactsRole);
}
@RequestMapping(value = "/removeContactsRole", method = RequestMethod.POST)
@ResponseBody