Compare commits

..

No commits in common. "main" and "release" have entirely different histories.

2837 changed files with 0 additions and 675248 deletions

View File

@ -1,30 +0,0 @@
{
"buildType":"GRADLE",
"devProject":{
"basePath":"D:/WEAVER/seconddev-fage-demo",
"name":"seconddev-fage-demo",
"open":true
},
"developer":"sysadmin",
"eteamsid":"THIRD_a499fa851c1500096d3977a17c0873b4-BK0AFI9FML94F",
"funcDevLibPath":null,
"funcDevLibServerUrl":null,
"localEcDir":null,
"localFuncDevLib":false,
"localZipPath":null,
"moduleDesc":"",
"moduleName":"secondev-fage-demo",
"platform":"ETEAMS",
"projectDesc":"",
"projectTypeEnum":"ONLINE_SECDEV",
"secServiceUrl":"http://221.226.25.34:10600/",
"serviceNodeBean":{
"installPath":"/opt/weaver/e10-server0/weaver-secondev-service/",
"ip":"127.0.0.1",
"merge":false,
"modules":null,
"port":23200,
"serverName":"weaver-secondev-service"
},
"unZipPath":null
}

View File

@ -1,2 +0,0 @@
#Mon Jun 02 12:04:35 CST 2025
gradle.version=6.9.2

View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.20/18bcea7d5df4d49227b4a0743a536208ce4825bb/lombok-1.18.20.jar" />
</processorPath>
<module name="secondev-fage-demo.main" />
<module name="secondev-fage-demo.secondev-fage-demo.main" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="seconddev-fage-demo.buildSrc" target="15" />
<module name="seconddev-fage-demo.buildSrc.main" target="15" />
<module name="seconddev-fage-demo.buildSrc.test" target="15" />
<module name="seconddev-fage-demo.secondev-fage-demo" target="15" />
<module name="seconddev-fage-demo.secondev-fage-demo.main" target="1.8" />
<module name="seconddev-fage-demo.secondev-fage-demo.test" target="15" />
<module name="WEAVER.seconddev-fage-demo" target="15" />
<module name="WEAVER.seconddev-fage-demo.main" target="1.8" />
<module name="WEAVER.seconddev-fage-demo.test" target="15" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="azul-15" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/buildSrc" />
<option value="$PROJECT_DIR$/secondev-fage-demo" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:/$MAVEN_REPOSITORY$" />
</remote-repository>
</component>
</project>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/seconddev-fage-demo.iml" filepath="$PROJECT_DIR$/seconddev-fage-demo.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/secondev-fage-demo/secondev-fage-demo.secondev-fage-demo.main.iml" filepath="$PROJECT_DIR$/.idea/modules/secondev-fage-demo/secondev-fage-demo.secondev-fage-demo.main.iml" />
</modules>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../../../secondev-fage-demo/build/generated/sources/annotationProcessor/java/main">
<sourceFolder url="file://$MODULE_DIR$/../../../secondev-fage-demo/build/generated/sources/annotationProcessor/java/main" isTestSource="false" generated="true" />
</content>
</component>
</module>

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -1,680 +0,0 @@
package com.weaver.seconddev.jcl.organization.esb;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.common.mybatis.util.DatabaseUtil;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.day02.util.DatabaseUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.security.SecureRandom;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @use信息变更节点后数据同步到员工信息表
* @date 2025年5月19日
* @author xuxy
*/
@Service("SyncXxbgPersonInfo_jcl")
public class SyncXxbgPersonInfo implements EsbServerlessRpcRemoteInterface {
@Autowired
private DatabaseUtils databaseUtils;
private static final Logger log = LoggerFactory.getLogger(SyncXxbgPersonInfo.class);
private static String nowData;
@Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
int code =200;
Map<String, Object> result = new HashMap<>();
String lcid = null!=params.get("lcid")?String.valueOf(params.get("lcid").toString()):"";
String ygid = null!=params.get("ygid")?String.valueOf(params.get("ygid").toString()):"";
log.error("SyncXxbgPersonInfo.lcid : [{}].ygid:[{}]",lcid,ygid);
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式化器
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化当前日期
nowData = now.format(formatter);
log.error("resultCalculAtion.nowData:{}", nowData);
//判断新增/更新数据是否都成功
if(code==200){
result.put("code",200);
result.put("msg","更新员工信息表数据成功!");
}
log.error("SyncXxbgPersonInfo.result:"+result);
return WeaResult.success(result);
}
/**
* 查询员工信息表id
* @param ygid
* @return
*/
public String getEmployeeId(String ygid,String ebTableName) {
String employeeid = "";
String sql = "SELECT id FROM "+ebTableName+" WHERE glyg = '" + ygid+ "' and delete_type=0";
log.error("getEmployeeId.sql:{}", sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
log.error("getEmployeeId.recordList:{}", recordList);
if(CollectionUtils.isNotEmpty(recordList)){
Object formdataValue = recordList.get(0).get("id");
if (formdataValue instanceof Long) {
employeeid = String.valueOf(formdataValue); // 转换为 String
} else if (formdataValue instanceof String) {
employeeid = (String) formdataValue; // 如果是 String 类型直接赋值
}else {
employeeid = String.valueOf(formdataValue);
}
}
return employeeid;
}
/**
* 根据流程id查询变更流程数据
* @return
*/
public Map<String, Object> getXxbgsqInfo(String lcid,String ebTableXxName){
Map<String, Object> map = new HashMap<>();
String sql = "select * from "+ebTableXxName+" where DELETE_TYPE=0 and id ="+lcid;
log.error("getXxbgsqInfo.sql:{}", sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
log.error("getXxbgsqInfo.recordList:{}", recordList);
if(CollectionUtils.isNotEmpty(recordList)){
map = recordList.get(0);
}
return map;
}
public int insert(String tableName, Map<String, Object> setMap){
int result = 400;
log.info("insert-setMap{}",setMap);
if (StringUtils.isBlank(tableName) || null==setMap || setMap.size() <= 0) {
return result;
}
List<String> setkey = new ArrayList<>();
List<Object> setvalue = new ArrayList<>();
setMap.forEach((key1, value) -> {
setkey.add(key1);
setvalue.add(value);
});
List<String> setvalueNew = new ArrayList<>();
for (Object obj : setvalue) {
if (obj == null) {
setvalueNew.add("");
} else {
setvalueNew.add(obj.toString());
}
}
String sql = " insert into " + tableName + "(" + String.join(",", setkey) + ") values('"
+ String.join("','", setvalueNew)+ "')";
log.info("insert-sql{}",sql);
//查询数据库类型
String databaseId = DatabaseUtil.getDatabaseId();
log.info("insert-databaseId{}",databaseId);
if(databaseId.equalsIgnoreCase("oracle")){
// 正则表达式匹配日期格式
Pattern pattern = Pattern.compile("'(\\d{4}-\\d{2}-\\d{2})'");
Matcher matcher = pattern.matcher(sql);
// 使用 StringBuffer 进行替换
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, "TO_DATE('" + matcher.group(1) + "', 'yyyy-mm-dd')");
}
matcher.appendTail(sb);
String updatedSql = sb.toString();
System.out.println(updatedSql);
// 示例字符串包含日期和时间
// 正则表达式匹配日期和时间格式
Pattern patternWithTime = Pattern.compile("'(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})'");
Matcher matcherWithTime = patternWithTime.matcher(updatedSql);
// 使用 StringBuffer 进行替换
StringBuffer sbWithTime = new StringBuffer();
while (matcherWithTime.find()) {
matcherWithTime.appendReplacement(sbWithTime, "TO_DATE('" + matcherWithTime.group(1) + "', 'yyyy-mm-dd hh24:mi:ss')");
}
matcherWithTime.appendTail(sbWithTime);
String updatedSqlWithTime = sbWithTime.toString();
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", updatedSqlWithTime);
log.error("insert.recordList:{}", rs);
result = Integer.parseInt(String.valueOf(rs.get("code")));
}else{
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
log.error("insert.recordList:{}", rs);
result = Integer.parseInt(String.valueOf(rs.get("code")));
}
return result;
}
public int update(String tableName, Map<String, Object> setMap,String condition,String id){
int result = 400;
if(StringUtils.isNotBlank(id)){
log.info("update-setMap{},id{}",setMap,id);
if (StringUtils.isBlank(tableName) || setMap == null || setMap.size() <= 0) {
return result;
}
StringBuilder sql = new StringBuilder();
sql.append("update "+tableName + " set ");
//查询数据库类型
String databaseId = DatabaseUtil.getDatabaseId();
log.info("update-databaseId{}",databaseId);
for (String key : setMap.keySet()) {
if(databaseId.equalsIgnoreCase("oracle")){
//判断是否是日期类型
if(isValidDateTime(String.valueOf(setMap.get(key)))){
sql.append(key).append("=").append("TO_DATE('").append(setMap.get(key)).append("', 'yyyy-mm-dd hh24:mi:ss')").append(",");
}else if(isValidDate(String.valueOf(setMap.get(key)))){
sql.append(key).append("=").append("TO_DATE('").append(setMap.get(key)).append("', 'yyyy-mm-dd')").append(",");
}else{
sql.append(key).append("=").append("'").append(setMap.get(key)).append("'").append(",");
}
}else {
sql.append(key).append("=").append("'").append(setMap.get(key)).append("'").append(",");
}
}
if (sql.length() > 0) {
sql.deleteCharAt(sql.length() - 1); // 删除最后一个字符
}
sql.append(" where "+condition+" = "+id);
log.info("update-sql{}",sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql.toString());
log.error("update.recordList:{}", rs);
result = Integer.parseInt(String.valueOf(rs.get("code")));
}
return result;
}
public static boolean isValidDate(String dateTimeStr) {
// 定义日期时间格式
String dateTimePattern = "yyyy-MM-dd";
return isValidDate(dateTimeStr, dateTimePattern);
}
public static boolean isValidDateTime(String dateTimeStr) {
// 定义日期时间格式
String dateTimePattern = "yyyy-MM-dd HH:mm:ss";
return isValidDate(dateTimeStr, dateTimePattern);
}
private static boolean isValidDate(String dateStr, String pattern) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setLenient(false); // 设置为严格模式避免宽松解析
sdf.parse(dateStr);
return true;
} catch (ParseException e) {
return false;
}
}
private void cleanUpTime(Map<String, Object> employee_info){
//特殊处理
//try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
long create_time =0L;
long update_time =0L;
long hiredate_time =0L;
Date parsedDate1 = new Date();
Date parsedDate2 = new Date();
Date parsedDate3 = new Date();
String createDate =nowData;
String updateDate =nowData;
String hiredate =nowData;
if(StringUtils.isNotBlank(getIgnoreCase(employee_info, "create_time"))){
String time = getIgnoreCase(employee_info, "create_time");
if(!time.contains("-")){
create_time = Long.parseLong(time);
Date date = new Date(create_time);
createDate = sdf.format(date);
//parsedDate1 = new Date(sdf.parse(createDate).getTime());
}
}
if(StringUtils.isNotBlank(getIgnoreCase(employee_info, "update_time"))){
String time = getIgnoreCase(employee_info, "update_time");
if(!time.contains("-")){
update_time = Long.parseLong(time);
Date date = new Date(update_time);
updateDate = sdf.format(date);
//parsedDate2 = new Date(sdf.parse(updateDate).getTime());
}
}
if(StringUtils.isNotBlank(getIgnoreCase(employee_info, "hiredate"))){
String time = getIgnoreCase(employee_info, "hiredate");
if(!time.contains("-")){
hiredate_time = Long.parseLong(time);
Date date = new Date(hiredate_time);
hiredate = sdf2.format(date);
//parsedDate3 = new Date(sdf2.parse(hiredate).getTime());
}
}
if(StringUtils.isNotBlank(getIgnoreCase(employee_info, "ft_status"))){
String ft_status = getIgnoreCase(employee_info, "ft_status");
if("false".equalsIgnoreCase(ft_status)){
employee_info.put("ft_status","0");
}
}
if(StringUtils.isNotBlank(getIgnoreCase(employee_info, "is_delete"))){
String is_delete = getIgnoreCase(employee_info, "is_delete");
if("false".equalsIgnoreCase(is_delete)){
employee_info.put("is_delete","0");
}
}
if(StringUtils.isNotBlank(getIgnoreCase(employee_info, "delete_type"))){
String delete_type = getIgnoreCase(employee_info, "delete_type");
if("false".equalsIgnoreCase(delete_type)){
employee_info.put("delete_type","0");
}
}
employee_info.put("create_time",createDate);
employee_info.put("update_time",updateDate);
employee_info.put("hiredate",hiredate);
// }catch (ParseException e) {
// e.printStackTrace();
// }
}
public static String getIgnoreCase(Map<String, Object> map, String key) {
for (Map.Entry<String, Object> entry : map.entrySet()) {
if (entry.getKey().equalsIgnoreCase(key)) {
return entry.getValue().toString();
}
}
return null; // 或者抛出异常取决于你的需求
}
/**
* 数据同步处理明细表更新
* @return
*/
public void updateAllXxbgDetailInfo(String ygxxid,String lcid,long objId,long objXxId){
log.error("updateAllXxbgDetailInfo.ygxxid:{},lcid:{}", ygxxid,lcid);
/**
* 多租户查询主表名称
*/
String uf_jcl_employ4944 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ4944");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ4944:{}", uf_jcl_employ4944);
String uf_jcl_emp_gzll = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_gzll");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_gzll:{}", uf_jcl_emp_gzll);
//先删除原来记录只能逻辑删除更新时间也必须加上
String sql = "update "+uf_jcl_emp_gzll+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid ;
deleteDetailData(sql);
/**
* 工作履历表
* */
String gzsql = "select * from "+uf_jcl_employ4944+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> gzllInfo = getYgxxDetailInfo(gzsql);
List<String> listOfgzllColumns = getTableColumnsOfTableName(uf_jcl_emp_gzll);
log.error("updateAllXxbgDetailInfo.gzllInfo:{}", gzllInfo);
log.error("updateAllXxbgDetailInfo.listOfgzllColumns:{}", listOfgzllColumns);
for (Map<String, Object> map : gzllInfo) {
Map<String, Object> gzllInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfgzllColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
gzllInfo_new.put(key,"0");
}else{
gzllInfo_new.put(key,getIgnoreCase(map, key));
}
}
gzllInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
gzllInfo_new.put("id",primarykey);
//插入组织工作履历表
cleanUpTime(gzllInfo_new);
gzllInfo_new.remove("hiredate");
insert(uf_jcl_emp_gzll,gzllInfo_new);
}
/**
* 教育经历表
* */
/**
* 多租户查询主表名称
*/
String uf_jcl_employ4991 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ4991");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ4991:{}", uf_jcl_employ4991);
String uf_jcl_emp_jyjl = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_jyjl");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_jyjl:{}", uf_jcl_emp_jyjl);
//先删除原来记录
sql = "update "+uf_jcl_emp_jyjl+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid;
deleteDetailData(sql);
String jysql = "select * from "+uf_jcl_employ4991+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> jyjlInfo = getYgxxDetailInfo(jysql);
List<String> listOfjyjlColumns = getTableColumnsOfTableName(uf_jcl_emp_jyjl);
log.error("getYgxxDetailInfo.jyjlInfo0172:{}", jyjlInfo);
log.error("getYgxxDetailInfo.listOfjyjlColumns:{}", listOfjyjlColumns);
for (Map<String, Object> map : jyjlInfo) {
Map<String, Object> jyjlInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfjyjlColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
jyjlInfo_new.put(key,"0");
}else{
jyjlInfo_new.put(key,getIgnoreCase(map, key));
}
}
jyjlInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
jyjlInfo_new.put("id",primarykey);
//插入教育经历表
cleanUpTime(jyjlInfo_new);
jyjlInfo_new.remove("hiredate");
insert(uf_jcl_emp_jyjl,jyjlInfo_new);
}
/**
* 家庭信息表
* */
/**
* 多租户查询主表名称
*/
String uf_jcl_employ5051 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ5051");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ5051:{}", uf_jcl_employ5051);
String uf_jcl_emp_jtxx = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_jtxx");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_jtxx:{}", uf_jcl_emp_jtxx);
//先删除原来记录
sql = "update "+uf_jcl_emp_jtxx+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid;
deleteDetailData(sql);
String jtxxsql = "select * from "+uf_jcl_employ5051+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> jtxxInfo = getYgxxDetailInfo(jtxxsql);
List<String> listOfjtxxColumns = getTableColumnsOfTableName(uf_jcl_emp_jtxx);
log.error("getYgxxDetailInfo.jtxxInfo:{}", jtxxInfo);
for (Map<String, Object> map : jtxxInfo) {
Map<String, Object> jtxxInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfjtxxColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
jtxxInfo_new.put(key,"0");
}else{
jtxxInfo_new.put(key,getIgnoreCase(map, key));
}
}
jtxxInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
jtxxInfo_new.put("id",primarykey);
//插入家庭信息表
cleanUpTime(jtxxInfo_new);
jtxxInfo_new.remove("hiredate");
insert(uf_jcl_emp_jtxx,jtxxInfo_new);
}
/**
* 表彰与奖励
* */
/**
* 多租户查询主表名称
*/
String uf_jcl_employ5105 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ5105");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ5105:{}", uf_jcl_employ5105);
String uf_jcl_emp_bzyjl = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_bzyjl");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_bzyjl:{}", uf_jcl_emp_bzyjl);
//先删除原来记录
sql = "update "+uf_jcl_emp_bzyjl+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid;
deleteDetailData(sql);
String bzsql = "select * from "+uf_jcl_employ5105+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> bzInfo = getYgxxDetailInfo(bzsql);
List<String> listOfbzColumns = getTableColumnsOfTableName(uf_jcl_emp_bzyjl);
log.error("getYgxxDetailInfo.bzInfo:{}", bzInfo);
log.error("getYgxxDetailInfo.listOfbzColumns:{}", listOfbzColumns);
for (Map<String, Object> map : bzInfo) {
Map<String, Object> bzInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfbzColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
bzInfo_new.put(key,"0");
}else{
bzInfo_new.put(key,getIgnoreCase(map, key));
}
}
bzInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
bzInfo_new.put("id",primarykey);
//插入家庭信息表
cleanUpTime(bzInfo_new);
bzInfo_new.remove("hiredate");
insert(uf_jcl_emp_bzyjl,bzInfo_new);
}
/**
* 培训经历
* */
/**
* 多租户查询主表名称
*/
String uf_jcl_employ5165 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ5165");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ5165:{}", uf_jcl_employ5165);
String uf_jcl_emp_pxjl = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_pxjl");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_pxjl:{}", uf_jcl_emp_pxjl);
//先删除原来记录
sql = "update "+uf_jcl_emp_pxjl+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid;
deleteDetailData(sql);
String pxsql = "select * from "+uf_jcl_employ5165+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> pxInfo = getYgxxDetailInfo(pxsql);
List<String> listOfpxColumns = getTableColumnsOfTableName(uf_jcl_emp_pxjl);
log.error("getYgxxDetailInfo.pxInfo:{}", pxInfo);
log.error("getYgxxDetailInfo.listOfpxColumns:{}", listOfpxColumns);
for (Map<String, Object> map : pxInfo) {
Map<String, Object> pxInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfpxColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
pxInfo_new.put(key,"0");
}else{
pxInfo_new.put(key,getIgnoreCase(map, key));
}
}
pxInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
pxInfo_new.put("id",primarykey);
//插入培训表
cleanUpTime(pxInfo_new);
pxInfo_new.remove("hiredate");
insert(uf_jcl_emp_pxjl,pxInfo_new);
}
/**
* 语言能力
* */
/**
* 多租户查询主表名称
*/
String uf_jcl_employ5218 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ5218");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ5218:{}", uf_jcl_employ5218);
String uf_jcl_emp_yynl = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_yynl");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_yynl:{}", uf_jcl_emp_yynl);
//先删除原来记录
sql = "update "+uf_jcl_emp_yynl+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid;
deleteDetailData(sql);
String yysql = "select * from "+uf_jcl_employ5218+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> yyInfo = getYgxxDetailInfo(yysql);
List<String> listOfyyColumns = getTableColumnsOfTableName(uf_jcl_emp_yynl);
log.error("getYgxxDetailInfo.yyInfo:{}", yyInfo);
log.error("getYgxxDetailInfo.listOfyyColumns:{}", listOfyyColumns);
for (Map<String, Object> map : yyInfo) {
Map<String, Object> yyInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfyyColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
yyInfo_new.put(key,"0");
}else{
yyInfo_new.put(key,getIgnoreCase(map, key));
}
}
yyInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
yyInfo_new.put("id",primarykey);
//插入培训表
cleanUpTime(yyInfo_new);
yyInfo_new.remove("hiredate");
insert(uf_jcl_emp_yynl,yyInfo_new);
}
/**
* 权威机构资格
* */
/**
* 多租户查询主表名称
*/
String uf_jcl_employ5265 = recruitModuleUtils.getDetailTableNameByMasterId(objXxId, "uf_jcl_employ5265");
log.error("updateAllXxbgDetailInfo.uf_jcl_employ5265:{}", uf_jcl_employ5265);
String uf_jcl_emp_qwjgzgrz = recruitModuleUtils.getDetailTableNameByMasterId(objId, "uf_jcl_emp_qwjgzgrz");
log.error("updateAllXxbgDetailInfo.uf_jcl_emp_qwjgzgrz:{}", uf_jcl_emp_qwjgzgrz);
//先删除原来记录
sql = "update "+uf_jcl_emp_qwjgzgrz+" set delete_type = 1,update_time ='" + nowData + "' where FORM_DATA_ID = "+ygxxid;
deleteDetailData(sql);
String qwsql = "select * from "+uf_jcl_employ5265+" where FORM_DATA_ID = '" + lcid + "' and delete_type=0";
List<Map<String, Object>> qwInfo = getYgxxDetailInfo(qwsql);
List<String> listOfqwColumns = getTableColumnsOfTableName(uf_jcl_emp_qwjgzgrz);
log.error("getYgxxDetailInfo.qwInfo:{}", qwInfo);
log.error("getYgxxDetailInfo.listOfqwColumns:{}", listOfqwColumns);
for (Map<String, Object> map : qwInfo) {
Map<String, Object> qwInfo_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : listOfqwColumns) {
if (containsKeyIgnoreCase(map,key)) {
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
qwInfo_new.put(key,"0");
}else{
qwInfo_new.put(key,getIgnoreCase(map, key));
}
}
qwInfo_new.put("form_data_id",ygxxid);
}
//跟换id值然后主键冲突
String primarykey = createPrimarykey();
log.error("getYgxxDetailInfo.primarykey:{}", primarykey);
qwInfo_new.put("id",primarykey);
//插入权威机构表
cleanUpTime(qwInfo_new);
qwInfo_new.remove("hiredate");
insert(uf_jcl_emp_qwjgzgrz,qwInfo_new);
}
}
public static boolean containsKeyIgnoreCase(Map<String, Object> map, String key) {
if (map == null || key == null) {
return false;
}
for (String mapKey : map.keySet()) {
if (mapKey.equalsIgnoreCase(key)) {
return true;
}
}
return false;
}
/**
* 删除系统明细表数据
* @return
*/
public void deleteDetailData(String sql){
log.error("deleteDetailData888.sql:{}", sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
log.error("deleteDetailData.recordList:{}", recordList);
}
/**
* 根据明细表名称和关联id查询员工信息明细表数据
* @return
*/
public List<Map<String, Object>> getYgxxDetailInfo(String sql){
log.error("getYgxxDetailInfo.sql:{}", sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
log.error("getYgxxDetailInfo.recordList:{}", recordList);
return recordList;
}
public List<String> getTableColumnsOfTableName(String tableName) {
String sql = "";
//String sql = "SELECT * FROM " + tableName;
//查询数据库类型
String databaseId = DatabaseUtil.getDatabaseId();
log.info("getTableColumnsOfTableName-databaseId{}",databaseId);
if(databaseId.equalsIgnoreCase("oracle")){
//oracle
sql = "SELECT column_name FROM ALL_TAB_COLUMNS WHERE TABLE_NAME ='" + tableName + "' ";
}else{
//mysql
sql = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + tableName + "' ";
}
log.error("getTableColumnsOfTableName.sql:{}", sql);
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
log.error("getTableColumnsOfTableName.recordList:{}", recordList);
List<String> listOfColumn = recordList.stream()
.map(map -> map.get("column_name").toString())
.collect(Collectors.toList());
return listOfColumn;
//return extractFieldNames(recordList);
}
public Set<String> extractFieldNames(List<Map<String, Object>> recordList) {
// 使用 Stream API 提取所有字段名
return recordList.stream()
.flatMap(record -> record.keySet().stream())
.collect(Collectors.toSet());
}
/**
* 自动生成eb表主键
*/
private String createPrimarykey(){
SecureRandom random = new SecureRandom();
long randomNumber = 0;
// 生成一个18位的随机数
do {
// 生成一个18位随机数范围从100000000000000000L到999999999999999999L
randomNumber = 100000000000000000L + (long) (random.nextDouble() * 900000000000000000L);
} while (randomNumber < 100000000000000000L || randomNumber > 999999999999999999L);
return String.valueOf(randomNumber);
}
}

View File

@ -1,112 +0,0 @@
package com.weaver.secondev.action;
import com.alibaba.fastjson.JSON;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.common.form.data.detail.FormDataDetail;
import com.weaver.common.form.data.option.FormDataOption;
import com.weaver.ebuilder.datasource.api.entity.ExecuteSqlEntity;
import com.weaver.ebuilder.datasource.api.enums.SourceType;
import com.weaver.ebuilder.datasource.api.service.DataSetService;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.day02.util.DatabaseUtils;
import com.weaver.workflow.common.entity.formdef.WfFormFieldEntity;
import com.weaver.workflow.core.api.rest.form.WfcFormRest;
import com.weaver.workflow.core.api.rest.publicapi.WfcFormDataRest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("actionDemo")
@Slf4j
public class BaseAction implements EsbServerlessRpcRemoteInterface {
@Autowired
private DatabaseUtils databaseUtils;
@Value("${weaver.dev.xgqqField}")
private String xgqqField;//配置文件维护的相关请求字段
@RpcReference(group = "workflow")
WfcFormRest wfcFormRest;
@RpcReference
WfcFormDataRest wfcFormDataRest;
@Autowired
private DataSetService dataSetService;
@Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
log.info("==== BaseAction start===== inParams ==> {}", JSON.toJSONString(params));
String workflowId = String.valueOf(params.get("workflowId"));
String requestId = String.valueOf(params.get("requestId"));
String employId = String.valueOf(params.get("employId"));
//1获取相关请求字段fieldid
log.info("xgqqField==>{}",xgqqField);
long fieldid = -1l;
List<WfFormFieldEntity> formFieldEntityList = wfcFormRest.getFormFieldByWfId(Long.parseLong(workflowId),new HashMap<>(),Long.parseLong(employId));
for(WfFormFieldEntity entity : formFieldEntityList){
String dataKey = String.valueOf(entity.getOtherParams().get("dataKey'"));
if(dataKey.equals(xgqqField)){
fieldid = entity.getId();
}
}
log.info("fieldid==>{}",fieldid);
//2获取相关请求数据
List<Long> fieldList = new ArrayList<>();
fieldList.add(fieldid);
List<FormDataDetail> formDataDetails = wfcFormDataRest.getFormFieldValue(Long.parseLong(requestId),fieldList,Long.parseLong(employId));
List<FormDataOption> dataOptions = formDataDetails.get(0).getDataOptions();
log.info("formDataDetails==>{}",JSON.toJSONString(formDataDetails));
String xgqqValue = "";
for(FormDataOption option : dataOptions){
xgqqValue += ","+option.getOptionId();
}
if(!"".equals(xgqqValue)){
xgqqValue = xgqqValue.substring(1);
}
//3查询流程是否归档 delete_type 0-正常 1-删除 租户 tenant_key=''
String sql = "select requestid,requestname from wfc_requestbase where flowstatus !=4 and requestid in ("+xgqqValue+") and delete_type='0'";
log.info("sql==>{}",sql);
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(cn.hutool.core.codec.Base64.encode(sql));
executeSqlEntity.setGroupId("weaver-workflow-report-serviceworkflowreport");// 访问 E10地址/api/datasource/ds/group?sourceType=LOGIC 获取对应的id
executeSqlEntity.setSourceType(SourceType.LOGIC);
Map<String,Object> datas = dataSetService.executeSql(executeSqlEntity);
log.info("datas==>{}",JSON.toJSONString(datas));
String errStr = "";
if(String.valueOf(datas.get("status")).equals("OK")){
List<Map<String,Object>> results = (List<Map<String,Object>>)datas.get("records");
for(Map<String,Object> result : results){
errStr += "," + result.get("requestname");
}
}
//4封装返回值
if(!"".equals(errStr)){
errStr = errStr.substring(1);
errStr = "相关请求中,存在未归档的流程【"+errStr+"】,请将关联流程归档后再提交本流程!";
return WeaResult.fail(errStr);
}else{
Map<String,Object> result = new HashMap<>();
return WeaResult.success(result);
}
}
}

View File

@ -1,36 +0,0 @@
package com.weaver.secondev.action;
import com.alibaba.fastjson.JSON;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.day02.util.DatabaseUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service("fageBaseDemo")
@Slf4j
public class BaseDemoAction implements EsbServerlessRpcRemoteInterface {
@Autowired
private DatabaseUtils databaseUtils;
@Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
log.info("==== BaseDemoAction start===== inParams ==> {}", JSON.toJSONString(params));
String lcid = String.valueOf(params.get("lcid"));
String bcsjid = String.valueOf(params.get("bcsjid"));
String bdid = String.valueOf(params.get("bdid"));
log.info("==== BaseDemoAction start===== lcid ==> {}", lcid);
log.info("==== BaseDemoAction start===== bcsjid ==> {}", bcsjid);
log.info("==== BaseDemoAction start===== bdid ==> {}", bdid);
Map<String,Object> result = new HashMap<>();
return WeaResult.success(result);
}
}

View File

@ -1,29 +0,0 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
</annotationProcessing>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="classbean">
<CLASSES>
<root url="file://$PROJECT_DIR$/../../classbean" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/../../classbean" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="lib_ec">
<CLASSES>
<root url="file://$PROJECT_DIR$/../../lib_ec" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/../../lib_ec" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/../../lib_ec" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/../../lib_ec" recursive="false" type="SOURCES" />
</library>
</component>

View File

@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="lib_resin">
<CLASSES>
<root url="file://$PROJECT_DIR$/../../lib_resin" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$PROJECT_DIR$/../../lib_resin" recursive="false" />
</library>
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/FiveHzCenter.iml" filepath="$PROJECT_DIR$/FiveHzCenter.iml" />
</modules>
</component>
</project>

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="classbean" level="project" />
<orderEntry type="library" name="lib_ec" level="project" />
<orderEntry type="library" name="lib_resin" level="project" />
</component>
</module>

View File

@ -1,145 +0,0 @@
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u8BC4\u4EF7 \u6D41\u7A0B\u8868\u540D
evaluateNewEmploy_table=formtable_main_94
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u8BC4\u4EF7 workflowid
evaluateNewEmploy_workflowid=47
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u8BC4\u4EF7 \u5BFC\u5E08\u8BC4\u4EF7/\u4EBA\u529B\u8D44\u6E90\u90E8 \u4E00\u9636\u6BB5 \u8282\u70B9id
evaluateNewEmploy_first_nodeid=224
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u8BC4\u4EF7 \u5BFC\u5E08\u8BC4\u4EF7/\u4EBA\u529B\u8D44\u6E90\u90E8 \u4E8C\u9636\u6BB5 \u8282\u70B9id
evaluateNewEmploy_second_nodeid=380
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u8BC4\u4EF7 \u5BFC\u5E08\u8BC4\u4EF7/\u4EBA\u529B\u8D44\u6E90\u90E8 \u4E09\u9636\u6BB5 \u8282\u70B9id
evaluateNewEmploy_third_nodeid=382
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u8BC4\u4EF7\u63D0\u9192 \u6D88\u606F\u6765\u6E90 id
evaluateNewEmploy_message_id=1371
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u76EE\u6807\u786E\u5B9A \u6D41\u7A0B\u8868\u540D
goalNewEmploy_table=formtable_main_93
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u76EE\u6807\u786E\u5B9A workflowid
goalNewEmploy_workflowid=46
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u76EE\u6807\u786E\u5B9A \u5458\u5DE5\u672C\u4EBA\u8282\u70B9\u88AB\u63D0\u9192\u89D2\u8272 \u4EBA\u529B\u8D44\u6E90\u90E8 \u89D2\u8272id \u6307\u5B9A\u63D0\u9192\u7684\u4EBA\u5458\u5728\u8FD9\u4E2A\u89D2\u8272\u7EF4\u62A4
message_hrm_roleid=34
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u76EE\u6807\u786E\u5B9A \u5458\u5DE5\u672C\u4EBA \u8282\u70B9id
goalNewEmploy_two_nodeid=451
# \u65B0\u5458\u5DE5\u8BD5\u7528\u671F\u76EE\u6807\u786E\u5B9A \u6D88\u606F\u6765\u6E90 id
goalNewEmploy_message_id=1238
# \u6559\u80B2\u7ECF\u5386 \u6A21\u5757id
jyjl_formmodeid=5
# \u5DE5\u4F5C\u7ECF\u5386 \u6A21\u5757id
gzjl_formmodeid=7
# \u5BB6\u5EAD\u60C5\u51B5 \u6A21\u5757id
jtqk_formmodeid=72
# \u52A0\u5165\u5F53\u524D\u5C97\u4F4D\u65F6\u95F4 \u81EA\u5B9A\u4E49\u5B57\u6BB5id
jrdqgwsj_fieldid=field54
# \u52A8\u8BAE\u915D\u917F \u6D41\u7A0B\u8868\u540D
proposal_brewing_workflowid=27
# \u52A8\u8BAE\u915D\u917F \u6D41\u7A0B\u8868\u540D
proposal_brewing_table=formtable_main_52
# \u53D1\u5E03\u7ADE\u8058\u516C\u544A workflowid
recruitment_announcement_workflowid=28
# \u53D1\u5E03\u7ADE\u8058\u516C\u544A \u6D41\u7A0B\u8868\u540D
recruitment_announcement_table=formtable_main_53
# \u7ADE\u8058\u62A5\u540D workflowid
competitionRegistration_workflowid=29
# \u7ADE\u8058\u62A5\u540D \u6D41\u7A0B\u8868\u540D
competitionRegistration_table=formtable_main_55
# \u62A5\u540D\u60C5\u51B5\u5BA1\u6838 workflowid
registrationStatusReview_workflowid=122
# \u62A5\u540D\u60C5\u51B5\u5BA1\u6838 \u6D41\u7A0B\u8868\u540D
registrationStatusReview_table=formtable_main_198
# \u516C\u5E03\u7ADE\u8058\u4EBA\u5458\u540D\u5355 workflowid
gbjprymd_workflowid=30
# \u516C\u5E03\u7ADE\u8058\u4EBA\u5458\u540D\u5355 \u6D41\u7A0B\u8868\u540D
gbjprymd_table=formtable_main_56
# \u7ADE\u8058\u7B54\u8FA9 workflowid
competition_defense_workflowid=32
# \u7ADE\u8058\u7B54\u8FA9 \u6D41\u7A0B\u8868\u540D
competition_defense_table=formtable_main_59
# \u53D1\u5E03\u7ADE\u8058\u5165\u56F4\u8005\u540D\u5355\u516C\u544A workflowid
fbjprwzmdgg_workflowid=33
# \u53D1\u5E03\u7ADE\u8058\u5165\u56F4\u8005\u540D\u5355\u516C\u544A \u6D41\u7A0B\u8868\u540D
fbjprwzmdgg_table=formtable_main_61
# \u6C11\u65CF\u6D4B\u8BC4\u8BB0\u5F55 workflowid
democratic_appraisal_workflowid=34
# \u6C11\u65CF\u6D4B\u8BC4\u8BB0\u5F55 \u6D41\u7A0B\u8868\u540D
democratic_appraisal_table=formtable_main_62
# \u8003\u5BDF\u8C08\u8BDD workflowid
examination_conversation_workflowid=35
# \u8003\u5BDF\u8C08\u8BDD \u6D41\u7A0B\u8868\u540D
examination_conversation_table=formtable_main_64
# \u5E72\u90E8\u4EFB\u514D\u5BA1\u6279\u8868 workflowid
cadre_appoint_workflowid=37
# \u5E72\u90E8\u4EFB\u514D\u5BA1\u6279\u8868 \u6D41\u7A0B\u8868\u540D
cadre_appoint_table=formtable_main_67
# \u5404\u7C7B\u6750\u6599 workflowid
various_materials_workflowid=36
# \u5404\u7C7B\u6750\u6599 \u6D41\u7A0B\u8868\u540D
various_materials_table=formtable_main_66
# \u603B\u652F\u59D4\u4F1A workflowid
general_branch_committee_workflowid=38
# \u603B\u652F\u59D4\u4F1A \u6D41\u7A0B\u8868\u540D
general_branch_committee_table=formtable_main_68
# \u4E3B\u4EFB\u529E\u516C\u4F1A workflowid
director_office_meeting_workflowid=39
# \u4E3B\u4EFB\u529E\u516C\u4F1A \u6D41\u7A0B\u8868\u540D
director_office_meeting_table=formtable_main_69
# \u4EFB\u524D\u516C\u793A workflowid
pre_employment_announcement_workflowid=40
# \u4EFB\u524D\u516C\u793A \u6D41\u7A0B\u8868\u540D
pre_employment_announcement_table=formtable_main_70
# \u8058\u4EFB\u53D1\u6587 workflowid
appointment_document_workflowid=41
# \u8058\u4EFB\u53D1\u6587 \u6D41\u7A0B\u8868\u540D
appointment_document_table=formtable_main_71
# \u751F\u6210\u7EAA\u5B9E\u8868 workflowid
documentary_table_workflowid=125
# \u751F\u6210\u7EAA\u5B9E\u8868 \u6D41\u7A0B\u8868\u540D
documentary_table_table=formtable_main_202

View File

@ -1,43 +0,0 @@
# \u9996\u6B21\u53C2\u52A0\u5DE5\u4F5C\u65E5\u671F \u81EA\u5B9A\u4E49\u5B57\u6BB5id
cjgzrq_fieldid=field42
# \u6263\u51CF\u793E\u4F1A\u5DE5\u9F84 \u81EA\u5B9A\u4E49\u5B57\u6BB5id
kjshgl_fieldid=field19
# \u5E74\u9F84 \u81EA\u5B9A\u4E49\u5B57\u6BB5id
age_fieldid=field9
# \u751F\u65E5 \u81EA\u5B9A\u4E49\u5B57\u6BB5id
birth_fieldid=field37
# \u8003\u52E4\u62A5\u8868\u9501\u5B9A \u6A21\u5757id
kqbbsd_formmodeid=84
# \u8003\u52E4\u62A5\u8868\u9501\u5B9A \u6A21\u5757id
kqbbsdtxjlb_formmodeid=86
# \u5916\u51FA\u7533\u8BF7\u5355 \u6D41\u7A0Bid
wcsqd_wf_id=55
# \u57F9\u8BAD\u5916\u51FA\u7533\u8BF7\u5355 \u6D41\u7A0Bid
pxwcsqd_wf_id=19
# \u8865\u5361\u7533\u8BF7\u5355 \u6D41\u7A0Bid
bksqd_wf_id=58
# \u9500\u5047\u7533\u8BF7\u5355 \u6D41\u7A0Bid
xjsqd_wf_id=59
# \u8BF7\u5047\u7533\u8BF7\u5355 \u6D41\u7A0Bid
qjsqd_wf_id=62
# \u51FA\u5DEE\u7533\u8BF7\u5355 \u6D41\u7A0Bid
ccsqd_wf_id=124
# \u8003\u52E4\u4FEE\u6B63\u7533\u8BF7\u5355 \u6D41\u7A0Bid
kqszsqd_wf_id=123

View File

@ -1,32 +0,0 @@
<%@ page import="weaver.general.Util" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="bb" class="weaver.general.BaseBean" />
<%
int nodeid = Util.getIntValue(request.getParameter("nodeid"));//流程的节点id
bb.writeLog("========== 加班申请流程 nodeid ============"+ nodeid);
String sql = "select isstart from workflow_nodebase where id = " + nodeid;
rs.execute(sql);
rs.next();
int isstart = Util.getIntValue(rs.getString("isstart"));//判断是否是流程创建节点 1是 0
%>
<script type="text/javascript">
jQuery(document).ready(function(){
var xmid = WfForm.convertFieldNameToId("xm", "detail_1");
var bmqkid = WfForm.convertFieldNameToId("bmqk", "detail_1");
let rowIndexs = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
for(let i=0;i<rowIndexs.length;i++){
let rowIndex = rowIndexs[i];
let xmname = WfForm.getBrowserShowName(xmid+"_"+rowIndex);
let bmrequestid = WfForm.getFieldValue(bmqkid+"_"+rowIndex);
let url = '/spa/workflow/static4form/index.html?#/main/workflow/req?requestid='+bmrequestid+'&ismonitor=1';
let aa = '<a href="javascript:void(0);" onclick="window.open(\''+url+'\')">'+xmname+'</a>';
console.log(aa);
WfForm.changeFieldValue(bmqkid+"_"+rowIndex,{value:aa});
}
});
</script>

View File

@ -1,222 +0,0 @@
<%@ page import="weaver.general.Util" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="bb" class="weaver.general.BaseBean" />
<%
int nodeid = Util.getIntValue(request.getParameter("nodeid"));//流程的节点id
bb.writeLog("========== 加班申请流程 nodeid ============"+ nodeid);
String sql = "select isstart from workflow_nodebase where id = " + nodeid;
rs.execute(sql);
rs.next();
int isstart = Util.getIntValue(rs.getString("isstart"));//判断是否是流程创建节点 1是 0
%>
<script type="text/javascript">
jQuery(document).ready(function(){
function tiaoHref(bmjzsj,url){
var date = new Date();
var year = date.getFullYear(); // 年份
var month = date.getMonth() + 1; // 月份返回值为0-11所以需要加1
var day = date.getDate(); // 日期
// 对月份和日期进行补零
month = month < 10 ? '0' + month : month.toString();
day = day < 10 ? '0' + day : day.toString();
var currentDate1 = year + '-' +month + '-' + day;
console.log(currentDate1);
let currentDate = new Date(currentDate1);
let dateObj = new Date(bmjzsj);
let dateTimestamp = dateObj.getTime();
let currentTimestamp = currentDate.getTime();
console.log(dateTimestamp);
console.log(currentTimestamp);
if (dateObj < currentDate) {
window.weaJs.alert("此次报名已截止!");
return;
} else if (dateObj >= currentDate) {
window.open(url);
}
}
const signFlowId = 29;
const createUrl = '/spa/workflow/static4form/index.html#/main/workflow/req?iscreate=1&workflowid='
let bm_id = WfForm.convertFieldNameToId('bm');
let bmjzsj_id = WfForm.convertFieldNameToId('bmjzsj');
let pxmc_value = 3;
if(pxmc_value){
let bmjzsj = WfForm.getFieldValue(bmjzsj_id);
let url = createUrl + signFlowId + '&xm=' + pxmc_value;
url = '<a onclick="tiaoHref('+bmjzsj+','+url+')" href="javascript:void(0)">报名链接</a>';
WfForm.changeFieldValue(bm_id, {value: url})
WfForm.changeFieldAttr(bm_id, 1); //字段修改为只读
}
//岗位名称
let gwmc_id = WfForm.convertFieldNameToId("gwmc","detail_1");
WfForm.bindDetailFieldChangeEvent(gwmc_id,function(id,rowIndex,value){
if(value){
var options = {
url: '/interface/wuyuan/checkHasGwmc.jsp',
method: 'POST',
params : {gwmc:value}
};
window.weaJs.callApi(options).then(function(res) {
let flag = res.flag;
if(flag){
WfForm.showMessage("第"+(parseInt(rowIndex)+1)+"行,岗位名称已存在!");
//WfForm.changeFieldValue(gwmc_id+"_"+rowIndex, {value:""});
}
});
}
});
WfForm.registerCheckEvent(WfForm.OPER_SAVE+","+WfForm.OPER_SUBMIT,function(callback){
var lines = "";
var a = "0";
var gwmcid = WfForm.convertFieldNameToId("gwmc", "detail_1");
var xh_detail2 = WfForm.getDetailAllRowIndexStr('detail_1');
var xhs2 = xh_detail2.split(',');
for(var i=0;i<xhs2.length;i++) {
var xh2 = xhs2[i];
var gwmc = WfForm.getFieldValue(gwmcid+'_'+xh2);
var options = {
url: '/interface/wuyuan/checkHasGwmc.jsp',
method: 'POST',
params : {gwmc:gwmc}
};
window.weaJs.callApi(options).then(function(res) {
let flag = res.flag;
if(flag){
a = "1";
lines = lines + ""+(i+1);
}
});
}
if(a == "1"){
window.weaJs.alert("第"+lines.substring(1)+"行 岗位名称已存在!");
return;
}else{
callback();
}
});
let ksrq_id = WfForm.convertFieldNameToId("ks");
let jsrq_id = WfForm.convertFieldNameToId("js");
var pxksrq_id = WfForm.convertFieldNameToId("pxksrq", "detail_1");
var pxkssj_id = WfForm.convertFieldNameToId("pxkssj", "detail_1");
var pxjsrq_id = WfForm.convertFieldNameToId("pxjsrq", "detail_1");
var pxjssj_id = WfForm.convertFieldNameToId("pxjssj", "detail_1");
WfForm.bindFieldChangeEvent(ksrq_id,function(obj,id,value){
if(value){
let ksrq = value.substring(0,10);
var xh_detail1 = WfForm.getDetailAllRowIndexStr('detail_1');
if (xh_detail1.length > 0) {
var xhs1 = xh_detail1.split(',');
for (var i = 0; i < xhs1.length; i++) {
var xh1 = xhs1[i];
WfForm.changeFieldValue(pxksrq_id+'_'+xh1, {value: ksrq});
}
}
}else{
var xh_detail1 = WfForm.getDetailAllRowIndexStr('detail_1');
if (xh_detail1.length > 0) {
var xhs1 = xh_detail1.split(',');
for (var i = 0; i < xhs1.length; i++) {
var xh1 = xhs1[i];
WfForm.changeFieldValue(pxksrq_id+'_'+xh1, {value: ''});
}
}
}
})
WfForm.bindFieldChangeEvent(jsrq_id,function(obj,id,value){
if(value){
let ksrq = value.substring(0,10);
var xh_detail1 = WfForm.getDetailAllRowIndexStr('detail_1');
if (xh_detail1.length > 0) {
var xhs1 = xh_detail1.split(',');
for (var i = 0; i < xhs1.length; i++) {
var xh1 = xhs1[i];
WfForm.changeFieldValue(pxjsrq_id+'_'+xh1, {value: ksrq});
}
}
}else{
var xh_detail1 = WfForm.getDetailAllRowIndexStr('detail_1');
if (xh_detail1.length > 0) {
var xhs1 = xh_detail1.split(',');
for (var i = 0; i < xhs1.length; i++) {
var xh1 = xhs1[i];
WfForm.changeFieldValue(pxjsrq_id+'_'+xh1, {value: ''});
}
}
}
})
WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){
var value = WfForm.getFieldValue(ksrq_id);
let ksrq = value.substring(0,10);
let kssj = value.substring(12,16);
WfForm.changeFieldValue(pxksrq_id+'_'+index, {value: ksrq});
WfForm.changeFieldValue(pxkssj_id+'_'+index, {value: kssj});
var value2 = WfForm.getFieldValue(jsrq_id);
let jsrq = value2.substring(0,10);
let jssj = value2.substring(12,16);
WfForm.changeFieldValue(pxjsrq_id+'_'+index, {value: jsrq});
WfForm.changeFieldValue(pxjssj_id+'_'+index, {value: jssj});
});
});
jQuery(document).ready(function(){
var b = "0";
//控制 是否继续流转 1-是 2-否
let mxsfwcdfdws_id = WfForm.convertFieldNameToId("mxsfwcdfdws");
//轮转情况下 操作人
let lzqkxczr_id = WfForm.convertFieldNameToId("lzqkxczr");
//是否完成答复 0-是 1-否 2-需进一步明确
let sfwcdf_id = WfForm.convertFieldNameToId("sfwcdf", "detail_1");
//经办人
let jbr_id = WfForm.convertFieldNameToId("jbr", "detail_1");
//经办人姓名
let jbrxm_id = WfForm.convertFieldNameToId("jbrxm", "detail_1");
let jbrs = '';
let jbrxms = '';
var xh_detail1 = WfForm.getDetailCheckedRowIndexStr("detail_1");
var xhs1 = xh_detail1.split(',');
for(var i=0;i<xhs1.length;i++) {
var xh1 = xhs1[i];
var sfwcdf = WfForm.getFieldValue(sfwcdf_id+"_"+xh1);
var jbr = WfForm.getFieldValue(jbr_id+"_"+xh1);
var jbrxm = WfForm.getFieldValue(jbrxm_id+"_"+xh1);
if(parseInt(sfwcdf) > 0){
b = "1";
jbrs += jbr+',';
jbrxms += {id:jbr,name:jbrxm}+',';
}
}
jbrs = jbrs.substring(1);
jbrxms = jbrxms.substring(1);
//还需要继续流转
if(b=='1'){
//
WfForm.changeFieldValue(mxsfwcdfdws_id,{vale:1});
//
WfForm.changeFieldValue(lzqkxczr_id, {value: jbrs, specialobj:[jbrxms]});
}else{
WfForm.changeFieldValue(mxsfwcdfdws_id,{vale:2});
}
});
</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
boolean flag = false;
String gwmc = Util.null2String(request.getParameter("gwmc"));
rs.executeQuery("select * from hrmjobtitles where 1=1 and (canceled is null or canceled='0') and (jobtitlename=? or jobtitlemark=?)",gwmc,gwmc);
if(rs.next()) {
flag = true;
}
jsonObject.put("flag",flag);
out.print(JSONObject.toJSONString(jsonObject));
%>

View File

@ -1,23 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
boolean flag = false;
String requestid = Util.null2String(request.getParameter("requestid"));
String competitionRegistration_table = rs.getPropValue("hrm_wuyuan","competitionRegistration_table");
rs.executeQuery("select * from "+competitionRegistration_table+" where requestid=?",requestid);
while(rs.next()) {
//查看报名结果 0-通过 1-不通过
String ckbmjg = Util.null2String(rs.getString("ckbmjg"));
if(ckbmjg != null && !"".equals(ckbmjg)){
if(Integer.parseInt(ckbmjg)==0 || Integer.parseInt(ckbmjg)==1){
flag = true;
}
}
}
jsonObject.put("flag",flag);
out.print(JSONObject.toJSONString(jsonObject));
%>

View File

@ -1,108 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="weaver.general.TimeUtil" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject data = new JSONObject();
String currentDate = TimeUtil.getCurrentDateString();
String fromDate = getMonthByDateStr(currentDate)+"-01";
//发起审批按钮
boolean fqsp_flag = false;
//确认按钮
boolean qr_flag = false;
//
String has_fqsp = "0";
//
String has_qr = "0";
User user = HrmUserVarify.getUser(request, response);
int userid = user.getUID();
int deptid = user.getUserDepartment();
//
String bmfzrids = "";
String kqglyids = "";
rs.executeQuery("select bmfzr,kqgly from Matrixtable_2 ");
while(rs.next()){
String bmfzr = Util.null2String(rs.getString("bmfzr"));
bmfzrids += bmfzr +",";
String kqgly = Util.null2String(rs.getString("kqgly"));
kqglyids += kqgly +",";
}
if(bmfzrids.endsWith(",")){
bmfzrids = bmfzrids.substring(0,bmfzrids.length()-1);
}
if(kqglyids.endsWith(",")){
kqglyids = kqglyids.substring(0,kqglyids.length()-1);
}
if((","+bmfzrids+",").contains(","+userid+",")){
qr_flag = true;
}
if((","+kqglyids+",").contains(","+userid+",")){
fqsp_flag = true;
}
if(userid == 1){
fqsp_flag = true;
qr_flag = true;
}
//如果已经有了记录,考勤确认提醒按钮置灰
rs.executeQuery("select id from uf_kqbbsdtxjlb where ksrq=? and bm=?",fromDate,deptid);
if(rs.next()){
has_fqsp = "1";
}
//如果已经有了记录,确认考勤按钮置灰
rs.executeQuery("select id from uf_kqbbsd where ksrq=? and bm=? and sfsd='0'",fromDate,deptid);
if(rs.next()){
has_qr = "1";
}
data.put("fqsp_flag",fqsp_flag);
data.put("qr_flag",qr_flag);
data.put("has_fqsp",has_fqsp);
data.put("has_qr",has_qr);
out.print(data.toJSONString());
%>
<%!
/**
* 获取日期字符串中的年月份
* @param dateString
* @return
*/
public static String getMonthByDateStr(String dateString){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
String result = "";
try {
// 解析日期字符串并获取LocalDate对象
LocalDate date = LocalDate.parse(dateString, formatter);
int year = date.getYear();
System.out.println(year);
// 获取月份1代表1月...12代表12月
int month = date.getMonthValue(); // 或者使用date.getMonth().getValue()也是可以的,两者效果相同
System.out.println("月份: " + month); // 输出4因为4月是第4个月份
result += year+"-";
System.out.println(result);
if(month > 10){
result += ""+month;
}else{
result += "0"+month;
}
} catch (DateTimeParseException e) {
System.out.println("日期格式错误"); // 如果日期字符串格式不正确,将抛出异常并打印错误信息
}
return result;
}
%>

View File

@ -1,204 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="javax.crypto.spec.SecretKeySpec" %>
<%@ page import="javax.crypto.spec.IvParameterSpec" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.util.Map" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.HashMap" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
String APP_SECRET = "YVBKbcEQSXlwcpOxjOGRhODWASSkzg";
String data = System.currentTimeMillis() + "||" + APP_SECRET;
String IV = APP_SECRET.substring(APP_SECRET.length() - 16);
String key = APP_SECRET.substring(0, 16);
String sign = encryptData(data, key, IV);
System.out.println(sign);
String url = "http://192.168.10.54:7123/hklearn/api/access/getUserToken";
String username = "SZ001";
Map<String,String> headers = new HashMap<>();
String encode = "utf-8";
JSONObject param = new JSONObject();
param.put("username",username);
param.put("sign",sign);
jsonObject.put("url",url);
jsonObject.put("sign",sign);
jsonObject.put("username",username);
String token = httpGetToken(url,param.toString(),headers,"utf-8");
jsonObject.put("token",token);
out.print(jsonObject.toJSONString());
%>
<%!
/**
*
* @param data 需要加密的数据
* @param key 秘钥
* @param IV 偏移量
* @return
*/
private static String encryptData(String data, String key, String IV) {
try {
//算法/模式/填充模式 AES/CBC/PKCS5Padding
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
int plaintextLength = dataBytes.length;
byte[] plaintext = new byte[plaintextLength];
System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivspec = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
byte[] encrypted = cipher.doFinal(plaintext);
//输出内容Base64处理
return new String(Base64.encodeBase64(encrypted));
} catch (Exception e) {
return null;
}
}
/**
* 发送 http post 请求,参数以原生字符串进行提交
* @param url
* @param encode
* @return
*/
public static String httpGetToken(String url, String stringJson, Map<String,String> headers, String encode){
if(encode == null){
encode = "utf-8";
}
String result = "";
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
//HttpClients.createDefault()等价于 HttpClientBuilder.create().build();
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
httpost.setHeader("Content-type", "application/json");
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
//组织请求参数
StringEntity stringEntity = new StringEntity(stringJson, encode);
httpost.setEntity(stringEntity);
//响应信息
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
String content = EntityUtils.toString(entity, encode);
if(content != null && !"".equals(content)){
JSONObject jsonObject = JSONObject.parseObject(content);
int code = (int) jsonObject.get("code");
if(code==10000){
String data = jsonObject.get("data").toString();
JSONObject jsonObject1 = JSONObject.parseObject(data);
result = jsonObject1.get("accessToken").toString();
}
}
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
/**
* 发送 http post 请求,参数以原生字符串进行提交
* @param url
* @param encode
* @return
*/
public static boolean httpPostJson(String url, String stringJson, Map<String,String> headers, String encode){
if(encode == null){
encode = "utf-8";
}
boolean result = false;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
//HttpClients.createDefault()等价于 HttpClientBuilder.create().build();
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
httpost.setHeader("Content-type", "application/json");
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
//组织请求参数
StringEntity stringEntity = new StringEntity(stringJson, encode);
httpost.setEntity(stringEntity);
//响应信息
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
String content = EntityUtils.toString(entity, encode);
if(content != null && !"".equals(content)){
JSONObject jsonObject = JSONObject.parseObject(content);
int code = (int) jsonObject.get("code");
if(code==10000){
result = true;
}
}
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
%>

View File

@ -1,88 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
boolean flag = false;
String mainid = Util.null2String(request.getParameter("mainid"));
String workflowid = "43";
String url = "/spa/workflow/index_form.jsp#/main/workflow/req?iscreate=1&workflowid="+workflowid;
rs.executeQuery("select * from uf_xygrztz where id=?",mainid);
while(rs.next()) {
rs1.executeQuery(" select a.* from workflow_billfield a,workflow_bill b where b.tablename='uf_xygrztz' and a.billid=b.id and viewtype='0' ");
while (rs1.next()) {
String fieldname = Util.null2String(rs1.getString("fieldname"));
String fieldvalue = Util.null2String(rs.getString(fieldname));
if(fieldvalue != null && !"".equals(fieldvalue)){
String fieldid = getFieldId(fieldname);
url += "&" + fieldid + "=" + fieldvalue;
if ("sfzhm".equals(fieldname)) {
flag = checkHasWorkflow(fieldvalue);
}
}
}
}
jsonObject.put("flag",flag);
jsonObject.put("url",url);
out.print(JSONObject.toJSONString(jsonObject));
%>
<%!
public static String getFieldId(String fieldname){
RecordSet rs = new RecordSet();
String fieldid = "field";
String billid = "-89";
rs.executeQuery("select * from workflow_billfield where billid=? and viewtype=0 and fieldname=?",billid,fieldname);
if(rs.next()){
String id = Util.null2String(rs.getString("id"));
fieldid += id;
}
return fieldid;
}
public static boolean checkHasWorkflow(String sfzh){
boolean flag = false;
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
RecordSet rs1 = new RecordSet();
String billid = "-89";
rs.executeQuery("select * from workflow_bill where id=?",billid);
rs.next();
String tablename = Util.null2String(rs.getString("tablename"));
rs1.executeQuery("select * from "+ tablename +" where sfzhm=?",sfzh);
while(rs1.next()){
String requestid = Util.null2String(rs1.getString("requestid"));
rst.executeQuery("select currentnodetype from workflow_requestbase where requestid=?",requestid);
rst.next();
String currentnodetype = Util.null2String(rst.getString("currentnodetype"));
//非创建节点
if(!"0".equals(currentnodetype)){
flag = true;
break;
}else{
boolean bool = checkHasWorkflowLog(requestid);
if(bool){
flag = true;
break;
}
}
}
return flag;
}
public static boolean checkHasWorkflowLog(String requestid){
boolean flag = false;
RecordSet rs = new RecordSet();
rs.executeQuery("select * from workflow_requestlog where logtype='3' and requestid=?",requestid);
if(rs.next()){
flag = true;
}
return flag;
}
%>

View File

@ -1,125 +0,0 @@
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="weaver.general.*,java.util.*,java.math.*" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.temporal.ChronoUnit" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.Period" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rst" class="weaver.conn.RecordSet" scope="page" />
<%
int sum = 0;
String sss = "";
String companystartdate = request.getParameter("companystartdate");
String id = request.getParameter("userid");
//参加工作日期
String cjgzrq = request.getParameter("cjgzrq");
//扣减社会工龄
String kjshgl = request.getParameter("kjshgl");
// 首次参加工作日期 自定义字段
String cjgzrq_fieldid = rs.getPropValue("wuyuan_hrminfo","cjgzrq_fieldid");
// 扣减社会工龄 自定义字段id
String kjshgl_fieldid = rs.getPropValue("wuyuan_hrminfo","kjshgl_fieldid");
//司龄
String companyworkyear = "0";
if(companystartdate != null && !"".equals(companystartdate)){
int company_year = Integer.parseInt(companystartdate.substring(0,4));
int company_month = Integer.parseInt(companystartdate.substring(5,7));
int company_day = Integer.parseInt(companystartdate.substring(8,10));
companyworkyear = calculateCompanyAge(company_year,company_month,company_day);
sss += "update hrmresource set companyworkyear='"+companyworkyear+"' where id="+ id;
}
//参加工作日期
// String cjgzrq = Util.null2String(getFieldValue(cjgzrq_fieldid,id));
//扣减社会工龄
// String kjshgl = Util.null2o(getFieldValue(kjshgl_fieldid,id));
String age = calculateAge(cjgzrq);
if(cjgzrq != null && !"".equals(cjgzrq)){
sss += "update hrmresource set workstartdate='"+cjgzrq+"' where id="+ id;
if(Float.valueOf(kjshgl) > 0){
String endAge = String.valueOf(new BigDecimal(age).subtract(new BigDecimal(kjshgl)));
sss += "update hrmresource set workyear='"+endAge+"' where id="+id;
}else{
sss += "update hrmresource set workyear='"+age+"' where id="+id;
}
}
sum++;
%>
<%!
public String getFieldValue(String type,String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select "+type+" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",userid);
if(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
/**
* 根据 日期 计算年龄
* @param birthdate
* @return
*/
public String calculateAge(String birthdate) {
String result = "0";
try {
// 解析日期
LocalDate startDate = LocalDate.parse(birthdate);
LocalDate endDate = LocalDate.now();
// 计算工龄(月份)
long monthsBetween = ChronoUnit.MONTHS.between(startDate, endDate);
// 将月份转换为年并格式化为2位小数
double years = (double) monthsBetween / 12;
DecimalFormat df = new DecimalFormat("0.00"); // 设置格式为2位小数
result = df.format(years);
}catch (Exception e){
e.printStackTrace();
}
return result;
}
public String calculateCompanyAge(int year,int month,int day){
String result = "";
// 假设入职日期是2020年1月1日
LocalDate hireDate = LocalDate.of(year, month, day);
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算司龄总月份数除以12
double monthsBetween = Math.abs(Period.between(hireDate, currentDate).getMonths()) + 12 * Math.abs(Period.between(hireDate, currentDate).getYears());
double serviceYears = monthsBetween / 12.0; // 注意这里已经是总月份数除以12的结果可以直接格式化输出
// 使用DecimalFormat格式化输出保留两位小数
DecimalFormat df = new DecimalFormat("#.##"); // 注意这里的格式化符号使用的是英文的点号和井号,而不是中文的井号和井号。
result = df.format(serviceYears);
return result;
}
%>
<HEAD>
</HEAD>
<BODY>
<h1>Congratulation Mode 666666 !</h1>
<h1> sss <%=sss%> </h1>
<h1> sum <%=sum%> </h1>
</BODY>

View File

@ -1,302 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="weaver.conn.RecordSet" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs3" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
boolean flag = false;
String mobile = Util.null2String(request.getParameter("mobile"));
rs.executeQuery("select * from uf_sxszqbssjtz where yddh=?",mobile);
while(rs.next()) {
//民族
String mz = Util.null2String(rs.getString("mz"));
jsonObject.put("mz",mz);
//籍贯
String jg = Util.null2String(rs.getString("jg"));
jsonObject.put("jg",jg);
//个人邮箱
String gryx = Util.null2String(rs.getString("gryx"));
jsonObject.put("gryx",gryx);
//户口类别
String hklb = Util.null2String(rs.getString("hklb"));
jsonObject.put("hklb",hklb);
//现通讯地址
String xtxdz = Util.null2String(rs.getString("xtxdz"));
jsonObject.put("xtxdz",xtxdz);
//学校
String xx = Util.null2String(rs.getString("xx"));
jsonObject.put("xx",xx);
//姓名
String xm = Util.null2String(rs.getString("xm"));
jsonObject.put("xm",xm);
//政治面貌
String zzmm = Util.null2String(rs.getString("zzmm"));
String zzmmname = getSelectNameById("11252",zzmm);
String newzzmm = getSelectidByName("8342",zzmmname);
jsonObject.put("zzmm",newzzmm);
//学历
String xl = Util.null2String(rs.getString("xl"));
jsonObject.put("xl",xl);
//专业
String zy = Util.null2String(rs.getString("zy"));
jsonObject.put("zy",zy);
//性别
String xb = Util.null2String(rs.getString("xb"));
jsonObject.put("xb",xb);
//身份证号码
String sfzhm = Util.null2String(rs.getString("sfzhm"));
jsonObject.put("sfzhm",sfzhm);
}
//教育经历
JSONArray jyjl_array = new JSONArray();
rs1.executeQuery("select * from uf_jxjl where yddh=?",mobile);
while(rs1.next()) {
JSONObject jsonObject1 = new JSONObject();
//入学时间
String rxsj = Util.null2String(rs1.getString("rxsj"));
if(rxsj != null && !"".equals(rxsj)) {
jsonObject1.put("rxsj", rxsj);
}
//毕业时间
String bysj = Util.null2String(rs1.getString("bysj"));
if(bysj != null && !"".equals(bysj)) {
jsonObject1.put("bysj", bysj);
}
//毕业院校
String byyx = Util.null2String(rs1.getString("byyx"));
if(byyx != null && !"".equals(byyx)) {
jsonObject1.put("byyx", byyx);
}
//学习专业
String xxzy = Util.null2String(rs1.getString("xxzy"));
if(xxzy != null && !"".equals(xxzy)) {
jsonObject1.put("xxzy", xxzy);
}
//院校类别
String yxlb = Util.null2String(rs1.getString("yxlb"));
if(yxlb != null && !"".equals(yxlb)) {
jsonObject1.put("yxlb", yxlb);
}
//所在学院
String szxy = Util.null2String(rs1.getString("szxy"));
if(szxy != null && !"".equals(szxy)){
jsonObject1.put("szxy",szxy);
}
//学制
String xz = Util.null2String(rs1.getString("xz"));
if(xz != null && !"".equals(xz)){
jsonObject1.put("xz",xz);
}
//学习形式
String xxxs = Util.null2String(rs1.getString("xxxs"));
if(xxxs != null && !"".equals(xxxs)){
jsonObject1.put("xxxs",xxxs);
}
//是否最高学历
String sfzgxl = Util.null2String(rs1.getString("sfzgxl"));
if(sfzgxl != null && !"".equals(sfzgxl)){
jsonObject1.put("sfzgxl",sfzgxl);
}
//学位
String xw = Util.null2String(rs1.getString("xw"));
if(xw != null && !"".equals(xw)){
jsonObject1.put("xw",xw);
}
//学位授予日期
String xwsyrq = Util.null2String(rs1.getString("xwsyrq"));
if(xwsyrq != null && !"".equals(xwsyrq)){
jsonObject1.put("xwsyrq",xwsyrq);
}
//学位专业名称
String xwzymc = Util.null2String(rs1.getString("xwzymc"));
if(xwzymc != null && !"".equals(xwzymc)){
jsonObject1.put("xwzymc",xwzymc);
}
//学位类别
String xwlb = Util.null2String(rs1.getString("xwlb"));
if(xwlb != null && !"".equals(xwlb)){
jsonObject1.put("xwlb",xwlb);
}
//是否最高学位
String sfzgxw = Util.null2String(rs1.getString("sfzgxw"));
if(sfzgxw != null && !"".equals(sfzgxw)){
jsonObject1.put("sfzgxw",sfzgxw);
}
//学历
String xl1 = Util.null2String(rs1.getString("xl1"));
if(xl1 != null && !"".equals(xl1)){
jsonObject1.put("xl1",xl1);
}
//身份证号开发用
String sfzhkfy = Util.null2String(rs1.getString("sfzhkfy"));
if(sfzhkfy != null && !"".equals(sfzhkfy)){
jsonObject1.put("sfzhkfy",sfzhkfy);
}
jyjl_array.add(jsonObject1);
}
jsonObject.put("jyjls",jyjl_array);
//家庭情况
JSONArray jtqk_array = new JSONArray();
rs2.executeQuery("select * from uf_jtqk where yddh=?",mobile);
while(rs2.next()) {
JSONObject jsonObject1 = new JSONObject();
//关系
String gx = Util.null2String(rs2.getString("gx"));
if(gx != null && !"".equals(gx)) {
jsonObject1.put("gx", gx);
}
//家庭成员姓名
String jtcyxm = Util.null2String(rs2.getString("jtcyxm"));
if(jtcyxm != null && !"".equals(jtcyxm)) {
jsonObject1.put("jtcyxm", jtcyxm);
}
//工作单位
String gzdw = Util.null2String(rs2.getString("gzdw"));
if(gzdw != null && !"".equals(gzdw)) {
jsonObject1.put("gzdw", gzdw);
}
//政治面貌
String zzmm = Util.null2String(rs2.getString("zzmm"));
if(zzmm != null && !"".equals(zzmm)) {
String zzmmname = getSelectNameById("11252", zzmm);
String newzzmm = getSelectidByName("10661", zzmmname);
jsonObject1.put("zzmm", newzzmm);
}
//出生日期
String csrq = Util.null2String(rs2.getString("csrq"));
if(csrq != null && !"".equals(csrq)) {
jsonObject1.put("csrq", csrq);
}
//职务
String zw = Util.null2String(rs2.getString("zw"));
if(zw != null && !"".equals(zw)) {
jsonObject1.put("zw", zw);
}
//身份证号码
String sfzhm = Util.null2String(rs2.getString("sfzhm"));
if(sfzhm != null && !"".equals(sfzhm)) {
jsonObject1.put("sfzhm", sfzhm);
}
//身份证号开发用
String sfzhkfy = Util.null2String(rs2.getString("sfzhkfy"));
if(sfzhkfy != null && !"".equals(sfzhkfy)) {
jsonObject1.put("sfzhkfy", sfzhkfy);
}
jtqk_array.add(jsonObject1);
}
jsonObject.put("jtqks",jtqk_array);
//工作经历
JSONArray gzjl_array = new JSONArray();
rs3.executeQuery("select * from uf_gzjj where yddh=?",mobile);
while(rs3.next()) {
JSONObject jsonObject1 = new JSONObject();
//劳动关系所属单位
String ldgxszdw = Util.null2String(rs3.getString("ldgxszdw"));
if(ldgxszdw != null && !"".equals(ldgxszdw)) {
jsonObject1.put("ldgxszdw", ldgxszdw);
}
//履历单位
String lldw = Util.null2String(rs3.getString("lldw"));
if(lldw != null && !"".equals(lldw)) {
jsonObject1.put("lldw", lldw);
}
//起始时间
String qssj = Util.null2String(rs3.getString("qssj"));
if(qssj != null && !"".equals(qssj)) {
jsonObject1.put("qssj", qssj);
}
//终止时间
String zzsj = Util.null2String(rs3.getString("zzsj"));
if(zzsj != null && !"".equals(zzsj)) {
jsonObject1.put("zzsj", zzsj);
}
//工作履历
String gzll = Util.null2String(rs3.getString("gzll"));
if(gzll != null && !"".equals(gzll)) {
jsonObject1.put("gzll", gzll);
}
//所在部门
String szbm = Util.null2String(rs3.getString("szbm"));
if(szbm != null && !"".equals(szbm)) {
jsonObject1.put("szbm", szbm);
}
//任职岗位
String rzgw = Util.null2String(rs3.getString("rzgw"));
if(rzgw != null && !"".equals(rzgw)) {
jsonObject1.put("rzgw", rzgw);
}
//任职类型
String rzlx = Util.null2String(rs3.getString("rzlx"));
if(rzlx != null && !"".equals(rzlx)) {
jsonObject1.put("rzlx", rzlx);
}
//地点
String dd = Util.null2String(rs3.getString("dd"));
if(dd != null && !"".equals(dd)) {
jsonObject1.put("dd", dd);
}
//职务/职位等级
String zwzwdj = Util.null2String(rs3.getString("zwzwdj"));
if(zwzwdj != null && !"".equals(zwzwdj)) {
jsonObject1.put("zwzwdj", zwzwdj);
}
//身份证号开发用
String sfzhkfy = Util.null2String(rs3.getString("sfzhkfy"));
if(sfzhkfy != null && !"".equals(sfzhkfy)) {
jsonObject1.put("sfzhkfy", sfzhkfy);
}
jsonObject1.put("gzll","1");
gzjl_array.add(jsonObject1);
}
jsonObject.put("gzjls",gzjl_array);
jsonObject.put("flag",flag);
out.print(JSONObject.toJSONString(jsonObject));
%>
<%!
/**
* 根据政治面貌名称获取下拉框选项名称
* @param fieldid
* @param name
* @return
*/
public String getSelectNameById(String fieldid,String name) {
String jobtitleId = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select selectname from workflow_selectitem where 1=1 and fieldid=? and (cancel is null or cancel=0) and selectvalue = ?", fieldid, name);
if (rs.next()) {
jobtitleId = rs.getString("selectname");
}
return jobtitleId;
}
/**
* 根据政治面貌名称获取下拉框id
* @param fieldid
* @param name
* @return
*/
public String getSelectidByName(String fieldid,String name) {
String jobtitleId = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select selectvalue from workflow_selectitem where 1=1 and fieldid=? and (cancel is null or cancel=0) and selectname = ?", fieldid, name);
if (rs.next()) {
jobtitleId = rs.getString("selectvalue");
}
return jobtitleId;
}
%>

View File

@ -1,308 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="weaver.conn.RecordSet" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs3" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
boolean flag = false;
String mobile = Util.null2String(request.getParameter("mobile"));
rs.executeQuery("select * from uf_ybygzqbssjtz where yddh=?",mobile);
while(rs.next()) {
//民族
String mz = Util.null2String(rs.getString("mz"));
jsonObject.put("mz",mz);
//籍贯
String jg = Util.null2String(rs.getString("jg"));
jsonObject.put("jg",jg);
//个人邮箱
String gryx = Util.null2String(rs.getString("gryx"));
jsonObject.put("gryx",gryx);
//户口类别
String hklb = Util.null2String(rs.getString("hklb"));
jsonObject.put("hklb",hklb);
//现通讯地址
String xtxdz = Util.null2String(rs.getString("xtxdz"));
jsonObject.put("xtxdz",xtxdz);
//婚姻状况
String hyzk = Util.null2String(rs.getString("hyzk"));
jsonObject.put("hyzk",hyzk);
//学校
String xx = Util.null2String(rs.getString("xx"));
jsonObject.put("xx",xx);
//姓名
String xm = Util.null2String(rs.getString("xm"));
jsonObject.put("xm",xm);
//政治面貌
String zzmm = Util.null2String(rs.getString("zzmm"));
String zzmmname = getSelectNameById("9556",zzmm);
String newzzmm = getSelectidByName("8342",zzmmname);
jsonObject.put("zzmm",newzzmm);
//年龄
String nl = Util.null2String(rs.getString("nl"));
jsonObject.put("nl",nl);
//学历
String xl = Util.null2String(rs.getString("xl"));
jsonObject.put("xl",xl);
//专业
String zy = Util.null2String(rs.getString("zy"));
jsonObject.put("zy",zy);
//性别
String xb = Util.null2String(rs.getString("xb"));
jsonObject.put("xb",xb);
//身份证号码
String sfzhm = Util.null2String(rs.getString("sfzhm"));
jsonObject.put("sfzhm",sfzhm);
}
//教育经历
JSONArray jyjl_array = new JSONArray();
rs1.executeQuery("select * from uf_jxjl where yddh=?",mobile);
while(rs1.next()) {
JSONObject jsonObject1 = new JSONObject();
//入学时间
String rxsj = Util.null2String(rs1.getString("rxsj"));
if(rxsj != null && !"".equals(rxsj)) {
jsonObject1.put("rxsj", rxsj);
}
//毕业时间
String bysj = Util.null2String(rs1.getString("bysj"));
if(bysj != null && !"".equals(bysj)) {
jsonObject1.put("bysj", bysj);
}
//毕业院校
String byyx = Util.null2String(rs1.getString("byyx"));
if(byyx != null && !"".equals(byyx)) {
jsonObject1.put("byyx", byyx);
}
//学习专业
String xxzy = Util.null2String(rs1.getString("xxzy"));
if(xxzy != null && !"".equals(xxzy)) {
jsonObject1.put("xxzy", xxzy);
}
//院校类别
String yxlb = Util.null2String(rs1.getString("yxlb"));
if(yxlb != null && !"".equals(yxlb)) {
jsonObject1.put("yxlb", yxlb);
}
//所在学院
String szxy = Util.null2String(rs1.getString("szxy"));
if(szxy != null && !"".equals(szxy)){
jsonObject1.put("szxy",szxy);
}
//学制
String xz = Util.null2String(rs1.getString("xz"));
if(xz != null && !"".equals(xz)){
jsonObject1.put("xz",xz);
}
//学习形式
String xxxs = Util.null2String(rs1.getString("xxxs"));
if(xxxs != null && !"".equals(xxxs)){
jsonObject1.put("xxxs",xxxs);
}
//是否最高学历
String sfzgxl = Util.null2String(rs1.getString("sfzgxl"));
if(sfzgxl != null && !"".equals(sfzgxl)){
jsonObject1.put("sfzgxl",sfzgxl);
}
//学位
String xw = Util.null2String(rs1.getString("xw"));
if(xw != null && !"".equals(xw)){
jsonObject1.put("xw",xw);
}
//学位授予日期
String xwsyrq = Util.null2String(rs1.getString("xwsyrq"));
if(xwsyrq != null && !"".equals(xwsyrq)){
jsonObject1.put("xwsyrq",xwsyrq);
}
//学位专业名称
String xwzymc = Util.null2String(rs1.getString("xwzymc"));
if(xwzymc != null && !"".equals(xwzymc)){
jsonObject1.put("xwzymc",xwzymc);
}
//学位类别
String xwlb = Util.null2String(rs1.getString("xwlb"));
if(xwlb != null && !"".equals(xwlb)){
jsonObject1.put("xwlb",xwlb);
}
//是否最高学位
String sfzgxw = Util.null2String(rs1.getString("sfzgxw"));
if(sfzgxw != null && !"".equals(sfzgxw)){
jsonObject1.put("sfzgxw",sfzgxw);
}
//学历
String xl1 = Util.null2String(rs1.getString("xl1"));
if(xl1 != null && !"".equals(xl1)){
jsonObject1.put("xl1",xl1);
}
//身份证号开发用
String sfzhkfy = Util.null2String(rs1.getString("sfzhkfy"));
if(sfzhkfy != null && !"".equals(sfzhkfy)){
jsonObject1.put("sfzhkfy",sfzhkfy);
}
jyjl_array.add(jsonObject1);
}
jsonObject.put("jyjls",jyjl_array);
//家庭情况
JSONArray jtqk_array = new JSONArray();
rs2.executeQuery("select * from uf_jtqk where yddh=?",mobile);
while(rs2.next()) {
JSONObject jsonObject1 = new JSONObject();
//关系
String gx = Util.null2String(rs2.getString("gx"));
if(gx != null && !"".equals(gx)) {
jsonObject1.put("gx", gx);
}
//家庭成员姓名
String jtcyxm = Util.null2String(rs2.getString("jtcyxm"));
if(jtcyxm != null && !"".equals(jtcyxm)) {
jsonObject1.put("jtcyxm", jtcyxm);
}
//工作单位
String gzdw = Util.null2String(rs2.getString("gzdw"));
if(gzdw != null && !"".equals(gzdw)) {
jsonObject1.put("gzdw", gzdw);
}
//政治面貌
String zzmm = Util.null2String(rs2.getString("zzmm"));
if(zzmm != null && !"".equals(zzmm)) {
String zzmmname = getSelectNameById("9556", zzmm);
String newzzmm = getSelectidByName("10661", zzmmname);
jsonObject1.put("zzmm", newzzmm);
}
//出生日期
String csrq = Util.null2String(rs2.getString("csrq"));
if(csrq != null && !"".equals(csrq)) {
jsonObject1.put("csrq", csrq);
}
//职务
String zw = Util.null2String(rs2.getString("zw"));
if(zw != null && !"".equals(zw)) {
jsonObject1.put("zw", zw);
}
//身份证号码
String sfzhm = Util.null2String(rs2.getString("sfzhm"));
if(sfzhm != null && !"".equals(sfzhm)) {
jsonObject1.put("sfzhm", sfzhm);
}
//身份证号开发用
String sfzhkfy = Util.null2String(rs2.getString("sfzhkfy"));
if(sfzhkfy != null && !"".equals(sfzhkfy)) {
jsonObject1.put("sfzhkfy", sfzhkfy);
}
jtqk_array.add(jsonObject1);
}
jsonObject.put("jtqks",jtqk_array);
//工作经历
JSONArray gzjl_array = new JSONArray();
rs3.executeQuery("select * from uf_gzjj where yddh=?",mobile);
while(rs3.next()) {
JSONObject jsonObject1 = new JSONObject();
//劳动关系所属单位
String ldgxszdw = Util.null2String(rs3.getString("ldgxszdw"));
if(ldgxszdw != null && !"".equals(ldgxszdw)) {
jsonObject1.put("ldgxszdw", ldgxszdw);
}
//履历单位
String lldw = Util.null2String(rs3.getString("lldw"));
if(lldw != null && !"".equals(lldw)) {
jsonObject1.put("lldw", lldw);
}
//起始时间
String qssj = Util.null2String(rs3.getString("qssj"));
if(qssj != null && !"".equals(qssj)) {
jsonObject1.put("qssj", qssj);
}
//终止时间
String zzsj = Util.null2String(rs3.getString("zzsj"));
if(zzsj != null && !"".equals(zzsj)) {
jsonObject1.put("zzsj", zzsj);
}
//工作履历
String gzll = Util.null2String(rs3.getString("gzll"));
if(gzll != null && !"".equals(gzll)) {
jsonObject1.put("gzll", gzll);
}
//所在部门
String szbm = Util.null2String(rs3.getString("szbm"));
if(szbm != null && !"".equals(szbm)) {
jsonObject1.put("szbm", szbm);
}
//任职岗位
String rzgw = Util.null2String(rs3.getString("rzgw"));
if(rzgw != null && !"".equals(rzgw)) {
jsonObject1.put("rzgw", rzgw);
}
//任职类型
String rzlx = Util.null2String(rs3.getString("rzlx"));
if(rzlx != null && !"".equals(rzlx)) {
jsonObject1.put("rzlx", rzlx);
}
//地点
String dd = Util.null2String(rs3.getString("dd"));
if(dd != null && !"".equals(dd)) {
jsonObject1.put("dd", dd);
}
//职务/职位等级
String zwzwdj = Util.null2String(rs3.getString("zwzwdj"));
if(zwzwdj != null && !"".equals(zwzwdj)) {
jsonObject1.put("zwzwdj", zwzwdj);
}
//身份证号开发用
String sfzhkfy = Util.null2String(rs3.getString("sfzhkfy"));
if(sfzhkfy != null && !"".equals(sfzhkfy)) {
jsonObject1.put("sfzhkfy", sfzhkfy);
}
jsonObject1.put("gzll","1");
gzjl_array.add(jsonObject1);
}
jsonObject.put("gzjls",gzjl_array);
jsonObject.put("flag",flag);
out.print(JSONObject.toJSONString(jsonObject));
%>
<%!
/**
* 根据政治面貌名称获取下拉框选项名称
* @param fieldid
* @param name
* @return
*/
public String getSelectNameById(String fieldid,String name) {
String jobtitleId = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select selectname from workflow_selectitem where 1=1 and fieldid=? and (cancel is null or cancel=0) and selectvalue = ?", fieldid, name);
if (rs.next()) {
jobtitleId = rs.getString("selectname");
}
return jobtitleId;
}
/**
* 根据政治面貌名称获取下拉框id
* @param fieldid
* @param name
* @return
*/
public String getSelectidByName(String fieldid,String name) {
String jobtitleId = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select selectvalue from workflow_selectitem where 1=1 and fieldid=? and (cancel is null or cancel=0) and selectname = ?", fieldid, name);
if (rs.next()) {
jobtitleId = rs.getString("selectvalue");
}
return jobtitleId;
}
%>

View File

@ -1,173 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.general.TimeUtil" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="com.engine.kq.service.KQReportService" %>
<%@ page import="com.engine.common.util.ServiceUtil" %>
<%@ page import="com.engine.kq.service.impl.KQReportServiceImpl" %>
<%@ page import="weaver.formmode.setup.ModeRightInfo" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rst" class="weaver.conn.RecordSet" scope="page" />
<%
int kqbbsd_formmodeid = Util.getIntValue(rs.getPropValue("wuyuan_hrminfo","kqbbsd_formmodeid"));
JSONObject data = new JSONObject();
User user = HrmUserVarify.getUser(request, response);
int userid = user.getUID();
//发起审批按钮
boolean flag = false;
String parmm = Util.null2String(request.getParameter("parmm"));
rs.writeLog("=============== kqConfirmMessage.jsp parmm ==================="+ parmm);
JSONObject jsonObject = JSONObject.parseObject(parmm);
rs.writeLog("=============== kqConfirmMessage.jsp jsonObject ==================="+ jsonObject);
Map<String,Object> params = jsonObject.toJavaObject(Map.class);
rs.writeLog("=============== kqConfirmMessage.jsp params ==================="+ params);
String sqlWhere = "";
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String status = Util.null2String(jsonObj.get("status"));
if(status.length()>0){
if (!status.equals("8") && !status.equals("9")) {
sqlWhere += " and a.status = "+status+ "";
}else if (status.equals("8")) {
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
}
}
if(subCompanyId.length()>0){
sqlWhere +=" and b.subcompanyid in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere +=" and b.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere +=" and b.resourceid in("+resourceId+") ";
}
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
String deptids = "";
rs.executeQuery("select id from Matrixtable_2 where bmfzr in ("+ userid+")");
while(rs.next()){
String deptid = Util.null2String(rs.getString("id"));
deptids += deptid + ",";
}
if(deptids.endsWith(",")){
deptids = deptids.substring(0,deptids.length()-1);
}
Set<String> deptSet = new HashSet<>();
rs1.executeQuery("select a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,case when b.sfqr='0' then '是' else '否' end as sfqr, " +
"b.kqdate " +
"from hrmresource a, kq_format_total b " +
"where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"' " +
"and a.loginid is not null and a.loginid<>'' and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) "+ sqlWhere);
while(rs1.next()){
String mxid = Util.null2String(rs1.getString("id"));
String kqdate = Util.null2String(rs1.getString("kqdate"));
String departmentid = Util.null2String(rs1.getString("departmentid"));
deptSet.add(departmentid);
flag = rst.executeUpdate("update kq_format_total set sfqr='0' where resourceid = ? and kqdate = ?",mxid,kqdate);
}
if(flag){
for(String deptid:deptids.split(",")) {
rs.executeQuery("select id from uf_kqbbsd where ksrq=? and bm=?", fromDate, deptid);
if (!rs.next()) {
String yearmonth = getMonthByDateStr(fromDate);
toDate = yearmonth + "-25";
//入库明细存档
String insertSql = " insert into uf_kqbbsd(ksrq,jsrq,bm,sfsd," +
"modedatacreater,modedatacreatedate,modedatacreatetime,formmodeid,modeuuid) " +
"values(?,?,?,?,?,?,?,?,?)";
String currentdate = TimeUtil.getCurrentDateString();
String currenttime = TimeUtil.getOnlyCurrentTimeString();
String uuid = UUID.randomUUID().toString();
boolean exeRes = rs1.executeUpdate(insertSql, fromDate, toDate, deptid, "0", userid, currentdate, currenttime, kqbbsd_formmodeid, uuid);
int billid = -1;
if (exeRes) {
//重构权限
rs2.executeQuery(" select id from uf_kqbbsd where modeuuid=? ", new Object[]{uuid});
rs2.next();
billid = rs2.getInt("id");
ModeRightInfo moderight = new ModeRightInfo();
moderight.editModeDataShare(userid, kqbbsd_formmodeid, billid);
}
}else{
String mxid = Util.null2String(rs.getString("id"));
rst.executeUpdate("update uf_kqbbsd set sfsd='0' where id=?",mxid);
}
}
}
data.put("flag",flag);
out.print(data.toJSONString());
%>
<%!
/**
* 获取日期字符串中的年月份
* @param dateString
* @return
*/
public static String getMonthByDateStr(String dateString){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
String result = "";
try {
// 解析日期字符串并获取LocalDate对象
LocalDate date = LocalDate.parse(dateString, formatter);
int year = date.getYear();
System.out.println(year);
// 获取月份1代表1月...12代表12月
int month = date.getMonthValue(); // 或者使用date.getMonth().getValue()也是可以的,两者效果相同
System.out.println("月份: " + month); // 输出4因为4月是第4个月份
result += year+"-";
System.out.println(result);
if(month > 10){
result += ""+month;
}else{
result += "0"+month;
}
} catch (DateTimeParseException e) {
System.out.println("日期格式错误"); // 如果日期字符串格式不正确,将抛出异常并打印错误信息
}
return result;
}
private KQReportService getService(User user) {
return (KQReportService) ServiceUtil.getService(KQReportServiceImpl.class, user);
}
%>

View File

@ -1,190 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.general.TimeUtil" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="com.engine.kq.service.KQReportService" %>
<%@ page import="com.engine.common.util.ServiceUtil" %>
<%@ page import="com.engine.kq.service.impl.KQReportServiceImpl" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="weaver.formmode.setup.ModeRightInfo" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<%
int kqbbsdtxjlb_formmodeid = Util.getIntValue(rs.getPropValue("wuyuan_hrminfo","kqbbsdtxjlb_formmodeid"));
JSONObject data = new JSONObject();
User user = HrmUserVarify.getUser(request, response);
int userid = user.getUID();
//发起审批按钮
boolean flag = false;
String parmm = Util.null2String(request.getParameter("parmm"));
rs.writeLog("=============== kqConfirmMessage.jsp parmm ==================="+ parmm);
JSONObject jsonObject = JSONObject.parseObject(parmm);
rs.writeLog("=============== kqConfirmMessage.jsp jsonObject ==================="+ jsonObject);
Map<String,Object> params = jsonObject.toJavaObject(Map.class);
rs.writeLog("=============== kqConfirmMessage.jsp params ==================="+ params);
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
Map<String, Object> apidatas = new HashMap<String, Object>();
apidatas = getService(user).getKQReport(params, user);
rs.writeLog("apidatas:" + JSONObject.toJSONString(apidatas));
JSONArray jsonArray = JSON.parseArray(Util.null2String(JSONObject.toJSONString(apidatas.get("datas"))));
rs.writeLog("jsonArray:" + JSONObject.toJSONString(jsonArray));
Set<String> deptList = new HashSet<>();
for (Iterator<Object> iterator = jsonArray.iterator(); iterator.hasNext(); ) {
List<List<Object>> lsParams = new ArrayList<>();
List<List<Object>> lsDelParams = new ArrayList<>();
JSONObject next = (JSONObject) iterator.next();
String resourceid = next.getString("resourceId");
String departmentid = next.getString("departmentId");
deptList.add(departmentid);
}
rs.writeLog("=============== kqConfirmMessage.jsp deptList size ==================="+ deptList.size());
Set<String> userIdList = new HashSet<>(); // 消息接收人id 必填
String userids = "";
String deptids = "";
if(deptList.size() > 0){
for(String deptid : deptList){
deptids += deptid +",";
}
if(deptids.endsWith(",")){
deptids = deptids.substring(0,deptids.length()-1);
}
rs.writeLog("=============== kqConfirmMessage.jsp deptids ==================="+ deptids);
if(deptids!=null && !"".equals(deptids)){
rs1.executeQuery("select * from Matrixtable_2 where id in ("+deptids+")");
while(rs1.next()){
//部门负责人
String bmfzr = Util.null2String(rs1.getString("bmfzr"));
if(bmfzr!=null && !"".equals(bmfzr)) {
if (bmfzr.contains(",")) {
for (String useid : bmfzr.split(",")) {
userIdList.add(useid);
}
} else {
userIdList.add(bmfzr);
}
}
}
rs.writeLog("=============== kqConfirmMessage.jsp userIdList size ==================="+ userIdList.size());
if(userIdList.size() > 0){
for(String useridd:userIdList){
userids += useridd +",";
}
if(userids.endsWith(",")){
userids = userids.substring(0,userids.length()-1);
}
String xxnr = "有考勤数据需要确认,请关注查看!";
String requestname = "考勤数据确认提醒";
MessageType messageType = MessageType.newInstance(1306); // 消息来源(见文档第四点补充 必填)
String linkUrl = "/wui/index.html?#/main/attendance/report/month"; // PC端链接
String linkMobileUrl = "/wui/index.html?#/main/attendance/report/month"; // 移动端链接
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, requestname, "", linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
messageBean.setTitle("考勤数据确认提醒");
messageBean.setContext(xxnr);
Util_Message.store(messageBean);
String yearmonth = getMonthByDateStr(fromDate);
toDate = yearmonth + "-25";
//入库明细存档
String insertSql = " insert into uf_kqbbsdtxjlb(ksrq,fqr,bm,btxr,txrq,txsj," +
"modedatacreater,modedatacreatedate,modedatacreatetime,formmodeid,modeuuid) " +
"values(?,?,?,?,?,?,?,?,?,?,?)";
String currentdate = TimeUtil.getCurrentDateString();
String currenttime = TimeUtil.getOnlyCurrentTimeString();
String uuid = UUID.randomUUID().toString();
boolean exeRes = rs1.executeUpdate(insertSql, fromDate, userid, deptids, userids, currentdate, currenttime, userid, currentdate, currenttime, kqbbsdtxjlb_formmodeid, uuid);
int billid = -1;
if (exeRes) {
//重构权限
rs2.executeQuery(" select id from uf_kqbbsdtxjlb where modeuuid=? ", new Object[]{uuid});
rs2.next();
billid = rs2.getInt("id");
ModeRightInfo moderight = new ModeRightInfo();
moderight.editModeDataShare(userid, kqbbsdtxjlb_formmodeid, billid);
}
}
}
flag = true;
}
data.put("flag",flag);
out.print(data.toJSONString());
%>
<%!
/**
* 获取日期字符串中的年月份
* @param dateString
* @return
*/
public static String getMonthByDateStr(String dateString){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
String result = "";
try {
// 解析日期字符串并获取LocalDate对象
LocalDate date = LocalDate.parse(dateString, formatter);
int year = date.getYear();
System.out.println(year);
// 获取月份1代表1月...12代表12月
int month = date.getMonthValue(); // 或者使用date.getMonth().getValue()也是可以的,两者效果相同
System.out.println("月份: " + month); // 输出4因为4月是第4个月份
result += year+"-";
System.out.println(result);
if(month > 10){
result += ""+month;
}else{
result += "0"+month;
}
} catch (DateTimeParseException e) {
System.out.println("日期格式错误"); // 如果日期字符串格式不正确,将抛出异常并打印错误信息
}
return result;
}
private KQReportService getService(User user) {
return (KQReportService) ServiceUtil.getService(KQReportServiceImpl.class, user);
}
%>

View File

@ -1,30 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="weaver.general.Util" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rst" class="weaver.conn.RecordSet" scope="page" />
<%
int sum = 0;
rs.executeQuery("select distinct id,field42 from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='3'");
while(rs.next()){
String mxid = Util.null2String(rs.getString("id"));
String field42 = Util.null2String(rs.getString("field42"));
if(field42 != null && !"".equals(field42)){
boolean bool = rst.executeUpdate("update hrmresource set workstartdate=? where id=?",field42,mxid);
if(bool){
sum++;
}
}
}
%>
<HEAD>
</HEAD>
<BODY>
<h1>Congratulation!</h1>
<h1>一共更新了 <%=sum%> 条数据!</h1>
</BODY>

View File

@ -1,911 +0,0 @@
package com.api.hrm.service;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.SearchConditionItem;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.*;
import com.cloudstore.dev.api.util.TextUtil;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogOperateType;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.common.service.HrmCommonService;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.common.util.LogUtil;
import com.engine.common.util.ParamUtil;
import com.engine.hrm.biz.HrmFieldManager;
import com.engine.hrm.util.face.HrmFaceCheckManager;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.docs.docs.CustomFieldManager;
import weaver.encrypt.EncryptUtil;
import weaver.file.FileUpload;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.common.DbFunctionUtil;
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
import weaver.hrm.moduledetach.ManageDetachComInfo;
import weaver.hrm.resource.AllManagers;
import weaver.hrm.resource.CustomFieldTreeManager;
import weaver.hrm.resource.HrmListValidate;
import weaver.hrm.resource.ResourceComInfo;
import weaver.hrm.settings.HrmSettingsComInfo;
import weaver.systeminfo.SysMaintenanceLog;
import weaver.systeminfo.SystemEnv;
import weaver.systeminfo.systemright.CheckSubCompanyRight;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.*;
/***
* 人员卡片
* @author lvyi
*
*/
public class HrmResourcePersonalService extends BaseBean {
private static final char separator = Util.getSeparator() ;
private String today = DateUtil.getCurrentDate();
/**
* 查看人员个人信息
* @param request
* @param response
* @return
*/
public String getResourcePesonalView(HttpServletRequest request, HttpServletResponse response){
User user = HrmUserVarify.getUser(request, response);
HrmSettingsComInfo hrmSettingsComInfo = new HrmSettingsComInfo();
HrmResourceBaseService hrmResourceBaseService = new HrmResourceBaseService();
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType",1);
String checkIsEdit = hrmSettingsComInfo.getCheckIsEdit();
new BaseBean().writeLog("checkIsEdit==="+checkIsEdit);
Map<String,Object> retmap = new HashMap<String,Object>();
Map<String,Object> result = new HashMap<String,Object>();
try{
String id = Util.null2String(request.getParameter("id"));
if(id.length()==0){
id = ""+user.getUID();
}
boolean isSelf = false;
boolean isShowNew = false;
isShowNew = checkRyShow(user.getUID(),id);
if (id.equals("" + user.getUID())) {
isSelf = true;
}
if (id.equals("")) id = String.valueOf(user.getUID());
String status = "";
String subcompanyid = "", departmentId = "";
RecordSet rs = new RecordSet();
HttpSession session = request.getSession(true);
rs.executeSql("select subcompanyid1, status, departmentId from hrmresource where id = " + id);
if (rs.next()) {
status = Util.toScreen(rs.getString("status"), user.getLanguage());
subcompanyid = Util.toScreen(rs.getString("subcompanyid1"), user.getLanguage());
departmentId = StringUtil.vString(rs.getString("departmentId"));
if (subcompanyid == null || subcompanyid.equals("") || subcompanyid.equalsIgnoreCase("null"))
subcompanyid = "-1";
}
int operatelevel = -1;
//人力资源模块是否开启了管理分权如不是则不显示框架直接转向到列表页面(新的分权管理)
int hrmdetachable = 0;
ManageDetachComInfo ManageDetachComInfo = new ManageDetachComInfo();
boolean isUseHrmManageDetach = ManageDetachComInfo.isUseHrmManageDetach();
if (isUseHrmManageDetach) {
hrmdetachable = 1;
} else {
hrmdetachable = 0;
}
if (hrmdetachable == 1) {
CheckSubCompanyRight CheckSubCompanyRight = new CheckSubCompanyRight();
operatelevel = CheckSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmResourceEdit:Edit", Util.getIntValue(subcompanyid));
} else {
if (HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user, departmentId)) {
operatelevel = 2;
}
}
Map<String, Object> buttons = new Hashtable<String, Object>();
if (((isSelf&&hrmResourceBaseService.isHasModify(1)) || operatelevel > 0 || isShowNew) && !status.equals("10")) {
buttons.put("hasEdit", true);
buttons.put("hasSave", true);
}
HrmListValidate HrmListValidate = new HrmListValidate();
AllManagers AllManagers = new AllManagers();
boolean isManager = false;
AllManagers.getAll(id);
if (id.equals("" + user.getUID())) {
isSelf = true;
}
while (AllManagers.next()) {
String tempmanagerid = AllManagers.getManagerID();
if (tempmanagerid.equals("" + user.getUID())) {
isManager = true;
}
}
if ((isSelf || operatelevel >= 0 || isShowNew) && HrmListValidate.isValidate(11)) {
result.put("buttons", buttons);
Map<String,Object> tmp = getFormFields(request, response, false);
result.put("conditions", tmp.get("conditions"));
result.put("tables", tmp.get("tables"));
result.put("id", id);
}else{
result.put("hasRight", false);
}
//
// if(HrmUserVarify.checkUserRight("HrmResourceEdit:Edit",user)||(isSelf&&hrmResourceBaseService.isHasModify(1))) {
// buttons.put("hasEdit", true);
// buttons.put("hasSave", true);
// }
}catch (Exception e) {
writeLog(e);
}
retmap.put("result", result);
return JSONObject.toJSONString(retmap);
}
/**
* 人员个人信息表单字段
* @param request
* @param response
* @return
*/
public Map<String,Object> getFormFields(HttpServletRequest request, HttpServletResponse response, boolean isAdd){
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> result = new HashMap<String,Object>();
List<Object> lsGroup = new ArrayList<Object>();
Map<String,Object> groupitem = null;
List<Object> itemlist = null;
try{
String id = Util.null2String(request.getParameter("id"));
int viewAttr = Util.getIntValue(request.getParameter("viewAttr"),1);
if(isAdd)viewAttr=2;
if(id.length()==0){
id = ""+user.getUID();
}
boolean isSelf = false;
if (id.equals("" + user.getUID())) {
isSelf = true;
}
String subcompanyid = "", departmentId = "";
RecordSet recordSet = new RecordSet();
//不能直接判断是否有人力资源维护权限也需要根据分权进行判断
boolean canEdit = false;
recordSet.executeSql("select subcompanyid1, status, departmentId from hrmresource where id = " + id);
if (recordSet.next()) {
subcompanyid = Util.toScreen(recordSet.getString("subcompanyid1"), user.getLanguage());
departmentId = StringUtil.vString(recordSet.getString("departmentId"));
if (subcompanyid == null || subcompanyid.equals("") || subcompanyid.equalsIgnoreCase("null"))
subcompanyid = "-1";
}
int operatelevel = -1;
//人力资源模块是否开启了管理分权如不是则不显示框架直接转向到列表页面(新的分权管理)
int hrmdetachable = 0;
ManageDetachComInfo ManageDetachComInfo = new ManageDetachComInfo();
boolean isUseHrmManageDetach = ManageDetachComInfo.isUseHrmManageDetach();
if (isUseHrmManageDetach) {
hrmdetachable = 1;
} else {
hrmdetachable = 0;
}
if (hrmdetachable == 1) {
CheckSubCompanyRight CheckSubCompanyRight = new CheckSubCompanyRight();
operatelevel = CheckSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmResourceEdit:Edit", Util.getIntValue(subcompanyid));
} else {
if (HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user, departmentId)) {
operatelevel = 2;
}
}
if(operatelevel>0){
canEdit = true;
}
int scopeId = 1;
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType",scopeId);
CustomFieldManager cfm = new CustomFieldManager("HrmCustomFieldByInfoType",scopeId);
if(viewAttr!=1)hfm.isReturnDecryptData(true);
hfm.getHrmData(Util.getIntValue(id));
cfm.getCustomData(Util.getIntValue(id));
HrmListValidate hrmListValidate = new HrmListValidate();
while(HrmFieldGroupComInfo.next()){
int grouptype = Util.getIntValue(HrmFieldGroupComInfo.getType());
if(grouptype!=scopeId)continue;
int grouplabel = Util.getIntValue(HrmFieldGroupComInfo.getLabel());
int groupid = Util.getIntValue(HrmFieldGroupComInfo.getid());
hfm.getCustomFields(groupid);
groupitem = new HashMap<String,Object>();
itemlist = new ArrayList<Object>();
groupitem.put("title", SystemEnv.getHtmlLabelName(grouplabel, user.getLanguage()));
groupitem.put("defaultshow", true);
if(groupid==4){
groupitem.put("hide", (!isAdd&&!canEdit&&isSelf&&viewAttr==2&&hfm.getContactEditCount()==0)||!hrmListValidate.isValidate(42));
}else{
groupitem.put("hide", (!isAdd&&!canEdit&&isSelf&&viewAttr==2&&hfm.getContactEditCount()==0)||!Util.null2String(HrmFieldGroupComInfo.getIsShow()).equals("1"));
}
groupitem.put("items", itemlist);
lsGroup.add(groupitem);
while(hfm.next()){
int tmpviewattr = viewAttr;
String fieldName=hfm.getFieldname();
String cusFieldname = "";
String fieldValue="";
if(hfm.isBaseField(fieldName)){
fieldValue = hfm.getHrmData(fieldName);
}else{
fieldValue = Util.null2String(new EncryptUtil().decrypt("cus_fielddata","field" + hfm.getFieldid(),"HrmCustomFieldByInfoType",""+scopeId,cfm.getData("field" + hfm.getFieldid()),viewAttr==2,true));
cusFieldname = "customfield"+hfm.getFieldid();
if(isAdd) cusFieldname = "customfield_1_"+hfm.getFieldid();
}
if(!hfm.isUse()||(!isAdd&&viewAttr==2&&!canEdit&&isSelf&&!hfm.isModify())){
HrmFieldBean hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname(cusFieldname.length() > 0 ? cusFieldname : fieldName);
hrmFieldBean.setFieldhtmltype("1");
hrmFieldBean.setType("1");
if(!isAdd){
hrmFieldBean.setFieldvalue(fieldValue);
}
hrmFieldBean.setIsFormField(true);
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
Map<String, Object> otherParams = new HashMap<String, Object>();
otherParams.put("hide", true);
searchConditionItem.setOtherParams(otherParams);
itemlist.add(searchConditionItem);
continue;
}
org.json.JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
HrmFieldBean hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid((String)hrmFieldConf.get("id"));
hrmFieldBean.setFieldname(cusFieldname.length()>0?cusFieldname:fieldName);
hrmFieldBean.setFieldlabel(hfm.getLable());
hrmFieldBean.setFieldhtmltype((String)hrmFieldConf.get("fieldhtmltype"));
hrmFieldBean.setType((String)hrmFieldConf.get("type"));
hrmFieldBean.setDmlurl((String)hrmFieldConf.get("dmlurl"));
hrmFieldBean.setIssystem(""+(Integer)hrmFieldConf.get("issystem"));
if(!isAdd){
hrmFieldBean.setFieldvalue(fieldValue);
}
hrmFieldBean.setIsFormField(true);
if(viewAttr==2 && ((String)hrmFieldConf.get("ismand")).equals("1")){
tmpviewattr=3;
if(hrmFieldBean.getFieldhtmltype().equals("3")){
hrmFieldBean.setRules("required|string");
// if (hrmFieldBean.getType().equals("2")||hrmFieldBean.getType().equals("161")||hrmFieldBean.getType().equals("162")) {
// hrmFieldBean.setRules("required|string");
// }else{
// hrmFieldBean.setRules("required|integer");
// }
}else if(hrmFieldBean.getFieldhtmltype().equals("4")||
hrmFieldBean.getFieldhtmltype().equals("5")){
hrmFieldBean.setRules("required|integer");
} else if (hrmFieldBean.getFieldhtmltype().equals("1") && hrmFieldBean.getType().equals("2")) {
hrmFieldBean.setRules("required|integer");
}else{
hrmFieldBean.setRules("required|string");
}
}
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if(searchConditionItem==null)continue;
if(searchConditionItem.getBrowserConditionParam()!=null){
searchConditionItem.getBrowserConditionParam().setViewAttr(tmpviewattr);
}
searchConditionItem.setViewAttr(tmpviewattr);
itemlist.add(searchConditionItem);
}
if(itemlist.size()==0)lsGroup.remove(groupitem);
}
result.put("conditions", lsGroup);
//明细信息
List<Object> lsTable = new ArrayList<Object>();
List<HrmFieldBean> titles = null;
Map<String,Object> table = null;
Map<String,Object> maptab = null;
HrmFieldBean hrmFieldBean = null;
List<Map<String,Object>> columns = null;
List<Map<String,Object>> datas = null;
Map<String,Object> data = null;
result.put("tables",lsTable);
//标头信息--家庭信息
HrmFieldDetailComInfo HrmFieldDetailComInfo = new HrmFieldDetailComInfo();
LinkedHashMap<String, List<HrmFieldBean>> detialTable = HrmFieldDetailComInfo.getDetialTable(""+scopeId, viewAttr, "80%");
Iterator<Map.Entry<String, List<HrmFieldBean>>> entries = detialTable.entrySet().iterator();
while(entries.hasNext()){
Map.Entry<String, List<HrmFieldBean>> entry = entries.next();
String tablename = entry.getKey();
titles = entry.getValue();
table = new HashMap<String,Object>();
columns = HrmFieldUtil.getHrmDetailTable(titles, null, user);
table.put("columns", columns);
datas = new ArrayList<Map<String,Object>>();
RecordSet rs = new RecordSet();
String sql = "select * from "+tablename+" where resourceid = "+id;
rs.executeSql(sql);
while(rs.next()){
data = new HashMap<String,Object>();
for(HrmFieldBean fieldInfo :titles){
if (!isAdd){
data.put(fieldInfo.getFieldname(), TextUtil.toBase64ForMultilang(Util.null2String(rs.getString(fieldInfo.getFieldname()))));
}
}
datas.add(data);
}
table.put("datas", datas);
table.put("rownum","rownum");
maptab = new Hashtable<String, Object>();
String tablabel = HrmResourceDetailTab.HrmResourceDetailTabInfo.get(tablename.toUpperCase());
maptab.put("tabname", SystemEnv.getHtmlLabelNames(tablabel,user.getLanguage()));
maptab.put("hide", (!hrmListValidate.isValidate(45)||(!isAdd&&!canEdit&&isSelf&&viewAttr==2)));
maptab.put("tabinfo", table);
lsTable.add(maptab);
}
//自定义信息
RecordSet RecordSet = new RecordSet();
CustomFieldTreeManager CustomFieldTreeManager = new CustomFieldTreeManager();
LinkedHashMap<String,String> ht = new LinkedHashMap<String,String>();
RecordSet.executeSql("select id, formlabel,viewtype from cus_treeform where parentid="+scopeId+" order by scopeorder");
while(RecordSet.next()){
if(RecordSet.getInt("viewtype")!=1)continue;
titles = new ArrayList<HrmFieldBean>();
int subId = RecordSet.getInt("id");
CustomFieldManager cfm2 = new CustomFieldManager("HrmCustomFieldByInfoType",subId);
cfm2.getCustomFields();
CustomFieldTreeManager.getMutiCustomData("HrmCustomFieldByInfoType", subId, Util.getIntValue(id,0));
int colcount1 = 0 ;
int rowcount = 0;
int col = 0;
while(cfm2.next()){
rowcount++;
if(!cfm2.isUse()||(!isAdd&&viewAttr==2&&!canEdit&&isSelf&&!cfm2.isModify()))continue;
col++;
}
if(rowcount==0)continue;
cfm2.beforeFirst();
ht.put("cus_list_" + subId, RecordSet.getString("formlabel"));
cfm2.beforeFirst();
while (cfm2.next()) {
if(!cfm2.isUse()||(!isAdd&&viewAttr==2&&!canEdit&&isSelf&&!cfm2.isModify()))continue;
int tmpviewattr = viewAttr;
//创建表头
String fieldname = "customfield" + cfm2.getId() + "_" + subId;
if (isAdd) fieldname = "customfield_1_" + cfm2.getId() + "_" + subId;
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid("" + cfm2.getId());
hrmFieldBean.setFieldname(fieldname);
hrmFieldBean.setFieldlabel(cfm2.getLable());
hrmFieldBean.setFieldhtmltype(cfm2.getHtmlType());
hrmFieldBean.setType("" + cfm2.getType());
hrmFieldBean.setDmlurl(cfm2.getDmrUrl());
if (viewAttr == 2 && cfm2.isMand()) {
tmpviewattr = 3;
hrmFieldBean.setRules("required|string");
}
hrmFieldBean.setViewAttr(tmpviewattr);
hrmFieldBean.setWidth("80%");
titles.add(hrmFieldBean);
}
table = new HashMap<String, Object>();
if(col>0){
columns = HrmFieldUtil.getHrmDetailTable(titles, null, user);
table.put("columns", columns);
}
datas = new ArrayList<Map<String, Object>>();
cfm2.beforeFirst();
while (CustomFieldTreeManager.nextMutiData()) {
data = new HashMap<String, Object>();
while (cfm2.next()) {
// if(!cfm2.isUse()||(!isAdd&&viewAttr==2&&!canEdit&&isSelf&&!cfm2.isModify()))continue;
int fieldid = cfm2.getId(); //字段id
int type = cfm2.getType();
String dmlurl = cfm2.getDmrUrl();
int fieldhtmltype = Util.getIntValue(cfm2.getHtmlType());
String fieldname = "customfield" + cfm2.getId() + "_" + subId;
if (isAdd) fieldname = "customfield_1_" + cfm2.getId() + "_" + subId;
String fieldvalue = "";
if (!isAdd){
fieldvalue = Util.null2String(CustomFieldTreeManager.getMutiData("field" + fieldid));
}
data.put(fieldname, fieldvalue);
if (cfm2.getHtmlType().equals("1") && cfm2.getType() == 1) {
data.put(fieldname, TextUtil.toBase64ForMultilang(Util.null2String(fieldvalue)));
} else if (cfm2.getHtmlType().equals("3")) {
String fieldshowname = hfm.getFieldvalue(user, dmlurl, fieldid, fieldhtmltype, type, fieldvalue, 0);
data.put(fieldname, fieldvalue);
data.put(fieldname + "span", fieldshowname);
} else if (cfm2.getHtmlType().equals("4")) {
data.put(fieldname, fieldvalue.equals("1"));
} else if(cfm2.getHtmlType().equals("6")){
List<Object> filedatas = new ArrayList<Object>();
if(Util.null2String(fieldvalue).length()>0) {
Map<String, Object> filedata = null;
String[] tmpIds = Util.splitString(Util.null2String(fieldvalue), ",");
for (int i = 0; i < tmpIds.length; i++) {
String fileid = tmpIds[i];
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(Util.getIntValue(fileid));
String filename = manager.getImageFileName();
String extname = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : "";
filedata = new HashMap<String, Object>();
filedata.put("acclink", "/weaver/weaver.file.FileDownload?fileid=" + fileid);
filedata.put("fileExtendName", extname);
filedata.put("fileid", fileid);
filedata.put("filelink", "/spa/document/index2file.jsp?imagefileId=" + fileid + "#/main/document/fileView");
filedata.put("filename", filename);
filedata.put("filesize", manager.getImgsize());
filedata.put("imgSrc", "");
filedata.put("isImg", "");
filedata.put("loadlink", "/weaver/weaver.file.FileDownload?fileid=" + fileid + "&download=1");
filedata.put("showDelete", viewAttr==2);
filedata.put("showLoad", "true");
filedatas.add(filedata);
}
}
data.put(fieldname, filedatas);
}
//只允许有权限的人删除明细行,没有权限的人只能修改不能删除
if (canEdit) {
data.put("viewAttr", 2);
} else {
data.put("viewAttr", 1);
}
}
cfm2.beforeFirst();
datas.add(data);
}
table.put("datas", datas);
table.put("rownum", "nodesnum_" + subId);
maptab = new Hashtable<String, Object>();
RecordSet rs = new RecordSet();
rs.executeSql("select id, formlabel from cus_treeform where parentid=" + scopeId + " and id=" + subId + " order by scopeorder");
if (rs.next()) {
maptab.put("tabname", rs.getString("id"));
maptab.put("tabname", rs.getString("formlabel"));
}
maptab.put("hide", col == 0);
maptab.put("tabinfo", table);
lsTable.add(maptab);
}
}catch (Exception e) {
writeLog(e);
}
return result;
}
/***
* 新建人员个人信息
* @param request
* @param response
* @return
*/
public Map<String,String> addResourcePersonal(String id, HttpServletRequest request, HttpServletResponse response){
Map<String,String> retmap = new HashMap<String,String>();
try{
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
ResourceComInfo ResourceComInfo = new ResourceComInfo();
CustomFieldTreeManager CustomFieldTreeManager = new CustomFieldTreeManager();
String para = "";
FileUpload fu = new FileUpload(request);
//String id = Util.null2String(fu.getParameter("id"));
String birthday = Util.fromScreen3(fu.getParameter("birthday"),user.getLanguage());
String folk = Util.fromScreen3(fu.getParameter("folk"),user.getLanguage()) ; /*民族*/
String nativeplace = Util.fromScreen3(fu.getParameter("nativeplace"),user.getLanguage()) ; /*籍贯*/
String regresidentplace = Util.fromScreen3(fu.getParameter("regresidentplace"),user.getLanguage()) ; /*户口所在地*/
String maritalstatus = Util.fromScreen3(fu.getParameter("maritalstatus"),user.getLanguage());
String policy = Util.fromScreen3(fu.getParameter("policy"),user.getLanguage()) ; /*政治面貌*/
String bememberdate = Util.fromScreen3(fu.getParameter("bememberdate"),user.getLanguage()) ; /*入团日期*/
String bepartydate = Util.fromScreen3(fu.getParameter("bepartydate"),user.getLanguage()) ; /*入党日期*/
String islabourunion = Util.fromScreen3(fu.getParameter("islabouunion"),user.getLanguage()) ;
String educationlevel = Util.fromScreen3(fu.getParameter("educationlevel"),user.getLanguage()) ;/*学历*/
String degree = Util.fromScreen3(fu.getParameter("degree"),user.getLanguage()) ; /*学位*/
String healthinfo = Util.fromScreen3(fu.getParameter("healthinfo"),user.getLanguage()) ;/*健康状况*/
String height = Util.null2o(fu.getParameter("height")) ;/*身高*/
String weight = Util.null2o(fu.getParameter("weight")) ;
String residentplace = Util.fromScreen3(fu.getParameter("residentplace"),user.getLanguage()) ; /*现居住地*/
String homeaddress = Util.fromScreen3(fu.getParameter("homeaddress"),user.getLanguage()) ;
String tempresidentnumber = Util.fromScreen3(fu.getParameter("tempresidentnumber"),user.getLanguage()) ;
String certificatenum = Util.fromScreen3(fu.getParameter("certificatenum"),user.getLanguage()) ;/*证件号码*/
certificatenum=certificatenum.trim();
String tempcertificatenum=certificatenum;
if(certificatenum != null && !"".equals(certificatenum)){
birthday = certificatenum.substring(6,10)+"-"+certificatenum.substring(10,12)+"-"+certificatenum.substring(12,14);
}
//年龄
String age_fieldid = rs.getPropValue("wuyuan_hrminfo","age_fieldid");
//生日
String birth_fieldid = rs.getPropValue("wuyuan_hrminfo","birth_fieldid");
SimpleBizLogger logger = new SimpleBizLogger();
Map<String, Object> params = ParamUtil.request2Map(request);
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD);//所属大类型
bizLogContext.setBelongTypeTargetName(SystemEnv.getHtmlLabelName(15687, user.getLanguage()));
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD_PERSONAL);//当前小类型
bizLogContext.setOperateType(BizLogOperateType.ADD);
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String cusFieldNames = ServiceUtil.getCusFieldNames("HrmCustomFieldByInfoType",1,"b");
String mainSql = "select a.*"+(cusFieldNames.length()>0?","+cusFieldNames:"")+" from hrmresource a left join cus_fielddata b on a.id=b.id and b.scope='HrmCustomFieldByInfoType' and b.scopeid=1 where a.id="+id;
logger.setMainSql(mainSql,"id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("lastname");//当前targetName对应的列对应日志中的对象名
logger.before(bizLogContext);//写入操作前日志
int msg=0;
if(!certificatenum.equals("")){
rs.executeSql("select accounttype,certificatenum from HrmResource where id="+id);
String accountType = "", tempCertificatenum = "";
if(rs.next()){
accountType = Util.null2String(rs.getString("accounttype"));
tempCertificatenum = Util.null2String(rs.getString("certificatenum"));
}
if(!accountType.equals("1")) {
rs.executeSql("select id from HrmResource where id<>"+id+" and certificatenum='"+certificatenum+"' and accounttype != '1'");
if(rs.next()){
msg=1;
tempcertificatenum = tempCertificatenum;
}
}
}
para = ""+id+ separator+birthday+separator+folk+separator+nativeplace+separator+regresidentplace+separator+
maritalstatus+ separator+policy+separator+bememberdate+separator+bepartydate+separator+islabourunion+
separator+educationlevel+separator+degree+separator+healthinfo+separator+height+separator+weight+
separator+residentplace+separator+homeaddress+separator+tempresidentnumber+separator+tempcertificatenum;
int userid = user.getUID();
String userpara = ""+userid+separator+today;
rs.executeProc("HrmResourcePersonalInfo_Insert",para);
rs.executeProc("HrmResource_ModInfo",""+id+separator+userpara);
int rownum = Util.getIntValue(fu.getParameter("rownum"),user.getLanguage()) ;
String prefix = "" ;
if(Boolean.TRUE.equals(HrmResourceAddService.saveStatusThreadLocal.get())){
prefix="person_" ;
}
for(int i = 0;i<rownum;i++){
String member = Util.fromScreen3(fu.getParameter("member_"+i),user.getLanguage());
String title = Util.fromScreen3(fu.getParameter("title_"+i),user.getLanguage());
String company = Util.fromScreen3(fu.getParameter(prefix+"company_"+i),user.getLanguage());
String jobtitle = Util.fromScreen3(fu.getParameter(prefix+"jobtitle_"+i),user.getLanguage());
String address = Util.fromScreen3(fu.getParameter("address_"+i),user.getLanguage());
String info = member+title+company+jobtitle+address;
if(!(info.trim().equals(""))){
para = ""+id+separator+member+separator+title+separator+company+separator+jobtitle+separator+address;
rs.executeProc("HrmFamilyInfo_Insert",para);
}
}
//处理自定义字段 add by wjy
CustomFieldTreeManager.editCustomDataE9Add("HrmCustomFieldByInfoType", 1, fu, Util.getIntValue(id,0));
CustomFieldTreeManager.editMutiCustomDataeE9Add("HrmCustomFieldByInfoType", 1, fu, Util.getIntValue(id,0));
//更新年龄和退休日期
if(birthday != null && !"".equals(birthday)){
int age = calculateAge(birthday);
String birth = birthday.substring(5,10);
rs.executeUpdate("update cus_fielddata set "+ age_fieldid +"=?,"+ birth_fieldid +"=? where id=?",age,birth,id);
}
rs.execute("update HrmResource set "+ DbFunctionUtil.getUpdateSetSql(rs.getDBType(),user.getUID())+" where id="+id) ;
rs.execute("update HrmResourceManager set "+ DbFunctionUtil.getUpdateSetSql(rs.getDBType(),user.getUID())+" where id="+id) ;
LogUtil.writeBizLog(logger.getBizLogContexts());
if(msg==1){
retmap.put("status", "-1");
}else{
retmap.put("status", "1");
}
}catch (Exception e) {
writeLog("新建人员个人信息错误:"+e);
retmap.put("status", "-1");
}
return retmap;
}
/**
* 编辑人员个人信息
* @param request
* @param response
* @return
*/
public Map<String,Object> editResourcePersonal(HttpServletRequest request, HttpServletResponse response){
Map<String,Object> retmap = new HashMap<String,Object>();
HrmSettingsComInfo hrmSettingsComInfo = new HrmSettingsComInfo();
try{
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
ResourceComInfo ResourceComInfo = new ResourceComInfo();
CustomFieldTreeManager CustomFieldTreeManager = new CustomFieldTreeManager();
SysMaintenanceLog SysMaintenanceLog = new SysMaintenanceLog();
String para = "";
FileUpload fu = new FileUpload(request);
String id = Util.null2String(fu.getParameter("id"));
if (!HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user)) {
if (!id.equals(user.getUID() + "")) {
retmap.put("status", "-1");
retmap.put("message", ""+ SystemEnv.getHtmlLabelName(22620,weaver.general.ThreadVarLanguage.getLang())+"");
return retmap;
}
}
String birthday = Util.fromScreen3(fu.getParameter("birthday"),user.getLanguage());
String folk = Util.fromScreen3(fu.getParameter("folk"),user.getLanguage()) ; /*民族*/
String nativeplace = Util.fromScreen3(fu.getParameter("nativeplace"),user.getLanguage()) ; /*籍贯*/
String regresidentplace = Util.fromScreen3(fu.getParameter("regresidentplace"),user.getLanguage()) ; /*户口所在地*/
String maritalstatus = Util.fromScreen3(fu.getParameter("maritalstatus"),user.getLanguage());
String policy = Util.fromScreen3(fu.getParameter("policy"),user.getLanguage()) ; /*政治面貌*/
String bememberdate = Util.fromScreen3(fu.getParameter("bememberdate"),user.getLanguage()) ; /*入团日期*/
String bepartydate = Util.fromScreen3(fu.getParameter("bepartydate"),user.getLanguage()) ; /*入党日期*/
String islabourunion = Util.fromScreen3(fu.getParameter("islabouunion"),user.getLanguage()) ;
String educationlevel = Util.fromScreen3(fu.getParameter("educationlevel"),user.getLanguage()) ;/*学历*/
String degree = Util.fromScreen3(fu.getParameter("degree"),user.getLanguage()) ; /*学位*/
String healthinfo = Util.fromScreen3(fu.getParameter("healthinfo"),user.getLanguage()) ;/*健康状况*/
String height = Util.null2o(fu.getParameter("height")) ;/*身高*/
String weight = Util.null2o(fu.getParameter("weight")) ;
String residentplace = Util.fromScreen3(fu.getParameter("residentplace"),user.getLanguage()) ; /*现居住地*/
String homeaddress = Util.fromScreen3(fu.getParameter("homeaddress"),user.getLanguage()) ;
String tempresidentnumber = Util.fromScreen3(fu.getParameter("tempresidentnumber"),user.getLanguage()) ;
String certificatenum = Util.fromScreen3(fu.getParameter("certificatenum"),user.getLanguage()) ;/*证件号码*/
certificatenum=certificatenum.trim();
String tempcertificatenum=certificatenum;
if(certificatenum != null && !"".equals(certificatenum)){
birthday = certificatenum.substring(6,10)+"-"+certificatenum.substring(10,12)+"-"+certificatenum.substring(12,14);
}
//年龄
String age_fieldid = rs.getPropValue("wuyuan_hrminfo","age_fieldid");
//生日
String birth_fieldid = rs.getPropValue("wuyuan_hrminfo","birth_fieldid");
SimpleBizLogger logger = new SimpleBizLogger();
Map<String, Object> params = ParamUtil.request2Map(request);
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD);//所属大类型
bizLogContext.setBelongTypeTargetName(SystemEnv.getHtmlLabelName(15687, user.getLanguage()));
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD_PERSONAL);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String cusFieldNames = ServiceUtil.getCusFieldNames("HrmCustomFieldByInfoType",1,"b");
String mainSql = "select a.*"+(cusFieldNames.length()>0?","+cusFieldNames:"")+" from hrmresource a left join cus_fielddata b on a.id=b.id and b.scope='HrmCustomFieldByInfoType' and b.scopeid=1 where a.id="+id;
logger.setMainSql(mainSql,"id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("lastname");//当前targetName对应的列对应日志中的对象名
logger.before(bizLogContext);//写入操作前日志
int msg=0;
if(!certificatenum.equals("")&&isNeedCheck(user,id,"certificatenum")){
rs.executeSql("select accounttype,certificatenum from HrmResource where id="+id);
String accountType = "", tempCertificatenum = "";
if(rs.next()){
accountType = Util.null2String(rs.getString("accounttype"));
tempCertificatenum = Util.null2String(rs.getString("certificatenum"));
}
if(!accountType.equals("1")) {
rs.executeSql("select id from HrmResource where id<>"+id+" and certificatenum='"+certificatenum+"' and (accounttype != '1' or accounttype is null)");
if(rs.next()){
msg=1;
tempcertificatenum = tempCertificatenum;
retmap.put("status", "-1");
retmap.put("message", ""+ SystemEnv.getHtmlLabelName(83521,weaver.general.ThreadVarLanguage.getLang())+"");
return retmap;
}
}
}
para = ""+id+ separator+birthday+separator+folk+separator+nativeplace+separator+regresidentplace+separator+
maritalstatus+ separator+policy+separator+bememberdate+separator+bepartydate+separator+islabourunion+
separator+educationlevel+separator+degree+separator+healthinfo+separator+height+separator+weight+
separator+residentplace+separator+homeaddress+separator+tempresidentnumber+separator+tempcertificatenum;
rs.executeProc("HrmResourcePersonalInfo_Insert",para);
int userid = user.getUID();
String userpara = ""+userid+separator+today;
rs.executeProc("HrmResource_ModInfo",""+id+separator+userpara);
int rownum = Util.getIntValue(fu.getParameter("rownum"),user.getLanguage()) ;
rs.executeProc("HrmFamilyInfo_Delete",""+id);
for(int i = 0;i<rownum;i++){
String member = Util.fromScreen3(fu.getParameter("member_"+i),user.getLanguage());
String title = Util.fromScreen3(fu.getParameter("title_"+i),user.getLanguage());
String company = Util.fromScreen3(fu.getParameter("company_"+i),user.getLanguage());
String jobtitle = Util.fromScreen3(fu.getParameter("jobtitle_"+i),user.getLanguage());
String address = Util.fromScreen3(fu.getParameter("address_"+i),user.getLanguage());
String sonBirthday = Util.fromScreen3(fu.getParameter("birthday_"+i),user.getLanguage());
String WhetherChildren = Util.fromScreen3(fu.getParameter("WhetherChildren_"+i),user.getLanguage());
if("".equals(WhetherChildren)){
WhetherChildren = "0";
}
String info = member+title+company+jobtitle+address+sonBirthday+WhetherChildren;
if(!info.trim().equals("")){
para = "INSERT INTO HrmFamilyInfo ( resourceid, member, title, company, jobtitle, address,birthday,WhetherChildren) VALUES ( ?,?, ?,?, ?, ?,?,? ) ";
rs.executeUpdate(para,id,member,title,company,jobtitle,address,sonBirthday,WhetherChildren);
}
}
ResourceComInfo.updateResourceInfoCache(id);
//处理自定义字段 add by wjy
CustomFieldTreeManager.editCustomData("HrmCustomFieldByInfoType", 1, fu, Util.getIntValue(id,0));
CustomFieldTreeManager.setIsE9(true);
CustomFieldTreeManager.editMutiCustomData("HrmCustomFieldByInfoType", 1, fu, Util.getIntValue(id,0));
//更新年龄和退休日期
if(birthday != null && !"".equals(birthday)){
int age = calculateAge(birthday);
String birth = birthday.substring(5,10);
rs.executeUpdate("update cus_fielddata set "+ age_fieldid +"=?,"+ birth_fieldid +"=? where id=?",age,birth,id);
}
// 个人信息不需要清理人力资源缓存 ResourceComInfo.removeResourceCache();
rs.execute("update HrmResource set "+ DbFunctionUtil.getUpdateSetSql(rs.getDBType(),user.getUID())+" where id="+id) ;
rs.execute("update HrmResourceManager set "+ DbFunctionUtil.getUpdateSetSql(rs.getDBType(),user.getUID())+" where id="+id) ;
HrmFaceCheckManager.sync(id,HrmFaceCheckManager.getOptUpdate(),
"hrm_e9_HrmResourcePersonalService_editResourcePersonal",HrmFaceCheckManager.getOaResource());
LogUtil.writeBizLog(logger.getBizLogContexts());
retmap.put("status", "1");
}catch (Exception e) {
writeLog("编辑人员个人信息错误:"+e);
retmap.put("status", "-1");
}
return retmap;
}
public boolean isNeedCheck(User user,String id,String fieldName){
RecordSet rs = new RecordSet();
boolean flag = true;
try {
if (!HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user)) {
if (id.equals(user.getUID() + "")) {
rs.executeQuery("select isModify from hrm_formfield where fieldName = ?", fieldName);
if (rs.next()) {
int isModify = rs.getInt("isModify");
if (isModify == 0) flag = false;
}
}
}
}catch (Exception e){
writeLog(e);
}
return flag;
}
/**
* 判断人员是否能查看对应卡片信息
* @param currentUserId
* @param userid
* @return
*/
public boolean checkRyShow(Integer currentUserId,String userid){
boolean back = true;
try {
BaseBean bb = new BaseBean();
ResourceComInfo resourceComInfo = new ResourceComInfo();
String userManagerId = "";
String userDeptId = "";
if(StringUtils.isNotBlank(userid)){
userManagerId = resourceComInfo.getManagerID(userid);
userDeptId = resourceComInfo.getDepartmentID(userid);
}
String allDeptLeaders = getDepartmentLeader(userDeptId);
bb.writeLog("userManagerId:"+userManagerId);
bb.writeLog("userDeptId:"+userDeptId);
bb.writeLog("allDeptLeaders:"+allDeptLeaders);
// String leader_roleid = "30";
// List<String> leaderList = queryHrmRoleUserByRole(leader_roleid);
// String hr_roleid = "29";
// List<String> hrList = queryHrmRoleUserByRole(hr_roleid);
//判断是否是指定角色2930
boolean hasAccess = false;
HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
List<String> roleIds = new ArrayList<>(Arrays.asList(hrmCommonService.getRoleIds(currentUserId).split(",")));
List<String> accessRoleIds = new ArrayList<>();
accessRoleIds.add("29");
accessRoleIds.add("30");
roleIds.retainAll(accessRoleIds);
hasAccess = CollectionUtils.isNotEmpty(roleIds);
new BaseBean().writeLog("currentUserId"+currentUserId+"roleIds"+roleIds+"hasAccess"+hasAccess);
if(hasAccess){
back = true;
}else if((","+allDeptLeaders+",").contains(","+currentUserId+",")){
back = true;
}else if(String.valueOf(currentUserId).equals(userManagerId)){
back = true;
}else if(String.valueOf(currentUserId).equals(userid)){
//自己看自己可以看
back = true;
}else if(currentUserId == 1){
//系统管理员可以看所有
back = true;
}else{
back = false;
}
} catch (Exception e) {
e.printStackTrace();
}
return back;
}
/***
*
* @param deptid
* @return
*/
public String getDepartmentLeader(String deptid){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("getDepartmentLeader:deptid:"+deptid);
String bmfzrs = "";
try {
String sql =" with tem_table(dep_id,departmentname,supdepid,curlevel) as (\n" +
" select id, departmentname,supdepid, 1 as level from HrmDepartment where id=" + deptid+
" union all\n" +
" select a.id,a.departmentname,a.supdepid,b.curlevel+1 from Hrmdepartment a inner join tem_table b on (a.id = b.supdepid)\n" +
" )\n" +
" select bmfzr from hrmdepartmentdefined where deptid in (select dep_id from tem_table)";
rs.executeQuery(sql);
while(rs.next()){
String bmfzr = Util.null2String(rs.getString("bmfzr"));
bmfzrs += StringUtils.isBlank(bmfzrs) ? bmfzr :","+bmfzr ;
}
}catch (Exception e){
bb.writeLog("e:"+e);
}
return bmfzrs;
}
/**
* 根据 出生日期 计算年龄
* @param birthdate
* @return
*/
public int calculateAge(String birthdate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
int years = 0;
try {
Date date = sdf.parse(birthdate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Calendar currentDate = Calendar.getInstance();
years = currentDate.get(Calendar.YEAR) - calendar.get(Calendar.YEAR);
if (currentDate.get(Calendar.DAY_OF_YEAR) < calendar.get(Calendar.DAY_OF_YEAR)) {
years--;
}
}catch (Exception e){
e.printStackTrace();
}
return years;
}
}

