项目部
This commit is contained in:
parent
901a307c8d
commit
e29772f542
|
|
@ -56,5 +56,5 @@ public class SystemGlobal {
|
|||
*/
|
||||
public final static String OBS="obs";
|
||||
|
||||
|
||||
public final static int SUCCESS_MIN_NUM = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.common.entity.file.ResourceFileVo;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位表 sys_post
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
|
||||
@Api("BaseProject")
|
||||
@Data
|
||||
public class BaseProject extends BaseEntity
|
||||
{
|
||||
/** 项目id */
|
||||
@Excel(name = "项目id", cellType = ColumnType.NUMERIC)
|
||||
private int projectId;
|
||||
|
||||
/** 项目部名称 */
|
||||
@Excel(name = "项目部名称")
|
||||
private String projectDepartName;
|
||||
|
||||
/** 负责人名称 */
|
||||
@Excel(name = "负责人名称")
|
||||
private String projectHeadName;
|
||||
|
||||
/** 联系方式 */
|
||||
@Excel(name = "联系方式")
|
||||
private String contactInformation;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remarks;
|
||||
|
||||
/** 创建人 */
|
||||
@Excel(name = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/** 更新人 */
|
||||
@Excel(name = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
|
||||
/** 是否删除 */
|
||||
@Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
|
||||
private int delFlag;
|
||||
|
||||
/** app轮播图数量 */
|
||||
@Excel(name = "app轮播图数量", cellType = ColumnType.NUMERIC)
|
||||
private int appnum;
|
||||
|
||||
private List<ResourceFileVo> fileList;
|
||||
|
||||
private List<String> delFileIdList;
|
||||
/**
|
||||
* 人脸照片
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private MultipartFile file;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
/**
|
||||
* 岗位表 sys_post
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Api("BaseProject")
|
||||
public class QueryConstruction extends BaseEntity
|
||||
{
|
||||
/** 工程名称 */
|
||||
@Excel(name = "工程名称")
|
||||
private String proname;
|
||||
|
||||
/** 项目部名称 */
|
||||
@Excel(name = "项目部名称")
|
||||
private String departname;
|
||||
|
||||
/** 施工班组 */
|
||||
@Excel(name = "施工班组")
|
||||
private String teamname;
|
||||
|
||||
/** 班组负责人 */
|
||||
@Excel(name = "班组负责人")
|
||||
private String teamleader;
|
||||
|
||||
/** 班组施工人数 */
|
||||
@Excel(name = "班组施工人数")
|
||||
private int teamnum;
|
||||
|
||||
/** 临时人数 */
|
||||
@Excel(name = "临时人数")
|
||||
private int tempnum;
|
||||
|
||||
/** 施工时间 */
|
||||
@Excel(name = "施工时间")
|
||||
private Date lytime;
|
||||
|
||||
/** 施工预警次数 */
|
||||
@Excel(name = "施工预警次数")
|
||||
private int warnnum;
|
||||
|
||||
|
||||
public String getProname() {
|
||||
return proname;
|
||||
}
|
||||
|
||||
public void setProname(String proname) {
|
||||
this.proname = proname;
|
||||
}
|
||||
|
||||
public String getDepartname() {
|
||||
return departname;
|
||||
}
|
||||
|
||||
public void setDepartname(String departname) {
|
||||
this.departname = departname;
|
||||
}
|
||||
|
||||
public String getTeamname() {
|
||||
return teamname;
|
||||
}
|
||||
|
||||
public void setTeamname(String teamname) {
|
||||
this.teamname = teamname;
|
||||
}
|
||||
|
||||
public String getTeamleader() {
|
||||
return teamleader;
|
||||
}
|
||||
|
||||
public void setTeamleader(String teamleader) {
|
||||
this.teamleader = teamleader;
|
||||
}
|
||||
|
||||
public int getTeamnum() {
|
||||
return teamnum;
|
||||
}
|
||||
|
||||
public void setTeamnum(int teamnum) {
|
||||
this.teamnum = teamnum;
|
||||
}
|
||||
|
||||
public int getTempnum() {
|
||||
return tempnum;
|
||||
}
|
||||
|
||||
public void setTempnum(int tempnum) {
|
||||
this.tempnum = tempnum;
|
||||
}
|
||||
|
||||
public int getWarnnum() {
|
||||
return warnnum;
|
||||
}
|
||||
|
||||
public void setWarnnum(int warnnum) {
|
||||
this.warnnum = warnnum;
|
||||
}
|
||||
|
||||
public Date getLytime() {
|
||||
return lytime;
|
||||
}
|
||||
|
||||
public void setLytime(Date lytime) {
|
||||
this.lytime = lytime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueryConstruction{" +
|
||||
"proname='" + proname + '\'' +
|
||||
", departname='" + departname + '\'' +
|
||||
", teamname='" + teamname + '\'' +
|
||||
", teamleader='" + teamleader + '\'' +
|
||||
", teamnum=" + teamnum +
|
||||
", tempnum=" + tempnum +
|
||||
", lytime=" + lytime +
|
||||
", warnnum=" + warnnum +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,9 @@ public class ResourceFileVo {
|
|||
@ApiModelProperty(value = "文件类型 0 文件 1图片")
|
||||
private Integer fileType;
|
||||
|
||||
@ApiModelProperty(value = "文件id")
|
||||
private Long fileId;
|
||||
|
||||
@ApiModelProperty(value = "业务id")
|
||||
private String sourceId;
|
||||
|
||||
|
|
@ -47,4 +50,7 @@ public class ResourceFileVo {
|
|||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer delFlag = 0;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String Bast64Image;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class MyFilter extends OncePerRequestFilter {
|
|||
//去除文件上传
|
||||
String header = request.getHeader(HttpHeaders.CONTENT_TYPE);
|
||||
if(StringUtils.isNotEmpty(header)){
|
||||
if(header.contains(MediaType.MULTIPART_FORM_DATA_VALUE) && header.contains(MediaType.APPLICATION_FORM_URLENCODED_VALUE)){
|
||||
if(header.contains(MediaType.MULTIPART_FORM_DATA_VALUE) || header.contains(MediaType.APPLICATION_FORM_URLENCODED_VALUE)){
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
|
|||
try
|
||||
{
|
||||
String rspStr = resolveBodyFromRequest(request);
|
||||
rspStr= AesCbcUtils.decrypt(rspStr);
|
||||
if(jaData){
|
||||
rspStr= AesCbcUtils.decrypt(rspStr);
|
||||
}
|
||||
if(StringUtils.isEmpty(rspStr)){
|
||||
throw new CaptchaException("请求参数异常");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,135 @@
|
|||
package com.bonus.bracelet.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.bonus.bracelet.service.IBaseProjectService;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.bracelet.vo.BaseProject;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/project")
|
||||
@Slf4j
|
||||
public class BaseProjectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBaseProjectService projectService;
|
||||
|
||||
/**
|
||||
* 获取项目列表
|
||||
*/
|
||||
@RequiresPermissions("bracelet:project:list")
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "项目部管理", businessType = OperaType.QUERY,module = "基础管理->项目部管理")
|
||||
public TableDataInfo list(BaseProject project) {
|
||||
try{
|
||||
startPage();
|
||||
List<BaseProject> list = projectService.selectProjectList(project);
|
||||
return getDataTable(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("bracelet:project:query")
|
||||
@GetMapping(value = "/{projectId}")
|
||||
public AjaxResult getInfo(@PathVariable Integer projectId) {
|
||||
return projectService.selectProjectById(projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*/
|
||||
@RequiresPermissions("bracelet:project:add")
|
||||
@PostMapping("/addtemp")
|
||||
@SysLog(title = "项目部管理", businessType = OperaType.INSERT,module = "基础管理->项目部管理",details ="新增项目" )
|
||||
public AjaxResult addtemp(@RequestParam(value = "file", required = false) MultipartFile[] file, String params) {
|
||||
try{
|
||||
BaseProject project = JSON.parseObject(params, BaseProject.class);
|
||||
if (!projectService.checkProjectDeptNameUniqueAdd(project)) {
|
||||
return error("修改项目'" + project.getProjectDepartName() + "'失败,项目名称已存在");
|
||||
}
|
||||
project.setCreateBy(SecurityUtils.getUsername());
|
||||
// project.setDelFlag(0);
|
||||
return projectService.insertProject(file,params);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return error("系统异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*/
|
||||
@RequiresPermissions("bracelet:project:edit")
|
||||
@PutMapping
|
||||
@SysLog(title = "项目部管理", businessType = OperaType.UPDATE,module = "基础管理->项目管理")
|
||||
public AjaxResult edit(@RequestParam(value = "file", required = false) MultipartFile[] file, String params) {
|
||||
try{
|
||||
BaseProject project = JSON.parseObject(params, BaseProject.class);
|
||||
if (!projectService.checkProjectDeptNameUnique(project)) {
|
||||
return error("修改项目'" + project.getProjectDepartName() + "'失败,项目名称已存在");
|
||||
}
|
||||
project.setUpdateBy(SecurityUtils.getUsername());
|
||||
return projectService.updateProject(file,params);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return error("系统异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
@RequiresPermissions("bracelet:project:remove")
|
||||
@DeleteMapping("/{projectIds}")
|
||||
@SysLog(title = "项目部管理", businessType = OperaType.UPDATE,module = "基础管理->项目部管理")
|
||||
public AjaxResult remove(@PathVariable int[] projectIds) {
|
||||
try{
|
||||
return toAjax(projectService.deleteProjectByIds(projectIds));
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return error("系统异常");
|
||||
}
|
||||
|
||||
@RequiresPermissions("bracelet:project:export")
|
||||
@PostMapping("/export")
|
||||
@SysLog(title = "项目部管理", businessType = OperaType.EXPORT,module = "基础管理->项目部管理")
|
||||
public void export(HttpServletResponse response, BaseProject project) {
|
||||
try{
|
||||
List<BaseProject> list = projectService.selectProjectList(project);
|
||||
ExcelUtil<BaseProject> util = new ExcelUtil<BaseProject>(BaseProject.class);
|
||||
util.exportExcel(response, list, "项目部数据");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.bonus.bracelet.controller;
|
||||
|
||||
|
||||
import com.bonus.bracelet.service.IQueryConstructionService;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.bracelet.vo.QueryConstruction;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/construction")
|
||||
@Slf4j
|
||||
public class QueryConstructionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IQueryConstructionService constructionService;
|
||||
|
||||
/**
|
||||
* 获取项目列表
|
||||
*/
|
||||
@RequiresPermissions("bracelet:construction:list")
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "施工记录管理", businessType = OperaType.QUERY,module = "综合查询->施工记录管理")
|
||||
public TableDataInfo list(QueryConstruction construction) {
|
||||
try{
|
||||
startPage();
|
||||
List<QueryConstruction> list = constructionService.selectConstructionList(construction);
|
||||
return getDataTable(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
@RequiresPermissions("bracelet:construction:export")
|
||||
@PostMapping("/export")
|
||||
@SysLog(title = "施工记录管理", businessType = OperaType.EXPORT,module = "综合查询->施工记录管理")
|
||||
public void export(HttpServletResponse response, QueryConstruction construction) {
|
||||
try{
|
||||
List<QueryConstruction> list = constructionService.selectConstructionList(construction);
|
||||
ExcelUtil<QueryConstruction> util = new ExcelUtil<QueryConstruction>(QueryConstruction.class);
|
||||
util.exportExcel(response, list, "项目部数据");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.bracelet.mapper;
|
||||
|
||||
import com.bonus.common.entity.bracelet.vo.BaseProject;
|
||||
import com.bonus.common.entity.file.ResourceFileVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 项目信息 数据层
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public interface BaseProjectMapper
|
||||
{
|
||||
/**
|
||||
* 查询项目数据集合
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 项目数据集合
|
||||
*/
|
||||
public List<BaseProject> selectProjectList(BaseProject project);
|
||||
|
||||
public List<ResourceFileVo> selectProjectFile(Integer projectId);
|
||||
|
||||
public BaseProject selectProjectById(Integer projectId);
|
||||
|
||||
public BaseProject checkProjectDeptNameUnique(@Param("projectDepartName") String projectDepartName,@Param("projectId") Integer projectId);
|
||||
|
||||
public BaseProject checkProjectDeptNameUniqueAdd(@Param("projectDepartName") String projectDepartName);
|
||||
|
||||
/**
|
||||
* 新增保存项目信息
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProject(BaseProject project);
|
||||
|
||||
/**
|
||||
* 修改项目信息
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProject(BaseProject project);
|
||||
|
||||
/**
|
||||
* 批量删除项目信息
|
||||
*
|
||||
* @param projectId 需要删除的项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProjectByIds(int projectId);
|
||||
|
||||
|
||||
/**
|
||||
* 删除文件信息
|
||||
*
|
||||
* @param projectId 需要删除的项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteFile(int projectId);
|
||||
|
||||
public void deleteFileId(String filePath);
|
||||
|
||||
public List<String> selectFilePathById(int projectId);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.bracelet.mapper;
|
||||
|
||||
import com.bonus.common.entity.bracelet.vo.QueryConstruction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目信息 数据层
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public interface QueryConstructionMapper
|
||||
{
|
||||
/**
|
||||
* 查询项目数据集合
|
||||
*
|
||||
|
||||
* @return 项目数据集合
|
||||
*/
|
||||
public List<QueryConstruction> selectConstructionList(QueryConstruction construction);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.bracelet.service;
|
||||
|
||||
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.bracelet.vo.BaseProject;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目部信息 服务层
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public interface IBaseProjectService
|
||||
{
|
||||
/**
|
||||
* 查询项目信息集合
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 项目列表
|
||||
*/
|
||||
public List<BaseProject> selectProjectList(BaseProject project);
|
||||
|
||||
public AjaxResult selectProjectById(Integer projectId);
|
||||
|
||||
public boolean checkProjectDeptNameUnique(BaseProject project);
|
||||
|
||||
public boolean checkProjectDeptNameUniqueAdd(BaseProject project);
|
||||
|
||||
public AjaxResult insertProject( MultipartFile[] file, String params);
|
||||
|
||||
/**
|
||||
* 修改保存项目信息
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult updateProject(MultipartFile[] file, String params);
|
||||
|
||||
public int deleteProjectByIds(int[] projectIds);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.bracelet.service;
|
||||
|
||||
import com.bonus.common.entity.bracelet.vo.QueryConstruction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目部信息 服务层
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public interface IQueryConstructionService
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param construction
|
||||
* @return
|
||||
*/
|
||||
public List<QueryConstruction> selectConstructionList(QueryConstruction construction);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
package com.bonus.bracelet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.bracelet.mapper.BaseProjectMapper;
|
||||
import com.bonus.bracelet.mapper.ResourceFileMapper;
|
||||
import com.bonus.bracelet.service.IBaseProjectService;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.constant.HttpStatus;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.UserConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.UploadCheckUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.utils.global.SystemGlobal;
|
||||
import com.bonus.common.core.utils.uuid.IdUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.bracelet.vo.BaseProject;
|
||||
import com.bonus.common.entity.bracelet.vo.PersonVo;
|
||||
import com.bonus.common.entity.file.ResourceFileVo;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import static com.bonus.common.core.web.domain.AjaxResult.error;
|
||||
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
|
||||
|
||||
/**
|
||||
* 岗位信息 服务层处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BaseProjectServiceImpl implements IBaseProjectService
|
||||
{
|
||||
@Autowired
|
||||
private BaseProjectMapper projectMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Resource(name = "ResourceFileMapper")
|
||||
private ResourceFileMapper resourceFileMapper;
|
||||
|
||||
/**
|
||||
* 查询项目数据集合
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 项目数据集合
|
||||
*/
|
||||
@Override
|
||||
public List<BaseProject> selectProjectList(BaseProject project)
|
||||
{
|
||||
return projectMapper.selectProjectList(project);
|
||||
}
|
||||
|
||||
/**
|
||||
*通过项目名称查询项目信息
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public AjaxResult selectProjectById(Integer projectId) {
|
||||
try {
|
||||
BaseProject vo = projectMapper.selectProjectById(projectId);
|
||||
if(ObjectUtil.isNotEmpty(vo)){
|
||||
List<ResourceFileVo> list = projectMapper.selectProjectFile(projectId);
|
||||
getImageFile(list);
|
||||
vo.setFileList(list);
|
||||
}
|
||||
|
||||
return AjaxResult.success(vo);
|
||||
} catch (Exception e) {
|
||||
log.error("项目详情", e);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改条件下校验项目名称是否唯一
|
||||
* @param project 项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkProjectDeptNameUnique(BaseProject project)
|
||||
{
|
||||
String projectDepartName = project.getProjectDepartName();
|
||||
Integer projectId = project.getProjectId();
|
||||
BaseProject projectTemp = projectMapper.checkProjectDeptNameUnique(projectDepartName,projectId);
|
||||
if (StringUtils.isNotNull(projectTemp))
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增条件下校验项目名称是否唯一
|
||||
* @param project 项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkProjectDeptNameUniqueAdd(BaseProject project)
|
||||
{
|
||||
String projectDepartName = project.getProjectDepartName();
|
||||
Integer projectId = project.getProjectId();
|
||||
BaseProject projectTemp = projectMapper.checkProjectDeptNameUniqueAdd(projectDepartName);
|
||||
if (StringUtils.isNotNull(projectTemp))
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param file
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertProject( MultipartFile[] file, String params)
|
||||
{
|
||||
BaseProject project = JSON.parseObject(params, BaseProject.class);
|
||||
int pro = projectMapper.insertProject(project);
|
||||
String delFileId = null;
|
||||
try{
|
||||
if(pro > SystemGlobal.SUCCESS_MIN_NUM){
|
||||
R result = remoteFileService.mostUploadFile(file, SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.ERROR) {
|
||||
log.error("人员照片上传失败");
|
||||
return null;
|
||||
} else if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONArray json = JSON.parseArray(jsonString);
|
||||
for (int i = 0; i < json.size(); i++) {
|
||||
JSONObject item = json.getJSONObject(i);
|
||||
if (item != null) {
|
||||
ResourceFileVo fileVo = setResourceFileData(item, project);
|
||||
resourceFileMapper.addFile(fileVo);
|
||||
delFileId = item.getString("fileId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("新增项目", e);
|
||||
// 添加失败-删除文件
|
||||
if (org.apache.commons.lang3.StringUtils.isNotEmpty(delFileId)) {
|
||||
remoteFileService.delFile(delFileId, SecurityConstants.INNER);
|
||||
}
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存项目信息
|
||||
*
|
||||
* @param project 项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateProject( MultipartFile[] file, String params)
|
||||
{
|
||||
BaseProject project = JSON.parseObject(params, BaseProject.class);
|
||||
int pro = projectMapper.updateProject(project);
|
||||
List<String> fileList = project.getDelFileIdList();
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
String filePath = fileList.get(i);
|
||||
projectMapper.deleteFileId(filePath);
|
||||
remoteFileService.delFile(filePath,SecurityConstants.INNER);
|
||||
}
|
||||
|
||||
String delFileId = null;
|
||||
try{
|
||||
if(pro > SystemGlobal.SUCCESS_MIN_NUM){
|
||||
R result = remoteFileService.mostUploadFile(file, SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.ERROR) {
|
||||
log.error("人员照片上传失败");
|
||||
return null;
|
||||
} else if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONArray json = JSON.parseArray(jsonString);
|
||||
for (int i = 0; i < json.size(); i++) {
|
||||
JSONObject item = json.getJSONObject(i);
|
||||
if (item != null) {
|
||||
ResourceFileVo fileVo = setResourceFileData(item, project);
|
||||
resourceFileMapper.addFile(fileVo);
|
||||
delFileId = item.getString("fileId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("新增项目", e);
|
||||
// 添加失败-删除文件
|
||||
if (org.apache.commons.lang3.StringUtils.isNotEmpty(delFileId)) {
|
||||
remoteFileService.delFile(delFileId, SecurityConstants.INNER);
|
||||
}
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目信息
|
||||
*
|
||||
* @param projectIds 需要删除的项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProjectByIds(int[] projectIds)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < projectIds.length; i++) {
|
||||
int a = projectMapper.deleteProjectByIds(projectIds[i]);
|
||||
projectMapper.deleteFile(projectIds[i]);
|
||||
List<String> list = projectMapper.selectFilePathById(projectIds[i]);
|
||||
for(int j = 0;j<list.size();j++){
|
||||
remoteFileService.delFile(list.get(j),SecurityConstants.INNER);
|
||||
}
|
||||
num = num + a;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源文件赋值
|
||||
*
|
||||
* @param item
|
||||
* @return ResourceFileVo
|
||||
* @author cwchen
|
||||
* @date 2024/7/16 13:49
|
||||
*/
|
||||
public ResourceFileVo setResourceFileData(JSONObject item, BaseProject vo) {
|
||||
ResourceFileVo fileVo = new ResourceFileVo();
|
||||
String resourceId = IdUtils.simpleUUID();
|
||||
fileVo.setFileType(5);
|
||||
fileVo.setFilePath(item.getString("fileId"));
|
||||
fileVo.setFileSuffix(item.getString("suffix"));
|
||||
fileVo.setFileName(item.getString("fileName"));
|
||||
fileVo.setSourceId(vo.getProjectId() + "");
|
||||
fileVo.setSourceType("5");
|
||||
return fileVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片查询
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public void getImageFile(List<ResourceFileVo> list) {
|
||||
if(StringUtils.isNotEmpty(list)){
|
||||
list.forEach(file->{
|
||||
R<SysFile> result = remoteFileService.getImgBase64(file.getFilePath(), SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
String base64 = item.getString("url");
|
||||
file.setBast64Image(base64);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.bracelet.service.impl;
|
||||
|
||||
import com.bonus.bracelet.mapper.QueryConstructionMapper;
|
||||
import com.bonus.bracelet.service.IQueryConstructionService;
|
||||
import com.bonus.common.entity.bracelet.vo.QueryConstruction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 服务层处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Service
|
||||
public class QueryConstructionServiceImpl implements IQueryConstructionService
|
||||
{
|
||||
@Autowired
|
||||
private QueryConstructionMapper constructionMapper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param construction
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<QueryConstruction> selectConstructionList(QueryConstruction construction)
|
||||
{
|
||||
return constructionMapper.selectConstructionList(construction);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<?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.bracelet.mapper.BaseProjectMapper">
|
||||
|
||||
<resultMap type="com.bonus.common.entity.bracelet.vo.BaseProject" id="BaseProjectResult">
|
||||
<id property="projectId" column="id" />
|
||||
<result property="projectDepartName" column="depart_name" />
|
||||
<result property="projectHeadName" column="head_name" />
|
||||
<result property="contactInformation" column="contact_information" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="updateBy" column="update_user" />
|
||||
<result property="createBy" column="create_user" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="appnum" column="appnum" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectProjectList" parameterType="com.bonus.common.entity.bracelet.vo.BaseProject" resultMap="BaseProjectResult">
|
||||
select a.id, depart_name, head_name, contact_information,count(b.source_id) as appnum, remarks,a.create_user,a.update_user
|
||||
from tb_project_depart a
|
||||
left join sys_file_source b on a.id = b.source_id and b.del_flag = 0
|
||||
<where>
|
||||
a.del_flag = 0
|
||||
<if test="projectDepartName != null and projectDepartName != ''">
|
||||
and depart_name = #{projectDepartName}
|
||||
</if>
|
||||
<if test="projectHeadName != null and projectHeadName != ''">
|
||||
and head_name = #{projectHeadName}
|
||||
</if>
|
||||
</where>
|
||||
group by a.id
|
||||
</select>
|
||||
|
||||
<select id="selectProjectById" parameterType="int" resultMap="BaseProjectResult">
|
||||
select a.id, depart_name, head_name, contact_information, remarks
|
||||
from tb_project_depart a
|
||||
where a.id = #{projectId}
|
||||
</select>
|
||||
|
||||
<select id="selectProjectFile" parameterType="int" resultType="com.bonus.common.entity.file.ResourceFileVo">
|
||||
select sfs.file_path AS filePath, sfs.id AS fileId
|
||||
from tb_project_depart a
|
||||
left join sys_file_source sfs on a.id = sfs.source_id and sfs.del_flag = 0
|
||||
where sfs.source_type = 5 and a.id = #{projectId}
|
||||
</select>
|
||||
|
||||
<select id="checkProjectDeptNameUnique" resultMap="BaseProjectResult">
|
||||
select a.id, depart_name, head_name, contact_information,count(b.source_id) as appnum, remarks
|
||||
from tb_project_depart a
|
||||
left join sys_file_source b on a.id = b.source_id and b.del_flag = 0
|
||||
where depart_name = #{projectDepartName} and a.id != #{projectId}
|
||||
group by a.id
|
||||
</select>
|
||||
|
||||
<select id="checkProjectDeptNameUniqueAdd" resultMap="BaseProjectResult">
|
||||
select a.id, depart_name, head_name, contact_information,count(b.source_id) as appnum, remarks
|
||||
from tb_project_depart a
|
||||
left join sys_file_source b on a.id = b.source_id and b.del_flag = 0
|
||||
where depart_name = #{projectDepartName}
|
||||
group by a.id
|
||||
</select>
|
||||
|
||||
<insert id="insertProject" parameterType="com.bonus.common.entity.bracelet.vo.BaseProject" useGeneratedKeys="true" keyProperty="projectId">
|
||||
insert into tb_project_depart(
|
||||
|
||||
<if test="projectDepartName != null and projectDepartName != ''">depart_name,</if>
|
||||
<if test="projectHeadName != null and projectHeadName != ''">head_name,</if>
|
||||
<if test="contactInformation != null and contactInformation != ''">contact_information,</if>
|
||||
<if test="remarks != null and remarks != ''">remarks,</if>
|
||||
<if test="createBy != null and createBy != ''">create_user,</if>
|
||||
create_time,del_flag
|
||||
)values(
|
||||
<if test="projectId != null and projectId != 0">#{projectId},</if>
|
||||
<if test="projectDepartName != null and projectDepartName != ''">#{projectDepartName},</if>
|
||||
<if test="projectHeadName != null and projectHeadName != ''">#{projectHeadName},</if>
|
||||
<if test="contactInformation != null and contactInformation != ''">#{contactInformation},</if>
|
||||
<if test="remarks != null and remarks != ''">#{remarks},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate(),0
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateProject" parameterType="com.bonus.common.entity.bracelet.vo.BaseProject">
|
||||
update tb_project_depart
|
||||
<set>
|
||||
<if test="projectDepartName != null and projectDepartName != ''">depart_name = #{projectDepartName},</if>
|
||||
<if test="projectHeadName != null and projectHeadName != ''">head_name = #{projectHeadName},</if>
|
||||
<if test="contactInformation != null and contactInformation != ''">contact_information = #{contactInformation},</if>
|
||||
<if test="remarks != null">remarks = #{remarks},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_user = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where id = #{projectId}
|
||||
</update>
|
||||
|
||||
<update id="deleteProjectByIds" parameterType="int">
|
||||
update tb_project_depart
|
||||
set del_flag = 1
|
||||
where id = #{projectId}
|
||||
</update>
|
||||
|
||||
<update id="deleteFile" parameterType="int">
|
||||
update sys_file_source
|
||||
set del_flag = 1
|
||||
where source_id = #{projectId} and del_flag = 0
|
||||
</update>
|
||||
|
||||
<update id="deleteFileId" parameterType="String">
|
||||
update sys_file_source
|
||||
set del_flag = 1
|
||||
where file_path = #{filePath}
|
||||
</update>
|
||||
|
||||
<select id="selectFilePathById" parameterType="int" resultType="java.lang.String">
|
||||
select file_path
|
||||
from sys_file_source
|
||||
where source_id = #{projectId} and del_flag = 0
|
||||
</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.bracelet.mapper.QueryConstructionMapper">
|
||||
|
||||
<resultMap type="com.bonus.common.entity.bracelet.vo.QueryConstruction" id="QueryConstructionResult">
|
||||
<id property="proname" column="proname" />
|
||||
<result property="departname" column="departname" />
|
||||
<result property="teamname" column="teamname" />
|
||||
<result property="teamleader" column="teamleader" />
|
||||
<result property="teamnum" column="teamnum" />
|
||||
<result property="tempnum" column="tempnum" />
|
||||
<result property="lytime" column="lytime" />
|
||||
<result property="warnnum" column="warnnum" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectConstructionList" parameterType="com.bonus.common.entity.bracelet.vo.QueryConstruction" resultMap="QueryConstructionResult">
|
||||
select a.lytime,tp.pro_name as proname,tpd.depart_name as departname,twt.team_name as teamname,concat(twt.team_leader,' \ ',twt.leader_phone) as teamleader,
|
||||
count(DISTINCT tbp.id) as teamnum,count(DISTINCT tlu.id) as tempnum,count(DISTINCT tw.id) as warnnum
|
||||
from
|
||||
(select tdu.pro_id,tdu.team_id as teamid,tdu.pro_id as proid,DATE(tdub.ly_time) as lytime
|
||||
from tb_dev_use tdu
|
||||
left join tb_dev_use_bid tdub on tdub.id = tdu.id
|
||||
where tdu.del_flag = 0) a
|
||||
left join tb_project tp on tp.id = a.proid
|
||||
left join t_work_team twt on twt.team_id = a.teamid and twt.pro_id = tp.id
|
||||
left join tb_project_depart tpd on tpd.id = tp.depart_id
|
||||
left join tb_bracelet tb on tb.del_flag = 0
|
||||
left join tb_people tbp on tbp.id = tb.bid_id and peopel_type = 0 and tbp.team_id = a.teamid and tbp.del_flag = 0
|
||||
left join tb_ls_user tlu on tlu.id = tb.bid_id and peopel_type = 1 and tlu.team_id = a.teamid
|
||||
left join tb_warn tw on tw.pro_id = a.pro_id and tw.del_flag = 0
|
||||
<where>
|
||||
tp.del_flag = 0 and twt.del_flag = 0
|
||||
<if test="proname != null and proname != ''">
|
||||
and tp.pro_name = #{proname}
|
||||
</if>
|
||||
<if test="departname != null and departname != ''">
|
||||
and tpd.depart_name = #{departname}
|
||||
</if>
|
||||
<if test="teamname != null and teamname != ''">
|
||||
and twt.team_name = #{teamname}
|
||||
</if>
|
||||
<if test="lytime != null ">
|
||||
and DATE(a.lytime) = #{lytime}
|
||||
</if>
|
||||
</where>
|
||||
group by a.lytime,proname,departname,teamname,teamleader
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue