Java+Springboot+H-ui实现营销管理系统

@RequestMapping(value = “/delbusiness” , method = RequestMethod.GET)

public Map<String,Object> delBusinesss(@RequestParam(“business_id”) String business_id) {

Map<String, Object> map = new HashMap<String, Object>();

String result = businessService.delBusiness(Integer.parseInt(business_id));

map.put(“msg”,result);

return map;

}

@RequestMapping(value = “/querybusiness” , method = RequestMethod.POST)

public Map<String,Object> queryBusinesss(@RequestParam(“business_name”) String business_name,

@RequestParam(“business_state”) String business_state,

@RequestParam(“person”) String person) {

Map<String, Object> map = new HashMap<String, Object>();

List business = businessService.queryBusiness(business_name,business_state,person);

map.put(“business”,business);

return map;

}

@RequestMapping(value = “/selectbusiness” , method = RequestMethod.POST)

public Map<String,Object> selectBusiness(@RequestParam(“business_id”) String business_id) {

Map<String, Object> map = new HashMap<String, Object>();

Business business = businessService.selectBusiness(Integer.parseInt(business_id));

map.put(“business”,business);

return map;

}

@RequestMapping(value = “/updatebusiness” , method = RequestMethod.POST)

public Map<String,Object> updateBusiness(@RequestBody Business business) {

Map<String, Object> map = new HashMap<String, Object>();

boolean result = businessService.updateBusiness(business);

map.put(“success”,result);

return map;

}

}

ClueController


package com.example.cra.controller;

import com.example.cra.entity.Clue;

import com.example.cra.service.ClueService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

@RestController

@RequestMapping(“/clue”)

public class ClueController {

@Autowired

private ClueService clueService;

@RequestMapping(value = “/addclue” , method = RequestMethod.POST)

public Map<String,Object> addClue(@RequestBody Clue clue) {

Map<String, Object> map = new HashMap<String, Object>();

String result = clueService.addClue(clue);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/clueList” , method = RequestMethod.GET)

public Map<String,Object> clueList() {

Map<String, Object> map = new HashMap<String, Object>();

List clue = clueService.clueList();

map.put(“clue”,clue);

return map;

}

@RequestMapping(value = “/delclue” , method = RequestMethod.GET)

public Map<String,Object> delClues(@RequestParam(“clue_id”) String clue_id) {

Map<String, Object> map = new HashMap<String, Object>();

String result = clueService.delClue(Integer.parseInt(clue_id));

map.put(“msg”,result);

return map;

}

@RequestMapping(value = “/queryclue” , method = RequestMethod.POST)

public Map<String,Object> queryClues(@RequestParam(“clue_name”) String clue_name,

@RequestParam(“person”) String person) {

Map<String, Object> map = new HashMap<String, Object>();

List clue = clueService.queryClue(clue_name,person);

map.put(“clue”,clue);

return map;

}

@RequestMapping(value = “/selectclue” , method = RequestMethod.POST)

public Map<String,Object> selectClue(@RequestParam(“clue_id”) String clue_id) {

Map<String, Object> map = new HashMap<String, Object>();

Clue clue = clueService.selectClue(Integer.parseInt(clue_id));

map.put(“clue”,clue);

return map;

}

@RequestMapping(value = “/updateclue” , method = RequestMethod.POST)

public Map<String,Object> updateClue(@RequestBody Clue clue) {

Map<String, Object> map = new HashMap<String, Object>();

boolean result = clueService.updateClue(clue);

map.put(“success”,result);

return map;

}

}

ContactController


package com.example.cra.controller;

import com.example.cra.entity.Contact;

import com.example.cra.service.ContactService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

@RestController

@RequestMapping(“/contacts”)

