wangliang 1 år sedan
förälder
incheckning
d485200945

+ 2 - 1
sop-api/src/main/java/com/qmth/sop/server/api/TBSopInfoController.java

@@ -7,6 +7,7 @@ import com.qmth.sop.business.bean.params.SopApplyParam;
 import com.qmth.sop.business.bean.params.SopInfoListParam;
 import com.qmth.sop.business.bean.params.SopSaveParam;
 import com.qmth.sop.business.bean.result.FlowResult;
+import com.qmth.sop.business.bean.result.FormWidgetMetadataResult;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.entity.TDFormWidgetMetadata;
 import com.qmth.sop.business.service.TBSopInfoService;
@@ -51,7 +52,7 @@ public class TBSopInfoController {
 
     @ApiOperation(value = "sop元数据查询")
     @RequestMapping(value = "/metadata/list", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TDFormWidgetMetadata.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = FormWidgetMetadataResult.class)})
     public Result metadataList(@ApiParam(value = "sop流程类型", required = true) @RequestParam TFCustomTypeEnum type,
                        @ApiParam(value = "sop流程版本") @RequestParam(required = false) Integer version) {
         return ResultUtil.ok(tdFormWidgetMetadataService.selectAll(type, Objects.isNull(version) ? 1 : version));

+ 30 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/FormWidgetMetadataResult.java

@@ -0,0 +1,30 @@
+package com.qmth.sop.business.bean.result;
+
+import com.qmth.sop.business.entity.TDFormWidgetMetadata;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 动态表单元数据表result
+ * </p>
+ *
+ * @author wangliang
+ * @since 2023-08-29
+ */
+public class FormWidgetMetadataResult extends TDFormWidgetMetadata implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "单选/多选option")
+    private String options;
+
+    public String getOptions() {
+        return options;
+    }
+
+    public void setOptions(String options) {
+        this.options = options;
+    }
+}

+ 13 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/TDFormWidgetMetadataMapper.java

@@ -1,7 +1,11 @@
 package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.sop.business.bean.result.FormWidgetMetadataResult;
 import com.qmth.sop.business.entity.TDFormWidgetMetadata;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -22,4 +26,13 @@ public interface TDFormWidgetMetadataMapper extends BaseMapper<TDFormWidgetMetad
 //    @InterceptorIgnore(blockAttack = "true")
 //    @Delete("delete t from t_d_form_widget_metadata t where t.type = '${type}'")
 //    Boolean deleteAllData(@Param("type") String type);
+
+    /**
+     * 查询所有sop元数据
+     *
+     * @param type
+     * @param version
+     * @return
+     */
+    List<FormWidgetMetadataResult> getFormWidgetMetadataResult(@Param("type") String type, @Param("version") Integer version);
 }

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/service/TDFormWidgetMetadataService.java

@@ -1,6 +1,7 @@
 package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.result.FormWidgetMetadataResult;
 import com.qmth.sop.business.entity.TDFormWidgetMetadata;
 import com.qmth.sop.common.enums.TFCustomTypeEnum;
 
@@ -34,7 +35,7 @@ public interface TDFormWidgetMetadataService extends IService<TDFormWidgetMetada
      * @param version
      * @return
      */
-    List<TDFormWidgetMetadata> selectAll(TFCustomTypeEnum type, Integer version);
+    List<FormWidgetMetadataResult> selectAll(TFCustomTypeEnum type, Integer version);
 
     /**
      * 保存sop元数据

+ 16 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -425,6 +425,22 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         IPage<Map> list = this.baseMapper.list(new Page<>(sopInfoListParam.getPageNumber(), sopInfoListParam.getPageSize()), Objects.nonNull(sopInfoListParam.getType()) ? sopInfoListParam.getType().name() : null, sopInfoListParam.getServiceId(), tableName, fieldName, fieldValue, dpr);
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         for (Map m : list.getRecords()) {
+            String regionUserId = (String) m.get("region_user_id_1");
+            String engineerUserId = (String) m.get("engineer_user_id_1");
+            String assistantEngineerUserId = (String) m.get("assistant_engineer_user_id_1");
+            if (Objects.nonNull(regionUserId)) {
+                SysUser user = sysUserService.getById(regionUserId);
+                m.put("region_user_id_1", user.getRealName());
+            }
+            if (Objects.nonNull(engineerUserId)) {
+                SysUser user = sysUserService.getById(engineerUserId);
+                m.put("engineer_user_id_1", user.getRealName());
+            }
+            if (Objects.nonNull(assistantEngineerUserId)) {
+                SysUser user = sysUserService.getById(assistantEngineerUserId);
+                m.put("assistant_engineer_user_id_1", user.getRealName());
+            }
+
             String taskIds = (String) m.get("taskId");
             if (Objects.nonNull(taskIds) && taskIds.contains(",")) {
                 String[] taskStrs = taskIds.split(",");

+ 5 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TDFormWidgetMetadataServiceImpl.java

@@ -3,6 +3,7 @@ package com.qmth.sop.business.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.bean.result.FormWidgetMetadataResult;
 import com.qmth.sop.business.entity.TDFormWidgetMetadata;
 import com.qmth.sop.business.mapper.TDFormWidgetMetadataMapper;
 import com.qmth.sop.business.service.TDFormWidgetMetadataService;
@@ -18,6 +19,7 @@ import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -74,11 +76,12 @@ public class TDFormWidgetMetadataServiceImpl extends ServiceImpl<TDFormWidgetMet
      * @return
      */
     @Override
-    public List<TDFormWidgetMetadata> selectAll(TFCustomTypeEnum type, Integer version) {
+    public List<FormWidgetMetadataResult> selectAll(TFCustomTypeEnum type, Integer version) {
         if (type != TFCustomTypeEnum.OFFICE_SOP_FLOW && type != TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW) {
             throw ExceptionResultEnum.ERROR.exception("流程类型只能为教务处或研究生");
         }
-        return this.list(new QueryWrapper<TDFormWidgetMetadata>().lambda().eq(TDFormWidgetMetadata::getType, type).eq(TDFormWidgetMetadata::getVersion, version).orderByAsc(TDFormWidgetMetadata::getSetup));
+//        return this.list(new QueryWrapper<TDFormWidgetMetadata>().lambda().eq(TDFormWidgetMetadata::getType, type).eq(TDFormWidgetMetadata::getVersion, version).orderByAsc(TDFormWidgetMetadata::getSetup));
+        return this.baseMapper.getFormWidgetMetadataResult(Objects.nonNull(type) ? type.name() : null, version);
     }
 
     /**

+ 16 - 0
sop-business/src/main/resources/mapper/TDFormWidgetMetadataMapper.xml

@@ -2,4 +2,20 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.TDFormWidgetMetadataMapper">
 
+    <select id="getFormWidgetMetadataResult" resultType="com.qmth.sop.business.bean.result.FormWidgetMetadataResult">
+        SELECT
+            t.*,tdfw.`options`
+        FROM
+            t_d_form_widget_metadata t
+            left join t_d_form_widget tdfw on tdfw.code =  t.code and CONCAT(tdfw.form_id,'_',t.setup) = t.field_id and tdfw.flow_type = t.type
+        <where> 1 = 1
+            <if test="type != null and type != ''">
+                and t.type = #{type}
+            </if>
+            <if test="version != null and version != ''">
+                and t.version = #{version}
+            </if>
+        </where>
+        ORDER BY setup ASC
+    </select>
 </mapper>