diff --git a/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/utils/global/SystemGlobal.java b/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/utils/global/SystemGlobal.java index 3917639..c23ea96 100644 --- a/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/utils/global/SystemGlobal.java +++ b/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/utils/global/SystemGlobal.java @@ -56,5 +56,5 @@ public class SystemGlobal { */ public final static String OBS="obs"; - + public final static int SUCCESS_MIN_NUM = 0; } diff --git a/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/bracelet/vo/BaseProject.java b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/bracelet/vo/BaseProject.java new file mode 100644 index 0000000..7bde53d --- /dev/null +++ b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/bracelet/vo/BaseProject.java @@ -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 fileList; + + private List delFileIdList; + /** + * 人脸照片 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private MultipartFile file; + +} diff --git a/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/bracelet/vo/QueryConstruction.java b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/bracelet/vo/QueryConstruction.java new file mode 100644 index 0000000..c53aa33 --- /dev/null +++ b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/bracelet/vo/QueryConstruction.java @@ -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 + + '}'; + } +} diff --git a/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/file/ResourceFileVo.java b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/file/ResourceFileVo.java index d6eb8a9..7edac69 100644 --- a/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/file/ResourceFileVo.java +++ b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/entity/file/ResourceFileVo.java @@ -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; } diff --git a/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/config/MyFilter.java b/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/config/MyFilter.java index 38f3b7c..e3cad0e 100644 --- a/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/config/MyFilter.java +++ b/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/config/MyFilter.java @@ -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; } diff --git a/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java b/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java index 7241581..1311242 100644 --- a/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java +++ b/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java @@ -63,7 +63,9 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory try { String rspStr = resolveBodyFromRequest(request); - rspStr= AesCbcUtils.decrypt(rspStr); + if(jaData){ + rspStr= AesCbcUtils.decrypt(rspStr); + } if(StringUtils.isEmpty(rspStr)){ throw new CaptchaException("请求参数异常"); } diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/controller/BaseProjectController.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/controller/BaseProjectController.java new file mode 100644 index 0000000..d312351 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/controller/BaseProjectController.java @@ -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 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 list = projectService.selectProjectList(project); + ExcelUtil util = new ExcelUtil(BaseProject.class); + util.exportExcel(response, list, "项目部数据"); + }catch (Exception e){ + log.error(e.toString(),e); + } + } +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/controller/QueryConstructionController.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/controller/QueryConstructionController.java new file mode 100644 index 0000000..1dfafe6 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/controller/QueryConstructionController.java @@ -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 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 list = constructionService.selectConstructionList(construction); + ExcelUtil util = new ExcelUtil(QueryConstruction.class); + util.exportExcel(response, list, "项目部数据"); + }catch (Exception e){ + log.error(e.toString(),e); + } + } +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/mapper/BaseProjectMapper.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/mapper/BaseProjectMapper.java new file mode 100644 index 0000000..378df7a --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/mapper/BaseProjectMapper.java @@ -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 selectProjectList(BaseProject project); + + public List 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 selectFilePathById(int projectId); +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/mapper/QueryConstructionMapper.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/mapper/QueryConstructionMapper.java new file mode 100644 index 0000000..6ba4884 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/mapper/QueryConstructionMapper.java @@ -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 selectConstructionList(QueryConstruction construction); + + + + +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/IBaseProjectService.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/IBaseProjectService.java new file mode 100644 index 0000000..a5027f4 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/IBaseProjectService.java @@ -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 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); + + +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/IQueryConstructionService.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/IQueryConstructionService.java new file mode 100644 index 0000000..2260374 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/IQueryConstructionService.java @@ -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 selectConstructionList(QueryConstruction construction); + + +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/impl/BaseProjectServiceImpl.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/impl/BaseProjectServiceImpl.java new file mode 100644 index 0000000..662a035 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/impl/BaseProjectServiceImpl.java @@ -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 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 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 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 list = projectMapper.selectFilePathById(projectIds[i]); + for(int j = 0;j list) { + if(StringUtils.isNotEmpty(list)){ + list.forEach(file->{ + R 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); + } + }); + } + + } +} diff --git a/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/impl/QueryConstructionServiceImpl.java b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/impl/QueryConstructionServiceImpl.java new file mode 100644 index 0000000..2ee0fd1 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/java/com/bonus/bracelet/service/impl/QueryConstructionServiceImpl.java @@ -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 selectConstructionList(QueryConstruction construction) + { + return constructionMapper.selectConstructionList(construction); + } + + +} diff --git a/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/BaseProjectMapper.xml b/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/BaseProjectMapper.xml new file mode 100644 index 0000000..7f5e1e5 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/BaseProjectMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into tb_project_depart( + + depart_name, + head_name, + contact_information, + remarks, + create_user, + create_time,del_flag + )values( + #{projectId}, + #{projectDepartName}, + #{projectHeadName}, + #{contactInformation}, + #{remarks}, + #{createBy}, + sysdate(),0 + ) + + + + update tb_project_depart + + depart_name = #{projectDepartName}, + head_name = #{projectHeadName}, + contact_information = #{contactInformation}, + remarks = #{remarks}, + update_user = #{updateBy}, + update_time = sysdate() + + where id = #{projectId} + + + + update tb_project_depart + set del_flag = 1 + where id = #{projectId} + + + + update sys_file_source + set del_flag = 1 + where source_id = #{projectId} and del_flag = 0 + + + + update sys_file_source + set del_flag = 1 + where file_path = #{filePath} + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/QueryConstructionMapper.xml b/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/QueryConstructionMapper.xml new file mode 100644 index 0000000..a842918 --- /dev/null +++ b/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/QueryConstructionMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file