View File

@ -1,272 +0,0 @@
package com.engine.common.service;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
public interface HrmCommonService {
/**
* 是否存在下属
* */
public boolean isManager(int userid);
/**
* 获取直接下属
* */
public String getUnderling(int userid);
/**
* 获取直接下属
* */
public String getUnderling(int userid, String keyword);
/**
* 获取所有下属
* */
public String getAllUnderling(int userid);
/**
* 获取所有下属
* */
public String getAllUnderling(int userid, String keyword);
/**
* 获取用户角色信息roleIds
* */
public String getRoleIds(int userid);
/**
* 获取用户角色信息
* */
public List<Object> getRoleInfo(int userid);
/**
* 获取用户角色信息
* */
public List<Object> getRoleInfo(String userid);
/**
* 获取角色成员信息
* */
public String getRoleMemberIds(int roleid, String rolelevel);
/**
* 获取角色成员信息
* */
public String getRoleMemberIds(String roleid, String rolelevel);
/**
* 获取角色成员信息
* */
public String getRoleMemberIds(int roleid, String rolelevel,Map<String,Object> params);
/**
* 获取角色成员信息
* */
public String getRoleMemberIds(String roleid, String rolelevel,Map<String,Object> params);
/**
* 获取角色成员信息
* */
public String getRoleSql(String userid);
/**
* 获取角色成员SQL
* */
public String getHrmRoleMemeberSqlByRoleIds(String roleids);
/**
* 获取角色成员SQL
* */
public String getHrmRoleMemeberSqlByRoleIds4Cus(String roleids);
/**
* 获取角色成员信息
* */
public List<Object> getRoleMembers(String roleid, String rolelevel);
/**
* 获取角色成员信息
* */
public List<Object> getRoleMembers(int roleid, String rolelevel);
/**
* 获取角色成员信息
* */
public List<Object> getRoleMembers(String roleid, String rolelevel,Map<String,Object> params);
/**
* 获取角色成员信息
* */
public List<Object> getRoleMembers(int roleid, String rolelevel,Map<String,Object> params);
/**
* 返回查询hrmRoleMembers表的查询条件按人员ID
* */
public String getHrmRoleMembers_queryConditionSql(int uid, String hrmRoleMembers_alias);
/**
* 获取用户角色最大级别
* */
public int getMaxRoleLevel(int userid, String rightStr);
/**
* SQL拼接 for项目&资产
*/
public String getCptRoleMembersSql(String roleid,String rolelevel);
/**
* SQL拼接 for文档
*/
public String getDocRoleMembersSql(int roleid,String rolelevel);
/**
* 常用组sql
*/
public String getHrmGroupSql(String userid);
/**
* 获取人员所属考勤组的节假日设置
* @param resourceId
* @param beginDate
* @param endDate
* @return
*/
public Map<String,Object> getHolidayInfo(String resourceId,String beginDate,String endDate);
/**
* 判断人员是否需要考勤
* @param user user对象
* @return 开启考勤:1 未开启: 0
*/
public String isneedsign(User user);
/**
* 根据条件获取人员迟到明细数据
* @param fromDate 查询开始日期
* @param toDate 查询结束日期
* @param subCompanyId 分部ID
* @param departmentId 部门ID
* @param resourceId 人员ID
* @return 迟到日期集合
*/
public List getBeLateDaysList(String fromDate, String toDate, String subCompanyId, String departmentId, String resourceId);
/**
* 根据条件获取人员矿工明细数据
* @param fromDate 查询开始日期
* @param toDate 查询结束日期
* @param subCompanyId 分部ID
* @param departmentId 部门ID
* @param resourceId 人员ID
* @return 矿工日期集合
*/
public List getAbsenteeismDaysList(String fromDate, String toDate, String subCompanyId, String departmentId, String resourceId);
/**
* 判断当前日期是否是工作日
* @param userId 人员id
* @param currentDate 当前日期
* @return true/false
*/
public boolean isWorkDay(String userId,String currentDate);
/**
* 汉字转换位汉语拼音首字母英文字符不变特殊字符丢失 支持多音字生成方式如长沙市长:cssc,zssz,zssc,cssz
*
* @param chines 汉字
* @return 拼音
*/
public String converterToFirstSpell(String chines);
/**
* 汉字转换位汉语全拼英文字符不变特殊字符丢失
* 支持多音字生成方式如重当参:zhongdangcen,zhongdangcan,chongdangcen
* ,chongdangshen,zhongdangshen,chongdangcan
*
* @param chines 汉字
* @return 拼音
*/
public String converterToSpell(String chines);
/**
* 汉字转换快速搜索
* @param chinese
* @return
*/
public String generateQuickSearchStr(String chinese);
/**
* 获取管理分权sql过滤条件
* @param rightStr
* @param tableAlias
* @param user
* @return
*/
public String getManageDetachSql(String rightStr, String tableAlias,User user);
/**
* 获取管理分权sql过滤条件
* @param rightStr
* @param tableAlias
* @param userId
* @return
*/
public String getManageDetachSql(String rightStr, String tableAlias,int userId);
/**
* 获取是否开启管理分权开关
* @param params
* @param user
* @return
*/
public Map<String, Object> getManageDetachEnable(Map<String, Object> params,User user);
public String getHrmGroupSql(String userid, String groupName);
/**
* 获取人员数据
* @param params
* @param user
* @return
*/
public Map<String, Object> getHrmResource4eTeams(Map<String, Object> params, User user);
/**
* 获取人员所有上级分部
* @param params
* @param user
* @return
*/
public Map<String, Object> getSubCompanyId4eTeams(Map<String, Object> params, User user);
/**
* 校验账号密码是否正确
* @param params
* @return
*/
public Map<String, Object> checkUser(Map<String, Object> params);
/**
* 根据userid获取角色信息
* @param userid
* @return
*/
Map<String, Object> getRoleInfoByUserID(String userid);
List<Map<String, Object>> getUserIdByEmail(List<String> emails);
List<Integer> getDetachSubcomList(String moudleType, String rightStr, User user);
/**
* 员工离职后自动解绑发票邮箱并注销该员工在发票云的信息
* @param userid
* @return
*/
String unbindInvoiceCloud(int userid);
}

View File

@ -1,227 +0,0 @@
package com.engine.hzzx.conn;
import com.engine.hzzx.exception.CustomizeRunTimeException;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/02/27
* @version: 1.0
*/
public class DataUtil {
/**
* 根据流程ID获取流程表名
*
* @param workflowId
* @return
*/
public static String getTableNameById(String workflowId) {
RecordSet rs = new RecordSet();
rs.executeQuery("select formid from workflow_base where id= ?", workflowId);
if (rs.next()) {
String formId = rs.getString("formid");
if (StringUtils.isNotBlank(formId)) {
rs.executeQuery("select tablename from workflow_bill wb where id = ?", formId);
if (rs.next()) {
return rs.getString("tablename");
}
}
}
return null;
}
/**
* 根据建模表名,获取建模ID
*
* @param modeTable
* @return
*/
public static int getModeIdByTableName(String modeTable) {
int formModeId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? ) and isdelete = 0 order by id", modeTable);
if (rs.next()) {
formModeId = rs.getInt("id");
}
return formModeId;
}
/**
* 根据表名获取表单ID
*
* @param modeTable
* @return
*/
public static int getFormIdByTableName(String modeTable) {
int formId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select id from workflow_bill where tablename = ? ", modeTable);
if (rs.next()) {
formId = rs.getInt("id");
}
return formId;
}
/**
* 插入数据
*
* @param dataMap 数据集合
* @param tableName 表名
*/
public static void insertData(Map<String, String> dataMap, String tableName) {
List<String> fieldList = new ArrayList<>();
List<String> dataList = new ArrayList<>();
List<String> paramList = new ArrayList<>();
dataMap.forEach((key, value) -> {
if (StringUtils.isNotBlank(value)) {
fieldList.add(key);
dataList.add(value);
paramList.add("?");
}
});
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
RecordSet rs = new RecordSet();
rs.executeUpdate(insertSql, dataList);
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
throw new CustomizeRunTimeException(rs.getExceptionMsg());
}
}
/**
* 根据ID更新数据
*
* @param dataMap
* @param tableName
*/
public static void updateDataById(Map<String, String> dataMap, String tableName) {
List<String> fieldList = new ArrayList<>();
List<Object> dataList = new ArrayList<>();
String id = Util.null2String(dataMap.get("id"));
dataMap.remove("id");
dataMap.forEach((key, value) -> {
fieldList.add(key + " = ? ");
dataList.add(value);
});
dataList.add(id);
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
RecordSet rs = new RecordSet();
rs.executeUpdate(updateSql, dataList);
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
throw new CustomizeRunTimeException(rs.getExceptionMsg());
}
}
/**
* 构建建模表基本数据
*
* @param mainDataMap 参数集合
*/
public static void buildModeInsertFields(Map<String, String> mainDataMap, String userId) {
String dateTime = DateUtil.getFullDate();
String[] dateSplit = dateTime.split(" ");
mainDataMap.put("modedatacreater", userId);
mainDataMap.put("modedatacreatedate", dateSplit[0]);
mainDataMap.put("modedatacreatetime", dateSplit[1]);
mainDataMap.put("modedatacreatertype", "0");
}
/**
* 构建建模表基本数据
*
* @param mainDataMap 参数集合
*/
public static void buildModeUpdateFields(Map<String, String> mainDataMap, String userId) {
String dateTime = DateUtil.getFullDate();
mainDataMap.put("modedatamodifier", userId);
mainDataMap.put("modedatamodifydatetime", dateTime);
}
/**
* 建模表数据权限重构
*
* @param uuid
* @param modeTable
* @param formModeId
*/
public static int refreshRight(String uuid, String modeTable, int formModeId, String creator) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from " + modeTable + " where modeuuid='" + uuid + "'");
if (rs.next()) {
//建模数据的id
int bid = Util.getIntValue(rs.getString("id"));
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
//新建的时候添加共享
modeRightInfo.editModeDataShare(Integer.parseInt(creator), formModeId, bid);
return bid;
}
return -1;
}
/**
* 获取表单下拉框展示文本
*
* @param formId 表单ID
* @param fieldName 字段明湖曾
* @param value 下拉框值
* @return
*/
public static String getSelectName(String formId, String fieldName, String value) {
String cancelReason = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select selectname from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectvalue = ?", formId, fieldName, value);
if (rs.next()) {
cancelReason = rs.getString("selectname");
}
return cancelReason;
}
/**
* 获取表单下拉框值
*
* @param formId 表单ID
* @param fieldName 字段明湖曾
* @param selectName 下拉框展示内容
* @return
*/
public static String getSelectValue(String formId, String fieldName, String selectName) {
String selectValue = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectname = ?", formId, fieldName, selectName);
if (rs.next()) {
selectValue = rs.getString("selectvalue");
}
return selectValue;
}
/**
* 获取文档ID
*
* @param imageFileId
* @return
*/
public static String getDocIdByImageId(String imageFileId) {
if (StringUtils.isBlank(imageFileId)) {
return "";
}
RecordSet rs = new RecordSet();
rs.executeQuery("select docid from DocImageFile where IMAGEFILEID=?", imageFileId);
if (rs.next()) {
return rs.getString("docid");
}
return "";
}
}

View File

@ -1,16 +0,0 @@
package com.engine.hzzx.entity;
import lombok.Data;
/**
* @author:dxfeng
* @createTime: 2025/03/13
* @version: 1.0
*/
@Data
public class Department {
private String name;
private String shortName;
private String code;
private String oId;
}

View File

@ -1,78 +0,0 @@
package com.engine.hzzx.entity;
/**
* @author:dxfeng
* @createTime: 2025/03/13
* @version: 1.0
*/
import lombok.Data;
import java.util.Date;
@Data
public class Employee {
private String lastSchool;
private String modifiedTime;
private String nation;
private Long userID;
private String major;
private String applicantIdV6;
private String createdTime;
private Integer applicantId;
private Date certificateValidityTerm;
private Integer nationality;
private Integer sourceType;
private String name;
private boolean stdIsDeleted;
private Integer gender;
private String iDType;
private String backupMail;
private String certificateStartDate;
private String businessModifiedTime;
private Long businessModifiedBy;
private String _Name;
private String educationLevel;
private Long modifiedBy;
private String email;
private String objectId;
private String politicalStatus;
private Long createdBy;
private Integer age;
private String departmentCode;
private String positionCode;
private String positionName;
@Override
public String toString() {
return "Employee{" +
"lastSchool='" + lastSchool + '\'' +
", modifiedTime='" + modifiedTime + '\'' +
", nation='" + nation + '\'' +
", userID=" + userID +
", major='" + major + '\'' +
", applicantIdV6='" + applicantIdV6 + '\'' +
", createdTime='" + createdTime + '\'' +
", applicantId=" + applicantId +
", certificateValidityTerm=" + certificateValidityTerm +
", nationality=" + nationality +
", sourceType=" + sourceType +
", name='" + name + '\'' +
", stdIsDeleted=" + stdIsDeleted +
", gender=" + gender +
", iDType='" + iDType + '\'' +
", backupMail='" + backupMail + '\'' +
", certificateStartDate='" + certificateStartDate + '\'' +
", businessModifiedTime='" + businessModifiedTime + '\'' +
", businessModifiedBy=" + businessModifiedBy +
", _Name='" + _Name + '\'' +
", educationLevel='" + educationLevel + '\'' +
", modifiedBy=" + modifiedBy +
", email='" + email + '\'' +
", objectId='" + objectId + '\'' +
", politicalStatus='" + politicalStatus + '\'' +
", createdBy=" + createdBy +
", age=" + age +
'}';
}
}

View File

@ -1,103 +0,0 @@
package com.engine.hzzx.entity;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/03/17
* @version: 1.0
*/
public class EmployeeTrans {
private static final Map<String, String> POLITICAL_MAP;
static {
POLITICAL_MAP = new HashMap<>();
POLITICAL_MAP.put("4", "群众");
POLITICAL_MAP.put("1", "中共党员");
POLITICAL_MAP.put("6", "中共预备党员");
POLITICAL_MAP.put("2", "共青团员");
POLITICAL_MAP.put("7", "民革党员");
POLITICAL_MAP.put("8", "民盟盟员");
POLITICAL_MAP.put("9", "民建会员");
POLITICAL_MAP.put("10", "民进会员");
POLITICAL_MAP.put("11", "农工党党员");
POLITICAL_MAP.put("13", "九三学社社员");
POLITICAL_MAP.put("14", "台盟盟员");
POLITICAL_MAP.put("15", "无党派人士");
POLITICAL_MAP.put("5", "其他");
}
public static String getPoliticalStr(String politicalStatus) {
return POLITICAL_MAP.get(politicalStatus);
}
public static String getDepartmentId(String departmentCode) {
String departmentId = "";
RecordSet rs = new RecordSet();
if (StringUtils.isBlank(departmentCode)) {
return departmentId;
}
rs.executeQuery("select id from hrmdepartment where departmentcode = ?", departmentCode);
if (rs.next()) {
departmentId = rs.getString("id");
}
return departmentId;
}
//public static String getJobtitleId(String jobtitleCode) {
// String jobtitleId = "";
// RecordSet rs = new RecordSet();
// if (StringUtils.isBlank(jobtitleCode)) {
// return jobtitleId;
// }
// rs.executeQuery("select id from hrmjobtitles where jobtitlecode = ?", jobtitleCode);
// if (rs.next()) {
// jobtitleId = rs.getString("id");
// }
// return jobtitleId;
//}
public static String getJobIdByName(String name) {
String jobtitleId = "";
RecordSet rs = new RecordSet();
if (StringUtils.isBlank(name)) {
return jobtitleId;
}
rs.executeQuery("select id from uf_gwgl where gwmc = ?", name);
if (rs.next()) {
jobtitleId = rs.getString("id");
}
return jobtitleId;
}
public static String getEducationLevelId(String educationLevel) {
if (StringUtils.isBlank(educationLevel)) {
return "";
}
String educationLevelId = "";
switch (educationLevel) {
case "1":
// 本科
educationLevelId = "1";
break;
case "2":
// 硕士研究生
educationLevelId = "2";
break;
case "7":
// 博士研究生
educationLevelId = "3";
break;
default:
educationLevelId = "4";
break;
}
return educationLevelId;
}
}

View File

@ -1,15 +0,0 @@
package com.engine.hzzx.entity;
import lombok.Data;
/**
* @author:dxfeng
* @createTime: 2025/03/13
* @version: 1.0
*/
@Data
public class Position {
private String name;
private String code;
private String oId;
}

View File

@ -1,43 +0,0 @@
package com.engine.hzzx.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2025/03/20
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RecruitingPlan {
public RecruitingPlan(Integer departmentId, Integer onJobNumber) {
this.departmentId = departmentId;
this.onJobNumber = onJobNumber;
}
public RecruitingPlan(String requestId, String departmentName, Integer departmentId, Integer plannedNumber, Integer onJobNumber) {
this.requestId = requestId;
this.departmentName = departmentName;
this.departmentId = departmentId;
this.plannedNumber = plannedNumber;
this.onJobNumber = onJobNumber;
}
private String departmentName;
private Integer departmentId;
private Integer plannedNumber;
private Integer onJobNumber;
private Integer totalNumber;
private String requestId;
public Integer getTotalNumber() {
return plannedNumber + onJobNumber;
}
}

View File

@ -1,22 +0,0 @@
package com.engine.hzzx.exception;
/**
* @Author weaver_cl
* @Description:
* @Date 2023/2/21
* @Version V1.0
**/
public class CustomizeRunTimeException extends RuntimeException{
public CustomizeRunTimeException(String message) {
super(message);
}
public CustomizeRunTimeException(Throwable cause) {
super(cause);
}
public CustomizeRunTimeException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -1,19 +0,0 @@
package com.engine.hzzx.service;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/03/25
* @version: 1.0
*/
public interface RecruitDemandService {
/**
* 获取招聘需求列表
*
* @param params
* @return
*/
Map<String, Object> getRecruitDemandList(Map<String, Object> params);
}

View File

@ -1,13 +0,0 @@
package com.engine.hzzx.service;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/08/29
* @version: 1.0
*/
public interface TrainingManagementService {
Map<String, Object> verificationDeadline(Map<String, Object> param);
}

View File

@ -1,83 +0,0 @@
package com.engine.hzzx.service.impl;
import com.engine.core.impl.Service;
import com.engine.hzzx.entity.RecruitingPlan;
import com.engine.hzzx.service.RecruitDemandService;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.hrm.company.DepartmentComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/03/25
* @version: 1.0
*/
public class RecruitDemandServiceImpl extends Service implements RecruitDemandService {
// update workflow_config set value=value+',field9536_1' where name='support_html_textarea_field'
@Override
public Map<String, Object> getRecruitDemandList(Map<String, Object> params) {
RecordSet rs = new RecordSet();
String year = DateUtil.getYear();
// 查询当前年度提交的数据
//rs.executeQuery("select * from uf_zpxqhztz where sqrq like '%" + year + "%'");
rs.executeQuery("SELECT id, lcid FROM uf_zpxqhztz WHERE YEAR(sqrq) = ?", year);
Map<String, String> mainIdsMap = new HashMap<>();
while (rs.next()) {
String lcid = rs.getString("lcid");
String mainId = rs.getString("id");
mainIdsMap.put(mainId, lcid);
}
// 查询明细表数据
List<RecruitingPlan> recruitingPlans = new ArrayList<>();
mainIdsMap.forEach((mainId, lcid) -> {
rs.executeQuery("select * from uf_zpxqhztz_dt1 where mainid = ?", mainId);
while (rs.next()) {
recruitingPlans.add(new RecruitingPlan(lcid, "", rs.getInt("zpbm"), rs.getInt("xqrs"), 0));
}
});
Map<Integer, Integer> departmentSum = new HashMap<>();
Map<Integer, String> departmentApply = new HashMap<>();
// 遍历recruitingPlans列表
for (RecruitingPlan plan : recruitingPlans) {
int department = plan.getDepartmentId();
int required = plan.getPlannedNumber();
if (required < 0) {
required = 0;
}
// 将需求人数累加到对应部门的统计中
departmentSum.put(
department,
departmentSum.getOrDefault(department, 0) + required
);
departmentApply.put(department, plan.getRequestId());
}
// 汇总部门数据
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
List<RecruitingPlan> resultList = new ArrayList<>();
departmentSum.forEach((department, requiredTotal) -> {
// 查询当年年度统计的年末在岗人数
int onJobNumber = 0;
rs.executeQuery("select nmzgrs from uf_nmgbmzgrs where nd = '" + year + "' and bm = " + department);
if (rs.next()) {
onJobNumber = rs.getInt("nmzgrs");
}
String departmentname = departmentComInfo.getDepartmentname(String.valueOf(department));
resultList.add(new RecruitingPlan(departmentApply.get(department), departmentname, department, requiredTotal, onJobNumber));
});
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("details", resultList);
resultMap.put("year", year);
return resultMap;
}
}

View File

@ -1,62 +0,0 @@
package com.engine.hzzx.service.impl;
import com.engine.core.impl.Service;
import com.engine.hzzx.conn.DataUtil;
import com.engine.hzzx.service.TrainingManagementService;
import com.engine.hzzx.exception.CustomizeRunTimeException;
import org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/08/29
* @version: 1.0
*/
public class TrainingManagementServiceImpl extends Service implements TrainingManagementService {
@Override
public Map<String, Object> verificationDeadline(Map<String, Object> param) {
Map<String, Object> returnMap = new HashMap<>();
RecordSet rs = new RecordSet();
String pxmcId = Util.null2String(param.get("pxmcid"));
String sourceFlowId = Util.null2String(param.get("sourceFlowId"));
String tableName = DataUtil.getTableNameById(sourceFlowId);
if (StringUtils.isBlank(tableName)) {
throw new CustomizeRunTimeException("数据异常,请联系管理员");
}
// 查询最新的截止时间
String deadLineTime = "";
rs.executeQuery("select bmjzsj from " + tableName + " where pxmc = ?", pxmcId);
if (rs.next()) {
deadLineTime = rs.getString("bmjzsj");
}
// 校验时间是否截止
if (StringUtils.isBlank(deadLineTime)) {
throw new CustomizeRunTimeException("报名截止时间获取异常,请联系管理员");
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
LocalDateTime deadLineFormatTime = LocalDateTime.parse(deadLineTime, formatter);
LocalDateTime currentDateTime = LocalDateTime.parse(DateUtil.getDateTime(), formatter);
if(deadLineFormatTime.isBefore(currentDateTime)){
returnMap.put("msg", "报名时间已截止,暂时无法报名");
return returnMap;
}
//查询培训名称
rs.executeQuery("select pxmc from uf_pxsssq where id = ?", pxmcId);
if(rs.next()){
returnMap.put("pxmc",rs.getString("pxmc"));
}
return returnMap;
}
}

View File

@ -1,20 +0,0 @@
package com.engine.hzzx.util;
/**
* @Author weaver_cl
* @Description:
* @Date 2023/2/21
* @Version V1.0
**/
public class ExceptionUtil {
public static String getRealMessage(Throwable e) {
while (e != null) {
Throwable cause = e.getCause();
if (cause == null) {
return e.getMessage();
}
e = cause;
}
return "";
}
}

View File

@ -1,192 +0,0 @@
package com.engine.hzzx.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.engine.core.exception.ECException;
import com.engine.hzzx.exception.CustomizeRunTimeException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* 请求执行器
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Slf4j
public class ResponseResult<T, R> {
private static final long serialVersionUID = 1L;
private final User user;
private final BaseBean baseBean = new BaseBean();
private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log"));
public ResponseResult(User user) {
this.user = user;
}
/**
* 统一返回方法(自定义返回格式)
*/
public String customRun(Function<T, R> f, T t) {
try {
if (isLog) {
log.info("run api , param {}", t);
}
return getJsonString(f.apply(t));
} catch (CustomizeRunTimeException e) {
log.error("api run fail", e);
return Error(e.getMessage());
} catch (ECException e) {
log.error("api run fail", e);
Throwable cause = e.getCause();
return Error(cause.getMessage());
} catch (Exception e) {
log.error("api run fail", e);
return Error("系统异常!");
}
}
/**
* 统一返回方法
*/
public String run(Function<T, R> f, T t) {
try {
if (isLog) {
log.info("run api , param {}", t);
}
return Ok(f.apply(t));
} catch (CustomizeRunTimeException e) {
log.error("api run fail", e);
return Error(e.getMessage());
} catch (ECException e) {
log.error("api run fail", e);
Throwable cause = e.getCause();
return Error(cause.getMessage());
} catch (Exception e) {
log.error("api run fail", e);
return Error("系统异常!");
}
}
/**
* 统一返回方法有参无返回
*/
public String run(Consumer<T> f, T t) {
try {
if (isLog) {
log.info("run api , param {}", t);
}
f.accept(t);
return Ok();
} catch (CustomizeRunTimeException e) {
log.error("api run fail", e);
return Error(e.getMessage());
} catch (ECException e) {
log.error("api run fail", e);
return Error(ExceptionUtil.getRealMessage(e));
} catch (Exception e) {
log.error("api run fail", e);
return Error("系统异常!", e);
}
}
/**
* 统一返回方法无参有返回
*/
public String run(Supplier<R> f) {
try {
if (isLog) {
log.info("run api");
}
return Ok(f.get());
} catch (CustomizeRunTimeException e) {
log.error("api run fail", e);
return Error(e.getMessage());
} catch (ECException e) {
log.error("api run fail", e);
Throwable cause = e.getCause();
return Error(cause.getMessage());
} catch (Exception e) {
log.error("api run fail", e);
return Error("系统异常!", e);
}
}
private static String getJsonString(Object apidatas) {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.writeValueAsString(apidatas);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return "";
}
/**
* 成功返回
*/
private String Ok() {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("api_status", true);
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
/**
* 成功返回
*/
private String Ok(R r) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("api_status", true);
apidatas.put("data", r);
String success = JSON.toJSONString(apidatas);
if (isLog) {
log.info("run salary api success return {}", success);
}
return success;
}
/**
* 失败返回
*/
private static String Error(String message) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("api_status", false);
apidatas.put("errormsg", message);
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
/**
* 系统异常失败返回
*/
private static String Error(String message, Exception e) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("api_status", false);
apidatas.put("errormsg", message);
apidatas.put("error", e.getMessage());
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
}

View File

@ -1,39 +0,0 @@
package com.engine.hzzx.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.hzzx.service.RecruitDemandService;
import com.engine.hzzx.service.impl.RecruitDemandServiceImpl;
import com.engine.hzzx.util.ResponseResult;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/03/25
* @version: 1.0
*/
public class RecruitDemandController {
public RecruitDemandService getService(User user) {
return ServiceUtil.getService(RecruitDemandServiceImpl.class, user);
}
@GET
@Path("/getRecruitDemandList")
@Produces(MediaType.APPLICATION_JSON)
public String getRecruitDemandList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getRecruitDemandList, params);
}
}

View File

@ -1,39 +0,0 @@
package com.engine.hzzx.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.hzzx.service.TrainingManagementService;
import com.engine.hzzx.service.impl.TrainingManagementServiceImpl;
import com.engine.hzzx.util.ResponseResult;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/02/27
* @version: 1.0
*/
public class TrainingManagementController {
public TrainingManagementService getService(User user) {
return ServiceUtil.getService(TrainingManagementServiceImpl.class, user);
}
@GET
@Path("/verificationDeadline")
@Produces(MediaType.APPLICATION_JSON)
public String verificationDeadline(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::verificationDeadline, params);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,729 +0,0 @@
package com.engine.kq.cmd.report;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import com.google.common.collect.Lists;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
private HttpServletRequest request;
private HttpServletResponse response;
private List<String> lsFieldDataKey;
private boolean isKqReportHalfOpen = "1".equals(new KQSettingsComInfo().getMain_val("kq_report_half"));
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
this.user = user;
this.params = params;
this.request = request;
this.response = response;
this.lsFieldDataKey = new ArrayList<>();
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
String sql = "";
try {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
ResourceComInfo resourceComInfo = new ResourceComInfo();
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
String leavetype_is_on = Util.null2String(kqSettingsComInfo.getMain_val("leavetype_is_on"),"0");
KQReportBiz kqReportBiz = new KQReportBiz();
new KQReportBiz().insertKqReportExportLog(params, user);
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect = Util.null2String(jsonObj.get("typeselect"));
if (typeselect.length() == 0) typeselect = "3";
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
if (typeselect.equals("1")) {
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
} else {
fromDate = TimeUtil.getDateByOption(typeselect, "0");
toDate = TimeUtil.getDateByOption(typeselect, "1");
}
}
//人员状态
String status = Util.null2String(jsonObj.get("status"));
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
showColumns.add("lastname");
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
List<String> tmpShowColumns = new ArrayList<>();
for(String showColumn:showColumns){
tmpShowColumns.add(showColumn);
String cascadekey = "";
if(showColumn.equals("beLate")){
cascadekey = "beLateMins";
}else if(showColumn.equals("leaveEearly")){
cascadekey = "leaveEarlyMins";
}else if(showColumn.equals("graveBeLate")){
cascadekey = "graveBeLateMins";
}else if(showColumn.equals("graveLeaveEarly")){
cascadekey = "graveLeaveEarlyMins";
}else if(showColumn.equals("absenteeism")){
cascadekey = "absenteeismMins";
}else if(showColumn.equals("overtime")){
tmpShowColumns.add("overtime_4leave");
tmpShowColumns.add("overtime_nonleave");
tmpShowColumns.add("workingDayOvertime_nonleave");
tmpShowColumns.add("workingDayOvertime_4leave");
tmpShowColumns.add("restDayOvertime_nonleave");
tmpShowColumns.add("restDayOvertime_4leave");
tmpShowColumns.add("holidayOvertime_4leave");
tmpShowColumns.add("holidayOvertime_nonleave");
}
if(cascadekey.length()>0){
tmpShowColumns.add(cascadekey);
}
}
showColumns = tmpShowColumns;
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
List<Object> lsSheet = new ArrayList<>();
Map<String, Object> sheet = null;
List<Object> titleList = new ArrayList<>();
Map<String, Object> title = null;
List<List<Object>> dataList = new ArrayList<>();
List<Object> data = null;
List<Map<String, Object>> constraintList = null;
sheet = new HashMap<>();
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
boolean isEnd = false;
Calendar cal = DateUtil.getCalendar();
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
Map<String, Object> mapChildColumnInfo = null;
List<Object> childColumns = null;
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
while (kqReportFieldComInfo.next()) {
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
continue;
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
continue;
}
title = new HashMap<>();
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
if(unitType.length()>0){
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
}else{
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
}
title.put("width", 30 * 256);
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
if (childColumns.size() > 0) {//跨列width取子列的width
title.put("children", childColumns);
title.put("colSpan", childColumns.size());
} else {
title.put("rowSpan", 3);
}
titleList.add(title);
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
}
String today = DateUtil.getCurrentDate();
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
// toDate = today;
// }
if(showColumns.contains("kqCalendar")) {
childColumns = new ArrayList<>();
for (String date = fromDate; !isEnd; ) {
if (date.equals(toDate)) isEnd = true;
title = new HashMap<>();
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date)-1,user.getLanguage()) +"\r\n"+ DateUtil.geDayOfMonth(date));
title.put("width", 30 * 256);
childColumns.add(title);
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
}
title = new HashMap();
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
if (childColumns.size() > 0) {//跨列width取子列的width
title.put("children", childColumns);
title.put("colSpan", childColumns.size());
}
titleList.add(title);
}
sheet.put("titleList", titleList);
// 没有权限的人最大只支持查询本季
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
fromDate = getRealDate.get("fromDate");
toDate = getRealDate.get("toDate");
if("-1".equals(fromDate) || "-1".equals(toDate)) {
retmap.put("status", "1");
return retmap;
}
List<List> paramLists = new ArrayList<>();
List<Object> paramList = null;
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
if(rs.getDBType().equalsIgnoreCase("oracle")) {
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
}else {
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
}
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,case when b.sfqr='0' then '是' else '否' end as sfqr," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
if(rs.getDBType().equals("oracle")){
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
}
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
String sqlWhere = rightSql;
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,b.sfqr ";
if (subCompanyId.length() > 0) {
sqlWhere +=" and a.subcompanyid1 in("+KQReportBiz.splitParamStr(subCompanyId)+") ";
for(String bean : subCompanyId.split(",")) {
paramList = new ArrayList<>();
paramList.add(bean);
paramLists.add(paramList);
}
}
if (departmentId.length() > 0) {
sqlWhere +=" and a.departmentid in("+KQReportBiz.splitParamStr(departmentId)+") ";
for(String bean : departmentId.split(",")) {
paramList = new ArrayList<>();
paramList.add(bean);
paramLists.add(paramList);
}
}
if (resourceId.length() > 0) {
sqlWhere +=" and a.id in("+KQReportBiz.splitParamStr(resourceId)+") ";
for(String bean : resourceId.split(",")) {
paramList = new ArrayList<>();
paramList.add(bean);
paramLists.add(paramList);
}
}
if (viewScope.equals("4")) {//我的下属
if (allLevel.equals("1")) {//所有下属
sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
} else {
sqlWhere += " and a.managerid=" + user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
}
if(status.length()>0){
if (!status.equals("8") && !status.equals("9")) {
sqlWhere += " and a.status = ?";
paramList = new ArrayList<>();
paramList.add(status);
paramLists.add(paramList);
}else if (status.equals("8")) {
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
}
}
String orderBy = " order by a.dsporder asc, a.lastname asc ";
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
//System.out.println("start" + DateUtil.getFullDate());
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据以及打卡数据来源
params.put("show_card_source",show_card_source);
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
params.put("uintType",uintType);
params.put("hoursToDay",hoursToDay);
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
//System.out.println("end" + DateUtil.getFullDate());
// #1475814-概述满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
rs.executeQuery(sql, paramLists);
int calIndex = -1;
while (rs.next()) {
data = new ArrayList<>();
String id = rs.getString("id");
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
String fieldValue = "";
if (fieldName.equals("subcompany")) {
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
if (tmpSubcompanyId.length() == 0) {
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
}
fieldValue = "1".equals(isShowFullPath) ?
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
} else if (fieldName.equals("department")) {
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
if (tmpDepartmentId.length() == 0) {
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
}
fieldValue = "1".equals(isShowFullPath) ?
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
departmentComInfo.getDepartmentname(tmpDepartmentId);
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
} else if (fieldName.equals("jobtitle")) {
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
if (tmpJobtitleId.length() == 0) {
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
}
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
} else if (fieldName.equals("attendanceSerial")) {
List<String> serialIds = null;
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
}
}else{
data.add("");
}
continue;
} else if (fieldName.equals("leave")) {//请假
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
if (("1").equals(leavetype_is_on)) {
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
for (int i = allLeaveRules.size() - 1; i >= 0; i--) {
Map<String, Object> leaveRule = allLeaveRules.get(i);
String leaveId = Util.null2String(leaveRule.get("id"));
boolean flag = kqLeaveRulesBiz.filterSubLeaveRule(kqLeaveRulesComInfo, user, leaveId);
if (flag) {
allLeaveRules.remove(i);
}
}
}
Map<String, Object> leaveRule = null;
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
leaveRule = allLeaveRules.get(i);
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
String b_flowLeaveData = "";
String flowLeaveData = "";
try {
//以防止出现精度问题
if (leaveData.length() == 0) {
leaveData = "0.0";
}
if (leavebackData.length() == 0) {
leavebackData = "0.0";
}
BigDecimal b_leaveData = new BigDecimal(leaveData);
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
b_flowLeaveData = "0.0";
}
} catch (Exception e) {
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
}
if (b_flowLeaveData.length() > 0) {
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
} else {
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
}
data.add(flowLeaveData);
}
continue;
}else if(fieldName.equals("overtime")){
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
continue;
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
String backType = fieldName+"_back";
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
String businessLeave = "";
try{
//以防止出现精度问题
if(businessLeaveData.length() == 0){
businessLeaveData = "0.0";
}
if(businessLeavebackData.length() == 0){
businessLeavebackData = "0.0";
}
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
if(Util.getDoubleValue(businessLeave, -1) < 0){
businessLeave = "0.0";
}
}catch (Exception e){
}
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
} else if(Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length()>0){
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
data.add(fieldValue);
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid),",");
for(int i=0;i<lsCascadekey.size();i++){
if(Util.null2String(rs.getString(lsCascadekey.get(i))).length()>0){
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)),kqReportFieldComInfo.getUnittype(fieldid));
}else{
fieldValue = "0";
}
data.add(fieldValue);
}
continue;
}else {
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
}
fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
data.add(fieldValue);
}
List<Object> amData = Lists.newArrayList();
List<Object> pmData = Lists.newArrayList();
if(isKqReportHalfOpen) {
amData.addAll(data);
pmData.addAll(data);
calIndex = data.size();
}
if(showColumns.contains("kqCalendar")) {
// Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true);
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true,uintType,show_card_source);
String user_endDate = Util.null2String(resourceComInfo.getEndDate(id));
String user_status = Util.null2String(resourceComInfo.getStatus(id));
String begindate = Util.null2String(resourceComInfo.getCreatedate(id)).trim();
String companyStartDate = Util.null2String(resourceComInfo.getCompanyStartDate(id)).trim();
if(companyStartDate.length()!=10){
companyStartDate = "";
}
if(companyStartDate.length()>0 && companyStartDate.indexOf("-")>0){
begindate=companyStartDate;
}
isEnd = false;
for (String date = fromDate; !isEnd; ) {
if (date.equals(toDate)) isEnd = true;
if(DateUtil.compDate(today, date)>0){
if(isKqReportHalfOpen) {
amData.add("");
pmData.add("");
} else {
data.add("");
}
}else{
if(!(user_status.equals("0")||user_status.equals("1")||user_status.equals("2")||user_status.equals("3"))){
//其他状态
if(user_endDate.length()>0 && date.compareTo(user_endDate)>0){//人员合同结束日期之后
if(isKqReportHalfOpen) {
amData.add("");
pmData.add("");
} else {
data.add("");
}
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
continue;
}
}
if(begindate.length()>0 && date.compareTo(begindate)<0 ){//人员入职日期前无需计算考勤如果没有入职日期已创建日期为准
if(isKqReportHalfOpen) {
amData.add("");
pmData.add("");
} else {
data.add("");
}
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
continue;
}
if (detialDatas.get(id + "|" + date) != null) {
if(isKqReportHalfOpen) {
amData.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("textAM"));
pmData.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("textPM"));
} else {
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
}
} else {
if(isKqReportHalfOpen) {
amData.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
pmData.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
} else {
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
}
}
}
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
}
}
if(isKqReportHalfOpen) {
dataList.add(amData);
dataList.add(pmData);
} else {
dataList.add(data);
}
}
sheet.put("dataList", dataList);
if(isKqReportHalfOpen) {
sheet.put("calIndex", calIndex);
}
sheet.put("constraintList", constraintList);
sheet.put("createFile", "1");
lsSheet.add(sheet);
workbook.put("sheet", lsSheet);
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage())+" "+fromDate+" "+toDate;
workbook.put("fileName", fileName);
ExcelUtil ExcelUtil = new ExcelUtil();
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response,true);
retmap.putAll(exportMap);
retmap.put("status", "1");
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
writeLog(e);
}
return retmap;
}
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
Map<String, Object> returnMap = new HashMap<>();
List<Object> titleList = new ArrayList<>();
Map<String, Object> title = null;
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
String leavetype_is_on = Util.null2String(kqSettingsComInfo.getMain_val("leavetype_is_on"),"0");
if (parentid.equals("attendanceSerial")) {//考勤班次
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
List<String> serialIds = null;
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
}
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
title = new HashMap<>();
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)),""+user.getLanguage()));
title.put("width", 30 * 256);
titleList.add(title);
}
} else if (parentid.equals("leave")) {
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
if (("1").equals(leavetype_is_on)) {
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
for (int i = leaveRules.size() - 1; i >= 0; i--) {
Map<String, Object> leaveRule = leaveRules.get(i);
String leaveId = Util.null2String(leaveRule.get("id"));
boolean flag = kqLeaveRulesBiz.filterSubLeaveRule(kqLeaveRulesComInfo, user, leaveId);
if (flag) {
leaveRules.remove(i);
}
}
}
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
Map<String, Object> leaveRule = leaveRules.get(i);
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
String unitType = Util.null2String(leaveRule.get("unitType"));
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
title = new HashMap<>();
title.put("title", name + "(" + unitName + ")");
title.put("width", 30 * 256);
titleList.add(title);
}
}else if(parentid.equals("overtime")){
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
for(int i=0;i<overtimeChild.length;i++){
String id = overtimeChild[i];
title = new HashMap();
String fieldlabel = "";
if("overtime_nonleave".equalsIgnoreCase(id)){
fieldlabel = "125805";
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
title.put("rowSpan","2");
}else if("overtime_4leave".equalsIgnoreCase(id)){
fieldlabel = "125804";
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
title.put("rowSpan","2");
}else{
fieldlabel = "523";
title.put("showDetial","1");
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
String unitTypeName = "";
if(Util.null2String(unitType).length()>0){
if(unitType.equals("1")){
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
}else if(unitType.equals("2")){
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
}else if(unitType.equals("3")){
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
}
}
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
}
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
int childWidth = 65;
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
if(childColumns.size()>0) {//跨列width取子列的width
title.put("children", childColumns);
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
}
title.put("width", childWidth+"");
titleList.add(title);
}
} else {
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
while (kqReportFieldComInfo.next()) {
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
title = new HashMap<>();
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
title.put("width", 30 * 256);
titleList.add(title);
}
}
}
returnMap.put("childColumns", titleList);
return returnMap;
}
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
List<Object> titleList = new ArrayList<>();
Map<String, Object> title = null;
if(Util.null2String(cascadeKey).length()==0){
return titleList;
}
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
for(int i=0;i<lsCascadeKey.size();i++){
kqReportFieldComInfo.setTofirstRow();
while (kqReportFieldComInfo.next()) {
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
title = new HashMap<>();
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
title.put("width", 30 * 256);
titleList.add(title);
}
}
}
return titleList;
}
private String getFieldValueByUnitType(String fieldValue,String unittype){
if (Util.null2String(unittype).length() > 0) {
if (fieldValue.length() == 0) {
fieldValue = "0";
} else {
if (unittype.equals("2")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
}
}
}
return fieldValue;
}
@Override
public BizLogContext getLogContext() {
return null;
}
}

View File

@ -1,838 +0,0 @@
package com.engine.kq.cmd.report;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.weaver.file.Prop;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import com.google.common.collect.Maps;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal;
import java.util.*;
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetKQReportCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String,Object> retmap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String sql = "";
try{
String pageUid = PageUidFactory.getHrmPageUid("KQReport");
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
ResourceComInfo resourceComInfo = new ResourceComInfo();
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
KQReportBiz kqReportBiz = new KQReportBiz();
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
String leavetype_is_on = Util.null2String(kqSettingsComInfo.getMain_val("leavetype_is_on"),"0");
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
//人员状态
String status = Util.null2String(jsonObj.get("status"));
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求如果是不加载考勤报表权限共享的限制不然我的考勤会提示无权限
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
boolean isKqReportHalfOpen = "1".equals(new KQSettingsComInfo().getMain_val("kq_report_half"));
if(isKqReportHalfOpen) {
pageSize = pageSize/2;
}
int count = 0;
int pageCount = 0;
int isHavePre = 0;
int isHaveNext = 0;
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
if(isFromMyAttendance.equals("1")){
rightSql = "";
}
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
List<Object> columns = new ArrayList();
Map<String,Object> column = null;
List<Object> datas = new ArrayList();
Map<String,Object> data = null;
Map<String,Object> mapChildColumnInfo = null;
List<Object> childColumns = null;
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
while (kqReportFieldComInfo.next()){
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
column = new HashMap();
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
column.put("type", kqReportFieldComInfo.getFieldname());
column.put("key", kqReportFieldComInfo.getFieldname());
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
if(childColumns.size()>0) {//跨列width取子列的width
column.put("rowSpan", 1);
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
column.put("children", childColumns);
}else{
column.put("rowSpan", 3);
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
}
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
columns.add(column);
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
}
boolean isEnd = false;
Calendar cal = DateUtil.getCalendar();
String today = DateUtil.getCurrentDate();
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
// toDate = today;
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
// fromDate = today;
// }
// }
childColumns = new ArrayList<>();
for(String date=fromDate; !isEnd;) {
if(date.equals(toDate)) isEnd = true;
column = new HashMap();
column.put("title", DateUtil.geDayOfMonth(date));
column.put("dataIndex", date);
column.put("key", date);
column.put("type", date);
column.put("rowSpan", 1);
column.put("width", 90);
column.put("isCalendar", 1);
childColumns.add(column);
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
}
column = new HashMap();
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
column.put("dataIndex", "kqCalendar");
column.put("key", "kqCalendar");
if(childColumns.size()>0) {//跨列width取子列的width
column.put("rowSpan", 1);
column.put("width", childColumns.size()*90);
column.put("children", childColumns);
}
columns.add(column);
// 没有权限的人最大只支持查询本季
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
fromDate = getRealDate.get("fromDate");
toDate = getRealDate.get("toDate");
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
if(rs.getDBType().equalsIgnoreCase("oracle")) {
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
}else {
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
}
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,case when b.sfqr='0' then '是' else '否' end as sfqr," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
if(rs.getDBType().equals("oracle")){
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
}
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
String sqlWhere = rightSql;
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,b.sfqr ";
List<List> paramLists = new ArrayList<>();
List<Object> paramList = null;
if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+KQReportBiz.splitParamStr(subCompanyId)+") ";
for(String bean : subCompanyId.split(",")) {
paramList = new ArrayList<>();
paramList.add(bean);
paramLists.add(paramList);
}
}
if(departmentId.length()>0){
sqlWhere +=" and a.departmentid in("+KQReportBiz.splitParamStr(departmentId)+") ";
for(String bean : departmentId.split(",")) {
paramList = new ArrayList<>();
paramList.add(bean);
paramLists.add(paramList);
}
}
if(resourceId.length()>0){
sqlWhere +=" and a.id in("+KQReportBiz.splitParamStr(resourceId)+") ";
for(String bean : resourceId.split(",")) {
paramList = new ArrayList<>();
paramList.add(bean);
paramLists.add(paramList);
}
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
if(status.length()>0){
if (!status.equals("8") && !status.equals("9")) {
sqlWhere += " and a.status = ?";
paramList = new ArrayList<>();
paramList.add(status);
paramLists.add(paramList);
}else if (status.equals("8")) {
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
}
}
if("-1".equals(fromDate) || "-1".equals(toDate)) {
sqlWhere += " and 1=2 ";
}
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
rs.executeQuery(sql, paramLists);
if (rs.next()){
count = rs.getInt("c");
}
if (count <= 0) {
pageCount = 0;
}
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
String orderBy = " order by t.dsporder asc, t.lastname asc ";
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
//默认排序设置 start有性能问题先取消后面再看看有没有好的方式
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
// rs.executeQuery(orderBySql, user.getUID());
// if (rs.getCounts() <= 0) {
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
// rs.executeQuery(orderBySql);
// }
// while (rs.next()) {
// String dataIndex = rs.getString("dataIndex");
// String ascOrDesc = rs.getString("ascOrDesc");
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
// if (dataIndex.equals("organization")) {
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
// }
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
// }
// }
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
// orderBy = "order by "+orderBy;
sql = backFields + sqlFrom + sqlWhere + groupBy;
if (pageIndex > 0 && pageSize > 0) {
if (rs.getDBType().equals("oracle")) {
sql = " select * from (select " + sql+") t "+orderBy;
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
} else if (rs.getDBType().equals("mysql")) {
sql = " select * from (select " + sql+") t "+orderBy;
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
}
else if (rs.getDBType().equals("postgresql")) {
sql = " select * from (select " + sql+") t "+orderBy;
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
}
else {
orderBy = " order by dsporder asc, lastname asc ";
descOrderBy = " order by dsporder desc, lastname desc ";
if (pageIndex > 1) {
int topSize = pageSize;
if (pageSize * pageIndex > count) {
topSize = count - (pageSize * (pageIndex - 1));
}
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
} else {
sql = " select top " + pageSize + sql+orderBy;
}
}
} else {
sql = " select " + sql;
}
// #1475814-概述满足考勤报分部部门显示及导出时显示全路径
String fullPathMainKey = "show_full_path";
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据以及打卡数据来源
params.put("show_card_source",show_card_source);
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
params.put("uintType",uintType);
params.put("hoursToDay",hoursToDay);
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
rs.executeQuery(sql, paramLists);
rs.writeLog("========== GetKQReportCmd sql =========== "+ sql);
while (rs.next()) {
data = new HashMap<>();
kqReportFieldComInfo.setTofirstRow();
String id = rs.getString("id");
data.put("resourceId",id);
while (kqReportFieldComInfo.next()){
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
continue;
}
String fieldName = kqReportFieldComInfo.getFieldname();
String fieldValue = "";
if(fieldName.equals("subcompany")){
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
if(tmpSubcompanyId.length()==0){
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
}
data.put("subcompanyId",tmpSubcompanyId);
fieldValue = "1".equals(isShowFullPath) ?
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
}else if(fieldName.equals("department")){
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
if(tmpDepartmentId.length()==0){
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
}
data.put("departmentId",tmpDepartmentId);
fieldValue = "1".equals(isShowFullPath) ?
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
departmentComInfo.getDepartmentname(tmpDepartmentId);
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
}else if(fieldName.equals("jobtitle")){
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
if(tmpJobtitleId.length()==0){
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
}
data.put("jobtitleId",tmpJobtitleId);
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
}else if(fieldName.equals("attendanceSerial")){
List<String> serialIds = null;
if(attendanceSerial.length()>0){
serialIds = Util.splitString2List(attendanceSerial,",");
}
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
}
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
if(fieldName.equals("overtimeTotal")){
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
String backType = fieldName+"_back";
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
String businessLeave = "";
try{
//以防止出现精度问题
if(businessLeaveData.length() == 0){
businessLeaveData = "0.0";
}
if(businessLeavebackData.length() == 0){
businessLeavebackData = "0.0";
}
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
if(Util.getDoubleValue(businessLeave, -1) < 0){
businessLeave = "0.0";
}
}catch (Exception e){
}
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
}else{
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
}
} else {
fieldValue = Util.null2String(rs.getString(fieldName));
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
if(fieldValue.length() == 0){
fieldValue="0";
}else{
if (kqReportFieldComInfo.getUnittype().equals("2")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
}
}
}
}
data.put(fieldName,fieldValue);
}
//请假
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
if(("1").equals(leavetype_is_on)) {
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
for (int i = allLeaveRules.size() - 1; i >= 0; i--) {
Map<String, Object> leaveRule = allLeaveRules.get(i);
String leaveId = Util.null2String(leaveRule.get("id"));
boolean flag = KQLeaveRulesBiz.filterSubLeaveRule(kqLeaveRulesComInfo, user, leaveId);
if (flag) {
allLeaveRules.remove(i);
}
}
}
Map<String, Object> leaveRule = null;
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
String b_flowLeaveData = "";
String flowLeaveData = "";
try{
//以防止出现精度问题
if(leaveData.length() == 0){
leaveData = "0.0";
}
if(leavebackData.length() == 0){
leavebackData = "0.0";
}
BigDecimal b_leaveData = new BigDecimal(leaveData);
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
b_flowLeaveData = "0.0";
}
}catch (Exception e){
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
}
//考虑下冻结的数据
if(b_flowLeaveData.length() > 0){
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
}else{
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
}
data.put(flowType,flowLeaveData);
}
Map<String,Object> amData = Maps.newHashMap();
Map<String,Object> pmData = Maps.newHashMap();
if(isKqReportHalfOpen) {
amData.putAll(data);
pmData.putAll(data);
}
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
String user_endDate = Util.null2String(resourceComInfo.getEndDate(id));
String user_status = Util.null2String(resourceComInfo.getStatus(id));
String begindate = Util.null2String(resourceComInfo.getCreatedate(id)).trim();
String companyStartDate = Util.null2String(resourceComInfo.getCompanyStartDate(id)).trim();
if(companyStartDate.length()!=10){
companyStartDate = "";
}
if(companyStartDate.length()>0 && companyStartDate.indexOf("-")>0){
begindate=companyStartDate;
}
isEnd = false;
for(String date=fromDate; !isEnd;) {
if(date.equals(toDate)) isEnd = true;
if(DateUtil.compDate(today, date)>0){
if(isKqReportHalfOpen) {
amData.put(date,"");
pmData.put(date,"");
} else {
data.put(date,"");
}
}else{
if(!(user_status.equals("0")||user_status.equals("1")||user_status.equals("2")||user_status.equals("3"))){
//其他状态
if(user_endDate.length()>0 && date.compareTo(user_endDate)>0){//人员合同结束日期之后
if(isKqReportHalfOpen) {
amData.put(date,"");
pmData.put(date,"");
} else {
data.put(date,"");
}
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
continue;
}
}
if(begindate.length()>0 && date.compareTo(begindate)<0 ){//人员入职日期前无需计算考勤如果没有入职日期已创建日期为准
if(isKqReportHalfOpen) {
amData.put(date,"");
pmData.put(date,"");
} else {
data.put(date,"");
}
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
continue;
}
if(isKqReportHalfOpen) {
Map<String,Object> tmpData = Maps.newHashMap();
Object tmpValue = null;
if(detialDatas.get(id+"|"+date)==null){
tmpValue = SystemEnv.getHtmlLabelName(26593, user.getLanguage());
data.put(date,tmpValue);
amData.put(date,tmpValue);
pmData.put(date,tmpValue);
}else {
tmpData = (Map<String, Object>) detialDatas.get(id+"|"+date);
data.put(date,tmpData);
if(tmpData != null){
tmpData.put("text",Util.null2String(tmpData.get("textAM")));
Map<String,Object> amTmpData = Maps.newHashMap();
amTmpData.put("text",Util.null2String(tmpData.get("textAM")));
Map<String,Object> pmTmpData = Maps.newHashMap();
pmTmpData.put("text",Util.null2String(tmpData.get("textPM")));
amData.put(date,amTmpData);
pmData.put(date,pmTmpData);
}
}
} else {
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
}
}
cal.setTime(DateUtil.parseToDate(date));
date = DateUtil.getDate(cal.getTime(), 1);
}
if(isKqReportHalfOpen) {
amData.put("rowSpan", "2");
pmData.put("rowSpan", "0");
datas.add(amData);
datas.add(pmData);
} else {
datas.add(data);
}
}
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
retmap.put("holidays", lsHolidays);
retmap.put("columns",columns);
retmap.put("datas",datas);
if(isKqReportHalfOpen) {
retmap.put("pagesize", pageSize*2);
retmap.put("count", count*2);
} else {
retmap.put("pagesize", pageSize);
retmap.put("count", count);
}
retmap.put("pageindex", pageIndex);
retmap.put("pagecount", pageCount);
retmap.put("ishavepre", isHavePre);
retmap.put("ishavenext", isHaveNext);
retmap.put("isKqReportHalfOpen", isKqReportHalfOpen);
}catch (Exception e){
writeLog(e);
}
return retmap;
}
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
Map<String,Object> returnMap = new HashMap<>();
List<Object> lsChildColumns = new ArrayList<>();
Map column = null;
int sumChildColumnWidth = 0;
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
String leavetype_is_on = Util.null2String(kqSettingsComInfo.getMain_val("leavetype_is_on"),"0");
if(parentid.equals("attendanceSerial")){//考勤班次
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
List<String> serialIds = null;
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
}
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
column = new HashMap();
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
column.put("unit", "");
column.put("width", 65);
column.put("dataIndex", serialIds.get(i));
column.put("key", serialIds.get(i));
column.put("rowSpan", 2);
column.put("colSpan", 1);
sumChildColumnWidth+=65;
lsChildColumns.add(column);
}
}else if(parentid.equals("leave")){
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
if (("1").equals(leavetype_is_on)) {
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
for (int i = leaveRules.size() - 1; i >= 0; i--) {
Map<String, Object> leaveRule = leaveRules.get(i);
String leaveId = Util.null2String(leaveRule.get("id"));
boolean flag = kqLeaveRulesBiz.filterSubLeaveRule(kqLeaveRulesComInfo, user, leaveId);
if (flag) {
leaveRules.remove(i);
}
}
}
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
Map<String, Object> leaveRule = leaveRules.get(i);
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
String name = Util.null2String(leaveRule.get("name"));
String unitType = Util.null2String(leaveRule.get("unitType"));
column = new HashMap();
column.put("title", name);
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
column.put("width", 65);
column.put("dataIndex", id);
column.put("key", id);
column.put("rowSpan", 2);
column.put("colSpan", 1);
column.put("showDetial","1");
sumChildColumnWidth+=65;
lsChildColumns.add(column);
}
}else if(parentid.equals("overtime")){
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
for(int i=0;i<overtimeChild.length;i++){
String id = overtimeChild[i];
column = new HashMap();
String fieldlabel = "";
column.put("unit", "");
if("overtime_nonleave".equalsIgnoreCase(id)){
fieldlabel = "125805";
}else if("overtime_4leave".equalsIgnoreCase(id)){
fieldlabel = "125804";
}else{
fieldlabel = "523";
column.put("showDetial","1");
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
String unitTypeName = "";
if(Util.null2String(unitType).length()>0){
if(unitType.equals("1")){
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
}else if(unitType.equals("2")){
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
}else if(unitType.equals("3")){
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
}
}
column.put("unit", unitTypeName);
}
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
column.put("dataIndex", id);
column.put("key", id);
column.put("rowSpan", 1);
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
int childWidth = 65;
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
if(childColumns.size()>0) {//跨列width取子列的width
column.put("children", childColumns);
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
}
column.put("width", childWidth+"");
sumChildColumnWidth+=childWidth;
lsChildColumns.add(column);
}
}else{
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
while (kqReportFieldComInfo.next()){
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
column = new HashMap();
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
column.put("key", kqReportFieldComInfo.getFieldname());
column.put("rowSpan", 1);
column.put("colSpan", 1);
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
lsChildColumns.add(column);
}
}
}
returnMap.put("childColumns",lsChildColumns);
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
return returnMap;
}
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
List<Object> lsChildColumns = new ArrayList<>();
if(Util.null2String(cascadeKey).length()==0){
return lsChildColumns;
}
Map<String,Object> column = null;
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
for(int i=0;i<lsCascadeKey.size();i++){
kqReportFieldComInfo.setTofirstRow();
while (kqReportFieldComInfo.next()) {
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
column = new HashMap();
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
column.put("key", kqReportFieldComInfo.getFieldname());
column.put("rowSpan", 1);
column.put("colSpan", 1);
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
lsChildColumns.add(column);
}
}
}
return lsChildColumns;
}
/**
* * 关联流程计算加班时长 加班时长减去调休
*/
public double getOvertimeCount(String userid , String fromDate, String toDate, double leaveTime, String leaveType){
BigDecimal bigDecimal = new BigDecimal(Double.toString(leaveTime));
KQWorkTime kqWorkTime = new KQWorkTime();
String propValue = Util.null2String(Prop.getPropValue("Others","wfTableName"));
if("".equals(propValue)){
return leaveTime;
}
String sql = " select * from " +propValue +" where jbksrq >= ? and jbksrq >= ? and sqr = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(sql,fromDate, toDate, userid);
while (rs.next()) {
String workdate = rs.getString("jbksrq");
boolean workDay = kqWorkTime.isWorkDay(userid, workdate);
boolean isHoliday = KQHolidaySetBiz.isHoliday(userid,workdate);
double dxsc = rs.getDouble("dxsc");
dxsc = (double)Math.round(dxsc*100)/100;
BigDecimal bigDecimalDxsc = new BigDecimal(Double.toString(dxsc));
if(workDay){
if("1".equals(leaveType)){
bigDecimal.subtract(bigDecimalDxsc);
}
}else if(isHoliday ){
if("2".equals(leaveType)){
bigDecimal.subtract(bigDecimalDxsc);
}
}else {
if("3".equals(leaveType)){
bigDecimal.subtract(bigDecimalDxsc);
}
}
}
return bigDecimal.doubleValue();
}
@Override
public BizLogContext getLogContext() {
return null;
}
public static void main(String[] args) {
String s1 = String.format("%.2f", 1.2);
System.out.println(s1);
}
}