public class ContactController {

@Autowired

private ContactService contactService;

@RequestMapping(value = “/addcontacts” , method = RequestMethod.POST)

public Map<String,Object> addContact(@RequestBody Contact contact) {

Map<String, Object> map = new HashMap<String, Object>();

String result = contactService.addContact(contact);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/contactsList” , method = RequestMethod.GET)

public Map<String,Object> contactList() {

Map<String, Object> map = new HashMap<String, Object>();

List contact = contactService.contactList();

map.put(“contact”,contact);

return map;

}

@RequestMapping(value = “/delcontacts” , method = RequestMethod.GET)

public Map<String,Object> delContacts(@RequestParam(“cont_id”) String contacts_id) {

Map<String, Object> map = new HashMap<String, Object>();

String result = contactService.delContact(Integer.parseInt(contacts_id));

map.put(“msg”,result);

return map;

}

@RequestMapping(value = “/querycontacts” , method = RequestMethod.POST)

public Map<String,Object> queryContacts(@RequestParam(“customer_name”) String customer_name,

@RequestParam(“telephone”) String telephone,

@RequestParam(“contacts_name”) String contacts_name) {

Map<String, Object> map = new HashMap<String, Object>();

List contact = contactService.queryContact(customer_name,telephone,contacts_name);

map.put(“contact”,contact);

return map;

}

@RequestMapping(value = “/selectcontacts” , method = RequestMethod.POST)

public Map<String,Object> selectContact(@RequestParam(“cont_id”) String contacts_id) {

Map<String, Object> map = new HashMap<String, Object>();

Contact contact = contactService.selectContact(Integer.parseInt(contacts_id));

map.put(“contact”,contact);

return map;

}

@RequestMapping(value = “/updatecontacts” , method = RequestMethod.POST)

public Map<String,Object> updateContact(@RequestBody Contact contact) {

Map<String, Object> map = new HashMap<String, Object>();

boolean result = contactService.updateContact(contact);

map.put(“success”,result);

return map;

}

}

CustomerController


package com.example.cra.controller;

import com.example.cra.entity.Customer;

import com.example.cra.service.CustomerService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

@RestController

@RequestMapping(“/customers”)

public class CustomerController {

@Autowired

private CustomerService customerService;

@RequestMapping(value = “/listCustomers” , method = RequestMethod.GET)

public Map<String,Object> listCustomers() {

Map<String, Object> map = new HashMap<String, Object>();

List customers = customerService.getAllCustomers();

map.put(“customers”, customers);

return map;

}

@RequestMapping(value = “/querycustomers” , method = RequestMethod.POST)

public Map<String,Object> queryCustomer(@RequestParam(“customer_name”) String customer_name,

@RequestParam(“person”) String person,

@RequestParam(“customer_state”) String customer_state) {

Map<String, Object> map = new HashMap<String, Object>();

List customer = customerService.queryCustomer(customer_name,person,customer_state);

map.put(“customer”, customer);

return map;

}

@RequestMapping(value = “/addcustomer” , method = RequestMethod.POST)

public Map<String,Object> addCustomer(@RequestBody Customer customer) {

Map<String, Object> map = new HashMap<String, Object>();

String result = customerService.insertCustomer(customer);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/updatecustomer” , method = RequestMethod.POST)

public Map<String,Object> updateCustomer(@RequestBody Customer customer) {

Map<String, Object> map = new HashMap<String, Object>();

String result = customerService.updateCustomer(customer);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/deletecustomer” , method = RequestMethod.POST)

public Map<String,Object> deleteCustomer(@RequestParam(“customer_id”) Integer customer_id) {

Map<String, Object> map = new HashMap<String, Object>();

String result = customerService.deleteCustomer(customer_id);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/getcustomer” , method = RequestMethod.POST)

public Map<String,Object> getCustomer(@RequestParam(“customer_id”) Integer customer_id) {

Map<String, Object> map = new HashMap<String, Object>();

Customer customer = customerService.getCustomer(customer_id);

map.put(“customer”, customer);

return map;

}

}

FrontendController


package com.example.cra.controller;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;

@Controller

@RequestMapping(“/front”)

