|
@@ -1,5 +1,6 @@
|
|
|
package com.lc.ibps.platform.plan.job;
|
|
package com.lc.ibps.platform.plan.job;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
import com.lc.ibps.base.core.util.AppUtil;
|
|
@@ -25,26 +26,176 @@ public class BasicDataInitializationJob extends BaseJob2 {
|
|
|
@Override
|
|
@Override
|
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
public void executeJob(JobExecutionContext context) throws Exception {
|
|
|
|
|
|
|
|
|
|
+ //每日安全默认增加配置
|
|
|
|
|
+ //前置条件:设施环境配置表中已经有了每日安全的类型配置
|
|
|
|
|
+
|
|
|
|
|
+ //每日安全是基于先有设施才能添加的配置项
|
|
|
|
|
+ List<Map<String, Object>> list = get();
|
|
|
|
|
+ //若是为空则不需要加默认的配置,直接返回即可
|
|
|
|
|
+ if(Collections.isEmpty(list)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //组装数据加配置
|
|
|
|
|
+ List<Map<String, Object>> assemble = assemble(list); //直接加主表 返回子表
|
|
|
|
|
+
|
|
|
|
|
+ //添加子表数据
|
|
|
|
|
+ addAsseMble(assemble);
|
|
|
//get admin position id.
|
|
//get admin position id.
|
|
|
- String sql1 = "SELECT a.positions_ positions_,b.path_ path_ FROM ibps_party_employee a ,ibps_party_entity b WHERE a.id_=1 AND a.positions_=b.id_";
|
|
|
|
|
- Map<String, Object> p = commonDao.queryOne(sql1);
|
|
|
|
|
- if (p == null) return;
|
|
|
|
|
- String posAdmin = (String) p.get("positions_");
|
|
|
|
|
- String didianAdmin = ((String) p.get("path_")).split("\\.")[1];
|
|
|
|
|
|
|
+ // String sql1 = "SELECT a.positions_ positions_,b.path_ path_ FROM ibps_party_employee a ,ibps_party_entity b WHERE a.id_=1 AND a.positions_=b.id_";
|
|
|
|
|
+ // Map<String, Object> p = commonDao.queryOne(sql1);
|
|
|
|
|
+ // if (p == null) return;
|
|
|
|
|
+ //String posAdmin = (String) p.get("positions_");
|
|
|
|
|
+ //String didianAdmin = ((String) p.get("path_")).split("\\.")[1];
|
|
|
|
|
|
|
|
//文件类型数据
|
|
//文件类型数据
|
|
|
- executeWenJianStep(posAdmin,didianAdmin);
|
|
|
|
|
|
|
+ // executeWenJianStep(posAdmin,didianAdmin);
|
|
|
|
|
|
|
|
//岗位职责配置列表
|
|
//岗位职责配置列表
|
|
|
- excutePositionStep(posAdmin);
|
|
|
|
|
|
|
+ //excutePositionStep(posAdmin);
|
|
|
|
|
|
|
|
//其他的基础数据
|
|
//其他的基础数据
|
|
|
- executeBaseTablesStep(posAdmin);
|
|
|
|
|
|
|
+ // executeBaseTablesStep(posAdmin);
|
|
|
|
|
|
|
|
// 外部文件基础数据
|
|
// 外部文件基础数据
|
|
|
- externalFile();
|
|
|
|
|
|
|
+ // externalFile();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<Map<String,Object>> get(){
|
|
|
|
|
+ List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
|
|
|
|
|
+ String sql =" select subId,dept,area,roomName,location from v_facs where type = '06-每日安全检查' and (isRemoved is null or isRemoved= '') and (subId is not null) and " +
|
|
|
|
|
+ " not exists (select 1 from t_mraqjcjlpzb m where m.xuan_ze_pei_zhi_ = v_facs.subId )";
|
|
|
|
|
+ list = (List<Map<String,Object>>) commonDao.query(sql);
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private List<Map<String,Object>> assemble(List<Map<String, Object>> list) throws Exception{
|
|
|
|
|
+ //先组装主表数据
|
|
|
|
|
+ List<Map<String,Object>> zhu = new ArrayList<>();
|
|
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
|
|
+ for (Map<String,Object> item: list ) {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ String zhuId = UniqueIdUtil.getId();
|
|
|
|
|
+ ids.add(zhuId);
|
|
|
|
|
+ map.put("id_",zhuId);
|
|
|
|
|
+ map.put("xuan_ze_pei_zhi_",item.get("subId").toString());
|
|
|
|
|
+ map.put("bian_zhi_bu_men_",item.get("dept").toString());
|
|
|
|
|
+ map.put("bian_zhi_shi_jian", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
|
|
|
|
|
+ map.put("jian_cha_qu_yu_",item.get("area").toString());
|
|
|
|
|
+ map.put("jian_cha_fang_jia",item.get("roomName").toString());
|
|
|
|
|
+ map.put("di_dian_",item.get("location").toString());
|
|
|
|
|
+ map.put("lei_xing_","06-每日安全检查");
|
|
|
|
|
+ zhu.add(map);
|
|
|
|
|
+ commonDao.execute(this.buildInsertSql(map, "t_mraqjcjlpzb"));
|
|
|
|
|
+ }
|
|
|
|
|
+ //组装子表数据、
|
|
|
|
|
+ List<Map<String, Object>> sublist = sublist(ids);
|
|
|
|
|
+
|
|
|
|
|
+ return sublist;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<Map<String,Object>> sublist (List<String> ids){
|
|
|
|
|
+ List<Map<String,Object>> subList = new ArrayList<>();
|
|
|
|
|
+ if(ids.size()>0){
|
|
|
|
|
+ for (String id: ids) {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "1.上下水管");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map1 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "2.电源");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map2 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "3.门窗");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map3 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "4.微波炉");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map4 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "5.灭火器");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map5 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "6.空调");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> map6 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "7.酒精灯");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map7 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "8.高压锅");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map8 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "二、生物安全");
|
|
|
|
|
+ put("qing_kuang_","");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map9 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "1.个人防护");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map10 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "2.感染垃圾处理");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map11 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "3.生物安全柜使用");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map12 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "4.污染物浸泡");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ Map<String, Object> map13 = new HashMap<String, Object>() {{
|
|
|
|
|
+ put("parent_id_", id);
|
|
|
|
|
+ put("id_", UniqueIdUtil.getId());
|
|
|
|
|
+ put("xiang_mu_", "5.锐器处理");
|
|
|
|
|
+ put("qing_kuang_","合格");
|
|
|
|
|
+ }};
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return subList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void addAsseMble(List<Map<String,Object>> list) throws Exception{
|
|
|
|
|
+ if(Collections.isNotEmpty(list)){
|
|
|
|
|
+ for ( Map<String,Object> item: list) {
|
|
|
|
|
+ commonDao.execute(this.buildInsertSql(item, "t_mraqjcjlpzzb"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
private void excutePositionStep(String posAdmin) throws Exception {
|
|
private void excutePositionStep(String posAdmin) throws Exception {
|
|
|
String sql1 = "SELECT * FROM ibps_party_entity WHERE party_type_='position' AND depth_ IN (3,4) " +
|
|
String sql1 = "SELECT * FROM ibps_party_entity WHERE party_type_='position' AND depth_ IN (3,4) " +
|
|
|
" AND path_ NOT LIKE '%%%s%%' AND id_ NOT IN (SELECT bian_zhi_bu_men_ FROM t_dyzzb ) ORDER BY depth_ ";
|
|
" AND path_ NOT LIKE '%%%s%%' AND id_ NOT IN (SELECT bian_zhi_bu_men_ FROM t_dyzzb ) ORDER BY depth_ ";
|