|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.zh.project0512.annotation.tokenValid;
|
|
|
|
|
import com.zh.project0512.model.*;
|
|
|
|
|
import com.zh.project0512.service.*;
|
|
|
|
|
import com.zh.project0512.utils.JwtUtil;
|
|
|
|
@ -25,6 +26,7 @@ import javax.validation.Valid;
|
|
|
|
|
import javax.validation.constraints.DecimalMin;
|
|
|
|
|
import javax.validation.constraints.Min;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -35,7 +37,7 @@ import java.util.*;
|
|
|
|
|
* @author zh
|
|
|
|
|
* @since 2022-05-21
|
|
|
|
|
*/
|
|
|
|
|
@Tag(name="任务管理")
|
|
|
|
|
@Tag(name = "任务管理")
|
|
|
|
|
@Validated
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/task")
|
|
|
|
@ -56,10 +58,11 @@ public class TaskController {
|
|
|
|
|
private IRewardRuleTemplateService rewardRuleTemplateService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICustomerActionNoteService customerActionNoteService;
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "新增")
|
|
|
|
|
@PostMapping("/add")
|
|
|
|
|
public Result add(@Validated @RequestBody Task task) {
|
|
|
|
|
taskService.save(task);
|
|
|
|
|
taskService.save(task);
|
|
|
|
|
int id = task.getId();
|
|
|
|
|
taskTagService.addGroup(task.getTagList(), id);
|
|
|
|
|
taskBrandService.addGroup(task.getReferenceList(), id);
|
|
|
|
@ -74,6 +77,7 @@ public class TaskController {
|
|
|
|
|
@Schema(title = "任务id")
|
|
|
|
|
private Integer id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "删除")
|
|
|
|
|
@PostMapping("/del")
|
|
|
|
|
public Result del(@Validated @RequestBody DelTaskParam param) {
|
|
|
|
@ -83,16 +87,16 @@ public class TaskController {
|
|
|
|
|
@Operation(summary = "列表")
|
|
|
|
|
@PostMapping("/list")
|
|
|
|
|
public Result list(@RequestBody(required = false) JSONObject obj,
|
|
|
|
|
@RequestHeader(required = false,value="token") @Parameter(name="用户token",description = "关联用户信息") String token) {
|
|
|
|
|
@RequestHeader(required = false, value = "token") @Parameter(name = "用户token", description = "关联用户信息") String token) {
|
|
|
|
|
Claims claims = new JwtUtil().parseJWT(token);
|
|
|
|
|
String openid = null;
|
|
|
|
|
if(claims != null){
|
|
|
|
|
openid =claims.getId();
|
|
|
|
|
if (claims != null) {
|
|
|
|
|
openid = claims.getId();
|
|
|
|
|
}
|
|
|
|
|
IPage ipage = taskService.taskIdList(MybatisPlusUtil.SetPage(obj));
|
|
|
|
|
List taskIdList = ipage.getRecords();
|
|
|
|
|
if(taskIdList.size()>0){
|
|
|
|
|
ipage.setRecords(taskService.taskList(openid,taskIdList));
|
|
|
|
|
if (taskIdList.size() > 0) {
|
|
|
|
|
ipage.setRecords(taskService.taskList(openid, taskIdList));
|
|
|
|
|
}
|
|
|
|
|
return Result.success(ipage);
|
|
|
|
|
}
|
|
|
|
@ -108,7 +112,7 @@ public class TaskController {
|
|
|
|
|
@Operation(summary = "详情")
|
|
|
|
|
@PostMapping("/detail")
|
|
|
|
|
public Result detail(@Validated @RequestBody DetTaskParam param) {
|
|
|
|
|
int id =param.getId();
|
|
|
|
|
int id = param.getId();
|
|
|
|
|
Task task = taskService.getById(id);
|
|
|
|
|
if (null == task) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.NOT_FOUND);
|
|
|
|
@ -143,6 +147,7 @@ public class TaskController {
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "用户线索搜集")
|
|
|
|
|
@PostMapping("/customerNote")
|
|
|
|
|
@tokenValid
|
|
|
|
|
public Result customerNote(@Validated @RequestBody CusNoteParam param, @RequestHeader("token") @Parameter(name = "登录token") String token) {
|
|
|
|
|
Claims claims = new JwtUtil().parseJWT(token);
|
|
|
|
|
Integer useId = userService.selByOpenid(claims.getId()).getId();
|
|
|
|
@ -150,9 +155,15 @@ public class TaskController {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户");
|
|
|
|
|
}
|
|
|
|
|
customerActionNoteService.save(
|
|
|
|
|
new CustomerActionNote().setCustomerName(param.getCustomerName()).setTel(param.getTel()).
|
|
|
|
|
setArea(param.getArea()).setBrandId(param.getBrandId()).setRemarks(param.getRemarks()).setProvideId(useId));
|
|
|
|
|
return Result.success("上传完成");
|
|
|
|
|
new CustomerActionNote().setCustomerName(param.getCustomerName()).setTel(param.getTel()).setArea(param.getArea())
|
|
|
|
|
.setBrandId(param.getBrandId()).setRemarks(param.getRemarks()).setProvideId(useId).setCreatAt(LocalDateTime.now()));
|
|
|
|
|
return Result.success("上传完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "线索搜集列表")
|
|
|
|
|
@PostMapping("/customerNoteList")
|
|
|
|
|
public Result customerNote(@Validated @RequestBody JSONObject obj) {
|
|
|
|
|
return Result.success(customerActionNoteService.pageList(MybatisPlusUtil.SetPage(obj)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|