Parcourir la source

Merge branch 'V0.0.1' of http://10.87.10.227:4000/jzyd_yyds/soc into V0.0.1

jiawuxian il y a 2 ans
Parent
commit
fbf2525c5d

+ 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,

+ 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;

+ 35 - 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,40 @@ 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()) {
+//                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;
     }
 
     /**