View File

@ -1,372 +0,0 @@
package com.engine.workflow.cmd.requestForm;
import com.api.workflow.util.ServiceUtil;
import com.cloudstore.dev.api.util.Util_TableMap;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.constant.BizLogOperateType;
import com.engine.common.constant.BizLogSmallType4Workflow;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.common.util.ParamUtil;
import com.engine.core.interceptor.CommandContext;
import com.engine.workflow.biz.WorkflowTestBiz;
import com.engine.workflow.biz.publicApi.RequestOperateBiz;
import com.engine.workflow.biz.requestForm.RequestRemindBiz;
import com.engine.workflow.biz.requestForm.SubmitErrorMsgBiz;
import com.engine.workflow.biz.requestForm.TestWorkflowCheckBiz;
import com.engine.workflow.biz.requestList.RequestAttentionBiz;
import com.engine.workflow.biz.workflowOvertime.OvertimeBiz;
import com.engine.workflow.constant.RemindTypeEnum;
import com.engine.workflow.constant.requestForm.RequestExecuteType;
import com.engine.workflow.entity.requestForm.RequestOperationResultBean;
import weaver.conn.RecordSet;
import weaver.file.FileUpload;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.agent.AgentManager;
import weaver.workflow.msg.MsgPushUtil;
import weaver.workflow.msg.entity.MsgEntity;
import weaver.workflow.request.RequestAnnexUpload;
import weaver.workflow.request.RequestOperationMsgManager;
import weaver.workflow.request.WFUrgerManager;
import weaver.workflow.workflow.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 功能管理
* @author liuzy 2018/5/4
*/
public class FunctionManageCmd extends AbstractCommonCommand<Map<String,Object>>{
private HttpServletRequest request;
private HttpServletResponse response;
public FunctionManageCmd(HttpServletRequest request, HttpServletResponse response, User user){
this.request = request;
this.response = response;
this.user = user;
}
public Map<String,Object> execute(CommandContext commandContext){
Map<String, Object> apidatas = new HashMap<String, Object>();
Map<String, String> resultmap = new HashMap<String, String>();
int logintype = Util.getIntValue(user.getLogintype());
int requestid = Util.getIntValue(request.getParameter("requestid"), 0);
String flag = Util.null2String(request.getParameter("flag"));
WfFunctionManageUtil wffmu = new WfFunctionManageUtil();
ArrayList<String> requestidlist = new ArrayList<String>();
int formid = Util.getIntValue(request.getParameter("formid"), 0);
int requestLogId = Util.getIntValue(request.getParameter("workflowRequestLogId"), 0);
String signdocids = Util.null2String(request.getParameter("signdocids"));
String signworkflowids = Util.null2String(request.getParameter("signworkflowids"));
String remark = Util.null2String(request.getParameter("remark"));
int workflowid = Util.getIntValue(request.getParameter("workflowid"), 0);
int nodeid = -1;
String isnew = new BaseBean().getPropValue("WorkflowOvertimeIsNew" , "isNew");
boolean isnewFlag = "1".equals(isnew);
// 流程暂停
if ("stop".equals(flag)) {
wffmu.setStopOperation(requestid, user);
// this.pushOperationMsg(requestid,user,flag);
if(isnewFlag)
OvertimeBiz.getInstance().cancelOvertimeTask(requestid, nodeid);//取消超时任务
}
// 流程撤销
if ("cancel".equals(flag)) {
wffmu.setCancelOperation(requestid, user);
// this.pushOperationMsg(requestid,user,flag);
if(isnewFlag)
OvertimeBiz.getInstance().cancelOvertimeTask(requestid, nodeid);//取消超时任务
}
// 流程启用
if ("restart".equals(flag)) {
wffmu.setRestartOperation(requestid, user);
// this.pushOperationMsg(requestid,user,flag);
if(isnewFlag)
OvertimeBiz.getInstance().addOvertimeTaskThread(requestid, workflowid, nodeid);//添加超时任务
}
// 强制归档
if ("ov".equals(flag)) {
WfForceOver wfo = new WfForceOver();
String annexdocids = "";
String fromflow = Util.null2String(request.getParameter("fromflow"));
String remarkLocation = Util.null2String(request.getParameter("remarkLocation"));
int agentType = Util.getIntValue(Util.null2String(request.getParameter("agentType")));
int agentorByAgentId = Util.getIntValue(Util.null2String(request.getParameter("agentorByAgentId")));
if (agentType == 1) {//流程代理出去本人强制归档需先收回代理
AgentManager agentManager = new AgentManager(user);
agentManager.agentBackRequest(agentorByAgentId, user.getUID(), workflowid + "", requestid);
Date currentDate = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
SimpleDateFormat timeForamt = new SimpleDateFormat("HH:mm:ss");
new RecordSet().executeUpdate("update workflow_currentoperator set operatedate = ? , operatetime = ? where userid = ? and requestid = ? and (operatedate is null or operatedate < ' ' ) ",
dateFormat.format(currentDate), timeForamt.format(currentDate), user.getUID(), requestid);
}
if (fromflow.equals("1")) {
FileUpload fu = new FileUpload(request);
remark = Util.null2String(fu.getParameter("remark"));
workflowid = Util.getIntValue(fu.getParameter("workflowid"), -1);
nodeid = Util.getIntValue(fu.getParameter("nodeid"), -1);
// 获取签字意见相关文档相关流程
signdocids = Util.null2String(fu.getParameter("signdocids"));
signworkflowids = Util.null2String(fu.getParameter("signworkflowids"));
String ismode = Util.null2String(request.getParameter("ismode"));
if (!ismode.equals("1")) {
RequestAnnexUpload rau = new RequestAnnexUpload();
rau.setRequest(fu);
rau.setUser(user);
annexdocids = rau.AnnexUpload();
} else {
String hasSign = "0";// 模板中是否设置了签字
RecordSet rs = new RecordSet();
rs.executeSql("select * from workflow_modeview where formid=" + formid + " and nodeid=" + nodeid + " and fieldid=-4");
if (rs.next())
hasSign = "1";
if ("1".equals(hasSign)) {// 模板中设置了签字
annexdocids = Util.null2String(fu.getParameter("qianzi"));
} else {// 模板中没有设置签字按普通方式上传签字意见的附件
RequestAnnexUpload rau = new RequestAnnexUpload();
rau.setRequest(fu);
rau.setUser(user);
annexdocids = rau.AnnexUpload();
}
}
WFManager wfManager = new WFManager();
wfManager.setWfid(workflowid);
try {
wfManager.getWfInfo();
} catch (Exception e) {
e.printStackTrace();
}
String isShowChart = Util.null2s(wfManager.getIsShowChart().trim(),"0");
apidatas.put("isShowChart", isShowChart);
}
wfo.setRemark(remark);
wfo.setAnnexdocids(annexdocids);
wfo.setSigndocids(signdocids);
wfo.setSignworkflowids(signworkflowids);
wfo.setRequestLogId(requestLogId);
wfo.setRemarkLocation(remarkLocation);
WFUrgerManager wfum = new WFUrgerManager();
if (wffmu.haveOtherOperationRight(requestid) && !wfo.isOver(requestid) && (wfo.isNodeOperator(requestid, user.getUID()) || wfum.getMonitorViewRight(requestid, user.getUID()))) {
requestidlist.add("" + requestid);
wfo.doForceOver(requestidlist, request, response, user);
apidatas.put("success",1);
if(isnewFlag)
OvertimeBiz.getInstance().cancelOvertimeTask(requestid, nodeid);//取消超时任务
}else{
apidatas.put("success",0);
}
//判断是否属于流程测试
TestWorkflowCheckBiz testBiz = new TestWorkflowCheckBiz();
boolean belongTest = testBiz.judgeBelongTest(request, false);
if(belongTest) {
RecordSet rs = new RecordSet();
rs.executeQuery("select nodeid from workflow_flownode where workflowid = ? and nodetype = 3",workflowid);
rs.next();
WorkflowTestBiz.setWorkflowTestInfo(flag, requestid, nodeid, "", null,rs.getInt("nodeid"));
}
this.doArchiveRemind(workflowid,requestid);
new weaver.cpt.util.CptWfUtil().releaseFrozenCptnum(requestid+""); //清除资产冻结
}
// 强制收回
if ("rb".equals(flag)) {
WfForceDrawBack wfdb = new WfForceDrawBack();
RequestForceDrawBack requestForceDrawBack = new RequestForceDrawBack();
RequestOperationResultBean resultBean = new RequestOperationResultBean();
if (wffmu.haveOtherOperationRight(requestid) && wfdb.isHavePurview(requestid, user.getUID(), logintype, -1, -1)) {
requestidlist.add("" + requestid);
// WfForceDrawBack.doForceDrawBack(requestidsArr, request,
// response, -1, -1);
// 使用新的收回方式
String sessionkey = workflowid + "_" + nodeid + "_" + user.getUID() + "_" + System.currentTimeMillis();
int result = requestForceDrawBack.foreceDrawBack(user, requestid, false, -1, -1);
if (!requestForceDrawBack.isAddInOperateSuccess()) {//强制收回附加操作执行失败返回错误信息
String message = requestForceDrawBack.getMessage();
String messagecontent = requestForceDrawBack.getMessageContent();
if("".equals(message) || requestid <= 0) {
message = "1";
}
resultBean.setMessageInfo(SubmitErrorMsgBiz.getMsgInfo(request,user,message,messagecontent));
resultBean.setType(RequestExecuteType.FAILD);
Util_TableMap.setObjVal(Util.null2String(sessionkey), resultBean);
apidatas.put("success",false);
apidatas.put("msg",SystemEnv.getHtmlLabelNames("506175,83071",user.getLanguage()));
return apidatas;
}
if (result == RequestForceDrawBack.OLDDATA) {
wfdb.doForceDrawBack(requestidlist, request, response, -1, -1);
}
RequestOperateBiz.drawBackSpecialTreatment(formid, workflowid);
/*E9打印登录超时报错(QC:527424)*/
if(user == null) {
try {
response.sendRedirect(weaver.general.GCONST.getContextPath()+"/wui/index.html");
return null;
} catch (IOException e) {
e.printStackTrace();
}
}
//判断是否可以跳转到新的页面
boolean reqRoute = ServiceUtil.isReqRoute(String.valueOf(requestid),user);
apidatas.put("reqRoute", reqRoute);
apidatas.put("success",result == RequestForceDrawBack.SUCCESS);
if(result == RequestForceDrawBack.SUCCESS){
apidatas.put("msg",SystemEnv.getHtmlLabelName(83585,user.getLanguage()));
}else if(result == RequestForceDrawBack.FAIL){
apidatas.put("msg",SystemEnv.getHtmlLabelName(389102,user.getLanguage()));
}else if(result == RequestForceDrawBack.NORIGHT){
apidatas.put("msg",SystemEnv.getHtmlLabelName(18567,user.getLanguage()));
}else if(result == RequestForceDrawBack.REPEAT){
apidatas.put("msg",SystemEnv.getHtmlLabelName(543020,user.getLanguage()));
}
apidatas.put("sessionkey", sessionkey);
// 竞聘报名流程的前提下删除 报名情况审核流程中对应的明细表数据
if(workflowid == 29){
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
RecordSet rst = new RecordSet();
// 竞聘报名 流程表名
String competitionRegistration_table = rs.getPropValue("hrm_wuyuan","competitionRegistration_table");
// 报名情况审核 流程表名
String registrationStatusReview_table = rs.getPropValue("hrm_wuyuan","registrationStatusReview_table");
String registrationStatusReview_table_dt1 = registrationStatusReview_table+"_dt1";
rs.executeQuery("select * from "+ competitionRegistration_table +" where requestid=?",requestid);
rs.next();
String xm = Util.null2String(rs.getString("xm"));
String gbjpzt = Util.null2String(rs.getString("gbjpzt"));
String jpgw = Util.null2String(rs.getString("jpgw"));
rs1.executeQuery("select b.* from "+ registrationStatusReview_table +" a,"+ registrationStatusReview_table_dt1 +" b,workflow_requestbase c where a.requestid=c.requestid and a.id=b.mainid and c.currentnodetype!='3' and a.gbjpzt=? and b.xm=? and b.jpgw=?",gbjpzt,xm,jpgw);
while(rs1.next()){
String mxid = Util.null2String(rs1.getString("id"));
rst.executeUpdate("delete from "+ registrationStatusReview_table_dt1 +" where id=?",mxid);
}
}
}else {
apidatas.put("success",false);
apidatas.put("msg",SystemEnv.getHtmlLabelName(18567,user.getLanguage()));
}
}
//自动取消 流程关注
new RequestAttentionBiz().cancelAttention(requestid,flag);
return apidatas;
}
@Override
public BizLogContext getLogContext() {
String targetName = "";
String flag = Util.null2String(request.getParameter("flag"));
if ("stop".equals(flag)) {
targetName = "流程暂停";
} else if ("cancel".equals(flag)) {
targetName = "流程撤销";
} else if ("restart".equals(flag)) {
targetName = "流程启用";
} else if ("ov".equals(flag)) {
targetName = "强制归档";
} else if ("rb".equals(flag)) {
targetName = "强制收回";
}
BizLogContext bizLogContext = new BizLogContext();
BizLogOperateType bizLogOperateType = BizLogOperateType.APPROVE;
bizLogContext.setDateObject(new Date());
bizLogContext.setUserid(user.getUID());
bizLogContext.setUsertype(Util.getIntValue(user.getLogintype()));
bizLogContext.setTargetId("request_functionlink_" + flag);
bizLogContext.setTargetName(targetName);
bizLogContext.setLogType(BizLogType.WORKFLOW);
bizLogContext.setLogSmallType(BizLogSmallType4Workflow.WORKFLOW_APPROVE);
bizLogContext.setOperateType(bizLogOperateType);
bizLogContext.setClientIp(Util.null2String(Util.getIpAddr(request)));
bizLogContext.setParams(ParamUtil.request2Map(request));
bizLogContext.setDesc(String.format(user.getLastname() + "进行了"+targetName+"操作"));
return bizLogContext;
}
/**
* 暂停撤销启用消息数据
* @param requestId
* @param user
* @param flag
*/
private boolean pushOperationMsg(int requestId,User user,String flag){
RequestOperationMsgManager romm = new RequestOperationMsgManager();
List<MsgEntity> requestMsgEntity = romm.getOperateMsgByReqId(String.valueOf(requestId),user,flag);
new MsgPushUtil().pushMsg(requestMsgEntity);
return true;
}
private void doArchiveRemind(int workflowid,int requestid){
String src = Util.null2String(request.getParameter("src"));
String remindTypes = Util.null2String(request.getParameter("remindTypes")); //表单上提醒方式
RequestRemindBiz requestRemindBiz = new RequestRemindBiz(user);
//默认提醒
WFManager wfManager = new WFManager();
try{
wfManager.setWfid(workflowid);
wfManager.getWfInfo();
}catch (Exception e){}
if("-1".equals(remindTypes)){ //老数据
int messageType = Util.getIntValue(Util.null2String(request.getParameter("messageType")),-1); // 老短信提醒
int mailMessageType = Util.getIntValue(Util.null2String(request.getParameter("chatsType")),-1); // 老邮件提醒
if(messageType >=1) requestRemindBiz.requestRemind(requestid,workflowid,src, RemindTypeEnum.SMS,messageType);
//历史数据可能只有短信提醒但是其实也开启了邮件提醒
int _mailMessageType = Util.getIntValue(wfManager.getMailMessageType(),-1);
if(mailMessageType == 1 || _mailMessageType == 1) requestRemindBiz.requestRemind(requestid,workflowid,src,RemindTypeEnum.EMAIL,0);
Set<String> remindType = new HashSet<>();
if(messageType >=1) {
requestRemindBiz.requestRemind(requestid,workflowid,src,RemindTypeEnum.SMS,messageType);
}
if(mailMessageType == 1 || _mailMessageType == 1) {
requestRemindBiz.requestRemind(requestid,workflowid,src,RemindTypeEnum.EMAIL,0);
}
}else{
String isSmsRemind = remindTypes.indexOf(RemindTypeEnum.SMS.getCode()) > -1 ? "1" : "0";
String isEmailRemind = remindTypes.indexOf(RemindTypeEnum.EMAIL.getCode()) > -1 ? "1" : "0";
if("1".equals(isSmsRemind)) requestRemindBiz.requestRemind(requestid,workflowid,src,RemindTypeEnum.SMS,0);
if("1".equals(isEmailRemind)) requestRemindBiz.requestRemind(requestid,workflowid,src,RemindTypeEnum.EMAIL,0);
}
requestRemindBiz.requestEmailApproveRemind(String.valueOf(workflowid),String.valueOf(requestid),src);
}
public HttpServletRequest getRequest() {
return request;
}
}

View File

