Merge branch 'master' into docker_package
This commit is contained in:
commit
35d8b7715a
|
@ -107,6 +107,56 @@ public class CodeGenerationUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private void setApplyNumber(String type, final String id) {
|
||||
String applyNumberPattern = type + SIMPLE_DATE_FORMAT.format(new Date());
|
||||
if (StringUtils.isBlank(type)) {
|
||||
return;
|
||||
}
|
||||
String tableName = null;
|
||||
switch (type) {
|
||||
//能力上架
|
||||
case "NLSJ":
|
||||
tableName = "t_resource_mount_apply";
|
||||
break;
|
||||
//能力使用
|
||||
case "NLSY":
|
||||
tableName = "t_ability_application";
|
||||
break;
|
||||
//能力需求
|
||||
case "NLXQ":
|
||||
tableName = "t_demand_data";
|
||||
break;
|
||||
//需求评论
|
||||
case "XQPL":
|
||||
tableName = "t_demand_comment";
|
||||
break;
|
||||
//能力下架
|
||||
case "NLXJ":
|
||||
tableName = "tb_data_resource";
|
||||
break;
|
||||
}
|
||||
lock.lock();
|
||||
String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName +
|
||||
" WHERE 1 = 1 AND apply_number IS NOT NULL " +
|
||||
"AND apply_number LIKE '" + applyNumberPattern + "%' " +
|
||||
"ORDER BY apply_number DESC " +
|
||||
"LIMIT 1";
|
||||
logger.info(sql);
|
||||
String no = null;
|
||||
try {
|
||||
String s = jdbcTemplate.queryForObject(sql, String.class);
|
||||
no = applyNumberPattern.substring(0, 3) + (Long.parseLong(s) + 1);
|
||||
} catch (Exception e) {
|
||||
logger.error("流水号生成失败", e);
|
||||
no = applyNumberPattern + "0001";
|
||||
} finally {
|
||||
String sql_ = String.format("UPDATE %s SET apply_number = %s WHERE id = %s", tableName, no, id);
|
||||
logger.info(sql_);
|
||||
jdbcTemplate.update(sql_);
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private CodeGenerationUtils() {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue