提交 0d7dfbd6 authored 作者: chenshiying's avatar chenshiying

[新增] 廊坊生成大小类管理问题sql

上级 b406ce95
package com.loit.common.langfang;
import com.loit.common.langfang.dto.CommandManualDTO;
import com.loit.common.langfang.dto.LimitUnitType;
import com.loit.common.utils.DateUtils;
import com.loit.common.utils.ListUtil;
import com.loit.common.utils.StringUtils;
import com.loit.common.utils.excel.ImportExcel;
......@@ -8,6 +10,8 @@ import com.loit.common.utils.file.FileUtils;
import com.loit.common.utils.freemarker.FreeMarkerUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
......@@ -20,6 +24,8 @@ import java.util.stream.Collectors;
@Slf4j
public class GeneratorCommandManualScript {
private static Logger logger = LoggerFactory.getLogger(GeneratorCommandManualScript.class);
public static final String CASE_TYPE = "1";
protected static String root_path = "F:\\9Git140\\loit-build-common\\loit-build-component\\loit-build-deploy-env\\src\\main\\resources\\langfang";
......@@ -48,7 +54,7 @@ public class GeneratorCommandManualScript {
createSmallTypeScript(transformList);
createManageProblemScript(transformList);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
......@@ -112,8 +118,7 @@ public class GeneratorCommandManualScript {
commandManual.setCtype(atype);
}
commandManual.setBigAndSmallCode(commandManual.getBigTypeCode() + "|"+ commandManual.getSmallTypeCode());
commandManual.setBigAndSmallCode(commandManual.getBigTypeCode() + "|" + commandManual.getSmallTypeCode());
commandManual.setBigTypeCodeInt(Integer.valueOf(commandManual.getBigTypeCode()));
......@@ -142,6 +147,9 @@ public class GeneratorCommandManualScript {
return;
}
bitTypeList.sort(Comparator.comparing(CommandManualDTO::getBigTypeCodeInt));
for (CommandManualDTO commandManualDTO : bitTypeList) {
Map model = new HashMap();
model.put("bigTypeCode", commandManualDTO.getBigTypeCode());
......@@ -188,4 +196,78 @@ public class GeneratorCommandManualScript {
}
}
/**
* 生成管理问题脚本
*
* @throws IOException
*/
private static void createManageProblemScript(List<CommandManualDTO> commandManualList) {
if (commandManualList == null || commandManualList.isEmpty()) {
return;
}
for (CommandManualDTO commandManualDTO : commandManualList) {
Map model = new HashMap();
model.put("bigTypeCode", commandManualDTO.getBigTypeCode());
model.put("bigTypeName", commandManualDTO.getBigTypeName());
model.put("smallTypeCode", commandManualDTO.getSmallTypeCode());
model.put("smallTypeName", commandManualDTO.getSmallTypeName());
model.put("manageProblem", commandManualDTO.getManageProblem());
model.put("datetime", DateUtils.getDateTime());
model.put("caseType", CASE_TYPE);
LimitUnitType alimitUnit = getLimitUnit(commandManualDTO.getAtype());
LimitUnitType blimitUnit = getLimitUnit(commandManualDTO.getBtype());
LimitUnitType climitUnit = getLimitUnit(commandManualDTO.getCtype());
model.put("alimit", alimitUnit.getLimit());
model.put("aunit", alimitUnit.getUnit());
model.put("blimit", blimitUnit.getLimit());
model.put("bunit", blimitUnit.getUnit());
model.put("climit", climitUnit.getLimit());
model.put("cunit", climitUnit.getUnit());
String configFilePath = root_path + "\\manageProblemScript.sql";
String jobConfig = FreeMarkerUtils.process("langfang" + "\\manageProblemScript.ftl", model);
FileUtils.append(configFilePath, jobConfig);
}
}
private static LimitUnitType getLimitUnit(String limitStr) {
LimitUnitType limitUnitType = new LimitUnitType();
if (StringUtils.isEmpty(limitStr)) {
logger.error("limitStr is null");
return limitUnitType;
}
limitStr = limitStr.trim();
//0:工作日,1:工作时, 2:紧急工作时
if (limitStr.contains("工作日")) {
limitUnitType.setUnit("0");
limitUnitType.setLimit(limitStr.replaceAll("工作日", "").trim());
} else if (limitStr.contains("紧急工作时")) {
limitUnitType.setUnit("2");
limitUnitType.setLimit(limitStr.replaceAll("紧急工作时", "").trim());
} else if (limitStr.contains("工作时")) {
limitUnitType.setUnit("1");
limitUnitType.setLimit(limitStr.replaceAll("工作时", "").trim());
}
if (limitUnitType.getLimit().length() > 1) {
logger.error("limit length > 1" + limitUnitType.getLimit());
}
return limitUnitType;
}
}
package com.loit.common.langfang.dto;
public class LimitUnitType {
private String limit;
//0:工作日,1:工作时, 2:紧急工作时
private String unit;
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}
INSERT INTO `digital_command_manual`(
`case_type`,
`door_type`,
`door_type_id`,
`big_type`,
`big_type_id`,
`small_type`,
`small_type_id`,
`small_type_all_code`,
`manage_problem`,
`handle_a_Limit_time`,
`handle_a_Limit_unit`,
`handle_b_Limit_time`,
`handle_b_Limit_unit`,
`handle_c_Limit_time`,
`handle_c_Limit_unit`,
`feedback_a_Limit_time`,
`feedback_a_Limit_unit`,
`feedback_b_Limit_time`,
`feedback_b_Limit_unit`,
`feedback_c_Limit_time`,
`feedback_c_Limit_unit`,
`first_handle_sm`,
`first_handle_hl`,
`first_handle_hc`,
`first_handle_jm`,
`first_handle_ta`,
`first_handle_xa`,
`first_handle_city`,
`file_name`,
`file_path`,
`finish_condition`,
`laws_regulations`,
`competent_department`,
`manage_subject`,
`enforce_subect`,
`synergy_unit`,
`coordinate_items`,
`remarks`,
`register_user`,
`create_time`,
`update_time`
)
VALUES (
'1',
NULL,
NULL,
'${bigTypeName}', -- 你的大类
'${bigTypeCode}', -- 大类的编码
'${smallTypeName}', -- 你的小类
'${smallTypeCode}', -- 小类的编码
NULL,
'施工过程中或者施工堆料未采取有效防尘措施造成扬尘现象', -- 管理问题
${alimit}, -- A 类处置时限
${aunit}, -- 0:工作日,1:工作时, 2:紧急工作时
${blimit}, -- B 类处置时限
${bunit}, -- 0:工作日,1:工作时, 2:紧急工作时
${climit}, -- C 类处置时限
${cunit}, -- 0:工作日,1:工作时, 2:紧急工作时
${alimit},
${aunit},
${blimit},
${bunit},
${climit},
${cunit},
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
'1、相关承办单位接到通知后,应在30分钟内派专人到现场勘验,迅速组织⼈员调查取
证。\n2、对明确的违法相对人,应实施宣传教有,责令整改并依法实施行政处罚。\n3、现场责令整
改要求在4工作时内处理完毕,并将处理结果反馈派遣单位。',
'法律法规',
NULL,
'质量安全部、综合执法局',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
'${datetime}'
);
......@@ -23,8 +23,8 @@ INSERT INTO `base_base_casetype`(
`case_type`
)
VALUES (
'${smallTypeCode}', -- 类编码,自己取一个
'${smallTypeName}', -- 修改你的
'${smallTypeCode}', -- 类编码,自己取一个
'${smallTypeName}', -- 修改你的
'${bigTypeCode}', -- 大类的 id
'',
'',
......@@ -46,3 +46,4 @@ NULL,
'3',
'${caseType}' -- 1:事件,2:部件
);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论