Jelajahi Sumber

签发类型管理、项目签发调整

lizhenhao 2 tahun lalu
induk
melakukan
529faed641

+ 1 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectBusinessType/controller/CwProjectBusinessTypeController.java

@@ -109,7 +109,7 @@ public class CwProjectBusinessTypeController {
      * @return
      */
     @ApiLog(value = "修改/新增业务类型", type = LogTypeEnum.SAVE)
-    @PreAuthorize("hasAnyAuthority('cw_project_business_type:save','cw_project_business_type:edit')")
+    @PreAuthorize("hasAnyAuthority('cw_project_business_type:add','cw_project_business_type:edit')")
     @PostMapping("save")
     public ResponseEntity save(@Valid @RequestBody CwProjectBusinessTypeDTO cwProjectBusinessTypeDTO) {
         cwProjectBusinessTypeService.saveType(cwProjectBusinessTypeDTO);

+ 130 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/controller/ProgramServiceTypeController.java

@@ -0,0 +1,130 @@
+package com.jeeplus.test.program.serviceType.controller;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.sys.constant.enums.LogTypeEnum;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.projectBusinessType.service.dto.CwProjectBusinessTypeDTO;
+import com.jeeplus.test.program.serviceType.domain.ProgramServiceType;
+import com.jeeplus.test.program.serviceType.service.ProgramServiceTypeService;
+import com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO;
+import io.swagger.annotations.Api;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Api("项目管理-业务类型管理")
+@RestController
+@RequestMapping(value = "/program/service_type")
+public class ProgramServiceTypeController {
+
+    @Resource
+    private ProgramServiceTypeService programServiceTypeService;
+
+    /**
+     * 查询业务类型列表
+     * @param programServiceTypeDTO
+     * @param page
+     * @return
+     * @throws Exception
+     */
+    @ApiLog("查询业务类型列表")
+    @GetMapping("list")
+    public ResponseEntity<IPage<ProgramServiceTypeDTO>> data(ProgramServiceTypeDTO programServiceTypeDTO, Page<ProgramServiceTypeDTO> page) throws Exception {
+        page.setSize(-1);
+        IPage<ProgramServiceTypeDTO> result = new Page<ProgramServiceTypeDTO>();
+        if(ObjectUtil.isNotEmpty(programServiceTypeDTO)){
+            if(StringUtils.isNotBlank(programServiceTypeDTO.getName())){
+                //根据type模糊查询
+                List<ProgramServiceType> programServiceTypeList = programServiceTypeService.list(new QueryWrapper<ProgramServiceType>().lambda()
+                        .like(StringUtils.isNotBlank(programServiceTypeDTO.getName()), ProgramServiceType::getName, programServiceTypeDTO.getName())
+                );
+                List<String> idList = new ArrayList<>();
+                programServiceTypeList.stream().forEach(item->{
+                    if (StringUtils.isNotBlank(item.getParentIds())){
+                        String[] split = item.getParentIds().split(",");
+                        for (String s : split) {
+                            idList.add(s);
+                        }
+                    }
+                    List<ProgramServiceType> list = programServiceTypeService.list(new QueryWrapper<ProgramServiceType>().lambda().like(ProgramServiceType::getParentIds, "," + item.getId() + ","));
+                    idList.addAll(list.stream().map(ProgramServiceType::getId).collect(Collectors.toList()));
+                    idList.add(item.getId());
+                });
+                List<String> ids = idList.stream().distinct().filter(item->{
+                    if (!"0".equals(item)){
+                        return true;
+                    }
+                    return false;
+                }).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(ids)){
+                    QueryWrapper<ProgramServiceType> wrapper = new QueryWrapper<ProgramServiceType>()
+                            .in("pst.id",idList);
+                    result = programServiceTypeService.findList (page,wrapper);
+                }
+            }else{
+                result = programServiceTypeService.findList (page,new QueryWrapper<ProgramServiceType>());
+            }
+        }
+        return ResponseEntity.ok (result);
+    }
+
+    /**
+     * 查询业务类型数据
+     * @param id
+     * @return
+     */
+    @ApiLog("查询业务类型数据")
+    @PreAuthorize ("hasAnyAuthority('program_service_type:view','program_service_type:add','program_service_type:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam("id") String id) {
+        ProgramServiceTypeDTO programServiceTypeDTO = programServiceTypeService.queryById ( id );
+        return ResponseEntity.ok (programServiceTypeDTO);
+    }
+
+    /**
+     * 保存业务类型
+     * @param programServiceTypeDTO
+     * @return
+     */
+    @ApiLog(value = "修改/新增业务类型", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('program_service_type:add','program_service_type:edit')")
+    @PostMapping("save")
+    public ResponseEntity save(@Valid @RequestBody ProgramServiceTypeDTO programServiceTypeDTO) {
+        programServiceTypeService.saveType(programServiceTypeDTO);
+        return ResponseEntity.ok ("操作成功");
+    }
+
+    /**
+     * 删除业务类型
+     * @param ids
+     * @return
+     */
+    @ApiLog(value = "删除业务类型", type = LogTypeEnum.SAVE)
+    @PreAuthorize ("hasAuthority('program_service_type:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        return programServiceTypeService.deleteByIds(ids);
+    }
+
+    /**
+     * 查询全部一级业务类型
+     * @return
+     */
+    @ApiLog("查询全部一级业务类型")
+    @GetMapping("getList")
+    public ResponseEntity<List<ProgramServiceTypeDTO>> getList() {
+        List<ProgramServiceTypeDTO> list = programServiceTypeService.getList();
+        return ResponseEntity.ok (list);
+    }
+}

+ 46 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/domain/ProgramServiceType.java

@@ -0,0 +1,46 @@
+package com.jeeplus.test.program.serviceType.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 评估-项目管理-业务类型管理
+ * @TableName program_service_type
+ */
+@Data
+@TableName("program_service_type")
+public class ProgramServiceType extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 分类名称
+     */
+    private String name;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 等级
+     */
+    private Integer level;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 父ids
+     */
+    private String parentIds;
+
+    private static final long serialVersionUID = 1L;
+}

+ 30 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/mapper/ProgramServiceTypeMapper.java

@@ -0,0 +1,30 @@
+package com.jeeplus.test.program.serviceType.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.cw.projectBusinessType.domain.CwProjectBusinessType;
+import com.jeeplus.test.cw.projectBusinessType.service.dto.CwProjectBusinessTypeDTO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.program.serviceType.domain.ProgramServiceType;
+import com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface ProgramServiceTypeMapper extends BaseMapper<ProgramServiceType> {
+
+    IPage<ProgramServiceTypeDTO> findList(Page<ProgramServiceTypeDTO> page, @Param(Constants.WRAPPER) QueryWrapper<ProgramServiceType> queryWrapper);
+
+    ProgramServiceTypeDTO queryById(@Param("id") String id);
+
+    public List<ProgramServiceTypeDTO> getList();
+
+}
+
+
+
+

+ 80 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/mapper/xml/ProgramServiceTypeMapper.xml

@@ -0,0 +1,80 @@
+<?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.jeeplus.test.program.serviceType.mapper.ProgramServiceTypeMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+            <result property="level" column="level" jdbcType="INTEGER"/>
+            <result property="sort" column="sort" jdbcType="INTEGER"/>
+            <result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        pst.id,
+        pst.create_by,
+        pst.create_date,
+        pst.update_by,
+        pst.update_date,
+        pst.del_flag,
+        pst.remarks,
+        pst.name,
+        pst.parent_id,
+        pst.level,
+        pst.sort
+    </sql>
+
+    <select id="findList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from program_service_type pst
+        ${ew.customSqlSegment}
+    </select>
+
+    <select id="queryById" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from program_service_type pst
+        where pst.del_flag = '0' and pst.id = #{id}
+    </select>
+
+    <select id="getList" resultMap="map">
+        select
+        <include refid="Base_Column_List"></include>
+        from program_service_type pst
+        where pst.del_flag = '0' and pst.parent_id = '0'
+    </select>
+
+    <resultMap id="map" type="com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+        <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+        <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+        <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+        <result property="level" column="level" jdbcType="INTEGER"/>
+        <result property="sort" column="sort" jdbcType="INTEGER"/>
+        <result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+        <collection property="childrenList" column="id" select="getChildList" ofType="com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO"/>
+    </resultMap>
+
+    <select id="getChildList" resultType="com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO">
+        select
+        <include refid="Base_Column_List"></include>
+        from program_service_type pst
+        where pst.del_flag = '0' and pst.parent_id = ${id}
+    </select>
+
+</mapper>

+ 84 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/service/ProgramServiceTypeService.java

@@ -0,0 +1,84 @@
+package com.jeeplus.test.program.serviceType.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.projectBusinessType.domain.CwProjectBusinessType;
+import com.jeeplus.test.cw.projectBusinessType.mapper.CwProjectBusinessTypeMapper;
+import com.jeeplus.test.cw.projectBusinessType.service.dto.CwProjectBusinessTypeDTO;
+import com.jeeplus.test.cw.projectBusinessType.service.mapstruct.CwProjectBusinessTypeWrapper;
+import com.jeeplus.test.program.serviceType.domain.ProgramServiceType;
+import com.jeeplus.test.program.serviceType.mapper.ProgramServiceTypeMapper;
+import com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO;
+import com.jeeplus.test.program.serviceType.service.mapstruct.ProgramServiceTypeWrapper;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class ProgramServiceTypeService extends ServiceImpl<ProgramServiceTypeMapper, ProgramServiceType> {
+
+    @Resource
+    private ProgramServiceTypeMapper programServiceTypeMapper;
+
+    public IPage<ProgramServiceTypeDTO> findList(Page<ProgramServiceTypeDTO> page, QueryWrapper<ProgramServiceType> queryWrapper){
+        queryWrapper.eq("pst.del_flag","0").orderByAsc("pst.sort");
+        return programServiceTypeMapper.findList(page,queryWrapper);
+    }
+
+    public ProgramServiceTypeDTO queryById(String id) {
+
+        ProgramServiceTypeDTO programServiceTypeDTO = programServiceTypeMapper.queryById(id);
+
+        return programServiceTypeDTO;
+    }
+
+    public ResponseEntity saveType(ProgramServiceTypeDTO programServiceTypeDTO) {
+        ProgramServiceType programServiceType = ProgramServiceTypeWrapper.INSTANCE.toEntity(programServiceTypeDTO);
+        if (ObjectUtil.isNotEmpty(programServiceTypeDTO)) {
+            if (StringUtils.isBlank(programServiceTypeDTO.getId())) {
+                if (StringUtils.isNotBlank(programServiceTypeDTO.getParentId())){
+                    if ("0".equals(programServiceTypeDTO.getParentId())){
+                        programServiceType.setLevel(1);
+                        programServiceType.setParentIds("0,");
+                    }else{
+                        ProgramServiceType byId = this.getById(programServiceTypeDTO.getParentId());
+                        ProgramServiceTypeDTO pbt = ProgramServiceTypeWrapper.INSTANCE.toDTO(byId);
+                        if(ObjectUtil.isNotEmpty(pbt)){
+                            programServiceType.setLevel(pbt.getLevel()+1);
+                            programServiceType.setParentIds(pbt.getParentIds()+pbt.getId()+",");
+                        }
+                    }
+                }
+            }
+        }
+        this.saveOrUpdate(programServiceType);
+        return ResponseEntity.ok("保存成功");
+    }
+
+    public ResponseEntity deleteByIds(String ids) {
+        String idArray[] =ids.split(",");
+        if(CollectionUtil.isNotEmpty(Lists.newArrayList (idArray))){
+            List<String> list = this.list(new QueryWrapper<ProgramServiceType>().lambda().in(ProgramServiceType::getParentId, Lists.newArrayList(idArray))).stream().distinct().map(ProgramServiceType::getId).collect(Collectors.toList());
+            this.removeByIds (list);
+        }
+        this.removeByIds (Lists.newArrayList (idArray));
+        return ResponseEntity.ok ("删除成功");
+    }
+
+    public List<ProgramServiceTypeDTO> getList() {
+        List<ProgramServiceTypeDTO> list = programServiceTypeMapper.getList();
+        return list;
+    }
+
+}

+ 51 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/service/dto/ProgramServiceTypeDTO.java

@@ -0,0 +1,51 @@
+package com.jeeplus.test.program.serviceType.service.dto;
+
+import com.jeeplus.core.service.dto.BaseDTO;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 评估-项目管理-业务类型管理
+ */
+@Data
+public class ProgramServiceTypeDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 分类名称
+     */
+    private String name;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 等级
+     */
+    private Integer level;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 父ids
+     */
+    private String parentIds;
+
+    /**
+     * 子集合
+     */
+    private List<ProgramServiceTypeDTO> childrenList;
+
+    private static final long serialVersionUID = 1L;
+}

