Java 實戰(zhàn)項目之CRM客戶管理系統(tǒng)的實現(xiàn)流程
一、項目簡述
功能包括: 用戶管理,系統(tǒng)管理,客戶管理,客戶服務,客戶關懷, 銷售機會,統(tǒng)計管理等等。
二、項目運行
環(huán)境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
項目技術: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。





員工操作:
/**
* @author 員工操作
*/
@RestController
@RequestMapping("/employee")
@CrossOrigin
@Slf4j
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@Autowired
private JobService jobService;
@Autowired
private EduLevelMapper eduLevelMapper;
@Autowired
private EmployeeMapper employeeMapper;
/**
* 搜索接口
*/
@GetMapping("/search")
public Result search(@RequestParam(name = "name", required = false,defaultValue = "") String name,
@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
@RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
return employeeService.list(current, size, name);
}
/**
* 分頁查詢接口
*
* @param current
* @param size
* @return
*/
@GetMapping("/list")
public Result list(@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
@RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
return employeeService.list(current, size, null);
}
/**
* 根據id獲取員工具體信息
* @param id
* @return
*/
@GetMapping("/getUserById")
public EmployeeDTO getUserAllInfoById(@RequestParam(name = "id") Integer id) {
return employeeService.getUserById(id);
}
/**
* 根據員工獲取信息
* @param id
* @return
*/
@GetMapping("/getEmployeeById")
public Employee getUserById(@RequestParam(name = "id") Integer id) {
return employeeMapper.selectById(id);
}
/**
* 增加員工接口
*
* @param employee
* @return
*/
@PostMapping("/add")
public Map<String, Object> addUser(@RequestBody Employee employee) {
log.info(employee.toString());
return employeeService.add(employee);
}
/**
* 更新用戶
* @param employee
* @return
*/
@PostMapping("/update")
public Map<String, Object> updateUser(@RequestBody Employee employee) {
log.info(employee.toString());
return employeeService.update(employee);
}
/**
* 刪除用戶
* @param id
* @return
*/
@GetMapping("/delete")
public Result deleteEmployeeById(@RequestParam(name = "id") Integer id) {
return employeeService.deleteEmployeeById(id);
}
/**
* 辭退員工
*
* @param id
* @return
*/
@GetMapping("/dismiss")
public Map<String, Object> dismissEmployeeById(@RequestParam(name = "id") Integer id) {
return employeeService.dismissEmployeeById(id);
}
/**
* 得到所以工作,部門,學歷信息
*
* @return
*/
@GetMapping("/otherInfo")
public Result getAllOtherInfo() {
Map<String, Object> info = new HashMap<>();
info.put("departments", departmentService.selectAll());
info.put("jobs", jobService.selectAll());
info.put("eduLevels", eduLevelMapper.selectList(null));
return Result.success(info);
}
@GetMapping("/map")
public Result getMap() {
return employeeService.getMap();
}
}
人事管理相關接口:
/**
* 人事管理相關接口
*/
@RestController
@CrossOrigin
@RequestMapping("/personnel")
public class PersonnelController {
@Autowired
private PersonnelService personnelService;
/**
* 所以人事記錄接口
* @param current
* @param size
* @return
*/
@GetMapping("/list")
public Result list(@RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
@RequestParam(name = "size", required = false, defaultValue = "10") Integer size) {
return personnelService.list(current, size);
}
}
服務端:
/**
* websocket 服務端
* 注意: websocket 不能被代理,還有下面幾個注解修飾的方法必須是public的
*/
@Component
@ServerEndpoint("/websocket/login")
@Slf4j
public class WebSocketServer {
// static Log log = LogFactory.get(WebSocketServer.class);
/**
* 記錄連接數(shù)量
*/
private static int onlineCount = 0;
/**
* juc中的線程安全容器
*/
private static CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
/**
* 存放websocket 中的會話
*/
private Session session;
/**
* 連接建立成功調用的方法
*/
@OnOpen
public void onOpen(Session session) {
this.session = session;
webSocketSet.add(this);
addOnlineCount();
log.info("新增一個websocket連接,現(xiàn)在連接數(shù)" + getOnlineCount());
}
/**
* websocket 連接斷開調用的方法
*/
@OnClose
public void onClose() {
webSocketSet.remove(this);
subOnlineCount();
log.info("斷開websocket一個連接,現(xiàn)在連接數(shù):" + getOnlineCount());
}
/**
* 收到消息調用此方法
*
* @param message
* @param session
*/
@OnMessage
public void onMessage(String message, Session session) {
log.info("websocket 收到消息了: " + message);
try {
sendInfo("hello, too!!!", "text");
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 發(fā)生錯誤調用的方法
*
* @param session
* @param throwable
*/
@OnError
public void onError(Session session, Throwable throwable) {
log.error("發(fā)送錯誤, ");
throwable.printStackTrace();
}
/**
* 實現(xiàn)主動推送消息到客戶端
*/
public void sendMessage(String message) throws IOException {
if (session != null) {
this.session.getBasicRemote().sendText(message);
} else {
log.info("session為空");
}
}
public static void sendInfo(Object message, String type) throws IOException {
log.info("推送消息到窗口,推送內容:" + message);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("type", type);
resultMap.put("message", message);
JSONObject jsonObject = JSONUtil.parseObj(resultMap);
for (WebSocketServer item : webSocketSet) {
try {
//這里可以設定只推送給這個sid的,為null則全部推送
item.sendMessage(jsonObject.toString());
} catch (IOException e) {
continue;
}
}
}
public static synchronized int getOnlineCount() {
return onlineCount;
}
public static synchronized void addOnlineCount() {
WebSocketServer.onlineCount++;
}
public static synchronized void subOnlineCount() {
WebSocketServer.onlineCount--;
}
}
以上就是Java 實戰(zhàn)項目之CRM客戶管理系統(tǒng)的實現(xiàn)流程的詳細內容,更多關于Java CRM客戶管理系統(tǒng)的資料請關注腳本之家其它相關文章!
相關文章
SpringBoot開發(fā)案例之打造私有云網盤的實現(xiàn)
這篇文章主要介紹了SpringBoot開發(fā)案例之打造私有云網盤的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-04-04
springboot+thymeleaf+mybatis實現(xiàn)甘特圖的詳細過程
這篇文章主要介紹了springboot+thymeleaf+mybatis實現(xiàn)甘特圖的詳細過程,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-07-07
鴻蒙HarmonyOS App開發(fā)造輪子之自定義圓形圖片組件的實例代碼
這篇文章主要介紹了鴻蒙HarmonyOS App開發(fā)造輪子之自定義圓形圖片組件,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-01-01
Mybatis中#{}和${}傳參的區(qū)別及#和$的區(qū)別小結
這篇文章主要介紹了Mybatis中#{}和${}傳參的區(qū)別及#和$的區(qū)別小結 的相關資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-07-07

