修改提交
This commit is contained in:
parent
9fb26ab866
commit
97fe8eb588
|
|
@ -62,7 +62,8 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
|
|||
registry.addInterceptor(new SaInterceptor(handler ->
|
||||
SaRouter.match("/**", r -> StpUtil.checkLogin()))
|
||||
.isAnnotation(true))
|
||||
.excludePathPatterns("/option/addOption")
|
||||
.excludePathPatterns("/option/appUploadFile")
|
||||
.excludePathPatterns("/option/getTaskDetails")
|
||||
// .excludePathPatterns("/swagger-resources/**")
|
||||
.excludePathPatterns("/webjars/**")
|
||||
.excludePathPatterns("/error")
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class PasswordValidator {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String password = "assword1@"; // 示例密码
|
||||
String password = "Bonus@admin123"; // 示例密码
|
||||
if (isValidPassword(password)) {
|
||||
System.err.println("密码强度合格");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,13 +3,18 @@ package com.company.project.controller;
|
|||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.company.project.common.utils.DataResult;
|
||||
import com.company.project.entity.*;
|
||||
import com.company.project.common.aop.annotation.LogAnnotation;
|
||||
import com.company.project.common.utils.ExportExcelUtil;
|
||||
|
||||
import com.company.project.service.OptionService;
|
||||
import com.company.project.service.UserService;
|
||||
import com.company.project.vo.req.UserRoleOperationReqVO;
|
||||
import com.company.project.vo.resp.TaskOwnUserRespVo;
|
||||
import com.company.project.vo.resp.UserInfoRespVO;
|
||||
import com.company.project.vo.resp.UserOwnRoleRespVO;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -17,13 +22,19 @@ import io.swagger.annotations.ApiOperation;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户意见收集查询
|
||||
|
|
@ -71,7 +82,16 @@ public class OptionController {
|
|||
return optionService.listInfoByPage(vo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "APP文件上传")
|
||||
@PostMapping("appUploadFile")
|
||||
public String addTaskInfoData(@RequestParam(value = "file",required = false) MultipartFile[] files, HttpServletRequest request){
|
||||
return optionService.addTaskInfoData(files,request);
|
||||
}
|
||||
@ApiOperation(value = "app 意见任务信息查询")
|
||||
@PostMapping("getTaskDetails")
|
||||
public Map<String,Object> getTaskDetails(@RequestBody TbTask vo){
|
||||
return optionService.getTaskDetails(vo);
|
||||
}
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除任务")
|
||||
@LogAnnotation(title = "意见收集", action = "删除任务")
|
||||
|
|
@ -155,8 +175,20 @@ public class OptionController {
|
|||
|
||||
|
||||
|
||||
@GetMapping("/task/user/{taskId}")
|
||||
@ApiOperation(value = "赋予任务-获取搜有点任务角色")
|
||||
@LogAnnotation(title = "任务管理", action = "赋予任务-临时角色")
|
||||
@SaCheckPermission("tb:option:user")
|
||||
public TaskOwnUserRespVo getTaskUser(@PathVariable("taskId") String taskId) {
|
||||
return optionService.getTaskUser(taskId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PutMapping("/task/user/{taskId}")
|
||||
@ApiOperation(value = "赋予角色-用户赋予角色接口")
|
||||
@LogAnnotation(title = "用户管理", action = "赋予角色-用户赋予角色接口")
|
||||
@SaCheckPermission("tb:option:user")
|
||||
public void setTaskUser(@PathVariable("taskId") String taskId, @RequestBody List<String> userIds ) {
|
||||
optionService.setTaskUser(taskId,userIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.company.project.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class SourceFileVo {
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* 资源id
|
||||
*/
|
||||
private String sourceId;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String filePath;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
private String createTime;
|
||||
|
||||
private String fileType;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.company.project.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class TaskInfoVo {
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String userPhone;
|
||||
|
||||
private String userOpinion;
|
||||
|
||||
private String createTime;
|
||||
|
||||
private List<String> fileList;
|
||||
|
||||
}
|
||||
|
|
@ -3,9 +3,8 @@ package com.company.project.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.company.project.entity.TbExportTask;
|
||||
import com.company.project.entity.TbTask;
|
||||
import com.company.project.entity.TbUserOption;
|
||||
import com.company.project.entity.*;
|
||||
import com.company.project.service.impl.SourceFileVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -87,5 +86,49 @@ public interface OptionMapper extends BaseMapper<TbTask> {
|
|||
*/
|
||||
List<String> getUploadFile(TbTask vo);
|
||||
|
||||
/**
|
||||
* 查询临时用户
|
||||
* @return
|
||||
*/
|
||||
|
||||
List<SysUser> getUserList();
|
||||
|
||||
/**
|
||||
* 查询让人物数据
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
List<String> getTaskUserByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param taskId
|
||||
*/
|
||||
void deleteTaskUser(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* 新增任务角色
|
||||
* @param taskId
|
||||
* @param userIds
|
||||
*/
|
||||
void addTaskUser(@Param("taskId") String taskId,@Param("list") List<String> userIds);
|
||||
|
||||
/**
|
||||
* 添加任务数据
|
||||
* @param vo
|
||||
*/
|
||||
int addTaskInfoData(TaskInfoVo vo);
|
||||
|
||||
/**
|
||||
* 新增资源数据
|
||||
* @param vo1
|
||||
*/
|
||||
void addFileSource(SourceFileVo vo1);
|
||||
|
||||
/**
|
||||
* 查询任务信息
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
TbTask getTaskDetails(TbTask vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,17 @@ package com.company.project.service;
|
|||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.company.project.entity.TaskInfoVo;
|
||||
import com.company.project.entity.TbExportTask;
|
||||
import com.company.project.entity.TbTask;
|
||||
import com.company.project.entity.TbUserOption;
|
||||
import com.company.project.vo.resp.TaskOwnUserRespVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
|
|
@ -73,4 +79,33 @@ public interface OptionService extends IService<TbTask> {
|
|||
* @return
|
||||
*/
|
||||
List<TbExportTask> getExportList(TbExportTask vo);
|
||||
|
||||
/**
|
||||
* 查询 任务用户信息
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
TaskOwnUserRespVo getTaskUser(String taskId);
|
||||
|
||||
/**
|
||||
* 设置任务用户
|
||||
* @param taskId
|
||||
* @param userIds
|
||||
*/
|
||||
void setTaskUser(String taskId, List<String> userIds);
|
||||
|
||||
/**
|
||||
* 新增人
|
||||
* @param vo
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
String addTaskInfoData(MultipartFile[] files, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 意见信息查询
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> getTaskDetails(TbTask vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.company.project.entity.SysUser;
|
||||
import com.company.project.vo.resp.LoginRespVO;
|
||||
import com.company.project.vo.resp.TaskOwnUserRespVo;
|
||||
import com.company.project.vo.resp.UserOwnRoleRespVO;
|
||||
|
||||
/**
|
||||
|
|
@ -77,4 +78,6 @@ public interface UserService extends IService<SysUser> {
|
|||
* @param vo vo
|
||||
*/
|
||||
void updateUserInfoMy(SysUser vo);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,33 @@
|
|||
package com.company.project.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.company.project.common.utils.DateUtils;
|
||||
import com.company.project.entity.TbExportTask;
|
||||
import com.company.project.entity.TbTask;
|
||||
import com.company.project.entity.TbUserOption;
|
||||
import com.company.project.entity.*;
|
||||
import com.company.project.mapper.OptionMapper;
|
||||
import com.company.project.common.exception.BusinessException;
|
||||
import com.company.project.service.OptionService;
|
||||
import com.company.project.utils.IDUtils;
|
||||
import com.company.project.utils.ZipExportUtils;
|
||||
import com.company.project.vo.resp.TaskOwnUserRespVo;
|
||||
import com.company.project.vo.resp.UserOwnRoleRespVO;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.zxing.WriterException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
|
|
@ -66,6 +70,149 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
|||
}
|
||||
return mapper.getExportList(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TaskOwnUserRespVo getTaskUser(String taskId) {
|
||||
List<String> taskList = mapper.getTaskUserByTaskId(taskId);
|
||||
List<SysUser> list = mapper.getUserList();
|
||||
|
||||
TaskOwnUserRespVo vo = new TaskOwnUserRespVo();
|
||||
vo.setUserList(list);
|
||||
vo.setOwnRoles(taskList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param taskId
|
||||
* @param userIds
|
||||
*/
|
||||
@Override
|
||||
public void setTaskUser(String taskId, List<String> userIds) {
|
||||
mapper.deleteTaskUser(taskId);
|
||||
mapper.addTaskUser(taskId,userIds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String addTaskInfoData(MultipartFile[] files, HttpServletRequest request) {
|
||||
try{
|
||||
String param=request.getParameter("param");
|
||||
if (StringHelper.isNullOrEmptyString(param)){
|
||||
return "青上传参数";
|
||||
}
|
||||
TaskInfoVo vo= JSON.parseObject(param,TaskInfoVo.class);
|
||||
if (StringHelper.isNullOrEmptyString(vo.getTaskId())){
|
||||
return "请上传任务id";
|
||||
}
|
||||
|
||||
if(!StringHelper.isNullOrEmptyString(vo.getUserPhone())){
|
||||
if(!isValidPhoneNumber(vo.getUserPhone())){
|
||||
return "请填写正确的手机号码";
|
||||
}
|
||||
}
|
||||
TbTask task=new TbTask() ;
|
||||
task.setId(vo.getTaskId());
|
||||
TbTask voo=mapper.getTaskDetails(task);
|
||||
if(voo==null){
|
||||
return "任务不存在/已被删除";
|
||||
}else{
|
||||
if(!"1".equals(voo.getTaskType())){
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime startTime = LocalDateTime.parse(voo.getStartTime(), formatter);
|
||||
LocalDateTime endTime = LocalDateTime.parse(voo.getEndTime(), formatter);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.isAfter(startTime) && now.isBefore(endTime)) {
|
||||
|
||||
}else{
|
||||
return "任务已过期";
|
||||
}
|
||||
}
|
||||
}
|
||||
String createTimes= DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN);
|
||||
vo.setCreateTime(createTimes);
|
||||
int num= mapper.addTaskInfoData(vo);
|
||||
if(num>0){
|
||||
if(files != null){
|
||||
for (MultipartFile file : files) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String suffix= IDUtils.getSuffix(fileName);
|
||||
String name=IDUtils.createID()+suffix;
|
||||
//创建
|
||||
String createTime = DateUtils.format(new Date(), DateUtils.DATEPATTERN);
|
||||
String paths="app/" +createTime + "/"+name;
|
||||
String newPath = filePath + paths;
|
||||
File uploadFile = new File(newPath);
|
||||
if (!uploadFile.getParentFile().exists()) {
|
||||
uploadFile.getParentFile().mkdirs();
|
||||
}
|
||||
file.transferTo(uploadFile);
|
||||
SourceFileVo vo1=new SourceFileVo();
|
||||
vo1.setSourceId(vo.getId());
|
||||
vo1.setCreateTime(createTimes);
|
||||
vo1.setFilePath(paths);
|
||||
vo1.setFileName(fileName);
|
||||
vo1.setFileSuffix(suffix);
|
||||
vo1.setFileType("1");
|
||||
mapper.addFileSource(vo1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "添加成功";
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
||||
return "添加失败";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getTaskDetails(TbTask vo) {
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
String id=vo.getId();
|
||||
if(StringHelper.isNullOrEmptyString(id)){
|
||||
map.put("msg","任务id不能为空");
|
||||
map.put("data","任务id不能为空");
|
||||
map.put("code","201");
|
||||
}else{
|
||||
TbTask voo=mapper.getTaskDetails(vo);
|
||||
if(voo==null){
|
||||
map.put("msg","任务不存在/已被删除");
|
||||
map.put("code","202");
|
||||
map.put("data","任务不存在/已被删除");
|
||||
}else{
|
||||
if("1".equals(voo.getTaskType())){
|
||||
map.put("msg","请求成功");
|
||||
map.put("data",voo);
|
||||
map.put("code","200");
|
||||
}else{
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime startTime = LocalDateTime.parse(voo.getStartTime(), formatter);
|
||||
LocalDateTime endTime = LocalDateTime.parse(voo.getEndTime(), formatter);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.isAfter(startTime) && now.isBefore(endTime)) {
|
||||
map.put("msg","请求成功");
|
||||
map.put("data",voo);
|
||||
map.put("code","200");
|
||||
}else{
|
||||
map.put("msg","任务已过期");
|
||||
map.put("data","任务已过期");
|
||||
map.put("code","203");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(TbTask vo) {
|
||||
mapper.deleteData(vo);
|
||||
|
|
@ -123,12 +270,8 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
|||
}
|
||||
@Override
|
||||
public void addOption(TbUserOption vo) {
|
||||
if(StringHelper.isNullOrEmptyString(vo.getUserName())){
|
||||
throw new BusinessException("请填写用户名");
|
||||
}
|
||||
if(StringHelper.isNullOrEmptyString(vo.getUserPhone())){
|
||||
throw new BusinessException("请填写正确的手机号码!");
|
||||
}else{
|
||||
|
||||
if(!StringHelper.isNullOrEmptyString(vo.getUserPhone())){
|
||||
if(!isValidPhoneNumber(vo.getUserPhone())){
|
||||
throw new BusinessException("请填写正确的手机号码!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.company.project.service.UserRoleService;
|
|||
import com.company.project.service.UserService;
|
||||
import com.company.project.vo.req.UserRoleOperationReqVO;
|
||||
import com.company.project.vo.resp.LoginRespVO;
|
||||
import com.company.project.vo.resp.TaskOwnUserRespVo;
|
||||
import com.company.project.vo.resp.UserOwnRoleRespVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
|
@ -185,6 +186,8 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<SysUser> pageInfo(SysUser vo) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery();
|
||||
|
|
@ -204,6 +207,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
|||
if (null != vo.getStatus()) {
|
||||
queryWrapper.eq(SysUser::getStatus, vo.getStatus());
|
||||
}
|
||||
queryWrapper.ne(SysUser::getCreateWhere, "4");
|
||||
if (!StringUtils.isEmpty(vo.getDeptNo())) {
|
||||
LambdaQueryWrapper<SysDept> queryWrapperDept = Wrappers.lambdaQuery();
|
||||
queryWrapperDept.select(SysDept::getId).like(SysDept::getRelationCode, vo.getDeptNo());
|
||||
|
|
@ -317,7 +321,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
|||
@Override
|
||||
public void updatePwd(SysUser vo) {
|
||||
|
||||
if(!PasswordValidator.isValidPassword(vo.getPassword())){
|
||||
if(!PasswordValidator.isValidPassword(vo.getNewPwd())){
|
||||
throw new BusinessException("密码必须包含字母、数字和特殊字符至少各一个");
|
||||
}
|
||||
SysUser sysUser = sysUserMapper.selectById(vo.getId());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.company.project.utils;
|
||||
|
||||
public class IDUtils {
|
||||
private static byte[] lock = new byte[0];
|
||||
|
||||
// 位数,默认是8位
|
||||
private final static long w = 100000000;
|
||||
|
||||
/**
|
||||
* 传入文件 名称
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static String getSuffix(String fileName){
|
||||
return fileName.substring(fileName.lastIndexOf('.'));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.err.println(createID());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取id
|
||||
* @return
|
||||
*/
|
||||
public static String createID() {
|
||||
long r = 0;
|
||||
synchronized (lock) {
|
||||
r = (long) ((Math.random() + 1) * w);
|
||||
}
|
||||
|
||||
return System.currentTimeMillis() + String.valueOf(r).substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是文件/图片
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String isImageFileExtension(String name) {
|
||||
name=name.toLowerCase();
|
||||
String[] imageFormats = {"jpg", "jpeg", "png", "gif", "bmp", "tiff"};
|
||||
for (String format : imageFormats) {
|
||||
if (format.equals(name)) { // 判断扩展名
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
return "2"; // 不是支持的图片格式
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.company.project.vo.resp;
|
||||
|
||||
import com.company.project.entity.SysRole;
|
||||
import com.company.project.entity.SysUser;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 任务分配的全部角色
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class TaskOwnUserRespVo {
|
||||
|
||||
@ApiModelProperty("所有的临时用户")
|
||||
private List<SysUser> userList;
|
||||
|
||||
@ApiModelProperty(value = "用户拥有的任务")
|
||||
private List<String> ownRoles;
|
||||
}
|
||||
|
|
@ -24,9 +24,11 @@ spring:
|
|||
|
||||
file:
|
||||
#文件上传目录 绝对路径 末尾请加 /
|
||||
path: F:/files/ #windows
|
||||
visitPath: http://192.168.0.38:21666/manager/files/
|
||||
#path: /data/files/ #linux
|
||||
# path: F:/files/ #windows
|
||||
# visitPath: http://192.168.0.38:21666/manager/files/
|
||||
visitPath: http://192.168.0.14:21666/manager/files/
|
||||
path: /home/options/file/
|
||||
#linux
|
||||
knife4j:
|
||||
production: true #生成环境禁用查看文档
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,34 @@
|
|||
)values (#{taskType},#{taskTitle},#{taskDescribe},#{startTime},#{endTime},#{createUser},
|
||||
now(),0,#{taskTime})
|
||||
</insert>
|
||||
<insert id="addTaskUser">
|
||||
insert into tb_task_user(
|
||||
user_id,task_id
|
||||
)values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item},#{taskId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addTaskInfoData" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_task_info (task_id, user_name, user_phone, user_opinion, create_time
|
||||
)values (#{taskId},#{userName},#{userPhone},#{userOpinion},#{createTime})
|
||||
</insert>
|
||||
<insert id="addFileSource">
|
||||
insert into tb_source_file(
|
||||
source_id, file_path, file_name, create_time, file_suffix, file_type
|
||||
)values (#{sourceId},#{filePath},#{fileName},#{createTime},#{fileSuffix},#{fileType})
|
||||
|
||||
</insert>
|
||||
<update id="deleteData">
|
||||
update tb_task set del_flag=1 WHERE id=#{id}
|
||||
</update>
|
||||
<delete id="deleteInfo">
|
||||
update tb_task_info set del_flag=1 WHERE id=#{id}
|
||||
</delete>
|
||||
<delete id="deleteTaskUser">
|
||||
delete from tb_task_user where task_id=#{taskId}
|
||||
|
||||
</delete>
|
||||
<update id="updateTaskPath">
|
||||
update tb_task set file_path=#{filePath}
|
||||
where id=#{id}
|
||||
|
|
@ -170,6 +192,23 @@
|
|||
GROUP BY tti.id
|
||||
|
||||
</select>
|
||||
<select id="getUserList" resultType="com.company.project.entity.SysUser">
|
||||
select username,create_time,id
|
||||
from sys_user su
|
||||
WHERE create_where=4 and deleted=1
|
||||
|
||||
</select>
|
||||
<select id="getTaskUserByTaskId" resultType="java.lang.String">
|
||||
select user_id
|
||||
from tb_task_user
|
||||
where task_id= #{taskId}
|
||||
|
||||
</select>
|
||||
<select id="getTaskDetails" resultType="com.company.project.entity.TbTask">
|
||||
select id,task_type taskType,task_title taskTitle,task_describe taskDescribe,start_time startTime,end_time endTime
|
||||
from tb_task
|
||||
where id=#{id} and del_flag=0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -124,45 +124,61 @@
|
|||
|
||||
<div id="look_file" hidden>
|
||||
<img src="http://192.168.0.38:21666/manager/files/20250328/4.png" id="lookFilePath" style="max-width:100%;" >
|
||||
<input name="thisFileName" id="thisFileName" hidden>
|
||||
<div style="margin-left: 40%"> <button onclick="downloadImage()" class="layui-btn btn-secondary close-popup" ><i class="fa fa-times-circle"></i> 下载</button></div>
|
||||
</div>
|
||||
|
||||
<div id="look_file_all" hidden>
|
||||
<button style="margin-left: 10px" class="layui-btn btn-secondary close-popup next" onclick="next(1)" ><i class="fa fa-times-circle"></i> 上一张</button>
|
||||
<img src="http://192.168.0.38:21666/manager/files/20250328/4.png" id="seeFile" style="width: 800px;height: 700px" >
|
||||
<button class="layui-btn btn-secondary close-popup next" onclick="next(2)" ><i class="fa fa-times-circle"></i> 下一张</button>
|
||||
<div style="margin-left: 40%"> <button onclick="downloadImage2()" class="layui-btn btn-secondary close-popup" ><i class="fa fa-times-circle"></i> 下载</button> </div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="userTree" style="display: none"></div>
|
||||
<div id="users" class="demo-transfer" style="display: none"></div>
|
||||
|
||||
|
||||
</body>
|
||||
<script type="text/html" id="toolbar">
|
||||
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addTask" sa:hasPermission="tb:option:add">新增</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="export" sa:hasPermission="tb:option:export">导出</button>
|
||||
|
||||
<button class="layui-btn layui-btn-sm" lay-event="del" sa:hasPermission="tb:option:del">删除</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="infoTool">
|
||||
|
||||
<button class="layui-btn layui-btn-sm" lay-event="del" sa:hasPermission="tb:option:del">删除</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="feedback" sa:hasPermission="tb:option:export">反馈</button>
|
||||
<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del" sa:hasPermission="tb:option:del">删除</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="feedback" sa:hasPermission="tb:option:fk">反馈</button>
|
||||
|
||||
</script>
|
||||
<script type="text/html" id="infoToolbar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="export" sa:hasPermission="tb:option:export">导出</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="export" sa:hasPermission="tb:option:export:detail">导出</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="tool">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="update" sa:hasPermission="tb:option:update">修改</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="taskInfo" sa:hasPermission="tb:option:yj">意见</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="tempUser" sa:hasPermission="tb:option:user">临时用户</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="update" sa:hasPermission="tb:option:update">修改</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="taskInfo" sa:hasPermission="tb:option:yj">意见</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="tempUser" sa:hasPermission="tb:option:user">临时用户</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" sa:hasPermission="tb:option:del">删除</a>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
let fileList;
|
||||
let nowIndex=0;
|
||||
layui.config({
|
||||
base: ctx + 'static/layui-ext/'
|
||||
}).use(function () {
|
||||
var transfer = layui.transfer;
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
|
||||
var layer = layui.layer;
|
||||
var laydate = layui.laydate;
|
||||
var thisRoleType= CoreUtil.getData("roleType")
|
||||
|
|
@ -190,14 +206,15 @@
|
|||
[
|
||||
{type: 'checkbox', fixed: 'left'},
|
||||
{field:'index', width:80, title: '序号',type:'numbers', sort: true,fixed: 'left',},
|
||||
{field: 'type', title: '任务类型', width: 100,sort: true },
|
||||
{field: 'type', title: '任务类型', width: 120,sort: true },
|
||||
{field: 'taskTitle', title: '任务主题', width: 250,sort: true},
|
||||
{field: 'taskDescribe', title: '主题说明', width: 300,sort: true},
|
||||
{field: 'taskTime', title: '任务时效', width: 250,sort: true},
|
||||
{field: 'taskDescribe', title: '主题说明', width: 320,sort: true},
|
||||
{field: 'taskTime', title: '任务时效', width: 310,sort: true},
|
||||
{field: 'createUser', title: '发布人', width: 120,sort: true},
|
||||
{field: 'createTime', title: '发布时间', width: 120,sort: true},
|
||||
{field: 'filePath', title: '二维码', width: 120,sort: true,templet:function (d){
|
||||
return '<a style="color: #00a2d4;cursor:pointer" onclick="looImage('+d.id+')">查看任务二维码</a>';
|
||||
{field: 'filePath', title: '二维码', width: 150,sort: true,templet:function (d){
|
||||
let image="`"+d.id+"@"+d.taskTitle+"`";
|
||||
return '<a style="color: #00a2d4;cursor:pointer" onclick="looImage('+image+')">查看任务二维码</a>';
|
||||
} },
|
||||
{title: '操作', width: 300, toolbar: '#tool'}
|
||||
]
|
||||
|
|
@ -207,12 +224,12 @@
|
|||
//时间组件
|
||||
laydate.render({
|
||||
elem: '#createTime'
|
||||
, type: 'times',
|
||||
, type: 'date',
|
||||
range: true //或 range: '到' 来自定义范围内的分隔字符
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#subTimes'
|
||||
, type: 'times',
|
||||
, type: 'date',
|
||||
range: true //或 range: '到' 来自定义范围内的分隔字符
|
||||
});
|
||||
laydate.render({
|
||||
|
|
@ -314,13 +331,73 @@
|
|||
taskInfoData(data.id);
|
||||
break;
|
||||
case 'tempUser':
|
||||
taskInfoData(data.id);
|
||||
//
|
||||
initTree(data.id);
|
||||
break;
|
||||
case 'previewImage':
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
function initTree(id){
|
||||
CoreUtil.sendGet(ctx + "option/task/user/" + id, null, function (res) {
|
||||
initTransfer(res.data);
|
||||
layer.open({
|
||||
type: 1,
|
||||
offset: '50px',
|
||||
skin: 'layui-layer-molv',
|
||||
title: "用户授权",
|
||||
area: ['600px', '600px'],
|
||||
shade: 0,
|
||||
shadeClose: false,
|
||||
content: $("#users"),
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
//获得右侧数据
|
||||
var users = [];
|
||||
var getData = transfer.getData('ownData');
|
||||
if (getData.length == 0) {
|
||||
layer.msg("请选择要授权的用户");
|
||||
} else {
|
||||
$(getData).each(function (index, item) {
|
||||
users.push(item.value);
|
||||
});
|
||||
}
|
||||
console.log(users)
|
||||
CoreUtil.sendPut(ctx + "option/task/user/" + id, users, function (res) {
|
||||
layer.msg(res.msg);
|
||||
tableIns1.reload();
|
||||
});
|
||||
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
var initTransfer = function (data) {
|
||||
console.log(data)
|
||||
transfer.render({
|
||||
elem: '#users'
|
||||
, data: data.userList
|
||||
, title: ['临时用户', '授权用户']
|
||||
, showSearch: true
|
||||
, value: data.ownRoles
|
||||
, id: 'ownData'
|
||||
, parseData: function (res) {
|
||||
return {
|
||||
"value": res.id //数据值
|
||||
, "title": res.username //数据标题
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
table.on('tool(option_info_table)', function (obj) {
|
||||
var data = obj.data;
|
||||
//删除和反馈
|
||||
|
|
@ -370,6 +447,10 @@
|
|||
content: $("#task_info_result"),
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
if($("#resultReason").val()==='' ||$("#resultReason").val()==null){
|
||||
return layer.msg("请填写回复意见");
|
||||
}
|
||||
|
||||
let formData={
|
||||
'id':data.id,
|
||||
'resultReason':$("#resultReason").val(),
|
||||
|
|
@ -492,7 +573,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
function resetForm() {
|
||||
form.val('taskInfo', {
|
||||
'id': '',
|
||||
|
|
@ -694,12 +774,66 @@
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
function openImage(id){
|
||||
alert(id)
|
||||
var openImage = function(id){
|
||||
formData={
|
||||
"id":id,
|
||||
"type":2
|
||||
}
|
||||
CoreUtil.sendPost(ctx + "option/getFilePath", formData, function (res) {
|
||||
if(res.data){
|
||||
console.log(res.data[0])
|
||||
if(res.data.length<1){
|
||||
layer.msg("暂无图片");
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById('seeFile').src = res.data[nowIndex];
|
||||
let x_l='800px'
|
||||
console.log(res.data.length)
|
||||
if(res.data.length>1){
|
||||
x_l='1000px'
|
||||
$(".next").show();
|
||||
}else{
|
||||
$(".next").hide();
|
||||
|
||||
}
|
||||
|
||||
fileList=res.data
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '意见图片',
|
||||
closeBtn: true,
|
||||
area: [x_l,'800px'],
|
||||
content: $("#look_file_all")
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function looImage(id){
|
||||
function next(type){
|
||||
let allL= fileList.length-1;
|
||||
console.log(type);
|
||||
if(type===1){
|
||||
if(nowIndex===0){
|
||||
nowIndex=allL;
|
||||
}else{
|
||||
nowIndex=nowIndex-1;
|
||||
}
|
||||
}else{
|
||||
if(nowIndex===allL){
|
||||
nowIndex=0;
|
||||
}else{
|
||||
nowIndex=nowIndex+1;
|
||||
}
|
||||
}
|
||||
document.getElementById('seeFile').src = fileList[nowIndex];
|
||||
}
|
||||
function looImage(ids){
|
||||
let id=ids.split("@")[0];
|
||||
let title=ids.split("@")[1];
|
||||
formData={
|
||||
"id":id,
|
||||
"type":1
|
||||
|
|
@ -707,10 +841,11 @@
|
|||
CoreUtil.sendPost(ctx + "option/getFilePath", formData, function (res) {
|
||||
if(res.data){
|
||||
console.log( res.data[0])
|
||||
$("#thisFileName").val(title);
|
||||
document.getElementById('lookFilePath').src = res.data[0];
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '二维码',
|
||||
title: title+'-二维码',
|
||||
closeBtn: true,
|
||||
area: ['300px','400px'],
|
||||
content: $("#look_file")
|
||||
|
|
@ -719,11 +854,11 @@
|
|||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
function downloadImage() {
|
||||
var imageUrl=document.getElementById('lookFilePath').src;
|
||||
var name="二维码";
|
||||
var title=$("#thisFileName").val();
|
||||
var name=title+"-二维码";
|
||||
const image = new Image();
|
||||
// 解决跨域 Canvas 污染问题
|
||||
image.setAttribute('crossOrigin', 'anonymous');
|
||||
|
|
@ -748,7 +883,33 @@ function downloadImage() {
|
|||
};
|
||||
image.src = imageUrl;
|
||||
}
|
||||
function downloadImage2() {
|
||||
var imageUrl=document.getElementById('seeFile').src;
|
||||
var name="意见图片";
|
||||
const image = new Image();
|
||||
// 解决跨域 Canvas 污染问题
|
||||
image.setAttribute('crossOrigin', 'anonymous');
|
||||
image.onload = function () {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
const context = canvas.getContext('2d');
|
||||
context.drawImage(image, 0, 0, image.width, image.height);
|
||||
// 得到图片的base64编码数据
|
||||
const url = canvas.toDataURL('image/png');
|
||||
|
||||
// 生成一个a元素
|
||||
const a = document.createElement('a');
|
||||
// 创建一个单击事件
|
||||
const event = new MouseEvent('click');
|
||||
a.download = name;
|
||||
// 将生成的URL设置为a.href属性
|
||||
a.href = url;
|
||||
// 触发a的单击事件
|
||||
a.dispatchEvent(event);
|
||||
};
|
||||
image.src = imageUrl;
|
||||
}
|
||||
function getPermissionIds(jsonObj, permissionIds) {
|
||||
if (jsonObj == undefined || jsonObj == null || !jsonObj instanceof Object) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,6 @@
|
|||
if (getData.length == 0) {
|
||||
layer.msg("请选择要赋予用户的角色");
|
||||
} else {
|
||||
|
||||
$(getData).each(function (index, item) {
|
||||
roleIds.push(item.value);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue