fixed 2023年初再次修改

master
zhangjinli 2 years ago
parent 851bbfc37d
commit df1c83aed2

@ -51,7 +51,7 @@ public class GeneratorCodeConfig {
dsc.setUrl(
"jdbc:mysql://121.41.171.43:3306/project0512?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("project0512");
dsc.setUsername("root");
dsc.setPassword("zhang123.");
mpg.setDataSource(dsc);

@ -198,6 +198,13 @@ public class UtilsController {
public static void main(String[] args) {
String session_key = "sNlwYEz92LwCKnsYclHknQ==";
String encryptedData = "x7OocajZ2wHJA/HpmUpcgSQYR05QbIgoBwUz5llUVY1kB1gminmcQWDziRQ4DZUV9Km68plV/vvq1bggM9To37k8fGjWYX4jXi56h8Fqi2sE74fYfnE9K6ccTVtB5m2EMs2ePUA6qkR4+qLBPOoocMlU7fI+vWuY/l70/FVqh0YPgNJsewaN2MyPE/7xjh9HY9IjDCY/FuZbzWiwDBDz+6CK/XNZvQvlzgfrEyRE1mVdEso/fHifmJoIR7iwq67pfMtp1Fovwc3/dPvdXM9IqChaQc46dGwz4VeuW6NmjnndVfIfDHn0jQQktA/NmC85";
String iv ="ITNHB91+Pfgm9wt2eSh6HA==";
String info = CoderUtil.decrypt(session_key, iv, encryptedData);
System.out.println(info);
// String a = m.find() ? m.group(1) : url;
// System.out.println(a);
// int b = StringUtils.countOccurrencesOf(a, "https://v.douyin");

@ -0,0 +1,134 @@
package com.zh.project0512.controller.manage;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.zh.project0512.annotation.AdminCheckAuthorityAnnotation;
import com.zh.project0512.annotation.AdminTokenValid;
import com.zh.project0512.model.CommonWords;
import com.zh.project0512.service.ICommonWordsService;
import com.zh.project0512.utils.MybatisPlusUtil;
import com.zh.project0512.utils.result.HttpStatusEnum;
import com.zh.project0512.utils.result.Result;
import io.swagger.v3.oas.annotations.Operation;
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 javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author zh
* @since 2023-02-16
*/
@RestController
@RequestMapping("/commonWords")
@Tag(name = "话术词条")
public class CommonWordsController {
@Autowired
private ICommonWordsService commonWordsService;
@Data
static class AddWordParam {
@NotNull(message = "title不能为空")
@Schema(title = "词条")
private String title;
}
@Operation(summary = "创建词条")
@PostMapping("/add")
@AdminTokenValid
@AdminCheckAuthorityAnnotation(jurisdictionId = "120")
public Result add(@Validated @RequestBody AddWordParam param) {
commonWordsService.addWords(new CommonWords().setTitle(param.getTitle()).setCreatAt(LocalDateTime.now()));
return Result.success("添加完成");
}
@Data
static class DelWordsParam {
@NotNull(message = "id不能为空")
@Min(value = 1, message = "id最小值为1")
@Schema(title = "词条id")
private Integer id;
}
@Operation(summary = "删除词条(软删除)")
@PostMapping("/del")
@AdminTokenValid
@AdminCheckAuthorityAnnotation(jurisdictionId = "121")
public Result del(@Validated @RequestBody DelWordsParam param) {
return MybatisPlusUtil.sqlResult(commonWordsService.update(new UpdateWrapper<CommonWords>().eq("id", param.getId()).set("sortWeight",0).set("isDeleted", 1)), "删除");
}
@Data
static class UpdWordsParam {
@NotNull(message = "id不能为空")
@Min(value = 1, message = "id最小值为1")
@Schema(title = "词条id")
private Integer id;
@NotNull(message = "词条不能为空")
@Schema(title = "词条")
private String title;
}
@Operation(summary = "更新标签名称")
@PostMapping("/upd")
@AdminTokenValid
@AdminCheckAuthorityAnnotation(jurisdictionId = "131")
public Result upd(@Validated @RequestBody UpdWordsParam param) {
return MybatisPlusUtil.sqlResult(commonWordsService.updateById(new CommonWords().setId(param.getId()).setTitle(param.getTitle()).setUpdateAt(LocalDateTime.now())), "修改");
}
@Operation(summary = "词条列表")
@PostMapping("/list")
@AdminTokenValid
public Result list(@RequestBody(required = false) JSONObject obj) {
QueryWrapper<CommonWords> qw = new QueryWrapper<>();
qw.eq("isDeleted",0).orderByAsc("sortWeight").orderByDesc("updateAt", "creatAt");
return Result.success(commonWordsService.pageMaps(MybatisPlusUtil.SetPage(obj), qw));
}
@Data
static class UpdWSParam {
@NotNull(message = "id不能为空")
@Min(value = 1, message = "id最小值为1")
@Schema(title = "词条id")
private Integer id;
@NotNull(message = "排序权重不能为空")
@Min(value = 1, message = "排序权重最小值为1")
@Schema(title = "排序权重:数字越小排序靠前")
private Integer sortWeight;
}
@Operation(summary = "修改词条排序")
@PostMapping("/updSort")
@AdminTokenValid
@AdminCheckAuthorityAnnotation(jurisdictionId = "132")
public Result updSort(@Validated @RequestBody UpdWSParam param) {
CommonWords words = commonWordsService.getById(param.getId());
if(words.getIsDeleted() == 1){
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION,"该标签已被删除");
}
int origin = words.getSortWeight();
int current = param.getSortWeight();
if (origin == current) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "权重无变化");
}
commonWordsService.updSort(origin, current, origin > current);
return Result.success("修改完成");
}
}

@ -19,6 +19,7 @@ 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 lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -69,6 +70,27 @@ public class TaskUController {
@Autowired
private IVideoEffectSettingService videoEffectSettingService;
@Data
@Accessors(chain = true)
static class CountTask{
private int all;
private int progressing;
private int completed;
}
@Operation(summary = "统计")
@PostMapping("/count")
@TokenValid
public Result count(@RequestHeader String token) {
String openid = new JwtUtil().parseOpenid(token);
int all = taskService.count( new QueryWrapper<Task>().eq("(SELECT count(*)!=0 from userTask as t4,user as t5 WHERE task.id = t4.taskId and t4.userId = t5.id and t5.openid = +'" + openid + "' )", 1));
int progressing = taskService.count( new QueryWrapper<Task>().eq("status",1).eq("(SELECT count(*)!=0 from userTask as t4,user as t5 WHERE task.id = t4.taskId and t4.userId = t5.id and t5.openid = +'" + openid + "' )", 1));
int completed = taskService.count( new QueryWrapper<Task>().between("status", 2,3).eq("(SELECT count(*)!=0 from userTask as t4,user as t5 WHERE task.id = t4.taskId and t4.userId = t5.id and t5.openid = +'" + openid + "' )", 1));
CountTask countTask = new CountTask();
countTask.setAll(all).setProgressing(progressing).setCompleted(completed);
return Result.success(countTask);
}
@Data
static class ListTParam {
private int pageNum;
@ -233,7 +255,8 @@ public class TaskUController {
.or().like("t1.area", keywords).or().like("t1.remarks", keywords).or().like("t1.brandList", keywords)
);
}
IPage<Map> iPage = customerActionNoteService.pageList(MybatisPlusUtil.SetPage(obj), new JwtUtil().parseOpenid(token), qw);
String openid = new JwtUtil().parseOpenid(token);
IPage<Map> iPage = customerActionNoteService.pageList(MybatisPlusUtil.SetPage(obj), openid==null?"":openid, qw);
List<Map> records = iPage.getRecords();
for (Map m : records) {
if (m.get("brandList") != null) {

@ -64,6 +64,12 @@ public class VideoUController {
private Integer type;
@NotNull(message = "视频地址不能为空")
private String url;
private Integer playNum; // 点击
private Integer commendNum; // 点赞
private Integer collectionNum; // 收藏
private Integer commentNum; // 评论
private Integer reSendNum; // 转发
private Integer recommendNum; // 推荐
}
@Operation(summary = "用户上传")
@ -90,26 +96,48 @@ public class VideoUController {
} else if (taskStatus != 1) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "任务不在上传时间内");
}
// 不支持重复提交
QueryWrapper<Video> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("userId", useId).eq("taskId", taskId).eq("type", param.getType()).ne("status",3);
if (videoService.getMap(queryWrapper) != null) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "已提交过该平台视频");
}
// 校验并提取链接
String s = RegexUtils.get("(http|https)://[A-Za-z0-9_\\-\\+.:?&@=/%#,;]*",param.getUrl(),0);
if(null == s){
String videoUrl = RegexUtils.get("(http|https)://[A-Za-z0-9_\\-\\+.:?&@=/%#,;]*", param.getUrl(), 0);
if (null == videoUrl) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "视频链接有误");
}else if(param.getType() == 1&&0==StringUtils.countOccurrencesOf(s,"https://v.douyin")){
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "请确认平台是否选择正确");
}else if(param.getType() == 2&&0==StringUtils.countOccurrencesOf(s,"https://v.kuaishou")){
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "请确认平台是否选择正确");
}
Map<String, Object> urlRepeat = videoService.getMap(new QueryWrapper<Video>().eq("url", s).ne("status",3));
if(null !=urlRepeat){
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "视频链接已被提交过");
Video video = new Video().setUserId(useId).setTaskId(taskId).setType(param.getType()).setUrl(videoUrl).setCreatAt(LocalDateTime.now()).setUpdateAt(LocalDateTime.now());
Integer commendNum = param.getCommendNum();
Integer commentNum = param.getCommentNum();
Integer collectionNum = param.getCollectionNum();
Integer reSendNum = param.getReSendNum();
switch (video.getType()) {
case Video.VideoTypeDouyin:
if (0 == StringUtils.countOccurrencesOf(videoUrl, "https://v.douyin")) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "抖音视频错误!");
}
break;
case Video.VideoTypeKuaishou:
if (0 == StringUtils.countOccurrencesOf(videoUrl, "https://v.kuaishou")) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "快手视频错误");
}
break;
case Video.VideoTypeWXMoments:
if (commendNum==null || commentNum==null){
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "请填写朋友圈数据");
}
video.setCommendNum(commendNum).setCommentNum(commentNum);
break;
case Video.VideoTypeWXVideo:
if (commendNum==null || commentNum==null||collectionNum==null || reSendNum==null){
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "请填写视频号数据");
}
video.setCommendNum(commendNum).setCommentNum(commentNum).setCollectionNum(collectionNum).setReSendNum(reSendNum);
break;
}
// 不支持重复提交
QueryWrapper<Video> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("userId", useId).eq("taskId", taskId).eq("type",video.getType()).ne("status", 3);
if (videoService.getMap(queryWrapper) != null) {
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "该视频已被使用");
}
videoService.save(new Video().setUserId(useId).setTaskId(taskId).setType(param.getType()).setUrl(s).setCreatAt(LocalDateTime.now()).setUpdateAt(LocalDateTime.now()));
videoService.save(video);
return Result.success("添加完成!");
}

@ -152,4 +152,9 @@ public class Task extends Model {
@Schema(title = "是否被用户接受")
@TableField(exist = false)
private Integer isReceived;
public static int taskStatusWait = 0 ;// 未上线
public static int taskStatusOnline = 1 ; // 已上线
public static int taskStatusEnd = 2 ; // 已结算
public static int taskStatusCal = 3 ; // 已结算
}

@ -127,4 +127,9 @@ public class Video extends Model {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime settledAt;
public final static int VideoTypeDouyin = 1;
public final static int VideoTypeKuaishou = 2;
public final static int VideoTypeWXMoments = 3;
public final static int VideoTypeWXVideo = 4;
}

@ -5,7 +5,7 @@ spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://121.41.171.43:3306/project0512?serverTimezone=GMT&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: project0512
username: root
password: zhang123.
hikari:
max-lifetime: 500000

@ -7,6 +7,7 @@
<result column="type" property="type"/>
<result column="userId" property="userId"/>
<result column="taskId" property="taskId"/>
<result column="taskTitle" property="taskTitle"/>
<result column="playNum" property="playNum"/>
<result column="commendNum" property="commendNum"/>
<result column="collectionNum" property="collectionNum"/>
@ -33,14 +34,17 @@
</collection>
</resultMap>
<select id="pageList" resultMap="pageListMap">
SELECT t1.*,t2.name as providerName,t3.departmentId as departmentId,t3.name as departmentName,t4.title as taskTitle,
t5.account,t5.name as accountName,t5.tel as accountTel,t5.validImg as accountImg,t6.departmentId as dpId,t6.department
SELECT t1.*,t2.name as providerName,t3.departmentId as departmentId,t3.name as departmentName,t4.title as
taskTitle,
t5.account,t5.name as accountName,t5.tel as accountTel,t5.validImg as accountImg,t6.departmentId as
dpId,t6.department
from video as t1
LEFT JOIN user as t2 on t2.id = t1.userId
LEFT JOIN qywxDepartment as t3 on t3.departmentId = t2.main_department
LEFT JOIN task as t4 on t4.id = t1.taskId
LEFT JOIN userAccount as t5 on t1.userId = t5.userId and t1.type = t5.platform
left join (SELECT t.*,d.name as department from qywxDepartmentUserLink t left join qywxDepartment d on t.departmentId = d.departmentId) as t6 on t2.openid = t6.openid
left join (SELECT t.*,d.name as department from qywxDepartmentUserLink t left join qywxDepartment d on
t.departmentId = d.departmentId) as t6 on t2.openid = t6.openid
${ew.customSqlSegment}
ORDER BY updateAt DESC,creatAt DESC
</select>

Loading…
Cancel
Save