浏览代码

Merge remote-tracking branch 'origin/master'

Administrator 3 年之前
父节点
当前提交
b1b026c5db

+ 35 - 0
boman-modules/boman-system/src/main/java/com/boman/system/controller/SysDeptController.java

@@ -7,6 +7,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -262,4 +263,38 @@ public class SysDeptController extends BaseController
     public List<SysDept> getByParentId(@PathVariable("parentId") Long parentId) {
         return deptService.getByParentId(parentId);
     }
+
+    public AjaxResult setAncestors() {
+        List<SysDept> sysDepts = deptService.selectDepts(new SysDept());
+        for (SysDept sysDept : sysDepts) {
+            String ancestors = sysDept.getAncestors();
+            if (StringUtils.isEmpty(ancestors)) {
+                Long id = sysDept.getId();
+                SysDept parent1 = deptService.getParentById(id);
+                if (parent1 == null) {
+                    continue;
+                }
+
+                Long id1 = parent1.getId();
+                SysDept parent2 = deptService.getParentById(id1);
+                if (parent2 == null) {
+                    sysDept.setAncestors(id1 + "");
+                    continue;
+                }
+
+                Long id2 = parent2.getId();
+                SysDept parent3 = deptService.getParentById(id2);
+                if (parent3 == null) {
+                    sysDept.setAncestors(id2 + "," + id1);
+                    continue;
+                }
+
+                Long id3 = parent3.getId();
+                sysDept.setAncestors(id3 + "," + id2 + "," + id1);
+            }
+        }
+        
+        System.out.println(JSON.toJSONString(sysDepts));
+        return AjaxResult.success();
+    }
 }

+ 8 - 0
boman-modules/boman-system/src/main/java/com/boman/system/mapper/SysDeptMapper.java

@@ -130,4 +130,12 @@ public interface SysDeptMapper
      * @return 结果
      */
     public int deleteDeptById(Long id);
+
+    /**
+     * 功能描述: 只找父亲,不招爷爷
+     *
+     * @param deptId deptId
+     * @return com.boman.domain.SysDept
+     */
+    SysDept getParentById(Long deptId);
 }

+ 8 - 0
boman-modules/boman-system/src/main/java/com/boman/system/service/ISysDeptService.java

@@ -135,4 +135,12 @@ public interface ISysDeptService
     List<SysDept> getByParentId(Long deptId);
 
     public List<JSONObject> syncData() throws Exception;
+
+    /**
+     * 功能描述: 只找父亲,不招爷爷
+     *
+     * @param deptId deptId
+     * @return com.boman.domain.SysDept
+     */
+    SysDept getParentById(Long deptId);
 }

+ 11 - 0
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysDeptServiceImpl.java

@@ -508,4 +508,15 @@ public class SysDeptServiceImpl implements ISysDeptService {
 
         return deptMapper.getByParentId(deptId);
     }
+
+    /**
+     * 功能描述: 只找父亲,不招爷爷
+     *
+     * @param deptId deptId
+     * @return com.boman.domain.SysDept
+     */
+    @Override
+    public SysDept getParentById(Long deptId) {
+        return deptMapper.getParentById(deptId);
+    }
 }

+ 6 - 0
boman-modules/boman-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -175,4 +175,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		update sys_dept set del_flag = '2' where id = #{id}
 	</delete>
 
+
+	<select id="getParentById" resultMap="SysDeptResult">
+		<include refid="selectDeptVo"/>
+		where d.parent_id = #{deptId}
+	</select>
+
 </mapper> 

+ 5 - 5
boman-web-core/src/main/java/com/boman/web/core/controller/MoveYmjzDataController.java

@@ -83,7 +83,7 @@ public class MoveYmjzDataController {
                 age = null;
             }
             System.out.println("idCard: "+ idCard);
-            String process = VaccineInfoServiceImpl.getIsSuccess(生产厂家, 接种针次);
+            String progress = VaccineInfoServiceImpl.getIsSuccess(生产厂家, 接种针次);
             if (info == null) {
                 //insert
                 Long maxId = IdUtils.getMaxId("vaccine_info", "id");
@@ -94,7 +94,7 @@ public class MoveYmjzDataController {
                                 "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', )'; -- %s \r\n"
                         , maxId, 受种者姓名, 受种者性别, idCard
                         , 电话号码, "是", 生产厂家, 接种针次, 接种日期
-                        , 接种单位, "是", process
+                        , 接种单位, "是", progress
                         , 受种者编码, 出生日期, 工作单位, 人群分类, 生产厂家, age
                         , i);
                 stringBuilder.append(insert);
@@ -102,15 +102,15 @@ public class MoveYmjzDataController {
             } else {
                 String update = String.format("UPDATE vaccine_info set code = '%s'" +
                                 ", crowd_classification = '%s', vaccine_name = '%s', manufacturer = '%s', jici = '%s', vaccination_time = '%s'" +
-                                ", age = '%s', birthday = '%s', process = '%s' where id_card = '%s'; -- %s \r\n"
-                        , 受种者编码, 人群分类, 生产厂家, 生产厂家, 接种针次, 接种日期, age, 出生日期, process, idCard, i);
+                                ", age = '%s', birthday = '%s', progress = '%s' where id_card = '%s'; -- %s \r\n"
+                        , 受种者编码, 人群分类, 生产厂家, 生产厂家, 接种针次, 接种日期, age, 出生日期, progress, idCard, i);
                 stringBuilder.append(update);
                 System.err.println("count: " + i + ", " + update);
             }
 
             Long maxId = IdUtils.getMaxId("vaccine_info_user", "id");
             String userInsert = String.format("insert into vaccine_info_user (id, id_card, vaccine_name, jici, vaccination_time, vaccination_place) " +
-                    "values('%s', '%s', '%s', '%s', '%s', '%s')", maxId, idCard, 生产厂家, 接种针次, 接种日期, 接种单位);
+                    "values('%s', '%s', '%s', '%s', '%s', '%s');\r\n", maxId, idCard, 生产厂家, 接种针次, 接种日期, 接种单位);
             stringBuilder.append(userInsert);
             System.err.println("count: " + i + ", " + userInsert);