+ 17 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/serviceType/service/mapstruct/ProgramServiceTypeWrapper.java

@@ -0,0 +1,17 @@
+package com.jeeplus.test.program.serviceType.service.mapstruct;
+
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import com.jeeplus.test.cw.projectBusinessType.domain.CwProjectBusinessType;
+import com.jeeplus.test.cw.projectBusinessType.service.dto.CwProjectBusinessTypeDTO;
+import com.jeeplus.test.program.serviceType.domain.ProgramServiceType;
+import com.jeeplus.test.program.serviceType.service.dto.ProgramServiceTypeDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface ProgramServiceTypeWrapper extends EntityWrapper<ProgramServiceTypeDTO, ProgramServiceType>{
+
+        ProgramServiceTypeWrapper INSTANCE = Mappers.getMapper(ProgramServiceTypeWrapper.class);
+
+}

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/proofread/domain/ProofreadIssued.java

@@ -132,4 +132,6 @@ public class ProofreadIssued extends BaseEntity {
      */
     @TableField(exist = false)
     private String reportType;
+
+    private String serviceType;
 }

+ 2 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/proofread/mapper/xml/ProofreadIssuedMapper.xml

@@ -31,7 +31,8 @@
 			a.agree_time,
 			a.agree_user_id,
 			a.proc_ins_id,
-			a.process_definition_id
+			a.process_definition_id,
+			a.service_type
 		FROM
 			proofread_issued a
 			LEFT JOIN program_project_list_info b ON a.project_id = b.id