Переглянути джерело

Merge remote-tracking branch 'origin/V0.0.1' into V0.0.1

jingyuanchao 2 роки тому
батько
коміт
b4c18c6794

+ 5 - 2
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SysOrg.java

@@ -84,6 +84,7 @@ public class SysOrg extends BaseEntity {
 
     @ApiModelProperty(value = "机构类型")
     @TableField(value = "type")
+    @JsonSerialize(using = ToStringSerializer.class)
     private Integer type;
 
     @ApiModelProperty(value = "路径")
@@ -107,7 +108,10 @@ public class SysOrg extends BaseEntity {
     @ApiModelProperty(value = "机构来源, 0:系统新增 1:fjnx同步")
     @TableField(value = "source")
     private Integer source;
-
+    @ApiModelProperty(value = "机构类型(同步)")
+    private String orgType;
+    @ApiModelProperty(value = "实际机构类型")
+    private String realityOrgType;
     /**
      * 机构简称
      */
@@ -129,7 +133,6 @@ public class SysOrg extends BaseEntity {
     private List<SysOrg> children = new ArrayList<SysOrg>();
 
 
-
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleItemServiceImpl.java

@@ -210,7 +210,7 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
     private RuleTreeItem generateTree(SysOrg parent, List<SysOrg> allOrg, List<AppRule> allRule) {
         RuleTreeItem item = RuleTreeItem.builder().isRule(0).id(parent.getId()).label(parent.getName()).children(new ArrayList<>()).build();
         List<RuleTreeItem> ruleItems = allRule.stream().filter(r -> ObjectUtil.equal(r.getOrgId(), parent.getId()))
-                .map(o -> RuleTreeItem.builder().isRule(1).id(o.getId()).label(o.getName()).orgType(parent.getType().toString()).build())
+                .map(o -> RuleTreeItem.builder().isRule(1).id(o.getId()).label(o.getName()).orgType(o.getOrgType()).build())
                 .collect(Collectors.toList());
         item.getChildren().addAll(ruleItems);
 

+ 26 - 6
soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingPlanMapper.xml

@@ -156,7 +156,7 @@
             and p.plan_status = #{request.planStatus}
         </if>
         <if test="request.planName!=null">
-            and p.plan_name = #{request.planName}
+            and p.plan_name like concat('%',#{request.planName},'%')
         </if>
         <choose>
             <when test="request.checkSub==true">
@@ -167,6 +167,14 @@
             </otherwise>
         </choose>
     </sql>
+    <sql id="pageRoleIncludeReuqest">
+        select distinct p1.id
+        from core_edu_training_plan p1
+                 inner join core_edu_training_plan_to_role r1 on p1.id = r1.plan_id
+        where p1.deleted = 0
+          and p1.plan_status = 0
+          and r1.role_id = #{request.planRoleId}
+    </sql>
     <insert id="insertCoreEduTrainingPlan" parameterType="com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan"
             useGeneratedKeys="true" keyProperty="id">
         insert into core_edu_training_plan
@@ -440,14 +448,26 @@
         p.issue,
         p.standard,
         P.belong_org_id,
-        P.belong_org_name from core_edu_training_plan p left join sys_user u on p.update_by=u.id where p.deleted = 0 and p.parent_id is null
+        P.belong_org_name from core_edu_training_plan p left join sys_user u on p.update_by=u.id
+        where p.deleted = 0 and p.parent_id is null
         and p.standard=1 and p.issue=1
-        and p.id in ( select sp.parent_id from core_edu_training_plan sp where sp.deleted = 0 and sp.parent_id is not null  <include refid="pageIncludeSP"/>)
+        <if test="request.planRoleId!=null">
+            and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
+        </if>
+        and p.id in ( select sp.parent_id from core_edu_training_plan sp where sp.deleted = 0 and sp.parent_id is not
+        null<include refid="pageIncludeSP"/>)
         <!-- 不是标准计划但是也没下发: 行社自建的计划 -->
-        or ( p.standard=0 and p.issue=0 and p.deleted=0 and p.parent_id is null  <include refid="pageIncludeP"/>)
+        or ( p.standard=0 and p.issue=0 and p.deleted=0 and p.parent_id is null
+        <if test="request.planRoleId!=null">
+            and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
+        </if>
+        <include refid="pageIncludeP"/>)
         <!-- 是标准计划但是未下发 -->
-        or ( p.standard=1 and p.issue=0 and p.deleted=0 and p.parent_id is null  <include refid="pageIncludeP"/>)
-
+        or ( p.standard=1 and p.issue=0 and p.deleted=0 and p.parent_id is null
+        <if test="request.planRoleId!=null">
+            and p.id in ( <include refid="pageRoleIncludeReuqest"/>)
+        </if>
+        <include refid="pageIncludeP"/>)
     </select>
     <select id="selectPageData1" resultType="com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanPageVo">
         select p.id as id,

+ 20 - 30
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanMapper.xml

@@ -83,13 +83,6 @@
             <if test="info.orgType != null">
                 and a.exec_org_type = #{info.orgType}
             </if>
-            <if test="info.checkSub==false">
-                and a.plan_of_org_id = #{info.orgId}
-            </if>
-            <if test="info.checkSub==true">
-                and a.plan_of_org_id in (select id from sys_org where path like concat( (select path from sys_org where
-                id =#{info.orgId}),'%'))
-            </if>
             <if test="info.roleList != null and info.roleList.size > 0">
                 and a.id in (select plan_id from core_resumption_plan_to_role where role_id in
                 <foreach collection="info.roleList" item="roleId" index="index" open="(" separator="," close=")">
@@ -97,29 +90,26 @@
                 </foreach>
                 )
             </if>
-            <!--            <if test="info.orgList != null and info.orgList.size > 0">-->
-            <!--                and a.id in (select plan_id from core_resumption_plan_to_exec_org where org_id in-->
-            <!--                (select id from sys_org-->
-            <!--                where path like concat((select path from sys_org where id=#{info.orgId}),'%')-->
-            <!--                )-->
-            <!--            </if>-->
-<!--            and a.id in (-->
-<!--            select if(plan_of_org_id=plan_create_org_id,id,parent_id ) as id from core_resumption_plan-->
-<!--            where 1=1-->
-<!--            <if test="info.checkSub==false">-->
-<!--                and plan_of_org_id=#{info.orgId}-->
-<!--            </if>-->
-<!--            <if test="info.checkSub==true">-->
-<!--                and plan_of_org_id in (select id from sys_org-->
-<!--                where path like concat((select path from sys_org where id=#{info.orgId}),'%'))-->
-<!--            </if>-->
-<!--            )-->
-            <!--            <if test="info.ids!=null and info.ids.size > 0">-->
-            <!--                and a.plan_of_org_id in-->
-            <!--                <foreach collection="info.ids" item="orgId" index="index" open="(" separator="," close=")">-->
-            <!--                    #{orgId}-->
-            <!--                </foreach>-->
-            <!--            </if>-->
+            and a.id in (
+            select id from core_resumption_plan
+            where 1=1
+            <if test="info.checkSub==false">
+                and plan_of_org_id=#{info.orgId}
+            </if>
+            <if test="info.checkSub==true">
+                and plan_of_org_id in (select id from sys_org
+                where path like concat((select path from sys_org where id=#{info.orgId}),'%'))
+            </if>
+            and parent_id not in (select id from core_resumption_plan
+            where 1=1
+            <if test="info.checkSub==false">
+                and plan_of_org_id=#{info.orgId}
+            </if>
+            <if test="info.checkSub==true">
+                and plan_of_org_id in (select id from sys_org
+                where path like concat((select path from sys_org where id=#{info.orgId}),'%'))
+            </if>)
+            )
         </where>
     </select>
     <select id="selectChildren" parameterType="com.xunmei.core.resumption.dto.plan.CoreResumptionPlanPageDto"

+ 1 - 1
soc-modules/soc-modules-sync/src/main/java/com/xunmei/sync/domain/FjnxOrg.java

@@ -21,7 +21,7 @@ import java.util.Date;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("t_fjnx_org")
+@TableName("sync_fjnx_org")
 @ApiModel(value="同步FJNX机构保存对象", description="")
 public class FjnxOrg implements Serializable {
 

+ 12 - 12
soc-modules/soc-modules-sync/src/main/java/com/xunmei/sync/domain/FjnxOrgBusinessRelation.java

@@ -16,7 +16,7 @@ import java.util.Date;
  */
 
 @Data
-@TableName("t_fjnx_org_business_relation")
+@TableName("sync_fjnx_org_business_relation")
 @ApiModel(value = "OrgBusinessRelation对象", description = "")
 public class FjnxOrgBusinessRelation implements Serializable {
 
@@ -25,27 +25,27 @@ public class FjnxOrgBusinessRelation implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
 
-    @ApiModelProperty(value = "机构id")
-    @TableField("org_id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long orgId;
+//    @ApiModelProperty(value = "机构id")
+//    @TableField("org_id")
+//    @JsonSerialize(using = ToStringSerializer.class)
+//    private Long orgId;
 
     @ApiModelProperty(value = "机构编码")
     @TableField("org_code")
     private String orgCode;
 
-    @ApiModelProperty(value = "业务父级Id")
-    @TableField("business_parent_id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long businessParentId;
+//    @ApiModelProperty(value = "业务父级Id")
+//    @TableField("business_parent_id")
+//    @JsonSerialize(using = ToStringSerializer.class)
+//    private Long businessParentId;
 
     @ApiModelProperty(value = "业务父级机构编码")
     @TableField("business_parent_code")
     private String businessParentCode;
 
-    @ApiModelProperty(value = "机构层级")
-    @TableField("org_level")
-    private Integer orgLevel;
+//    @ApiModelProperty(value = "机构层级")
+//    @TableField("org_level")
+//    private Integer orgLevel;
 
     @ApiModelProperty(value = "创建时间")
     @TableField("create_time")

+ 1 - 1
soc-modules/soc-modules-sync/src/main/java/com/xunmei/sync/domain/FjnxUser.java

@@ -14,7 +14,7 @@ import java.util.Date;
 
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("t_fjnx_user")
+@TableName("sync_fjnx_user")
 @ApiModel(value="同步FJNX用户保存对象", description="")
 public class FjnxUser {
 

+ 5 - 4
soc-modules/soc-modules-sync/src/main/java/com/xunmei/sync/service/impl/FJNXSyncServiceImpl.java

@@ -534,7 +534,6 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
                 } else {
                     log.error("同步人员【{}】所属机构编码【{}】在当前数据库中未找到,{}", x.getUserId() + x.getUserName(), x.getDepCode(), x);
                 }
-
             });
         }
         return result;
@@ -559,6 +558,7 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
         user.setSource(1);
         // TODO 机构状态和机构类型转换
         //user.setIsLock(fjnxOrgDto.getUsableFlag());
+        user.setOriginalOrgId(org.getId());
         return user;
 
     }
@@ -573,14 +573,15 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
         user.setJobNumber(fjnxUserDto.getTeller());
         user.setApproveStatus(1L);
         user.setUpdateTime(fjnxUserDto.getUpdateTime());
-        user.setOrgId(org.getId());
-        user.setOrgName(org.getName());
-        user.setOrgPath(org.getPath());
+        user.setOrgId(businessOrg.getId());
+        user.setOrgName(businessOrg.getName());
+        user.setOrgPath(businessOrg.getPath());
         //0 禁用 1 启用已改密码 2 启用未改密码
         user.setIsLock(fjnxUserDto.getUserStatus());
         // TODO 机构状态和机构类型转换
         //user.setIsLock(fjnxOrgDto.getUsableFlag());
         user.setSource(1);
+        user.setOriginalOrgId(org.getId());
         return user;
 
     }

+ 1 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/SysOrgExtend.java

@@ -157,6 +157,7 @@ public class SysOrgExtend extends BaseEntity {
      * 机构id
      */
     @ApiModelProperty(value = "机构id")
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long orgId;
     @ApiModelProperty(value = "建设时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

+ 1 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/SysPhysicalDefenseConstruction.java

@@ -75,6 +75,7 @@ public class SysPhysicalDefenseConstruction extends BaseEntity {
      * 机构id
      */
     @ApiModelProperty(value = "机构id")
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long orgId;
 
 

+ 4 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/dto/SysOrgExtendDto.java

@@ -6,11 +6,15 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.domain.SysOrgExtend;
+import com.xunmei.system.domain.SysPhysicalDefenseConstruction;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class SysOrgExtendDto  {
+    private List<SysPhysicalDefenseConstruction> constructionList;
     @TableId
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;

+ 36 - 9
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgExtendServiceImpl.java

@@ -2,12 +2,15 @@ package com.xunmei.system.service.impl;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.system.api.domain.SysOrg;
+import com.xunmei.system.domain.SysPhysicalDefenseConstruction;
 import com.xunmei.system.dto.SysOrgExtendDto;
 import com.xunmei.system.mapper.SysOrgMapper;
+import com.xunmei.system.mapper.SysPhysicalDefenseConstructionMapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -37,6 +40,8 @@ public class SysOrgExtendServiceImpl extends ServiceImpl<SysOrgExtendMapper, Sys
     private ISysOrgService orgService;
     @Autowired
     private SysOrgMapper orgMapper;
+    @Autowired
+    private SysPhysicalDefenseConstructionMapper physicalDefenseConstructionMapper;
 
     @Override
     public TableDataInfo<SysOrgExtend> selectPage(SysOrgExtend sysOrgExtend) {
@@ -113,14 +118,10 @@ public class SysOrgExtendServiceImpl extends ServiceImpl<SysOrgExtendMapper, Sys
 
     @Override
     public int insertOrUpdateSysOrgExtend(SysOrgExtendDto sysOrgExtend) {
-//        sysOrgExtend.setCreateTime(DateUtils.getNowDate());
-//        SysOrg sysOrg = orgMapper.selectById(sysOrgExtend.getParentId());
-//        sysOrgExtend.setId(IdWorker.getId());
-//        sysOrgExtend.setPath(sysOrg.getPath()+sysOrgExtend.getId()+"-");
+        //处理org数据
         sysOrgExtend.setDeleted(0);
-//        sysOrgExtend.setParentGuid(sysOrg.getParentGuid());
         SysOrg org = new SysOrg();
-        BeanUtils.copyProperties(sysOrgExtend,org);
+        BeanUtils.copyProperties(sysOrgExtend, org);
         boolean isOk = false;
         if (org.getId() != null) {
             if (StringUtils.isEmpty(org.getManagerPhone())) {
@@ -144,15 +145,41 @@ public class SysOrgExtendServiceImpl extends ServiceImpl<SysOrgExtendMapper, Sys
          */
         orgService.clearOrgCache();
         orgService.loadingOrgCache();
-//        orgService.saveOrUpdateOrg(org);
 
+        //处理物防建设数据
+        physicalDefenseConstructionMapper.delete(new LambdaQueryWrapper<SysPhysicalDefenseConstruction>().eq(SysPhysicalDefenseConstruction::getOrgId,org.getId()));
+        if (sysOrgExtend.getConstructionList() != null && sysOrgExtend.getConstructionList().size() > 0) {
+            for (SysPhysicalDefenseConstruction s :
+                    sysOrgExtend.getConstructionList()) {
+                s.setId(null);
+//                if (s.getOrgId() == null) {
+                    s.setOrgId(org.getId());
+                    s.setCreateTime(DateUtils.getNowDate());
+                    s.setType(4L);
+                    physicalDefenseConstructionMapper.insert(s);
+//                }
+//                else{
+//                    s.setUpdateTime(DateUtils.getNowDate());
+//                    physicalDefenseConstructionMapper.updateById(s);
+//                }
+            }
+        }
+
+        //处理机构扩展数据
         SysOrgExtend extend = new SysOrgExtend();
-        extend.setOrgId(org.getId());
         extend.setCreateTime(DateUtils.getNowDate());
         extend.setDetachedLobbyEquipment(sysOrgExtend.getDetachedLobbyEquipment());
         extend.setDetachedWallPenetratingEquipment(sysOrgExtend.getDetachedWallPenetratingEquipment());
         extend.setCashAddingRoomRemoteControl(sysOrgExtend.getCashAddingRoomRemoteControl());
-        return sysOrgExtendMapper.insert(extend);
+        if (sysOrgExtend.getOrgExtendId()!=null){
+            extend.setOrgId(org.getId());
+            extend.setId(sysOrgExtend.getOrgExtendId());
+            sysOrgExtendMapper.updateById(extend);
+        }else{
+            sysOrgExtendMapper.insert(extend);
+        }
+
+        return 0;
     }
 
     /**