@ -1,448 +0,0 @@
package com.fage;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.wbi.util.Util;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import weaver.general.TimeUtil;
import java.io.*;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;
import java.text.DecimalFormat;
import java.util.*;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
public class DemoTest {
public static void main(String[] args) {
// 示例日期字符串
String startDateStr = "2025-05-21";
// // 解析日期
// LocalDate startDate = LocalDate.parse(startDateStr);
// LocalDate endDate = LocalDate.now();
//
// // 计算工龄月份
// long monthsBetween = ChronoUnit.MONTHS.between(startDate, endDate);
//
// // 将月份转换为年并格式化为2位小数
// double years = (double) monthsBetween / 12;
// DecimalFormat df = new DecimalFormat("0.00"); // 设置格式为2位小数
String formattedYears = calculateAge(startDateStr);
// String kjshgl = "2.00";
// String endAge = String.valueOf(new BigDecimal(formattedYears).subtract(new BigDecimal(kjshgl)));
// 输出结果
// System.out.println("工龄(年): " + formattedYears);
//
// System.out.println(getMonthStartStr(startDateStr,0));
//
// System.out.println(getMonthByDateStr(startDateStr));
// System.out.println(getMonthEndByDateStr(startDateStr,0));
//
// String currenttime = TimeUtil.getOnlyCurrentTimeString();
//
// String ywrq = "2025-05-26";
// ywrq += "T"+currenttime;
//
// System.out.println(ywrq);
//
// System.out.println(ywrq.substring(0,7).replaceAll("-",""));
//
// String APP_SECRET = "YVBKbcEQSXlwcpOxjOGRhODWASSkzg";
// String data = System.currentTimeMillis() + "||" + APP_SECRET;
// String IV = APP_SECRET.substring(APP_SECRET.length() - 16);
// String key = APP_SECRET.substring(0, 16);
// System.out.println(encryptData(data, key, IV));
// double ycqzss=149.08;
// double yycqss=152.0;
// double fdxjsc = 0.0;
// double jrjbs=0.0;
// double prjbss=0.0;
//
// double xxrjbs = ycqzss - fdxjsc - yycqss - jrjbs - prjbss;
// System.out.println(xxrjbs);
//
// String dateStr1 = "2023-03-01";
// String dateStr2 = "2025-07-24";
//
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// LocalDate date1 = LocalDate.parse(dateStr1, formatter);
// LocalDate date2 = LocalDate.parse(dateStr2, formatter);
//
// long daysBetween = Math.abs(ChronoUnit.DAYS.between(date1, date2));
// System.out.println("相差天数: " + daysBetween);
// String aaa = "2025-08-07";
// System.out.println("相差天数: " + addDateDay(aaa,-24));
//
// String token = "X4eTEiMr-1pdUwi1c9vxTidpgSg8rhOGbl7GFPvG8465Kadur7e5KBjFl3FS5amfsls0nPpzA";
//
// String applyId = "5dd8c3ca-b986-441f-ba66-12e63c841152";
//
// String url = "http://openapi.italent.cn/RecruitV6/api/v1/Applicant/GetResumeByApplyId";
//
// String result = httpGetRequestInfo(url,applyId,token);
//
// System.out.println("北森,简历接口返回 : " + result);
//
// JSONObject maindata_jsonObject = JSONObject.parseObject(result);
//
// String data = maindata_jsonObject.get("data").toString();
// JSONObject data_jsonObject = JSONObject.parseObject(data);
//
// JSONArray itemArray = data_jsonObject.getJSONArray("personProfile");
// for (int i = 0; i < itemArray.size(); i++) {
// Map<String, Object> newmap = new HashMap<>();
//
// JSONObject dataObject = itemArray.getJSONObject(i);
//
// String name = dataObject.get("name").toString();
// System.out.println("北森name : " + name);
// }
// String a = "1999/02/12";
// a = a.replaceAll("/","-");
// System.out.println(a);
//
//
//
// String data = "{\n" +
// "\"education\": [\n" +
// "\t\t\t[\n" +
// "\t\t\t\t{\n" +
// "\t\t\t\t\t\"name\": \"_id\",\n" +
// "\t\t\t\t\t\"value\": \"b1c310ec-e661-48a6-891c-5838c5e92231\",\n" +
// "\t\t\t\t\t\"text\": \"b1c310ec-e661-48a6-891c-5838c5e92231\",\n" +
// "\t\t\t\t\t\"downloadUrl\": null\n" +
// "\t\t\t\t},\n" +
// "\t\t\t\t{\n" +
// "\t\t\t\t\t\"name\": \"EndDate\",\n" +
// "\t\t\t\t\t\"value\": \"2025/07\",\n" +
// "\t\t\t\t\t\"text\": \"2025/07\",\n" +
// "\t\t\t\t\t\"downloadUrl\": null\n" +
// "\t\t\t\t},\n" +
// "\t\t\t\t{\n" +
// "\t\t\t\t\t\"name\": \"EducationLevel\",\n" +
// "\t\t\t\t\t\"value\": \"1\",\n" +
// "\t\t\t\t\t\"text\": \"本科\",\n" +
// "\t\t\t\t\t\"downloadUrl\": null\n" +
// "\t\t\t\t},\n" +
// "\t\t\t\t{\n" +
// "\t\t\t\t\t\"name\": \"StartDate\",\n" +
// "\t\t\t\t\t\"value\": \"2021/09\",\n" +
// "\t\t\t\t\t\"text\": \"2021/09\",\n" +
// "\t\t\t\t\t\"downloadUrl\": null\n" +
// "\t\t\t\t},\n" +
// "\t\t\t\t{\n" +
// "\t\t\t\t\t\"name\": \"SchoolName\",\n" +
// "\t\t\t\t\t\"value\": \"10235\",\n" +
// "\t\t\t\t\t\"text\": \"大庆师范学院\",\n" +
// "\t\t\t\t\t\"downloadUrl\": null\n" +
// "\t\t\t\t},\n" +
// "\t\t\t\t{\n" +
// "\t\t\t\t\t\"name\": \"MajorName\",\n" +
// "\t\t\t\t\t\"value\": \"钢琴表演\",\n" +
// "\t\t\t\t\t\"text\": \"钢琴表演\",\n" +
// "\t\t\t\t\t\"downloadUrl\": null\n" +
// "\t\t\t\t}\n" +
// "\t\t\t]\n" +
// "\t\t]" +
// "}";
// JSONObject data_jsonObject = JSONObject.parseObject(data);
// JSONArray jyjlArray = data_jsonObject.getJSONArray("education");
// for (int i = 0; i < jyjlArray.size(); i++) {
// JSONArray dataArray = jyjlArray.getJSONArray(i);
// for (int j = 0; j < dataArray.size(); j++) {
// JSONObject dataObject = dataArray.getJSONObject(j);
// System.out.println(dataObject);
// String name = dataObject.get("name").toString();
// String value = dataObject.get("value").toString();
// String text = dataObject.get("text").toString();
// }
// }
String a = "1991-10-07";
System.out.println(a.substring(0,4));
System.out.println(a.substring(5,7));
System.out.println(a.substring(8,10));
System.out.println(a.substring(5,10));
// 假设入职日期是2020年1月1日
LocalDate hireDate = LocalDate.of(2023, 8, 30);
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算司龄总月份数除以12
double monthsBetween = Math.abs(Period.between(hireDate, currentDate).getMonths()) + 12 * Math.abs(Period.between(hireDate, currentDate).getYears());
double serviceYears = monthsBetween / 12.0; // 注意这里已经是总月份数除以12的结果可以直接格式化输出
// 使用DecimalFormat格式化输出保留两位小数
DecimalFormat df = new DecimalFormat("#.##"); // 注意这里的格式化符号使用的是英文的点号和井号而不是中文的井号和井号
String formattedServiceYears = df.format(serviceYears);
System.out.println("司龄(保留两位小数): " + formattedServiceYears + "");
String date1 = "2023-08-30";
String date2 = "2025-08-29";
int days = getDays(date1,date2);
System.out.println("相差天数:"+ days);
}
/**
* 发送 http get 请求参数以原生字符串进行提交
* @param urll
* @param applyId
* @param token
* @return
*/
public static String httpGetRequestInfo(String urll, String applyId, String token){
String result = "";
HttpURLConnection conn = null;
InputStream in=null;
BufferedReader reader=null;
int statusCode = 0;
try {
StringBuilder urlBuilder = new StringBuilder(urll);
urlBuilder.append("?");
urlBuilder.append("applyId").append("=").append(URLEncoder.encode(applyId, "UTF-8"));
System.out.println(" urlParameters : " + urlBuilder);
URL url = new URL(urlBuilder.toString());
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer "+ token);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
statusCode = conn.getResponseCode();
System.out.println(statusCode);
if (statusCode == 200) {
in = conn.getInputStream();
//通过InputStreamReader将字节流转换成字符串在通过BufferedReader将字符流转换成自带缓冲流
reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
String line = null;
//按行读取
while ((line = reader.readLine()) != null) {
sb.append(line);
}
result = sb.toString();
System.out.println(result);
}
} catch (Exception e) {
e.printStackTrace();
}finally{
if (conn != null) {
conn.disconnect();
}
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
public static String addDateDay(String daytime, int day){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
date = format.parse(daytime);
if (date == null){
return "";
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, day);// 加一天
date = cal.getTime();
cal = null;
return format.format(date);
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
/**
* 计算两个时间字符串日期的相差天数
*
* @param date1 字符串时间1
* @param date2 字符串时间2
* @return 相差时间
*/
public static int getDays(String date1, String date2) {
if (!"".equals(date1) && !"".equals(date2)) {
String date1Arr[] = date1.split("-");
String date2Arr[] = date2.split("-");
Calendar cal1 = Calendar.getInstance();
cal1.set(Integer.parseInt(date1Arr[0]), Integer.parseInt(date1Arr[1]) - 1, Integer.parseInt(date1Arr[2]));
Date date1Obj = cal1.getTime();
Calendar cal2 = Calendar.getInstance();
cal2.set(Integer.parseInt(date2Arr[0]), Integer.parseInt(date2Arr[1]) - 1, Integer.parseInt(date2Arr[2]));
Date date2Obj = cal2.getTime();
return calculateDays(date1Obj, date2Obj);
}
return 0;
}
/**
* 计算天数
* @param date1 日期
* @param date2 日期
* @return 天数
*/
public static int calculateDays(Date date1, Date date2) {
Calendar cal1 = Calendar.getInstance();
cal1.setTime(date1);
Calendar cal2 = Calendar.getInstance();
cal2.setTime(date2);
int day1 = cal1.get(Calendar.DAY_OF_YEAR);
int day2 = cal2.get(Calendar.DAY_OF_YEAR);
int year1 = cal1.get(Calendar.YEAR);
int year2 = cal2.get(Calendar.YEAR);
if (year1 != year2) {//不同
int timeDistance = 0;
if (year1 < year2) {//后面日期年大于前面日期
for (int i = year1; i < year2; i++) {
if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {//闰年
timeDistance += 366;
} else {//不是闰年
timeDistance += 365;
}
}
} else {
for (int i = year2; i < year1; i++) {
if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {//闰年
timeDistance += 366;
} else {//不是闰年
timeDistance += 365;
timeDistance = 0 - timeDistance;
}
}
}
return timeDistance + (day2 - day1);
} else {//同一年
return day2 - day1;
}
}
/**
*
* @param data 需要加密的数据
* @param key 秘钥
* @param IV 偏移量
* @return
*/
private static String encryptData(String data, String key, String IV) {
try {
//算法/模式/填充模式 AES/CBC/PKCS5Padding
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
int plaintextLength = dataBytes.length;
byte[] plaintext = new byte[plaintextLength];
System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivspec = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
byte[] encrypted = cipher.doFinal(plaintext);
//输出内容Base64处理
return new String(Base64.encodeBase64(encrypted));
} catch (Exception e) {
return null;
}
}
/**
* 根据日期字符串的月末
*
* @param dateStr 日期字符串
* @param num 上下某月
* @return 月初月末集合
*/
public static String getMonthEndByDateStr(String dateStr, int num) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String res = "";
try {
Date date = sdf.parse(dateStr);
Calendar c1 = Calendar.getInstance();
c1.setTime(date);
c1.add(Calendar.MONTH, num);
c1.set(Calendar.DAY_OF_MONTH, 1);
String start = sdf.format(c1.getTime());
Calendar c2 = Calendar.getInstance();
Date dateTemp = sdf.parse(start);
c2.setTime(dateTemp);
c2.add(Calendar.MONTH, 1);
c2.set(Calendar.DAY_OF_MONTH, 0);
res = sdf.format(c2.getTime());
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public static String calculateAge(String birthdate) {
String result = "0";
try {
// 解析日期
LocalDate startDate = LocalDate.parse(birthdate);
LocalDate endDate = LocalDate.now();
// 计算工龄月份
long monthsBetween = ChronoUnit.MONTHS.between(startDate, endDate);
// 将月份转换为年并格式化为2位小数
double years = (double) monthsBetween / 12;
DecimalFormat df = new DecimalFormat("0.00"); // 设置格式为2位小数
result = df.format(years);
}catch (Exception e){
e.printStackTrace();
}
return result;
}
}

View File

@ -1,143 +0,0 @@
package com.wuyuan.util;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
public class HrmWyUtil {
public String getFieldValue(String type,String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select "+type+" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",userid);
if(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
/**
* 根据 日期 计算年龄
* @param birthdate
* @return
*/
public String calculateAge(String birthdate) {
String result = "0";
try {
// 解析日期
LocalDate startDate = LocalDate.parse(birthdate);
LocalDate endDate = LocalDate.now();
// 计算工龄月份
long monthsBetween = ChronoUnit.MONTHS.between(startDate, endDate);
// 将月份转换为年并格式化为2位小数
double years = (double) monthsBetween / 12;
DecimalFormat df = new DecimalFormat("0.00"); // 设置格式为2位小数
result = df.format(years);
}catch (Exception e){
e.printStackTrace();
}
return result;
}
/**
* 计算两个日期之间相差天数
* @param fromdate
* @param todate
* @return
*/
public long getBetweenDays(String fromdate, String todate) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate date1 = LocalDate.parse(fromdate, formatter);
LocalDate date2 = LocalDate.parse(todate, formatter);
long daysBetween = Math.abs(ChronoUnit.DAYS.between(date1, date2));
return daysBetween;
}
/**
* 获取 党内职务 要取最新的开始时间的那一条
* @param userid
* @return
*/
public String getDnzw(String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select top 1 dnzw from uf_dnzwxx where xm=? order by rzkssj desc",userid);
if(rs.next()){
result = Util.null2String(rs.getString("dnzw"));
}
return result;
}
/**
* 获取 劳动合同 的信息
* @param type
* @param userid
* @return
*/
public String getLdht(String type,String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select top 1 "+type+" from uf_ldht where htzt='1' and xm=? order by htjsrq desc ",userid);
if(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
/**
* 获取 职称 的信息
* @param type
* @param userid
* @return
*/
public String getZcxx(String type,String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select top 1 "+type+" from uf_zcxx where sfzg='0' and xm=? order by rzkssj desc",userid);
if(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
/**
* 获取 工作经历 的信息
* @param type
* @param userid
* @return
*/
public String getGzjl(String type,String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select "+type+" from uf_gzjj where sfzg='0' and xm=? order by rzkssj desc",userid);
if(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
public String calculateCompanyAge(int year,int month,int day){
String result = "";
// 假设入职日期是2020年1月1日
LocalDate hireDate = LocalDate.of(year, month, day);
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算司龄总月份数除以12
double monthsBetween = Math.abs(Period.between(hireDate, currentDate).getMonths()) + 12 * Math.abs(Period.between(hireDate, currentDate).getYears());
double serviceYears = monthsBetween / 12.0; // 注意这里已经是总月份数除以12的结果可以直接格式化输出
// 使用DecimalFormat格式化输出保留两位小数
DecimalFormat df = new DecimalFormat("#.##"); // 注意这里的格式化符号使用的是英文的点号和井号而不是中文的井号和井号
result = df.format(serviceYears);
return result;
}
}

View File

@ -1,60 +0,0 @@
package weaver.formmode.customjavacode.modeexpand;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* 党内职务信息 新建编辑保存 调用
*
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致
* 请把编译后的class文件放在对应的目录中才能生效
* 注意 同一路径下java名不能相同
* @author Administrator
*
*/
public class DnzwExpandTemplate extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>();
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
try {
User user = (User)param.get("user");
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());
if(billid>0&&modeid>0){
//------请在下面编写业务逻辑代码------
rs.executeQuery("select top 1 * from uf_dnzwxx where id = ? order by id desc",billid);
if(rs.next()) {
//姓名
String xm = Util.null2String(rs.getString("xm"));
//党内职务
String dnzw = Util.null2String(rs.getString("dnzw"));
//更新人员卡片工作信息党内职务
rst.executeUpdate("update cus_fielddata set field14='"+dnzw+"' where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",xm);
}
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,60 +0,0 @@
package weaver.formmode.customjavacode.modeexpand;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* 工作经历 新建编辑保存 调用
*
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致
* 请把编译后的class文件放在对应的目录中才能生效
* 注意 同一路径下java名不能相同
* @author Administrator
*
*/
public class GzjlExpandTemplate extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>();
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
try {
User user = (User)param.get("user");
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());
if(billid>0&&modeid>0){
//------请在下面编写业务逻辑代码------
rs.executeQuery("select * from uf_gzjj where id = ?",billid);
if(rs.next()) {
//姓名
String xm = Util.null2String(rs.getString("xm"));
//劳动关系所属单位
String ldgxszdw = Util.null2String(rs.getString("ldgxszdw"));
//更新人员卡片工作信息专业技术资格名称资格级别
rst.executeUpdate("update cus_fielddata set field37='"+ldgxszdw+"' where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",xm);
}
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,78 +0,0 @@
package weaver.formmode.customjavacode.modeexpand;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* 教育经历 新建编辑保存 调用
*
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致
* 请把编译后的class文件放在对应的目录中才能生效
* 注意 同一路径下java名不能相同
* @author Administrator
*
*/
public class JyjlExpandTemplate extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>();
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
RecordSet rst = new RecordSet();
try {
User user = (User)param.get("user");
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());
if(billid>0&&modeid>0){
//------请在下面编写业务逻辑代码------
rs.executeQuery("select * from uf_jxjl where sfzgxl='0' and id = ?",billid);
if(rs.next()) {
//姓名
String xm = Util.null2String(rs.getString("xm"));
//学历
String xl = Util.null2String(rs.getString("xl1"));
//学习专业
String xxzy = Util.null2String(rs.getString("xxzy"));
//院校类别
String yxlb = Util.null2String(rs.getString("yxlb"));
//毕业院校
String byyx = Util.null2String(rs.getString("byyx"));
//更新人员卡片个人信息最高学历最高学历/学位专业毕业院校类型最高学历学位毕业学校
rst.executeUpdate("update cus_fielddata set field43='"+xl+"',field15='"+xxzy+"',field16='"+yxlb+"',field46='"+byyx+"' where scope='HrmCustomFieldByInfoType' and scopeid='1' and id=?",xm);
}
rs1.executeQuery("select * from uf_jxjl where sfzgxw='0' and id = ?",billid);
if(rs1.next()) {
//姓名
String xm = Util.null2String(rs1.getString("xm"));
//学位
String xw = Util.null2String(rs.getString("xw"));
//更新人员卡片个人信息,学位信息
rst.executeUpdate("update cus_fielddata set field44='"+xw+"' where scope='HrmCustomFieldByInfoType' and scopeid='1' and id=?",xm);
}
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,80 +0,0 @@
package weaver.formmode.customjavacode.modeexpand;
import java.util.HashMap;
import java.util.Map;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
/**
* 说明
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致
* 请把编译后的class文件放在对应的目录中才能生效
* 注意 同一路径下java名不能相同
* @author Administrator
*
*/
public class KqsdExpandTemplate extends AbstractModeExpandJavaCodeNew {
/**
* 执行模块扩展动作
* @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>();
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
RecordSet rst = new RecordSet();
try {
User user = (User)param.get("user");
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());
if(billid>0&&modeid>0){
//------请在下面编写业务逻辑代码------
rs.executeQuery("select * from uf_kqbbsd where id = ?",billid);
rs.next();
String deptid = Util.null2String(rs.getString("bm"));
String ksrq = Util.null2String(rs.getString("ksrq"));
String jsrq = Util.null2String(rs.getString("jsrq"));
int sfsd = Util.getIntValue(rs.getString("sfsd"),0);
rs1.executeQuery("select a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,case when b.sfqr='0' then '是' else '否' end as sfqr, " +
"b.kqdate " +
"from hrmresource a, kq_format_total b " +
"where a.id= b.resourceid and b.kqdate >='"+ksrq+"' and b.kqdate <='"+jsrq+"' " +
"and a.loginid is not null and a.loginid<>'' and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) and a.departmentid ="+deptid);
while(rs1.next()){
String mxid = Util.null2String(rs1.getString("id"));
String kqdate = Util.null2String(rs1.getString("kqdate"));
rst.executeUpdate("update kq_format_total set sfqr=? where resourceid = ? and kqdate = ?",sfsd,mxid,kqdate);
}
rst.executeUpdate("delete from uf_kqbbsdtxjlb where ksrq=? and bm=?",ksrq,deptid);
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,68 +0,0 @@
package weaver.formmode.customjavacode.modeexpand;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* 劳动合同新建编辑保存 调用
*
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致
* 请把编译后的class文件放在对应的目录中才能生效
* 注意 同一路径下java名不能相同
* @author Administrator
*
*/
public class LdhtExpandTemplate extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>();
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
try {
User user = (User)param.get("user");
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());
if(billid>0&&modeid>0){
//------请在下面编写业务逻辑代码------
rs.executeQuery("select top 1 * from uf_ldht where id = ? order by id desc",billid);
if(rs.next()) {
//姓名
String xm = Util.null2String(rs.getString("xm"));
//合同开始日期
String htksrq = Util.null2String(rs.getString("htksrq"));
//合同结束日期
String htjsrq = Util.null2String(rs.getString("htjsrq"));
//试用期截止日期
String syqjzrq = Util.null2String(rs.getString("syqjzrq"));
//转正日期
String zzrq = Util.null2String(rs.getString("zzrq"));
//更新人员卡片工作信息合同开始日期合同结束日期
rst.executeUpdate("update hrmresource set startdate='"+htksrq+"',enddate='"+htjsrq+"' where id=?",xm);
//更新人员卡片工作信息试用期截止日期转正日期
rst.executeUpdate("update cus_fielddata set field61='"+syqjzrq+"',field12='"+zzrq+"' where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",xm);
}
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,90 +0,0 @@
package weaver.formmode.customjavacode.modeexpand;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* 职称信息 新建编辑保存 调用
*
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致
* 请把编译后的class文件放在对应的目录中才能生效
* 注意 同一路径下java名不能相同
* @author Administrator
*
*/
public class ZcxxExpandTemplate extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>();
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
try {
User user = (User)param.get("user");
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());
if(billid>0&&modeid>0){
//------请在下面编写业务逻辑代码------
rs.executeQuery("select top 1 * from uf_zcxx where sfzg='0' and id = ? order by id desc ",billid);
if(rs.next()) {
//姓名
String xm = Util.null2String(rs.getString("xm"));
//专业技术资格名称
String zyjszgmc = Util.null2String(rs.getString("zyjszgmc"));
//专业技术资格系列
String zyjszgxl = Util.null2String(rs.getString("zyjszgxl"));
//资格级别
// 0 助理级
// 1 中级
// 2 副高级
// 3 正高级
// 4
// 0
// 1 助理级
// 2 中级
// 3 副高级
// 4 正高级
String zgjb = Util.null2String(rs.getString("zgjb"));
if("0".equals(zgjb)){
zgjb = "1";
}else if("1".equals(zgjb)){
zgjb = "2";
}else if("2".equals(zgjb)){
zgjb = "3";
}else if("3".equals(zgjb)){
zgjb = "4";
}else if("4".equals(zgjb)){
zgjb = "0";
}
//更新人员卡片个人信息专业技术资格系列
rst.executeUpdate("update cus_fielddata set field45='"+zyjszgmc+"' where scope='HrmCustomFieldByInfoType' and scopeid='1' and id=?",xm);
rs.writeLog("update cus_fielddata set field45='"+zyjszgmc+"' where scope='HrmCustomFieldByInfoType' and scopeid='1' and id="+ xm);
//更新人员卡片工作信息专业技术资格名称资格级别
rst.executeUpdate("update cus_fielddata set field21='"+zyjszgxl+"',field22='"+zgjb+"' where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",xm);
rs.writeLog("update cus_fielddata set field21='"+zyjszgxl+"',field22='"+zgjb+"' where scope='HrmCustomFieldByInfoType' and scopeid='3' and id="+ xm);
}
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,376 +0,0 @@
package weaver.interfaces.hzzx.cronjob;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.hzzx.conn.DataUtil;
import com.engine.hzzx.entity.Department;
import com.engine.hzzx.entity.Employee;
import com.engine.hzzx.entity.EmployeeTrans;
import com.engine.hzzx.entity.Position;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.*;
/**
* @author:dxfeng
* @createTime: 2025/03/12
* @version: 1.0
*/
public class SyncBeiSenInfoJob extends BaseCronJob {
private static final String TOKEN_URL = "https://openapi.italent.cn/token";
private static final String GET_EMPLOYMENT_URL = "https://openapi.italent.cn/TenantBaseExternal/api/v5/Employee/GetByTimeWindow";
private static final String GET_DEPARTMENT_URL = "https://openapi.italent.cn/TenantBaseExternal/api/v5/Organization/GetByIds";
private static final String GET_POSITION_URL = "https://openapi.italent.cn/TenantBaseExternal/api/v5/Position/GetByOIds";
private static final String APP_KEY = "EE7D602509E04A59AE5DEFF0841F6A1C";
private static final String APP_SECRET = "F5229D9D83BF45DEBFA1EF8DAC13C0339D0074419CFE45FA8BAC2A0B9D170798";
private static final String EMPLOYEE_TABLE = "uf_ybygzqbssjtz";
private static final String INTERNSHIP_TABLE = "uf_sxszqbssjtz";
private static final String OPERATE_ID = "1";
RecordSet rs = new RecordSet();
@Override
public void execute() {
try {
String accessToken = getToken();
// 获取近两天的数据
String startTime = DateUtil.getYesterday() + "T00:00:00";
String stopTime = DateUtil.getCurrentDate() + "T23:59:59";
// TODO 测试使用
startTime = "2025-03-01T00:00:00";
int[] empStatus = {1};
int[] employType = {0};
int[] internshipType = {2};
List<Employee> employeeList = new ArrayList<>();
getPendingEmployment(startTime, stopTime, empStatus, employType, accessToken, "", employeeList);
if (CollectionUtils.isNotEmpty(employeeList)) {
// 遍历待入职信息插入数据库
for (Employee employee : employeeList) {
rs.writeLog("遍历待入职信息===" + employee.toString());
insertEmployee(employee);
}
}
List<Employee> internshipList = new ArrayList<>();
getPendingEmployment(startTime, stopTime, empStatus, internshipType, accessToken, "", internshipList);
if (CollectionUtils.isNotEmpty(internshipList)) {
// 遍历实习生信息插入数据库
for (Employee employee : internshipList) {
rs.writeLog("遍历实习生信息===" + employee.toString());
insertInternshipEmployee(employee);
}
}
} catch (Exception e) {
rs.writeLog("同步失败", e.getMessage());
}
}
/**
* 获取待入职信息
*
* @param startTime
* @param stopTime
* @param empStatus
* @param accessToken
* @param scrollId
* @param employeeList
* @return
*/
private String getPendingEmployment(String startTime, String stopTime, int[] empStatus, int[] employType, String accessToken, String scrollId, List<Employee> employeeList) {
JSONObject json = new JSONObject();
json.put("startTime", startTime);
json.put("stopTime", stopTime);
json.put("empStatus", empStatus);
json.put("employType", employType);
if (StringUtils.isNotBlank(scrollId)) {
json.put("scrollId", scrollId);
}
rs.writeLog("GetByTimeWindow,入参===" + json.toString());
String response = HttpRequest.post(GET_EMPLOYMENT_URL)
.header("Authorization", "Bearer " + accessToken)
.body(json.toString())
.contentType("application/json")
.execute()
.body();
rs.writeLog("GetByTimeWindow,返参===" + response);
JSONObject jsonObject = JSONObject.parseObject(response);
String code = jsonObject.getString("code");
if (!"200".equals(code)) {
throw new RuntimeException("GetByTimeWindow接口调用失败");
}
scrollId = jsonObject.getString("scrollId");
JSONArray data = jsonObject.getJSONArray("data");
if (data == null || data.size() == 0) {
rs.writeLog("GetByTimeWindow,无数据");
return "";
}
for (int i = 0; i < data.size(); i++) {
JSONObject dataObject = data.getJSONObject(i);
JSONObject employeeInfo = dataObject.getJSONObject("employeeInfo");
JSONObject recordInfo = dataObject.getJSONObject("recordInfo");
Long oIdDepartment = recordInfo.getLong("oIdDepartment");
String oIdJobPosition = recordInfo.getString("oIdJobPosition");
Department department = getDepartment(oIdDepartment, accessToken);
Position position = getPosition(oIdJobPosition, accessToken);
Employee employeeObject = JSONObject.parseObject(employeeInfo.toJSONString(), Employee.class);
if (null != department) {
// 设置部门编号
employeeObject.setDepartmentCode(department.getCode());
}
if (null != position) {
// 设置岗位编号
employeeObject.setPositionCode(position.getCode());
employeeObject.setPositionName(position.getName());
}
employeeList.add(employeeObject);
}
return getPendingEmployment(startTime, stopTime, empStatus, employType, accessToken, scrollId, employeeList);
}
/**
* 获取access_token
*
* @return
*/
private String getToken() {
JSONObject json = new JSONObject();
json.put("grant_type", "client_credentials");
json.put("app_key", APP_KEY);
json.put("app_secret", APP_SECRET);
rs.writeLog("获取token,入参===" + json);
String response = HttpRequest.post(TOKEN_URL)
.body(json.toString())
.contentType("application/json")
.execute()
.body();
rs.writeLog("获取token,返参===" + response);
JSONObject jsonObject = JSONObject.parseObject(response);
String accessToken = jsonObject.getString("access_token");
if (StringUtils.isBlank(accessToken)) {
throw new RuntimeException("获取token失败");
}
return accessToken;
}
/**
* 获取部门信息
*
* @param oId
* @param accessToken
* @return
*/
private Department getDepartment(Long oId, String accessToken) {
JSONObject json = new JSONObject();
json.put("oIds", new Long[]{oId});
rs.writeLog("GET_DEPARTMENT_URL,入参===" + json);
String response = HttpRequest.post(GET_DEPARTMENT_URL)
.header("Authorization", "Bearer " + accessToken)
.body(json.toString())
.contentType("application/json")
.execute()
.body();
rs.writeLog("GET_DEPARTMENT_URL,返参===" + response);
JSONObject jsonObject = JSONObject.parseObject(response);
String code = jsonObject.getString("code");
if (!"200".equals(code)) {
throw new RuntimeException("GET_DEPARTMENT_URL接口调用失败");
}
JSONArray data = jsonObject.getJSONArray("data");
if (data.size() == 0) {
return null;
}
Department department = new Department();
JSONObject dataObject = data.getJSONObject(0);
department.setOId(dataObject.getString("oId"));
department.setName(dataObject.getString("name"));
department.setShortName(dataObject.getString("shortName"));
return department;
}
/**
* 获取职位信息
*
* @param oId
* @param accessToken
* @return
*/
private Position getPosition(String oId, String accessToken) {
JSONObject json = new JSONObject();
json.put("oIds", new String[]{oId});
rs.writeLog("GET_POSITION_URL,入参===" + json);
String response = HttpRequest.post(GET_POSITION_URL)
.header("Authorization", "Bearer " + accessToken)
.body(json.toString())
.contentType("application/json")
.execute()
.body();
rs.writeLog("GET_POSITION_URL,返参===" + response);
JSONObject jsonObject = JSONObject.parseObject(response);
String code = jsonObject.getString("code");
if (!"200".equals(code)) {
throw new RuntimeException("GET_POSITION_URL接口调用失败");
}
JSONArray data = jsonObject.getJSONArray("data");
if (data.size() == 0) {
return null;
}
JSONObject dataObject = data.getJSONObject(0);
Position position = new Position();
position.setOId(dataObject.getString("oId"));
position.setName(dataObject.getString("name"));
position.setCode(dataObject.getString("code"));
return position;
}
/**
* 插入一般员工数据
*
* @param employee
*/
private void insertEmployee(Employee employee) {
Map<String, String> insertData = new HashMap<>();
// 判断是否存在
String objectId = employee.getObjectId();
String sql = "select id from " + EMPLOYEE_TABLE + " where modeuuid = ?";
if (StringUtils.isNotBlank(objectId)) {
rs.executeQuery(sql, objectId);
if (rs.next()) {
rs.writeLog("查询员工信息,objectId==" + objectId + ",oaId==" + rs.getString("id"));
// 重复数据不做插入操作直接返回
return;
}
} else {
objectId = UUID.randomUUID().toString();
}
int formModeId = DataUtil.getModeIdByTableName(EMPLOYEE_TABLE);
int formId = DataUtil.getFormIdByTableName(EMPLOYEE_TABLE);
// 构建插入数据
insertData.put("xm", employee.getName());
insertData.put("xb", Util.null2String(employee.getGender()));
insertData.put("nl", String.valueOf(employee.getAge()));
// 政治面貌
rs.writeLog("政治面貌Status==" + employee.getPoliticalStatus());
String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
rs.writeLog("政治面貌Str==" + politicalStr);
if (StringUtils.isNotBlank(politicalStr)) {
rs.writeLog("formId==" + formId);
String zzmm = DataUtil.getSelectValue(String.valueOf(formId), "zzmm", politicalStr);
rs.writeLog("政治面貌Id==" + zzmm);
insertData.put("zzmm", zzmm);
}
// 部门
String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
if (StringUtils.isNotBlank(departmentId)) {
insertData.put("ypbm", departmentId);
}
// 职位
String jobtitleId = EmployeeTrans.getJobIdByName(employee.getPositionName());
if (StringUtils.isNotBlank(jobtitleId)) {
insertData.put("ypgw", jobtitleId);
}
// 学历
String educationLevelId = EmployeeTrans.getEducationLevelId(employee.getEducationLevel());
if (StringUtils.isNotBlank(educationLevelId)) {
insertData.put("xl", educationLevelId);
}
// 学校
insertData.put("xx", employee.getLastSchool());
// 专业
insertData.put("zy", employee.getMajor());
// 工作年限
// 构建建模基本数据
insertData.put("modeuuid", objectId);
insertData.put("formmodeid", String.valueOf(formModeId));
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
// 插入数据刷新权限
DataUtil.insertData(insertData, EMPLOYEE_TABLE);
DataUtil.refreshRight(objectId, EMPLOYEE_TABLE, formModeId, OPERATE_ID);
}
private void insertInternshipEmployee(Employee employee) {
Map<String, String> insertData = new HashMap<>();
// 判断是否存在
String objectId = employee.getObjectId();
String sql = "select id from " + INTERNSHIP_TABLE + " where modeuuid = ?";
if (StringUtils.isNotBlank(objectId)) {
rs.executeQuery(sql, objectId);
if (rs.next()) {
rs.writeLog("查询实习生信息,objectId==" + objectId + ",oaId==" + rs.getString("id"));
// 重复数据不做插入操作直接返回
return;
}
} else {
objectId = UUID.randomUUID().toString();
}
int formModeId = DataUtil.getModeIdByTableName(INTERNSHIP_TABLE);
// 构建插入数据
insertData.put("xm", employee.getName());
insertData.put("xb", Util.null2String(employee.getGender()));
// insertData.put("nl", String.valueOf(employee.getAge()));
// 政治面貌
//String politicalStr = EmployeeTrans.getPoliticalStr(employee.getPoliticalStatus());
//if (StringUtils.isNotBlank(politicalStr)) {
// insertData.put("zzmm", DataUtil.getSelectValue(formModeId, "zzmm", politicalStr));
//}
//// 部门
//String departmentId = EmployeeTrans.getDepartmentId(employee.getDepartmentCode());
//if (StringUtils.isNotBlank(departmentId)) {
// insertData.put("ypbm", departmentId);
//}
// 岗位
String jobtitleId = EmployeeTrans.getJobIdByName(employee.getPositionName());
if (StringUtils.isNotBlank(jobtitleId)) {
insertData.put("gw", jobtitleId);
}
// 目前学历
String educationLevelId = EmployeeTrans.getEducationLevelId(employee.getEducationLevel());
if (StringUtils.isNotBlank(educationLevelId)) {
insertData.put("mqxl", educationLevelId);
}
// 就读学校
insertData.put("jdxx", employee.getLastSchool());
// 就读专业
insertData.put("jdzy", employee.getMajor());
// 工作年限
// 构建建模基本数据
insertData.put("modeuuid", objectId);
insertData.put("formmodeid", String.valueOf(formModeId));
DataUtil.buildModeInsertFields(insertData, OPERATE_ID);
// 插入数据刷新权限
DataUtil.insertData(insertData, INTERNSHIP_TABLE);
DataUtil.refreshRight(objectId, INTERNSHIP_TABLE, formModeId, OPERATE_ID);
}
}

View File

@ -1,106 +0,0 @@
package weaver.interfaces.wuyuan.action;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
/**
* 入职办理流程 归档后 更新人员卡片的 工龄参加工作日期
*/
public class CalculateSeniorityAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
// 首次参加工作日期 自定义字段
String cjgzrq_fieldid = rs.getPropValue("wuyuan_hrminfo","cjgzrq_fieldid");
// 扣减社会工龄 自定义字段id
String kjshgl_fieldid = rs.getPropValue("wuyuan_hrminfo","kjshgl_fieldid");
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
rs.executeQuery("select * from "+ tablename +" where requestid = ?",requestid);
while(rs.next()) {
String sfzhm = Util.null2String(rs.getString("sfzhm"));
String userid = getUserIdBySfzhm(sfzhm);
//参加工作日期
String cjgzrq = Util.null2String(getFieldValue(cjgzrq_fieldid,userid));
rs.writeLog("============= CalculateSeniorityAction cjgzrq =================== "+ cjgzrq);
//扣减社会工龄
String kjshgl = Util.null2o(getFieldValue(kjshgl_fieldid,userid));
rs.writeLog("============= CalculateSeniorityAction kjshgl =================== "+ kjshgl);
String age = calculateAge(cjgzrq);
rs.writeLog("============= CalculateSeniorityAction age =================== "+ age);
if(cjgzrq != null && !"".equals(cjgzrq)){
rst.executeUpdate("update hrmresource set workstartdate='"+cjgzrq+"' where id=?",userid);
rs.writeLog("update hrmresource set workstartdate='"+cjgzrq+"' where id="+ userid);
if(Float.valueOf(kjshgl) > 0){
String endAge = String.valueOf(new BigDecimal(age).subtract(new BigDecimal(kjshgl)));
rst.executeUpdate("update hrmresource set workyear='"+endAge+"' where id=?",userid);
rs.writeLog("update hrmresource set workyear='"+endAge+"' where id="+userid);
}else{
rst.executeUpdate("update hrmresource set workyear='"+age+"' where id=?",userid);
rs.writeLog("update hrmresource set workyear='"+age+"' where id="+userid);
}
}
}
}catch (Exception e){
e.printStackTrace();
rs.writeLog(e);
}
return Action.SUCCESS;
}
public String getUserIdBySfzhm(String sfzhm){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select id from hrmresource where certificatenum='"+ sfzhm +"'");
if(rs.next()){
result = Util.null2String(rs.getString("id"));
}
return result;
}
public String getFieldValue(String type,String userid){
String result = "";
RecordSet rs = new RecordSet();
rs.executeQuery("select "+type+" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",userid);
if(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
public String calculateAge(String birthdate) {
String result = "0";
try {
// 解析日期
LocalDate startDate = LocalDate.parse(birthdate);
LocalDate endDate = LocalDate.now();
// 计算工龄月份
long monthsBetween = ChronoUnit.MONTHS.between(startDate, endDate);
// 将月份转换为年并格式化为2位小数
double years = (double) monthsBetween / 12;
DecimalFormat df = new DecimalFormat("0.00"); // 设置格式为2位小数
result = df.format(years);
}catch (Exception e){
e.printStackTrace();
}
return result;
}
}

View File

@ -1,410 +0,0 @@
package weaver.interfaces.wuyuan.action;
import weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.wuyuan.util.HttpUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 发布竞聘入围者名单公告 流程归档后 触发生成 干部任免审批表 流程
*/
public class CreateCadreAppointAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
String currentdate = TimeUtil.getCurrentDateString();
String currenttime = TimeUtil.getOnlyCurrentTimeString();
// 干部任免审批表 workflowid
int cadre_appoint_workflowid = Util.getIntValue(rs.getPropValue("hrm_wuyuan","cadre_appoint_workflowid"));
// 干部任免审批表 流程表名
String cadre_appoint_table = rs.getPropValue("hrm_wuyuan","cadre_appoint_table");
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
boolean bool = false;
rs.executeQuery("select * from "+ tablename +" where requestid = ?",requestid);
while(rs.next()) {
Map<String, Object> map = new HashMap();
String title = "干部任免审批表";
//干部竞聘主题
String gbjpzt = Util.null2String(rs.getString("gbjpzt"));
map.put("gbjpzt",gbjpzt);
//发布公告时间
String fbggsj = Util.null2String(rs.getString("fbggsj"));
//入围名单 多人力浏览
String rwmd = Util.null2String(rs.getString("rwmd"));
List<Map<String, Object>> dtList = new ArrayList<Map<String, Object>>();
for(String userId : rwmd.split(",")){
map.put("xm",userId);
String name = new ResourceComInfo().getLastname(userId);
title += "-"+name;
String sex = Util.null2String(getUseridByType("sex","id",userId));
if(sex != null && !"".equals(sex)){
map.put("xb",sex);
}
String birthday = Util.null2String(getUseridByType("birthday","id",userId));
if(birthday != null && !"".equals(birthday)){
birthday = birthday.substring(0,7);
map.put("csny",birthday);
}
String minzu = Util.null2String(getPersonCusFieldValue(userId,"field59"));
if(minzu != null && !"".equals(minzu)){
map.put("mz",minzu);
}
String jiguan = Util.null2String(getUseridByType("nativeplace","id",userId));
if(jiguan != null && !"".equals(jiguan)){
map.put("jg",jiguan);
}
String csd = Util.null2String(getPersonCusFieldValue(userId,"field38"));
if(csd != null && !"".equals(csd)){
map.put("csd",csd);
}
String rdsj = Util.null2String(getPersonCusFieldValue(userId,"field42"));
if(rdsj != null && !"".equals(rdsj)) {
map.put("rdsj", rdsj);
}
String cjgzsj = Util.null2String(getWorkCusFieldValue(userId,"field42"));
if(cjgzsj != null && !"".equals(cjgzsj)) {
map.put("cjgzsj", cjgzsj);
}
String jkzk = Util.null2String(getUseridByType("healthinfo","id",userId));
if(jkzk != null && !"".equals(jkzk)) {
map.put("jkzk", jkzk);
}
String zyjszw = Util.null2String(getPersonCusFieldValue(userId,"field45"));
if(zyjszw != null && !"".equals(zyjszw)) {
map.put("zyjszw", zyjszw);
}
String zhaopian = Util.null2String(getUseridByType("resourceimageid","id",userId));
if(zyjszw != null && !"".equals(zyjszw)) {
map.put("zp", zhaopian);
}
String qrzzgxl = Util.null2String(getUserQrzJyjjByType("xl","sfzgxl","0",userId));
if(qrzzgxl != null && !"".equals(qrzzgxl)) {
map.put("qrzzgxl12", qrzzgxl);
}
String qrzzgxw = Util.null2String(getUserQrzJyjjByType("xw","sfzgxw","0",userId));
if(qrzzgxw != null && !"".equals(qrzzgxw)) {
map.put("qrzzgxw", qrzzgxw);
}
String qrzzgxlbyxx = Util.null2String(getUserQrzJyjjByType("byyx","sfzgxl","0",userId));
if(qrzzgxlbyxx != null && !"".equals(qrzzgxlbyxx)) {
map.put("qrzzgxlbyxx", qrzzgxlbyxx);
}
String qrzzgxlbyzy = Util.null2String(getUserQrzJyjjByType("xxzy","sfzgxl","0",userId));
if(qrzzgxlbyzy != null && !"".equals(qrzzgxlbyzy)) {
map.put("qrzzgxlbyzy", qrzzgxlbyzy);
}
String fqrzzgxl = Util.null2String(getUserFqrzJyjjByType("xl","sfzgxl","0",userId));
if(fqrzzgxl != null && !"".equals(fqrzzgxl)) {
map.put("fqrzzgxl12", fqrzzgxl);
}
String fqrzzgxw = Util.null2String(getUserFqrzJyjjByType("xw","sfzgxw","0",userId));
if(fqrzzgxw != null && !"".equals(fqrzzgxw)) {
map.put("fqrzzgxw", fqrzzgxw);
}
String frzzgxlbyxx = Util.null2String(getUserFqrzJyjjByType("byyx","sfzgxl","0",userId));
if(frzzgxlbyxx != null && !"".equals(frzzgxlbyxx)) {
map.put("frzzgxlbyxx", frzzgxlbyxx);
}
String frzzgxlbyzy = Util.null2String(getUserFqrzJyjjByType("xxzy","sfzgxl","0",userId));
if(frzzgxlbyzy != null && !"".equals(frzzgxlbyzy)) {
map.put("frzzgxlbyzy", frzzgxlbyzy);
}
String xrzw = Util.null2String(getBaseCusFieldValue(userId,"field58"));
if(xrzw != null && !"".equals(xrzw)) {
map.put("xrzw", xrzw);
}
createMx1(userId,dtList);
title += "-"+currentdate;
rs.writeLog("============ CreateCadreAppointAction title ================ " + title);
rs.writeLog("============ CreateCadreAppointAction map ================ " + map);
String requestidd = HttpUtil.Createrequest(cadre_appoint_workflowid, Integer.parseInt(userId), title, "1", map, dtList, "1");
rs.writeLog("============ CreateCadreAppointAction requestid ================ " + requestidd);
if (Integer.parseInt(requestidd) > 0) {
String mainId = "" ;
String mainsql = " select id from "+cadre_appoint_table+" where requestid=?";
rs.executeQuery(mainsql, requestidd);
if(rs.next()){
mainId = Util.null2String(rs.getString("id"));
}
//流程明细2 工作经历
boolean insertWorkflowMx2 = insertWorkflowMx2(userId,mainId);
rs.writeLog("============ CreateCadreAppointAction insertWorkflowMx2 ================ " + insertWorkflowMx2);
bool = true;
} else {
continue;
}
}
}
if(bool){
return Action.SUCCESS;
}
}catch (Exception e){
e.printStackTrace();
rs.writeLog(e);
}
return Action.SUCCESS;
}
public static void createMx1(String xm,List<Map<String, Object>> list){
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_gzjj where xm=? order by qssj asc,zzsj asc",xm);
while(rs.next()){
Map<String, Object> map = new HashMap<String, Object>();
String qssj = Util.null2String(rs.getString("qssj"));
String zzsj = Util.null2String(rs.getString("zzsj"));
String lldw = Util.null2String(rs.getString("lldw"));
String rzgw = Util.null2String(rs.getString("rzgw"));
if(qssj != null && !"".equals(qssj)) {
map.put("qssj", qssj);
}
if(zzsj != null && !"".equals(zzsj)) {
map.put("jssj", zzsj);
}
if(lldw != null && !"".equals(lldw)) {
map.put("dwxxcgzbyhksx", lldw);
}
if(rzgw != null && !"".equals(rzgw)) {
map.put("gw", rzgw);
}
rs.writeLog("============ createMx1 map =============== "+ map);
list.add(map);
}
}
public static boolean insertWorkflowMx2(String xm,String mainid){
boolean bool = false;
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
String formtable = rs.getPropValue("hrm_wuyuan","cadre_appoint_table");
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
rst.executeUpdate(" delete from "+formtable+"_dt2 where mainid="+mainid);
rs.executeQuery("select * from uf_jtqk where xm=? order by id",xm);
while(rs.next()){
Map<String, Object> map = new HashMap<String, Object>();
String gx = Util.null2String(rs.getString("gx"));
String jtcyxm = Util.null2String(rs.getString("jtcyxm"));
String csrq = Util.null2String(rs.getString("csrq"));
String zzmm = Util.null2String(rs.getString("zzmm"));
String gzdw = Util.null2String(rs.getString("gzdw"));
String zw = Util.null2String(rs.getString("zw"));
String sfzhm = Util.null2String(rs.getString("sfzhm"));
if(gx != null && !"".equals(gx)) {
map.put("gx", gx);
}
if(jtcyxm != null && !"".equals(jtcyxm)) {
map.put("jtcyxm", jtcyxm);
}
if(csrq != null && !"".equals(csrq)) {
map.put("csrq", csrq);
}
if(zzmm != null && !"".equals(zzmm)) {
map.put("zzmm", zzmm);
}
if(gzdw != null && !"".equals(gzdw)) {
map.put("gzdw", gzdw);
}
if(zw != null && !"".equals(zw)) {
map.put("zw", zw);
}
if(sfzhm != null && !"".equals(sfzhm)) {
map.put("sfzhm", sfzhm);
}
rs.writeLog("============ insertWorkflowMx2 map =============== "+ map);
list.add(map);
}
if(list.size()>0){
int cou = insertDtTableByList(list,formtable+"_dt2",mainid);
if(cou > 0){
bool = true;
}
}
return bool;
}
public static int insertDtTableByList(List<Map<String,Object>> list,String table,String mainid) {
RecordSet rs = new RecordSet();
int count = 0;
if(list !=null && list.size() > 0)
{
for(int i=0; i<list.size();i++)
{
String tablename = "" ;
String tablenvalue = "" ;
Map<String,Object> map = list.get(i);
for (Map.Entry<String, Object> entry : map.entrySet())
{
String fieldname = Util.null2String(entry.getKey()).trim();
String fieldvalue = Util.null2String(entry.getValue()).replace("'", "''").trim();
tablename += tablename==""? fieldname :","+fieldname ;
tablenvalue += tablenvalue=="" ? "'"+fieldvalue+"'" :",'"+fieldvalue+"'" ;
}
if(tablename !="" && tablenvalue !="")
{
String sql = " insert into "+table+"(mainid,"+tablename+") values ('"+mainid+"',"+ tablenvalue +")";
rs.writeLog("sql:"+sql);
boolean boo = rs.execute(sql);
if(boo)
{
count++;
}
}
}
}
return count;
}
public static String getUseridByType(String name,String type,String value){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ name + " from hrmresource where "+type+" = ?",value);
while(rs.next()){
result = weaver.general.Util.null2String(rs.getString(name));
}
return result;
}
/**
* 获取 教育经历 全日制 信息
* @param name
* @param type
* @param typeValue
* @param value
* @return
*/
public static String getUserQrzJyjjByType(String name,String type,String typeValue,String value){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ name + " from uf_jxjl where xxxs='0' and "+type+"="+typeValue+" and xm=?",value);
while(rs.next()){
result = weaver.general.Util.null2String(rs.getString(name));
}
return result;
}
/**
* 获取 教育经历 非全日制 信息
* @param name
* @param type
* @param typeValue
* @param value
* @return
*/
public static String getUserFqrzJyjjByType(String name,String type,String typeValue,String value){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ name + " from uf_jxjl where xxxs='1' and "+type+"="+typeValue+" and xm=?",value);
while(rs.next()){
result = weaver.general.Util.null2String(rs.getString(name));
}
return result;
}
/**
* 获取 工作经历的 信息
* @param name
* @param type
* @param value
* @return
*/
public static String getUserGzjjByType(String name,String type,String value){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ name + " from uf_gzjj where "+type+" = ?",value);
while(rs.next()){
result = weaver.general.Util.null2String(rs.getString(name));
}
return result;
}
/**
* 获取 基本信息里的 自定义字段的
* @param userid
* @return
*/
public static String getBaseCusFieldValue(String userid,String fieldid){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ fieldid +" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='-1' and id=?",userid);
if(rs.next()){
result = weaver.general.Util.null2String(rs.getString(fieldid));
}
return result;
}
/**
* 获取 个人信息里的 自定义字段的
* @param userid
* @return
*/
public static String getPersonCusFieldValue(String userid,String fieldid){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ fieldid +" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='1' and id=?",userid);
if(rs.next()){
result = weaver.general.Util.null2String(rs.getString(fieldid));
}
return result;
}
/**
* 获取 工作信息里的 自定义字段的
* @param userid
* @return
*/
public static String getWorkCusFieldValue(String userid,String fieldid){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ fieldid +" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",userid);
if(rs.next()){
result = weaver.general.Util.null2String(rs.getString(fieldid));
}
return result;
}
}

View File

@ -1,559 +0,0 @@
package weaver.interfaces.wuyuan.action;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.wuyuan.util.HttpUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CreateDocumentaryTableAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
// 加入当前岗位时间 自定义字段id
String jrdqgwsj_fieldid = rs.getPropValue("hrm_wuyuan","jrdqgwsj_fieldid");
// 动议酝酿 流程表名
String proposal_brewing_table = rs.getPropValue("hrm_wuyuan","proposal_brewing_table");
// 发布竞聘公告 流程表名
String recruitment_announcement_table = rs.getPropValue("hrm_wuyuan","recruitment_announcement_table");
// 竞聘报名 流程表名
String competitionRegistration_table = rs.getPropValue("hrm_wuyuan","competitionRegistration_table");
// 报名情况审核 流程表名
String registrationStatusReview_table = rs.getPropValue("hrm_wuyuan","registrationStatusReview_table");
// 公布竞聘人员名单 流程表名
String gbjprymd_table = rs.getPropValue("hrm_wuyuan","gbjprymd_table");
// 竞聘答辩 流程表名
String competition_defense_table = rs.getPropValue("hrm_wuyuan","competition_defense_table");
// 发布竞聘入围者名单公告 流程表名
String fbjprwzmdgg_table = rs.getPropValue("hrm_wuyuan","fbjprwzmdgg_table");
// 民族测评记录 流程表名
String democratic_appraisal_table = rs.getPropValue("hrm_wuyuan","democratic_appraisal_table");
// 考察谈话 流程表名
String examination_conversation_table = rs.getPropValue("hrm_wuyuan","examination_conversation_table");
// 各类材料 流程表名
String various_materials_table = rs.getPropValue("hrm_wuyuan","various_materials_table");
// 总支委会 流程表名
String general_branch_committee_table = rs.getPropValue("hrm_wuyuan","general_branch_committee_table");
// 主任办公会 流程表名
String director_office_meeting_table = rs.getPropValue("hrm_wuyuan","director_office_meeting_table");
// 任前公示 流程表名
String pre_employment_announcement_table = rs.getPropValue("hrm_wuyuan","pre_employment_announcement_table");
// 聘任发文 流程表名
String appointment_document_table = rs.getPropValue("hrm_wuyuan","appointment_document_table");
// 生成纪实表 workflowid
int documentary_table_workflowid = Util.getIntValue(rs.getPropValue("hrm_wuyuan","documentary_table_workflowid"));
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String title = "生成纪实表";
String currentdate = TimeUtil.getCurrentDateString();
rs.executeQuery("select * from "+ tablename +" where requestid = ?",requestid);
while(rs.next()){
Map<String,Object> map = new HashMap();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
//姓名
String xm = Util.null2String(rs.getString("xm"));
if(xm != null && !"".equals(xm)) {
map.put("xm", xm);
}
String name = new ResourceComInfo().getLastname(xm);
title += "-"+name;
//工号
String gh = Util.null2String(rs.getString("gh"));
if(gh != null && !"".equals(gh)) {
map.put("gh", gh);
}
//干部竞聘主题
String gbjpzt = Util.null2String(rs.getString("gbjpzt"));
if(gbjpzt != null && !"".equals(gbjpzt)) {
map.put("gbjpzt", gbjpzt);
}
title += "-"+currentdate;
//性别
String xb = Util.null2String(rs.getString("xb"));
if(xb != null && !"".equals(xb)) {
map.put("xb", xb);
}
//出生年月
String csny = Util.null2String(rs.getString("csny"));
if(csny != null && !"".equals(csny)) {
map.put("csny", csny);
}
//民族
String mz = Util.null2String(rs.getString("mz"));
if(mz != null && !"".equals(mz)) {
map.put("mz", mz);
}
//学历
String xl = Util.null2String(rs.getString("qrzzgxl"));
if(xl != null && !"".equals(xl)) {
map.put("xl1", xl);
}
//学位
String xw = Util.null2String(rs.getString("qrzzgxw"));
if(xw != null && !"".equals(xw)) {
map.put("xw1", xw);
}
//职称
String zc = Util.null2String(rs.getString("zc"));
if(zc != null && !"".equals(zc)) {
map.put("zc", zc);
}
//参加工作时间
String cjgzsj = Util.null2String(rs.getString("cjgzsj"));
if(cjgzsj != null && !"".equals(cjgzsj)) {
map.put("cjgzsj", cjgzsj);
}
//入党时间
String rdsj = Util.null2String(rs.getString("rdsj"));
if(rdsj != null && !"".equals(rdsj)) {
map.put("rdsj", rdsj);
}
//现任职务
String xrzw = Util.null2String(rs.getString("xrzw"));
if(xrzw != null && !"".equals(xrzw)) {
map.put("xrzw", xrzw);
}
//任现职务时间
String rxzwsj = Util.null2String(getWorkCusFieldValue(xm,jrdqgwsj_fieldid));
if(rxzwsj != null && !"".equals(rxzwsj)) {
map.put("rxzwsj", rxzwsj);
}
//照片
String zp = Util.null2String(rs.getString("zp"));
if(zp != null && !"".equals(zp)) {
map.put("zp", zp);
}
//竞聘岗位
String jpgw = Util.null2String(getValueByTypeTable("jpgw",competitionRegistration_table,gbjpzt,xm));
if(jpgw != null && !"".equals(jpgw)) {
map.put("jpgw", jpgw);
}
//会议时间
String hysj = Util.null2String(getDyynValueByTypeTable("hysj",proposal_brewing_table,gbjpzt,xm));
if(hysj != null && !"".equals(hysj)) {
map.put("hysj", hysj);
}
//参会人员
String chry = Util.null2String(getDyynValueByTypeTable("cjr",proposal_brewing_table,gbjpzt,xm));
if(chry != null && !"".equals(chry)) {
map.put("chry", chry);
}
//发布时间
String fbsj = Util.null2String(getValueByTypeTable("fbggsj",fbjprwzmdgg_table,gbjpzt,null));
if(fbsj != null && !"".equals(fbsj)) {
map.put("fbsj", fbsj);
}
//发布范围
String fbfw = Util.null2String(getValueByTypeTable("rwmd",fbjprwzmdgg_table,gbjpzt,null));
if(fbfw != null && !"".equals(fbfw)) {
map.put("fbfw", fbfw);
}
//报名方式
String bmfs = Util.null2String(getValueByTypeTable("rwmd",fbjprwzmdgg_table,gbjpzt,null));
if(bmfs != null && !"".equals(bmfs)) {
map.put("bmfs", bmfs);
}
//报名人数
String bmrs = Util.null2String(getBmqkshCount(registrationStatusReview_table,gbjpzt,"0"));
if(bmrs != null && !"".equals(bmrs)) {
map.put("bmrs", bmrs);
}
//符合任职资格人数
String fhrzzgrs = Util.null2String(getBmqkshCount(registrationStatusReview_table,gbjpzt,"0"));
if(fhrzzgrs != null && !"".equals(fhrzzgrs)) {
map.put("fhrzzgrs", fhrzzgrs);
}
//答辩时间
String dbsj = Util.null2String(getCompetitionDefenseInfo(competition_defense_table,gbjpzt,xm,"dbsj"));
if(dbsj != null && !"".equals(dbsj)) {
map.put("dbsj", dbsj);
}
//评委人数
String pwrs = Util.null2String(getCompetitionDefenseInfo(competition_defense_table,gbjpzt,xm,"pwrs"));
if(pwrs != null && !"".equals(pwrs)) {
map.put("pwrs", pwrs);
}
//答辩成绩 答辩分数
String dbcj = Util.null2String(getCompetitionDefenseInfo(competition_defense_table,gbjpzt,xm,"dbfs"));
if(dbcj != null && !"".equals(dbcj)) {
map.put("dbcj", dbcj);
}
//排名
String pm = Util.null2String(getCompetitionDefenseInfo(competition_defense_table,gbjpzt,xm,"pm"));
if(pm != null && !"".equals(pm)) {
map.put("pm", pm);
}
//民主测评时间
String sj = Util.null2String(getDemocraticAppraisalInfo(democratic_appraisal_table,gbjpzt,xm,"mzcpsj"));
if(sj != null && !"".equals(sj)) {
map.put("sj", sj);
}
//民主测评参会人员
String chrs = Util.null2String(getDemocraticAppraisalInfo(democratic_appraisal_table,gbjpzt,xm,"cjcpry"));
if(chrs != null && !"".equals(chrs)) {
map.put("chrs", chrs);
}
//民主测评得票
String dp = Util.null2String(getDemocraticAppraisalInfo(democratic_appraisal_table,gbjpzt,xm,"ty"));
if(dp != null && !"".equals(dp)) {
map.put("dp", dp);
}
//民主测评排名
String pm2 = Util.null2String(getDemocraticAppraisalInfo(democratic_appraisal_table,gbjpzt,xm,"pm"));
if(pm2 != null && !"".equals(pm2)) {
map.put("pm2", pm2);
}
//考察谈话 考察组成员
String kczcy = Util.null2String(getExaminationConversationInfo(examination_conversation_table,gbjpzt,xm,"kczcy"));
if(kczcy != null && !"".equals(kczcy)) {
map.put("kczcy", kczcy);
}
//考察谈话 考察时间
String kcsj = Util.null2String(getExaminationConversationInfo(examination_conversation_table,gbjpzt,xm,"kcthsj"));
if(kcsj != null && !"".equals(kcsj)) {
map.put("kcsj", kcsj);
}
//考察谈话 考察结果
String kcjg = Util.null2String(getExaminationConversationInfo(examination_conversation_table,gbjpzt,xm,"kcjg"));
if(kcjg != null && !"".equals(kcjg)) {
map.put("kcjg", kcjg);
}
//档案核查
//征求纪检意见情况
//总支委会审议 会议时间
String hysj2 = Util.null2String(getGeneralBranchCommitteeInfo(general_branch_committee_table,gbjpzt,"hysj"));
if(hysj2 != null && !"".equals(hysj2)) {
map.put("hysj2", hysj2);
}
//总支委会审议 会议结果
String hyjg = Util.null2String(getGeneralBranchCommitteeInfo(general_branch_committee_table,gbjpzt,"bjjg"));
if(hyjg != null && !"".equals(hyjg)) {
map.put("hyjg", hyjg);
}
//总支委会审议 参会人员
String chry2 = Util.null2String(getGeneralBranchCommitteeInfo(general_branch_committee_table,gbjpzt,"chry"));
if(chry2 != null && !"".equals(chry2)) {
map.put("chry2", chry2);
}
//中心主任办公会审定 会议时间
String hysj3 = Util.null2String(getDirectorOfficeMeetingInfo(director_office_meeting_table,gbjpzt,"hysj"));
if(hysj3 != null && !"".equals(hysj3)) {
map.put("hysj3", hysj3);
}
//中心主任办公会审定 会议结果
String hyjg3 = Util.null2String(getDirectorOfficeMeetingInfo(director_office_meeting_table,gbjpzt,"bjjg"));
if(hyjg3 != null && !"".equals(hyjg3)) {
map.put("hyjg3", hyjg3);
}
//中心主任办公会审定 参会人员
String chry3 = Util.null2String(getDirectorOfficeMeetingInfo(director_office_meeting_table,gbjpzt,"chry"));
if(chry3 != null && !"".equals(chry3)) {
map.put("chry3", chry3);
}
//任前公示 公示时间
String gssj = Util.null2String(getPreEmploymentAnnouncementInfo(pre_employment_announcement_table,gbjpzt,"gssj"));
if(gssj != null && !"".equals(gssj)) {
map.put("gssj", gssj);
}
//任前公示 公示范围
String gsfw = Util.null2String(getPreEmploymentAnnouncementInfo(pre_employment_announcement_table,gbjpzt,"gsfw"));
if(gsfw != null && !"".equals(gsfw)) {
map.put("gsfw", gsfw);
}
//任前公示 有无举报
String ywjb = Util.null2String(getPreEmploymentAnnouncementInfo(pre_employment_announcement_table,gbjpzt,"ywjb"));
if(ywjb != null && !"".equals(ywjb)) {
map.put("ywjb", ywjb);
}
//聘任发文 发文时间
String fwsj = Util.null2String(getAppointmentDocumentInfo(appointment_document_table,gbjpzt,"rqthsj"));
if(fwsj != null && !"".equals(fwsj)) {
map.put("fwsj", fwsj);
}
//聘任发文 发文文号
String fwwh = Util.null2String(getAppointmentDocumentInfo(appointment_document_table,gbjpzt,"rzwh"));
if(fwwh != null && !"".equals(fwwh)) {
map.put("fwwh", fwwh);
}
//聘任发文 谈话人
String thr = Util.null2String(getAppointmentDocumentInfo(appointment_document_table,gbjpzt,"thr"));
if(thr != null && !"".equals(thr)) {
map.put("thr", thr);
}
String requestidd = HttpUtil.Createrequest(documentary_table_workflowid, Integer.parseInt(xm), title, "1", map, list, "1");
if (Integer.parseInt(requestidd) > 0) {
return Action.SUCCESS;
} else {
return Action.FAILURE_AND_CONTINUE;
}
}
}catch (Exception e){
e.printStackTrace();
rs.writeLog(e);
}
return Action.SUCCESS;
}
public static String getDyynValueByTypeTable(String type,String table,String gbjpzt,String xm){
String result = null;
RecordSet rs = new RecordSet();
String where = "";
if(xm != null && !"".equals(xm)){
where += " and b.creater = "+ xm;
}
rs.executeQuery("select a."+ type +" from "+ table +" a,workflow_requestbase b,uf_hyyctz c where a.requestid=b.requestid and a.ztqs=c.btjqs and b.currentnodetype='3' and c.id=? "+ where,gbjpzt);
while(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
public static String getValueByTypeTable(String type,String table,String gbjpzt,String xm){
String result = null;
RecordSet rs = new RecordSet();
String where = "";
if(xm != null && !"".equals(xm)){
where += " and a.xm = "+ xm;
}
rs.executeQuery("select "+ type +" from "+ table +" a,workflow_requestbase b where a.requestid=b.requestid and b.currentnodetype='3' and a.gbjpzt=? "+ where,gbjpzt);
while(rs.next()){
result = Util.null2String(rs.getString(type));
}
return result;
}
/**
* 获取 工作信息里的 自定义字段的
* @param userid
* @return
*/
public static String getWorkCusFieldValue(String userid,String fieldid){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ fieldid +" from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid='3' and id=?",userid);
if(rs.next()){
result = Util.null2String(rs.getString(fieldid));
}
return result;
}
/**
* 查询报名情况审核的人数 type=0 代表审核通过 符合条件的 人数
* @param table
* @param gbjpzt
* @param type
* @return
*/
public static String getBmqkshCount(String table,String gbjpzt,String type){
String result = "0";
RecordSet rs = new RecordSet();
String tableDt = table+"_dt1";
String where = "";
if(type != null && !"".equals(type)){
where += " and b.shjg = "+ type;
}
rs.executeQuery("select count(b.id) as count from "+ table +" a,"+ tableDt +" b,workflow_requestbase c where a.id=b.mainid and a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? "+ where,gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString("count"));
}
return result;
}
/**
* 获取 竞聘答辩 字段信息
* @param table
* @param gbjpzt
* @param xm
* @param type
* @return
*/
public static String getCompetitionDefenseInfo(String table,String gbjpzt,String xm,String type){
String result = null;
RecordSet rs = new RecordSet();
String tableDt = table+"_dt1";
String where = "";
if(xm != null && !"".equals(xm)){
where += " and b.jpry = "+ xm;
}
rs.executeQuery("select "+ type +" from "+ table +" a,"+ tableDt +" b,workflow_requestbase c where a.id=b.mainid and a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? "+ where,gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
/**
* 获取 民主测评 字段信息
* @param table
* @param gbjpzt
* @param xm
* @param type
* @return
*/
public static String getDemocraticAppraisalInfo(String table,String gbjpzt,String xm,String type){
String result = null;
RecordSet rs = new RecordSet();
String tableDt = table+"_dt1";
String where = "";
if(xm != null && !"".equals(xm)){
where += " and b.kcdx = "+ xm;
}
rs.executeQuery("select "+ type +" from "+ table +" a,"+ tableDt +" b,workflow_requestbase c where a.id=b.mainid and a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? "+ where,gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
/**
* 获取 考察谈话 字段信息
* @param table
* @param gbjpzt
* @param xm
* @param type
* @return
*/
public static String getExaminationConversationInfo(String table,String gbjpzt,String xm,String type){
String result = null;
RecordSet rs = new RecordSet();
String tableDt = table+"_dt1";
String where = "";
if(xm != null && !"".equals(xm)){
where += " and b.kcdx = "+ xm;
}
rs.executeQuery("select "+ type +" from "+ table +" a,"+ tableDt +" b,workflow_requestbase c where a.id=b.mainid and a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? "+ where,gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
/**
* 获取 总支委会 字段信息
* @param table
* @param gbjpzt
* @param type
* @return
*/
public static String getGeneralBranchCommitteeInfo(String table,String gbjpzt,String type){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ type +" from "+ table +" a,workflow_requestbase c where a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? ",gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
/**
* 获取 主任办公会 字段信息
* @param table
* @param gbjpzt
* @param type
* @return
*/
public static String getDirectorOfficeMeetingInfo(String table,String gbjpzt,String type){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ type +" from "+ table +" a,workflow_requestbase c where a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? ",gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
/**
* 获取 任前公示 字段信息
* @param table
* @param gbjpzt
* @param type
* @return
*/
public static String getPreEmploymentAnnouncementInfo(String table,String gbjpzt,String type){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ type +" from "+ table +" a,workflow_requestbase c where a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? ",gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
/**
* 获取 聘任发文 字段信息
* @param table
* @param gbjpzt
* @param type
* @return
*/
public static String getAppointmentDocumentInfo(String table,String gbjpzt,String type){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ type +" from "+ table +" a,workflow_requestbase c where a.requestid=c.requestid and c.currentnodetype='3' and a.gbjpzt=? ",gbjpzt);
if(rs.next()){
result = Util.null2o(rs.getString(type));
}
return result;
}
}

View File

@ -1,105 +0,0 @@
package weaver.interfaces.wuyuan.action;
import com.wbi.util.Util;
import weaver.conn.RecordSet;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.wuyuan.util.HttpUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 新员工试用期目标确定 流程归档后 触发 新员工试用期评价 流程 给导师的待办
*/
public class CreateEvaluateNewEmployAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
// 新员工试用期评价 workflowid
String evaluateNewEmploy_workflowid = rs.getPropValue("hrm_wuyuan","evaluateNewEmploy_workflowid");
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String title = "关于";
rs.executeQuery("select * from "+ tablename +" where requestid = ?",requestid);
while(rs.next()){
Map<String,Object> map = new HashMap();
//身份证号码
String userId = Util.null2String(rs.getString("xm"));
if(userId != null && !"".equals(userId)) {
//用户id
map.put("xm", userId);
}
//工号
String workcode = Util.null2String(rs.getString("gh"));
if(workcode != null && !"".equals(workcode)) {
map.put("gh", workcode);
}
//所属部门
String deptId = Util.null2String(rs.getString("szbm"));
if(deptId != null && !"".equals(deptId)) {
map.put("szbm", deptId);
}
String deptName = new DepartmentComInfo().getDepartmentName(deptId);
title += deptName;
//用户姓名
String lastname = new ResourceComInfo().getLastname(userId);
title += lastname;
title += "的试用期评价记录表";
//岗位
String gwId = Util.null2String(rs.getString("gww"));
if(gwId != null && !"".equals(gwId)) {
map.put("gww", gwId);
}
//入职日期
String rzrq = Util.null2String(rs.getString("rzrq"));
if(rzrq != null && !"".equals(rzrq)) {
map.put("rzrq", rzrq);
}
//试用期开始日期
String syqksrq = Util.null2String(rs.getString("syqksrq"));
if(syqksrq != null && !"".equals(syqksrq)) {
map.put("syqksrq", syqksrq);
}
//试用期结束日期
String syqjzrq = Util.null2String(rs.getString("syqjzrq"));
if(syqjzrq != null && !"".equals(syqjzrq)) {
map.put("syqjzrq", syqjzrq);
}
List<Map<String, Object>> dtList = new ArrayList<Map<String, Object>>();
rs.writeLog("=============== CreateEvaluateNewEmployAction map ========================== "+ map);
String requestidd = HttpUtil.Createrequest(Integer.parseInt(evaluateNewEmploy_workflowid), Integer.parseInt(userId), title, "0", map, dtList, null);
if (Integer.parseInt(requestidd) > 0) {
return Action.SUCCESS;
} else {
return Action.FAILURE_AND_CONTINUE;
}
}
}catch (Exception e){
e.printStackTrace();
requestInfo.getRequestManager().setMessagecontent("生成新员工试用期评价流程失败!");
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

View File

@ -1,117 +0,0 @@
package weaver.interfaces.wuyuan.action;
import com.wbi.util.Util;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.wuyuan.util.HttpUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
/**
* 确认入职流程归档后 触发 员工的流程待办 新员工试用期目标确定
*/
public class CreateGoalNewEmployAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
RecordSetTrans rts = new RecordSetTrans();
rs.writeLog("=============================== start to create goal new employ =================================================");
// 新员工试用期目标确定 workflowid
String goalNewEmploy_workflowid = rs.getPropValue("hrm_wuyuan","goalNewEmploy_workflowid");
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String title = "关于";
rts.setAutoCommit(false);
rs.executeQuery("select * from "+ tablename +" where requestid = ?",requestid);
while(rs.next()){
Map<String,Object> map = new HashMap();
//身份证号码
String sfzhm = Util.null2String(rs.getString("sfzhm"));
//员工类别 0-劳动合同员工 1-劳务派遣员工
String yglb = Util.null2String(rs.getString("yglb"));
//用户id
String userId = Util.null2String(HttpUtil.getUseridByType("id","certificatenum",sfzhm));
if(userId != null && !"".equals(userId)) {
if("0".equals(yglb) || "1".equals(yglb)){
map.put("xm", userId);
//工号
String workcode = new ResourceComInfo().getWorkcode(userId);
if (workcode != null && !"".equals(workcode)) {
map.put("gh", workcode);
}
//所属部门
String deptId = new ResourceComInfo().getDepartmentID(userId);
if (deptId != null && !"".equals(deptId)) {
map.put("szbm", deptId);
}
String deptName = new DepartmentComInfo().getDepartmentName(deptId);
title += deptName;
//用户姓名
String lastname = new ResourceComInfo().getLastname(userId);
title += lastname;
title += "的试用期目标确定表";
//岗位
String gwId = new ResourceComInfo().getJobTitle(userId);
if (gwId != null && !"".equals(gwId)) {
map.put("gw", gwId);
}
//入职日期
String rzrq = Util.null2String(rs.getString("rzrq"));
if (rzrq != null && !"".equals(rzrq)) {
map.put("rzrq", rzrq);
}
//试用期开始日期
String syqksrq = Util.null2String(rs.getString("syqksrq"));
if (syqksrq != null && !"".equals(syqksrq)) {
map.put("syqksrq", syqksrq);
}
//试用期结束日期
String syqjzrq = Util.null2String(rs.getString("syqjzrq"));
if (syqjzrq != null && !"".equals(syqjzrq)) {
map.put("syqjzrq", syqjzrq);
}
List<Map<String, Object>> dtList = new ArrayList<Map<String, Object>>();
rs.writeLog("=============================== create goal new employ map =================================================" + map);
String requestidd = HttpUtil.Createrequest(Integer.parseInt(goalNewEmploy_workflowid), Integer.parseInt(userId), title, "0", map, dtList, null);
if (Integer.parseInt(requestidd) > 0) {
rts.commit();
return Action.SUCCESS;
} else {
rts.rollback();
return Action.FAILURE_AND_CONTINUE;
}
}
}else{
rts.commit();
}
}
rs.writeLog("=============================== end to create goal new employ =================================================");
}catch (Exception e){
rs.writeLog("=============================== create goal new employ error ================================================="+ e);
e.printStackTrace();
rts.rollback();
requestInfo.getRequestManager().setMessagecontent("生成新员工试用期目标确定流程失败!");
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

View File

@ -1,163 +0,0 @@
package weaver.interfaces.wuyuan.action;
import com.wbi.util.Util;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.wuyuan.util.HttpUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
/**
* 竞聘报名 流程归档后 触发生成 报名情况审核 流程
*/
public class CreateRegistrationStatusReviewAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
RecordSet rst = new RecordSet();
// 报名情况审核 workflowid
String registrationStatusReview_workflowid = rs.getPropValue("hrm_wuyuan","registrationStatusReview_workflowid");
// 报名情况审核 流程表名
String registrationStatusReview_table = rs.getPropValue("hrm_wuyuan","registrationStatusReview_table");
// 报名情况审核 流程表 明细1
String registrationStatusReview_table_dt1 = registrationStatusReview_table + "_dt1";
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String requestid = requestInfo.getRequestid();
String title = "报名情况审核";
String currentdate = TimeUtil.getCurrentDateString();
rs.executeQuery("select * from "+ tablename +" where requestid = ?",requestid);
while(rs.next()){
Map<String,Object> map = new HashMap();
//干部竞聘主题
String gbjpzt = Util.null2String(rs.getString("gbjpzt"));
if(gbjpzt != null && !"".equals(gbjpzt)) {
map.put("gbjpzt", gbjpzt);
}
String createter = getFbjpggFqr(gbjpzt);
//姓名
String xm = Util.null2String(rs.getString("xm"));
String name = new ResourceComInfo().getLastname(xm);
title += "-"+name;
//竞聘岗位
String jpgw = Util.null2String(rs.getString("jpgw"));
title += "-"+currentdate;
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map1 = new HashMap<String, Object>();
if(xm != null && !"".equals(xm)) {
map1.put("xm",xm);
}
if(jpgw != null && !"".equals(jpgw)) {
map1.put("jpgw", jpgw);
}
if(gbjpzt != null && !"".equals(gbjpzt)) {
map1.put("gbjpzt", gbjpzt);
}
if(requestid != null && !"".equals(requestid)) {
map1.put("bmqk", requestid);
}
//提交结果
map1.put("tjjg", "1");
list.add(map1);
//是否已经有了 报名情况审核 流程
boolean bool = checkHasWork(gbjpzt);
//插入新的明细
if(bool){
String mainid = getMainid(gbjpzt);
boolean bole = rst.executeUpdate("insert into "+ registrationStatusReview_table_dt1 +" (mainid,bmqk,gbjpzt,jpgw,xm,shjg,tjjg) values(?,?,?,?,?,?,?)",mainid,requestid,gbjpzt,jpgw,xm,null,"1");
if(bole){
return Action.SUCCESS;
}else{
return Action.FAILURE_AND_CONTINUE;
}
}
//创建流程
else{
String requestidd = HttpUtil.Createrequest(Integer.parseInt(registrationStatusReview_workflowid), Integer.parseInt(createter), title, "1", map, list, "1");
if (Integer.parseInt(requestidd) > 0) {
return Action.SUCCESS;
} else {
return Action.FAILURE_AND_CONTINUE;
}
}
}
}catch (Exception e){
e.printStackTrace();
rs.writeLog(e);
}
return Action.SUCCESS;
}
/**
* 判断 是否已经有了 该主题的流程
* @param gbjpzt
* @return
*/
public boolean checkHasWork(String gbjpzt){
boolean bool = false;
RecordSet rs = new RecordSet();
// 报名情况审核 流程表名
String registrationStatusReview_table = rs.getPropValue("hrm_wuyuan","registrationStatusReview_table");
rs.executeQuery("select a.id from "+ registrationStatusReview_table +" a,workflow_requestbase b where a.requestid=b.requestid and b.currentnodetype!='3' and a.gbjpzt='"+ gbjpzt +"' ");
if(rs.next()){
bool = true;
}
return bool;
}
public String getMainid(String gbjpzt){
String result = "";
RecordSet rs = new RecordSet();
// 报名情况审核 流程表名
String registrationStatusReview_table = rs.getPropValue("hrm_wuyuan","registrationStatusReview_table");
rs.executeQuery("select a.id from "+ registrationStatusReview_table +" a,workflow_requestbase b where a.requestid=b.requestid and b.currentnodetype!='3' and a.gbjpzt='"+ gbjpzt +"' ");
if(rs.next()){
result = Util.null2String(rs.getString("id"));
}
return result;
}
public String getBmRequestid(String gbjpzt){
String result = "";
RecordSet rs = new RecordSet();
// 报名情况审核 流程表名
String registrationStatusReview_table = rs.getPropValue("hrm_wuyuan","registrationStatusReview_table");
rs.executeQuery("select a.requestid from "+ registrationStatusReview_table +" a,workflow_requestbase b where a.requestid=b.requestid and b.currentnodetype!='3' and a.gbjpzt='"+ gbjpzt +"' ");
if(rs.next()){
result = Util.null2String(rs.getString("requestid"));
}
return result;
}
/**
* 获取 发布竞聘公告的 发起人
* @param gbjpzt
* @return
*/
public String getFbjpggFqr(String gbjpzt){
String result = "";
RecordSet rs = new RecordSet();
// 发布竞聘公告 流程表名
String recruitment_announcement_table = rs.getPropValue("hrm_wuyuan","recruitment_announcement_table");
rs.executeQuery("select b.creater from "+ recruitment_announcement_table +" a,workflow_requestbase b where a.requestid=b.requestid and b.currentnodetype='3' and a.gbjpzt='"+ gbjpzt +"' ");
if(rs.next()){
result = Util.null2String(rs.getString("creater"));
}
return result;
}
}

View File

@ -1,88 +0,0 @@
package weaver.interfaces.wuyuan.action;
import com.wbi.util.Util;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.UUID;
/**
* 入职办理流程 归档后 写入家庭情况 建模台账
*/
public class InsertFamilySituationModeAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
RecordSet rss = new RecordSet();
RecordSet rs1 = new RecordSet();
RecordSet rst = new RecordSet();
int jtqk_formmodeid = Util.getIntValue(rs.getPropValue("hrm_wuyuan","jtqk_formmodeid"));
String currentdate = TimeUtil.getCurrentDateString();
String currenttime = TimeUtil.getOnlyCurrentTimeString();
try{
String tablename = requestInfo.getRequestManager().getBillTableName();
String tableDt = tablename+"_dt4";
String requestid = requestInfo.getRequestid();
rs.executeQuery("select b.* from "+ tablename +" a,"+tableDt+" b where a.requestid = ?",requestid);
writeLog("select b.* from "+ tablename +" a,"+tableDt+" b where a.requestid = "+ requestid);
while(rs.next()){
//身份证号码
String sfzhm = Util.null2String(rs.getString("sfzhm"));
//姓名
String xm = Util.null2String(rs.getString("xm"));
//关系
String gx = Util.null2String(rs.getString("gx"));
//职务
String zw = Util.null2String(rs.getString("zw"));
//家庭成员姓名
String jtcyxm = Util.null2String(rs.getString("jtcyxm"));
//出生日期
String csrq = Util.null2String(rs.getString("csrq"));
//工作单位
String gzdw = Util.null2String(rs.getString("gzdw"));
//政治面貌
String zzmm = Util.null2String(rs.getString("zzmm"));
String userId = Util.null2String(getUseridByCertificatenum("id",sfzhm));
//插入新的数据本次同步的分部部门岗位
String insert_jlsql1 = "insert into uf_jtqk(xm,sfzhm,gx,zw,jtcyxm,csrq,gzdw,zzmm," +
"modedatacreater,modedatacreatedate,modedatacreatetime,formmodeid,modeuuid) " +
" values(?,?,?,?,?,?,?,?," +
"?,?,?,?,?) ";
int bill_id1 = -1;
String uuid = UUID.randomUUID().toString();
boolean exeRes1 = rst.executeUpdate(insert_jlsql1, new Object[]{userId, sfzhm, gx, zw, jtcyxm, csrq, gzdw, zzmm,
Integer.parseInt(userId), currentdate, currenttime, jtqk_formmodeid, uuid});
if (exeRes1) {
//重构权限
rs1.executeQuery(" select id from uf_jtqk where modeuuid=? ", new Object[]{uuid});
rs1.next();
bill_id1 = rs1.getInt("id");
ModeRightInfo moderight1 = new ModeRightInfo();
moderight1.editModeDataShare(Integer.parseInt(userId), jtqk_formmodeid, bill_id1);
}
}
}catch (Exception e){
e.printStackTrace();
writeLog(e);
}
return Action.SUCCESS;
}
public String getUseridByCertificatenum(String name,String certificatenum){
String result = null;
RecordSet rs = new RecordSet();
rs.executeQuery("select "+ name + " from hrmresource where certificatenum = ?",certificatenum);
while(rs.next()){
result = weaver.general.Util.null2String(rs.getString(name));
}
return result;
}
}

View File

@ -1,328 +0,0 @@
package weaver.interfaces.wuyuan.action;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* 考勤报表锁定 前置流程的 提交
*/
public class KQYJCloseWfAction implements Action {
BaseBean baseBean = new BaseBean();
@Override
public String execute(RequestInfo requestInfo) {
String workflowid = requestInfo.getWorkflowid();
String requestId = requestInfo.getRequestid();
baseBean.writeLog("KQYJCloseWfAction start:" + workflowid + "" + requestId);
try {
RecordSet rs = new RecordSet();
// 外出申请单流程id
String wcsqdWfId = rs.getPropValue("wuyuan_hrminfo", "wcsqd_wf_id");
// 培训外出申请单流程id
String pxwcsqdWfId = rs.getPropValue("wuyuan_hrminfo", "pxwcsqd_wf_id");
// 补卡申请单流程id
String bksqdWfId = rs.getPropValue("wuyuan_hrminfo", "bksqd_wf_id");
// 销假申请单流程id
String xjsqWfId = rs.getPropValue("wuyuan_hrminfo", "xjsqd_wf_id");
// 请假申请单流程id
String qjsqdWfId = rs.getPropValue("wuyuan_hrminfo", "qjsqd_wf_id");
// 出差申请单流程id
String ccsqWfId = rs.getPropValue("wuyuan_hrminfo", "ccsqd_wf_id");
// 考勤修正申请表流程id
String kqxzsqWfId = rs.getPropValue("wuyuan_hrminfo", "kqszsqd_wf_id");
// 外出申请单 fromDate toDate
// 请假申请单 fromDate toDate
if (StringUtils.equals(workflowid, wcsqdWfId) || StringUtils.equals(workflowid, qjsqdWfId)) {
String ksrq = null;
String deptid = null;
Property[] properties = requestInfo.getMainTableInfo().getProperty();
for (Property property : properties) {
if ("fromDate".equals(property.getName())) {
ksrq = Util.null2String(property.getValue());
}
if("departmentId".equals(property.getName())){
deptid = Util.null2String(property.getValue());
}
}
if (StringUtils.isEmpty(ksrq)) {
return Action.SUCCESS;
}
boolean bool = checkIsBetwwen(deptid,ksrq);
if (bool) {
requestInfo.getRequestManager().setMessagecontent("当前申请日期所在考勤周期已关闭,无法操作!");
return Action.FAILURE_AND_CONTINUE;
} else {
return Action.SUCCESS;
}
}
// 补卡申请单 detail_signdate
if (StringUtils.equals(workflowid, bksqdWfId)) {
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(0);
Row[] rows = detailTable.getRow();
if (rows.length > 0) {
for (Row r : rows) {
String xjksrq = null;
String deptid = null;
String userid = null;
Cell[] cells = r.getCell();
for (Cell c : cells) {
String name = c.getName();
if (name.equals("detail_signdate")) {
xjksrq = c.getValue();
}
if("detail_resourceid".equals(name)){
userid = c.getValue();
deptid = new ResourceComInfo().getDepartmentID(userid);
}
}
if (StringUtils.isEmpty(xjksrq)) {
return Action.SUCCESS;
}
boolean bool = checkIsBetwwen(deptid,xjksrq);
if (bool) {
requestInfo.getRequestManager().setMessagecontent("当前申请日期所在考勤周期已关闭,无法操作!");
return Action.FAILURE_AND_CONTINUE;
} else {
return Action.SUCCESS;
}
}
}
}
// 培训外出申请单 明细 pxksrq
if (StringUtils.equals(workflowid, pxwcsqdWfId)) {
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(0);
Row[] rows = detailTable.getRow();
if (rows.length > 0) {
for (Row r : rows) {
String xjksrq = null;
String deptid = null;
Cell[] cells = r.getCell();
for (Cell c : cells) {
String name = c.getName();
if (name.equals("pxksrq")) {
xjksrq = c.getValue();
}
if("bm".equals(name)){
deptid = c.getValue();
}
}
if (StringUtils.isEmpty(xjksrq)) {
return Action.SUCCESS;
}
boolean bool = checkIsBetwwen(deptid,xjksrq);
if (bool) {
requestInfo.getRequestManager().setMessagecontent("当前申请日期所在考勤周期已关闭,无法操作!");
return Action.FAILURE_AND_CONTINUE;
} else {
return Action.SUCCESS;
}
}
}
}
// 考勤修正申请单 明细 detail_signdate
if (StringUtils.equals(workflowid, kqxzsqWfId)) {
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(0);
Row[] rows = detailTable.getRow();
if (rows.length > 0) {
for (Row r : rows) {
String xjksrq = null;
String deptid = null;
String userid = null;
Cell[] cells = r.getCell();
for (Cell c : cells) {
String name = c.getName();
if (name.equals("detail_signdate")) {
xjksrq = c.getValue();
}
if (name.equals("detail_resourceid")) {
userid = c.getValue();
deptid = new ResourceComInfo().getDepartmentID(userid);
}
}
if (StringUtils.isEmpty(xjksrq)) {
return Action.SUCCESS;
}
boolean bool = checkIsBetwwen(deptid,xjksrq);
if (bool) {
requestInfo.getRequestManager().setMessagecontent("当前申请日期所在考勤周期已关闭,无法操作!");
return Action.FAILURE_AND_CONTINUE;
} else {
return Action.SUCCESS;
}
}
}
}
// 销假申请单 明细 detail_fromDate detail_toDate
if (StringUtils.equals(workflowid, xjsqWfId)) {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
String deptid = null;
for (Property property : properties) {
if ("szbm".equals(property.getName())) {
deptid = Util.null2String(property.getValue());
}
}
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(0);
Row[] rows = detailTable.getRow();
if (rows.length > 0) {
for (Row r : rows) {
String xjksrq = null;
Cell[] cells = r.getCell();
for (Cell c : cells) {
String name = c.getName();
if (name.equals("detail_fromDate")) {
xjksrq = c.getValue();
}
}
if (StringUtils.isEmpty(xjksrq)) {
return Action.SUCCESS;
}
boolean bool = checkIsBetwwen(deptid,xjksrq);
if (bool) {
requestInfo.getRequestManager().setMessagecontent("当前申请日期所在考勤周期已关闭,无法操作!");
return Action.FAILURE_AND_CONTINUE;
} else {
return Action.SUCCESS;
}
}
}
}
// 出差申请单 明细 fromDate toDate
if (StringUtils.equals(workflowid, ccsqWfId)) {
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(0);
Row[] rows = detailTable.getRow();
if (rows.length > 0) {
for (Row r : rows) {
String xjksrq = null;
String deptid = null;
Cell[] cells = r.getCell();
for (Cell c : cells) {
String name = c.getName();
if (name.equals("fromDate")) {
xjksrq = c.getValue();
}
if("departmentId".equals(name)){
deptid = c.getValue();
}
}
if (StringUtils.isEmpty(xjksrq)) {
return Action.SUCCESS;
}
boolean bool = checkIsBetwwen(deptid,xjksrq);
if (bool) {
requestInfo.getRequestManager().setMessagecontent("当前申请日期所在考勤周期已关闭,无法操作!");
return Action.FAILURE_AND_CONTINUE;
} else {
return Action.SUCCESS;
}
}
}
}
baseBean.writeLog("KQYJCloseWfAction end.");
} catch (Exception e) {
baseBean.writeLog("KQYJCloseWfAction error:" + e.getMessage());
}
return Action.SUCCESS;
}
/**
* 判断日期是否有 锁定
* @param deptid
* @param date
* @return
*/
public static boolean checkIsBetwwen(String deptid,String date){
boolean bool = false;
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
String lastdate = getMonthEndByDateStr(date,0);
rs.executeQuery("select id from uf_kqbbsd where sfsd='0' and bm=? and ksrq<='"+date+"' and '"+date+"'<=jsrq",deptid);
if(rs.next()){
bool = true;
}
rs1.executeQuery("select id from uf_kqbbsd where sfsd='0' and bm=? and '"+ date +"'>= jsrq and jsrq <= '"+ lastdate +"'",deptid);
if(rs1.next()){
bool = true;
}
return bool;
}
/**
* 获取 日期字符串的 月初
* @param dateStr
* @param num
* @return
*/
public static String getMonthStartStr(String dateStr, int num) {
String result = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = sdf.parse(dateStr);
Calendar c1 = Calendar.getInstance();
c1.setTime(date);
c1.add(Calendar.MONTH, num);
c1.set(Calendar.DAY_OF_MONTH, 1);
result = sdf.format(c1.getTime());
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 根据日期字符串获取上下某个月的月初和月末
*
* @param dateStr 日期字符串
* @param num 上下某月
* @return 月初月末集合
*/
public static String getMonthEndByDateStr(String dateStr, int num) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String res = "";
try {
Date date = sdf.parse(dateStr);
Calendar c1 = Calendar.getInstance();
c1.setTime(date);
c1.add(Calendar.MONTH, num);
c1.set(Calendar.DAY_OF_MONTH, 1);
String start = sdf.format(c1.getTime());
Calendar c2 = Calendar.getInstance();
Date dateTemp = sdf.parse(start);
c2.setTime(dateTemp);
c2.add(Calendar.MONTH, 1);
c2.set(Calendar.DAY_OF_MONTH, 0);
res = sdf.format(c2.getTime());
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
}

Some files were not shown because too many files have changed in this diff Show More