Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
450f8ce1c9
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.imgTool.Enum;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum FileSourceTypeEnum {
|
||||
|
||||
FILE_SOURCE_TYPE_1("1", "安全违章-违章照片"),
|
||||
FILE_SOURCE_TYPE_2("2", "安全违章-整改照片"),
|
||||
FILE_SOURCE_TYPE_3("3", "质量检查-缺陷问题照片"),
|
||||
FILE_SOURCE_TYPE_4("4", "质量检查-整改照片"),
|
||||
FILE_SOURCE_TYPE_5("5", "安全措施落实-现场照片"),
|
||||
FILE_SOURCE_TYPE_6("6", "协调照片-建设前"),
|
||||
FILE_SOURCE_TYPE_7("7", "协调照片-建设中"),
|
||||
FILE_SOURCE_TYPE_8("8", "协调照片-恢复后"),
|
||||
FILE_SOURCE_TYPE_9("9", "重要事项及宣传-照片");
|
||||
private final String status;
|
||||
private final String statusName;
|
||||
|
||||
FileSourceTypeEnum(String status, String statusName) {
|
||||
this.status = status;
|
||||
this.statusName = statusName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -14,6 +14,8 @@ import java.util.List;
|
|||
@Data
|
||||
public class QueryParamDto {
|
||||
|
||||
private String imgPath;
|
||||
|
||||
/**
|
||||
* 1.我的收藏 2.最近上传
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -54,4 +54,7 @@ public class SynthesisQueryVo {
|
|||
* 收藏状态 0.未收藏 1.已收藏
|
||||
*/
|
||||
private String collectStatus;
|
||||
|
||||
/**重要事项宣传类标题*/
|
||||
private String title;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.bonus.imgTool.imageUpload.controller;
|
||||
|
||||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||
import com.bonus.imgTool.annotation.LogAnnotation;
|
||||
import com.bonus.imgTool.backstage.entity.QueryParamDto;
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresReqVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo;
|
||||
import com.bonus.imgTool.imageUpload.service.SafetyMeasuresService;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 安全措施落实
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/safetyMeasure")
|
||||
public class SafetyMeasuresController {
|
||||
|
||||
@Resource
|
||||
private SafetyMeasuresService safetyMeasuresService;
|
||||
|
||||
|
||||
/**
|
||||
* 安全措施落实获取列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/getSafetyMeasuresList")
|
||||
@DecryptAndVerify(decryptedClass = SafetyMeasuresReqVo.class)
|
||||
@LogAnnotation(operModul = "安全措施落实-查询", operation = "查询照片", operDesc = "系统级事件",operType="查询")
|
||||
public ServerResponse getSafetyMeasuresList(EncryptedReq<SafetyMeasuresReqVo> data) {
|
||||
return safetyMeasuresService.getSafetyMeasuresList(data.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全措施落实删除
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteSafetyMeasures")
|
||||
@DecryptAndVerify(decryptedClass = SafetyMeasuresReqVo.class)
|
||||
@LogAnnotation(operModul = "安全措施落实-删除", operation = "查询照片", operDesc = "系统级事件",operType="查询")
|
||||
public ServerResponse deleteSafetyMeasures(EncryptedReq<SafetyMeasuresReqVo> data) {
|
||||
return safetyMeasuresService.deleteSafetyMeasures(data.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全措施落实新增
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addSafetyMeasures")
|
||||
@DecryptAndVerify(decryptedClass = SafetyMeasuresVo.class)
|
||||
@LogAnnotation(operModul = "安全措施落实-新增", operation = "查询照片", operDesc = "系统级事件",operType="查询")
|
||||
public ServerResponse addSafetyMeasures(EncryptedReq<SafetyMeasuresVo> data) {
|
||||
return safetyMeasuresService.addSafetyMeasures(data.getData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.imgTool.imageUpload.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SafetyMeasuresReqVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Long proId;
|
||||
|
||||
/**
|
||||
* 专业id
|
||||
*/
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private Long gxId;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
private int pageNum = 1;
|
||||
private int pageSize = 15;
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.bonus.imgTool.imageUpload.dto;
|
||||
|
||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SafetyMeasuresVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Long proId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 专业id
|
||||
*/
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private Long gxId;
|
||||
|
||||
/**
|
||||
* 工序名称
|
||||
*/
|
||||
private String gxName;
|
||||
|
||||
/**
|
||||
* 检查人
|
||||
*/
|
||||
private String checkUserName;
|
||||
|
||||
/**
|
||||
* 检查时间
|
||||
*/
|
||||
private Date checkDate;
|
||||
|
||||
/**
|
||||
* 检查地点
|
||||
*/
|
||||
private String checkPlace;
|
||||
|
||||
/**
|
||||
* 违章描述
|
||||
*/
|
||||
private String checkDesc;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 数据来源 1.web 2.app
|
||||
*/
|
||||
private String dataSource;
|
||||
|
||||
/**
|
||||
* 图片信息
|
||||
*/
|
||||
private List<SysFileResourceVo> sysFileResourceList;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.imgTool.imageUpload.mapper;
|
||||
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresReqVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SafetyMeasuresMapper {
|
||||
List<SafetyMeasuresVo> getSafetyMeasuresList(SafetyMeasuresReqVo data);
|
||||
|
||||
void deleteSafetyMeasures(SafetyMeasuresReqVo data);
|
||||
|
||||
|
||||
void addSafetyMeasures(SafetyMeasuresVo data);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.imgTool.imageUpload.service;
|
||||
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresReqVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
|
||||
public interface SafetyMeasuresService {
|
||||
ServerResponse getSafetyMeasuresList(SafetyMeasuresReqVo data);
|
||||
|
||||
ServerResponse deleteSafetyMeasures(SafetyMeasuresReqVo data);
|
||||
|
||||
ServerResponse addSafetyMeasures(SafetyMeasuresVo data);
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.bonus.imgTool.imageUpload.service.impl;
|
||||
|
||||
import com.bonus.imgTool.Enum.FileSourceTypeEnum;
|
||||
import com.bonus.imgTool.backstage.entity.SynthesisQueryVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresReqVo;
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo;
|
||||
import com.bonus.imgTool.imageUpload.mapper.SafetyMeasuresMapper;
|
||||
import com.bonus.imgTool.imageUpload.service.SafetyMeasuresService;
|
||||
import com.bonus.imgTool.system.dao.SysFileResourceDao;
|
||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.bonus.imgTool.utils.UserUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class SafetyMeasuresServiceImpl implements SafetyMeasuresService {
|
||||
|
||||
@Resource
|
||||
private SafetyMeasuresMapper safetyMeasuresMapper;
|
||||
|
||||
@Resource
|
||||
private SysFileResourceDao sysFileResourceDao;
|
||||
|
||||
/**
|
||||
* 安全措施落实获取列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse getSafetyMeasuresList(SafetyMeasuresReqVo data) {
|
||||
PageHelper.startPage(data.getPageNum(), data.getPageSize());
|
||||
try {
|
||||
List<SafetyMeasuresVo> list = safetyMeasuresMapper.getSafetyMeasuresList(data);
|
||||
//获取图片信息
|
||||
for (SafetyMeasuresVo safetyMeasuresVo : list) {
|
||||
List<SysFileResourceVo> sysFileResourceList = sysFileResourceDao.getSysFileResourceList(safetyMeasuresVo.getId());
|
||||
safetyMeasuresVo.setSysFileResourceList(sysFileResourceList);
|
||||
}
|
||||
PageInfo<SafetyMeasuresVo> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccess(pageInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全措施落实删除--这里是逻辑删除
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse deleteSafetyMeasures(SafetyMeasuresReqVo data) {
|
||||
try {
|
||||
safetyMeasuresMapper.deleteSafetyMeasures(data);
|
||||
sysFileResourceDao.deleteFileResource(data);
|
||||
return ServerResponse.createSuccess();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全措施落实新增
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse addSafetyMeasures(SafetyMeasuresVo data) {
|
||||
try {
|
||||
//保存
|
||||
safetyMeasuresMapper.addSafetyMeasures(data);
|
||||
//保存附件
|
||||
List<SysFileResourceVo> sysFileResourceList = data.getSysFileResourceList();
|
||||
for (SysFileResourceVo sysFileResourceVo: sysFileResourceList ) {
|
||||
sysFileResourceVo.setSourceId(data.getId());
|
||||
sysFileResourceVo.setUploadType("3");
|
||||
sysFileResourceVo.setSourceType(FileSourceTypeEnum.FILE_SOURCE_TYPE_5.getStatus());
|
||||
sysFileResourceVo.setSourceTypeName(FileSourceTypeEnum.FILE_SOURCE_TYPE_5.getStatusName());
|
||||
sysFileResourceVo.setCreateUser(UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getId() : 0);
|
||||
sysFileResourceVo.setCreateUserName(UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getNewUser():null);
|
||||
sysFileResourceDao.addSysFileResource(sysFileResourceVo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
}
|
||||
return ServerResponse.createSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
package com.bonus.imgTool.model;
|
||||
|
||||
import com.bonus.imgTool.base.entity.PageEntity;
|
||||
import com.bonus.imgTool.system.vo.SelectVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SysUser extends PageEntity {
|
||||
|
|
@ -149,6 +151,16 @@ public class SysUser extends PageEntity {
|
|||
* 签字路径
|
||||
*/
|
||||
private String signImg;
|
||||
private List<SelectVo> projects;
|
||||
/**
|
||||
* 绑定工程
|
||||
*/
|
||||
private String project;
|
||||
/**
|
||||
* 角色级别
|
||||
*/
|
||||
private String levelName;
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 角色级别
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bonus.imgTool.system.controller;
|
||||
|
||||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||
import com.bonus.imgTool.backstage.entity.QueryParamDto;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.utils.ImageDownloadHandler;
|
||||
import com.bonus.imgTool.utils.SystemUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* @className:FileDownLoadController
|
||||
* @author:cwchen
|
||||
* @date:2025-04-02-17:21
|
||||
* @version:1.0
|
||||
* @description:文件下载
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/download/")
|
||||
@Slf4j
|
||||
public class FileDownLoadController {
|
||||
|
||||
@ApiOperation("原图下载")
|
||||
@GetMapping("/downloadImage")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
public void downloadImage(HttpServletRequest request, HttpServletResponse response, EncryptedReq<QueryParamDto> dto) {
|
||||
String basicPath = SystemUtils.getUploadPath();
|
||||
String imgPath = dto.getData().getImgPath();
|
||||
ImageDownloadHandler.downloadImage(basicPath +File.separator+ imgPath, response, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -73,6 +73,18 @@ public class SelectController {
|
|||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
@GetMapping(value = "getProjectSelect")
|
||||
@DecryptAndVerify(decryptedClass = SelectDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "工程查询", operation = "下拉框", operDesc = "系统级事件",operType="查询")
|
||||
public ServerResponse getProjectSelect(EncryptedReq<SelectDto> data) {
|
||||
try {
|
||||
List<SelectVo> list = service.getProjectSelect(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
|
||||
private void setDictsList(Long pId, List<Dict> dictsAll, List<Dict> list) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ import java.util.Objects;
|
|||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||
import com.bonus.imgTool.model.Role;
|
||||
import com.bonus.imgTool.system.dao.UserDao;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.system.vo.Org;
|
||||
import com.bonus.imgTool.system.vo.SysMenuVo;
|
||||
import com.bonus.imgTool.system.vo.UserDto;
|
||||
import com.bonus.imgTool.system.vo.*;
|
||||
import com.bonus.imgTool.model.PasswordConfig;
|
||||
import com.bonus.imgTool.model.SysUser;
|
||||
import com.bonus.imgTool.system.service.UserService;
|
||||
|
|
@ -140,13 +137,14 @@ public class UserController {
|
|||
if (u != null && !Objects.equals(data.getData().getId(), u.getId())) {
|
||||
return ServerResponse.createErroe(data.getData().getLoginName() + "已存在");
|
||||
}
|
||||
if(StringHelper.isNotEmpty(data.getData().getPhone())){
|
||||
/* if(StringHelper.isNotEmpty(data.getData().getPhone())){
|
||||
SysUser u2 = userService.getPhone(data.getData().getPhone());
|
||||
if (u2 != null && !Objects.equals(data.getData().getId(), u2.getId())) {
|
||||
return ServerResponse.createErroe("手机号"+data.getData().getPhone() + "已存在");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
userService.updateUser(data.getData());
|
||||
// 先删除对应的工程再新增
|
||||
return ServerResponse.createBySuccessMsg("操作成功");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
|
|
@ -168,6 +166,18 @@ public class UserController {
|
|||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
@PostMapping(value = "checkPassword")
|
||||
@DecryptAndVerify(decryptedClass = SysUser.class)
|
||||
@LogAnnotation(operModul = "系统管理-用户管理", operation = "校验用户名密码", operDesc = "系统级事件",operType="查询")
|
||||
public ServerResponse checkPassword(EncryptedReq<SysUser> data) {
|
||||
try {
|
||||
ServerResponse response = userService.checkPassword(data.getData());
|
||||
return response;
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "password")
|
||||
|
|
@ -214,7 +224,9 @@ public class UserController {
|
|||
public ServerResponse user(EncryptedReq<UserDto> data) {
|
||||
try {
|
||||
UserDto userDto = userService.getById(data.getData().getId());
|
||||
String loginType = userDto.getLoginType();
|
||||
List<SelectVo> projects = userService.getProjects(userDto);
|
||||
userDto.setProjects(projects);
|
||||
/*String loginType = userDto.getLoginType();
|
||||
if (loginType != null && !loginType.isEmpty()){
|
||||
String[] loginTypeArr = loginType.split(",");
|
||||
List<Long> loginTypes = new ArrayList<>();
|
||||
|
|
@ -222,7 +234,7 @@ public class UserController {
|
|||
loginTypes.add(Long.parseLong(type.trim()));
|
||||
}
|
||||
userDto.setLoginTypes(loginTypes);
|
||||
}
|
||||
}*/
|
||||
return ServerResponse.createSuccess(userDto);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
|
|
|
|||
|
|
@ -14,4 +14,6 @@ public interface SelectDao {
|
|||
List<SelectVo> getProfessionSelect(SelectDto data);
|
||||
|
||||
List<SelectVo> getProcessSelect(SelectDto data);
|
||||
|
||||
List<SelectVo> getProjectSelect(SelectDto data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.imgTool.system.dao;
|
||||
|
||||
import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresReqVo;
|
||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface SysFileResourceDao {
|
||||
|
||||
void deleteFileResource(SafetyMeasuresReqVo data);
|
||||
|
||||
List<SysFileResourceVo> getSysFileResourceList(Long id);
|
||||
|
||||
void addSysFileResource(SysFileResourceVo sysFileResourceVo);
|
||||
}
|
||||
|
|
@ -5,10 +5,7 @@ import java.util.Map;
|
|||
|
||||
import com.bonus.imgTool.base.entity.DtreeVo;
|
||||
import com.bonus.imgTool.model.Role;
|
||||
import com.bonus.imgTool.system.vo.LoginUser;
|
||||
import com.bonus.imgTool.system.vo.Org;
|
||||
import com.bonus.imgTool.system.vo.SysMenuVo;
|
||||
import com.bonus.imgTool.system.vo.UserDto;
|
||||
import com.bonus.imgTool.system.vo.*;
|
||||
import com.bonus.imgTool.model.PasswordConfig;
|
||||
import com.bonus.imgTool.model.SysUser;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
|
|
@ -197,4 +194,10 @@ public interface UserDao {
|
|||
* @return
|
||||
*/
|
||||
List<SysUser> getPersonList(SysUser data);
|
||||
|
||||
Integer deleteUserProject(Long id);
|
||||
|
||||
Integer saveUserProject(@Param("userId") Long id, @Param("proId")String proId);
|
||||
|
||||
List<SelectVo> getProjects(UserDto userDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ public interface SelectService {
|
|||
List<SelectVo> getProfessionSelect(SelectDto data);
|
||||
|
||||
List<SelectVo> getProcessSelect(SelectDto data);
|
||||
|
||||
List<SelectVo> getProjectSelect(SelectDto data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.imgTool.system.service;
|
|||
|
||||
import com.bonus.imgTool.model.Role;
|
||||
import com.bonus.imgTool.system.vo.Org;
|
||||
import com.bonus.imgTool.system.vo.SelectVo;
|
||||
import com.bonus.imgTool.system.vo.SysMenuVo;
|
||||
import com.bonus.imgTool.system.vo.UserDto;
|
||||
import com.bonus.imgTool.model.PasswordConfig;
|
||||
|
|
@ -51,9 +52,8 @@ public interface UserService {
|
|||
* @param user
|
||||
* @return
|
||||
*/
|
||||
default ServerResponse changePassword(SysUser user) {
|
||||
return null;
|
||||
}
|
||||
ServerResponse changePassword(SysUser user);
|
||||
ServerResponse checkPassword(SysUser user);
|
||||
|
||||
/**
|
||||
* 管理员修改密码
|
||||
|
|
@ -168,4 +168,6 @@ public interface UserService {
|
|||
* @return
|
||||
*/
|
||||
List<SysUser> getPersonList(SysUser data);
|
||||
|
||||
List<SelectVo> getProjects(UserDto userDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,4 +40,9 @@ public class SelectServiceImpl implements SelectService {
|
|||
public List<SelectVo> getProcessSelect(SelectDto data) {
|
||||
return dao.getProcessSelect(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectVo> getProjectSelect(SelectDto data) {
|
||||
return dao.getProjectSelect(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import com.bonus.imgTool.base.entity.DtreeVo;
|
|||
import com.bonus.imgTool.model.Role;
|
||||
import com.bonus.imgTool.system.vo.Org;
|
||||
import com.bonus.imgTool.model.PasswordConfig;
|
||||
import com.bonus.imgTool.system.vo.SelectVo;
|
||||
import com.bonus.imgTool.system.vo.SysMenuVo;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.bonus.imgTool.utils.StringHelper;
|
||||
import com.bonus.imgTool.utils.UserUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -33,258 +35,295 @@ import javax.annotation.Resource;
|
|||
public class UserServiceImpl implements UserService {
|
||||
|
||||
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
@Autowired
|
||||
private BCryptPasswordEncoder passwordEncoder;
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
@Autowired
|
||||
private BCryptPasswordEncoder passwordEncoder;
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse saveUser(UserDto userDto) {
|
||||
try{
|
||||
SysUser user = userDto;
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
int num=userDao.saveUser(user);
|
||||
if(num>0){
|
||||
return ServerResponse.createSuccess("新增成功",num);
|
||||
}else{
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("新增失败,数据异常");
|
||||
}
|
||||
private void saveUserRoles(Long userId, List<Long> roleIds) {
|
||||
if (roleIds != null) {
|
||||
userDao.deleteUserRole(userId);
|
||||
if (!CollectionUtils.isEmpty(roleIds)) {
|
||||
userDao.saveUserRoles(userId, roleIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse saveUser(UserDto userDto) {
|
||||
try {
|
||||
String project = userDto.getProject();
|
||||
SysUser user = userDto;
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
int num = userDao.saveUser(user);
|
||||
if (StringUtils.isNotBlank(project)){
|
||||
for (String proId : project.split(",")) {
|
||||
// 新增工程
|
||||
userDao.saveUserProject(userDto.getId(), proId);
|
||||
}
|
||||
}
|
||||
if (num > 0) {
|
||||
return ServerResponse.createSuccess("新增成功", num);
|
||||
} else {
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("新增失败,数据异常");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser getUser(String loginName) {
|
||||
try{
|
||||
return userDao.getUser(loginName);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private void saveUserRoles(Long userId, List<Long> roleIds) {
|
||||
if (roleIds != null) {
|
||||
userDao.deleteUserRole(userId);
|
||||
if (!CollectionUtils.isEmpty(roleIds)) {
|
||||
userDao.saveUserRoles(userId, roleIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser getUserCode(String userCode) {
|
||||
try{
|
||||
return userDao.getUserCode(userCode);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public SysUser getUser(String loginName) {
|
||||
try {
|
||||
return userDao.getUser(loginName);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse changePassword(SysUser user) {
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
UserDto bean = userDao.getById(userId);
|
||||
SysUser u = userDao.getUser(bean.getLoginName());
|
||||
if (u == null) {
|
||||
return ServerResponse.createErroe("用户不存在");
|
||||
}
|
||||
if (!passwordEncoder.matches(user.getOldP(), u.getPassword())) {
|
||||
return ServerResponse.createErroe("旧密码错误");
|
||||
}
|
||||
userDao.changePassword(u.getId(), passwordEncoder.encode(user.getNewP1()));
|
||||
return ServerResponse.createBySuccessMsg("修改成功");
|
||||
}
|
||||
@Override
|
||||
public SysUser getUserCode(String userCode) {
|
||||
try {
|
||||
return userDao.getUserCode(userCode);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void password(SysUser user) {
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
userDao.password(user);
|
||||
}
|
||||
@Override
|
||||
public ServerResponse changePassword(SysUser user) {
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
UserDto bean = userDao.getById(userId);
|
||||
SysUser u = userDao.getUser(bean.getLoginName());
|
||||
if (u == null) {
|
||||
return ServerResponse.createErroe("用户不存在");
|
||||
}
|
||||
if (!passwordEncoder.matches(user.getOldP(), u.getPassword())) {
|
||||
return ServerResponse.createErroe("旧密码错误");
|
||||
}
|
||||
userDao.changePassword(u.getId(), passwordEncoder.encode(user.getNewP1()));
|
||||
return ServerResponse.createBySuccessMsg("修改成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> params) {
|
||||
return userDao.count(params);
|
||||
}
|
||||
@Override
|
||||
public ServerResponse checkPassword(SysUser user) {
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
UserDto bean = userDao.getById(userId);
|
||||
SysUser u = userDao.getUser(bean.getLoginName());
|
||||
if (u == null) {
|
||||
return ServerResponse.createByErrorMsg(500,"用户不存在");
|
||||
}
|
||||
if (!passwordEncoder.matches(user.getOldP(), u.getPassword())) {
|
||||
return ServerResponse.createByErrorMsg(500,"旧密码错误");
|
||||
}
|
||||
return ServerResponse.createSuccess("校验成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> list(SysUser user) {
|
||||
List<SysUser> list = userDao.list(user);
|
||||
if (list.size()>0){
|
||||
for (SysUser users : list){
|
||||
//如果班组为不空,则拼接;否则只展示组织
|
||||
if (StringHelper.isNotEmpty(users.getTeamName())){
|
||||
users.setOrgName(users.getOrgName()+"/"+users.getTeamName());
|
||||
}
|
||||
if (StringHelper.isNotEmpty(users.getSignImg())){
|
||||
users.setSignStatus("已签");
|
||||
} else {
|
||||
users.setSignStatus("未签");
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Override
|
||||
public void password(SysUser user) {
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
userDao.password(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户详情
|
||||
*/
|
||||
@Override
|
||||
public UserDto getById(Long id) {
|
||||
return userDao.getById(id);
|
||||
}
|
||||
@Override
|
||||
public int count(Map<String, Object> params) {
|
||||
return userDao.count(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delUser(Long id) {
|
||||
return userDao.delUser(id);
|
||||
}
|
||||
/**
|
||||
* 查询用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> list(SysUser user) {
|
||||
List<SysUser> list = userDao.list(user);
|
||||
if (list.size() > 0) {
|
||||
for (SysUser users : list) {
|
||||
//如果班组为不空,则拼接;否则只展示组织
|
||||
if (StringHelper.isNotEmpty(users.getTeamName())) {
|
||||
users.setOrgName(users.getOrgName() + "/" + users.getTeamName());
|
||||
}
|
||||
if (StringHelper.isNotEmpty(users.getSignImg())) {
|
||||
users.setSignStatus("已签");
|
||||
} else {
|
||||
users.setSignStatus("未签");
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PasswordConfig getPasswordConfigById() {
|
||||
return userDao.getPasswordConfigById();
|
||||
}
|
||||
/**
|
||||
* 查询用户详情
|
||||
*/
|
||||
@Override
|
||||
public UserDto getById(Long id) {
|
||||
return userDao.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Org> getOrg() {
|
||||
return userDao.getOrg();
|
||||
}
|
||||
@Override
|
||||
public int delUser(Long id) {
|
||||
return userDao.delUser(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser getPhone(String phone) {
|
||||
return userDao.getPhone(phone);
|
||||
}
|
||||
@Override
|
||||
public PasswordConfig getPasswordConfigById() {
|
||||
return userDao.getPasswordConfigById();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询锁定的用户
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getLockUser(String state,String type) {
|
||||
try{
|
||||
return userDao.getLockUser(state, type);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public List<Org> getOrg() {
|
||||
return userDao.getOrg();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserState(String loginName, String state,String delFlag,Long id) {
|
||||
try{
|
||||
userDao.updateUserState(loginName, state,delFlag, id);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public SysUser getPhone(String phone) {
|
||||
return userDao.getPhone(phone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse getOrgTree() {
|
||||
List<DtreeVo> list = null;
|
||||
try {
|
||||
list = userDao.getOrgTree();
|
||||
} catch (Exception e) {
|
||||
log.error("单位部门树", e);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询成功", list);
|
||||
}
|
||||
/**
|
||||
* 查询锁定的用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getLockUser(String state, String type) {
|
||||
try {
|
||||
return userDao.getLockUser(state, type);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改启用状态
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse updateEnableState(UserDto data) {
|
||||
try {
|
||||
if (data.getId() == 0 || data.getState() == null) {
|
||||
return ServerResponse.createErroe("参数不能为空");
|
||||
} else {
|
||||
int num = userDao.updateEnableState(data);
|
||||
if (num == 1) {
|
||||
if (data.getState()==1) {
|
||||
return ServerResponse.createSuccess("开启成功");
|
||||
}
|
||||
return ServerResponse.createSuccess("关闭成功");
|
||||
} else {
|
||||
return ServerResponse.createErroe("设置失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("参数异常,请联系管理员");
|
||||
}
|
||||
@Override
|
||||
public void updateUserState(String loginName, String state, String delFlag, Long id) {
|
||||
try {
|
||||
userDao.updateUserState(loginName, state, delFlag, id);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Role> getRoleAll() {
|
||||
return userDao.getRoleAll();
|
||||
}
|
||||
@Override
|
||||
public ServerResponse getOrgTree() {
|
||||
List<DtreeVo> list = null;
|
||||
try {
|
||||
list = userDao.getOrgTree();
|
||||
} catch (Exception e) {
|
||||
log.error("单位部门树", e);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询成功", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色下App权限菜单
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenuVo> getRoleAppAuth() {
|
||||
//获取当前登录用户角色编码
|
||||
String roleCode = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getRoleCode() : "";
|
||||
return userDao.getRoleAppAuth(roleCode);
|
||||
}
|
||||
/**
|
||||
* 修改启用状态
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse updateEnableState(UserDto data) {
|
||||
try {
|
||||
if (data.getId() == 0 || data.getState() == null) {
|
||||
return ServerResponse.createErroe("参数不能为空");
|
||||
} else {
|
||||
int num = userDao.updateEnableState(data);
|
||||
if (num == 1) {
|
||||
if (data.getState() == 1) {
|
||||
return ServerResponse.createSuccess("开启成功");
|
||||
}
|
||||
return ServerResponse.createSuccess("关闭成功");
|
||||
} else {
|
||||
return ServerResponse.createErroe("设置失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("参数异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存签名
|
||||
*/
|
||||
@Override
|
||||
public int updateSign(UserDto userDto) {
|
||||
return userDao.updateSign(userDto);
|
||||
}
|
||||
@Override
|
||||
public List<Role> getRoleAll() {
|
||||
return userDao.getRoleAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delSignById(Long id) {
|
||||
return userDao.delSignById(id);
|
||||
}
|
||||
/**
|
||||
* 获取角色下App权限菜单
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenuVo> getRoleAppAuth() {
|
||||
//获取当前登录用户角色编码
|
||||
String roleCode = UserUtil.getLoginUser() != null ? UserUtil.getLoginUser().getRoleCode() : "";
|
||||
return userDao.getRoleAppAuth(roleCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> getPersonList(SysUser data) {
|
||||
//获取登录人id
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
data.setId(userId);
|
||||
List<SysUser> list = userDao.getPersonList(data);
|
||||
if (list.size() > 0) {
|
||||
for (SysUser users : list) {
|
||||
if (StringHelper.isNotEmpty(users.getSignImg())) {
|
||||
users.setSignStatus("已签");
|
||||
} else {
|
||||
users.setSignStatus("未签");
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 保存签名
|
||||
*/
|
||||
@Override
|
||||
public int updateSign(UserDto userDto) {
|
||||
return userDao.updateSign(userDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public SysUser updateUser(UserDto userDto) {
|
||||
if (userDto.getRoleId().isEmpty()){
|
||||
userDto.setRoleId(null);
|
||||
}
|
||||
if (StringHelper.isEmpty(userDto.getTeamId())){
|
||||
userDto.setTeamId(null);
|
||||
}
|
||||
userDao.update(userDto);
|
||||
//saveUserRoles(userDto.getId(), userDto.getRoleIds());
|
||||
@Override
|
||||
public int delSignById(Long id) {
|
||||
return userDao.delSignById(id);
|
||||
}
|
||||
|
||||
return userDto;
|
||||
}
|
||||
@Override
|
||||
public List<SysUser> getPersonList(SysUser data) {
|
||||
//获取登录人id
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
data.setId(userId);
|
||||
List<SysUser> list = userDao.getPersonList(data);
|
||||
if (list.size() > 0) {
|
||||
for (SysUser users : list) {
|
||||
if (StringHelper.isNotEmpty(users.getSignImg())) {
|
||||
users.setSignStatus("已签");
|
||||
} else {
|
||||
users.setSignStatus("未签");
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectVo> getProjects(UserDto userDto) {
|
||||
return userDao.getProjects(userDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public SysUser updateUser(UserDto userDto) {
|
||||
String project = userDto.getProject();
|
||||
if (userDto.getRoleId().isEmpty()) {
|
||||
userDto.setRoleId(null);
|
||||
}
|
||||
if (StringHelper.isEmpty(userDto.getTeamId())) {
|
||||
userDto.setTeamId(null);
|
||||
}
|
||||
userDao.update(userDto);
|
||||
// saveUserRoles(userDto.getId(), userDto.getRoleIds());
|
||||
// 先删除之前绑定的工程
|
||||
userDao.deleteUserProject(userDto.getId());
|
||||
if (StringUtils.isNotBlank(project)){
|
||||
for (String proId : project.split(",")) {
|
||||
// 在新增修改后的工程
|
||||
userDao.saveUserProject(userDto.getId(), proId);
|
||||
}
|
||||
}
|
||||
return userDto;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.imgTool.system.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SysFileResourceVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 文件大小 Mb单位
|
||||
*/
|
||||
private BigDecimal fileSize;
|
||||
|
||||
/**
|
||||
* 原图图片路径
|
||||
*/
|
||||
private String originalFilePath;
|
||||
|
||||
/**
|
||||
* 压缩图片路径
|
||||
*/
|
||||
private String compressFilePath;
|
||||
|
||||
/**
|
||||
* 图片水印路径
|
||||
*/
|
||||
private String watermarkFilePath;
|
||||
|
||||
/**
|
||||
* 文件类型 1.图片 2.文件
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 资源id(安全违章ID、质量检查ID、3.安全措施落实ID、协调照片ID、重要事项及宣传照片ID)
|
||||
*/
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* 上传类型 1.安全违章、2.质量检查、3.安全措施落实、4.协调照片、5.重要事项及宣传照片
|
||||
*/
|
||||
private String uploadType;
|
||||
|
||||
/**
|
||||
* 资源类型 码表配置(照片类型或阶段)
|
||||
*/
|
||||
private String sourceType;
|
||||
|
||||
/**
|
||||
* 资源类型名称
|
||||
*/
|
||||
private String sourceTypeName;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUser;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUserName;
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.bonus.imgTool.utils;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
/**
|
||||
* @className:ImageDownloadHandler
|
||||
* @author:cwchen
|
||||
* @date:2025-04-02-17:30
|
||||
* @version:1.0
|
||||
* @description: 图片下载器
|
||||
*/
|
||||
public class ImageDownloadHandler {
|
||||
|
||||
/**
|
||||
* 根据图片路径读取图片并返回到浏览器下载
|
||||
* @param imagePath 图片路径
|
||||
* @param response HttpServletResponse对象
|
||||
* @param download 是否作为附件下载(true-下载, false-直接显示)
|
||||
*/
|
||||
public static void downloadImage(String imagePath, HttpServletResponse response, boolean download) {
|
||||
try {
|
||||
Path path = Paths.get(imagePath);
|
||||
|
||||
// 1. 检查文件是否存在
|
||||
if (!Files.exists(path)) {
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND, "图片不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 检查是否是文件
|
||||
if (!Files.isRegularFile(path)) {
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "路径不是有效的文件");
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 获取文件类型并设置Content-Type
|
||||
String contentType = determineContentType(imagePath);
|
||||
if (contentType == null) {
|
||||
response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "不支持的图片格式");
|
||||
return;
|
||||
}
|
||||
response.setContentType(contentType);
|
||||
|
||||
// 4. 设置响应头
|
||||
String fileName = path.getFileName().toString();
|
||||
if (download) {
|
||||
// 作为附件下载
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\"" + fileName + "\"");
|
||||
} else {
|
||||
// 直接显示在浏览器
|
||||
response.setHeader("Content-Disposition",
|
||||
"inline; filename=\"" + fileName + "\"");
|
||||
}
|
||||
|
||||
// 5. 设置缓存控制
|
||||
// response.setHeader("Cache-Control", "max-age=3600"); // 1小时缓存
|
||||
|
||||
// 6. 读取文件并写入响应输出流
|
||||
try (InputStream in = Files.newInputStream(path);
|
||||
OutputStream out = response.getOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
out.flush();
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||
"读取图片时发生错误: " + e.getMessage());
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件扩展名确定Content-Type
|
||||
*/
|
||||
private static String determineContentType(String filePath) {
|
||||
String extension = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();
|
||||
switch (extension) {
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
return "image/jpeg";
|
||||
case "png":
|
||||
return "image/png";
|
||||
case "gif":
|
||||
return "image/gif";
|
||||
case "webp":
|
||||
return "image/webp";
|
||||
case "bmp":
|
||||
return "image/bmp";
|
||||
case "svg":
|
||||
return "image/svg+xml";
|
||||
case "ico":
|
||||
return "image/x-icon";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,9 +101,9 @@ public class PicUtils {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
byte[] bytes = compressPicForScale(FileTobyte(new File("L:\\其他\\测试图片\\6.jpg")), 200);
|
||||
String newFileName = IDUtils.createID() + ".jpg";
|
||||
File fOut = new File("L:\\新建文件夹\\" + newFileName);
|
||||
byte[] bytes = compressPicForScale(FileTobyte(new File("L:\\yn_img\\files\\yt\\2.png")), 200);
|
||||
String newFileName = IDUtils.createID() + ".png";
|
||||
File fOut = new File("L:\\yn_img\\files\\ys\\" + newFileName);
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(fOut);
|
||||
fileOutputStream.write(bytes);
|
||||
fileOutputStream.close();
|
||||
|
|
|
|||
|
|
@ -27,20 +27,25 @@
|
|||
<select id="getImgList" resultType="com.bonus.imgTool.backstage.entity.SynthesisQueryVo">
|
||||
SELECT sfr.id,
|
||||
sfr.original_file_path AS originalFilePath,
|
||||
sfr.original_file_path AS compressFilePath,
|
||||
sfr.original_file_path AS watermarkFilePath,
|
||||
sfr.compress_file_path AS compressFilePath,
|
||||
sfr.watermark_file_path AS watermarkFilePath,
|
||||
sfr.upload_type AS uploadType,
|
||||
CASE sfr.upload_type WHEN '1' THEN '安全违章' WHEN '2' THEN '质量检查' WHEN '3' THEN '安全措施落实'
|
||||
WHEN '4' THEN '协调照片' WHEN '5' THEN '重要事项及宣传类' ELSE '' END AS uploadTypeName,
|
||||
sfr.create_time AS uploadTime,
|
||||
source_type AS sourceType,
|
||||
sd2.dict_name AS sourceTypeName,
|
||||
IF(tpc.file_resource_id IS NULL,'0','1') AS collectStatus
|
||||
A.dict_name AS sourceTypeName,
|
||||
IF(tpc.file_resource_id IS NULL,'0','1') AS collectStatus,
|
||||
tcq.title
|
||||
FROM tb_comprehensive_query tcq
|
||||
LEFT JOIN sys_file_resource sfr ON tcq.id = sfr.source_id AND tcq.upload_type = sfr.upload_type AND sfr.is_active = '1'
|
||||
LEFT JOIN tb_photo_collect tpc ON sfr.id = tpc.file_resource_id AND tpc.collect_user_id = #{userId}
|
||||
LEFT JOIN sys_distinct sd ON sfr.source_type = sd.dict_value
|
||||
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||
LEFT JOIN (
|
||||
SELECT sd.dict_value,sd.dict_name
|
||||
FROM sys_distinct sd
|
||||
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||
WHERE sd2.dict_code = 'file_source_type'
|
||||
) A ON A.dict_value = sfr.source_type
|
||||
<where>
|
||||
<if test="roleLevel = 0 and proIds != null and proIds.size() > 0">
|
||||
AND tcq.pro_id IN
|
||||
|
|
@ -48,7 +53,7 @@
|
|||
#{proId}
|
||||
</foreach>
|
||||
</if>
|
||||
AND tcq.is_active = '1' AND sd2.dict_value = 'file_source_type'
|
||||
AND tcq.is_active = '1'
|
||||
</where>
|
||||
ORDER BY sfr.create_time DESC
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.imgTool.imageUpload.mapper.SafetyMeasuresMapper">
|
||||
<insert id="addSafetyMeasures" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_safety_measure
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="proId != null and proId != ''">pro_id,</if>
|
||||
<if test="proName != null">pro_name,</if>
|
||||
<if test="majorId != null and majorId != ''">major_id,</if>
|
||||
<if test="majorName != null">major_name,</if>
|
||||
<if test="gxId != null and gxId != ''">gx_id,</if>
|
||||
<if test="gxName != null">gx_name,</if>
|
||||
<if test="checkUserName != null">check_user_name,</if>
|
||||
<if test="checkDate != null">check_date,</if>
|
||||
<if test="checkPlace != null">check_place,</if>
|
||||
<if test="checkDesc != null">check_desc,</if>
|
||||
<if test="createUserId != null">create_user_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createUserName != null">create_user_name,</if>
|
||||
<if test="updateUserid != null">update_user_id,</if>
|
||||
<if test="updateUserName != null">update_user_name,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="dataSource != null">data_source,</if>
|
||||
is_active
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="proId != null and proId != ''">#{proId},</if>
|
||||
<if test="proName != null">#{proName},</if>
|
||||
<if test="majorId != null and majorId != ''">#{majorId},</if>
|
||||
<if test="majorName != null">#{majorName},</if>
|
||||
<if test="gxId != null and gxId != ''">#{gxId},</if>
|
||||
<if test="gxName != null and gxName != ''">#{gxName},</if>
|
||||
<if test="checkUserName != null">#{checkUserName},</if>
|
||||
<if test="checkDate != null and checkDate != ''">#{checkDate},</if>
|
||||
<if test="checkPlace != null">#{checkPlace},</if>
|
||||
<if test="checkDesc != null">#{checkDesc},</if>
|
||||
<if test="createUserId != null">#{createUserId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createUserName != null">#{createUserName},</if>
|
||||
<if test="updateUserid != null">#{updateUserid},</if>
|
||||
<if test="updateUserName != null">#{updateUserName},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="dataSource != null">#{dataSource},</if>
|
||||
1
|
||||
</trim>
|
||||
|
||||
</insert>
|
||||
<delete id="deleteSafetyMeasures">
|
||||
update tb_safety_measure set is_active ='0'
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
<select id="getSafetyMeasuresList" resultType="com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo">
|
||||
select * from tb_safety_measure
|
||||
where is_active = '1'
|
||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
check_user_name like concat('%', #{keyWord}, '%') or
|
||||
check_desc like concat('%', #{keyWord}, '%') or
|
||||
check_place like concat('%', #{keyWord}, '%') or
|
||||
)
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -40,6 +40,12 @@
|
|||
major_id = #{pid}
|
||||
</where>
|
||||
</select>
|
||||
<select id="getProjectSelect" resultType="com.bonus.imgTool.system.vo.SelectVo">
|
||||
select
|
||||
t.id,
|
||||
t.name
|
||||
from tb_project t where is_active = 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.imgTool.system.dao.SysFileResourceDao">
|
||||
<insert id="addSysFileResource">
|
||||
insert into sys_file_resource
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="fileName != null and fileName != ''">file_name,</if>
|
||||
<if test="fileSuffix != null">file_suffix,</if>
|
||||
<if test="fileSize != null and fileSize != ''">file_size,</if>
|
||||
<if test="originalFilePath != null">original_file_path,</if>
|
||||
<if test="compressFilePath != null and compressFilePath != ''">compress_file_path,</if>
|
||||
<if test="watermarkFilePath != null">watermark_file_path,</if>
|
||||
<if test="fileType != null">file_type,</if>
|
||||
<if test="sourceId != null">source_id,</if>
|
||||
<if test="uploadType != null">upload_type,</if>
|
||||
<if test="sourceType != null">source_type,</if>
|
||||
<if test="sourceTypeName != null">source_type_name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createUserName != null">create_user_name,</if>
|
||||
<if test="createUser != null">create_user,</if>
|
||||
is_active
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
||||
<if test="fileSuffix != null">#{fileSuffix},</if>
|
||||
<if test="fileSize != null and fileSize != ''">#{fileSize},</if>
|
||||
<if test="originalFilePath != null">#{originalFilePath},</if>
|
||||
<if test="compressFilePath != null and compressFilePath != ''">#{compressFilePath},</if>
|
||||
<if test="watermarkFilePath != null and watermarkFilePath != ''">#{watermarkFilePath},</if>
|
||||
<if test="fileType != null">#{fileType},</if>
|
||||
<if test="sourceId != null and checkDate != ''">#{sourceId},</if>
|
||||
<if test="uploadType != null">#{uploadType},</if>
|
||||
<if test="sourceType != null">#{sourceType},</if>
|
||||
<if test="sourceTypeName != null">#{sourceTypeName},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createUserName != null">#{createUserName},</if>
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
1
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteFileResource">
|
||||
update sys_file_resource set is_active ='0'
|
||||
where source_id = #{id}
|
||||
</delete>
|
||||
<select id="getSysFileResourceList" resultType="com.bonus.imgTool.system.vo.SysFileResourceVo">
|
||||
select * from sys_file_resource where source_id = #{id}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -34,6 +34,10 @@
|
|||
set sign_img=null
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteUserProject">
|
||||
delete from tb_pro_user
|
||||
where user_id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getLockUser" resultType="com.bonus.imgTool.model.SysUser">
|
||||
select user_name userName,login_name loginName,ls_time lsTime ,
|
||||
|
|
@ -134,6 +138,10 @@
|
|||
t.org_id as orgId,
|
||||
so.org_name as orgName,
|
||||
sr.role_name roleName,
|
||||
case when sr.level = 0 then '项目部级'
|
||||
when sr.level = 1 then '公司级'
|
||||
else ''
|
||||
end as levelName,
|
||||
t.team_id as teamId,
|
||||
CASE
|
||||
t.user_type
|
||||
|
|
@ -151,19 +159,13 @@
|
|||
LEFT JOIN sys_role sr ON sr.role_id = t.role_id
|
||||
LEFT JOIN sys_org so ON so.org_id = t.org_id
|
||||
where t.del_flag = 0
|
||||
<if test="username != null and username != ''">
|
||||
and t.user_name like concat('%', #{username}, '%')
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
AND (
|
||||
INSTR(t.user_name,#{keyWord}) > 0 OR
|
||||
INSTR(t.login_name,#{keyWord}) > 0
|
||||
)
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
and t.phone like concat('%', #{phone}, '%')
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and t.org_id = #{orgId}
|
||||
</if>
|
||||
<if test="userType != null and userType != ''">
|
||||
and t.user_type = #{userType}
|
||||
</if>
|
||||
order by t.del_flag ASC , t.state,t.create_time DESC
|
||||
order by t.del_flag ASC ,t.create_time DESC
|
||||
</select>
|
||||
<select id="getPasswordConfigById" resultType="com.bonus.imgTool.model.PasswordConfig">
|
||||
select pwd_strength as pwdStrength,
|
||||
|
|
@ -175,6 +177,7 @@
|
|||
<select id="getById" resultType="com.bonus.imgTool.system.vo.UserDto">
|
||||
select id,
|
||||
user_name as username,
|
||||
password,
|
||||
login_name as loginName,
|
||||
sex,
|
||||
user_code as userCode,
|
||||
|
|
@ -279,13 +282,23 @@
|
|||
and t.id=#{id}
|
||||
order by t.del_flag ASC , t.state,t.create_time DESC
|
||||
</select>
|
||||
<select id="getProjects" resultType="com.bonus.imgTool.system.vo.SelectVo">
|
||||
select p.id,
|
||||
p.name
|
||||
from tb_pro_user t
|
||||
left join tb_project p on t.pro_id = p.id
|
||||
where t.user_id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="saveUserRoles">
|
||||
<insert id="saveUserRoles">
|
||||
insert into sys_role_user(roleId, userId) values
|
||||
<foreach collection="roleIds" item="roleId" separator=",">
|
||||
(#{roleId}, #{userId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="saveUserProject">
|
||||
insert into tb_pro_user(user_id, pro_id) values (#{userId}, #{proId})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_user t
|
||||
|
|
@ -295,11 +308,9 @@
|
|||
t.sex = #{sex},
|
||||
t.org_id = #{orgId},
|
||||
t.role_id = #{roleId},
|
||||
t.phone = #{phone},
|
||||
t.user_type = #{userType},
|
||||
t.login_type = #{loginType},
|
||||
t.team_id = #{teamId},
|
||||
t.state = #{state},
|
||||
t.update_time = now()
|
||||
where t.id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -93,16 +93,17 @@ function initImgData(list) {
|
|||
let htmlArr = [];
|
||||
if (list && list.length > 0) {
|
||||
$.each(list, function (index, item) {
|
||||
let filePath = imgUrl + item.compressFilePath + "?token=" + tokens
|
||||
htmlArr.push("<div class='img-info'>" +
|
||||
" <div class='imgData layout'>\n" +
|
||||
" <img src='" + item.compressFilePath + "'>" +
|
||||
" <img src='" + filePath + "'>" +
|
||||
" </div>" +
|
||||
" <div class='imgData2 layout'>" +
|
||||
" <p>" + item.uploadTime + "</p>" +
|
||||
" <p class='img-color" + (item.uploadType) + "'>" + item.uploadTypeName + "</p>" +
|
||||
" </div>" +
|
||||
" <div class='imgData3 layout'>" +
|
||||
" <p>" + item.sourceTypeName + "</p>" +
|
||||
" <p>" + setSourceTypeName(item) + "</p>" +
|
||||
setCollectData(item) +
|
||||
" </div>" +
|
||||
" <div class='hidden-actions'><div class='hidden-btn layout'>" +
|
||||
|
|
@ -136,30 +137,20 @@ function initImgData(list) {
|
|||
return "<img style='display:none;' src='../../img/synthesisQuery/collect_check.png'>";
|
||||
}
|
||||
|
||||
// 设置标题
|
||||
function setSourceTypeName(item){
|
||||
if(item.sourceType === '9'){
|
||||
return item.title;
|
||||
}else{
|
||||
return item.sourceTypeName.split('-')[1];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**放大*/
|
||||
function viewImg(item) {
|
||||
layer.photos({
|
||||
shade: 0.5,
|
||||
footer: false,
|
||||
photos: {
|
||||
"title": "图片预览",
|
||||
"start": 0,
|
||||
"data": [
|
||||
{
|
||||
"pid": 1,
|
||||
"src": "../../img/synthesisQuery/7.jpg",
|
||||
}
|
||||
]
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**放大*/
|
||||
function imgDownLoad(item) {
|
||||
alert(item.id)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**水印下载*/
|
||||
function waterImgDownLoad(item) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
/**放大*/
|
||||
function viewImg(item) {
|
||||
layer.photos({
|
||||
shade: 0.5,
|
||||
footer: false,
|
||||
photos: {
|
||||
"title": "图片预览",
|
||||
"start": 0,
|
||||
"data": [
|
||||
{
|
||||
"pid": 1,
|
||||
"src": imgUrl + item.originalFilePath + "?token=" + tokens,
|
||||
}
|
||||
]
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**原图下载*/
|
||||
function imgDownLoad(item) {
|
||||
let orginalPath = item.originalFilePath;
|
||||
let obj = {
|
||||
imgPath: orginalPath,
|
||||
}
|
||||
let loadingMsg = layer.msg("原图下载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
let url = dataUrl + "/common/download/downloadImage?token=" + tokens + "&encryptedData=" + encodeURIComponent(encryptCBC(JSON.stringify(obj)));
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("get", url, true);
|
||||
xhr.responseType = "blob"; // 转换流
|
||||
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8')
|
||||
xhr.onload = function () {
|
||||
layer.close(loadingMsg);
|
||||
if (this.status === 200) {
|
||||
let blob = this.response;
|
||||
var a = document.createElement("a");
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = orginalPath.substring(orginalPath.lastIndexOf('/') + 1,orginalPath.length); // 文件名
|
||||
} else {
|
||||
layer.msg("原图下载发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
|
||||
}
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
};
|
||||
// xhr.send(params);
|
||||
xhr.send();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
let form, layer, dtree, util, idParam, phoneParam;
|
||||
let form, layer, dtree, util, idParam, phoneParam, formSelects;
|
||||
let arr = ['background', 'web', 'mobile', 'wx'];
|
||||
let background, web, mobile, wx;
|
||||
let data = [], appResList = [];
|
||||
|
|
@ -12,13 +12,15 @@ function setParams(params) {
|
|||
console.log(params)
|
||||
idParam = JSON.parse(params).id;
|
||||
layui.config({
|
||||
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||
base: "../../../js/layui-v2.6.8/"
|
||||
}).extend({
|
||||
dtree: 'dtree'
|
||||
}).use(['form', 'layer', 'dtree', 'util'], function () {
|
||||
dtree: 'dtree/dtree',
|
||||
formSelects: 'formSelects-v4',
|
||||
}).use(['form', 'layer', 'dtree', 'util', 'formSelects'], function () {
|
||||
layer = layui.layer;
|
||||
form = layui.form;
|
||||
util = layui.util;
|
||||
formSelects = layui.formSelects;
|
||||
dtree = layui.dtree;
|
||||
var $ = layui.jquery;
|
||||
roleList = getRoleSelected();
|
||||
|
|
@ -123,11 +125,11 @@ function getRoleSelected() {
|
|||
* 获取工程数据
|
||||
*/
|
||||
function getProSelected() {
|
||||
let url = dataUrl + '/users/getRoleAll';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
let url = dataUrl + '/sys/select/getProjectSelect';
|
||||
ajaxRequest(url, "GET", null, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'project');
|
||||
setProjectValue(result.data);
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
|
|
@ -163,6 +165,21 @@ function setSelectValue(list, selectName) {
|
|||
layui.form.render();
|
||||
}
|
||||
|
||||
function setProjectValue(data) {
|
||||
let keys = [];
|
||||
$.each(data, function (index, item) {
|
||||
let temp = {
|
||||
"name": item.name,
|
||||
"value": item.id
|
||||
};
|
||||
keys.push(temp);
|
||||
})
|
||||
formSelects.data('project', 'local', {
|
||||
arr: keys
|
||||
});
|
||||
layui.form.render('select'); // 重新渲染 select 组件
|
||||
}
|
||||
|
||||
|
||||
// function setOrgTree(data){
|
||||
// orgTree = dtree.renderSelect({
|
||||
|
|
@ -249,17 +266,25 @@ function setFormData(data) {
|
|||
document.getElementById('userType_0').checked = true;
|
||||
}*/
|
||||
|
||||
if (data.state === 1) {
|
||||
document.getElementById('state_1').checked = true;
|
||||
} else if (data.state === 0) {
|
||||
document.getElementById('state_0').checked = true;
|
||||
}
|
||||
/* if (data.state === 1) {
|
||||
document.getElementById('state_1').checked = true;
|
||||
} else if (data.state === 0) {
|
||||
document.getElementById('state_0').checked = true;
|
||||
}*/
|
||||
$('#type_' + data.type).attr('checked', true)
|
||||
$('#orgId').val(data.orgId)
|
||||
$('#roleId').val(data.roleId)
|
||||
$('#roleId option[value=' + data.roleId + ']').attr('selected', true)
|
||||
$('#project').val(data.roleId)
|
||||
$('#project option[value=' + data.project + ']').attr('selected', true)
|
||||
if ($('#roleId option:selected').text().includes('项目部级')) {
|
||||
$('#projectDiv').removeClass('layui-hide');
|
||||
} else {
|
||||
$('#projectDiv').addClass('layui-hide');
|
||||
}
|
||||
$('#project').val(data.project)
|
||||
var selectedValues = data.projects.map(function (item) {
|
||||
return item.id;
|
||||
});
|
||||
formSelects.value('project', selectedValues);
|
||||
/*$('#teamId').val(data.teamId)
|
||||
$('#teamId option[value=' + data.teamId + ']').attr('selected', true)*/
|
||||
// var arrCB = data.loginTypes;
|
||||
|
|
@ -284,17 +309,17 @@ function saveData(data) {
|
|||
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||
let url = dataUrl + "/users/addTemp";
|
||||
let params = data.field;
|
||||
var arr_box = [];//固定复选框
|
||||
$('#cbGuDing input[type=checkbox]:checked').each(function () {
|
||||
arr_box.push($(this).val());
|
||||
});
|
||||
var arr_pro = [];//固定复选框
|
||||
$('#project input[type=checkbox]:checked').each(function () {
|
||||
arr_pro.push($(this).val());
|
||||
});
|
||||
// var arr_box = [];//固定复选框
|
||||
// $('#cbGuDing input[type=checkbox]:checked').each(function () {
|
||||
// arr_box.push($(this).val());
|
||||
// });
|
||||
// var arr_pro = [];//固定复选框
|
||||
// $('#project input[type=checkbox]:checked').each(function () {
|
||||
// arr_pro.push($(this).val());
|
||||
// });
|
||||
|
||||
// params.loginType = arr_box.join()
|
||||
params.project = arr_pro.join()
|
||||
// params.project = arr_pro.join()
|
||||
// params.orgId = params.orgId_select_nodeId;
|
||||
if (params.id != "") {
|
||||
url = dataUrl + "/users/update";
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ function initTable(dataList, limit, page) {
|
|||
// {field: "orgName", title: "单位部门", unresize: true, align: "center"},
|
||||
{field: "roleName", title: "角色", unresize: true, align: "center"},
|
||||
// {field: "phone", title: "联系电话", unresize: true, align: "center"},
|
||||
{field: "userType", title: "用户级别", unresize: true, align: "center"},
|
||||
{field: "levelName", title: "用户级别", unresize: true, align: "center"},
|
||||
{field: "state", title: "启用状态", align: "center", templet: '#is-state'},
|
||||
{field: "createTime", title: "创建时间", unresize: true, align: "center"},
|
||||
{
|
||||
|
|
@ -148,19 +148,13 @@ function getReqParams(page, limit, type) {
|
|||
obj = {
|
||||
page: page + "",
|
||||
limit: limit + "",
|
||||
userName: $('#userName').val(),
|
||||
phone: $('#phone').val(),
|
||||
orgId: selectOrgId,
|
||||
userType: $('#userType').val(),
|
||||
keyWord: $('#keyWord').val(),
|
||||
};
|
||||
} else {
|
||||
obj = {
|
||||
page: '1',
|
||||
limit: '10',
|
||||
userName: '',
|
||||
phone: '',
|
||||
orgId: '',
|
||||
userType: '',
|
||||
keyWord: '',
|
||||
};
|
||||
}
|
||||
console.log(obj)
|
||||
|
|
@ -172,7 +166,7 @@ function getReqParams(page, limit, type) {
|
|||
|
||||
// 查询/重置
|
||||
function query(type) {
|
||||
let pattern = new RegExp("[%_<>]");
|
||||
/* let pattern = new RegExp("[%_<>]");
|
||||
if (pattern.test($("#loginName").val())) {
|
||||
$("#loginName").val('');
|
||||
return layer.msg('用户名查询包含特殊字符,请重新输入', {
|
||||
|
|
@ -186,7 +180,7 @@ function query(type) {
|
|||
icon: 2,
|
||||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||
});
|
||||
}
|
||||
}*/
|
||||
pageNum = 1;
|
||||
pages(1, limitSize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,4 +104,5 @@
|
|||
</body>
|
||||
<script src="../../js/synthesisQuery/synthesisQuery.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/synthesisQuery/synthesisQueryAjax.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/synthesisQuery/synthesisQueryCommon.js" charset="UTF-8" type="text/javascript"></script>
|
||||
</html>
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.6.8/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.6.8/dtree/dtree.css">
|
||||
<link href="../../../js/layui-v2.6.8/formSelects-v4.css" rel="stylesheet" type="text/css"/>
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.6.8/dtree/font/dtreefont.css">
|
||||
<link rel="stylesheet" href="../../../css/dataForm.css">
|
||||
<script src="../../../js/libs/jquery-3.7.0.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
|
|
@ -64,7 +65,9 @@
|
|||
<div class="layui-form-item layui-hide" id="projectDiv">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>管理的工程</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="project" lay-verify="required" name="project" class="form-control input-sm">
|
||||
<!-- <select id="project" lay-verify="required" name="project" class="form-control input-sm">-->
|
||||
<!-- </select>-->
|
||||
<select class="layui-select" name="project" id="project" xm-select="project" xm-select-show-count='3'>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@
|
|||
<fieldset>
|
||||
<input type="hidden" id="id" name="id">
|
||||
<div class="layui-form-item" style="margin-top: 2%;">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>用户名</label>
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>登录账号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="form-control layui-input" placeholder="用户名" type="text" name="username" disabled id="username" maxlength="30"
|
||||
<input class="form-control layui-input" placeholder="登录账号" type="text" name="loginName" disabled id="loginName" maxlength="30"
|
||||
lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-top: 2%;">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>登录名</label>
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>姓名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="form-control layui-input" placeholder="登录名" type="text" name="loginName" disabled id="loginName" maxlength="30"
|
||||
<input class="form-control layui-input" placeholder="姓名" type="text" name="username" disabled id="username" maxlength="30"
|
||||
lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue