zhangjinli 3 years ago
parent 5f37e5d234
commit 016a9fbbf2

@ -11,6 +11,7 @@ import com.zh.project0512.model.*;
import com.zh.project0512.model.validatedDemo.TaskValidGroup1;
import com.zh.project0512.model.validatedDemo.TaskValidGroup2;
import com.zh.project0512.service.*;
import com.zh.project0512.utils.CustomUtil;
import com.zh.project0512.utils.JwtUtil;
import com.zh.project0512.utils.MybatisPlusUtil;
import com.zh.project0512.utils.result.HttpStatusEnum;
@ -265,8 +266,8 @@ public class TaskController {
@Operation(summary = "详情")
@PostMapping("detail")
public Result det( @RequestBody JSONObject obj) {
Task task = taskService.detailById(null, obj.getInteger("id"));
public Result det(@Validated @RequestBody DetTaskParam param) {
Task task = taskService.detailById(null, param.getId());
List rewardRulesList = rewardRuleService.listByTemplateId(task.getRewardRuleTemplateId());
JSONObject res = (JSONObject) JSONObject.toJSON(task);
res.put("rewardRuleList", rewardRulesList);
@ -275,8 +276,15 @@ public class TaskController {
@Operation(summary = "线索搜集列表")
@PostMapping("/customerNoteList")
public Result customerNote(@Validated @RequestBody JSONObject obj, @RequestHeader(value = "token",required = false) @Parameter(name = "登录token") String token) {
return Result.success(customerActionNoteService.pageList(MybatisPlusUtil.SetPage(obj), new JwtUtil().parseOpenid(token)));
public Result customerNote(@RequestBody JSONObject obj) {
IPage<Map> iPage = customerActionNoteService.pageList(MybatisPlusUtil.SetPage(obj),null);
List<Map> records = iPage.getRecords();
for(Map m:records){
if(m.get("brandList") !=null){
m.replace("brandList",new CustomUtil().stringToList(m.get("brandList").toString()));
}
}
return Result.success(iPage);
}
}

@ -69,7 +69,7 @@ public class TaskUController {
static class ListTParam {
private int pageNum;
private int pageSize;
@Schema(title="任务状态",description = "0未上线1已上线2已结束")
@Schema(title = "任务状态", description = "0未上线1已上线2已结束3待领取")
private Integer status;
@Schema(title = "月份区间")
private Integer month;
@ -85,8 +85,12 @@ public class TaskUController {
@PostMapping("/list")
public Result list(@Validated @RequestBody ListTParam param, @RequestHeader(required = false, value = "token") @Parameter(name = "用户token", description = "关联用户信息") String token) {
QueryWrapper<Reference> qw = new QueryWrapper<>();
if (null != param.getStatus()) {
qw.eq("t1.status", param.getStatus());
Integer status = param.getStatus();
if (null != status) {
qw.eq("t1.status", status == 3 ? 1 : status);
if(status == 3){
qw.ne("(SELECT count(*)!=0 from userTask as t4,user as t5 WHERE t1.id = t4.taskId and t4.userId = t5.id and t5.openid = +'"+new JwtUtil().parseOpenid(token)+"' )", 1);
}
}
if (null != param.getMonth()) {
qw.between("t1.creatAt", LocalDateTime.now().minusMonths(param.getMonth()), LocalDateTime.now());
@ -97,7 +101,6 @@ public class TaskUController {
IPage iPage = taskService.idList(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()), param.getTagIdList(), param.getBrandIdList(), qw);
List list = iPage.getRecords();
if (list.size() > 0) {
System.out.println(list);
iPage.setRecords(taskService.list(new JwtUtil().parseOpenid(token), list, param.getTagIdList(), param.getBrandIdList(), qw));
}
return Result.success(iPage);
@ -113,8 +116,8 @@ public class TaskUController {
@Operation(summary = "详情")
@PostMapping("detail")
public Result det(@RequestBody JSONObject obj, @RequestHeader(required = false, value = "token") @Parameter(name = "用户token", description = "关联用户信息") String token) {
Task task = taskService.detailById(new JwtUtil().parseOpenid(token), obj.getInteger("id"));
public Result det(@Validated @RequestBody DetTaskParam param, @RequestHeader(required = false, value = "token") @Parameter(name = "用户token", description = "关联用户信息") String token) {
Task task = taskService.detailById(new JwtUtil().parseOpenid(token), param.getId());
List rewardRulesList = rewardRuleService.listByTemplateId(task.getRewardRuleTemplateId());
JSONObject res = (JSONObject) JSONObject.toJSON(task);
res.put("rewardRuleList", rewardRulesList);
@ -149,7 +152,7 @@ public class TaskUController {
}
customerActionNoteService.save(
new CustomerActionNote().setCustomerName(param.getCustomerName()).setTel(param.getTel()).setArea(param.getArea()).setTaskId(param.getTaskId())
.setBrandList( new CustomUtil().listToString(param.getBrandList())).setRemarks(param.getRemarks()).setProvideId(useId).setCreatAt(LocalDateTime.now()));
.setBrandList(new CustomUtil().listToString(param.getBrandList())).setRemarks(param.getRemarks()).setProvideId(useId).setCreatAt(LocalDateTime.now()));
return Result.success("上传完成");
}
@ -159,9 +162,9 @@ public class TaskUController {
public Result customerNote(@Validated @RequestBody JSONObject obj, @RequestHeader(value = "token") @Parameter(name = "登录token") String token) {
IPage<Map> iPage = customerActionNoteService.pageList(MybatisPlusUtil.SetPage(obj), new JwtUtil().parseOpenid(token));
List<Map> records = iPage.getRecords();
for(Map m:records){
if(m.get("brandList") !=null){
m.replace("brandList",new CustomUtil().stringToList(m.get("brandList").toString()));
for (Map m : records) {
if (m.get("brandList") != null) {
m.replace("brandList", new CustomUtil().stringToList(m.get("brandList").toString()));
}
}
return Result.success(iPage);

@ -21,7 +21,8 @@ public interface CustomerActionNoteMapper extends BaseMapper<CustomerActionNote>
"from customerActionNote as t1\n" +
"LEFT JOIN user as t2 on t1.provideId = t2.id\n" +
"LEFT JOIN task as t3 on t1.taskId = t3.id\n"+
"<if test='openid!=null'>and t2.openid =#{openid} </if>"+
"<if test='openid!=null'>and t2.openid =#{openid} </if>" +
"order by t1.creatAt desc"+
"</script>")
IPage<Map> pageList(IPage page,String openid);
}

Loading…
Cancel
Save