|
@@ -1,13 +1,26 @@
|
|
|
package com.management.platform.controller;
|
|
|
|
|
|
|
|
|
+import com.management.platform.entity.BusinessOpportunity;
|
|
|
+import com.management.platform.entity.User;
|
|
|
+import com.management.platform.mapper.UserMapper;
|
|
|
+import com.management.platform.service.BusinessOpportunityService;
|
|
|
+import com.management.platform.service.SysFunctionService;
|
|
|
+import com.management.platform.service.UserService;
|
|
|
+import com.management.platform.util.HttpRespMsg;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 前端控制器
|
|
|
+ * 前端控制器
|
|
|
* </p>
|
|
|
*
|
|
|
* @author Seyason
|
|
@@ -17,5 +30,48 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("/business-opportunity")
|
|
|
public class BusinessOpportunityController {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private UserMapper userMapper;
|
|
|
+ @Resource
|
|
|
+ private SysFunctionService sysFunctionService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BusinessOpportunityService bOservice;
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("insertAndUpdate")
|
|
|
+ public HttpRespMsg insertAndUpdate(@RequestBody BusinessOpportunity bo) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setMsg("操作成功");
|
|
|
+ return msg;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("list")
|
|
|
+ public HttpRespMsg list(@RequestBody BusinessOpportunity bo, HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ bo.setCompanyId(user.getCompanyId());
|
|
|
+ List<BusinessOpportunity> list = new ArrayList<>();
|
|
|
+ boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部商机");
|
|
|
+ boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部商机");
|
|
|
+ if (!isAll) {
|
|
|
+ list = bOservice.getAll(bo);
|
|
|
+ } else if (!isNotAll) {
|
|
|
+ list = bOservice.getAll(bo);
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("getAllProduct")
|
|
|
+ public HttpRespMsg getAllProduct(@RequestBody BusinessOpportunity bo) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setMsg("操作成功");
|
|
|
+ return msg;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|