public class FrontendController {

@RequestMapping(value = “/index”, method = RequestMethod.GET)

public String login() {

return “index”;

}

@RequestMapping(value = “/home”, method = RequestMethod.GET)

public String index() {

return “home”;

}

@RequestMapping(value = “/user-add”, method = RequestMethod.GET)

public String userAdd() {

return “user-add”;

}

@RequestMapping(value = “/user-list”, method = RequestMethod.GET)

public String userList() {

return “user-list”;

}

@RequestMapping(value = “/user-update”, method = RequestMethod.GET)

public String userUpdate() {

return “user-update”;

}

@RequestMapping(value = “/contact-add”, method = RequestMethod.GET)

public String contactAdd() {

return “contact-add”;

}

@RequestMapping(value = “/contact-list”, method = RequestMethod.GET)

public String contactList() {

return “contact-list”;

}

@RequestMapping(value = “/contact-update”, method = RequestMethod.GET)

public String contactUpdate() {

return “contact-update”;

}

@RequestMapping(value = “/customer-add”, method = RequestMethod.GET)

public String customerAdd() {

return “customer-add”;

}

@RequestMapping(value = “/customer-list”, method = RequestMethod.GET)

public String customerList() {

return “customer-list”;

}

@RequestMapping(value = “/customer-update”, method = RequestMethod.GET)

public String customerUpdate() {

return “customer-update”;

}

@RequestMapping(value = “/clue-add”, method = RequestMethod.GET)

public String bookinfoAdd() {

return “clue-add”;

}

@RequestMapping(value = “/clue-list”, method = RequestMethod.GET)

public String bookinfoList() {

return “clue-list”;

}

@RequestMapping(value = “/clue-update”, method = RequestMethod.GET)

public String bookinfoUpdate() {

return “clue-update”;

}

@RequestMapping(value = “/business-add”, method = RequestMethod.GET)

public String logAdd() {

return “business-add”;

}

@RequestMapping(value = “/business-list”, method = RequestMethod.GET)

public String logList() {

return “business-list”;

}

@RequestMapping(value = “/business-update”, method = RequestMethod.GET)

public String logUpdate() {

return “business-update”;

}

}

UserController


package com.example.cra.controller;

import com.example.cra.entity.User;

import com.example.cra.service.UserService;

import com.example.cra.util.SelectUsers;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

import java.text.ParseException;

import java.util.*;

@RestController

@RequestMapping(“/users”)

public class UserController {

@Autowired

private UserService usersService;

//登录

@RequestMapping(value = “/login”, method = RequestMethod.POST)

public Map<String, Object> login(@RequestParam(“username”) String username,

@RequestParam(“password”) String password, HttpServletRequest request) {

Map<String, Object> map = new HashMap<String, Object>();

User result = usersService.login(username, password);

if (result != null) {

request.getSession().setAttribute(“username”, username);

map.put(“success”, true);

map.put(“msg”, “登陆成功!”);

} else {

map.put(“success”, false);

map.put(“msg”, “登陆失败!”);

}

return map;

}

//系统管理员创建用户信息,默认角色为销售

@RequestMapping(value = “/addUsers”, method = RequestMethod.POST)

public Map<String, Object> addUsers(@RequestBody User user) throws ParseException {

Map<String, Object> map = new HashMap<String, Object>();

String result = usersService.createUsers(user);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/selectUsers”, method = RequestMethod.POST)

public Map<String, Object> selectUsers(@RequestParam(“select_username”) String username,

@RequestParam(“select_sex”) String sex,

@RequestParam(“select_role”) String role,

@RequestParam(“select_status”) String select_status) throws ParseException {

Map<String, Object> map = new HashMap<String, Object>();

SelectUsers selectUsers = new SelectUsers();

selectUsers.setUsername(username);

selectUsers.setSex(sex);

selectUsers.setSelect_role(role);

selectUsers.setSelect_status(select_status);

List users = usersService.selectUsers(selectUsers);

map.put(“users”, users);

return map;

}

//修改用户角色

@RequestMapping(value = “/editUsers”, method = RequestMethod.POST)

public Map<String, Object> editUsers(@RequestBody User user) {

Map<String, Object> map = new HashMap<String, Object>();

String result = usersService.updateUser(user);

map.put(“msg”, result);

return map;

}

//系统管理员对系统所有用户进行删除

@RequestMapping(value = “/delUsers”, method = RequestMethod.GET)

public Map<String, Object> delUsers(@RequestParam(“user_id”) String user_id) {

Map<String, Object> map = new HashMap<String, Object>();

String result = usersService.delUsers(user_id);

map.put(“msg”, result);

return map;

}

//系统管理员对系统所有用户进行查看

@RequestMapping(value = “/listUsers”, method = RequestMethod.GET)

public Map<String, Object> listUsers() {

Map<String, Object> map = new HashMap<String, Object>();

List users = new ArrayList();

users = usersService.listUsers();

map.put(“users”, users);

return map;

}

//获取session

@RequestMapping(value = “/session”, method = RequestMethod.POST)

public Map<String, Object> session(HttpServletRequest request) {

Map<String, Object> map = new HashMap<String, Object>();

map.put(“session”, request.getSession().getAttribute(“username”));

return map;

}

//通过用户名获取用户id

@RequestMapping(value = “/getUserId”, method = RequestMethod.GET)

public Map<String, Integer> getUserId(@RequestParam(“username”) String username) {

Map<String, Integer> map = new HashMap<String, Integer>();

Integer user_id = usersService.findUserIdByUserName(username);

map.put(“user_id”, user_id);

System.out.println(user_id);

return map;

}

//检测用户名

@RequestMapping(value = “/checkname”, method = RequestMethod.POST)

public Map<String, Object> checkname(@RequestParam(“username”) String username) {

Map<String, Object> map = new HashMap<String, Object>();

String result = usersService.checkname(username);

map.put(“msg”, result);

return map;

}

@RequestMapping(value = “/selectuser”, method = RequestMethod.POST)

public Map<String, Object> selectuser(@RequestParam(“userid”) String user_id) {

Map<String, Object> map = new HashMap<String, Object>();

User result = usersService.queryuser(Integer.parseInt(user_id));

map.put(“users”, result);

return map;

}

@RequestMapping(value = “/updateuser”, method = RequestMethod.POST)

public Map<String, Object> updateUser(@RequestBody User user) throws ParseException {

Map<String, Object> map = new HashMap<String, Object>();

String result = usersService.updateUser(user);

map.put(“success”,result);

return map;

}

}

