zhangjinli 3 years ago
parent 89f4ad4d9e
commit eb2ac4ab9e

@ -0,0 +1,20 @@
package com.zh.project0512.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
*
* </p>
*
* @author zh
* @since 2022-05-30
*/
@RestController
@RequestMapping("/customerActionNote")
public class CustomerActionNoteController {
}

@ -54,11 +54,14 @@ public class ReferenceGroupController {
@NotNull(message = "name不能为空")
@Schema(title = "分组名")
private String name;
@NotNull(message = "封面不能为空")
@Schema(title = "封面地址")
private String coverUrl;
}
@Operation(summary = "新增分组")
@PostMapping("/add")
public Result add(@Validated @RequestBody AddRGParam param) {
referenceGroupService.save(new ReferenceGroup().setName(param.getName()).setCreatAt(LocalDateTime.now()));
referenceGroupService.save(new ReferenceGroup().setName(param.getName()).setCoverUrl(param.getCoverUrl()).setCreatAt(LocalDateTime.now()));
return Result.success("添加完成!");
}
@ -81,16 +84,17 @@ public class ReferenceGroupController {
@Min(value = 1, message = "id最小值为1")
@Schema(title = "分组id")
private Integer id;
@NotNull(message = "name不能为空")
@Schema(title = "分组名")
private String name;
@Schema(title = "封面地址")
private String coverUrl;
}
@Operation(summary = "更新分组")
@PostMapping("/upd")
public Result upd(@Validated @RequestBody UpdRGParam param) {
UpdateWrapper<ReferenceGroup> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", param.getId());
ReferenceGroup referenceGroup = new ReferenceGroup().setName(param.getName()).setUpdateAt(LocalDateTime.now());
ReferenceGroup referenceGroup = new ReferenceGroup().setName(param.getName()).setCoverUrl(param.getCoverUrl()).setUpdateAt(LocalDateTime.now());
return MybatisPlusUtil.sqlResult(referenceGroupService.update(referenceGroup, updateWrapper), "修改");
}

@ -5,10 +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.model.Reference;
import com.zh.project0512.model.RewardRule;
import com.zh.project0512.model.Task;
import com.zh.project0512.model.TaskTag;
import com.zh.project0512.model.*;
import com.zh.project0512.service.*;
import com.zh.project0512.utils.JwtUtil;
import com.zh.project0512.utils.MybatisPlusUtil;
@ -43,6 +40,8 @@ import java.util.*;
@RestController
@RequestMapping("/task")
public class TaskController {
@Autowired
private IUserService userService;
@Autowired
private ITaskService taskService;
@Autowired
@ -55,7 +54,8 @@ public class TaskController {
private IRewardRuleService rewardRuleService;
@Autowired
private IRewardRuleTemplateService rewardRuleTemplateService;
@Autowired
private ICustomerActionNoteService customerActionNoteService;
@Operation(summary = "新增")
@PostMapping("/add")
public Result add(@Validated @RequestBody Task task) {
@ -125,22 +125,34 @@ public class TaskController {
return Result.success(obj);
}
// @Data
// static class StatusTaskParam {
// @NotNull(message = "id不能为空")
// @Min(value = 1, message = "id最小值为1")
// @Schema(title = "任务id")
// private Integer id;
// @Schema(title = "任务id")
// private Integer id;
// @Schema(title = "任务id")
// private Integer id;
// }
//
// @Operation(summary = "详情")
// @PostMapping("/detail")
// public Result detail(@Validated @RequestBody StatusTaskParam param) {
//
// }
@Data
static class CusNoteParam {
@NotNull(message = "顾客姓名不能为空")
@Schema(title = "顾客姓名")
private String customerName;
@NotNull(message = "联系方式不能为空")
private String tel;
@Schema(title = "地区")
@NotNull(message = "地区不能为空")
private String area;
@Schema(title = "车型id")
private Integer brandId;
@Schema(title = "备注")
private String remarks;
}
@Operation(summary = "用户线索搜集")
@PostMapping("/customerNote")
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();
if (useId == null) {
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("上传完成");
}
}

@ -117,6 +117,6 @@ public class UtilsController {
@Scheduled(fixedRate = 10000) //每10秒执行一次
// @Scheduled(cron = "0 0 0 * * ?")
public void updDailyRank() {
System.out.println("sss");
System.out.println("进行中...");
}
}

@ -1,23 +1,35 @@
package com.zh.project0512.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zh.project0512.annotation.tokenValid;
import com.zh.project0512.model.ReferenceGroup;
import com.zh.project0512.model.Video;
import com.zh.project0512.service.IUserService;
import com.zh.project0512.service.IVideoService;
import com.zh.project0512.utils.JwtUtil;
import com.zh.project0512.utils.MybatisPlusUtil;
import com.zh.project0512.utils.result.HttpStatusEnum;
import com.zh.project0512.utils.result.Result;
import io.jsonwebtoken.Claims;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* <p>
*
*
* </p>
*
* @author zh
@ -25,19 +37,54 @@ import javax.validation.constraints.NotNull;
*/
@RestController
@RequestMapping("/video")
@Tag(name = "视频")
public class VideoController {
@Autowired
private IVideoService videoService;
@Autowired
private IUserService userService;
@Data
static class UserAddParam {
@NotNull(message = "id不能为空")
@Min(value = 1, message = "id最小值为1")
@Schema(title = "平台",description = "1抖音2快手")
@NotNull(message = "任务id不能为空")
private Integer id;
@NotNull(message = "type不能为空")
@Min(value = 1, message = "视频范围为[1.抖音,2.快手]")
@Max(value = 2, message = "视频范围为[1.抖音,2.快手]")
@Schema(title = "平台", description = "1抖音2快手")
private Integer type;
@NotNull(message = "视频地址不能为空")
private String url;
}
@Operation(summary = "用户上传")
@PostMapping("userAdd")
public Result userAdd(@Validated @RequestBody UserAddParam param) {
return Result.success();
@tokenValid
public Result userAdd(@Validated @RequestBody UserAddParam param, @RequestHeader("token") @Parameter(name = "登录token") String token) {
Claims claims = new JwtUtil().parseJWT(token);
Integer useId = userService.selByOpenid(claims.getId()).getId();
if (useId == null) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户");
}
videoService.save(new Video().setUserId(useId).setTaskId(param.getId()).setType(param.getType()).setUrl(param.getUrl()).setCreatAt(LocalDateTime.now()));
return Result.success("添加完成!");
}
@Operation(summary = "用户上传记录")
@PostMapping("addedRecord")
@tokenValid
public Result addedRecord(@RequestBody(required = false) JSONObject obj, @RequestHeader("token") @Parameter(name = "登录token") String token) {
Claims claims = new JwtUtil().parseJWT(token);
Integer useId = userService.selByOpenid(claims.getId()).getId();
if (useId == null) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该用户");
}
QueryWrapper<Video> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("userId",useId);
Integer taskId = obj.getInteger("taskId");
if(taskId != null){
queryWrapper.eq("taskId",taskId);
}
return Result.success(videoService.page(MybatisPlusUtil.SetPage(obj),queryWrapper));
}
}

@ -0,0 +1,16 @@
package com.zh.project0512.mapper;
import com.zh.project0512.model.CustomerActionNote;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author zh
* @since 2022-05-30
*/
public interface CustomerActionNoteMapper extends BaseMapper<CustomerActionNote> {
}

@ -2,6 +2,7 @@ package com.zh.project0512.mapper;
import com.zh.project0512.model.Video;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
/**
* <p>
@ -12,5 +13,4 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2022-05-18
*/
public interface VideoMapper extends BaseMapper<Video> {
}

@ -0,0 +1,70 @@
package com.zh.project0512.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author zh
* @since 2022-05-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("customerActionNote")
@Schema(title = "用户行为记录")
public class CustomerActionNote extends Model {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
*
*/
@Schema(title = "用户姓名")
@TableField("customerName")
private String customerName;
private String tel;
/**
*
*/
@Schema(title = "地区")
private String area;
@Schema(title = "品牌id")
@TableField("brandId")
private Integer brandId;
/**
*
*/
@Schema(title = "备注")
private String remarks;
/**
* id
*/
@Schema(title = "提供用户id")
@TableField("provideId")
private Integer provideId;
@TableField("creatAt")
private LocalDateTime creatAt;
}

@ -38,6 +38,12 @@ public class ReferenceGroup extends Model {
@Schema(title = "分组名称")
private String name;
/**
*
*/
@Schema(title = "封面地址")
private String coverUrl;
@TableField("creatAt")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime creatAt;

@ -60,7 +60,7 @@ public class Video extends Model {
/**
*
*/
@TableField("playTimes")
@TableField("playNum")
private Integer playNum;
/**

@ -0,0 +1,16 @@
package com.zh.project0512.service;
import com.zh.project0512.model.CustomerActionNote;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author zh
* @since 2022-05-30
*/
public interface ICustomerActionNoteService extends IService<CustomerActionNote> {
}

@ -12,5 +12,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2022-05-18
*/
public interface IVideoService extends IService<Video> {
}

@ -0,0 +1,20 @@
package com.zh.project0512.serviceImpl;
import com.zh.project0512.model.CustomerActionNote;
import com.zh.project0512.mapper.CustomerActionNoteMapper;
import com.zh.project0512.service.ICustomerActionNoteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author zh
* @since 2022-05-30
*/
@Service
public class CustomerActionNoteServiceImpl extends ServiceImpl<CustomerActionNoteMapper, CustomerActionNote> implements ICustomerActionNoteService {
}

@ -4,6 +4,7 @@ import com.zh.project0512.model.Video;
import com.zh.project0512.mapper.VideoMapper;
import com.zh.project0512.service.IVideoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -16,5 +17,4 @@ import org.springframework.stereotype.Service;
*/
@Service
public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements IVideoService {
}

Loading…
Cancel
Save