From 50fd1ca826d556657c09e4702a0f2de0d218b2c8 Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期四, 28 十一月 2024 00:06:29 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- system/src/main/java/com/ycl/system/domain/base/AbsVo.java | 2 business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java | 13 ++ start/src/main/resources/application.yml | 2 business/src/main/java/com/ycl/mapper/ProjectInfoMapper.java | 2 business/src/main/java/com/ycl/service/AuditHistoryService.java | 12 ++ business/src/main/resources/mapper/ProgressPlanMapper.xml | 6 - business/src/main/resources/mapper/ProjectProcessMapper.xml | 7 - system/src/main/java/com/ycl/system/domain/base/AbsEntity.java | 4 business/src/main/java/com/ycl/domain/entity/File.java | 11 - common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java | 27 +++++ business/src/main/java/com/ycl/mapper/AuditHistoryMapper.java | 16 +++ business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java | 63 ++++++++++- business/src/main/resources/mapper/AuditHistoryMapper.xml | 20 ++++ business/src/main/java/com/ycl/controller/IndexController.java | 22 ++++ common/pom.xml | 6 + business/src/main/java/com/ycl/domain/entity/AuditHistory.java | 25 +++++ system/pom.xml | 5 - business/src/main/java/com/ycl/service/impl/AuditHistoryServiceImpl.java | 22 ++++ 18 files changed, 225 insertions(+), 40 deletions(-) diff --git a/business/src/main/java/com/ycl/controller/IndexController.java b/business/src/main/java/com/ycl/controller/IndexController.java index 464e95e..6cb53e6 100644 --- a/business/src/main/java/com/ycl/controller/IndexController.java +++ b/business/src/main/java/com/ycl/controller/IndexController.java @@ -1,8 +1,11 @@ package com.ycl.controller; +import com.ycl.common.core.controller.BaseController; import com.ycl.common.core.domain.R; import com.ycl.common.core.page.TableDataInfo; +import com.ycl.domain.entity.AuditHistory; import com.ycl.domain.vo.*; +import com.ycl.service.AuditHistoryService; import com.ycl.service.ProjectInfoService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; @@ -17,11 +20,15 @@ @RequiredArgsConstructor @RestController @RequestMapping("/") -public class IndexController { +public class IndexController extends BaseController { @Autowired private ProjectInfoService projectInfoService; + + + @Autowired + private AuditHistoryService auditHistoryService; /** * 椤圭洰鏁伴噺缁熻 @@ -49,7 +56,18 @@ */ @GetMapping("/audit-message") public TableDataInfo<Object> auditMessage(PageQuery pageQuery) { - return null; + AuditHistory auditHistory = new AuditHistory(); + auditHistory.setTaskId("001"); + auditHistory.setTaskDefinitionKey("key"); + auditHistory.setViewer("寮犱笁"); + auditHistory.setCommitDept("閮ㄩ棬1"); + auditHistory.setAuditType("01"); + auditHistory.setIsRead("0"); + auditHistory.setBusinessKey("12"); + auditHistory.setBusinessTable("t_plan"); + auditHistory.setContent("娑堟伅鍥炲"); +// auditHistoryService.save(auditHistory); + return getDataTable(auditHistoryService.list()); } /** diff --git a/business/src/main/java/com/ycl/domain/entity/AuditHistory.java b/business/src/main/java/com/ycl/domain/entity/AuditHistory.java new file mode 100644 index 0000000..9f198f6 --- /dev/null +++ b/business/src/main/java/com/ycl/domain/entity/AuditHistory.java @@ -0,0 +1,25 @@ +package com.ycl.domain.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.ycl.system.domain.base.AbsEntity; +import lombok.Data; + +@Data +@TableName("t_audit_history") +public class AuditHistory extends AbsEntity { + private String taskId; + private String taskDefinitionKey; + private String viewer; + private String commitDept; + /** + * 1:鎻愪氦锛�2:瀹℃牳锛�3:椹冲洖锛�4:杞氦 + */ + private String auditType; + /** + * 鏄惁闃呰(0:鏈锛�1:宸茶) + */ + private String isRead; + private String businessKey; + private String businessTable; + private String content; +} diff --git a/business/src/main/java/com/ycl/domain/entity/File.java b/business/src/main/java/com/ycl/domain/entity/File.java index c71fac2..806883c 100644 --- a/business/src/main/java/com/ycl/domain/entity/File.java +++ b/business/src/main/java/com/ycl/domain/entity/File.java @@ -1,9 +1,7 @@ package com.ycl.domain.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; +import com.ycl.common.enums.business.FileTypeEnum; import com.ycl.system.domain.base.AbsEntity; import lombok.Data; @@ -22,8 +20,6 @@ private static final long serialVersionUID = 1L; - @TableId(value = "id", type = IdType.ASSIGN_ID) - private Integer id; /** * 鏂囦欢璺緞 */ @@ -35,7 +31,8 @@ /** * 鏂囦欢鍒嗙被 */ - private String type; + @TableField(value = "type") + private FileTypeEnum type; /** * 鏂囦欢鍚� */ diff --git a/business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java b/business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java index 2fc8f32..ee49ea6 100644 --- a/business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java +++ b/business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java @@ -1,5 +1,7 @@ package com.ycl.domain.vo; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ycl.domain.entity.File; import com.ycl.domain.entity.ProjectInfo; import com.ycl.system.domain.base.AbsVo; import io.swagger.annotations.ApiModel; @@ -93,14 +95,17 @@ /** 绔嬮」鏃堕棿 */ @ApiModelProperty("绔嬮」鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createProjectTime; /** 璁″垝寮�宸ユ椂闂� */ @ApiModelProperty("璁″垝寮�宸ユ椂闂�") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date planStartTime; /** 璁″垝绔e伐鏃堕棿 */ @ApiModelProperty("璁″垝绔e伐鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date planCompleteTime; /** 涓爣鍗曚綅 */ @@ -113,6 +118,7 @@ /** 涓爣鏃堕棿 */ @ApiModelProperty("涓爣鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date winTime; /** 璇︾粏鍦板潃 */ @@ -147,6 +153,13 @@ @ApiModelProperty("鍒涘缓浜�") private Long createBy; + /** 鐘舵�佺爜 */ + @ApiModelProperty("鐘舵�佺爜") + private String projectColorCode; + + @ApiModelProperty("鏂囦欢") + private List<File> fileList; + public static ProjectInfoVO getVoByEntity(@NonNull ProjectInfo entity, ProjectInfoVO vo) { if(vo == null) { vo = new ProjectInfoVO(); diff --git a/business/src/main/java/com/ycl/mapper/AuditHistoryMapper.java b/business/src/main/java/com/ycl/mapper/AuditHistoryMapper.java new file mode 100644 index 0000000..a696551 --- /dev/null +++ b/business/src/main/java/com/ycl/mapper/AuditHistoryMapper.java @@ -0,0 +1,16 @@ +package com.ycl.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ycl.domain.entity.AuditHistory; +import com.ycl.domain.entity.File; +import org.apache.ibatis.annotations.Mapper; + +/** + * 瀹℃牳璁板綍 Mapper 鎺ュ彛 + * + */ +@Mapper +public interface AuditHistoryMapper extends BaseMapper<AuditHistory> { + + +} diff --git a/business/src/main/java/com/ycl/mapper/ProjectInfoMapper.java b/business/src/main/java/com/ycl/mapper/ProjectInfoMapper.java index d1a54f3..fa9dd84 100644 --- a/business/src/main/java/com/ycl/mapper/ProjectInfoMapper.java +++ b/business/src/main/java/com/ycl/mapper/ProjectInfoMapper.java @@ -22,7 +22,7 @@ * @param id * @return */ - ProjectInfoVO getById(Integer id); + ProjectInfo getById(Integer id); /** * 鍒嗛〉 diff --git a/business/src/main/java/com/ycl/service/AuditHistoryService.java b/business/src/main/java/com/ycl/service/AuditHistoryService.java new file mode 100644 index 0000000..8f64b4c --- /dev/null +++ b/business/src/main/java/com/ycl/service/AuditHistoryService.java @@ -0,0 +1,12 @@ +package com.ycl.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ycl.domain.entity.AuditHistory; + +/** + * 瀹℃牳璁板綍 鏈嶅姟绫� + */ +public interface AuditHistoryService extends IService<AuditHistory> { + + +} diff --git a/business/src/main/java/com/ycl/service/impl/AuditHistoryServiceImpl.java b/business/src/main/java/com/ycl/service/impl/AuditHistoryServiceImpl.java new file mode 100644 index 0000000..8a830de --- /dev/null +++ b/business/src/main/java/com/ycl/service/impl/AuditHistoryServiceImpl.java @@ -0,0 +1,22 @@ +package com.ycl.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ycl.common.base.Result; +import com.ycl.domain.entity.AuditHistory; +import com.ycl.mapper.AuditHistoryMapper; +import com.ycl.service.AuditHistoryService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.List; + +/** + * 瀹℃牳璁板綍 鏈嶅姟瀹炵幇绫� + * + */ +@Service +@RequiredArgsConstructor +public class AuditHistoryServiceImpl extends ServiceImpl<AuditHistoryMapper, AuditHistory> implements AuditHistoryService { + +} diff --git a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java index 5c18d4a..22848db 100644 --- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java @@ -1,15 +1,20 @@ package com.ycl.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.common.base.Result; +import com.ycl.common.enums.business.FileTypeEnum; +import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.File; import com.ycl.domain.entity.ProjectInfo; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.domain.vo.*; import com.ycl.framework.utils.PageUtil; +import com.ycl.mapper.FileMapper; import com.ycl.mapper.ProjectInfoMapper; +import com.ycl.service.FileService; import com.ycl.service.ProjectInfoService; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; @@ -34,7 +39,8 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements ProjectInfoService { private final ProjectInfoMapper projectInfoMapper; - + private final FileService fileService; + private final FileMapper fileMapper; /** * 娣诲姞 * @@ -46,10 +52,17 @@ public Result add(ProjectInfoForm form) { //娣诲姞鍩烘湰淇℃伅 ProjectInfo entity = ProjectInfoForm.getEntityByForm(form, null); -// baseMapper.insert(entity); + Long userId = SecurityUtils.getUserId(); + entity.setCreateBy(userId); + entity.setUpdateBy(userId); + baseMapper.insert(entity); //娣诲姞鏂囦欢 List<File> fileList = form.getFileList(); - + fileList.forEach(item->{ + item.setBusId(entity.getId()); + item.setType(FileTypeEnum.PROJECT_INFO); + }); + fileService.saveBatch(fileList); return Result.ok("娣诲姞鎴愬姛"); } @@ -60,12 +73,28 @@ * @return */ @Override + @Transactional(rollbackFor = Exception.class) public Result update(ProjectInfoForm form) { ProjectInfo entity = baseMapper.selectById(form.getId()); - // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); - BeanUtils.copyProperties(form, entity); + ProjectInfoForm.getEntityByForm(form,entity); + Long userId = SecurityUtils.getUserId(); + entity.setUpdateBy(userId); + + List<File> fileList = form.getFileList(); + fileList.forEach(item->{ + item.setBusId(entity.getId()); + item.setType(FileTypeEnum.PROJECT_INFO); + }); + //鍒犻櫎鍘熸湁鏂囦欢 + QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); + fileQueryWrapper.eq("type",FileTypeEnum.PROJECT_INFO.getType()); + fileQueryWrapper.eq("bus_id",entity.getId()); + fileMapper.delete(fileQueryWrapper); + //鏇挎崲鎴愮幇鏈� + fileService.saveBatch(fileList); + //鏇存柊椤圭洰淇℃伅 baseMapper.updateById(entity); return Result.ok("淇敼鎴愬姛"); } @@ -77,6 +106,7 @@ * @return */ @Override + //TODO:寰呭畬鍠� public Result remove(List<String> ids) { baseMapper.deleteBatchIds(ids); return Result.ok("鍒犻櫎鎴愬姛"); @@ -89,6 +119,7 @@ * @return */ @Override + //TODO:寰呭畬鍠� public Result removeById(String id) { baseMapper.deleteById(id); return Result.ok("鍒犻櫎鎴愬姛"); @@ -102,9 +133,17 @@ */ @Override public Result page(ProjectInfoQuery query) { - IPage<ProjectInfoVO> page = PageUtil.getPage(query, ProjectInfoVO.class); + IPage<ProjectInfo> page = PageUtil.getPage(query, ProjectInfo.class); baseMapper.getPage(page, query); - return Result.ok().data(page.getRecords()).total(page.getTotal()); + List<ProjectInfo> records = page.getRecords(); + List<ProjectInfoVO> list = records.stream() + .map(entity -> { + ProjectInfoVO vo = ProjectInfoVO.getVoByEntity(entity, null); + vo.setProjectColorCode("green"); + return vo; + }) + .collect(Collectors.toList()); + return Result.ok().data(list).total(page.getTotal()); } /** @@ -115,8 +154,14 @@ */ @Override public Result detail(Integer id) { - ProjectInfoVO vo = baseMapper.getById(id); - Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + ProjectInfo entity = baseMapper.getById(id); + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + ProjectInfoVO vo = ProjectInfoVO.getVoByEntity(entity, null); + QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); + fileQueryWrapper.eq("type",FileTypeEnum.PROJECT_INFO.getType()); + fileQueryWrapper.eq("bus_id",vo.getId()); + List<File> files = fileMapper.selectList(fileQueryWrapper); + vo.setFileList(files); return Result.ok().data(vo); } diff --git a/business/src/main/resources/mapper/AuditHistoryMapper.xml b/business/src/main/resources/mapper/AuditHistoryMapper.xml new file mode 100644 index 0000000..7bb92f3 --- /dev/null +++ b/business/src/main/resources/mapper/AuditHistoryMapper.xml @@ -0,0 +1,20 @@ +<?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.ycl.mapper.AuditHistoryMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.ycl.domain.entity.AuditHistory"> + <result column="task_id" property="taskId" /> + <result column="task_definition_key" property="taskDefinitionKey" /> + <result column="viewer" property="viewer" /> + <result column="commit_dept" property="commitDept" /> + <result column="audit_type" property="auditType" /> + <result column="is_read" property="isRead" /> + <result column="business_key" property="businessKey" /> + <result column="business_table" property="businessTable" /> + <result column="content" property="content" /> + </resultMap> + + + +</mapper> diff --git a/business/src/main/resources/mapper/ProgressPlanMapper.xml b/business/src/main/resources/mapper/ProgressPlanMapper.xml index 4d1c63d..adf99f4 100644 --- a/business/src/main/resources/mapper/ProgressPlanMapper.xml +++ b/business/src/main/resources/mapper/ProgressPlanMapper.xml @@ -13,12 +13,6 @@ <result column="gmt_update_time" property="gmtUpdateTime" /> </resultMap> - - - - - - <select id="getById" resultMap="BaseResultMap"> SELECT TPP.project_info_id, diff --git a/business/src/main/resources/mapper/ProjectProcessMapper.xml b/business/src/main/resources/mapper/ProjectProcessMapper.xml index 9985dee..1e3cf70 100644 --- a/business/src/main/resources/mapper/ProjectProcessMapper.xml +++ b/business/src/main/resources/mapper/ProjectProcessMapper.xml @@ -14,9 +14,9 @@ <result column="invest_type" property="investType" /> <result column="project_phase" property="projectPhase" /> <result column="tag" property="tag" /> - <result column="competent_department" property="competentDepartment" /> +<!-- <result column="competent_department" property="competentDepartment" />--> <result column="area_code" property="areaCode" /> - <result column="management_centralization" property="managementCentralization" /> +<!-- <result column="management_centralization" property="managementCentralization" />--> <result column="project_approval_type" property="projectApprovalType" /> <result column="investment_catalogue" property="investmentCatalogue" /> <result column="importance_type" property="importanceType" /> @@ -41,9 +41,6 @@ <result column="flowable_process_id" property="flowableProcessId" /> <!-- <association property="id" column=""--> </resultMap> - - - diff --git a/common/pom.xml b/common/pom.xml index 2f8038a..99d8e16 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -16,7 +16,11 @@ </description> <dependencies> - + <!-- MybatisPlus --> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus-boot-starter</artifactId> + </dependency> <!-- lombok --> <dependency> <groupId>org.projectlombok</groupId> diff --git a/common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java b/common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java new file mode 100644 index 0000000..f2c0231 --- /dev/null +++ b/common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java @@ -0,0 +1,27 @@ +package com.ycl.common.enums.business; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; + +/** + * 鏂囦欢绫诲瀷鏋氫妇 + * + * @author锛歠lq + * @date锛�2024/11/27 18:21 + */ +@Getter +public enum FileTypeEnum { + PROJECT_INFO("project_info", "椤圭洰鍩烘湰淇℃伅"); + + @EnumValue // 鏍囨槑璇ュ瓧娈靛瓨鍏ユ暟鎹簱 + private final String type; + + @JsonValue // 鏍囨槑鍦ㄨ浆JSON鏃朵娇鐢ㄨ瀛楁 + private final String desc; + + FileTypeEnum(String type, String desc) { + this.type = type; + this.desc = desc; + } +} diff --git a/start/src/main/resources/application.yml b/start/src/main/resources/application.yml index f70d518..59ac04d 100644 --- a/start/src/main/resources/application.yml +++ b/start/src/main/resources/application.yml @@ -5,7 +5,7 @@ # 瀹炰綋鎵弿锛屽涓猵ackage鐢ㄩ�楀彿鎴栬�呭垎鍙峰垎闅� typeAliasesPackage: com.ycl.**.domain configuration: - default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler # 閫氱敤鏋氫妇澶勭悊鍣� + default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler # 閫氱敤鏋氫妇澶勭悊鍣� # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 鏃ュ織鎵撳嵃 global-config: db-config: diff --git a/system/pom.xml b/system/pom.xml index 439845d..18ddae0 100644 --- a/system/pom.xml +++ b/system/pom.xml @@ -28,11 +28,6 @@ <artifactId>easyexcel</artifactId> </dependency> - <!-- MybatisPlus --> - <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatis-plus-boot-starter</artifactId> - </dependency> <!-- 楠岃瘉鐮� --> <dependency> diff --git a/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java b/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java index e2a9f06..3f3cca0 100644 --- a/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java +++ b/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java @@ -17,8 +17,8 @@ private static final long serialVersionUID = 1L; - @TableId(value = "id", type = IdType.ASSIGN_ID) - private Integer id; + @TableId(value = "id", type = IdType.AUTO) + private Long id; /** 鍒涘缓鏃堕棿 */ @TableField(value = "gmt_create", fill = FieldFill.INSERT) diff --git a/system/src/main/java/com/ycl/system/domain/base/AbsVo.java b/system/src/main/java/com/ycl/system/domain/base/AbsVo.java index f1489cf..864fa69 100644 --- a/system/src/main/java/com/ycl/system/domain/base/AbsVo.java +++ b/system/src/main/java/com/ycl/system/domain/base/AbsVo.java @@ -13,7 +13,7 @@ public abstract class AbsVo { @ApiModelProperty("id") - private Integer id; + private Long id; @ApiModelProperty("鍒涘缓鏃堕棿") private Date gmtCreate; -- Gitblit v1.8.0