business-add.js


$(function () {

//刷新页面

$(‘#reload_btn’).click(function(){

$(‘#business_name’).val(‘’);

$(“#customer_name”).val(‘’);

$(‘#contacts’).val(‘’);

$(‘#amount’).val(‘’);

$(‘#date’).val(‘’);

$(‘#business_state’).val(‘’);

$(‘#create_time’).val(‘’);

$(‘#person’).val(‘’);

$(‘#remark’).val(‘’);

window.location.reload();

});

// 新增用户

$(‘#submit_btn’).click(function () {

var business_name = $(‘#business_name’).val();

var customer_name = $(“#customer_name”).val();

var contacts = $(‘#contacts’).val();

var amount = $(‘#amount’).val();

var date = $(‘#date’).val();

var business_state = $(‘#business_state’).val();

var create_time = $(‘#create_time’).val();

var person = $(‘#person’).val();

var remark = $(‘#remark’).val();

var param = {

“business_name”: business_name,

“customer_name”: customer_name,

“contacts”:contacts,

“amount”:amount,

“date”:date,

“business_state”:business_state,

“create_time”:create_time,

“person”: person,

“remark”: remark

};

$.ajax({

url: “/business/addbusiness”,

async: false,

cache: false,

type: “post”,

dataType: ‘json’,

// 格式化发送的数据

contentType: ‘application/json’,

data: JSON.stringify(param),

success: function (data) {

alert(data.msg);

window.location.reload();

}

});

})

});

business-list.js


$(function () {

getBusinessList();

// 获取所有商机信息

function getBusinessList(e) {

$.ajax({

url: “/business/businessList”,

type: “get”,

dataType: “json”,

success: function (data) {

businessList(data.business);

}

});

}

// 查询商机信息

$(“#queryBusiness”).click(function () {

var business_name = $(“#query_business_name”).val();

var business_state = $(“#query_business_state”).val();

var person = $(“#query_bussiness_person”).val();

$.ajax({

url: “/business/querybusiness”,

async: false,

cache: false,

type: “post”,

dataType: ‘json’,

data: {

“business_name”: business_name,

“business_state”: business_state,

“person”: person

},

success: function (data) {

businessList(data.business);

}

});

});

// 展示商机信息

function businessList(data) {

var html = ‘’;

if(data.length > 0){

data.map(function (item) {

html += ‘’

  • ‘’ + item.business_id + ‘’

  • ‘’ + item.business_name + ‘’

  • ‘’ + item.customer_name + ‘’

  • ‘’ + item.contacts + ‘’

  • ‘’ + item.amount + ‘’

  • ‘’ + item.date.substring(0, 10) + ‘’

  • ‘’ + item.business_state + ‘’

  • ‘’ + item.create_time.substring(0, 10) + ‘’

  • ‘’ + item.person + ‘’

  • ‘’ + item.remark + ‘’

  • ‘’

  • '修改  ’

  • 删除

  • ‘’

})

}

$(‘#business_list’).html(html);

}

// 监听修改商机信息

$(‘body’).on(‘click’, ‘#edit’, function (e) {

var business_id = e.target.dataset.id;

window.location.href = “/front/business-update?business_id=” + business_id;

})

// 监听删除商机信息

$(‘body’).on(‘click’, ‘#del’, function (e) {

var del_business_id = e.target.dataset.id;

$.ajax({

url: “/business/delbusiness”,

async: false,

cache: false,

type: “get”,

dataType: ‘json’,

data: {

“business_id”: del_business_id

},

success: function (data) {

alert(data.msg);

window.location.href = “/front/business-list”;

}

});

})

});

business-update.js


$(function () {

var businessId = getQueryString(“business_id”);

// 获取url后面参数

function getQueryString(name) {

var reg = new RegExp(“(^|&)” + name + “=([^&]*)(&|$)”);

var r = window.location.search.substr(1).match(reg);

if (r != null) {

return decodeURIComponent(r[2]);

}

return ‘’;

}

getBusinessList();

function getBusinessList() {

$.ajax({

url: “/business/selectbusiness”,

type: “post”,

data: {‘business_id’: businessId},

dataType: “json”,

success: function (data) {

var obj = data.business;

$(‘#business_id’).val(obj.business_id);

$(‘#business_name’).val(obj.business_name);

$(“#customer_name”).val(obj.customer_name);

$(‘#contacts’).val(obj.contacts);

$(‘#amount’).val(obj.amount);

$(‘#date’).val(obj.date);

$(‘#business_state’).val(obj.business_state);

$(‘#create_time’).val(obj.create_time);

$(‘#person’).val(obj.person);

$(‘#remark’).val(obj.remark);

}

});

}

//返回

$(‘#back_btn’).click(function () {

window.location.href = “/front/business-list”;

});

// 新增用户

$(‘#submit_btn’).click(function () {

var business_id = $(‘#business_id’).val();

var business_name = $(‘#business_name’).val();

var customer_name = $(“#customer_name”).val();

var contacts = $(‘#contacts’).val();

var amount = $(‘#amount’).val();

var date = $(‘#date’).val();

var business_state = $(‘#business_state’).val();

var create_time = $(‘#create_time’).val();

var person = $(‘#person’).val();

var remark = $(‘#remark’).val();

var param = {

“business_id” : business_id,

“business_name”: business_name,

“customer_name”: customer_name,

“contacts”:contacts,

“amount”:amount,

“date”:date,

“business_state”:business_state,

“create_time”:create_time,

“person”: person,

“remark”: remark

};

$.ajax({

url: “/business/updatebusiness”,

async: false,

cache: false,

type: “post”,

dataType: ‘json’,

// 格式化发送的数据

contentType: ‘application/json’,

data: JSON.stringify(param),

success: function (data) {

if(data.success){

alert(“修改成功!”);

window.location.href = “/front/business-list”;

}else {

alert(“修改失败!”);

}

}

});

})

});

business-add.html


新增商机
商机名称: 客户名称: 联系人: 预计成交金额: 预计成交日期: 商机状态: ==请选择== 潜在客户 正式客户 放弃客户 签约客户 创建时间: 负责人: 备注: 提交

重置

business-list.html


<meta name=“viewport”

content=“width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no”/>

用户管理

商机名称:

商机状态:

最后

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!

如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
h=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>

用户管理

商机名称:

商机状态:

最后

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

[外链图片转存中…(img-Gv5xwXcg-1715708212520)]

[外链图片转存中…(img-QQwgZEgV-1715708212521)]

[外链图片转存中…(img-Ha4GOogT-1715708212521)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,不论你是刚入门Java开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!

如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值