Compare commits
3 Commits
cc015d6098
...
bbcd42e79f
Author | SHA1 | Date |
---|---|---|
youhong.ai | bbcd42e79f | |
youhong.ai | a4f9ded450 | |
youhong.ai | 04a019b5ce |
|
@ -688,15 +688,17 @@ $(() => {
|
||||||
$(() => {
|
$(() => {
|
||||||
const config = [{
|
const config = [{
|
||||||
// 源字段
|
// 源字段
|
||||||
sourceField: '',
|
sourceField: 'htksrq',
|
||||||
// 目标字段
|
// 目标字段
|
||||||
targetField: '',
|
targetField: 'htjsrq',
|
||||||
// 日期加月份字段
|
// 日期加月份字段
|
||||||
numberField: ''
|
numberField: 'contractperiod',
|
||||||
|
monthBase: 12
|
||||||
}, {
|
}, {
|
||||||
sourceField: '',
|
sourceField: 'syqksrq',
|
||||||
targetField: '',
|
targetField: 'syqjsrq',
|
||||||
numberField: ''
|
numberField: 'probationperiod',
|
||||||
|
monthBase: 1
|
||||||
}]
|
}]
|
||||||
|
|
||||||
runJs();
|
runJs();
|
||||||
|
@ -711,22 +713,26 @@ $(() => {
|
||||||
let fieldId = WfForm.convertFieldNameToId(configItem.numberField)
|
let fieldId = WfForm.convertFieldNameToId(configItem.numberField)
|
||||||
WfForm.bindFieldChangeEvent(fieldId, (obj, id, value) => {
|
WfForm.bindFieldChangeEvent(fieldId, (obj, id, value) => {
|
||||||
if ("" == value) {
|
if ("" == value) {
|
||||||
WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField, {value: ""}))
|
WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField), {value: ""})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let sourceValue = WfForm.getFieldValue(WfForm.convertFieldNameToId(configItem.sourceField));
|
let sourceValue = WfForm.getFieldValue(WfForm.convertFieldNameToId(configItem.sourceField));
|
||||||
|
if ("" == sourceValue) {
|
||||||
|
setTimeout(() => {
|
||||||
|
WfForm.changeFieldValue(fieldId, {value: ""})
|
||||||
|
}, 10)
|
||||||
|
}
|
||||||
let date = new Date(sourceValue)
|
let date = new Date(sourceValue)
|
||||||
date.setMonth(date.getMonth() + +value)
|
date.setMonth(date.getMonth() + +value * configItem.monthBase)
|
||||||
let objectDate = new Date();
|
date.setDate(date.getDate() - 1)
|
||||||
|
let day = date.getDate();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
let day = objectDate.getDate();
|
let year = date.getFullYear();
|
||||||
let month = objectDate.getMonth() + 1;
|
WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField), {
|
||||||
let year = objectDate.getFullYear();
|
|
||||||
WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField, {
|
|
||||||
value: `${year}-${fullNum(month)}-${fullNum(day)}`
|
value: `${year}-${fullNum(month)}-${fullNum(day)}`
|
||||||
}))
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fullNum(i) {
|
function fullNum(i) {
|
||||||
|
@ -738,4 +744,46 @@ $(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
/* ******************* 计算年月日 end ******************* */
|
/* ******************* 计算年月日 end ******************* */
|
||||||
|
|
||||||
|
|
||||||
|
/* ******************* 年假计算 start ******************* */
|
||||||
|
$(() => {
|
||||||
|
let config = {
|
||||||
|
// 基础年假
|
||||||
|
base: 21,
|
||||||
|
// 入职日期
|
||||||
|
dateField: 'jrbsjjtsj',
|
||||||
|
// 年假
|
||||||
|
targetField: 'nj'
|
||||||
|
}
|
||||||
|
|
||||||
|
runJs()
|
||||||
|
|
||||||
|
function runJs() {
|
||||||
|
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId(config.dateField), (obj, id, value) => {
|
||||||
|
let date = new Date(value)
|
||||||
|
let nowDate = new Date()
|
||||||
|
let njValue = calculateBonus(date, nowDate, config)
|
||||||
|
if (value !== 0) {
|
||||||
|
WfForm.changeFieldValue(WfForm.convertFieldNameToId(config.targetField), {value: njValue})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateBonus(startDate, endDate, config) {
|
||||||
|
const diffInMs = endDate.getTime() - startDate.getTime();
|
||||||
|
const diffInYears = diffInMs / (1000 * 60 * 60 * 24 * 365);
|
||||||
|
|
||||||
|
if (diffInYears < 3) {
|
||||||
|
return 0;
|
||||||
|
} else if (diffInYears >= 3 && diffInYears < 6) {
|
||||||
|
return config.base;
|
||||||
|
} else {
|
||||||
|
const extraYears = Math.floor((diffInYears - 3) / 3);
|
||||||
|
return config.base + extraYears * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/* ******************* 年假计算 end ******************* */
|
|
@ -71,6 +71,7 @@ import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
@ -98,7 +99,7 @@ public class Util extends weaver.general.Util {
|
||||||
public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔
|
public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔
|
||||||
public static final ExecutorService threadPool = ThreadPoolConfig.createThreadPoolInstance();
|
public static final ExecutorService threadPool = ThreadPoolConfig.createThreadPoolInstance();
|
||||||
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
|
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
|
||||||
private static final UtilService utilService = new UtilService();
|
private static UtilService utilService = null;
|
||||||
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
||||||
private static final RecordsetUtil recordsetTransUtil = new RecordsetUtil();
|
private static final RecordsetUtil recordsetTransUtil = new RecordsetUtil();
|
||||||
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
|
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
|
||||||
|
@ -110,12 +111,20 @@ public class Util extends weaver.general.Util {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
rs = new RecordSet();
|
rs = new RecordSet();
|
||||||
|
utilService = new UtilService();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
new ToolUtil().writeErrorLog("\n初始化RecordSet失败!请检查系统是否正常启动!\n");
|
new ToolUtil().writeErrorLog("\n初始化RecordSet失败!请检查系统是否正常启动!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UtilService getUtilService() {
|
||||||
|
if (utilService == null) {
|
||||||
|
return new UtilService();
|
||||||
|
}
|
||||||
|
return utilService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定格式的当前时间
|
* 获取指定格式的当前时间
|
||||||
*
|
*
|
||||||
|
@ -1582,12 +1591,12 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
public static ApiConfigMainDTO queryApiConfig(String id) {
|
public static ApiConfigMainDTO queryApiConfig(String id) {
|
||||||
// System.out.println(JSON.toJSONString(apiConfigMain));
|
// System.out.println(JSON.toJSONString(apiConfigMain));
|
||||||
return utilService.getApiConfigMain(id);
|
return getUtilService().getApiConfigMain(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApiConfigMainDTO queryApiConfigTree(String id) {
|
public static ApiConfigMainDTO queryApiConfigTree(String id) {
|
||||||
// System.out.println(JSON.toJSONString(apiConfigMain));
|
// System.out.println(JSON.toJSONString(apiConfigMain));
|
||||||
return utilService.getApiConfigMainTree(id);
|
return getUtilService().getApiConfigMainTree(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> AZipOutputStream createZip(List<T> inputList) throws IOException {
|
public static <T> AZipOutputStream createZip(List<T> inputList) throws IOException {
|
||||||
|
@ -1711,13 +1720,13 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> queryLanguage(int groupId, int languageId) {
|
public static Map<String, String> queryLanguage(int groupId, int languageId) {
|
||||||
return utilService.queryLanguage(groupId, languageId);
|
return getUtilService().queryLanguage(groupId, languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> queryLanguage(int groupId, HttpServletRequest request, HttpServletResponse response) {
|
public static Map<String, String> queryLanguage(int groupId, HttpServletRequest request, HttpServletResponse response) {
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
int languageId = user.getLanguage();
|
int languageId = user.getLanguage();
|
||||||
return utilService.queryLanguage(groupId, languageId);
|
return getUtilService().queryLanguage(groupId, languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2920,6 +2929,17 @@ public class Util extends weaver.general.Util {
|
||||||
submitWorkflowThread(requestId, userId, remark, 60);
|
submitWorkflowThread(requestId, userId, remark, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>异步提交流程,一般作用于action在节点前</h2>
|
||||||
|
*
|
||||||
|
* @param requestId 流程ID
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param remark 签字意见
|
||||||
|
*/
|
||||||
|
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, Consumer<Boolean> callback) {
|
||||||
|
submitWorkflowThread(requestId, userId, remark, 60, callback);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>异步提交流程,一般作用于action在节点前</h2>
|
* <h2>异步提交流程,一般作用于action在节点前</h2>
|
||||||
*
|
*
|
||||||
|
@ -2929,6 +2949,10 @@ public class Util extends weaver.general.Util {
|
||||||
* @param seconds 延时多少秒提交
|
* @param seconds 延时多少秒提交
|
||||||
*/
|
*/
|
||||||
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, int seconds) {
|
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, int seconds) {
|
||||||
|
submitWorkflowThread(requestId, userId, remark, seconds, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, int seconds, Consumer<Boolean> callback) {
|
||||||
if (seconds <= 0) {
|
if (seconds <= 0) {
|
||||||
seconds = 1;
|
seconds = 1;
|
||||||
}
|
}
|
||||||
|
@ -2941,7 +2965,9 @@ public class Util extends weaver.general.Util {
|
||||||
Util.getLogger().error("线程休眠失败", e);
|
Util.getLogger().error("线程休眠失败", e);
|
||||||
}
|
}
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
while (!Util.submitWorkflow(requestId, userId, remark)) {
|
while (!Util.submitWorkflow(requestId, userId, remark)) {
|
||||||
|
log.info("异步提交流程失败,正在进行重试!!");
|
||||||
n++;
|
n++;
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000 * 10);
|
Thread.sleep(1000 * 10);
|
||||||
|
@ -2949,10 +2975,17 @@ public class Util extends weaver.general.Util {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (n > 5) {
|
if (n > 5) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.accept(false);
|
||||||
|
}
|
||||||
Util.getLogger().error("异步流程自动提交失败!");
|
Util.getLogger().error("异步流程自动提交失败!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("异步提交流程成功!");
|
||||||
|
if (callback != null) {
|
||||||
|
callback.accept(true);
|
||||||
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4020,4 +4053,30 @@ public class Util extends weaver.general.Util {
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String createTempFile(InputStream inputStream, String imageFileName, String tempDir) {
|
||||||
|
String filePath = getTempFilePath(tempDir, imageFileName);
|
||||||
|
try {
|
||||||
|
writeToFile(inputStream, filePath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new CustomerException("create temp file error!", e);
|
||||||
|
}
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeToFile(InputStream inputStream, String filePath) throws IOException {
|
||||||
|
Path path = Paths.get(filePath);
|
||||||
|
Path parentDir = path.getParent();
|
||||||
|
if (parentDir != null) {
|
||||||
|
Files.createDirectories(parentDir);
|
||||||
|
}
|
||||||
|
Files.createFile(path);
|
||||||
|
|
||||||
|
try (FileOutputStream outputStream = new FileOutputStream(filePath)) {
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ public abstract class SafeCusBaseAction implements Action {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Util.verifyRequiredField(this);
|
Util.verifyRequiredField(this);
|
||||||
|
log.info("action trigger by " + src);
|
||||||
if (!Strings.isNullOrEmpty(src)) {
|
if (!Strings.isNullOrEmpty(src)) {
|
||||||
src = "submit";
|
src = "submit";
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,4 +14,6 @@ import java.lang.annotation.*;
|
||||||
@Documented
|
@Documented
|
||||||
public @interface CollectionMethod {
|
public @interface CollectionMethod {
|
||||||
int value();
|
int value();
|
||||||
|
|
||||||
|
String desc() default "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,28 +17,28 @@ import java.util.List;
|
||||||
|
|
||||||
public class UtilDao {
|
public class UtilDao {
|
||||||
private final RecordSet rs = new RecordSet();
|
private final RecordSet rs = new RecordSet();
|
||||||
|
|
||||||
|
|
||||||
public ApiConfigMainDTO getApiConfigMain(String id) {
|
public ApiConfigMainDTO getApiConfigMain(String id) {
|
||||||
String query = "select id,workflow_type,api_url,api_name from uf_api_param_config where id = ?";
|
String query = "select id,workflow_type,api_url,api_name from uf_api_param_config where id = ?";
|
||||||
rs.executeQuery(query, id);
|
rs.executeQuery(query, id);
|
||||||
return Util.recordeSet2Entity(rs, ApiConfigMainDTO.class, true);
|
return Util.recordeSet2Entity(rs, ApiConfigMainDTO.class, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiConfigDetailDTO> getApiConfigDetail(int mainId) {
|
public List<ApiConfigDetailDTO> getApiConfigDetail(int mainId) {
|
||||||
String query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " +
|
String query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " +
|
||||||
"dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql " +
|
"dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql " +
|
||||||
"from uf_api_param_config_dt1 dt " +
|
"from uf_api_param_config_dt1 dt " +
|
||||||
"left join workflow_field_table_view wf on wf.id = dt.workflow_field " +
|
"left join workflow_field_table_view wf on wf.id = dt.workflow_field " +
|
||||||
"where mainid = ? and (are_use is null or are_use = 1)";
|
"where mainid = ? and (are_use is null or are_use = 1)";
|
||||||
rs.executeQuery(query, mainId);
|
rs.executeQuery(query, mainId);
|
||||||
return Util.recordeSet2Array(rs, ApiConfigDetailDTO.class, true);
|
return Util.recordeSet2Array(rs, ApiConfigDetailDTO.class, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MultiLanguageDTO> queryLanguage(int groupId) {
|
public List<MultiLanguageDTO> queryLanguage(int groupId) {
|
||||||
String query = "select * from uf_multi_language_dt1 where mainid = ?";
|
String query = "select * from uf_multi_language_dt1 where mainid = ?";
|
||||||
rs.executeQuery(query, groupId);
|
rs.executeQuery(query, groupId);
|
||||||
return Util.recordeSet2Array(rs, MultiLanguageDTO.class, true);
|
return Util.recordeSet2Array(rs, MultiLanguageDTO.class, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class PdfUtil {
|
||||||
FileOutputStream outputStreamTem;
|
FileOutputStream outputStreamTem;
|
||||||
try {
|
try {
|
||||||
outputStreamTem = new FileOutputStream(tempPath);
|
outputStreamTem = new FileOutputStream(tempPath);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (Exception e) {
|
||||||
throw new CustomerException("创建临时文件流和路径转换失败!", e);
|
throw new CustomerException("创建临时文件流和路径转换失败!", e);
|
||||||
}
|
}
|
||||||
PdfStamper pdfStamper = null;
|
PdfStamper pdfStamper = null;
|
||||||
|
|
|
@ -18,58 +18,58 @@ import java.util.List;
|
||||||
|
|
||||||
@SqlMapper
|
@SqlMapper
|
||||||
public interface OrgChartMapper {
|
public interface OrgChartMapper {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询所有的在职状态人员</h2>
|
* <h2>查询所有的在职状态人员</h2>
|
||||||
* <i>2022/12/5 11:05</i>
|
* <i>2022/12/5 11:05</i>
|
||||||
* ******************************************
|
* ******************************************
|
||||||
*
|
*
|
||||||
* @param typeOfEmploymentField 人员自定义字段
|
* @param typeOfEmploymentField 人员自定义字段
|
||||||
* @return List<HrmResource> 返回的人员信息
|
* @return List<HrmResource> 返回的人员信息
|
||||||
* @author youHong.ai ******************************************
|
* @author youHong.ai ******************************************
|
||||||
*/
|
*/
|
||||||
@Select("select hrm.id, " +
|
@Select("select hrm.id, " +
|
||||||
" hrm.subcompanyid1 sub_company_id," +
|
" hrm.subcompanyid1 sub_company_id," +
|
||||||
" hrm.messagerurl avatar," +
|
" hrm.messagerurl avatar," +
|
||||||
" (case when cus.$t{lastNameEnField} is null then hrm.lastname " +
|
" (case when cus.$t{lastNameEnField} is null then hrm.lastname " +
|
||||||
" else cus.$t{lastNameEnField} end) last_name, " +
|
" else cus.$t{lastNameEnField} end) last_name, " +
|
||||||
" hrm.managerstr manager_str, " +
|
" hrm.managerstr manager_str, " +
|
||||||
" hrm.jobtitle job_title_id, " +
|
" hrm.jobtitle job_title_id, " +
|
||||||
" hrm.managerid manager_id, " +
|
" hrm.managerid manager_id, " +
|
||||||
" hrm.departmentid department_id, " +
|
" hrm.departmentid department_id, " +
|
||||||
" dept.DEPARTMENTNAME department_name, " +
|
" dept.DEPARTMENTNAME department_name, " +
|
||||||
" job.JOBTITLENAME job_title_name, " +
|
" job.JOBTITLENAME job_title_name, " +
|
||||||
" uftb.$t{parentField} type_of_employment " +
|
" uftb.$t{parentField} type_of_employment " +
|
||||||
"from hrmresource hrm " +
|
"from hrmresource hrm " +
|
||||||
" inner join hrmjobtitles job on hrm.JOBTITLE = job.id " +
|
" left join hrmjobtitles job on hrm.JOBTITLE = job.id " +
|
||||||
" inner join cus_fielddata cus on cus.ID = hrm.ID " +
|
" left join cus_fielddata cus on cus.ID = hrm.ID " +
|
||||||
" and cus.SCOPE = 'HrmCustomFieldByInfoType' " +
|
" and cus.SCOPE = 'HrmCustomFieldByInfoType' " +
|
||||||
" and cus.SCOPEID = 1 " +
|
" and cus.SCOPEID = 1 " +
|
||||||
" inner join cus_fielddata cus1 on cus1.id = hrm.id" +
|
" left join cus_fielddata cus1 on cus1.id = hrm.id" +
|
||||||
" and cus1.scope = 'HrmCustomFieldByInfoType' " +
|
" and cus1.scope = 'HrmCustomFieldByInfoType' " +
|
||||||
" and cus1.scopeid = -1" +
|
" and cus1.scopeid = -1" +
|
||||||
" inner join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " +
|
" left join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " +
|
||||||
" inner join $t{typeOfEmploymentTable} uftb on uftb.$t{typeOfEmploymentIdField} = cus1.$t{typeOfEmploymentFiled} " +
|
" left join $t{typeOfEmploymentTable} uftb on uftb.$t{typeOfEmploymentIdField} = cus1.$t{typeOfEmploymentFiled} " +
|
||||||
"where hrm.status in (0, 1)")
|
"where hrm.status in (0, 1)")
|
||||||
List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField,
|
List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField,
|
||||||
@ParamMapper("lastNameEnField") String lastNameEnField,
|
@ParamMapper("lastNameEnField") String lastNameEnField,
|
||||||
@ParamMapper("typeOfEmploymentTable") String typeOfEmploymentTable,
|
@ParamMapper("typeOfEmploymentTable") String typeOfEmploymentTable,
|
||||||
@ParamMapper("parentField") String parentField,
|
@ParamMapper("parentField") String parentField,
|
||||||
@ParamMapper("typeOfEmploymentIdField") String typeOfEmploymentIdField);
|
@ParamMapper("typeOfEmploymentIdField") String typeOfEmploymentIdField);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询当前人员配置信息,是否全部展开,是否显示小红点点</h2>
|
* <h2>查询当前人员配置信息,是否全部展开,是否显示小红点点</h2>
|
||||||
* <i>2022/12/5 11:51</i>
|
* <i>2022/12/5 11:51</i>
|
||||||
* ******************************************
|
* ******************************************
|
||||||
*
|
*
|
||||||
* @param userId 当前用户id
|
* @param userId 当前用户id
|
||||||
* @return ShowPointOrAll 展示与否的人员信息
|
* @return ShowPointOrAll 展示与否的人员信息
|
||||||
* @author youHong.ai ******************************************
|
* @author youHong.ai ******************************************
|
||||||
*/
|
*/
|
||||||
@Select("select id,resources,show_all,show_type from uf_show_point_or_all " +
|
@Select("select id,resources,show_all,show_type from uf_show_point_or_all " +
|
||||||
"where concat(',',resources,',') like concat('%,',#{userId},',%')")
|
"where concat(',',resources,',') like concat('%,',#{userId},',%')")
|
||||||
ShowPointOrAll selectShowPointOrAll(@ParamMapper("userId") int userId);
|
ShowPointOrAll selectShowPointOrAll(@ParamMapper("userId") int userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,258 +27,266 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class OrgChartService {
|
public class OrgChartService {
|
||||||
|
|
||||||
private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class);
|
private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class);
|
||||||
|
|
||||||
private final OrgChartMapStruct struct = OrgChartMapStruct.INSTANCE;
|
private final OrgChartMapStruct struct = OrgChartMapStruct.INSTANCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>获取人员组织架构图数据</h2>
|
* <h2>获取人员组织架构图数据</h2>
|
||||||
*
|
*
|
||||||
* @param logInUser 当前登陆对象
|
* @param logInUser 当前登陆对象
|
||||||
* @return 组织架构图数据
|
* @return 组织架构图数据
|
||||||
* @author youHong.ai
|
* @author youHong.ai
|
||||||
*/
|
*/
|
||||||
public List<OrgChartNodeVo> getOrgChartTree(User logInUser) {
|
public List<OrgChartNodeVo> getOrgChartTree(User logInUser) {
|
||||||
int userId = logInUser.getUID();
|
int userId = logInUser.getUID();
|
||||||
AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>();
|
AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>();
|
||||||
List<HrmResourceDto> hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
|
List<HrmResourceDto> hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
|
||||||
/* ******************* 系统管理员默认全部展开哦 ******************* */
|
/* ******************* 系统管理员默认全部展开哦 ******************* */
|
||||||
if (userId == 1) {
|
if (userId == 1) {
|
||||||
return systemAdminTree(hrmResourceDtoList);
|
return systemAdminTree(hrmResourceDtoList);
|
||||||
}
|
}
|
||||||
filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
|
filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
|
||||||
/* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */
|
/* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */
|
||||||
ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId);
|
ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId);
|
||||||
List<OrgChartNodeVo> orgChartNodeVoList = null;
|
List<OrgChartNodeVo> orgChartNodeVoList = null;
|
||||||
if (Objects.isNull(showPointOrAll)) {
|
if (Objects.isNull(showPointOrAll)) {
|
||||||
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
||||||
orgChartNodeVoList = hrmResourceDtoList.stream()
|
orgChartNodeVoList = hrmResourceDtoList.stream()
|
||||||
.map(struct::hrmResourceDtoToVo)
|
.map(struct::hrmResourceDtoToVo)
|
||||||
.peek(item -> item.setType(-1))
|
.peek(item -> item.setType(-1))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
||||||
orgChartNodeVoList = hrmResourceDtoList.stream()
|
orgChartNodeVoList = hrmResourceDtoList.stream()
|
||||||
.map(struct::hrmResourceDtoToVo)
|
.map(struct::hrmResourceDtoToVo)
|
||||||
.peek(item -> {
|
.peek(item -> {
|
||||||
if (showPointOrAll.isShowAll()) {
|
if (showPointOrAll.isShowAll()) {
|
||||||
Builder.startSet(item)
|
Builder.startSet(item)
|
||||||
.with(OrgChartNodeVo::setShow, 1)
|
.with(OrgChartNodeVo::setShow, 1)
|
||||||
.with(OrgChartNodeVo::setShowBrother, 1)
|
.with(OrgChartNodeVo::setShowBrother, 1)
|
||||||
.with(OrgChartNodeVo::setShowChildren, 1)
|
.with(OrgChartNodeVo::setShowChildren, 1)
|
||||||
.endSet();
|
.endSet();
|
||||||
}
|
}
|
||||||
if (!showPointOrAll.isShowType()) {
|
if (!showPointOrAll.isShowType()) {
|
||||||
item.setType(-1);
|
item.setType(-1);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId,
|
sortByNameFirstLetter(orgChartNodeVoList);
|
||||||
OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren,
|
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId,
|
||||||
OrgChartNodeVo::setChildren,
|
OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren,
|
||||||
parentId -> parentId == null || parentId <= 0)
|
OrgChartNodeVo::setChildren,
|
||||||
.stream()
|
parentId -> parentId == null || parentId <= 0)
|
||||||
.peek(item -> item.setIsRoot(true))
|
.stream()
|
||||||
.peek(item -> recursionChildrenNums(item, 0))
|
.peek(item -> item.setIsRoot(true))
|
||||||
.collect(Collectors.toList());
|
.peek(item -> recursionChildrenNums(item, 0))
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public static void sortByNameFirstLetter(List<OrgChartNodeVo> nodeList) {
|
||||||
* <h2>getOrgChartTreeAll 获取所有的数据并默认展开</h2>
|
nodeList.sort((node1, node2) -> {
|
||||||
* <i>2022/12/16 17:21</i>
|
String name1 = node1.getName();
|
||||||
* ************************************************************
|
String name2 = node2.getName();
|
||||||
*
|
return name1.compareToIgnoreCase(name2);
|
||||||
* @param logInUser 当前登陆id
|
});
|
||||||
* @return List<OrgChartNodeVo> 最终树
|
}
|
||||||
* @author youHong.ai ******************************************
|
|
||||||
*/
|
/**
|
||||||
public List<OrgChartNodeVo> getOrgChartTreeAll(User logInUser) {
|
* <h2>getOrgChartTreeAll 获取所有的数据并默认展开</h2>
|
||||||
int userId = logInUser.getUID();
|
* <i>2022/12/16 17:21</i>
|
||||||
AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>();
|
* ************************************************************
|
||||||
List<HrmResourceDto> hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
|
*
|
||||||
/* ******************* 系统管理员默认全部展开哦 ******************* */
|
* @param logInUser 当前登陆id
|
||||||
if (userId == 1) {
|
* @return List<OrgChartNodeVo> 最终树
|
||||||
return systemAdminTree(hrmResourceDtoList);
|
* @author youHong.ai ******************************************
|
||||||
}
|
*/
|
||||||
filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
|
public List<OrgChartNodeVo> getOrgChartTreeAll(User logInUser) {
|
||||||
List<OrgChartNodeVo> orgChartNodeVoList = null;
|
int userId = logInUser.getUID();
|
||||||
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>();
|
||||||
orgChartNodeVoList = hrmResourceDtoList.stream()
|
List<HrmResourceDto> hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
|
||||||
.map(struct::hrmResourceDtoToVo)
|
/* ******************* 系统管理员默认全部展开哦 ******************* */
|
||||||
.peek(item ->
|
if (userId == 1) {
|
||||||
Builder.startSet(item)
|
return systemAdminTree(hrmResourceDtoList);
|
||||||
.with(OrgChartNodeVo::setShow, 1)
|
}
|
||||||
.with(OrgChartNodeVo::setShowBrother, 1)
|
filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
|
||||||
.with(OrgChartNodeVo::setShowChildren, 1)
|
List<OrgChartNodeVo> orgChartNodeVoList = null;
|
||||||
.endSet()
|
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
||||||
).collect(Collectors.toList());
|
orgChartNodeVoList = hrmResourceDtoList.stream()
|
||||||
|
.map(struct::hrmResourceDtoToVo)
|
||||||
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId,
|
.peek(item ->
|
||||||
OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren,
|
Builder.startSet(item)
|
||||||
OrgChartNodeVo::setChildren,
|
.with(OrgChartNodeVo::setShow, 1)
|
||||||
parentId -> parentId == null || parentId <= 0)
|
.with(OrgChartNodeVo::setShowBrother, 1)
|
||||||
.stream()
|
.with(OrgChartNodeVo::setShowChildren, 1)
|
||||||
.peek(item -> item.setIsRoot(true))
|
.endSet()
|
||||||
.peek(item -> recursionChildrenNums(item, 0))
|
).collect(Collectors.toList());
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId,
|
||||||
|
OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren,
|
||||||
|
OrgChartNodeVo::setChildren,
|
||||||
/**
|
parentId -> parentId == null || parentId <= 0)
|
||||||
* <h2>filterCurrentSubCom 过滤当前分部的人员,并且设置用户上级标识</h2>
|
.stream()
|
||||||
* <i>2022/12/16 17:16</i>
|
.peek(item -> item.setIsRoot(true))
|
||||||
* ************************************************************
|
.peek(item -> recursionChildrenNums(item, 0))
|
||||||
*
|
.collect(Collectors.toList());
|
||||||
* @param hrmResourceDtoList 人力资源dtolist
|
}
|
||||||
* @param currentUser 当前用户
|
|
||||||
* @param logInUser 当前登陆用户
|
|
||||||
* @author youHong.ai ******************************************
|
/**
|
||||||
*/
|
* <h2>filterCurrentSubCom 过滤当前分部的人员,并且设置用户上级标识</h2>
|
||||||
private void filterCurrentSubCom(List<HrmResourceDto> hrmResourceDtoList,
|
* <i>2022/12/16 17:16</i>
|
||||||
AtomicReference<HrmResourceDto> currentUser,
|
* ************************************************************
|
||||||
User logInUser) {
|
*
|
||||||
Assert.notNull(currentUser.get(), "not find current login user info!");
|
* @param hrmResourceDtoList 人力资源dtolist
|
||||||
/* ******************* 根据当前登陆人的分部来过滤 ******************* */
|
* @param currentUser 当前用户
|
||||||
hrmResourceDtoList = hrmResourceDtoList.stream()
|
* @param logInUser 当前登陆用户
|
||||||
.filter(item -> logInUser.getUserSubCompany1() == item.getSubCompanyId())
|
* @author youHong.ai ******************************************
|
||||||
.collect(Collectors.toList());
|
*/
|
||||||
/* ******************* 查找当前登陆人员的所有上级 ******************* */
|
private void filterCurrentSubCom(List<HrmResourceDto> hrmResourceDtoList,
|
||||||
String currentUserManagerStr = currentUser.get().getManagerStr();
|
AtomicReference<HrmResourceDto> currentUser,
|
||||||
if (Objects.isNull(currentUserManagerStr) || "".equals(currentUserManagerStr)) {
|
User logInUser) {
|
||||||
currentUserManagerStr = "0";
|
Assert.notNull(currentUser.get(), "not find current login user info!");
|
||||||
}
|
/* ******************* 根据当前登陆人的分部来过滤 ******************* */
|
||||||
currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ",");
|
hrmResourceDtoList = hrmResourceDtoList.stream()
|
||||||
List<Integer> currentUserManagerList = Arrays.stream(currentUserManagerStr.split(","))
|
.filter(item -> logInUser.getUserSubCompany1() == item.getSubCompanyId())
|
||||||
.map(Integer::parseInt)
|
.collect(Collectors.toList());
|
||||||
.collect(Collectors.toList());
|
/* ******************* 查找当前登陆人员的所有上级 ******************* */
|
||||||
/* ******************* 对当前用户的所有直接上级设置标识 ******************* */
|
String currentUserManagerStr = currentUser.get().getManagerStr();
|
||||||
hrmResourceDtoList.stream()
|
if (Objects.isNull(currentUserManagerStr) || "".equals(currentUserManagerStr)) {
|
||||||
.filter(item -> currentUserManagerList.contains(item.getId()))
|
currentUserManagerStr = "0";
|
||||||
.forEach(item -> Builder.startSet(item)
|
}
|
||||||
.with(HrmResourceDto::setShowChildren, 1)
|
currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ",");
|
||||||
.with(HrmResourceDto::setCurrentParent, true)
|
List<Integer> currentUserManagerList = Arrays.stream(currentUserManagerStr.split(","))
|
||||||
.endSet());
|
.map(Integer::parseInt)
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
/* ******************* 对当前用户的所有直接上级设置标识 ******************* */
|
||||||
|
hrmResourceDtoList.stream()
|
||||||
|
.filter(item -> currentUserManagerList.contains(item.getId()))
|
||||||
/**
|
.forEach(item -> Builder.startSet(item)
|
||||||
* <h2>systemAdminTree 系统管理员返回全部展开的数据</h2>
|
.with(HrmResourceDto::setShowChildren, 1)
|
||||||
* <i>2022/12/16 17:15</i>
|
.with(HrmResourceDto::setCurrentParent, true)
|
||||||
* ************************************************************
|
.endSet());
|
||||||
*
|
|
||||||
* @param hrmResourceDtoList 人力资源dtolist
|
}
|
||||||
* @return List<OrgChartNodeVo> 树型list
|
|
||||||
* @author youHong.ai ******************************************
|
|
||||||
*/
|
/**
|
||||||
private List<OrgChartNodeVo> systemAdminTree(List<HrmResourceDto> hrmResourceDtoList) {
|
* <h2>systemAdminTree 系统管理员返回全部展开的数据</h2>
|
||||||
List<OrgChartNodeVo> collect = hrmResourceDtoList.stream()
|
* <i>2022/12/16 17:15</i>
|
||||||
.map(struct::hrmResourceDtoToVo)
|
* ************************************************************
|
||||||
.peek(item -> Builder.startSet(item)
|
*
|
||||||
.with(OrgChartNodeVo::setShow, 1)
|
* @param hrmResourceDtoList 人力资源dtolist
|
||||||
.with(OrgChartNodeVo::setShowBrother, 1)
|
* @return List<OrgChartNodeVo> 树型list
|
||||||
.with(OrgChartNodeVo::setShowChildren, 1)
|
* @author youHong.ai ******************************************
|
||||||
.with(OrgChartNodeVo::setCurrent, true)
|
*/
|
||||||
.endSet())
|
private List<OrgChartNodeVo> systemAdminTree(List<HrmResourceDto> hrmResourceDtoList) {
|
||||||
.collect(Collectors.toList());
|
List<OrgChartNodeVo> collect = hrmResourceDtoList.stream()
|
||||||
return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId,
|
.map(struct::hrmResourceDtoToVo)
|
||||||
OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren,
|
.peek(item -> Builder.startSet(item)
|
||||||
parentId -> parentId == null || parentId <= 0)
|
.with(OrgChartNodeVo::setShow, 1)
|
||||||
.stream().peek(item -> Builder.startSet(item)
|
.with(OrgChartNodeVo::setShowBrother, 1)
|
||||||
.with(OrgChartNodeVo::setIsRoot, true)
|
.with(OrgChartNodeVo::setShowChildren, 1)
|
||||||
.with(OrgChartNodeVo::setCurrent, true)
|
.with(OrgChartNodeVo::setCurrent, true)
|
||||||
.endSet())
|
.endSet())
|
||||||
.peek(item -> recursionChildrenNums(item, 0))
|
.collect(Collectors.toList());
|
||||||
.collect(Collectors.toList());
|
return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId,
|
||||||
}
|
OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren,
|
||||||
|
parentId -> parentId == null || parentId <= 0)
|
||||||
/**
|
.stream().peek(item -> Builder.startSet(item)
|
||||||
* <h2>getHrmResourceDtoList 获取人力资源dto对象list</h2>
|
.with(OrgChartNodeVo::setIsRoot, true)
|
||||||
* <i>2022/12/16 17:09</i>
|
.with(OrgChartNodeVo::setCurrent, true)
|
||||||
* ************************************************************
|
.endSet())
|
||||||
*
|
.peek(item -> recursionChildrenNums(item, 0))
|
||||||
* @param userId 当前登陆用户ID
|
.collect(Collectors.toList());
|
||||||
* @param currentUser 当前登陆用户对象
|
}
|
||||||
* @return List<HrmResourceDto> 人力资源dto对象list
|
|
||||||
* @author youHong.ai ******************************************
|
/**
|
||||||
*/
|
* <h2>getHrmResourceDtoList 获取人力资源dto对象list</h2>
|
||||||
private List<HrmResourceDto> getHrmResourceDtoList(Integer userId, AtomicReference<HrmResourceDto> currentUser) {
|
* <i>2022/12/16 17:09</i>
|
||||||
// 人员类型自定义字段
|
* ************************************************************
|
||||||
String typeOfEmploymentField = Util.getCusConfigValue("typeOfEmploymentField");
|
*
|
||||||
Assert.notBlank(typeOfEmploymentField, "config [typeOfEmploymentField] is null or blank!");
|
* @param userId 当前登陆用户ID
|
||||||
// 英文自定义名称字段
|
* @param currentUser 当前登陆用户对象
|
||||||
String lastNameEnField = Util.getCusConfigValue("lastNameEnField");
|
* @return List<HrmResourceDto> 人力资源dto对象list
|
||||||
Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!");
|
* @author youHong.ai ******************************************
|
||||||
// 人员类型id字段 建模表
|
*/
|
||||||
String typeOfEmploymentIdField = Util.getCusConfigValue("typeOfEmploymentIdField");
|
private List<HrmResourceDto> getHrmResourceDtoList(Integer userId, AtomicReference<HrmResourceDto> currentUser) {
|
||||||
Assert.notBlank(typeOfEmploymentIdField, "config [typeOfEmploymentIdField] is null or blank!");
|
// 人员类型自定义字段
|
||||||
// 人员类型父级字段 建模表
|
String typeOfEmploymentField = Util.getCusConfigValue("typeOfEmploymentField");
|
||||||
String parentField = Util.getCusConfigValue("parentField");
|
Assert.notBlank(typeOfEmploymentField, "config [typeOfEmploymentField] is null or blank!");
|
||||||
Assert.notBlank(parentField, "config [parentField] is null or blank!");
|
// 英文自定义名称字段
|
||||||
// 人员类型建模表表名
|
String lastNameEnField = Util.getCusConfigValue("lastNameEnField");
|
||||||
String typeOfEmploymentTable = Util.getCusConfigValue("typeOfEmploymentTable");
|
Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!");
|
||||||
Assert.notBlank(typeOfEmploymentTable, "config [typeOfEmploymentTable] is null or blank!");
|
// 人员类型id字段 建模表
|
||||||
// 查询所有人员信息
|
String typeOfEmploymentIdField = Util.getCusConfigValue("typeOfEmploymentIdField");
|
||||||
List<HrmResource> hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField,
|
Assert.notBlank(typeOfEmploymentIdField, "config [typeOfEmploymentIdField] is null or blank!");
|
||||||
typeOfEmploymentTable, parentField, typeOfEmploymentIdField);
|
// 人员类型父级字段 建模表
|
||||||
if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) {
|
String parentField = Util.getCusConfigValue("parentField");
|
||||||
throw new CustomerException("查询不到相关人员!");
|
Assert.notBlank(parentField, "config [parentField] is null or blank!");
|
||||||
}
|
// 人员类型建模表表名
|
||||||
//List<HrmResourceDto> hrmResourceDtoList = new ArrayList();
|
String typeOfEmploymentTable = Util.getCusConfigValue("typeOfEmploymentTable");
|
||||||
/* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */
|
Assert.notBlank(typeOfEmploymentTable, "config [typeOfEmploymentTable] is null or blank!");
|
||||||
List<HrmResourceDto> hrmResourceDtoList = hrmResourceList.stream()
|
// 查询所有人员信息
|
||||||
.map(struct::hrmResourceToDto)
|
List<HrmResource> hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField,
|
||||||
.peek(item -> Builder.startSet(item)
|
typeOfEmploymentTable, parentField, typeOfEmploymentIdField);
|
||||||
.with(HrmResourceDto::setShow, 0)
|
if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) {
|
||||||
.with(HrmResourceDto::setShowBrother, 0)
|
throw new CustomerException("查询不到相关人员!");
|
||||||
.with(HrmResourceDto::setShowChildren, 0)
|
}
|
||||||
.endSet())
|
// List<HrmResourceDto> hrmResourceDtoList = new ArrayList();
|
||||||
.collect(Collectors.toList());
|
/* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */
|
||||||
hrmResourceDtoList.stream()
|
List<HrmResourceDto> hrmResourceDtoList = hrmResourceList.stream()
|
||||||
.peek(item -> {
|
.map(struct::hrmResourceToDto)
|
||||||
if (Objects.equals(item.getManagerId(), userId)) {
|
.peek(item -> Builder.startSet(item)
|
||||||
item.setShow(1);
|
.with(HrmResourceDto::setShow, 0)
|
||||||
}
|
.with(HrmResourceDto::setShowBrother, 0)
|
||||||
})
|
.with(HrmResourceDto::setShowChildren, 0)
|
||||||
.filter(item -> Objects.equals(item.getId(), userId))
|
.endSet())
|
||||||
.forEach(item -> {
|
.collect(Collectors.toList());
|
||||||
Builder.startSet(item)
|
hrmResourceDtoList.stream()
|
||||||
.with(HrmResourceDto::setShow, 1)
|
.peek(item -> {
|
||||||
.with(HrmResourceDto::setShowBrother, 1)
|
if (Objects.equals(item.getManagerId(), userId)) {
|
||||||
.with(HrmResourceDto::setShowChildren, 1)
|
item.setShow(1);
|
||||||
.with(HrmResourceDto::setCurrent, true)
|
}
|
||||||
.endSet();
|
})
|
||||||
currentUser.set(item);
|
.filter(item -> Objects.equals(item.getId(), userId))
|
||||||
});
|
.forEach(item -> {
|
||||||
return hrmResourceDtoList;
|
Builder.startSet(item)
|
||||||
}
|
.with(HrmResourceDto::setShow, 1)
|
||||||
|
.with(HrmResourceDto::setShowBrother, 1)
|
||||||
/**
|
.with(HrmResourceDto::setShowChildren, 1)
|
||||||
* <h2>计算节点所有子节点的数量</h2>
|
.with(HrmResourceDto::setCurrent, true)
|
||||||
* <i>2022/12/3 17:55</i>
|
.endSet();
|
||||||
* ******************************************
|
currentUser.set(item);
|
||||||
*
|
});
|
||||||
* @param chartNodeVo 节点对象
|
return hrmResourceDtoList;
|
||||||
* @return Integer 对应节点的所有子节点的数量
|
}
|
||||||
* @author youHong.ai ******************************************
|
|
||||||
*/
|
/**
|
||||||
private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) {
|
* <h2>计算节点所有子节点的数量</h2>
|
||||||
List<OrgChartNodeVo> children = chartNodeVo.getChildren();
|
* <i>2022/12/3 17:55</i>
|
||||||
if (Objects.isNull(children) || children.size() == 0) {
|
* ******************************************
|
||||||
chartNodeVo.setChildrenNum(0);
|
*
|
||||||
return 0;
|
* @param chartNodeVo 节点对象
|
||||||
}
|
* @return Integer 对应节点的所有子节点的数量
|
||||||
n += children.size();
|
* @author youHong.ai ******************************************
|
||||||
for (OrgChartNodeVo child : children) {
|
*/
|
||||||
child.setChildrenNum(recursionChildrenNums(child, 0));
|
private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) {
|
||||||
n += child.getChildrenNum();
|
List<OrgChartNodeVo> children = chartNodeVo.getChildren();
|
||||||
}
|
if (Objects.isNull(children) || children.size() == 0) {
|
||||||
chartNodeVo.setChildrenNum(n);
|
chartNodeVo.setChildrenNum(0);
|
||||||
return n;
|
return 0;
|
||||||
}
|
}
|
||||||
|
n += children.size();
|
||||||
|
for (OrgChartNodeVo child : children) {
|
||||||
|
child.setChildrenNum(recursionChildrenNums(child, 0));
|
||||||
|
n += child.getChildrenNum();
|
||||||
|
}
|
||||||
|
chartNodeVo.setChildrenNum(n);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ public class SsoYunZhaoService {
|
||||||
Method method = User.class.getMethod(userCodeMethod);
|
Method method = User.class.getMethod(userCodeMethod);
|
||||||
String value = Util.null2String(method.invoke(user));
|
String value = Util.null2String(method.invoke(user));
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
String token = this.rsaEncryptedUserInfo(value + "\"" + String.valueOf(currentTime).substring(0, 10));
|
String str = value + "\"" + String.valueOf(currentTime).substring(0, 10);
|
||||||
|
String token = this.rsaEncryptedUserInfo(str);
|
||||||
String yunZhaoSsoPathUrl = Util.getCusConfigValue("YunZhaoSSOPathURL");
|
String yunZhaoSsoPathUrl = Util.getCusConfigValue("YunZhaoSSOPathURL");
|
||||||
Assert.notEmpty(yunZhaoSsoPathUrl, "can not find [YunZhaoSSOPathURL] from table [uf_cus_dev_config]");
|
Assert.notEmpty(yunZhaoSsoPathUrl, "can not find [YunZhaoSSOPathURL] from table [uf_cus_dev_config]");
|
||||||
return yunZhaoSsoPathUrl + URLEncoder.encode(token, "UTF-8");
|
return yunZhaoSsoPathUrl + URLEncoder.encode(token, "UTF-8");
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.poi.xssf.streaming.SXSSFCell;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFRow;
|
import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
@ -46,6 +47,8 @@ public class OpenTheBillService {
|
||||||
|
|
||||||
private final Logger log = Util.getLogger();
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
private final RecordSet res = new RecordSet();
|
||||||
|
|
||||||
public Map<String, Object> getOpenBillListData(String startDate, String endDate, String orderNo) {
|
public Map<String, Object> getOpenBillListData(String startDate, String endDate, String orderNo) {
|
||||||
return getData(startDate, endDate, orderNo);
|
return getData(startDate, endDate, orderNo);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +153,7 @@ public class OpenTheBillService {
|
||||||
SXSSFCell cell,
|
SXSSFCell cell,
|
||||||
SXSSFSheet sheet, Map<Integer, CellStyle> singularLine, Map<Integer, CellStyle> evenNumberLine) {
|
SXSSFSheet sheet, Map<Integer, CellStyle> singularLine, Map<Integer, CellStyle> evenNumberLine) {
|
||||||
|
|
||||||
|
|
||||||
int columnWidth = sheet.getColumnWidth(colIndex);
|
int columnWidth = sheet.getColumnWidth(colIndex);
|
||||||
String value = cell.getStringCellValue();
|
String value = cell.getStringCellValue();
|
||||||
/** 计算字符串中中文字符的数量 */
|
/** 计算字符串中中文字符的数量 */
|
||||||
|
@ -160,27 +164,17 @@ public class OpenTheBillService {
|
||||||
if (length >= columnWidth && length < 256 * 256) {
|
if (length >= columnWidth && length < 256 * 256) {
|
||||||
sheet.setColumnWidth(colIndex, length);
|
sheet.setColumnWidth(colIndex, length);
|
||||||
}
|
}
|
||||||
if (rowIndex % 2 == 1) {
|
if (singularLine.containsKey(-1)) {
|
||||||
if (singularLine.containsKey(colIndex)) {
|
return singularLine.get(-1);
|
||||||
return singularLine.get(colIndex);
|
|
||||||
}
|
|
||||||
CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet);
|
|
||||||
singularLine.put(colIndex, cellStyle);
|
|
||||||
return cellStyle;
|
|
||||||
} else {
|
|
||||||
if (evenNumberLine.containsKey(colIndex)) {
|
|
||||||
return evenNumberLine.get(colIndex);
|
|
||||||
}
|
|
||||||
CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet);
|
|
||||||
// 设置字体格式
|
|
||||||
Font font = workbook.createFont();
|
|
||||||
font.setFontName("微软雅黑");
|
|
||||||
font.setFontHeightInPoints((short) 10);
|
|
||||||
|
|
||||||
cellStyle.setFont(font);
|
|
||||||
evenNumberLine.put(colIndex, cellStyle);
|
|
||||||
return cellStyle;
|
|
||||||
}
|
}
|
||||||
|
// 设置字体格式
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontName("微软雅黑");
|
||||||
|
font.setFontHeightInPoints((short) 10);
|
||||||
|
CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet);
|
||||||
|
cellStyle.setFont(font);
|
||||||
|
singularLine.put(-1, cellStyle);
|
||||||
|
return cellStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellStyle getCellStyle(SXSSFWorkbook workbook, Integer rowIndex, Integer colIndex, SXSSFCell cell, SXSSFSheet sheet) {
|
private CellStyle getCellStyle(SXSSFWorkbook workbook, Integer rowIndex, Integer colIndex, SXSSFCell cell, SXSSFSheet sheet) {
|
||||||
|
@ -232,6 +226,16 @@ public class OpenTheBillService {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> findMapByField(String filterString, List<Map<String, Object>> list) {
|
||||||
|
for (Map<String, Object> map : list) {
|
||||||
|
if (map.containsKey("field") && map.get("field").equals(filterString)) {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果找不到匹配的 Map,则返回 null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, Object> getData(String startDate, String endDate, String orderNo) {
|
public Map<String, Object> getData(String startDate, String endDate, String orderNo) {
|
||||||
Map<String, Object> config = Util.readProperties2Map("esteeLauderExcelExport", "export");
|
Map<String, Object> config = Util.readProperties2Map("esteeLauderExcelExport", "export");
|
||||||
Assert.notEmpty(config, "esteeLauderExcelExport.properties文件读取配置为空,请检查配置信息");
|
Assert.notEmpty(config, "esteeLauderExcelExport.properties文件读取配置为空,请检查配置信息");
|
||||||
|
@ -246,7 +250,8 @@ public class OpenTheBillService {
|
||||||
Util.null2String(config.get("createDate")),
|
Util.null2String(config.get("createDate")),
|
||||||
condition);
|
condition);
|
||||||
} else {
|
} else {
|
||||||
dataList = mapper.selectList(Util.null2String(config.get("tableName")));
|
// dataList = mapper.selectList(Util.null2String(config.get("tableName")));
|
||||||
|
dataList = Collections.emptyList();
|
||||||
}
|
}
|
||||||
Object head = config.get("head");
|
Object head = config.get("head");
|
||||||
Map<String, Object> result = new HashMap<>(16);
|
Map<String, Object> result = new HashMap<>(16);
|
||||||
|
@ -309,6 +314,7 @@ public class OpenTheBillService {
|
||||||
if (finalBgm.equals("Y")) {
|
if (finalBgm.equals("Y")) {
|
||||||
// 都过了bgm
|
// 都过了bgm
|
||||||
for (Map<String, Object> item : list) {
|
for (Map<String, Object> item : list) {
|
||||||
|
item.put(Util.null2String(config.get("additional")), "");
|
||||||
item.put(Util.null2String(config.get("openBillKey")), "");
|
item.put(Util.null2String(config.get("openBillKey")), "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -319,6 +325,7 @@ public class OpenTheBillService {
|
||||||
// 不全部都是y或者n
|
// 不全部都是y或者n
|
||||||
for (Map<String, Object> item : list) {
|
for (Map<String, Object> item : list) {
|
||||||
item.put(Util.null2String(config.get("openBillKey")), "全部订单总金额达到GM审批标准,拆分后无法到达GM审批节点。");
|
item.put(Util.null2String(config.get("openBillKey")), "全部订单总金额达到GM审批标准,拆分后无法到达GM审批节点。");
|
||||||
|
item.put(Util.null2String(config.get("additional")), "此单为系统判定疑似拆单");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,10 +407,12 @@ public class OpenTheBillService {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
for (Map<String, Object> item : list) {
|
for (Map<String, Object> item : list) {
|
||||||
item.put(Util.null2String(config.get("openBillKey")), "全部订单总金额达到GM审批标准,拆分后无法到达GM审批节点。");
|
item.put(Util.null2String(config.get("openBillKey")), "全部订单总金额达到GM审批标准,拆分后无法到达GM审批节点。");
|
||||||
|
item.put(Util.null2String(config.get("additional")), "此单为系统判定疑似拆单");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Map<String, Object> item : list) {
|
for (Map<String, Object> item : list) {
|
||||||
item.put(Util.null2String(config.get("openBillKey")), "");
|
item.put(Util.null2String(config.get("openBillKey")), "");
|
||||||
|
item.put(Util.null2String(config.get("additional")), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,6 +477,7 @@ public class OpenTheBillService {
|
||||||
|
|
||||||
|
|
||||||
private void calculationCondition(List<Map<String, Object>> dataList, Map<String, Object> config) {
|
private void calculationCondition(List<Map<String, Object>> dataList, Map<String, Object> config) {
|
||||||
|
Map<String, Object> convert = (Map<String, Object>) config.get("convert");
|
||||||
for (Map<String, Object> map : dataList) {
|
for (Map<String, Object> map : dataList) {
|
||||||
// 订单分类
|
// 订单分类
|
||||||
String orderType = Util.null2String(map.get(Util.null2String(config.get("orderType"))));
|
String orderType = Util.null2String(map.get(Util.null2String(config.get("orderType"))));
|
||||||
|
@ -485,7 +495,7 @@ public class OpenTheBillService {
|
||||||
// 内部领用
|
// 内部领用
|
||||||
// orderUse + " " + shipTo + " " + costCenter + " " + sku
|
// orderUse + " " + shipTo + " " + costCenter + " " + sku
|
||||||
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " CostCenter:" + costCenter + " sku:" + sku;
|
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " CostCenter:" + costCenter + " sku:" + sku;
|
||||||
condition = orderUse + " :" + shipTo + ":" + costCenter + ":" + sku;
|
condition = "订单用途:" + orderUse + "、" + "shipTo:" + shipTo + "、" + "CostCenter:" + costCenter + "、" + "sku:" + sku;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
|
@ -494,13 +504,28 @@ public class OpenTheBillService {
|
||||||
// 第三方 + 柜台订单
|
// 第三方 + 柜台订单
|
||||||
// orderUse + ":" + shipTo + ":" + sku
|
// orderUse + ":" + shipTo + ":" + sku
|
||||||
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " sku:" + sku + " 订单分类:" + orderType;
|
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " sku:" + sku + " 订单分类:" + orderType;
|
||||||
condition = orderUse + ":" + shipTo + ":" + sku + ":" + orderType;
|
condition = "订单用途:" + orderUse + "、" + "shipTo:" + shipTo + "、" + "sku:" + sku + "、" + "订单分类:" + orderType;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
map.put(Util.null2String(config.get("additional")), "");
|
||||||
map.put(Util.null2String(config.get("conditionKey")), condition);
|
map.put(Util.null2String(config.get("conditionKey")), condition);
|
||||||
|
if (Objects.nonNull(convert)) {
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
if (convert.containsKey(entry.getKey())) {
|
||||||
|
String sql = Util.null2String(convert.get(entry.getKey()));
|
||||||
|
if (StrUtil.isNotBlank(sql)) {
|
||||||
|
res.executeQuery(sql, entry.getValue());
|
||||||
|
if (res.next()) {
|
||||||
|
entry.setValue(res.getInt(1));
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -47,8 +48,10 @@ public class SingleSignOnController {
|
||||||
Map<String, Object> param = new HashMap<>(8);
|
Map<String, Object> param = new HashMap<>(8);
|
||||||
param.put("user", value);
|
param.put("user", value);
|
||||||
param.put("ts", System.currentTimeMillis());
|
param.put("ts", System.currentTimeMillis());
|
||||||
String encrypt = AES.encrypt(key, initVector, JSON.toJSONString(param));
|
String json = JSON.toJSONString(param);
|
||||||
response.sendRedirect(url + "?params=" + encrypt);
|
String encrypt = AES.encrypt(key, initVector, json);
|
||||||
|
Util.getLogger().info("加密内容: " + json + " 加密结果: " + encrypt);
|
||||||
|
response.sendRedirect(url + "?params=" + URLEncoder.encode(encrypt, "UTF-8"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("单点登录路径处理失败!" + e.getMessage() + "\n" + Util.getErrString(e));
|
log.error("单点登录路径处理失败!" + e.getMessage() + "\n" + Util.getErrString(e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestEntity;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataConfig;
|
||||||
|
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
|
||||||
|
import com.engine.core.impl.aop.AbstractServiceProxy;
|
||||||
|
import com.engine.workflow.service.SubRequestService;
|
||||||
|
import com.engine.workflow.service.impl.SubRequestServiceImpl;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.workflow.request.DiffWfTriggerSetting;
|
||||||
|
import weaver.workflow.request.SameWfTriggerSetting;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>触发子流程</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 22:52</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@ServiceDynamicProxy(target = SubRequestServiceImpl.class, desc = "拦截签字意见信息,是否需要隐私控制")
|
||||||
|
public class TriSubRequestAfterInterceptImpl extends AbstractServiceProxy implements SubRequestService {
|
||||||
|
|
||||||
|
private final TriSubRequestAfterMapper mapper = Util.getMapper(TriSubRequestAfterMapper.class);
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void triSameSubRequestBefore(int i, List<SameWfTriggerSetting> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void triDiffSubRequestBefore(int i, List<DiffWfTriggerSetting> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void triSubRequestAfter(int i) {
|
||||||
|
List<SubRequestEntity> subRequestEntities = mapper.selectSubRequestByMainRequest(i);
|
||||||
|
if (CollectionUtil.isEmpty(subRequestEntities)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<SubRequestToDataConfig> subRequestToDataConfigs = mapper.selectConfig();
|
||||||
|
if (CollectionUtil.isEmpty(subRequestToDataConfigs)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, SubRequestToDataConfig> collect = subRequestToDataConfigs
|
||||||
|
.stream()
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
SubRequestToDataConfig::getWorkflowType,
|
||||||
|
value -> value
|
||||||
|
));
|
||||||
|
|
||||||
|
for (SubRequestEntity subRequestEntity : subRequestEntities) {
|
||||||
|
// 查询流程对应的配置信息
|
||||||
|
String workflowId = subRequestEntity.getWorkflowId();
|
||||||
|
SubRequestToDataConfig subRequestToDataConfig = collect.get(workflowId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestEntity;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataConfig;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>sql查询</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 23:09</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface TriSubRequestAfterMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询子流程信息</h2>
|
||||||
|
*
|
||||||
|
* @param mainRequestId 主流程信息
|
||||||
|
* @return 子流程信息
|
||||||
|
*/
|
||||||
|
@Select("select requestid request_id,workflowid workflow_id from " +
|
||||||
|
"workflow_requestbase where mainrequestid = #{mainRequestId}")
|
||||||
|
List<SubRequestEntity> selectSubRequestByMainRequest(@ParamMapper("mainRequestId") Integer mainRequestId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询配置表信息</h2>
|
||||||
|
*
|
||||||
|
* @return 配置表信息
|
||||||
|
*/
|
||||||
|
@Select("select * from uf_sub_wf_to_mode")
|
||||||
|
@Associations({
|
||||||
|
@Association(
|
||||||
|
property = "modelTableName",
|
||||||
|
column = "model_table",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectModelTableInfo",
|
||||||
|
id = @Id(value = Integer.class)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
@CollectionMappings({
|
||||||
|
@CollectionMapping(
|
||||||
|
property = "mappings",
|
||||||
|
column = "id",
|
||||||
|
id = @Id(value = String.class, methodId = 1)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
List<SubRequestToDataConfig> selectConfig();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询配置表明细信息</h2>
|
||||||
|
*
|
||||||
|
* @param mainId 主表id
|
||||||
|
* @return 明细数据
|
||||||
|
*/
|
||||||
|
@CollectionMethod(value = 1, desc = "查询配置表明细信息")
|
||||||
|
@Select("select * from uf_sub_wf_to_mode_dt1 where mainid = #{mainId}")
|
||||||
|
@Associations({
|
||||||
|
@Association(
|
||||||
|
property = "modelField",
|
||||||
|
column = "model_field",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
|
||||||
|
id = @Id(value = Integer.class)
|
||||||
|
),
|
||||||
|
@Association(
|
||||||
|
property = "workflowField",
|
||||||
|
column = "workflow_field",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
|
||||||
|
id = @Id(value = Integer.class)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
List<SubRequestToDataMapping> selectConfigDt(String mainId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>子流程实体类</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 23:13</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class SubRequestEntity {
|
||||||
|
@SqlOracleDbFieldAnn("REQUEST_ID")
|
||||||
|
private String requestId;
|
||||||
|
@SqlOracleDbFieldAnn("WORKFLOW_ID")
|
||||||
|
private String workflowId;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.entity.ModelTableInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>配置表实体类</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 10:31</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class SubRequestToDataConfig {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 流程 */
|
||||||
|
private String workflowType;
|
||||||
|
/** 建模 */
|
||||||
|
private String modelTable;
|
||||||
|
/** 更新条件 */
|
||||||
|
private String conditionUpdate;
|
||||||
|
|
||||||
|
/** 建模表 */
|
||||||
|
private ModelTableInfo modelTableName;
|
||||||
|
|
||||||
|
private List<SubRequestToDataMapping> mappings;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
||||||
|
import aiyh.utils.entity.FieldViewInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>字段映射</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 10:37</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class SubRequestToDataMapping {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@SqlDbFieldAnn("mainid")
|
||||||
|
private Integer mainId;
|
||||||
|
|
||||||
|
/** 建模字段 */
|
||||||
|
private FieldViewInfo modelField;
|
||||||
|
/** 流程字段 */
|
||||||
|
private FieldViewInfo workflowField;
|
||||||
|
}
|
|
@ -0,0 +1,156 @@
|
||||||
|
package com.engine.yunjinshan.modeDelete.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
|
||||||
|
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
|
||||||
|
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore;
|
||||||
|
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
|
||||||
|
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.file.Prop;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.yunjinshan.formmode.action.CostIncomeUpdate;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云锦山
|
||||||
|
* 建模记录删除方法拦截方法
|
||||||
|
*/
|
||||||
|
@WeaIocReplaceComponent("CubeExpandService")
|
||||||
|
public class DeleteModeDataServiceImp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义一个当前线程
|
||||||
|
*/
|
||||||
|
private static final ThreadLocal<List<Map<String, String>>> threadLocal = new ThreadLocal<>();
|
||||||
|
|
||||||
|
private final static BaseBean bean = new BaseBean();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用删除前 进行方法拦截
|
||||||
|
* 人员成本管理、合同管理建模进行处理
|
||||||
|
*
|
||||||
|
* @param weaBeforeReplaceParam 拦截参数
|
||||||
|
*/
|
||||||
|
@WeaReplaceBefore(value = "/api/cube/expand/deleteData", order = 1, description = "删除建模数据,在数据删除前进行拦截")
|
||||||
|
public void before(WeaBeforeReplaceParam weaBeforeReplaceParam) {
|
||||||
|
// 获取请求参数
|
||||||
|
Map<String, Object> param = weaBeforeReplaceParam.getParamMap();
|
||||||
|
|
||||||
|
bean.writeLog("进入删除拦截:" + JSON.toJSONString(param));
|
||||||
|
// 模块ID
|
||||||
|
String modeId = Util.null2String(param.get("modeId"));
|
||||||
|
// 具体的数据ID
|
||||||
|
String billids = Util.null2String(param.get("billids"));
|
||||||
|
|
||||||
|
// 人力成本管理模块ID
|
||||||
|
String humanCostModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "HumanCostModeId"), "4");
|
||||||
|
// 合同管理模块ID
|
||||||
|
String contractManagementModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "ContractManagementModeId"), "3");
|
||||||
|
|
||||||
|
if ("".equals(humanCostModeId)) {
|
||||||
|
humanCostModeId = "4";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("".equals(contractManagementModeId)) {
|
||||||
|
contractManagementModeId = "3";
|
||||||
|
}
|
||||||
|
// 人员成本管理、合同管理 建模模块
|
||||||
|
if (contractManagementModeId.equals(modeId) || humanCostModeId.equals(modeId)) {
|
||||||
|
// 将待删除的记录写入临时表
|
||||||
|
String selectData = "";
|
||||||
|
|
||||||
|
bean.writeLog("删除建模数据!模块id: " + modeId);
|
||||||
|
bean.writeLog("删除的数据id: " + billids);
|
||||||
|
|
||||||
|
if (contractManagementModeId.equals(modeId)) {
|
||||||
|
selectData = "select qdny,yjbm,khmc from uf_hetongguanli where id in (" + billids + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (humanCostModeId.equals(modeId)) {
|
||||||
|
selectData = "select ny,yjbm,kh from uf_renlichengben where id in (" + billids + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
|
||||||
|
// 从当前线程中获取已删除的记录
|
||||||
|
List<Map<String, String>> dataList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (rs.executeQuery(selectData)) {
|
||||||
|
while (rs.next()) {
|
||||||
|
// 年月
|
||||||
|
String yearMonth = Util.null2String(rs.getString(1));
|
||||||
|
// 一级部门
|
||||||
|
String superiorDepartment = Util.null2String(rs.getString(2));
|
||||||
|
// 客户
|
||||||
|
String customer = Util.null2String(rs.getString(3));
|
||||||
|
|
||||||
|
Map<String, String> detailMap = new HashMap<>(8);
|
||||||
|
detailMap.put("yearMonth", yearMonth);
|
||||||
|
detailMap.put("superiorDepartment", superiorDepartment);
|
||||||
|
detailMap.put("customer", customer);
|
||||||
|
detailMap.put("modeId", modeId);
|
||||||
|
dataList.add(detailMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
threadLocal.set(dataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用删除后 进行方法拦截
|
||||||
|
* 人员成本管理、合同管理建模进行处理
|
||||||
|
*
|
||||||
|
* @param weaAfterReplaceParam 拦截参数
|
||||||
|
*/
|
||||||
|
@WeaReplaceAfter(value = "/api/cube/expand/deleteData", order = 1, description = "删除建模数据,在数据删除后进行拦截,处理特殊业务")
|
||||||
|
public void after(WeaAfterReplaceParam weaAfterReplaceParam) {
|
||||||
|
|
||||||
|
bean.writeLog("----------------删除拦截后!");
|
||||||
|
try {
|
||||||
|
// 从当前线程中获取已删除的记录
|
||||||
|
List<Map<String, String>> dataList = threadLocal.get();
|
||||||
|
|
||||||
|
if (Objects.nonNull(dataList) && dataList.size() > 0) {
|
||||||
|
bean.writeLog("删除的数据信息: " + JSON.toJSONString(dataList));
|
||||||
|
// 人力成本管理模块ID
|
||||||
|
String humanCostModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "HumanCostModeId"), "4");
|
||||||
|
// 合同管理模块ID
|
||||||
|
String contractManagementModeId = Util.null2String(Prop.getPropValue("DeleteModeData", "ContractManagementModeId"), "3");
|
||||||
|
if ("".equals(humanCostModeId)) {
|
||||||
|
humanCostModeId = "4";
|
||||||
|
}
|
||||||
|
if ("".equals(contractManagementModeId)) {
|
||||||
|
contractManagementModeId = "3";
|
||||||
|
}
|
||||||
|
CostIncomeUpdate incomeUpdate = new CostIncomeUpdate();
|
||||||
|
for (Map<String, String> detailMap : dataList) {
|
||||||
|
// 年月
|
||||||
|
String yearMonth = Util.null2String(detailMap.get("yearMonth"));
|
||||||
|
// 一级部门
|
||||||
|
String superiorDepartment = Util.null2String(detailMap.get("superiorDepartment"));
|
||||||
|
// 客户
|
||||||
|
String customer = Util.null2String(detailMap.get("customer"));
|
||||||
|
|
||||||
|
String modeId = Util.null2String(detailMap.get("modeId"));
|
||||||
|
|
||||||
|
if (humanCostModeId.equals(modeId)) {
|
||||||
|
incomeUpdate.updateByHumanCost(yearMonth, superiorDepartment, customer);
|
||||||
|
}
|
||||||
|
if (contractManagementModeId.equals(modeId)) {
|
||||||
|
incomeUpdate.updateByContract(yearMonth, superiorDepartment, customer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
bean.writeLog("处理删除数据信息异常!异常信息:" + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
threadLocal.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,6 @@ import com.google.common.base.Strings;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.collections.MapUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
@ -61,7 +60,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
private RecordSet tempRs;
|
private RecordSet tempRs;
|
||||||
|
|
||||||
private DealWithMapper mapper = null;
|
private DealWithMapper mapper = null;
|
||||||
|
|
||||||
private final Logger logger = aiyh.utils.Util.getLogger("json-util");
|
private final Logger logger = aiyh.utils.Util.getLogger("json-util");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -688,7 +687,9 @@ public class DealWithMapping extends ToolUtil {
|
||||||
// 数据id
|
// 数据id
|
||||||
case MAIN_DATA_ID: {
|
case MAIN_DATA_ID: {
|
||||||
if ("1".equals(childSource)) {
|
if ("1".equals(childSource)) {
|
||||||
value = Util.null2String(detailMap.get("id"));
|
if (Objects.nonNull(detailMap)) {
|
||||||
|
value = Util.null2String(detailMap.get("id"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
value = Util.null2String(mainMap.get("id"));
|
value = Util.null2String(mainMap.get("id"));
|
||||||
}
|
}
|
||||||
|
@ -1007,7 +1008,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
} else if ("0".equals(childSource)) {
|
} else if ("0".equals(childSource)) {
|
||||||
tempValue = Util.null2String(mainMap.get(fieldName));
|
tempValue = Util.null2String(mainMap.get(fieldName));
|
||||||
if ("".equals(tempValue)) {
|
if ("".equals(tempValue)) {
|
||||||
tempValue = Util.null2String(detailMap.get(fieldNameLower));
|
tempValue = Util.null2String(mainMap.get(fieldNameLower));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tempValue = Util.null2String(relationRs.getString(fieldName));
|
tempValue = Util.null2String(relationRs.getString(fieldName));
|
||||||
|
@ -1068,7 +1069,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
} else {
|
} else {
|
||||||
value = Util.null2String(mainMap.get(fieldName));
|
value = Util.null2String(mainMap.get(fieldName));
|
||||||
if ("".equals(value)) {
|
if ("".equals(value)) {
|
||||||
value = Util.null2String(detailMap.get(fieldNameLower));
|
value = Util.null2String(mainMap.get(fieldNameLower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String fileIds = Util.null2String(value);
|
String fileIds = Util.null2String(value);
|
||||||
|
@ -1108,7 +1109,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
} else {
|
} else {
|
||||||
value = Util.null2String(mainMap.get(fieldName));
|
value = Util.null2String(mainMap.get(fieldName));
|
||||||
if ("".equals(value)) {
|
if ("".equals(value)) {
|
||||||
value = Util.null2String(detailMap.get(fieldNameLower));
|
value = Util.null2String(mainMap.get(fieldNameLower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1521,33 +1522,6 @@ public class DealWithMapping extends ToolUtil {
|
||||||
if (split.length > 1) {
|
if (split.length > 1) {
|
||||||
paramStr = Arrays.stream(split).skip(1).collect(Collectors.joining("?"));
|
paramStr = Arrays.stream(split).skip(1).collect(Collectors.joining("?"));
|
||||||
}
|
}
|
||||||
/* 获取?后的参数:"weaver.aiyh_jitu.pushdata.service.toones.GetRequestValueCusGetValueImpl?" +
|
|
||||||
"requestType=get&apiOnlyMark=getAssign&valueKey=data&assign=#{main.zd2}&" +
|
|
||||||
"#processorClass=weaver.aiyh_jitu.pushdata.service.toones.GetAssignProcessorProcessorImpl" +
|
|
||||||
"&afterProcessor.hrmId=#{main.zd2}&beforeProcessor.hrmId=#{main.zd2}&高=udh高殿下g" +
|
|
||||||
"&assignValue=#sql{select workcode from hrmresource where id = #{main.zd1} and test = #{h-hah} and a in (${hrmids})}&hah=haode";
|
|
||||||
最终获取到的map,如下
|
|
||||||
key:requestType
|
|
||||||
value:get
|
|
||||||
key:apiOnlyMark
|
|
||||||
value:getAssign
|
|
||||||
key:valueKey
|
|
||||||
value:data
|
|
||||||
key:assign
|
|
||||||
value:#{main.zd2}
|
|
||||||
key:#processorClass
|
|
||||||
value:weaver.aiyh_jitu.pushdata.service.toones.GetAssignProcessorProcessorImpl
|
|
||||||
key:afterProcessor.hrmId
|
|
||||||
value:#{main.zd2}
|
|
||||||
key:beforeProcessor.hrmId
|
|
||||||
value:#{main.zd2}
|
|
||||||
key:高
|
|
||||||
value:udh高殿下g
|
|
||||||
key:assignValue
|
|
||||||
value:#sql{select workcode from hrmresource where id = #{main.zd1} and test = #{h-hah} and a in (${hrmids})}
|
|
||||||
key:hah
|
|
||||||
value:haode*/
|
|
||||||
// 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类,将参数传递给这个类, 使用``包裹的字符串会被解析为一个字符串
|
|
||||||
String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=" +
|
String pattern = "&?(?<key>([#.\\w\\u4E00-\\u9FA5]+))=" +
|
||||||
"(?<value>((`([^`]*)`)|" +
|
"(?<value>((`([^`]*)`)|" +
|
||||||
"((#(\\{|sql\\{))?([():/\\-$_#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?";
|
"((#(\\{|sql\\{))?([():/\\-$_#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?";
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
package weaver.youhong.ai.geerde.action.submitfirst;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
|
import aiyh.utils.annotation.*;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.youhong.ai.geerde.action.submitfirst.mapper.AutoSubmitFirstMapper;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>自动提交第一次经过节点的流程</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/17 18:52</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@ActionDesc(author = "youhong.ai", value = "自动流程提交,需要挂在需要提交的流程节点的节点前或者前一个节点的节点后或者两个节点的流转出口线上")
|
||||||
|
public class AutoSubmitFirstAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
|
private final AutoSubmitFirstMapper mapper = Util.getMapper(AutoSubmitFirstMapper.class);
|
||||||
|
|
||||||
|
@RequiredMark(value = "account", desc = "主表流程经过标识字段,整数或单行文本字段名都可以")
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionDefaultTestValue("account")
|
||||||
|
private String accountField;
|
||||||
|
|
||||||
|
@ActionOptionalParam(value = "1", desc = "流程操作人id,默认为1-系统管理员")
|
||||||
|
@PrintParamMark
|
||||||
|
private String operator = "1";
|
||||||
|
|
||||||
|
private static final Map<String, Integer> oneRequestLock = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public void doSubmit(String requestId, String billTable,
|
||||||
|
int workflowId, User user,
|
||||||
|
RequestInfo requestInfo) {
|
||||||
|
// 如果存在当前流程id的值,表示当前action属于锁住状态,需要进入线程睡眠等待
|
||||||
|
if (oneRequestLock.containsKey(requestId)) {
|
||||||
|
log.info("流程正在异步提交中,使用线程排队");
|
||||||
|
new Thread(() -> {
|
||||||
|
log.info("开始异步等待上一个节点提交");
|
||||||
|
while (oneRequestLock.containsKey(requestId)) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000L * 60 * oneRequestLock.get(requestId));
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("线程休眠失败!");
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("开始提交流程!");
|
||||||
|
oneRequestLock.put(requestId, 2);
|
||||||
|
Map<String, Object> mainMap = mapper.selectMainMap(billTable, requestId);
|
||||||
|
String currentNode = mapper.selectCurrentNodeId(requestId);
|
||||||
|
if (mainMap.containsKey(accountField)) {
|
||||||
|
String mark = Util.null2String(mainMap.get(accountField));
|
||||||
|
String nodesStr = currentNode;
|
||||||
|
if (StrUtil.isNotBlank(mark)) {
|
||||||
|
String[] split = mark.split(",");
|
||||||
|
List<String> nodes = Arrays.asList(split);
|
||||||
|
if (nodes.contains(currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodesStr += "," + Util.join(nodes, ",");
|
||||||
|
}
|
||||||
|
int creatorId = requestInfo.getRequestManager().getCreater();
|
||||||
|
String finalNodesStr = nodesStr;
|
||||||
|
Util.submitWorkflowThread(Integer.parseInt(requestId), creatorId,
|
||||||
|
"", 60, flag -> {
|
||||||
|
oneRequestLock.remove(requestId);
|
||||||
|
if (flag) {
|
||||||
|
mapper.updateMark(billTable, accountField, finalNodesStr,
|
||||||
|
Util.null2String(mainMap.get("id")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果没有锁住,异步延时提交,延时3分钟
|
||||||
|
log.info("没有锁住流程,开始异步提交流程");
|
||||||
|
oneRequestLock.put(requestId, 2);
|
||||||
|
Map<String, String> mainTableValue = getMainTableValue(requestInfo);
|
||||||
|
String currentNode = mapper.selectCurrentNodeId(requestId);
|
||||||
|
int creatorId = requestInfo.getRequestManager().getCreater();
|
||||||
|
// 判断是否存在统计字段
|
||||||
|
if (mainTableValue.containsKey(accountField)) {
|
||||||
|
// 获取统计字段的值
|
||||||
|
String mark = mainTableValue.get(accountField);
|
||||||
|
String nodesStr = currentNode;
|
||||||
|
if (StrUtil.isNotBlank(mark)) {
|
||||||
|
String[] split = mark.split(",");
|
||||||
|
List<String> nodes = Arrays.asList(split);
|
||||||
|
if (nodes.contains(currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodesStr += "," + Util.join(nodes, ",");
|
||||||
|
}
|
||||||
|
String finalNodesStr = nodesStr;
|
||||||
|
Util.submitWorkflowThread(Integer.parseInt(requestId), creatorId,
|
||||||
|
"", 60, flag -> {
|
||||||
|
oneRequestLock.remove(requestId);
|
||||||
|
if (flag) {
|
||||||
|
log.info("异步提交流程完成!");
|
||||||
|
// 提交成功,更新标识
|
||||||
|
mapper.updateMark(billTable, accountField, finalNodesStr,
|
||||||
|
mainTableValue.get("id"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package weaver.youhong.ai.geerde.action.submitfirst.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>自动提交流程标识更新</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/17 18:56</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface AutoSubmitFirstMapper {
|
||||||
|
|
||||||
|
@Update("update $t{tableName} set $t{fieldName} = #{value} where id = #{id}")
|
||||||
|
boolean updateMark(@ParamMapper("tableName") String tableName,
|
||||||
|
@ParamMapper("fieldName") String fieldName,
|
||||||
|
@ParamMapper("value") String value,
|
||||||
|
@ParamMapper("id") String id);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select * from $t{tableName} where requestid = #{requestId}")
|
||||||
|
Map<String, Object> selectMainMap(@ParamMapper("tableName") String tableName, @ParamMapper("requestId") String requestId);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select currentnodeid from workflow_requestbase where requestid = #{requestId}")
|
||||||
|
String selectCurrentNodeId(@ParamMapper("requestId") String requestId);
|
||||||
|
}
|
|
@ -20,8 +20,10 @@ import javax.ws.rs.core.MediaType;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>知识产权局ca电子签</h1>
|
* <h1>知识产权局ca电子签</h1>
|
||||||
|
@ -87,8 +89,13 @@ public class CaElectronicSignatureAction extends SafeCusBaseAction {
|
||||||
throw new CustomerException(responeVo.getCode() + ", fetch ca sign fail! ");
|
throw new CustomerException(responeVo.getCode() + ", fetch ca sign fail! ");
|
||||||
}
|
}
|
||||||
Map<String, Object> responseMap = responeVo.getResponseMap();
|
Map<String, Object> responseMap = responeVo.getResponseMap();
|
||||||
String documentNo = Util.null2String(responseMap.get("document_no"));
|
Map<String, Object> data = (Map<String, Object>) responseMap.get("data");
|
||||||
String pdf = Util.null2String(responseMap.get("ofd"));
|
if (Objects.isNull(data)) {
|
||||||
|
Util.actionFail(requestInfo.getRequestManager(), URLDecoder.decode(Util.null2String(responseMap.get("ret_msg")), "UTF-8"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String documentNo = Util.null2String(data.get("document_no"));
|
||||||
|
String pdf = Util.null2String(data.get("ofd"));
|
||||||
InputStream inputStream = base64ContentToFile(pdf);
|
InputStream inputStream = base64ContentToFile(pdf);
|
||||||
String docCategorys = Util.getDocCategorysByTable(String.valueOf(workflowId), signFileField, billTable);
|
String docCategorys = Util.getDocCategorysByTable(String.valueOf(workflowId), signFileField, billTable);
|
||||||
String[] docCategoryArr = docCategorys.split(",");
|
String[] docCategoryArr = docCategorys.split(",");
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package weaver.youhong.ai.intellectualproperty.cusgetvalue;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
|
||||||
|
import weaver.youhong.ai.intellectualproperty.util.OFDReader;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取关键字页码</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/18 16:56</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class GetOfdKeywordPageValue implements CusInterfaceGetValue {
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
|
||||||
|
try {
|
||||||
|
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(currentValue);
|
||||||
|
InputStream inputStream = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
||||||
|
String filePath = Util.createTempFile(inputStream, docImageInfo.getImageFileName(), "ofd");
|
||||||
|
String keywordType = pathParam.get("keywordType");
|
||||||
|
String keywordValue = "";
|
||||||
|
String keyword = pathParam.get("keyword");
|
||||||
|
if (StrUtil.isNotBlank(keywordType)) {
|
||||||
|
if ("1".equals(keywordType)) {
|
||||||
|
keywordValue = Util.null2String(mainMap.get(keyword));
|
||||||
|
} else {
|
||||||
|
keywordValue = keyword;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
keywordValue = keyword;
|
||||||
|
}
|
||||||
|
OFDReader reader = new OFDReader(filePath, keywordValue);
|
||||||
|
List<OFDReader.KeywordInfoRange> keywordInfos = reader.findKeywords();
|
||||||
|
Files.delete(Paths.get(filePath));
|
||||||
|
if (keywordInfos.isEmpty()) {
|
||||||
|
throw new CustomerException("关键字定位异常!未找到关键字");
|
||||||
|
} else {
|
||||||
|
String pageNumber = keywordInfos.get(keywordInfos.size() - 1).getStart().getPageNumber();
|
||||||
|
return Integer.parseInt(pageNumber) + 1;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("关键字定位异常: " + Util.getErrString(e));
|
||||||
|
throw new CustomerException("关键字定位异常!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,185 @@
|
||||||
|
package weaver.youhong.ai.intellectualproperty.util;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>ofd读区关键字</h2>
|
||||||
|
*/
|
||||||
|
public class OFDReader {
|
||||||
|
|
||||||
|
private final String ofdFilePath;
|
||||||
|
private final String keyword;
|
||||||
|
|
||||||
|
public OFDReader(String ofdFilePath, String keyword) {
|
||||||
|
this.ofdFilePath = ofdFilePath;
|
||||||
|
this.keyword = keyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<KeywordInfoRange> findKeywords() throws Exception {
|
||||||
|
// 解析OFD.xml文件,获取OFD的根目录路径
|
||||||
|
String rootDirPath = parseOFDXmlAndGetRootDirPath();
|
||||||
|
if (rootDirPath == null) {
|
||||||
|
throw new Exception("Failed to parse OFD.xml file!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开OFD文件并获取ZipFile对象
|
||||||
|
ZipFile zipFile = new ZipFile(ofdFilePath);
|
||||||
|
|
||||||
|
// 获取Pages目录下的所有页面文件夹
|
||||||
|
List<String> pageFolders = getPageFolders(zipFile, rootDirPath);
|
||||||
|
if (pageFolders == null || pageFolders.isEmpty()) {
|
||||||
|
throw new Exception("No page found in the OFD file!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找所有关键字的位置信息
|
||||||
|
List<KeywordInfoRange> result = new ArrayList<>();
|
||||||
|
for (String pageFolder : pageFolders) {
|
||||||
|
KeywordInfoRange keywordInfo = findKeywordInPage(zipFile, pageFolder);
|
||||||
|
if (keywordInfo != null) {
|
||||||
|
result.add(keywordInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
zipFile.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析OFD.xml文件并获取OFD的根目录路径
|
||||||
|
private String parseOFDXmlAndGetRootDirPath() throws Exception {
|
||||||
|
ZipFile zipFile = new ZipFile(ofdFilePath);
|
||||||
|
ZipEntry ofdXmlEntry = zipFile.getEntry("OFD.xml");
|
||||||
|
InputStream inputStream = zipFile.getInputStream(ofdXmlEntry);
|
||||||
|
|
||||||
|
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
||||||
|
NodeList docRootNodes = doc.getElementsByTagName("ofd:DocRoot");
|
||||||
|
if (docRootNodes.getLength() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String docRootPath = docRootNodes.item(0).getTextContent();
|
||||||
|
String[] docRootPathSegments = docRootPath.split("/");
|
||||||
|
if (docRootPathSegments.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return docRootPathSegments[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取Pages目录下的所有页面文件夹
|
||||||
|
private List<String> getPageFolders(ZipFile zipFile, String rootDirPath) {
|
||||||
|
List<String> pageFolders = new ArrayList<>();
|
||||||
|
String pagesDirPath = rootDirPath + "/Pages/";
|
||||||
|
String pagesPrefix = pagesDirPath + "Page_";
|
||||||
|
String pagesSuffix = "Content.xml";
|
||||||
|
// 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹
|
||||||
|
zipFile.stream().forEach(entry -> {
|
||||||
|
if (entry.getName().startsWith(pagesDirPath) && entry.getName().startsWith(pagesPrefix) && entry.getName().endsWith(pagesSuffix) && !entry.getName().equals(pagesDirPath)) {
|
||||||
|
pageFolders.add(entry.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return pageFolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在指定页面中查找关键字
|
||||||
|
private KeywordInfoRange findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception {
|
||||||
|
ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder);
|
||||||
|
InputStream inputStream = zipFile.getInputStream(contentXmlEntry);
|
||||||
|
|
||||||
|
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
||||||
|
NodeList textNodes = doc.getElementsByTagName("ofd:TextObject");
|
||||||
|
int startK = 0;
|
||||||
|
List<KeywordInfo> keywordInfos = new ArrayList<>();
|
||||||
|
for (int i = 0; i < textNodes.getLength(); i++) {
|
||||||
|
Node textNode = textNodes.item(i);
|
||||||
|
String textContent = textNode.getTextContent();
|
||||||
|
char[] chars = textContent.toCharArray();
|
||||||
|
char[] keywordChars = keyword.toCharArray();
|
||||||
|
for (int j = 0; j < chars.length; j++) {
|
||||||
|
for (int k = startK; k < keywordChars.length; k++) {
|
||||||
|
char contentChar = chars[j];
|
||||||
|
char keywordChar = keywordChars[k];
|
||||||
|
if (contentChar == keywordChar) {
|
||||||
|
j++;
|
||||||
|
if (j == chars.length) {
|
||||||
|
startK = j;
|
||||||
|
Node boundaryNode = textNode.getAttributes().getNamedItem("Boundary");
|
||||||
|
String boundary = boundaryNode.getNodeValue();
|
||||||
|
String[] boundarySegments = boundary.split(" ");
|
||||||
|
double x = Double.parseDouble(boundarySegments[0]);
|
||||||
|
double y = Double.parseDouble(boundarySegments[1]);
|
||||||
|
double width = Double.parseDouble(boundarySegments[2]);
|
||||||
|
double height = Double.parseDouble(boundarySegments[3]);
|
||||||
|
KeywordInfo keywordInfo = new KeywordInfo(pageFolder, x, y, width, height);
|
||||||
|
keywordInfos.add(keywordInfo);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startK = 0;
|
||||||
|
keywordInfos.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keywordInfos.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new KeywordInfoRange(keywordInfos.get(0), keywordInfos.get(keywordInfos.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class KeywordInfoRange {
|
||||||
|
private final KeywordInfo start;
|
||||||
|
|
||||||
|
private final KeywordInfo end;
|
||||||
|
|
||||||
|
public KeywordInfoRange(KeywordInfo start, KeywordInfo end) {
|
||||||
|
this.start = start;
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeywordInfo getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeywordInfo getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class KeywordInfo {
|
||||||
|
private final String pageFolder;
|
||||||
|
private final double x;
|
||||||
|
private final double y;
|
||||||
|
private final double width;
|
||||||
|
private final double height;
|
||||||
|
|
||||||
|
|
||||||
|
public KeywordInfo(String pageFolder, double x, double y, double width, double height) {
|
||||||
|
this.pageFolder = pageFolder;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPageNumber() {
|
||||||
|
int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - "/Content.xml".length()));
|
||||||
|
return String.valueOf(pageNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBoundingBox() {
|
||||||
|
return "(" + x + ", " + y + ", " + width + ", " + height + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.doctoavatar;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.IdUtil;
|
||||||
|
import com.weaver.esb.server.cache.ResourceComInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
import weaver.general.GCONST;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>生成头像</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 17:40</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@ActionDesc(value = "生成头像", author = "youhong.ai")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DocToAvatarAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@RequiredMark(value = "sctxzp", desc = "上传头像的字段名称")
|
||||||
|
private String iconDocField;
|
||||||
|
|
||||||
|
@RequiredMark(value = "dqyh", desc = "上传头像的字段名称")
|
||||||
|
@PrintParamMark
|
||||||
|
private String userField;
|
||||||
|
|
||||||
|
|
||||||
|
private final DocToAvatarActionMapper mapper = Util.getMapper(DocToAvatarActionMapper.class);
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
|
Map<String, String> mainTable = getMainTableValue(requestInfo);
|
||||||
|
String docIds = "";
|
||||||
|
if (mainTable.containsKey(iconDocField)) {
|
||||||
|
docIds = mainTable.get(iconDocField);
|
||||||
|
}
|
||||||
|
String[] docArr = docIds.split(",");
|
||||||
|
if (docArr.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String avatarDoc = docArr[0];
|
||||||
|
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(avatarDoc);
|
||||||
|
if (Objects.isNull(docImageInfo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
||||||
|
String avatarPath = GCONST.getRootPath();
|
||||||
|
if (avatarPath.endsWith(File.separator)) {
|
||||||
|
avatarPath += File.separator;
|
||||||
|
}
|
||||||
|
String uuid = IdUtil.randomUUID();
|
||||||
|
String imgName = docImageInfo.getImageFileName();
|
||||||
|
int dotIndex = imgName.lastIndexOf(".");
|
||||||
|
if (dotIndex > 0) {
|
||||||
|
String extension = imgName.substring(dotIndex + 1);
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
String imageFileName = "/messager/usericon/" + uuid + "-" + time + "." + extension;
|
||||||
|
avatarPath += "messager" + File.separator + "usericon" + File.separator;
|
||||||
|
File imageFile = new File(avatarPath + uuid + "-" + time + "." + extension);
|
||||||
|
if (!imageFile.getParentFile().exists()) {
|
||||||
|
imageFile.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
OutputStream os = null;
|
||||||
|
try {
|
||||||
|
os = Files.newOutputStream(imageFile.toPath());
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStreamById.read(buffer)) != -1) {
|
||||||
|
os.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.info("写入头像文件失败!" + Util.getErrString(e));
|
||||||
|
throw new CustomerException("头像生成失败!");
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (inputStreamById != null) {
|
||||||
|
inputStreamById.close();
|
||||||
|
}
|
||||||
|
if (os != null) {
|
||||||
|
os.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.info("关闭文件流失败!!" + Util.getErrString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mainTable.containsKey(userField)) {
|
||||||
|
String currentUser = mainTable.get(userField);
|
||||||
|
if (!mapper.updateAvatar(currentUser, imageFileName, docImageInfo.getImageFileId())) {
|
||||||
|
log.info("头像更新失败!sql出错!");
|
||||||
|
} else {
|
||||||
|
ResourceComInfo rsc = new ResourceComInfo();
|
||||||
|
rsc.removeCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.doctoavatar;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>更新头像</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 18:02</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface DocToAvatarActionMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>更新人员头像信息</h2>
|
||||||
|
*
|
||||||
|
* @param currentUser 当前用户
|
||||||
|
* @param avatarImg 更新头像
|
||||||
|
* @return 是否更新成功
|
||||||
|
*/
|
||||||
|
@Update("update hrmresource set messagerurl = #{avatarImg},resourceimageid = #{imageId} where id = #{currentUser}")
|
||||||
|
boolean updateAvatar(@ParamMapper("currentUser") String currentUser,
|
||||||
|
@ParamMapper("avatarImg") String avatarImg,
|
||||||
|
@ParamMapper("imageId") Integer imgId);
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package weaver.yunjinshan.formmode.action;
|
||||||
|
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.soa.workflow.request.MainTableInfo;
|
||||||
|
import weaver.soa.workflow.request.Property;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云锦山
|
||||||
|
* 合同管理模块 新建、编辑保存和导入时,自定义扩展功能
|
||||||
|
*/
|
||||||
|
public class ContractExpandAction extends AbstractModeExpandJavaCodeNew {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块主表名称
|
||||||
|
*/
|
||||||
|
private final static String modeTableName = "uf_hetongguanli";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浮点数格式化
|
||||||
|
*/
|
||||||
|
private final DecimalFormat df = new DecimalFormat("##############################0.0000");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行模块扩展动作
|
||||||
|
* @param param
|
||||||
|
* param包含(但不限于)以下数据
|
||||||
|
* user 当前用户
|
||||||
|
* importtype 导入方式(仅在批量导入的接口动作会传输) 1 追加,2覆盖,3更新,获取方式(int)param.get("importtype")
|
||||||
|
* 导入链接中拼接的特殊参数(仅在批量导入的接口动作会传输),比如a=1,可通过param.get("a")获取参数值
|
||||||
|
* 页面链接拼接的参数,比如b=2,可以通过param.get("b")来获取参数
|
||||||
|
* @return 返回执行结果
|
||||||
|
*/
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
try {
|
||||||
|
BaseBean bean = new BaseBean();
|
||||||
|
|
||||||
|
bean.writeLog("-------------ContractExpandAction Begin----------------");
|
||||||
|
|
||||||
|
bean.writeLog("param:[" + param.toString() + "]");
|
||||||
|
|
||||||
|
int billid;//数据id
|
||||||
|
int modeid;//模块id
|
||||||
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
|
if (requestInfo != null) {
|
||||||
|
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||||
|
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||||
|
|
||||||
|
bean.writeLog("billid:[" + billid + "],modeid:[" + modeid + "]");
|
||||||
|
|
||||||
|
if (billid > 0 && modeid > 0) {
|
||||||
|
//String selectData = "select * from " + modeTableName + " where id = ?";
|
||||||
|
|
||||||
|
//年月
|
||||||
|
String yearMonth = "";
|
||||||
|
//一级部门
|
||||||
|
String superiorDepartment = "";
|
||||||
|
//客户
|
||||||
|
String customer = "";
|
||||||
|
|
||||||
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||||
|
|
||||||
|
for(Property p : mainTableInfo.getProperty()){
|
||||||
|
if("qdny".equalsIgnoreCase(p.getName())) {
|
||||||
|
yearMonth = p.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if("yjbm".equalsIgnoreCase(p.getName())){
|
||||||
|
superiorDepartment = p.getValue();
|
||||||
|
}
|
||||||
|
if("khmc".equalsIgnoreCase(p.getName())){
|
||||||
|
customer = p.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
if(rs.executeQuery(selectData,billid)){
|
||||||
|
if(rs.next()){
|
||||||
|
yearMonth = Util.null2String(rs.getString("qdny"));
|
||||||
|
superiorDepartment = Util.null2String(rs.getString("yjbm"));
|
||||||
|
customer = Util.null2String(rs.getString("khmc"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
CostIncomeUpdate incomeUpdate = new CostIncomeUpdate();
|
||||||
|
incomeUpdate.updateByContract(yearMonth,superiorDepartment,customer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bean.writeLog("-------------ContractExpandAction End----------------");
|
||||||
|
result.put("flag", "true");
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("errmsg",e.getMessage());
|
||||||
|
result.put("flag", "false");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
package weaver.yunjinshan.formmode.action;
|
||||||
|
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云锦山
|
||||||
|
* 成本收入更新操作
|
||||||
|
*/
|
||||||
|
public class CostIncomeUpdate {
|
||||||
|
|
||||||
|
private final static String contractModeTableName = "uf_hetongguanli";
|
||||||
|
|
||||||
|
private final static BaseBean bean = new BaseBean();
|
||||||
|
|
||||||
|
private final static RecordSet rs = new RecordSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浮点数格式化
|
||||||
|
*/
|
||||||
|
private final DecimalFormat df = new DecimalFormat("##############################0.0000");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据合同管理 变更成本收入
|
||||||
|
*
|
||||||
|
* @param yearMonth 年月
|
||||||
|
* @param superiorDepartment 一级部门
|
||||||
|
* @param customer 客户
|
||||||
|
*/
|
||||||
|
public void updateByContract(String yearMonth, String superiorDepartment, String customer) {
|
||||||
|
bean.writeLog("yearMonth:[" + yearMonth + "],superiorDepartment:[" + superiorDepartment + "],customer:[" + customer + "]");
|
||||||
|
|
||||||
|
// 合同金额合计
|
||||||
|
double contractAmount = 0.0;
|
||||||
|
// 收款金额合计
|
||||||
|
double receivableAmount = 0.0;
|
||||||
|
// 开票金额合计
|
||||||
|
double invoiceAmount = 0.0;
|
||||||
|
// 获取该模块相同年月、一级部门、客户的合同金额合计
|
||||||
|
String selectData = "select sum(isnull(htje,0.0)) from " + contractModeTableName + " where qdny = ? and yjbm = ? and khmc = ?";
|
||||||
|
|
||||||
|
if (rs.executeQuery(selectData, yearMonth, superiorDepartment, customer)) {
|
||||||
|
if (rs.next()) {
|
||||||
|
contractAmount = Util.getDoubleValue(rs.getString(1), 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
selectData = "select sum(isnull(dt.ysje,0.0)) from " + contractModeTableName + "_dt1 dt inner join " + contractModeTableName + " m on dt.mainId = m.id " +
|
||||||
|
"where m.yjbm = ? and m.khmc = ? and (dt.skrq is not null and substring(dt.skrq,1,7) = ?)";
|
||||||
|
|
||||||
|
if (rs.executeQuery(selectData, superiorDepartment, customer, yearMonth) && rs.next()) {
|
||||||
|
receivableAmount = Util.getDoubleValue(rs.getString(1), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectData = "select sum(isnull(dt.jshjje,0.0)) from " + contractModeTableName + "_dt2 dt inner join " + contractModeTableName + " m on dt.mainId = m.id " +
|
||||||
|
"where m.yjbm = ? and m.khmc = ? and (dt.kprq is not null and substring(dt.kprq,1,7) = ?)";
|
||||||
|
|
||||||
|
if (rs.executeQuery(selectData, superiorDepartment, customer, yearMonth) && rs.next()) {
|
||||||
|
invoiceAmount = Util.getDoubleValue(rs.getString(1), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
String updateSQL = "update uf_chengbenshouru set yqhtjekkpje = " + df.format(contractAmount) + "," +
|
||||||
|
"yskje = " + df.format(receivableAmount) + "," +
|
||||||
|
"ykpjehs = " + df.format(invoiceAmount) +
|
||||||
|
" where ny = ? and yjbm = ? and kh = ?";
|
||||||
|
|
||||||
|
boolean isSuccess = rs.executeUpdate(updateSQL, yearMonth, superiorDepartment, customer);
|
||||||
|
|
||||||
|
bean.writeLog("updateSQL:[" + updateSQL + "],执行结果:[" + isSuccess + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据人力成本更新成本收入
|
||||||
|
*
|
||||||
|
* @param yearMonth 年月
|
||||||
|
* @param superiorDepartment 一级部门
|
||||||
|
* @param customer 客户名称
|
||||||
|
*/
|
||||||
|
public void updateByHumanCost(String yearMonth, String superiorDepartment, String customer) {
|
||||||
|
bean.writeLog("yearMonth:[" + yearMonth + "],superiorDepartment:[" + superiorDepartment + "],customer:[" + customer + "]");
|
||||||
|
|
||||||
|
double totalAmount = 0.0;
|
||||||
|
String selectData = "select sum(isnull(gszzffy,0.0)) from uf_renlichengben where ny = ? and yjbm = ? and kh = ?";
|
||||||
|
|
||||||
|
if (rs.executeQuery(selectData, yearMonth, superiorDepartment, customer)) {
|
||||||
|
if (rs.next()) {
|
||||||
|
totalAmount = Util.getDoubleValue(rs.getString(1), 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String updateSQL = "update uf_chengbenshouru set rycb = " + df.format(totalAmount) + " where ny = ? and yjbm = ? and kh = ?";
|
||||||
|
|
||||||
|
boolean isSuccess = rs.executeUpdate(updateSQL, yearMonth, superiorDepartment, customer);
|
||||||
|
|
||||||
|
bean.writeLog("updateSQL:[" + updateSQL + "],执行结果:[" + isSuccess + "]");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
package weaver.yunjinshan.formmode.action;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.soa.workflow.request.MainTableInfo;
|
||||||
|
import weaver.soa.workflow.request.Property;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云锦山
|
||||||
|
* 人力成本建模 新建、编辑保存和导入数据时,自定义扩展操作
|
||||||
|
*/
|
||||||
|
public class HumanCostExpandAction extends AbstractModeExpandJavaCodeNew {
|
||||||
|
|
||||||
|
private final DecimalFormat df = new DecimalFormat("##############################0.0000");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行模块扩展动作
|
||||||
|
* @param param
|
||||||
|
* param包含(但不限于)以下数据
|
||||||
|
* user 当前用户
|
||||||
|
* importtype 导入方式(仅在批量导入的接口动作会传输) 1 追加,2覆盖,3更新,获取方式(int)param.get("importtype")
|
||||||
|
* 导入链接中拼接的特殊参数(仅在批量导入的接口动作会传输),比如a=1,可通过param.get("a")获取参数值
|
||||||
|
* 页面链接拼接的参数,比如b=2,可以通过param.get("b")来获取参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
BaseBean bean = new BaseBean();
|
||||||
|
|
||||||
|
bean.writeLog("-------------HumanCostExpandAction Begin----------------");
|
||||||
|
|
||||||
|
bean.writeLog("param:[" + param.toString() + "]");
|
||||||
|
|
||||||
|
int billid = -1;//数据id
|
||||||
|
int modeid = -1;//模块id
|
||||||
|
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
|
||||||
|
if(requestInfo!=null){
|
||||||
|
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||||
|
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||||
|
|
||||||
|
bean.writeLog("billid:[" + billid + "],modeid:[" + modeid + "]");
|
||||||
|
if(billid>0&&modeid>0){
|
||||||
|
//年月
|
||||||
|
String yearMonth = "";
|
||||||
|
//一级部门
|
||||||
|
String superiorDepartment = "";
|
||||||
|
//客户
|
||||||
|
String customer = "";
|
||||||
|
|
||||||
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||||
|
|
||||||
|
for(Property p : mainTableInfo.getProperty()){
|
||||||
|
if("ny".equalsIgnoreCase(p.getName())) {
|
||||||
|
yearMonth = p.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if("yjbm".equalsIgnoreCase(p.getName())){
|
||||||
|
superiorDepartment = p.getValue();
|
||||||
|
}
|
||||||
|
if("kh".equalsIgnoreCase(p.getName())){
|
||||||
|
customer = p.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
//查询该记录对应的信息
|
||||||
|
String selectData = "select * from uf_renlichengben where id = ?";
|
||||||
|
|
||||||
|
if(rs.executeQuery(selectData,billid)){
|
||||||
|
if(rs.next()){
|
||||||
|
yearMonth = Util.null2String(rs.getString("ny"));
|
||||||
|
superiorDepartment = Util.null2String(rs.getString("yjbm"));
|
||||||
|
customer = Util.null2String(rs.getString("kh"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bean.writeLog("yearMonth:[" + yearMonth + "],superiorDepartment:[" + superiorDepartment + "],customer:[" + customer + "]");
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
|
||||||
|
double totalAmount = 0.0;
|
||||||
|
String selectData = "select sum(isnull(gszzffy,0.0)) from uf_renlichengben where ny = ? and yjbm = ? and kh = ?";
|
||||||
|
|
||||||
|
if(rs.executeQuery(selectData,yearMonth,superiorDepartment,customer)){
|
||||||
|
if(rs.next()){
|
||||||
|
totalAmount = Util.getDoubleValue(rs.getString(1),0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String updateSQL = "update uf_chengbenshouru set rycb = " + df.format(totalAmount) + " where ny = ? and yjbm = ? and kh = ?";
|
||||||
|
|
||||||
|
boolean isSuccess = rs.executeUpdate(updateSQL,yearMonth,superiorDepartment,customer);
|
||||||
|
|
||||||
|
bean.writeLog("updateSQL:[" + updateSQL + "],执行结果:[" + isSuccess + "]");
|
||||||
|
*/
|
||||||
|
|
||||||
|
CostIncomeUpdate incomeUpdate = new CostIncomeUpdate();
|
||||||
|
incomeUpdate.updateByHumanCost(yearMonth,superiorDepartment,customer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put("flag", "true");
|
||||||
|
|
||||||
|
bean.writeLog("-------------HumanCostExpandAction End----------------");
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("errmsg","自定义出错信息");
|
||||||
|
result.put("flag", "false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#修改当前配置文件后需要重启, you must restart service at change the config file after
|
#修改当前配置文件后需要重启, you must restart service at change the config file after
|
||||||
#
|
#
|
||||||
# 当前需要同步的语言, current active language
|
# 当前需要同步的语言, current active language
|
||||||
cus.multilingual.active=ZHS,IDN
|
cus.multilingual.active="ZHS,IDN"
|
||||||
#中文
|
#中文
|
||||||
cus.multilingual.ZHS=7
|
cus.multilingual.ZHS=7
|
||||||
#印尼
|
#印尼
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
yunzhao.environment=test
|
yunzhao.environment=pro
|
|
@ -18,6 +18,8 @@ export.createType=yyyy-MM-dd
|
||||||
export.costCenter=cbzxyh
|
export.costCenter=cbzxyh
|
||||||
# 条件key
|
# 条件key
|
||||||
export.conditionKey=condition
|
export.conditionKey=condition
|
||||||
|
#附加信息
|
||||||
|
export.additional=ddsm
|
||||||
#流水号-requestId
|
#流水号-requestId
|
||||||
export.requestId=lcid
|
export.requestId=lcid
|
||||||
# bgm字段
|
# bgm字段
|
||||||
|
@ -41,72 +43,114 @@ export.sku=sku
|
||||||
#导出表头设置
|
#导出表头设置
|
||||||
export.head.title[0]=序号
|
export.head.title[0]=序号
|
||||||
export.head.field[0]=no
|
export.head.field[0]=no
|
||||||
export.head.title[1]=分组编号
|
#export.head.title[1]=分组编号
|
||||||
export.head.field[1]=groupId
|
#export.head.field[1]=groupId
|
||||||
export.head.title[2]=ID
|
#export.head.title[2]=ID
|
||||||
export.head.field[2]=id
|
#export.head.field[2]=id
|
||||||
export.head.title[3]=条件
|
export.head.title[1]=条件
|
||||||
export.head.field[3]=condition
|
export.head.field[1]=condition
|
||||||
export.head.title[4]=疑似拆单
|
#export.head.title[4]=疑似拆单
|
||||||
export.head.field[4]=openBill
|
export.head.title[2]=拆单方式
|
||||||
export.head.title[5]=流水号
|
export.head.field[2]=openBill
|
||||||
export.head.field[5]=lcid
|
export.head.title[3]=月份
|
||||||
export.head.title[6]=shipTo
|
export.head.field[3]=sqtjrq
|
||||||
export.head.field[6]=shipto
|
export.head.title[4]=SKU
|
||||||
export.head.title[7]=推送时间
|
export.head.field[4]=ZWMS
|
||||||
export.head.field[7]=insertTime
|
export.head.title[5]=部门
|
||||||
export.head.title[8]=审批开始时间
|
export.head.field[5]=SPART
|
||||||
export.head.field[8]=createdate
|
export.head.title[6]=订单编号
|
||||||
export.head.title[9]=申请提交时间
|
export.head.field[6]=ddbh
|
||||||
export.head.field[9]=sqtjrq
|
export.head.title[7]=备注信息
|
||||||
export.head.title[10]=审批开始时间
|
export.head.field[7]=bz
|
||||||
export.head.field[10]=LASTOPERATEDATE
|
export.head.title[8]=附加信息
|
||||||
export.head.title[11]=收方限制
|
export.head.field[8]=ddsm
|
||||||
export.head.field[11]=ddlxms
|
export.head.title[9]=成本中心
|
||||||
export.head.title[12]=部门团队
|
export.head.field[9]=KOSTL
|
||||||
export.head.field[12]=SPART
|
export.head.title[10]=活动编号
|
||||||
export.head.title[13]=品牌部门
|
export.head.field[10]=hdbh
|
||||||
export.head.field[13]=yjpp
|
export.head.title[11]=流水号
|
||||||
export.head.title[14]=订单编号
|
export.head.field[11]=lcid
|
||||||
export.head.field[14]=ddbh
|
export.head.title[12]=用户
|
||||||
export.head.title[15]=订单说明
|
export.head.field[12]=cbzxyh
|
||||||
export.head.field[15]=ddsm
|
export.head.title[13]=订单类型
|
||||||
export.head.title[16]=备注
|
export.head.field[13]=AUART
|
||||||
export.head.field[16]=bz
|
export.head.title[14]=订单用途
|
||||||
export.head.title[17]=成本中心-sap
|
export.head.field[14]=ddyt
|
||||||
export.head.field[17]=KOSTL
|
export.head.title[15]=shipTo
|
||||||
export.head.title[18]=成本中心-用户
|
export.head.field[15]=shipto
|
||||||
export.head.field[18]=cbzxyh
|
export.head.title[16]=办公室员工
|
||||||
export.head.title[19]=财务科目
|
export.head.field[16]=KUNNRSHIPTO
|
||||||
export.head.field[19]=cwkm
|
export.head.title[17]=提交时间
|
||||||
export.head.title[20]=审批开始时间
|
export.head.field[17]=LASTOPERATEDATE
|
||||||
export.head.field[20]=LASTOPERATEDATE
|
export.head.title[18]=总数
|
||||||
export.head.title[21]=活动编号
|
export.head.field[18]=SL
|
||||||
export.head.field[21]=hdbh
|
export.head.title[19]=成本总额
|
||||||
export.head.title[22]=businessKey
|
export.head.field[19]=kxpmxzlsj
|
||||||
export.head.field[22]=businesskey
|
export.head.title[20]=总税额
|
||||||
export.head.title[23]=申请人
|
export.head.field[20]=
|
||||||
export.head.field[23]=SQRRLZY
|
export.head.title[21]=总价格
|
||||||
export.head.title[24]=订单类型
|
export.head.field[21]=
|
||||||
export.head.field[24]=AUART
|
export.head.title[22]=订单时间
|
||||||
export.head.title[25]=订单用途
|
export.head.field[22]=LASTOPERATEDATE
|
||||||
export.head.field[25]=VKAUS
|
export.head.title[23]=到货方
|
||||||
export.head.title[26]=收货人
|
export.head.field[23]=
|
||||||
export.head.field[26]=KUNNRSHIPTO
|
#export.head.title[5]=流水号
|
||||||
export.head.title[27]=收货人地址
|
#export.head.field[5]=lcid
|
||||||
export.head.field[27]=shdz
|
#export.head.title[6]=shipTo
|
||||||
export.head.title[28]=收货编号
|
#export.head.field[6]=shipto
|
||||||
export.head.field[28]=hwbh
|
#export.head.title[7]=推送时间
|
||||||
export.head.title[29]=收货类型
|
#export.head.field[7]=insertTime
|
||||||
export.head.field[29]=fl
|
#export.head.title[8]=审批开始时间
|
||||||
export.head.title[30]=收货中文名
|
#export.head.field[8]=createdate
|
||||||
export.head.field[30]=ZWMS
|
#export.head.title[9]=申请提交时间
|
||||||
export.head.title[31]=数量
|
#export.head.field[9]=sqtjrq
|
||||||
export.head.field[31]=SL
|
#export.head.title[10]=审批开始时间
|
||||||
export.head.title[32]=零售总额
|
#export.head.field[10]=LASTOPERATEDATE
|
||||||
export.head.field[32]=kxpmxzlsj
|
#export.head.title[11]=收方限制
|
||||||
export.head.title[33]=订单分类
|
#export.head.field[11]=ddlxms
|
||||||
export.head.field[33]=ddlx
|
#export.head.title[12]=部门团队
|
||||||
export.head.title[34]=gbm
|
#export.head.field[12]=SPART
|
||||||
export.head.field[34]=bgm
|
#export.head.title[13]=品牌部门
|
||||||
|
#export.head.field[13]=yjpp
|
||||||
|
#export.head.title[14]=订单编号
|
||||||
|
#export.head.field[14]=ddbh
|
||||||
|
#export.head.title[15]=订单说明
|
||||||
|
#export.head.field[15]=ddsm
|
||||||
|
#export.head.title[16]=备注
|
||||||
|
#export.head.field[16]=bz
|
||||||
|
#export.head.title[17]=成本中心-sap
|
||||||
|
#export.head.field[17]=KOSTL
|
||||||
|
#export.head.title[18]=成本中心-用户
|
||||||
|
#export.head.field[18]=cbzxyh
|
||||||
|
#export.head.title[19]=财务科目
|
||||||
|
#export.head.field[19]=cwkm
|
||||||
|
#export.head.title[20]=审批开始时间
|
||||||
|
#export.head.field[20]=LASTOPERATEDATE
|
||||||
|
#export.head.title[21]=活动编号
|
||||||
|
#export.head.field[21]=hdbh
|
||||||
|
#export.head.title[22]=businessKey
|
||||||
|
#export.head.field[22]=businesskey
|
||||||
|
#export.head.title[23]=申请人
|
||||||
|
#export.head.field[23]=SQRRLZY
|
||||||
|
#export.head.title[24]=订单类型
|
||||||
|
#export.head.field[24]=AUART
|
||||||
|
#export.head.title[25]=订单用途
|
||||||
|
#export.head.field[25]=VKAUS
|
||||||
|
#export.head.title[26]=收货人
|
||||||
|
#export.head.field[26]=KUNNRSHIPTO
|
||||||
|
#export.head.title[27]=收货人地址
|
||||||
|
#export.head.field[27]=shdz
|
||||||
|
#export.head.title[28]=收货编号
|
||||||
|
#export.head.field[28]=hwbh
|
||||||
|
#export.head.title[29]=收货类型
|
||||||
|
#export.head.field[29]=fl
|
||||||
|
#export.head.title[30]=收货中文名
|
||||||
|
#export.head.field[30]=ZWMS
|
||||||
|
#export.head.title[31]=数量
|
||||||
|
#export.head.field[31]=SL
|
||||||
|
#export.head.title[32]=零售总额
|
||||||
|
#export.head.field[32]=kxpmxzlsj
|
||||||
|
#export.head.title[33]=订单分类
|
||||||
|
##xport.head.title[34]=gbm
|
||||||
|
#export.head.field[34]=bgm
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
body{
|
||||||
|
background-color: rgb(241, 241, 241);
|
||||||
|
font-family: PingFangSC-Regular;
|
||||||
|
color: #333333 ;
|
||||||
|
}
|
||||||
|
.box{
|
||||||
|
width: 1000px;
|
||||||
|
margin:0 auto;
|
||||||
|
margin-top: 100px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
}
|
||||||
|
.mytitle{
|
||||||
|
width: 100%;
|
||||||
|
background-color: #F6F6F6 ;
|
||||||
|
height: 40px;
|
||||||
|
font-size: 14px;
|
||||||
|
background: #F6F6F6;
|
||||||
|
border: 1px solid #E2E2E2;
|
||||||
|
|
||||||
|
}
|
||||||
|
.clusterIp{
|
||||||
|
display: inline-block;
|
||||||
|
width: 120px;
|
||||||
|
|
||||||
|
}
|
||||||
|
input[type='checkbox']{
|
||||||
|
}
|
||||||
|
|
||||||
|
.cluster{
|
||||||
|
border-bottom: 1px solid #E2E2E2;
|
||||||
|
width: 80%;
|
||||||
|
margin-left: 39px;
|
||||||
|
height: 100px;
|
||||||
|
padding-top: 26px;
|
||||||
|
}
|
||||||
|
.Button{
|
||||||
|
color: #fff;
|
||||||
|
background-color: #2DB7F5;
|
||||||
|
border-color: #4cae4c;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
-ms-touch-action: manipulation;
|
||||||
|
touch-action: manipulation;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
background-image: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
width:70px;
|
||||||
|
height:30px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Wdate{
|
||||||
|
width: 150px;
|
||||||
|
height: 30px !important;
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clusterPlan{
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-left:30px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contend{
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-left: 1px solid #E2E2E2;
|
||||||
|
border-right: 1px solid #E2E2E2;
|
||||||
|
border-bottom: 1px solid #E2E2E2;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.messages{
|
||||||
|
color:red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#start[disabled]{
|
||||||
|
background-color: #A9A9A9;
|
||||||
|
}
|
|
@ -0,0 +1,138 @@
|
||||||
|
<%@ page language="java" %>
|
||||||
|
<%@ page import="org.apache.commons.httpclient.HttpClient" %>
|
||||||
|
<%@ page import="org.apache.commons.httpclient.methods.GetMethod" %>
|
||||||
|
<%@ page import="javax.servlet.http.HttpServletRequest" %>
|
||||||
|
<%@ page import="javax.servlet.http.HttpServletResponse" %>
|
||||||
|
<%@ page import="java.io.File" %>
|
||||||
|
<%@ page import="java.io.FileInputStream" %>
|
||||||
|
<%@ page import="java.io.InputStream" %>
|
||||||
|
<%@ page import="java.io.OutputStream" %>
|
||||||
|
<%@ page import="java.util.regex.Matcher" %>
|
||||||
|
<%@ page import="java.util.regex.Pattern" %>
|
||||||
|
<%
|
||||||
|
|
||||||
|
String logName = request.getParameter("logName");
|
||||||
|
String otherIp = request.getParameter("otherIp");
|
||||||
|
|
||||||
|
weaver.hrm.User user = (weaver.hrm.User) request.getSession(true).getAttribute("weaver_user@bean");
|
||||||
|
String ip = getIpAddress(request);
|
||||||
|
if (user == null || !"sysadmin".equals(user.getLoginid())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (otherIp != null) {
|
||||||
|
otherIp = otherIp.replace("-", ":");
|
||||||
|
downotherlog(logName, otherIp, response);
|
||||||
|
} else {
|
||||||
|
deal(request, response);
|
||||||
|
}
|
||||||
|
%><%!
|
||||||
|
public static boolean innerIP(String ip) {
|
||||||
|
String pattern = "((192\\.168|172\\.([1][6-9]|[2]\\d|3[01]))"
|
||||||
|
+ "(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){2}|"
|
||||||
|
+ "^(\\D)*10(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){3})";
|
||||||
|
Pattern reg = Pattern.compile(pattern);
|
||||||
|
Matcher match = reg.matcher(ip);
|
||||||
|
return match.find() || ip.equals("127.0.0.1");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIpAddress(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
if (ip.contains(",")) {
|
||||||
|
return ip.split(",")[0];
|
||||||
|
} else {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deal(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
response.reset();
|
||||||
|
String logName = request.getParameter("logName");
|
||||||
|
if (!logName.endsWith(".zip") || logName.indexOf("/") != -1 || logName.indexOf("\\") != -1 || logName.indexOf("..") != -1) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FileInputStream in = null;
|
||||||
|
OutputStream outs = null;
|
||||||
|
try {
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("content-disposition", "attachment;filename=" + logName);
|
||||||
|
response.setCharacterEncoding("ISO8859-1");
|
||||||
|
String ecologyPathtmp = request.getRealPath("/");
|
||||||
|
if (!ecologyPathtmp.endsWith(File.separator)) {
|
||||||
|
ecologyPathtmp = ecologyPathtmp + File.separator;
|
||||||
|
}
|
||||||
|
if (logName.indexOf("..") != -1 || logName.indexOf("\0") != -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
in = new FileInputStream(ecologyPathtmp + "cus_getlog" + File.separator + "log" + File.separator + logName);
|
||||||
|
outs = response.getOutputStream();
|
||||||
|
outs.flush();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int len = 0;
|
||||||
|
while ((len = in.read(buffer)) > 0) {
|
||||||
|
outs.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (in != null) {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
if (outs != null) {
|
||||||
|
outs.flush();
|
||||||
|
outs.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void downotherlog(String logName, String otherIp, HttpServletResponse response) {
|
||||||
|
response.reset();
|
||||||
|
|
||||||
|
InputStream in = null;
|
||||||
|
OutputStream outs = null;
|
||||||
|
try {
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("content-disposition", "attachment;filename=" + logName);
|
||||||
|
response.setCharacterEncoding("ISO8859-1");
|
||||||
|
HttpClient client = new HttpClient();
|
||||||
|
GetMethod httpget = new GetMethod("http://" + otherIp + "/cus_getlog/downlog.jsp?logName=" + logName);
|
||||||
|
client.executeMethod(httpget);
|
||||||
|
in = httpget.getResponseBodyAsStream();
|
||||||
|
outs = response.getOutputStream();
|
||||||
|
outs.flush();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int len = 0;
|
||||||
|
while ((len = in.read(buffer)) > 0) {
|
||||||
|
outs.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (in != null) {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
if (outs != null) {
|
||||||
|
outs.flush();
|
||||||
|
outs.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%>
|
|
@ -0,0 +1,481 @@
|
||||||
|
<%@ page language="java" contentType="text/html; charset=utf-8" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
<%@ page import="java.math.BigDecimal" %>
|
||||||
|
<%@ page import="java.math.RoundingMode" %>
|
||||||
|
<%@ page import="java.net.InetAddress" %>
|
||||||
|
<%@ page import="java.net.NetworkInterface" %>
|
||||||
|
<%@ page import="java.text.SimpleDateFormat" %>
|
||||||
|
<%@ page import="java.util.*" %>
|
||||||
|
<%@ page import="java.util.regex.Matcher" %>
|
||||||
|
<%@ page import="java.util.regex.Pattern" %>
|
||||||
|
<%@ page import="java.util.zip.ZipEntry" %>
|
||||||
|
<%@ page import="java.util.zip.ZipOutputStream" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
|
||||||
|
weaver.hrm.User user = (weaver.hrm.User) request.getSession(true).getAttribute("weaver_user@bean");
|
||||||
|
String ip = getIpAddress(request);
|
||||||
|
if (user == null || !"sysadmin".equals(user.getLoginid())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String startStr = request.getParameter("startDate");
|
||||||
|
String endStr = request.getParameter("endDate");
|
||||||
|
String logTypeStr = request.getParameter("loytype");
|
||||||
|
messageStr = new StringBuilder();
|
||||||
|
|
||||||
|
|
||||||
|
String ecologyPathtmp = request.getRealPath("/");
|
||||||
|
if (!ecologyPathtmp.endsWith(File.separator)) {
|
||||||
|
ecologyPathtmp = ecologyPathtmp + File.separator;
|
||||||
|
}
|
||||||
|
final String ecologyPath = ecologyPathtmp;
|
||||||
|
final String ResinPath = System.getProperty("user.dir") + File.separator;
|
||||||
|
//out.println(ResinPath+"<br>");
|
||||||
|
String outPath = ecologyPath + File.separator + "getlog" + File.separator + "log"; // 日志输出目录
|
||||||
|
List dates = getDateList(startStr, endStr);
|
||||||
|
File outFile = null;
|
||||||
|
try {
|
||||||
|
outFile = new File(outPath);
|
||||||
|
if (!outFile.exists()) {
|
||||||
|
outFile.mkdirs();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String outLogPath = outFile + File.separator + getInnerIp() + "downLog.zip";
|
||||||
|
Map logtype = new HashMap() { // 日志类型路径
|
||||||
|
{
|
||||||
|
put("thread", ecologyPath + "log" + File.separator + "thread");
|
||||||
|
put("mem", ecologyPath + "log" + File.separator + "mem");
|
||||||
|
put("ecology", ecologyPath + "log");
|
||||||
|
put("sql", ecologyPath + "log" + File.separator + "sql");
|
||||||
|
|
||||||
|
put("sqllog", ecologyPath + "sqllog");
|
||||||
|
|
||||||
|
put("security", ecologyPath + "WEB-INF" + File.separator + "securitylog");
|
||||||
|
put("Resin", ResinPath + "log");
|
||||||
|
put("integration", ecologyPath + "log" + File.separator + "integration");
|
||||||
|
|
||||||
|
put("monitorevent", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "event"); //运维平台的事件日志
|
||||||
|
put("monitorPool", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "pool");
|
||||||
|
put("monitorcpu", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "cpu");
|
||||||
|
put("resinconf", ResinPath + "conf" + File.separator + "resin.conf");
|
||||||
|
put("ecoloyweaver", ecologyPath + "WEB-INF" + File.separator + "prop" + File.separator);
|
||||||
|
put("monitorlog", ResinPath + "monitor" + File.separator + "resin" + File.separator + "log");
|
||||||
|
put("monitorconcurrent", ResinPath + "monitor" + File.separator + "resin" + File.separator + "app" + File.separator + "data" + File.separator + "concurrent");
|
||||||
|
|
||||||
|
put("cus", ecologyPath + "log" + File.separator + "cus");
|
||||||
|
put("util_cus", ecologyPath + "log" + File.separator + "cus" + File.separator + "util_cus");
|
||||||
|
put("sql_log", ecologyPath + "log" + File.separator + "cus" + File.separator + "sql_log");
|
||||||
|
put("http_util", ecologyPath + "log" + File.separator + "cus" + File.separator + "http_util");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Map logMap = getLogType(logTypeStr, logtype);
|
||||||
|
Set keys = logMap.keySet();
|
||||||
|
FileOutputStream fos = null;
|
||||||
|
try {
|
||||||
|
fos = new FileOutputStream(outLogPath);
|
||||||
|
ZipOutputStream zos = new ZipOutputStream(fos);
|
||||||
|
zos.setLevel(1);
|
||||||
|
Iterator it = keys.iterator();
|
||||||
|
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String key = (String) it.next();
|
||||||
|
for (int i = 0; i < dates.size(); i++) {
|
||||||
|
String date = (String) dates.get(i);
|
||||||
|
boolean isToDay = isToDay(date);
|
||||||
|
List fileNames = transition(key, (String) logtype.get(key), date, isToDay);
|
||||||
|
for (int j = 0; j < fileNames.size(); j++) {
|
||||||
|
String fileName = (String) fileNames.get(j);
|
||||||
|
//out.println(fileName+"<br>");
|
||||||
|
String basePath = date + File.separator;
|
||||||
|
if ("sqllog".equals(key)) {
|
||||||
|
basePath += ("sqllog" + File.separator);
|
||||||
|
}
|
||||||
|
if ("monitorevent".equals(key)) {
|
||||||
|
basePath += ("event" + File.separator);
|
||||||
|
}
|
||||||
|
if ("monitorlog".equals(key)) {
|
||||||
|
basePath += ("monitorlog" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("cus")) {
|
||||||
|
basePath += ("cus" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("util_cus")) {
|
||||||
|
basePath += ("util_cus" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("sql_log")) {
|
||||||
|
basePath += ("sql_log" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("http_util")) {
|
||||||
|
basePath += ("http_util" + File.separator);
|
||||||
|
}
|
||||||
|
compressbyType(fileName, zos, basePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
zos.close();
|
||||||
|
} catch (Exception es) {
|
||||||
|
}
|
||||||
|
if (fos != null)
|
||||||
|
fos.close();
|
||||||
|
File outLog = new File(outLogPath);
|
||||||
|
String fileSize = getFileSize(outLog);
|
||||||
|
out.println(fileSize + "," + messageStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
// out.println(end - start);
|
||||||
|
%>
|
||||||
|
<%!
|
||||||
|
|
||||||
|
public static boolean innerIP(String ip) {
|
||||||
|
String pattern = "((192\\.168|172\\.([1][6-9]|[2]\\d|3[01]))"
|
||||||
|
+ "(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){2}|"
|
||||||
|
+ "^(\\D)*10(\\.([2][0-4]\\d|[2][5][0-5]|[01]?\\d?\\d)){3})";
|
||||||
|
Pattern reg = Pattern.compile(pattern);
|
||||||
|
Matcher match = reg.matcher(ip);
|
||||||
|
return match.find() || ip.equals("127.0.0.1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIpAddress(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
if (ip.contains(",")) {
|
||||||
|
return ip.split(",")[0];
|
||||||
|
} else {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private StringBuilder messageStr = new StringBuilder();
|
||||||
|
|
||||||
|
private Map getLogType(String logTypeStr, Map logtype) {
|
||||||
|
Map resultmap = new HashMap();
|
||||||
|
String[] strs = logTypeStr.split(",");
|
||||||
|
for (int i = 0; i < strs.length; i++) {
|
||||||
|
String str = strs[i];
|
||||||
|
if (str.equals("monitor")) {
|
||||||
|
resultmap.put("thread", logtype.get("thread"));
|
||||||
|
resultmap.put("mem", logtype.get("mem"));
|
||||||
|
resultmap.put("sql", logtype.get("sql"));
|
||||||
|
resultmap.put("monitorevent", logtype.get("monitorevent"));
|
||||||
|
resultmap.put("monitorPool", logtype.get("monitorPool"));
|
||||||
|
resultmap.put("monitorcpu", logtype.get("monitorcpu"));
|
||||||
|
resultmap.put("resinconf", logtype.get("resinconf"));
|
||||||
|
resultmap.put("ecoloyweaver", logtype.get("ecoloyweaver"));
|
||||||
|
resultmap.put("monitorconcurrent", logtype.get("monitorconcurrent"));
|
||||||
|
resultmap.put("monitorlog", logtype.get("monitorlog"));
|
||||||
|
}
|
||||||
|
if (str.equals("Resin")) {
|
||||||
|
resultmap.put("Resin", logtype.get("Resin"));
|
||||||
|
}
|
||||||
|
if (str.equals("security")) {
|
||||||
|
resultmap.put("security", logtype.get("security"));
|
||||||
|
}
|
||||||
|
if (str.equals("ecology")) {
|
||||||
|
resultmap.put("ecology", logtype.get("ecology"));
|
||||||
|
}
|
||||||
|
if (str.equals("sql")) {
|
||||||
|
resultmap.put("sql", logtype.get("sql"));
|
||||||
|
}
|
||||||
|
if (str.equals("integration")) {
|
||||||
|
resultmap.put("integration", logtype.get("integration"));
|
||||||
|
}
|
||||||
|
if (str.equals("cus")) {
|
||||||
|
resultmap.put("cus", logtype.get("cus"));
|
||||||
|
}
|
||||||
|
if (str.equals("util_cus")) {
|
||||||
|
resultmap.put("util_cus", logtype.get("util_cus"));
|
||||||
|
}
|
||||||
|
if (str.equals("sql_log")) {
|
||||||
|
resultmap.put("sql_log", logtype.get("sql_log"));
|
||||||
|
}
|
||||||
|
if (str.equals("http_util")) {
|
||||||
|
resultmap.put("http_util", logtype.get("http_util"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List getDateList(String startDate, String endDate) {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
try {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date start = sdf.parse(startDate);
|
||||||
|
Date end = sdf.parse(endDate);
|
||||||
|
Calendar tempStart = Calendar.getInstance();
|
||||||
|
tempStart.setTime(start);
|
||||||
|
while (start.getTime() <= end.getTime()) {
|
||||||
|
list.add(sdf.format(tempStart.getTime()));
|
||||||
|
tempStart.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
start = tempStart.getTime();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isToDay(String date) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String toDay = sdf.format(new Date());
|
||||||
|
return date.equals(toDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List transition(String key, String path, String date, boolean isToDay) {//转换真实的日志文件
|
||||||
|
List list = new ArrayList();
|
||||||
|
if ("thread".equals(key)) {
|
||||||
|
list.add(path + File.separator + date);
|
||||||
|
} else if ("mem".equals(key)) {
|
||||||
|
list.add(path + File.separator + "memory_" + date + ".log");
|
||||||
|
} else if ("ecology".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "ecology");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "ecology_" + getDateStr(date) + ".log");
|
||||||
|
}
|
||||||
|
} else if ("sql".equals(key)) {
|
||||||
|
list.add(path + File.separator + "sqlcount_" + date + ".log");
|
||||||
|
list.add(path + File.separator + "sqltime_" + date + ".log");
|
||||||
|
} else if ("integration".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "integration.log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "integration.log_" + getDateStr(date) + ".log");
|
||||||
|
}
|
||||||
|
} else if ("security".equals(key)) {
|
||||||
|
list.add(path + File.separator + "systemRunInfo" + date + ".log");
|
||||||
|
list.add(path + File.separator + "systemSecurity" + date + ".log");
|
||||||
|
} else if ("Resin".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "stdout.log");
|
||||||
|
list.add(path + File.separator + "stderr.log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "stdout-" + getDateStr(date) + ".log.gz");
|
||||||
|
list.add(path + File.separator + "stderr-" + getDateStr(date) + ".log.gz");
|
||||||
|
}
|
||||||
|
list.add(path + File.separator + "watchdog-manager.log");
|
||||||
|
list.add(path + File.separator + "jvm-default.log");
|
||||||
|
} else if ("sqllog".equals(key)) {
|
||||||
|
list.add(path + File.separator + getSqlPathByDate(date));
|
||||||
|
list.add(path + File.separator);
|
||||||
|
} else if ("monitorevent".equals(key)) {
|
||||||
|
list.addAll(eventLog(path, date));
|
||||||
|
} else if ("monitorPool".equals(key)) {
|
||||||
|
list.add(path + File.separator + "pool_" + getDateStr(date) + "_ecology.log");
|
||||||
|
list.add(path + File.separator + "pool_" + getDateStr(date) + "_ecology.zip");
|
||||||
|
} else if ("monitorlog".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "stdout.log");
|
||||||
|
list.add(path + File.separator + "stderr-log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "stdout-" + getDateStr(date) + ".log.gz");
|
||||||
|
list.add(path + File.separator + "stderr-" + getDateStr(date) + ".log.gz");
|
||||||
|
}
|
||||||
|
} else if ("monitorconcurrent".equals(key)) {
|
||||||
|
list.add(path + File.separator + "concurrent_" + getDateStr(date) + ".log");
|
||||||
|
list.add(path + File.separator + "concurrent_" + getDateStr(date) + ".zip");
|
||||||
|
} else if ("monitorcpu".equals(key)) {
|
||||||
|
list.add(path + File.separator + "cpu_" + getDateStr(date) + ".log");
|
||||||
|
list.add(path + File.separator + "cpu_" + getDateStr(date) + ".zip");
|
||||||
|
} else if ("resinconf".equals(key)) {
|
||||||
|
list.add(path);
|
||||||
|
} else if ("ecoloyweaver".equals(key)) {
|
||||||
|
dealWidthWeaverProp(path + "weaver.properties", new File(path + "weaversecurity.properties"));
|
||||||
|
list.add(path + "weaversecurity.properties");
|
||||||
|
} else if ("cus".equals(key) || "util_cus".equals(key) || "sql_log".equals(key) || "http_util".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "cus.log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "cus.log_" + getDateStr(date) + ".log");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dealWidthWeaverProp(String path, File outFile) {//处理weaver.prop密码问题
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InputStreamReader reader = null;
|
||||||
|
java.io.Writer outWriter = null;
|
||||||
|
try {
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
Properties registerProp = new Properties();
|
||||||
|
reader = new InputStreamReader(new FileInputStream(file));
|
||||||
|
registerProp.load(reader);
|
||||||
|
reader.close();
|
||||||
|
outWriter = new FileWriter(outFile);
|
||||||
|
registerProp.put("ecology.password", "***********");
|
||||||
|
registerProp.store(outWriter, "");
|
||||||
|
outWriter.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
if (outWriter != null) {
|
||||||
|
outWriter.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List eventLog(String path, String date) {
|
||||||
|
List list = new ArrayList();
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
File[] filelists = new File(path).listFiles();
|
||||||
|
date = getDateStr(date);
|
||||||
|
for (int i = 0; i < filelists.length; i++) {
|
||||||
|
File filelist = filelists[i];
|
||||||
|
if (filelist.getName().indexOf(date) != -1) {
|
||||||
|
list.add(filelist.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSqlPathByDate(String date) {
|
||||||
|
return date.replace("-", File.separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileSize(File file) {
|
||||||
|
if (!file.exists()) {
|
||||||
|
return "0KB";
|
||||||
|
}
|
||||||
|
long length = file.length();
|
||||||
|
|
||||||
|
BigDecimal b1 = new BigDecimal(Double.toString(length));
|
||||||
|
BigDecimal b2 = new BigDecimal(Double.toString(1024));
|
||||||
|
BigDecimal b3 = b1.divide(b2, 2, RoundingMode.HALF_UP);
|
||||||
|
b3.floatValue();
|
||||||
|
if (b3.floatValue() > 1024) {
|
||||||
|
return b3.divide(b2, 2, RoundingMode.HALF_UP).floatValue() + "M";
|
||||||
|
} else {
|
||||||
|
return b3.floatValue() + "KB";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getInnerIp() {
|
||||||
|
try {
|
||||||
|
Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||||
|
while (netInterfaces.hasMoreElements()) {
|
||||||
|
NetworkInterface ni = (NetworkInterface) netInterfaces.nextElement();
|
||||||
|
Enumeration nii = ni.getInetAddresses();
|
||||||
|
while (nii.hasMoreElements()) {
|
||||||
|
InetAddress inetAddress = (InetAddress) nii.nextElement();
|
||||||
|
if (inetAddress.getHostAddress().indexOf(":") == -1) {
|
||||||
|
String ip = inetAddress.getHostAddress();
|
||||||
|
if (ip.startsWith("10.") || ip.startsWith("192.168.")) {// ||
|
||||||
|
return ip;
|
||||||
|
} else {
|
||||||
|
if (ip.startsWith("172.")) {
|
||||||
|
|
||||||
|
return ip;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDateStr(String date) {
|
||||||
|
date = date.replaceAll("-", "");
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按照原路径的类型就行压缩。文件路径直接把文件压缩
|
||||||
|
* @param src
|
||||||
|
* @param zos
|
||||||
|
* @param baseDir
|
||||||
|
*/
|
||||||
|
private void compressbyType(String src, ZipOutputStream zos, String baseDir) {
|
||||||
|
File srcFile = new File(src);
|
||||||
|
if (!srcFile.exists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//判断文件是否是文件,如果是文件调用compressFile方法,如果是路径,则调用compressDir方法;
|
||||||
|
if (srcFile.isFile()) {
|
||||||
|
//src是文件,调用此方法
|
||||||
|
compressFile(srcFile, zos, baseDir);
|
||||||
|
} else if (srcFile.isDirectory()) {
|
||||||
|
compressDir(srcFile, zos, baseDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压缩文件,取后面的80M内容
|
||||||
|
*/
|
||||||
|
private void compressFile(File file, ZipOutputStream zos, String baseDir) {
|
||||||
|
if (!file.exists())
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
RandomAccessFile fileRead = new RandomAccessFile(file, "r"); //用读模式
|
||||||
|
long fileLength = fileRead.length();//获得文件长度
|
||||||
|
if (file.getName().endsWith(".log") && fileLength > 1073741820) {//如果文件超过80M,则只取文件倒数80M内容
|
||||||
|
messageStr.append("、").append(file.getName());
|
||||||
|
fileRead.seek(fileLength - 1073741820);
|
||||||
|
} else {
|
||||||
|
fileRead.seek(0);
|
||||||
|
}
|
||||||
|
ZipEntry entry = new ZipEntry(baseDir + file.getName());
|
||||||
|
zos.putNextEntry(entry);
|
||||||
|
int hasRead;
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
while ((hasRead = fileRead.read(buf)) != -1) {
|
||||||
|
zos.write(buf, 0, hasRead);
|
||||||
|
}
|
||||||
|
fileRead.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压缩文件夹
|
||||||
|
*/
|
||||||
|
private void compressDir(File dir, ZipOutputStream zos, String baseDir) {
|
||||||
|
if (!dir.exists())
|
||||||
|
return;
|
||||||
|
File[] files = dir.listFiles();
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
File file = files[i];
|
||||||
|
compressFile(file, zos, baseDir + dir.getName() + File.separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%>
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,469 @@
|
||||||
|
<%@ page language="java" contentType="text/html; charset=utf-8" %>
|
||||||
|
<%@ page import="org.apache.commons.io.IOUtils" %>
|
||||||
|
<%@ page import="java.io.*" %>
|
||||||
|
<%@ page import="java.net.InetAddress" %>
|
||||||
|
<%@ page import="java.net.NetworkInterface" %>
|
||||||
|
<%@ page import="java.util.Enumeration" %>
|
||||||
|
<%@ page import="java.util.HashSet" %>
|
||||||
|
<%@ page import="java.util.Properties" %>
|
||||||
|
<%@ page import="java.util.Set" %>
|
||||||
|
<%
|
||||||
|
|
||||||
|
final String ecologyPath = request.getRealPath("/");
|
||||||
|
weaver.hrm.User user = (weaver.hrm.User) request.getSession(true).getAttribute("weaver_user@bean");
|
||||||
|
if (user == null || !"sysadmin".equals(user.getLoginid())) {
|
||||||
|
response.sendRedirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final String ResinPath = System.getProperty("user.dir") + File.separator;
|
||||||
|
boolean isResin = ResinPath.toLowerCase().indexOf("resin") != -1;
|
||||||
|
String ecologyWeaverPath = "";
|
||||||
|
if (ecologyPath.endsWith(File.separator)) {
|
||||||
|
ecologyWeaverPath = ecologyPath + "WEB-INF" + File.separator + "prop" + File.separator + "weaver.properties";
|
||||||
|
} else {
|
||||||
|
ecologyWeaverPath = ecologyPath + File.separator + "WEB-INF" + File.separator + "prop" + File.separator + "weaver.properties";
|
||||||
|
}
|
||||||
|
|
||||||
|
File ecolpogyProp = new File(ecologyWeaverPath);
|
||||||
|
File resinProp = new File(ResinPath + "bin" + File.separator + "startresin.sh");
|
||||||
|
|
||||||
|
Set ipList = readEcologyProp(ecolpogyProp);
|
||||||
|
String localIp = getInnerIp();
|
||||||
|
if (ipList.size() == 0) {
|
||||||
|
ipList.addAll(readResinProp(resinProp));
|
||||||
|
}
|
||||||
|
boolean isCluster = true;
|
||||||
|
if (ipList.size() == 0) {//没有集群的时候
|
||||||
|
//ipList.add(localIp);
|
||||||
|
isCluster = false;
|
||||||
|
} else {
|
||||||
|
boolean status = false;
|
||||||
|
java.util.Iterator it = ipList.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String ip = (String) it.next();
|
||||||
|
if (ip.indexOf(localIp) != -1 || "127.0.0.1".equals(ip) || "127.0.0.1".equals(localIp)) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!status) {
|
||||||
|
ipList.add(localIp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
/**
|
||||||
|
* 当前机器内网ip
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getInnerIp() {
|
||||||
|
try {
|
||||||
|
Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||||
|
while (netInterfaces.hasMoreElements()) {
|
||||||
|
NetworkInterface ni = (NetworkInterface) netInterfaces.nextElement();
|
||||||
|
Enumeration nii = ni.getInetAddresses();
|
||||||
|
while (nii.hasMoreElements()) {
|
||||||
|
InetAddress inetAddress = (InetAddress) nii.nextElement();
|
||||||
|
if (inetAddress.getHostAddress().indexOf(":") == -1) {
|
||||||
|
String ip = inetAddress.getHostAddress();
|
||||||
|
if (ip.startsWith("10.") || ip.startsWith("192.168.")) {// ||
|
||||||
|
return ip;
|
||||||
|
} else {
|
||||||
|
if (ip.startsWith("172.")) {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set readResinProp(File startResinFile) {
|
||||||
|
Set liststr = new HashSet();
|
||||||
|
if (!startResinFile.exists()) {
|
||||||
|
return liststr;
|
||||||
|
}
|
||||||
|
if (startResinFile.isFile() && startResinFile.length() > 0) {
|
||||||
|
FileInputStream fileInput = null;
|
||||||
|
BufferedReader bufferedReader = null;
|
||||||
|
try {
|
||||||
|
fileInput = new FileInputStream(startResinFile);
|
||||||
|
bufferedReader = new BufferedReader(new InputStreamReader(fileInput));
|
||||||
|
String str = null;
|
||||||
|
while ((str = bufferedReader.readLine()) != null) {
|
||||||
|
if (str.indexOf("-Dinitial_hosts") != -1 || str.indexOf("-J-Dinitial_hosts") != -1) {
|
||||||
|
if (str.indexOf("-J-Dinitial_hosts") != -1) {
|
||||||
|
str = str.substring(str.indexOf("-J-Dinitial_hosts") + 17);
|
||||||
|
}
|
||||||
|
if (str.indexOf("-Dinitial_hosts") != -1) {
|
||||||
|
str = str.substring(str.indexOf("-Dinitial_hosts") + 15);
|
||||||
|
}
|
||||||
|
str = str.indexOf("=") != -1 ? str.substring(str.indexOf("=") + 1) : str;
|
||||||
|
str = str.indexOf("-") != -1 ? str.substring(0, str.indexOf("-")) : str;
|
||||||
|
str = str.indexOf(" ") != -1 ? str.substring(0, str.indexOf(" ")) : str;
|
||||||
|
String[] ips = str.split(",");
|
||||||
|
for (int i = 0; i < ips.length; i++) {
|
||||||
|
String ip = ips[i];
|
||||||
|
try {
|
||||||
|
String tmpip = ip.replace(".", "").replace(":", "");
|
||||||
|
Long.parseLong(tmpip.trim());
|
||||||
|
liststr.add(ip.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(fileInput);
|
||||||
|
IOUtils.closeQuietly(bufferedReader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return liststr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Set readEcologyProp(File file) {
|
||||||
|
Set liststr = new HashSet();
|
||||||
|
try {
|
||||||
|
if (!file.exists()) {
|
||||||
|
return liststr;
|
||||||
|
}
|
||||||
|
Properties registerProp = new Properties();
|
||||||
|
InputStreamReader reader = new InputStreamReader(new FileInputStream(file));
|
||||||
|
registerProp.load(reader);
|
||||||
|
String initial_host = registerProp.getProperty("initial_hosts");
|
||||||
|
if (initial_host != null && !"".equals(initial_host)) {
|
||||||
|
String[] initial_hosts = initial_host.split(",");
|
||||||
|
for (int i = 0; i < initial_hosts.length; i++) {
|
||||||
|
String initial_hostStr = initial_hosts[i];
|
||||||
|
if (!initial_hostStr.isEmpty()) {
|
||||||
|
liststr.add(initial_hostStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IOUtils.closeQuietly(reader);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return liststr;
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="css/index.css">
|
||||||
|
|
||||||
|
<script type="text/javascript" src="js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="js/data.js"></script>
|
||||||
|
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
$("#downstartlogDate").val(new Date().format("yyyy-MM-dd"));
|
||||||
|
$("#downendlogDate").val(new Date().format("yyyy-MM-dd"));
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
function collectLog() {
|
||||||
|
var clusterips = "";
|
||||||
|
$("[name='clusterip']:checked").each(function () {
|
||||||
|
clusterips += $(this).val() + ",";
|
||||||
|
|
||||||
|
})
|
||||||
|
if (<%=isCluster%>&&
|
||||||
|
clusterips == ''
|
||||||
|
)
|
||||||
|
{
|
||||||
|
alert("请选择服务器节点!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clusterips = clusterips.substr(0, clusterips.length - 1);
|
||||||
|
|
||||||
|
var loytype = "";
|
||||||
|
$("[name='loytype']:checked").each(function () {
|
||||||
|
loytype += $(this).val() + ",";
|
||||||
|
})
|
||||||
|
if (loytype == '') {
|
||||||
|
alert("请选择日志类型!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loytype = loytype.substr(0, loytype.length - 1);
|
||||||
|
var startDate = $("#downstartlogDate").val();
|
||||||
|
var endDate = $("#downendlogDate").val();
|
||||||
|
if (startDate == '') {
|
||||||
|
alert("请选择开始日期!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (endDate == '') {
|
||||||
|
alert("请选择结束日期!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var oDate1 = new Date(startDate);
|
||||||
|
var oDate2 = new Date(endDate);
|
||||||
|
if (oDate1.getTime() > oDate2.getTime()) {
|
||||||
|
alert("结束日志不能少于开始日期!")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
waitInt = 0;
|
||||||
|
$("#start").attr("disabled", "disabled");
|
||||||
|
var clts = clusterips.split(",");
|
||||||
|
for (var i = 0; i < clts.length && clts.length > 0; i++) {
|
||||||
|
var ip = clts[i];
|
||||||
|
var clt = ip.replace(/\./g, "");
|
||||||
|
clt = clt.replace(/\:/g, "");
|
||||||
|
if (clt.indexOf("<%=localIp%>") != -1) {
|
||||||
|
waitInt += 1
|
||||||
|
getLog(clt, ip, loytype, startDate, endDate);
|
||||||
|
} else {
|
||||||
|
waitInt += 1
|
||||||
|
getOtherLog(clt, ip, loytype, startDate, endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (<%=!isCluster%>) {
|
||||||
|
waitInt += 1
|
||||||
|
getLog('log', '<%=localIp%>', loytype, startDate, endDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getold7Day() {
|
||||||
|
var now = new Date();
|
||||||
|
var date = new Date(now.getTime() - 7 * 24 * 3600 * 1000);
|
||||||
|
var year = date.getFullYear();
|
||||||
|
var month = date.getMonth() + 1;
|
||||||
|
var day = date.getDate();
|
||||||
|
return year + '-' + month + '-' + day;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLog(div, ip, loytype, startDate, endDate) {
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
contentType: " charset=utf-8",
|
||||||
|
url: '/cus_getlog/getlog.jsp?loytype=' + loytype + '&startDate=' + startDate + '&endDate=' + endDate,
|
||||||
|
beforeSend: function () {
|
||||||
|
$("#" + div + "div").html('<img alt="" style = "width: 20px;height: 20px;" src="img/loading.gif">')
|
||||||
|
$("#" + div + "messagediv").html('')
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
waitInt--;
|
||||||
|
if (waitInt == 0) {
|
||||||
|
$("#start").removeAttr("disabled");
|
||||||
|
}
|
||||||
|
var dataTmp = data.split(",");
|
||||||
|
if (dataTmp[0] != '0KB' && dataTmp[0].trim() != '') {
|
||||||
|
var iptmp = ip.indexOf(":") > 0 ? ip.substr(0, ip.indexOf(":")) : ip;
|
||||||
|
|
||||||
|
$("#" + div + "div").html('<a href="/getlog/downlog.jsp?logName=' + iptmp + 'downLog.zip">' + iptmp + 'downLog.zip(' + dataTmp[0] + ') 下载</a>')
|
||||||
|
if (dataTmp[1] != null && dataTmp[1] != undefined && dataTmp[1].trim() != '') {
|
||||||
|
var messtr = dataTmp[1];
|
||||||
|
$("#" + div + "messagediv").html(messtr.substr(1, messtr.length) + '日志内容大于1G,此次日志收集内容只取日志后面的1G内容,如需完整日志,请在服务器器上获取.请知晓!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$("#" + div + "div").html('收集失败,请手动收集!')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var waitInt = 0;
|
||||||
|
|
||||||
|
function getOtherLog(div, clusterIp, loytype, startDate, endDate) {
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
contentType: " charset=utf-8",
|
||||||
|
url: '/cus_getlog/sendUrl.jsp?clusterIp=' + clusterIp + '&loytype=' + loytype + '&startDate=' + startDate + '&endDate=' + endDate,
|
||||||
|
beforeSend: function () {
|
||||||
|
$("#" + div + "div").html('<img alt="" style = "width: 20px;height: 20px;" src="img/loading.gif">');
|
||||||
|
$("#" + div + "messagediv").html('')
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
var dataTmp = data.split(",");
|
||||||
|
waitInt--;
|
||||||
|
if (waitInt == 0) {
|
||||||
|
$("#start").removeAttr("disabled");
|
||||||
|
}
|
||||||
|
if (data.trim() == '1') {
|
||||||
|
$("#" + div + "div").html('收集失败,系统参数不全!')
|
||||||
|
} else if (data.trim() == '2') {
|
||||||
|
$("#" + div + "div").html(clusterIp + '请求被拦截,请将/getlog/getlog.jsp请求')
|
||||||
|
} else if (data.trim() == '3') {
|
||||||
|
$("#" + div + "div").html('收集失败,请手动收集!')
|
||||||
|
} else if (data.trim() == '4') {
|
||||||
|
$("#" + div + "div").html('收集失败,请手动收集!')
|
||||||
|
} else if (data.trim() != '0KB' && dataTmp[0].trim() != '') {
|
||||||
|
var iptmp = clusterIp.indexOf(":") > 0 ? clusterIp.substr(0, clusterIp.indexOf(":")) : clusterIp;
|
||||||
|
var otherIp = clusterIp.replace(":", "-");
|
||||||
|
//console.info('<a href="/getlog/downlog.jsp?logName='+iptmp+'downLog.zip&otherIp='+otherIp+'">'+iptmp+'downLog.zip('+data+') 下载</a>')
|
||||||
|
$("#" + div + "div").html('<a href="/getlog/downlog.jsp?logName=' + iptmp + 'downLog.zip&otherIp=' + otherIp + '">' + iptmp + 'downLog.zip(' + data + ') 下载</a>')
|
||||||
|
|
||||||
|
if (dataTmp[1] != null && dataTmp[1] != undefined && dataTmp[1].trim() != '') {
|
||||||
|
var messtr = dataTmp[1];
|
||||||
|
$("#" + div + "messagediv").html(messtr.substr(1, messtr.length) + '日志内容大于1G,此次日志收集内容只取日志后面的1G内容,如需完整日志,请在服务器器上获取.请知晓!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$("#" + div + "div").html('收集失败,请手动收集!')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body style="margin-top: 0px;">
|
||||||
|
<div class="box" style="margin-top: 0px;">
|
||||||
|
<div class="mytitle">
|
||||||
|
<div style="padding-top: 10px;padding-left: 16px">
|
||||||
|
ecology日志下载
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="" class="contend">
|
||||||
|
<%if (isCluster) { %>
|
||||||
|
<div class="cluster">
|
||||||
|
<div>服务器节点</div>
|
||||||
|
<div class="clusterPlan">
|
||||||
|
<%
|
||||||
|
java.util.Iterator it = ipList.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String ip = (String) it.next();
|
||||||
|
%>
|
||||||
|
<div class="clusterIp" style="width:180px">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="clusterip" value="<%=ip %>" checked>
|
||||||
|
<span></span>
|
||||||
|
<%=ip %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<%}%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%}%>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="cluster">
|
||||||
|
<div>日志类型</div>
|
||||||
|
<div class="clusterPlan">
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="monitor">
|
||||||
|
性能日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clusterIp" style="width: 140px">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="ecology" checked>
|
||||||
|
ecology日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="Resin">
|
||||||
|
Resin日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="security">
|
||||||
|
安全日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="integration">
|
||||||
|
集成日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="sql">
|
||||||
|
sql日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="cus" checked>
|
||||||
|
cus日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="http_util" checked>
|
||||||
|
http_util日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="sql_log" checked>
|
||||||
|
sql_log日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="clusterIp">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="checkbox" name="loytype" value="util_cus" checked>
|
||||||
|
util_cus日志
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="cluster">
|
||||||
|
<div>时间范围</div>
|
||||||
|
<div class="clusterPlan">
|
||||||
|
<div style="text-algin:center;font-family: PingFangSC-Regular;font-size: 12px;color: #999999;letter-spacing: -0.07px;">
|
||||||
|
<span style="padding-right:10px;color:#6d6d6d;">开始时间</span>
|
||||||
|
<input id="downstartlogDate" class="Wdate" type="text"
|
||||||
|
onclick="WdatePicker({minDate:'#F{getold7Day()}',maxDate:'%y-%M-%d'})" size="16" readonly/>
|
||||||
|
-
|
||||||
|
<span style="padding-right:10px;color:#6d6d6d;">结束时间</span>
|
||||||
|
<input id="downendlogDate" class="Wdate" type="text"
|
||||||
|
onclick="WdatePicker({minDate:'#F{getold7Day()}',maxDate:'%y-%M-%d'})" size="16" readonly/>
|
||||||
|
<span style="width: 10px;display:inline-block"></span>
|
||||||
|
<button class="Button" id="start" onclick="collectLog()">收集日志</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cluster" style="height: 300px;max-height: 300px;overflow-y:auto ">
|
||||||
|
<div>下载列表</div>
|
||||||
|
<div class="clusterPlan">
|
||||||
|
<%
|
||||||
|
java.util.Iterator it = ipList.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String ip = (String) it.next();
|
||||||
|
ip = ip.replaceAll("\\.", "");
|
||||||
|
ip = ip.replaceAll(":", "");
|
||||||
|
%>
|
||||||
|
<div id="<%=ip%>div">
|
||||||
|
</div>
|
||||||
|
<div id="<%=ip%>messagediv" class="messages"></div>
|
||||||
|
<%}%>
|
||||||
|
|
||||||
|
<%if (!isCluster) { %>
|
||||||
|
<div id="logdiv"></div>
|
||||||
|
<div id="logmessagediv" class="messages"></div>
|
||||||
|
<%} %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,14 @@
|
||||||
|
var $lang={
|
||||||
|
errAlertMsg: "Invalid date or the date out of range,redo or not?",
|
||||||
|
aWeekStr: ["wk", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
||||||
|
aLongWeekStr:["wk","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
|
||||||
|
aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||||
|
aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"],
|
||||||
|
clearStr: "Clear",
|
||||||
|
todayStr: "Today",
|
||||||
|
okStr: "OK",
|
||||||
|
updateStr: "OK",
|
||||||
|
timeStr: "Time",
|
||||||
|
quickStr: "Quick Selection",
|
||||||
|
err_1: 'MinDate Cannot be bigger than MaxDate!'
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
var $lang={
|
||||||
|
errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u8303\u56F4,\u9700\u8981\u64A4\u9500\u5417?",
|
||||||
|
aWeekStr: ["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],
|
||||||
|
aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],
|
||||||
|
aMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"],
|
||||||
|
aLongMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],
|
||||||
|
clearStr: "\u6E05\u7A7A",
|
||||||
|
todayStr: "\u4ECA\u5929",
|
||||||
|
okStr: "\u786E\u5B9A",
|
||||||
|
updateStr: "\u786E\u5B9A",
|
||||||
|
timeStr: "\u65F6\u95F4",
|
||||||
|
quickStr: "\u5FEB\u901F\u9009\u62E9",
|
||||||
|
err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6700\u5927\u65E5\u671F!'
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
var $lang={
|
||||||
|
errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u7BC4\u570D,\u9700\u8981\u64A4\u92B7\u55CE?",
|
||||||
|
aWeekStr: ["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],
|
||||||
|
aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],
|
||||||
|
aMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"],
|
||||||
|
aLongMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],
|
||||||
|
clearStr: "\u6E05\u7A7A",
|
||||||
|
todayStr: "\u4ECA\u5929",
|
||||||
|
okStr: "\u78BA\u5B9A",
|
||||||
|
updateStr: "\u78BA\u5B9A",
|
||||||
|
timeStr: "\u6642\u9593",
|
||||||
|
quickStr: "\u5FEB\u901F\u9078\u64C7",
|
||||||
|
err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u65BC\u6700\u5927\u65E5\u671F!'
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
.Wdate{
|
||||||
|
border:#999 1px solid;
|
||||||
|
height:20px;
|
||||||
|
background:#fff url(datePicker.gif) no-repeat right;
|
||||||
|
}
|
||||||
|
.Wdate::-ms-clear{display:none;}
|
||||||
|
|
||||||
|
.WdateFmtErr{
|
||||||
|
font-weight:bold;
|
||||||
|
color:red;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1,246 @@
|
||||||
|
/*
|
||||||
|
* My97 DatePicker 4.8
|
||||||
|
*/
|
||||||
|
|
||||||
|
.WdateDiv{
|
||||||
|
width:180px;
|
||||||
|
background-color:#FFFFFF;
|
||||||
|
border:#bbb 1px solid;
|
||||||
|
padding:2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv2{
|
||||||
|
width:360px;
|
||||||
|
}
|
||||||
|
.WdateDiv *{font-size:9pt;}
|
||||||
|
|
||||||
|
.WdateDiv .NavImg a{
|
||||||
|
display:block;
|
||||||
|
cursor:pointer;
|
||||||
|
height:16px;
|
||||||
|
width:16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .NavImgll a{
|
||||||
|
float:left;
|
||||||
|
background:transparent url(img.gif) no-repeat scroll 0 0;
|
||||||
|
}
|
||||||
|
.WdateDiv .NavImgl a{
|
||||||
|
float:left;
|
||||||
|
background:transparent url(img.gif) no-repeat scroll -16px 0;
|
||||||
|
}
|
||||||
|
.WdateDiv .NavImgr a{
|
||||||
|
float:right;
|
||||||
|
background:transparent url(img.gif) no-repeat scroll -32px 0;
|
||||||
|
}
|
||||||
|
.WdateDiv .NavImgrr a{
|
||||||
|
float:right;
|
||||||
|
background:transparent url(img.gif) no-repeat scroll -48px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTitle{
|
||||||
|
height:24px;
|
||||||
|
margin-bottom:2px;
|
||||||
|
padding:1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .yminput{
|
||||||
|
margin-top:2px;
|
||||||
|
text-align:center;
|
||||||
|
height:20px;
|
||||||
|
border:0px;
|
||||||
|
width:50px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .yminputfocus{
|
||||||
|
margin-top:2px;
|
||||||
|
text-align:center;
|
||||||
|
font-weight:bold;
|
||||||
|
height:20px;
|
||||||
|
color:blue;
|
||||||
|
border:#ccc 1px solid;
|
||||||
|
width:50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .menuSel{
|
||||||
|
z-index:1;
|
||||||
|
position:absolute;
|
||||||
|
background-color:#FFFFFF;
|
||||||
|
border:#ccc 1px solid;
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .menu{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .menuOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#BEEBEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .invalidMenu{
|
||||||
|
color:#aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .YMenu{
|
||||||
|
margin-top:20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .MMenu{
|
||||||
|
margin-top:20px;
|
||||||
|
*width:62px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .hhMenu{
|
||||||
|
margin-top:-90px;
|
||||||
|
margin-left:26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .mmMenu{
|
||||||
|
margin-top:-46px;
|
||||||
|
margin-left:26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .ssMenu{
|
||||||
|
margin-top:-24px;
|
||||||
|
margin-left:26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .Wweek {
|
||||||
|
text-align:center;
|
||||||
|
background:#DAF3F5;
|
||||||
|
border-right:#BDEBEE 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .MTitle{
|
||||||
|
background-color:#BDEBEE;
|
||||||
|
}
|
||||||
|
.WdateDiv .WdayTable2{
|
||||||
|
border-collapse:collapse;
|
||||||
|
border:#c5d9e8 1px solid;
|
||||||
|
}
|
||||||
|
.WdateDiv .WdayTable2 table{
|
||||||
|
border:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WdayTable{
|
||||||
|
line-height:20px;
|
||||||
|
border:#c5d9e8 1px solid;
|
||||||
|
}
|
||||||
|
.WdateDiv .WdayTable td{
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .Wday{
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WdayOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#C0EBEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .Wwday{
|
||||||
|
cursor:pointer;
|
||||||
|
color:#FF2F2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WwdayOn{
|
||||||
|
cursor:pointer;
|
||||||
|
color:#000;
|
||||||
|
background-color:#C0EBEF;
|
||||||
|
}
|
||||||
|
.WdateDiv .Wtoday{
|
||||||
|
cursor:pointer;
|
||||||
|
color:blue;
|
||||||
|
}
|
||||||
|
.WdateDiv .Wselday{
|
||||||
|
background-color:#A9E4E9;
|
||||||
|
}
|
||||||
|
.WdateDiv .WspecialDay{
|
||||||
|
background-color:#66F4DF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WotherDay{
|
||||||
|
cursor:pointer;
|
||||||
|
color:#6A6AFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WotherDayOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#C0EBEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WinvalidDay{
|
||||||
|
color:#aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime{
|
||||||
|
float:left;
|
||||||
|
margin-top:3px;
|
||||||
|
margin-right:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime #dpTimeStr{
|
||||||
|
margin-left:1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime input{
|
||||||
|
width:18px;
|
||||||
|
height:20px;
|
||||||
|
text-align:center;
|
||||||
|
border:#ccc 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime .tB{
|
||||||
|
border-right:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime .tE{
|
||||||
|
border-left:0;
|
||||||
|
border-right:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime .tm{
|
||||||
|
width:7px;
|
||||||
|
border-left:0;
|
||||||
|
border-right:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime #dpTimeUp{
|
||||||
|
height:10px;
|
||||||
|
width:13px;
|
||||||
|
border:0px;
|
||||||
|
background:url(img.gif) no-repeat -32px -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime #dpTimeDown{
|
||||||
|
height:10px;
|
||||||
|
width:13px;
|
||||||
|
border:0px;
|
||||||
|
background:url(img.gif) no-repeat -48px -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpQS {
|
||||||
|
float:left;
|
||||||
|
margin-right:3px;
|
||||||
|
margin-top:3px;
|
||||||
|
background:url(img.gif) no-repeat 0px -16px;
|
||||||
|
width:20px;
|
||||||
|
height:20px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.WdateDiv #dpControl {
|
||||||
|
text-align:right;
|
||||||
|
}
|
||||||
|
.WdateDiv .dpButton{
|
||||||
|
height:20px;
|
||||||
|
width:45px;
|
||||||
|
border:#ccc 1px solid;
|
||||||
|
margin-top:2px;
|
||||||
|
margin-right:1px;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 307 B |
|
@ -0,0 +1,256 @@
|
||||||
|
/*
|
||||||
|
* My97 DatePicker 4.8 Skin:whyGreen
|
||||||
|
*/
|
||||||
|
.WdateDiv{
|
||||||
|
width:180px;
|
||||||
|
background-color:#fff;
|
||||||
|
border:#C5E1E4 1px solid;
|
||||||
|
padding:2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv2{
|
||||||
|
width:360px;
|
||||||
|
}
|
||||||
|
.WdateDiv *{font-size:9pt;}
|
||||||
|
|
||||||
|
.WdateDiv .NavImg a{
|
||||||
|
cursor:pointer;
|
||||||
|
display:block;
|
||||||
|
width:16px;
|
||||||
|
height:16px;
|
||||||
|
margin-top:1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .NavImgll a{
|
||||||
|
float:left;
|
||||||
|
background:url(img.gif) no-repeat;
|
||||||
|
}
|
||||||
|
.WdateDiv .NavImgl a{
|
||||||
|
float:left;
|
||||||
|
background:url(img.gif) no-repeat -16px 0px;
|
||||||
|
}
|
||||||
|
.WdateDiv .NavImgr a{
|
||||||
|
float:right;
|
||||||
|
background:url(img.gif) no-repeat -32px 0px;
|
||||||
|
}
|
||||||
|
.WdateDiv .NavImgrr a{
|
||||||
|
float:right;
|
||||||
|
background:url(img.gif) no-repeat -48px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTitle{
|
||||||
|
height:24px;
|
||||||
|
padding:1px;
|
||||||
|
border:#c5d9e8 1px solid;
|
||||||
|
background:url(bg.jpg);
|
||||||
|
margin-bottom:2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .yminput{
|
||||||
|
margin-top:2px;
|
||||||
|
text-align:center;
|
||||||
|
border:0px;
|
||||||
|
height:20px;
|
||||||
|
width:50px;
|
||||||
|
color:#034c50;
|
||||||
|
background-color:transparent;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .yminputfocus{
|
||||||
|
margin-top:2px;
|
||||||
|
text-align:center;
|
||||||
|
border:#939393 1px solid;
|
||||||
|
font-weight:bold;
|
||||||
|
color:#034c50;
|
||||||
|
height:20px;
|
||||||
|
width:50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .menuSel{
|
||||||
|
z-index:1;
|
||||||
|
position:absolute;
|
||||||
|
background-color:#FFFFFF;
|
||||||
|
border:#A3C6C8 1px solid;
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .menu{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#fff;
|
||||||
|
color:#11777C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .menuOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#BEEBEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .invalidMenu{
|
||||||
|
color:#aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .YMenu{
|
||||||
|
margin-top:20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .MMenu{
|
||||||
|
margin-top:20px;
|
||||||
|
*width:62px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .hhMenu{
|
||||||
|
margin-top:-90px;
|
||||||
|
margin-left:26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .mmMenu{
|
||||||
|
margin-top:-46px;
|
||||||
|
margin-left:26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .ssMenu{
|
||||||
|
margin-top:-24px;
|
||||||
|
margin-left:26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .Wweek {
|
||||||
|
text-align:center;
|
||||||
|
background:#DAF3F5;
|
||||||
|
border-right:#BDEBEE 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .MTitle{
|
||||||
|
color:#13777e;
|
||||||
|
background-color:#bdebee;
|
||||||
|
}
|
||||||
|
.WdateDiv .WdayTable2{
|
||||||
|
border-collapse:collapse;
|
||||||
|
border:#BEE9F0 1px solid;
|
||||||
|
}
|
||||||
|
.WdateDiv .WdayTable2 table{
|
||||||
|
border:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WdayTable{
|
||||||
|
line-height:20px;
|
||||||
|
color:#13777e;
|
||||||
|
background-color:#edfbfb;
|
||||||
|
border:#BEE9F0 1px solid;
|
||||||
|
}
|
||||||
|
.WdateDiv .WdayTable td{
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .Wday{
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WdayOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#74d2d9 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .Wwday{
|
||||||
|
cursor:pointer;
|
||||||
|
color:#ab1e1e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WwdayOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#74d2d9;
|
||||||
|
}
|
||||||
|
.WdateDiv .Wtoday{
|
||||||
|
cursor:pointer;
|
||||||
|
color:blue;
|
||||||
|
}
|
||||||
|
.WdateDiv .Wselday{
|
||||||
|
background-color:#A7E2E7;
|
||||||
|
}
|
||||||
|
.WdateDiv .WspecialDay{
|
||||||
|
background-color:#66F4DF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WotherDay{
|
||||||
|
cursor:pointer;
|
||||||
|
color:#0099CC;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WotherDayOn{
|
||||||
|
cursor:pointer;
|
||||||
|
background-color:#C0EBEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv .WinvalidDay{
|
||||||
|
color:#aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime{
|
||||||
|
float:left;
|
||||||
|
margin-top:3px;
|
||||||
|
margin-right:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime #dpTimeStr{
|
||||||
|
margin-left:1px;
|
||||||
|
color:#497F7F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime input{
|
||||||
|
height:20px;
|
||||||
|
width:18px;
|
||||||
|
text-align:center;
|
||||||
|
color:#333;
|
||||||
|
border:#61CAD0 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime .tB{
|
||||||
|
border-right:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime .tE{
|
||||||
|
border-left:0;
|
||||||
|
border-right:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime .tm{
|
||||||
|
width:7px;
|
||||||
|
border-left:0;
|
||||||
|
border-right:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime #dpTimeUp{
|
||||||
|
height:10px;
|
||||||
|
width:13px;
|
||||||
|
border:0px;
|
||||||
|
background:url(img.gif) no-repeat -32px -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpTime #dpTimeDown{
|
||||||
|
height:10px;
|
||||||
|
width:13px;
|
||||||
|
border:0px;
|
||||||
|
background:url(img.gif) no-repeat -48px -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WdateDiv #dpQS {
|
||||||
|
float:left;
|
||||||
|
margin-right:3px;
|
||||||
|
margin-top:3px;
|
||||||
|
background:url(img.gif) no-repeat 0px -16px;
|
||||||
|
width:20px;
|
||||||
|
height:20px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
.WdateDiv #dpControl {
|
||||||
|
text-align:right;
|
||||||
|
margin-top:3px;
|
||||||
|
}
|
||||||
|
.WdateDiv .dpButton{
|
||||||
|
height:20px;
|
||||||
|
width:45px;
|
||||||
|
margin-top:2px;
|
||||||
|
border:#38B1B9 1px solid;
|
||||||
|
background-color:#CFEBEE;
|
||||||
|
color:#08575B;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,19 @@
|
||||||
|
Date.prototype.format = function(format) //author: meizz
|
||||||
|
{
|
||||||
|
var o = {
|
||||||
|
"M+" : this.getMonth()+1, //month
|
||||||
|
"d+" : this.getDate(), //day
|
||||||
|
"h+" : this.getHours(), //hour
|
||||||
|
"m+" : this.getMinutes(), //minute
|
||||||
|
"s+" : this.getSeconds(), //second
|
||||||
|
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
|
||||||
|
"S" : this.getMilliseconds() //millisecond
|
||||||
|
}
|
||||||
|
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
|
||||||
|
(this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
||||||
|
for(var k in o)if(new RegExp("("+ k +")").test(format))
|
||||||
|
format = format.replace(RegExp.$1,
|
||||||
|
RegExp.$1.length==1 ? o[k] :
|
||||||
|
("00"+ o[k]).substr((""+ o[k]).length));
|
||||||
|
return format;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,38 @@
|
||||||
|
<%@ page language="java"%><%@ page import="java.util.Properties" %><%@ page import="java.text.*" %><%@ page import="java.util.*" %><%@ page import="java.util.zip.*" %><%@ page import="org.apache.commons.httpclient.HttpClient" %><%@ page import="org.apache.commons.httpclient.methods.GetMethod" %><%
|
||||||
|
|
||||||
|
String clusterIp = request.getParameter("clusterIp");
|
||||||
|
String loytype = request.getParameter("loytype");
|
||||||
|
String startDate = request.getParameter("startDate");
|
||||||
|
String endDate = request.getParameter("endDate");
|
||||||
|
String result = ""; //0,成功,1、参数不对,2、被拦截,3、ecology不能访问
|
||||||
|
|
||||||
|
weaver.hrm.User user = (weaver.hrm.User)request.getSession(true).getAttribute("weaver_user@bean");
|
||||||
|
if(user==null || !"sysadmin".equals(user.getLoginid())){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(clusterIp ==null || clusterIp.equals("") || loytype ==null || loytype.equals("") || startDate ==null || startDate.equals("")){
|
||||||
|
result = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpClient client = new HttpClient();
|
||||||
|
client.getHttpConnectionManager().getParams().setSoTimeout(60000*10);
|
||||||
|
client.getHttpConnectionManager().getParams().setConnectionTimeout(6000*10);
|
||||||
|
try {
|
||||||
|
String url = "http://"+clusterIp+"/cus_getlog/getlog.jsp?loytype="+loytype+"&startDate="+startDate+"&endDate="+endDate;
|
||||||
|
GetMethod gets = new GetMethod(url);
|
||||||
|
client.executeMethod(gets);
|
||||||
|
int code = gets.getStatusCode();
|
||||||
|
if(code==200){
|
||||||
|
result = new String(gets.getResponseBody(),"UTF-8");
|
||||||
|
}else if(code == 302){
|
||||||
|
result="2";
|
||||||
|
}else{
|
||||||
|
result="3";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result = "4";
|
||||||
|
}
|
||||||
|
out.println(result);
|
||||||
|
%>
|
|
@ -33,6 +33,7 @@ public class JobTitleMultilingualUtil {
|
||||||
private static void extracted() {
|
private static void extracted() {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> jituMultilingual = Util.readProperties2Map("JituMultilingual", "cus.multilingual");
|
Map<String, Object> jituMultilingual = Util.readProperties2Map("JituMultilingual", "cus.multilingual");
|
||||||
|
Util.getLogger().info("配置文件:" + JSON.toJSONString(jituMultilingual));
|
||||||
if (!isEmpty(jituMultilingual)) {
|
if (!isEmpty(jituMultilingual)) {
|
||||||
for (Map.Entry<String, Object> entry : jituMultilingual.entrySet()) {
|
for (Map.Entry<String, Object> entry : jituMultilingual.entrySet()) {
|
||||||
LANGUAGE_MAP.put(entry.getKey(), Util.null2String(entry.getValue()));
|
LANGUAGE_MAP.put(entry.getKey(), Util.null2String(entry.getValue()));
|
||||||
|
@ -159,30 +160,29 @@ public class JobTitleMultilingualUtil {
|
||||||
// 对比缓存数据,如果是上一次传递进来的总数组,则不用再次分组
|
// 对比缓存数据,如果是上一次传递进来的总数组,则不用再次分组
|
||||||
if (!jsonArray.equals(this.jsonArray)) {
|
if (!jsonArray.equals(this.jsonArray)) {
|
||||||
this.jsonArray = jsonArray;
|
this.jsonArray = jsonArray;
|
||||||
|
extracted();
|
||||||
this.groupMap = list.stream().collect(Collectors.groupingBy(getKey));
|
this.groupMap = list.stream().collect(Collectors.groupingBy(getKey));
|
||||||
log.info("job title group : " + JSON.toJSONString(this.groupMap));
|
|
||||||
}
|
}
|
||||||
String active = LANGUAGE_MAP.get("active");
|
String active = LANGUAGE_MAP.get("active");
|
||||||
if (isBlank(active)) {
|
if (isBlank(active)) {
|
||||||
return getName.apply(JSONObject.toJavaObject(currentObj, Map.class));
|
return getName.apply(JSONObject.toJavaObject(currentObj, Map.class));
|
||||||
}
|
}
|
||||||
// 默认添加中文
|
// 默认添加中文
|
||||||
active += ",ZHS";
|
|
||||||
String[] activeLanguageArray = active.split(",");
|
String[] activeLanguageArray = active.split(",");
|
||||||
List<String> activeList = Arrays.stream(activeLanguageArray).distinct().collect(Collectors.toList());
|
Set<String> set = new HashSet<>();
|
||||||
log.info("active language: " + JSON.toJSONString(activeList));
|
Collections.addAll(set, activeLanguageArray);
|
||||||
log.info("language map: " + JSON.toJSONString(LANGUAGE_MAP));
|
set.add("ZHS");
|
||||||
groupMap = this.groupMap;
|
groupMap = this.groupMap;
|
||||||
if (!isEmpty(groupMap)) {
|
if (!isEmpty(groupMap)) {
|
||||||
List<Map> maps = groupMap.get(getKey.apply(JSONObject.toJavaObject(currentObj, Map.class)));
|
List<Map> maps = groupMap.get(getKey.apply(JSONObject.toJavaObject(currentObj, Map.class)));
|
||||||
log.info("current job Maps: " + JSON.toJSONString(maps));
|
|
||||||
if (!isEmpty(maps)) {
|
if (!isEmpty(maps)) {
|
||||||
sb.append("~`");
|
sb.append("~`");
|
||||||
for (Map map : maps) {
|
for (Map map : maps) {
|
||||||
String name = getName.apply(map);
|
String name = getName.apply(map);
|
||||||
String languageCd = getLanguageCd.apply(map);
|
String languageCd = getLanguageCd.apply(map);
|
||||||
// 当语言转换映射map中存在并且已经开启语言同步时,将对语言进行序列化
|
// 当语言转换映射map中存在并且已经开启语言同步时,将对语言进行序列化
|
||||||
if (LANGUAGE_MAP.containsKey(languageCd) && activeList.contains(languageCd)) {
|
if (LANGUAGE_MAP.containsKey(languageCd) && set.contains(languageCd)) {
|
||||||
String languageId = LANGUAGE_MAP.get(languageCd);
|
String languageId = LANGUAGE_MAP.get(languageCd);
|
||||||
sb.append("~`").append(languageId).append(" ").append(name).append("`");
|
sb.append("~`").append(languageId).append(" ").append(name).append("`");
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.h2.util.StringUtils;
|
||||||
import weaver.aiyh_pcn.common_fadada.entity.CreateFileEntity;
|
import weaver.aiyh_pcn.common_fadada.entity.CreateFileEntity;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
@ -36,6 +35,10 @@ public class FaRequestUtils {
|
||||||
private final static Logger log = Util.getLogger();
|
private final static Logger log = Util.getLogger();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
try {
|
try {
|
||||||
String appId = TOOL_UTIL.getSystemParamValue("FDD_appId");
|
String appId = TOOL_UTIL.getSystemParamValue("FDD_appId");
|
||||||
if (StringUtils.isNullOrEmpty(appId)) {
|
if (StringUtils.isNullOrEmpty(appId)) {
|
||||||
|
@ -256,6 +259,7 @@ public class FaRequestUtils {
|
||||||
* @return 构建结果
|
* @return 构建结果
|
||||||
*/
|
*/
|
||||||
private static String builderSign(Object data) {
|
private static String builderSign(Object data) {
|
||||||
|
init();
|
||||||
HEADER.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss"));
|
HEADER.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss"));
|
||||||
HEADER.put("bizContent", builderBizContent(data));
|
HEADER.put("bizContent", builderBizContent(data));
|
||||||
String signStr = "appId=" + HEADER.get("appId") +
|
String signStr = "appId=" + HEADER.get("appId") +
|
||||||
|
@ -319,12 +323,12 @@ public class FaRequestUtils {
|
||||||
log.info("排序后json编码:" + bizContent);
|
log.info("排序后json编码:" + bizContent);
|
||||||
// 将 JSON 字符串内特殊字符进行编码
|
// 将 JSON 字符串内特殊字符进行编码
|
||||||
bizContent = cn.hutool.core.util.URLUtil.encodeAll(bizContent,
|
bizContent = cn.hutool.core.util.URLUtil.encodeAll(bizContent,
|
||||||
Charset.forName("UTF-8"));
|
StandardCharsets.UTF_8);
|
||||||
log.info("bizContent进行JSON编码后URLEncoder编码:" + bizContent);
|
log.info("bizContent进行JSON编码后URLEncoder编码:" + bizContent);
|
||||||
// 将编码后的 JSON 字符串进行 base64 加密
|
// 将编码后的 JSON 字符串进行 base64 加密
|
||||||
bizContent =
|
bizContent =
|
||||||
cn.hutool.core.codec.Base64.encode(cn.hutool.core.util.StrUtil.bytes(bizContent,
|
cn.hutool.core.codec.Base64.encode(cn.hutool.core.util.StrUtil.bytes(bizContent,
|
||||||
Charset.forName("UTF-8")));
|
StandardCharsets.UTF_8));
|
||||||
log.info("bizContent进行JSON编码后URLEncoder编码后进行base64编码:" + bizContent);
|
log.info("bizContent进行JSON编码后URLEncoder编码后进行base64编码:" + bizContent);
|
||||||
return bizContent;
|
return bizContent;
|
||||||
|
|
||||||
|
|
|
@ -326,13 +326,6 @@ public class PdfMultipleWaterAction implements Action {
|
||||||
keyword, allMark, pdfWaterConfig.getOpacity(),
|
keyword, allMark, pdfWaterConfig.getOpacity(),
|
||||||
pdfWaterConfig.getPicWidth(), pdfWaterConfig.getPciHeight(),
|
pdfWaterConfig.getPicWidth(), pdfWaterConfig.getPciHeight(),
|
||||||
pdfWaterConfig.getOffsetX(), pdfWaterConfig.getOffsetY());
|
pdfWaterConfig.getOffsetX(), pdfWaterConfig.getOffsetY());
|
||||||
} catch (CustomerException e) {
|
|
||||||
if (e.getCode() != null) {
|
|
||||||
if (e.getCode() == -2) {
|
|
||||||
throw new CustomerException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Util.getLogger().error("水印文件生成失败!" + e.getMessage());
|
Util.getLogger().error("水印文件生成失败!" + e.getMessage());
|
||||||
throw new CustomerException("水印文件生成失败!" + e.getMessage(), e);
|
throw new CustomerException("水印文件生成失败!" + e.getMessage(), e);
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package youhong.ai.geerde;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.youhong.ai.geerde.action.submitfirst.AutoSubmitFirstAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/25 11:21</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class GeerdeTest extends BaseTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAvtion() {
|
||||||
|
Util.actionTest(AutoSubmitFirstAction.class, 522529);
|
||||||
|
Util.actionTest(AutoSubmitFirstAction.class, 522529);
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
Util.submitWorkflow(522524, 1, "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package youhong.ai.pcn;
|
||||||
|
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.api.youhong.ai.pcn.ssoyunzhao.service.SsoYunZhaoService;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>test</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 15:22</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class Test01 extends BaseTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testst() throws Exception {
|
||||||
|
SsoYunZhaoService service = new SsoYunZhaoService();
|
||||||
|
String redirectPath = service.getRedirectPath(new User(23));
|
||||||
|
System.out.println(redirectPath);
|
||||||
|
System.out.println(service.rsaDecryptUserInfo("EpPlcAYvNOFfJWHBuvLkWzkTOoEk3NoO95FoRlEJTGlblyBEYV0CQWnCDd4yXDCgcR1yhaig/5NrIZ5dGTTgwZ6f0fOfVDdnFPr5/GUUzxxsW8qpdHLIswFT1O4E57ny1Df6uxPaE5Hqp3QHvGkfUo4ak2mI0D11V7XzxGmVsSqoofdrCVXJIRrTkUHJ3OSxtQtkuxHcc0ivSAtJkWtdgnxRbmCvMMuPKELAq/cxqPfRSAf/sL/SI374DqlYnZDn/BCVA9Ab9TC/9g08QHSlGP+XV/CySecV5Z8bILCTV8bzcgMUznQSTuyIastzMHWLtcJ2zr4gE8jR393vRtAI9A=="));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package youhong.ai.utiltest;
|
||||||
|
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.general.GCONST;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class FileCleanup extends BaseTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void mainTest() {
|
||||||
|
String folderPath = GCONST.getLogPath() + "cus" + File.separator; // 文件夹路径
|
||||||
|
int n = 1; // 要删除的月份数
|
||||||
|
System.out.println(folderPath);
|
||||||
|
cleanupFiles(folderPath, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cleanupFiles(String folderPath, int n) {
|
||||||
|
File folder = new File(folderPath);
|
||||||
|
if (!folder.exists() || !folder.isDirectory()) {
|
||||||
|
System.out.println("指定的路径不是文件夹或不存在!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File[] files = folder.listFiles();
|
||||||
|
if (files == null || files.length == 0) {
|
||||||
|
System.out.println("文件夹为空!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.MONTH, -n);
|
||||||
|
Date thresholdDate = calendar.getTime();
|
||||||
|
|
||||||
|
for (File file : files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
cleanupFiles(file.getAbsolutePath(), n); // 递归扫描子文件夹
|
||||||
|
} else {
|
||||||
|
String fileName = file.getName();
|
||||||
|
if (fileName.matches(".*_\\d{8}\\.log")) {
|
||||||
|
String dateString = fileName.substring(fileName.length() - 12, fileName.length() - 4);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
try {
|
||||||
|
Date fileDate = dateFormat.parse(dateString);
|
||||||
|
if (fileDate.before(thresholdDate)) {
|
||||||
|
System.out.println(file.getName());
|
||||||
|
boolean deleted = file.delete();
|
||||||
|
if (deleted) {
|
||||||
|
System.out.println("已删除文件: " + file.getAbsolutePath());
|
||||||
|
} else {
|
||||||
|
System.out.println("无法删除文件: " + file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("无法解析文件名中的日期: " + fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,9 +12,7 @@ import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.youhong.ai.pcn.actioin.doctoavatar.DocToAvatarAction;
|
||||||
import weaver.soa.workflow.request.RequestService;
|
|
||||||
import weaver.youhong.ai.haripijiu.action.sapdocking.VoucherPayableNewAction;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
@ -97,7 +95,7 @@ public class GenericTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGre() {
|
public void testGre() {
|
||||||
GenerateFileUtil.createActionDocument(VoucherPayableNewAction.class);
|
GenerateFileUtil.createActionDocument(DocToAvatarAction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,8 +245,11 @@ public class GenericTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tesetAction() {
|
public void tesetAction() {
|
||||||
RequestService requestService = new RequestService();
|
// RequestService requestService = new RequestService();
|
||||||
RequestInfo request = requestService.getRequest(433436);
|
// RequestInfo request = requestService.getRequest(433436);
|
||||||
System.out.println(JSON.toJSONString(request));
|
// System.out.println(JSON.toJSONString(request));
|
||||||
|
Map<String, Object> config = Util.readProperties2Map("esteeLauderExcelExport", "export");
|
||||||
|
System.out.println(JSON.toJSONString(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
package youhong.ai.utiltest;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
public class OFDKeywordSearchTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String filePath = "/Users/aoey.oct.22/Downloads/测试.ofd";
|
||||||
|
String keyword = "签章位置";
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<KeywordLocation> keywordLocations = findKeywordLocations(filePath, keyword);
|
||||||
|
if (keywordLocations.isEmpty()) {
|
||||||
|
System.out.println("No occurrences of the keyword found.");
|
||||||
|
} else {
|
||||||
|
for (KeywordLocation location : keywordLocations) {
|
||||||
|
System.out.println("Page: " + location.getPageNumber());
|
||||||
|
System.out.println("Coordinates: " + location.getBoundingBox());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException | ParserConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<KeywordLocation> findKeywordLocations(String filePath, String keyword) throws IOException, ParserConfigurationException {
|
||||||
|
List<KeywordLocation> keywordLocations = new ArrayList<>();
|
||||||
|
|
||||||
|
try (ZipFile zipFile = new ZipFile(filePath)) {
|
||||||
|
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||||
|
|
||||||
|
while (entries.hasMoreElements()) {
|
||||||
|
ZipEntry entry = entries.nextElement();
|
||||||
|
if (entry.isDirectory() && entry.getName().equals("Pages")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!entry.isDirectory() && entry.getName().endsWith(".xml")) {
|
||||||
|
try (InputStream inputStream = zipFile.getInputStream(entry)) {
|
||||||
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||||
|
Document document = dBuilder.parse(inputStream);
|
||||||
|
|
||||||
|
NodeList textNodes = document.getElementsByTagName("Text");
|
||||||
|
|
||||||
|
for (int i = 0; i < textNodes.getLength(); i++) {
|
||||||
|
Node textNode = textNodes.item(i);
|
||||||
|
|
||||||
|
if (textNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
Element textElement = (Element) textNode;
|
||||||
|
String textContent = textElement.getTextContent();
|
||||||
|
|
||||||
|
if (textContent.contains(keyword)) {
|
||||||
|
int pageNumber = getPageNumber(entry.getName());
|
||||||
|
Rectangle boundingBox = getBoundingBox(textElement);
|
||||||
|
KeywordLocation location = new KeywordLocation(pageNumber, boundingBox);
|
||||||
|
keywordLocations.add(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SAXException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return keywordLocations;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getPageNumber(String entryName) {
|
||||||
|
String[] parts = entryName.split("_");
|
||||||
|
String lastPart = parts[parts.length - 1];
|
||||||
|
String pageNumberStr = lastPart.substring(0, lastPart.lastIndexOf('.'));
|
||||||
|
return Integer.parseInt(pageNumberStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Rectangle getBoundingBox(Element textElement) {
|
||||||
|
int x = Integer.parseInt(textElement.getAttribute("Boundary").split(" ")[0]);
|
||||||
|
int y = Integer.parseInt(textElement.getAttribute("Boundary").split(" ")[1]);
|
||||||
|
int width = Integer.parseInt(textElement.getAttribute("Boundary").split(" ")[2]);
|
||||||
|
int height = Integer.parseInt(textElement.getAttribute("Boundary").split(" ")[3]);
|
||||||
|
return new Rectangle(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class KeywordLocation {
|
||||||
|
private final int pageNumber;
|
||||||
|
private final Rectangle boundingBox;
|
||||||
|
|
||||||
|
public KeywordLocation(int pageNumber, Rectangle boundingBox) {
|
||||||
|
this.pageNumber = pageNumber;
|
||||||
|
this.boundingBox = boundingBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPageNumber() {
|
||||||
|
return pageNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle getBoundingBox() {
|
||||||
|
return boundingBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Rectangle {
|
||||||
|
private final int x;
|
||||||
|
private final int y;
|
||||||
|
private final int width;
|
||||||
|
private final int height;
|
||||||
|
|
||||||
|
public Rectangle(int x, int y, int width, int height) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "(" + x + ", " + y + ", " + width + ", " + height + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
package youhong.ai.utiltest;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
public class OFDReader {
|
||||||
|
|
||||||
|
private final String ofdFilePath;
|
||||||
|
private final String keyword;
|
||||||
|
|
||||||
|
public OFDReader(String ofdFilePath, String keyword) {
|
||||||
|
this.ofdFilePath = ofdFilePath;
|
||||||
|
this.keyword = keyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<KeywordInfo> findKeywords() throws Exception {
|
||||||
|
// 解析OFD.xml文件,获取OFD的根目录路径
|
||||||
|
String rootDirPath = parseOFDXmlAndGetRootDirPath();
|
||||||
|
if (rootDirPath == null) {
|
||||||
|
throw new Exception("Failed to parse OFD.xml file!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开OFD文件并获取ZipFile对象
|
||||||
|
ZipFile zipFile = new ZipFile(ofdFilePath);
|
||||||
|
|
||||||
|
// 获取Pages目录下的所有页面文件夹
|
||||||
|
List<String> pageFolders = getPageFolders(zipFile, rootDirPath);
|
||||||
|
if (pageFolders == null || pageFolders.isEmpty()) {
|
||||||
|
throw new Exception("No page found in the OFD file!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找所有关键字的位置信息
|
||||||
|
List<KeywordInfo> result = new ArrayList<>();
|
||||||
|
for (String pageFolder : pageFolders) {
|
||||||
|
KeywordInfo keywordInfo = findKeywordInPage(zipFile, pageFolder);
|
||||||
|
if (keywordInfo != null) {
|
||||||
|
result.add(keywordInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
zipFile.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析OFD.xml文件并获取OFD的根目录路径
|
||||||
|
private String parseOFDXmlAndGetRootDirPath() throws Exception {
|
||||||
|
ZipFile zipFile = new ZipFile(ofdFilePath);
|
||||||
|
ZipEntry ofdXmlEntry = zipFile.getEntry("OFD.xml");
|
||||||
|
InputStream inputStream = zipFile.getInputStream(ofdXmlEntry);
|
||||||
|
|
||||||
|
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
||||||
|
NodeList docRootNodes = doc.getElementsByTagName("ofd:DocRoot");
|
||||||
|
if (docRootNodes.getLength() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String docRootPath = docRootNodes.item(0).getTextContent();
|
||||||
|
String[] docRootPathSegments = docRootPath.split("/");
|
||||||
|
if (docRootPathSegments.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return docRootPathSegments[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取Pages目录下的所有页面文件夹
|
||||||
|
private List<String> getPageFolders(ZipFile zipFile, String rootDirPath) {
|
||||||
|
List<String> pageFolders = new ArrayList<>();
|
||||||
|
String pagesDirPath = rootDirPath + "/Pages/";
|
||||||
|
String pagesPrefix = pagesDirPath + "Page_";
|
||||||
|
String pagesSuffix = "Content.xml";
|
||||||
|
|
||||||
|
// 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹
|
||||||
|
zipFile.stream().forEach(entry -> {
|
||||||
|
if (entry.getName().startsWith(pagesDirPath) && entry.getName().startsWith(pagesPrefix) && entry.getName().endsWith(pagesSuffix) && !entry.getName().equals(pagesDirPath)) {
|
||||||
|
pageFolders.add(entry.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return pageFolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在指定页面中查找关键字
|
||||||
|
private KeywordInfo findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception {
|
||||||
|
ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder);
|
||||||
|
InputStream inputStream = zipFile.getInputStream(contentXmlEntry);
|
||||||
|
|
||||||
|
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
||||||
|
NodeList textNodes = doc.getElementsByTagName("ofd:TextObject");
|
||||||
|
|
||||||
|
for (int i = 0; i < textNodes.getLength(); i++) {
|
||||||
|
Node textNode = textNodes.item(i);
|
||||||
|
String textContent = textNode.getTextContent();
|
||||||
|
|
||||||
|
if (textContent.contains(keyword)) {
|
||||||
|
Node boundaryNode = textNode.getAttributes().getNamedItem("Boundary");
|
||||||
|
String boundary = boundaryNode.getNodeValue();
|
||||||
|
String[] boundarySegments = boundary.split(" ");
|
||||||
|
|
||||||
|
double x = Double.parseDouble(boundarySegments[0]);
|
||||||
|
double y = Double.parseDouble(boundarySegments[1]);
|
||||||
|
double width = Double.parseDouble(boundarySegments[2]);
|
||||||
|
double height = Double.parseDouble(boundarySegments[3]);
|
||||||
|
|
||||||
|
KeywordInfo keywordInfo = new KeywordInfo(pageFolder, x, y, width, height);
|
||||||
|
return keywordInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String filePath = "/Users/aoey.oct.22/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/44e92f459afe6c0b31d119efb268a257/Message/MessageTemp/65ac172b9cb23c7967462468b4b5be81/File/测试文档01 (1).ofd";
|
||||||
|
String keyword = "签章位置001";
|
||||||
|
|
||||||
|
OFDReader reader = new OFDReader(filePath, keyword);
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<KeywordInfo> keywordInfos = reader.findKeywords();
|
||||||
|
|
||||||
|
if (keywordInfos.isEmpty()) {
|
||||||
|
System.out.println("No occurrences of the keyword found.");
|
||||||
|
} else {
|
||||||
|
for (KeywordInfo info : keywordInfos) {
|
||||||
|
System.out.println("Page: " + info.getPageNumber());
|
||||||
|
System.out.println("Coordinates: " + info.getBoundingBox());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class KeywordInfo {
|
||||||
|
private final String pageFolder;
|
||||||
|
private final double x;
|
||||||
|
private final double y;
|
||||||
|
private final double width;
|
||||||
|
private final double height;
|
||||||
|
|
||||||
|
public KeywordInfo(String pageFolder, double x, double y, double width, double height) {
|
||||||
|
this.pageFolder = pageFolder;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPageNumber() {
|
||||||
|
int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - "/Content.xml".length()));
|
||||||
|
return String.valueOf(pageNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBoundingBox() {
|
||||||
|
return "(" + x + ", " + y + ", " + width + ", " + height + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package youhong.ai.utiltest;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.fileUtil.pdf.PdfPointItem;
|
||||||
|
import aiyh.utils.fileUtil.pdf.PdfUtil;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.api.youhong.ai.zhishichanquan.ssocaiwu.util.AES;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
|
||||||
|
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||||
|
import weaver.youhong.ai.intellectualproperty.util.OFDReader;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/17 14:20</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class PDFODFTest extends BaseTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOfdKeyword() throws IOException {
|
||||||
|
|
||||||
|
List<PdfPointItem> pointItemList = PdfUtil.findKeywordPoints(Files.newInputStream(Paths.get("/Users/aoey.oct.22/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/44e92f459afe6c0b31d119efb268a257/Message/MessageTemp/65ac172b9cb23c7967462468b4b5be81/File/测试文档01 (1).ofd")), "签章位置");
|
||||||
|
System.out.println(JSON.toJSONString(pointItemList));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void tesetOfdKeyWorkdasdf() throws Exception {
|
||||||
|
weaver.youhong.ai.intellectualproperty.util.OFDReader reader = new OFDReader("/Users/aoey.oct.22/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/44e92f459afe6c0b31d119efb268a257/Message/MessageTemp/65ac172b9cb23c7967462468b4b5be81/File/1684915381834-ofd-4e579378-0925-43b3-9f89-89b661772521测试文档01.ofd", "签章位置001");
|
||||||
|
System.out.println(JSON.toJSONString(reader.findKeywords()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void teest() throws ClassNotFoundException {
|
||||||
|
Map<String, String> stringStringMap = Util.parseCusInterfacePathParam("weaver.youhong.ai.intellectualproperty.cusgetvalue.GetOfdKeywordPageValue?keywordType=0&keyword=电子签章001");
|
||||||
|
System.out.println(stringStringMap);
|
||||||
|
Class<?> aClass = Class.forName(stringStringMap.get("_ClassPath"));
|
||||||
|
System.out.println(aClass);
|
||||||
|
DealWithMapping dealWithMapping = new DealWithMapping();
|
||||||
|
dealWithMapping.getCusInterfaceObj("weaver.youhong.ai.intellectualproperty.cusgetvalue.GetOfdKeywordPageValue?keywordType=0&keyword=电子签章001", CusInterfaceGetValue.class, stringStringMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void teesstA() throws UnsupportedEncodingException {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("user", "nieli");
|
||||||
|
map.put("ts", System.currentTimeMillis());
|
||||||
|
String a = AES.encrypt("SLwjQi043sKossVe", "9nP4OQ$eQ*WugI$1", JSON.toJSONString(map));
|
||||||
|
System.out.println(AES.decrypt("SLwjQi043sKossVe", "9nP4OQ$eQ*WugI$1", a));
|
||||||
|
System.out.println(a);
|
||||||
|
String encode = URLEncoder.encode(a, "UTF-8");
|
||||||
|
System.out.println(encode);
|
||||||
|
System.out.println(URLDecoder.decode("3CXGaVSSX6LF6rjgpQsDoFsCwZr9Yu6/apKv3z%20z%20yURxjFYMXOZITr9CmqoTS/3"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue