|
@@ -1,8 +1,14 @@
|
|
package com.management.platform.controller;
|
|
package com.management.platform.controller;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.management.platform.entity.Clue;
|
|
import com.management.platform.entity.Clue;
|
|
|
|
+import com.management.platform.entity.SysDict;
|
|
|
|
+import com.management.platform.entity.User;
|
|
|
|
+import com.management.platform.mapper.SysDictMapper;
|
|
|
|
+import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.service.ClueService;
|
|
import com.management.platform.service.ClueService;
|
|
|
|
+import com.management.platform.service.UserService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -11,7 +17,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -26,17 +35,55 @@ import java.util.List;
|
|
public class ClueController {
|
|
public class ClueController {
|
|
@Resource
|
|
@Resource
|
|
private ClueService clueService;
|
|
private ClueService clueService;
|
|
|
|
+ @Resource
|
|
|
|
+ private UserMapper userMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private SysDictMapper sysDictMapper;
|
|
|
|
|
|
-// @RequestMapping("listClue")
|
|
|
|
-// public Object list(@RequestBody Clue clue){
|
|
|
|
-// clueService.getList(clue);
|
|
|
|
-// return
|
|
|
|
-// }
|
|
|
|
- @RequestMapping("/inserANdUpdate")
|
|
|
|
- public Object inserANdUpdate(@RequestBody Clue clue){
|
|
|
|
|
|
+
|
|
|
|
+ @RequestMapping("getClueSources")
|
|
|
|
+ public Object getClueSources(){
|
|
|
|
+ QueryWrapper<SysDict> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("code", "ClueSources");
|
|
|
|
+ return sysDictMapper.selectList(queryWrapper);
|
|
|
|
+ }
|
|
|
|
+ @RequestMapping("getDetail")
|
|
|
|
+ public Object getDetail(@RequestBody Clue clue){
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ msg.setData(clueService.getInfo(clue));
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ @RequestMapping("listClue")
|
|
|
|
+ public Object list(@RequestBody Clue clue, HttpServletRequest request){
|
|
|
|
+ //TODO token待定
|
|
|
|
+ // User user = userMapper.selectById(request.getHeader( "Token"));
|
|
|
|
+ // clue.setCompanyId(user.getCompanyId());
|
|
|
|
+ List<Clue> list = clueService.getList(clue);
|
|
|
|
+ HashMap<Object, Object> map = new HashMap<>();
|
|
|
|
+ map.put("data",list);
|
|
|
|
+ map.put("total",clueService.getTotal(clue));
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+ @RequestMapping("listDeleterClue")
|
|
|
|
+ public Object listDeleterClue(@RequestBody Clue clue, HttpServletRequest request){
|
|
|
|
+ //TODO token待定
|
|
|
|
+ // User user = userMapper.selectById(request.getHeader( "Token"));
|
|
|
|
+ // clue.setCompanyId(user.getCompanyId());
|
|
|
|
+ List<Clue> list = clueService.getList(clue);
|
|
|
|
+ HashMap<Object, Object> map = new HashMap<>();
|
|
|
|
+ map.put("data",list);
|
|
|
|
+ map.put("total",clueService.getTotal(clue));
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+ @RequestMapping("/insertAndUpdate")
|
|
|
|
+ public Object inserANdUpdate(@RequestBody Clue clue, HttpServletRequest request){
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
//操作前校验
|
|
//操作前校验
|
|
- if (null == clue.getClueName() || "" == clue.getClueName()){
|
|
|
|
|
|
+ //TODO token待定
|
|
|
|
+ // User user = userMapper.selectById(request.getHeader( "Token"));
|
|
|
|
+ // Integer companyId = user.getCompanyId();
|
|
|
|
+ if (null == clue.getClueName() || "".equals(clue.getClueName())){
|
|
msg.setError("线索名称不能为空");
|
|
msg.setError("线索名称不能为空");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -51,7 +98,12 @@ public class ClueController {
|
|
msg.setMsg("操作成功");
|
|
msg.setMsg("操作成功");
|
|
}else {
|
|
}else {
|
|
//新增
|
|
//新增
|
|
|
|
+ //TODO token待定
|
|
|
|
+ // clue.setCompanyId(companyId);
|
|
|
|
+ // clue.setCreateId(user.getId());
|
|
|
|
+
|
|
clueService.insert(clue);
|
|
clueService.insert(clue);
|
|
|
|
+
|
|
msg.setMsg("操作成功");
|
|
msg.setMsg("操作成功");
|
|
}
|
|
}
|
|
return msg;
|
|
return msg;
|