Compare commits

..

No commits in common. '美之高考勤假期' and 'master' have entirely different histories.

2
.gitignore vendored

@ -1,12 +1,10 @@
/weaver-develop.iml
weaver-develop.iml
/out/
.idea/
HELP.md
target/
.idea
/test

@ -1,6 +1,6 @@
<component name="ArtifactManager">
<artifact type="jar" name="weaver-develop:jar">
<output-path>$PROJECT_DIR$/../../../../weaver/ecology/WEB-INF/lib</output-path>
<output-path>$PROJECT_DIR$/out/artifacts/weaver_develop_jar</output-path>
<root id="archive" name="weaver-develop.jar">
<element id="module-output" name="weaver-develop" />
</root>

@ -1,8 +0,0 @@
#????ID
docId=6
#????????
todoUrl=
#????????
noticeUrl=
#????????
trainUrl=

@ -1,13 +0,0 @@
package com.api.mzgsecond.web;
import javax.ws.rs.Path;
/**
* @Author liang.cheng
* @Date 2024/12/23 11:08 AM
* @Description:
* @Version 1.0
*/
@Path("/mzgsecond/portal")
public class PortalElementCusAction extends com.engine.mzgsecond.web.PortalElementCusAction {
}

@ -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);
/**
* hrmRoleMembersID
* */
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);
}

@ -1,46 +0,0 @@
package com.engine.kq.bean;
/**
* ----
*/
public class KQChildrenBean {
private String id;
private String birthday;
private String title;
private String resourceid;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getResourceid() {
return resourceid;
}
public void setResourceid(String resourceid) {
this.resourceid = resourceid;
}
}

File diff suppressed because it is too large Load Diff

@ -1,81 +0,0 @@
package com.engine.kq.biz;
import weaver.cache.CacheBase;
import weaver.cache.CacheColumn;
import weaver.cache.CacheColumnType;
import weaver.cache.PKColumn;
/**
*
*/
public class KQChildrenComInfo extends CacheBase {
/**
*
*/
protected static String TABLE_NAME = "hrmfamilyinfo";
/**
* sqlwherewhere
*/
protected static String TABLE_WHERE = " WhetherChildren=1 ";
/**
* sqlorder byorder by
*/
protected static String TABLE_ORDER = " id ";
/**
*
*/
@PKColumn(type = CacheColumnType.NUMBER)
protected static String PK_NAME = "id";
/**
*
*/
@CacheColumn(name = "birthday")
protected static int birthday;
/**
*
*/
@CacheColumn(name = "member")
protected static int member;
/**
* id
*/
@CacheColumn(name = "resourceid")
protected static int resourceid;
public String getId(){
return (String)getRowValue(PK_INDEX);
}
public String getChildrenName() {
return (String)getRowValue(member);
}
public String getChildrenName(String key){
return (String) getValue(member,key);
}
public String getBirthday() {
return (String)getRowValue(birthday);
}
public String getBirthday(String key){
return (String) getValue(birthday,key);
}
public String getResourceid() {
return (String)getRowValue(resourceid);
}
public String getResourceid(String key){
return (String) getValue(resourceid,key);
}
@Override
public void removeCache() {
super.removeCache();
}
}

File diff suppressed because it is too large Load Diff

@ -1,319 +0,0 @@
package com.engine.kq.biz;
import com.engine.kq.wfset.util.KQAttFlowCheckUtil;
import weaver.cache.CacheBase;
import weaver.cache.CacheColumn;
import weaver.cache.CacheColumnType;
import weaver.cache.PKColumn;
import weaver.general.Util;
import weaver.systeminfo.SystemEnv;
/**
*
*/
public class KQLeaveRulesComInfo extends CacheBase {
/**
*
*/
protected static String TABLE_NAME = "kq_leaveRules";
/**
* sqlwherewhere
*/
protected static String TABLE_WHERE = " (isDelete is null or isDelete !=1) ";
/**
* sqlorder byorder by
*/
protected static String TABLE_ORDER = " showOrder,id ";
/**
*
*/
@PKColumn(type = CacheColumnType.NUMBER)
protected static String PK_NAME = "id";
/**
*
*/
@CacheColumn(name = "leaveName")
protected static int leaveName;
@CacheColumn(name = "SchevacationON")
protected static int SchevacationON;
@CacheColumn(name = "Schevacation")
protected static int Schevacation;
/**
* 0-1-
*/
@CacheColumn(name = "isEnable")
protected static int isEnable;
/**
* 0-1-
*/
@CacheColumn(name = "scopeType")
protected static int scopeType;
/**
* ID(ID)
*/
@CacheColumn(name = "scopeValue")
protected static int scopeValue;
/**
*
* 1-
* 2-
* 3-
* 4-
*
*/
@CacheColumn(name = "minimumUnit")
protected static int minimumUnit;
/**
*
* XX=1
*/
@CacheColumn(name = "proportion")
protected static int proportion;
/**
* 1=XX
*/
@CacheColumn(name = "hoursToDay")
protected static int hoursToDay;
/**
* 0-1-2-3-
*/
@CacheColumn(name = "filterHolidays")
protected static int filterHolidays;
/**
*
* 1-
* 2-
*/
@CacheColumn(name = "computingMode")
protected static int computingMode;
/**
*
* 0-
* 1-
*/
@CacheColumn(name = "balanceEnable")
protected static int balanceEnable;
/**
*
*/
@CacheColumn(name = "leaveCode")
protected static int leaveCode;
/**
* 1- 2-
*/
@CacheColumn(name = "timeselection")
protected static int timeselection;
/**
* 1 2 3
*/
@CacheColumn(name = "conversion")
protected static int conversion;
/**
* 1 0
*/
@CacheColumn(name = "repeat_time")
protected static int repeatTime;
public String getId(){
return (String)getRowValue(PK_INDEX);
}
public String getLeaveName() {
return (String)getRowValue(leaveName);
}
public String getLeaveName(String key){
return (String) getValue(leaveName,key);
}
public String getSchevacationON() {
return (String)getRowValue(SchevacationON);
}
public String getSchevacationON(String key){
return (String) getValue(SchevacationON,key);
}
public String getSchevacation() {
return (String)getRowValue(Schevacation);
}
public String getSchevacation(String key){
return (String) getValue(Schevacation,key);
}
public String getIsEnable() {
return (String)getRowValue(isEnable);
}
public String getIsEnable(String key){
return (String) getValue(isEnable,key);
}
public String getScopeType() {
return (String)getRowValue(scopeType);
}
public String getScopeType(String key){
return (String) getValue(scopeType,key);
}
public String getScopeValue() {
return (String)getRowValue(scopeValue);
}
public String getScopeValue(String key){
return (String) getValue(scopeValue,key);
}
public String getMinimumUnit() {
return (String)getRowValue(minimumUnit);
}
public String getMinimumUnit(String key){
return (String)getValue(minimumUnit,key);
}
public String getProportion() {
return (String)getRowValue(proportion);
}
public String getProportion(String key){
return (String)getValue(proportion,key);
}
public String getHoursToDay() {
return (String)getRowValue(hoursToDay);
}
public String getHoursToDay(String key){
return (String)getValue(hoursToDay,key);
}
public String getFilterHolidays() {
return (String)getRowValue(filterHolidays);
}
public String getFilterHolidays(String key){
return (String)getValue(filterHolidays,key);
}
public String getComputingMode() {
return (String)getRowValue(computingMode);
}
public String getComputingMode(String key){
return (String)getValue(computingMode,key);
}
public String getBalanceEnable() {
return (String)getRowValue(balanceEnable);
}
public String getBalanceEnable(String key){
return (String)getValue(balanceEnable,key);
}
public String getLeaveCode() {
return (String)getRowValue(leaveCode);
}
public String getLeaveCode(String key){
return (String)getValue(leaveCode,key);
}
public String getTimeSelection() {
String value = (String) getRowValue(timeselection);
if (value == null || value.equals("")) {
value = "1";
}
return value;
}
public String getTimeSelection(String key) {
String value = (String) getValue(timeselection, key);
if (value == null || value.equals("")) {
value = "1";
}
return value;
}
public String getConversion() {
return (String)getRowValue(conversion);
}
public String getConversion(String key){
return (String)getValue(conversion,key);
}
public String getRepeatTime() {
return (String)getRowValue(repeatTime);
}
public String getRepeatTime(String key){
return (String)getValue(repeatTime,key);
}
public String getUnitName(int language){
String unitName = "";//单位名称,天/小时
int minimumUnit = Util.getIntValue(getMinimumUnit(),1);
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
unitName = SystemEnv.getHtmlLabelName(389325, language);//(天)
} else {
unitName = SystemEnv.getHtmlLabelName(389326, language);//(小时)
}
return unitName;
}
public String getUnitName(String key,int language){
String unitName = "";//单位名称,天/小时
int minimumUnit = Util.getIntValue(getMinimumUnit(key),1);
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
unitName = SystemEnv.getHtmlLabelName(389325, language);//(天)
} else {
unitName = SystemEnv.getHtmlLabelName(389326, language);//(小时)
}
// KQTransMethod method = new KQTransMethod();
// unitName = "("+method.getMinimumUnitName4Browser(""+minimumUnit, ""+language)+")";
return unitName;
}
public String getUnitNameNew(String key,int language){
String unitName = "";//单位名称,天/小时
int minimumUnit = Util.getIntValue(getMinimumUnit(key),1);
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
unitName = SystemEnv.getHtmlLabelName(389325, language);//(天)
} else {
unitName = SystemEnv.getHtmlLabelName(389326, language);//(小时)
}
return unitName;
}
@Override
public void removeCache() {
super.removeCache();
KQAttFlowCheckUtil kqAttFlowCheckUtil = new KQAttFlowCheckUtil();
kqAttFlowCheckUtil.initLeaveUnit();
}
}

File diff suppressed because it is too large Load Diff

@ -1,466 +0,0 @@
package com.engine.kq.cmd.leaverules;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* --
*/
public class AddLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>> {
private SimpleBizLogger logger;
public AddLeaveRulesCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
this.logger = new SimpleBizLogger();
String ruleId = Util.null2String(params.get("typeId"));
String ruleName = Util.null2String(params.get("ruleName"));
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "select * from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%'";
logger.setMainSql(mainSql, "id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("rulename");
SimpleBizLogger.SubLogInfo subLogInfo1 = logger.getNewSubLogInfo();
String subSql1 = "select * from kq_EntryToLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo1.setSubSql(subSql1, "id");
logger.addSubLogInfo(subLogInfo1);
SimpleBizLogger.SubLogInfo subLogInfo2 = logger.getNewSubLogInfo();
String subSql2 = "select * from kq_WorkingAgeToLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo2.setSubSql(subSql2, "id");
logger.addSubLogInfo(subLogInfo2);
SimpleBizLogger.SubLogInfo subLogInfo3 = logger.getNewSubLogInfo();
String subSql3 = "select * from kq_MixModeToLegalLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo3.setSubSql(subSql3, "id");
logger.addSubLogInfo(subLogInfo3);
SimpleBizLogger.SubLogInfo subLogInfo4 = logger.getNewSubLogInfo();
String subSql4 = "select * from kq_MixModeToWelfareLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo4.setSubSql(subSql4, "id");
logger.addSubLogInfo(subLogInfo4);
logger.before(bizLogContext);
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public List<BizLogContext> getLogContexts() {
return logger.getBizLogContexts();
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
boolean canAdd = HrmUserVarify.checkUserRight("KQLeaveRulesAdd:Add", user);//是否具有新建权限
if (!canAdd) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));//没有权限
return resultMap;
}
/*假期规则对应的假期类型的ID*/
String ruleId = Util.null2String(params.get("typeId"));
/*假期规则名称*/
String ruleName = Util.null2String(params.get("ruleName"));
/*应用范围0-总部、1-分部*/
int scopeType = Util.getIntValue((String) params.get("scopeType"));
/*应用范围为分部时选择的分部ID*/
String scopeValue = Util.null2String(params.get("scopeValue"));
String deductorder = Util.null2String(params.get("deductorder"));
/*应用范围为部门时选择的部门ID*/
String scopeValueDepartment = Util.null2String(params.get("scopeValueDepartment"));
/*应用范围为人员时选择的人员ID*/
String scopeValueMember = Util.null2String(params.get("scopeValueMember"));
/*todo 美之高二开 安全级别最小和最大值*/
String minLevel = Util.null2String(params.get("secLevel"));
String maxLevel = Util.null2String(params.get("secLevelto"));
if(scopeType == 2) {
scopeValue = scopeValueDepartment;
} else if(scopeType == 3) {
scopeValue = scopeValueMember;
}
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按司龄+工龄自动发放*/
int distributionMode = Util.getIntValue((String) params.get("distributionMode"), 1);
/*每人发放小时(天)数(当余额发放方式为每年自动发放固定天数时有效)*/
double annualAmount = Util.getDoubleValue((String) params.get("annualAmount"), 0);
//法定年假规则0-工龄、1-司龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String legalKey = Util.null2s((String) params.get("legalKey"), "0");
//福利年假规则0-工龄、1-工龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String welfareKey = Util.null2s((String) params.get("welfareKey"), "1");
/*扣减优先级1-法定年假、2-福利年假*/
int priority = Util.getIntValue((String) params.get("priority"), 1);
/*有效期规则0-不限制、1-按自然月(1月1日-12月31日)、2-按入职日期起12个月、3-自定义次年失效日期、4-自定义有效天数*/
int validityRule = Util.getIntValue((String) params.get("validityRule"), 1);
/*有效期天数:(当有效期天数选择按天数失效的时候有效)*/
int effectiveDays = Util.getIntValue((String) params.get("effectiveDays"), 30);
//有效月数(当有效期规则选择自定义有效月数时)
int effectiveMonths = Util.getIntValue((String) params.get("effectiveMonths"), 1);
/*失效日期--月当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationMonth = Util.null2String(params.get("expirationMonth"));
/*失效日期--日当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationDay = Util.null2String(params.get("expirationDay"));
/*允许延长有效期0-不允许、1-允许*/
int extensionEnable = Util.getIntValue((String) params.get("extensionEnable"), 0);
/*允许超过有效期天数*/
int extendedDays = Util.getIntValue((String) params.get("extendedDays"), 0);
/*释放规则0-不限制、1-按天释放、2-按月释放*/
int releaseRule = Util.getIntValue((String) params.get("releaseRule"), 0);
/*假期基数计算方式0-精确计算、1-按最少的假期余额计算、2-按最多的假期余额计算*/
int calcMethod = Util.getIntValue((String) params.get("calcMethod"), 0);
/*是否折算0-不折算、1-四舍五入、2-向上取整、3-向下取整、4-向上取0.5的倍数、5-向下取0.5的倍数*/
int convertMode = Util.getIntValue("" + params.get("convertMode"), 1);
/*次账号是否发放假期余额0-不发放、1-发放*/
int excludeSubAccount = Util.getIntValue("" + params.get("excludeSubAccount"), 1);
//多孩叠加开关。
int severalChildren = Util.getIntValue("" + params.get("severalChildren"), 0);
//孩子多少周岁前发放。
int yearsOld = Util.getIntValue("" + params.get("yearsOld"), 3);
//是否按照省份发放育儿假。
int isprovince = Util.getIntValue("" + params.get("isprovince"), 1);
// 2、在假期规则页面增加开关控制是否开启。carryOver
// 3、增加输入框控制结转天数。 carryOverDays
int carryOver = Util.getIntValue("" + params.get("carryOver"), 0);
double carryOverDays = Util.getDoubleValue((String) params.get("carryOverDays"), 0);
/*转正之前是否发放假期余额0-不发放、1-发放*/
int beforeFormal = Util.getIntValue("" + params.get("beforeFormal"), 1);
if (scopeType != 0 && scopeValue.equals("")) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(388858, user.getLanguage()));//参数有误
return resultMap;
}
/*两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式*/
if (distributionMode == 5) {
releaseRule = 0;
Map<String,String> data = KQLeaveRulesBiz.isRepeat(ruleId,scopeType,scopeValue,user,"");
if(null != data && "1".equals(data.get("flag"))){
resultMap.put("status", "-1");
resultMap.put("message", data.get("msg"));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
return resultMap;
}
// String sql = "select * from kq_LeaveRules where (isDelete is null or isDelete<>1) and id<>? and id in (select ruleId from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and distributionMode=5)";
// RecordSet recordSet = new RecordSet();
// recordSet.executeQuery(sql, ruleId);
// if (recordSet.next()) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
// return resultMap;
// }
if(null != deductorder && deductorder.length()>0){
String[] orders = deductorder.split(",");
if(null != orders && orders.length != 3){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(547752, user.getLanguage()));
return resultMap;
}
}
} else if (distributionMode == 6) {
/*同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505665, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
} else if (distributionMode == 8) {
/*同一假期类型下 育儿假 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>8";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
int severalChildrenValue = Util.getIntValue(Util.null2s(recordSet.getString("severalChildren"), "0"), 0);
if(severalChildrenValue!=severalChildren){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546859, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
}
} else {
/*同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505666, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=5";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(510357, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 育儿假叠加 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));
return resultMap;
}
}
//todo 美之高去除标准校验 同一应用维度下不可重复创建规则addsave
// String searchSql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=?";
RecordSet recordSet = new RecordSet();
// recordSet.executeQuery(searchSql, ruleId);
// while (recordSet.next()) {
// int scopeTypeTemp = Util.getIntValue(recordSet.getString("scopeType"), 0);
// String scopeValueTemp = recordSet.getString("scopeValue");
//
// if (scopeType == 0 && scopeTypeTemp == 0) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505667, user.getLanguage()));//该假期类型下已经新建过总部的假期规则,请勿重复新建
// return resultMap;
// }
// if (scopeType == 1 && scopeTypeTemp == 1) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// for (String temp : scopeValueList)
// if (scopeValueTempList.contains(temp)) {
// SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
// String subcomName = subCompanyComInfo.getSubCompanyname(temp);
//
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505668, user.getLanguage()).replace("$", subcomName));//该假期类型下已经新建过分部的假期规则,请勿重复新建
// return resultMap;
// }
// }
// if (scopeType == 2 && scopeTypeTemp == 2) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// for (String temp : scopeValueList)
// if (scopeValueTempList.contains(temp)) {
// DepartmentComInfo comInfo = new DepartmentComInfo();
// String name = comInfo.getDepartmentname(temp);
//
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(534890, user.getLanguage()).replace("$", name));//该假期类型下已经新建过部门的假期规则,请勿重复新建
// return resultMap;
// }
// }
// if (scopeType == 3 && scopeTypeTemp == 3) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// for (String temp : scopeValueList)
// if (scopeValueTempList.contains(temp)) {
// ResourceComInfo comInfo = new ResourceComInfo();
// String name = comInfo.getLastname(temp);
//
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(534891, user.getLanguage()).replace("$", name));//该假期类型下已经新建过人员的假期规则,请勿重复新建
// return resultMap;
// }
// }
// }
boolean flag = false;//数据是否插入成功
String sql = "insert into kq_LeaveRulesDetail(ruleId,ruleName,scopeType,scopeValue," +
"distributionMode,annualAmount,legalKey,welfareKey,priority,validityRule,effectiveDays,effectiveMonths,expirationMonth,expirationDay,extensionEnable,extendedDays,releaseRule,calcMethod,convertMode,excludeSubAccount,beforeFormal,severalChildren,yearsOld,isprovince,carryOver,carryOverDays,deductorder,isDelete,minLevel,maxLevel) values(?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?,?,?,?,0,?,?)";
flag = recordSet.executeUpdate(sql, ruleId, ruleName, scopeType, scopeValue,
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal,severalChildren,yearsOld,isprovince,carryOver,carryOverDays,deductorder,minLevel,maxLevel);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
/*获取刚才插入的假期规则详情的ID*/
int ruleDetailId = 0;
sql = "select max(id) maxId from kq_LeaveRulesDetail";
recordSet.executeQuery(sql);
if (recordSet.next()) {
ruleDetailId = Util.getIntValue(recordSet.getString("maxId"), 0);
}
if ((distributionMode == 2 || distributionMode == 7) && ruleDetailId != 0) {
int lowerLimit = 0;//司龄下限
int upperLimit = 0;//司龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_EntryToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 3 && ruleDetailId != 0) {
int lowerLimit = 0;//工龄下限
int upperLimit = 0;//工龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_WorkingAgeToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 6 && ruleDetailId != 0) {
String mixModeData = Util.null2String(params.get("legalRule"));
JSONArray jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double legalAmount = jsonObject.getDoubleValue("legalAmount");
sql = "insert into kq_MixModeToLegalLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, legalAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
mixModeData = Util.null2String(params.get("welfareRule"));
jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double welfareAmount = jsonObject.getDoubleValue("welfareAmount");
sql = "insert into kq_MixModeToWelfareLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, welfareAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 8 && ruleDetailId != 0) {
int provinceidValue = 0;//省份id
int yearsOldValue = 0;//孩子周岁
double amountValue = 0;//假期天数
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
provinceidValue = jsonObject.getIntValue("provinceid");
yearsOldValue = jsonObject.getIntValue("yearsOld");
amountValue = jsonObject.getDoubleValue("amount");
sql = "insert into kq_provinceToLeave(leaveRulesId,provinceid,yearsOld,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, provinceidValue, yearsOldValue, amountValue);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (flag) {
resultMap.put("sign", "1");
resultMap.put("message", SystemEnv.getHtmlLabelName(83551, user.getLanguage()));//保存成功
}
} catch (Exception e) {
writeLog(e);
} finally {
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
detailComInfo.removeCache();
}
return resultMap;
}
}

@ -1,494 +0,0 @@
package com.engine.kq.cmd.leaverules;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* --
*/
public class EditLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>> {
private SimpleBizLogger logger;
public EditLeaveRulesCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
this.logger = new SimpleBizLogger();
int ruleDetailId = Util.getIntValue((String) params.get("ruleId"));
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "select * from kq_LeaveRulesDetail where id=" + ruleDetailId;
logger.setMainSql(mainSql, "id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("rulename");
SimpleBizLogger.SubLogInfo subLogInfo1 = logger.getNewSubLogInfo();
String subSql1 = "select * from kq_EntryToLeave where leaveRulesId=" + ruleDetailId;
subLogInfo1.setSubSql(subSql1, "id");
logger.addSubLogInfo(subLogInfo1);
SimpleBizLogger.SubLogInfo subLogInfo2 = logger.getNewSubLogInfo();
String subSql2 = "select * from kq_WorkingAgeToLeave where leaveRulesId=" + ruleDetailId;
subLogInfo2.setSubSql(subSql2, "id");
logger.addSubLogInfo(subLogInfo2);
SimpleBizLogger.SubLogInfo subLogInfo3 = logger.getNewSubLogInfo();
String subSql3 = "select * from kq_MixModeToLegalLeave where leaveRulesId=" + ruleDetailId;
subLogInfo3.setSubSql(subSql3, "id");
logger.addSubLogInfo(subLogInfo3);
SimpleBizLogger.SubLogInfo subLogInfo4 = logger.getNewSubLogInfo();
String subSql4 = "select * from kq_MixModeToLegalLeave where leaveRulesId=" + ruleDetailId;
subLogInfo4.setSubSql(subSql4, "id");
logger.addSubLogInfo(subLogInfo4);
logger.before(bizLogContext);
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public List<BizLogContext> getLogContexts() {
return logger.getBizLogContexts();
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
boolean canEdit = HrmUserVarify.checkUserRight("KQLeaveRulesEdit:Edit", user);//是否具有新建权限
if (!canEdit) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
return resultMap;
}
/*假期类型的ID*/
int ruleId = Util.getIntValue((String) params.get("typeId"));
/*假期规则详情的ID*/
int ruleDetailId = Util.getIntValue((String) params.get("ruleId"));
/*假期规则名称*/
String ruleName = Util.null2String(params.get("ruleName"));
/*应用范围0-总部、1-分部*/
int scopeType = Util.getIntValue((String) params.get("scopeType"));
/*应用范围为分部时选择的分部ID*/
String scopeValue = Util.null2String(params.get("scopeValue"));
String deductorder = Util.null2String(params.get("deductorder"));
/*应用范围为部门时选择的部门ID*/
String scopeValueDepartment = Util.null2String(params.get("scopeValueDepartment"));
/*应用范围为人员时选择的人员ID*/
String scopeValueMember = Util.null2String(params.get("scopeValueMember"));
/*todo 美之高二开 安全级别最小和最大值*/
String minLevel = Util.null2String(params.get("secLevel"));
String maxLevel = Util.null2String(params.get("secLevelto"));
if(scopeType == 2) {
scopeValue = scopeValueDepartment;
} else if(scopeType == 3) {
scopeValue = scopeValueMember;
}
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、 5-加班时长自动计入余额*/
int distributionMode = Util.getIntValue((String) params.get("distributionMode"), 1);
/*每人发放小时(天)数(当余额发放方式为每年自动发放固定天数时有效)*/
double annualAmount = Util.getDoubleValue((String) params.get("annualAmount"), 0);
/*扣减优先级1-法定年假、2-福利年假*/
int priority = Util.getIntValue((String) params.get("priority"), 1);
//法定年假规则0-工龄、1-司龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String legalKey = Util.null2s((String) params.get("legalKey"), "0");
//福利年假规则0-工龄、1-工龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String welfareKey = Util.null2s((String) params.get("welfareKey"), "1");
/*有效期规则0-不限制、1-按自然月(1月1日-12月31日)、2-按入职日期起12个月、3-自定义次年失效日期、4-自定义有效天数*/
int validityRule = Util.getIntValue((String) params.get("validityRule"), 1);
/*有效期天数:(当有效期天数选择按天数失效的时候有效)*/
int effectiveDays = Util.getIntValue((String) params.get("effectiveDays"), 30);
//有效月数(当有效期规则选择自定义有效月数时)
int effectiveMonths = Util.getIntValue((String) params.get("effectiveMonths"), 1);
/*失效日期--月当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationMonth = Util.null2String(params.get("expirationMonth"));
/*失效日期--日当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationDay = Util.null2String(params.get("expirationDay"));
/*允许延长有效期0-不允许、1-允许*/
int extensionEnable = Util.getIntValue((String) params.get("extensionEnable"), 0);
/*允许超过有效期天数*/
int extendedDays = Util.getIntValue((String) params.get("extendedDays"), 0);
/*释放规则0-不限制、1-按天释放、2-按月释放*/
int releaseRule = Util.getIntValue((String) params.get("releaseRule"), 0);
/*假期基数计算方式0-精确计算、1-按最少的假期余额计算、2-按最多的假期余额计算*/
int calcMethod = Util.getIntValue((String) params.get("calcMethod"), 0);
/*是否折算0-不折算、1-四舍五入、2-向上取整、3-向下取整、4-向上取0.5的倍数、5-向下取0.5的倍数*/
int convertMode = Util.getIntValue("" + params.get("convertMode"), 1);
/*次账号是否发放假期余额0-不发放、1-发放*/
int excludeSubAccount = Util.getIntValue("" + params.get("excludeSubAccount"), 1);
/*转正之前是否发放假期余额0-不发放、1-发放*/
int beforeFormal = Util.getIntValue("" + params.get("beforeFormal"), 1);
//多孩叠加开关。
int severalChildren = Util.getIntValue("" + params.get("severalChildren"), 0);
//孩子多少周岁前发放。
int yearsOld = Util.getIntValue("" + params.get("yearsOld"), 3);
//是否按照省份发放育儿假。
int isprovince = Util.getIntValue("" + params.get("isprovince"), 1);
// 2、在假期规则页面增加开关控制是否开启。carryOver
// 3、增加输入框控制结转天数。 carryOverDays
int carryOver = Util.getIntValue("" + params.get("carryOver"), 0);
double carryOverDays = Util.getDoubleValue((String) params.get("carryOverDays"), 0);
if (scopeType == 1 && scopeValue.equals("")) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(388858, user.getLanguage()));//参数有误
return resultMap;
}
if (distributionMode == 5) {
releaseRule = 0;
Map<String,String> data = KQLeaveRulesBiz.isRepeat(Util.null2String(ruleId),scopeType,scopeValue,user,Util.null2String(ruleDetailId));
if(null != data && "1".equals(data.get("flag"))){
resultMap.put("status", "-1");
resultMap.put("message", data.get("msg"));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
return resultMap;
}
/*两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式*/
// String sql = "select * from kq_LeaveRules where (isDelete is null or isDelete<>1) and id<>? and id in (select ruleId from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and distributionMode=5)";
// RecordSet recordSet = new RecordSet();
// recordSet.executeQuery(sql, ruleId);
// if (recordSet.next()) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
// return resultMap;
// }
if(null != deductorder && deductorder.length()>0){
String[] orders = deductorder.split(",");
if(null != orders && orders.length != 3){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(547752, user.getLanguage()));
return resultMap;
}
}
} else if (distributionMode == 6) {
/*同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505665, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
}else if (distributionMode == 8) {
/*同一假期类型下 育儿假 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>8";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8 and id<>?";
recordSet.executeQuery(sql, ruleId,ruleDetailId);
if (recordSet.next()) {
int severalChildrenValue = Util.getIntValue(Util.null2s(recordSet.getString("severalChildren"), "0"), 0);
if(severalChildrenValue!=severalChildren){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546859, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
}
} else {
/*同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505666, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=5";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(510357, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 育儿假叠加 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));
return resultMap;
}
}
//todo 美之高去除标准校验 同一应用维度下不可重复创建规则(editsave)
//String searchSql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and id<>?";
RecordSet recordSet = new RecordSet();
// recordSet.executeQuery(searchSql, ruleId, ruleDetailId);
// while (recordSet.next()) {
// int scopeTypeTemp = Util.getIntValue(recordSet.getString("scopeType"), 0);
// String scopeValueTemp = recordSet.getString("scopeValue");
//
// if (scopeType == 0 && scopeTypeTemp == 0) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505667, user.getLanguage()));//该假期类型下已经新建过总部的假期规则,请勿重复新建
// return resultMap;
// }
// if (scopeType == 1 && scopeTypeTemp == 1) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// for (String temp : scopeValueList)
// if (scopeValueTempList.contains(temp)) {
// SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
// String subcomName = subCompanyComInfo.getSubCompanyname(temp);
//
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505668, user.getLanguage()).replace("$", subcomName));//该假期类型下已经新建过分部的假期规则,请勿重复新建
// return resultMap;
// }
// }
// if (scopeType == 2 && scopeTypeTemp == 2) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// for (String temp : scopeValueList)
// if (scopeValueTempList.contains(temp)) {
// DepartmentComInfo comInfo = new DepartmentComInfo();
// String name = comInfo.getDepartmentname(temp);
//
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(534890, user.getLanguage()).replace("$", name));//该假期类型下已经新建过部门的假期规则,请勿重复新建
// return resultMap;
// }
// }
// if (scopeType == 3 && scopeTypeTemp == 3) {
// List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
// List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
// for (String temp : scopeValueList)
// if (scopeValueTempList.contains(temp)) {
// ResourceComInfo comInfo = new ResourceComInfo();
// String name = comInfo.getLastname(temp);
//
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(534891, user.getLanguage()).replace("$", name));//该假期类型下已经新建过人员的假期规则,请勿重复新建
// return resultMap;
// }
// }
// }
boolean flag = false;//数据是否更新成功
String sql = "update kq_LeaveRulesDetail set ruleId=?,ruleName=?,scopeType=?,scopeValue=?," +
"distributionMode=?,annualAmount=?,legalKey=?,welfareKey=?,priority=?,validityRule=?,effectiveDays=?,effectiveMonths=?,expirationMonth=?,expirationDay=?,extensionEnable=?,extendedDays=?,releaseRule=?,calcMethod=?,convertMode=?,excludeSubAccount=?,beforeFormal=?,severalChildren=?,yearsOld=?,isprovince=? ,carryOver=?,carryOverDays=?,deductorder=?,minLevel=?,maxLevel=? where id=?";
flag = recordSet.executeUpdate(sql, ruleId, ruleName, scopeType, scopeValue,
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal,severalChildren,yearsOld,isprovince,carryOver,carryOverDays,deductorder,minLevel,maxLevel,ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
if ((distributionMode == 2 || distributionMode == 7) && ruleDetailId != 0) {
sql = "delete from kq_EntryToLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
int lowerLimit = 0;//司龄下限
int upperLimit = 0;//司龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_EntryToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 3 && ruleDetailId != 0) {
sql = "delete from kq_WorkingAgeToLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
int lowerLimit = 0;//工龄下限
int upperLimit = 0;//工龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_WorkingAgeToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 6 && ruleDetailId != 0) {
sql = "delete from kq_MixModeToLegalLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
sql = "delete from kq_MixModeToWelfareLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
String mixModeData = Util.null2String(params.get("legalRule"));
JSONArray jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double legalAmount = jsonObject.getDoubleValue("legalAmount");
sql = "insert into kq_MixModeToLegalLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, legalAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
mixModeData = Util.null2String(params.get("welfareRule"));
jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double welfareAmount = jsonObject.getDoubleValue("welfareAmount");
sql = "insert into kq_MixModeToWelfareLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, welfareAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 8 && ruleDetailId != 0) {
sql = "delete from kq_provinceToLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
int provinceidValue = 0;//省份id
int yearsOldValue = 0;//孩子周岁
double amountValue = 0;//假期天数
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
provinceidValue = jsonObject.getIntValue("provinceid");
yearsOldValue = jsonObject.getIntValue("yearsOld");
amountValue = jsonObject.getDoubleValue("amount");
sql = "insert into kq_provinceToLeave(leaveRulesId,provinceid,yearsOld,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, provinceidValue, yearsOldValue, amountValue);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (flag) {
resultMap.put("sign", "1");
resultMap.put("message", SystemEnv.getHtmlLabelName(83551, user.getLanguage()));//保存成功
}
} catch (Exception e) {
writeLog(e);
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
} finally {
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
detailComInfo.removeCache();
}
return resultMap;
}
}

File diff suppressed because it is too large Load Diff

@ -1,234 +0,0 @@
package com.engine.kq.entity;
/**
*
*/
public class KQBalanceOfLeaveEntity {
/**
* ID
*/
int id;
/**
* ID
*/
int leaveRulesId;
/**
* ID
*/
int resourceId;
/**
*
* yyyy
*/
String belongYear;
/**
*
*
*/
double baseAmount = 0.00;
/**
*
*
*/
double usedAmount = 0.00;
/**
*
*
*/
double extraAmount = 0.00;
/**
*
*/
double baseAmount2 = 0.00;
/**
*
*/
double usedAmount2 = 0.00;
/**
*
*/
double extraAmount2 = 0.00;
/**
* 0-1-
*/
int status;
/**
*
*/
String expirationDate;
/**
*
*/
String effectiveDate;
/**
*
*/
int minimumUnit;
public KQBalanceOfLeaveEntity() {
}
public KQBalanceOfLeaveEntity(int id, int leaveRulesId, int resourceId, String belongYear, double baseAmount, double usedAmount, double extraAmount, double baseAmount2, double usedAmount2, double extraAmount2, int status, String expirationDate) {
this.id = id;
this.leaveRulesId = leaveRulesId;
this.resourceId = resourceId;
this.belongYear = belongYear;
this.baseAmount = baseAmount;
this.usedAmount = usedAmount;
this.extraAmount = extraAmount;
this.baseAmount2 = baseAmount2;
this.usedAmount2 = usedAmount2;
this.extraAmount2 = extraAmount2;
this.status = status;
this.expirationDate = expirationDate;
}
public KQBalanceOfLeaveEntity(int id, int leaveRulesId, int resourceId, String belongYear, double baseAmount, double usedAmount, double extraAmount, double baseAmount2, double usedAmount2, double extraAmount2, int status, String expirationDate ,String effectiveDate) {
this.id = id;
this.leaveRulesId = leaveRulesId;
this.resourceId = resourceId;
this.belongYear = belongYear;
this.baseAmount = baseAmount;
this.usedAmount = usedAmount;
this.extraAmount = extraAmount;
this.baseAmount2 = baseAmount2;
this.usedAmount2 = usedAmount2;
this.extraAmount2 = extraAmount2;
this.status = status;
this.expirationDate = expirationDate;
this.effectiveDate = effectiveDate;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getLeaveRulesId() {
return leaveRulesId;
}
public void setLeaveRulesId(int leaveRulesId) {
this.leaveRulesId = leaveRulesId;
}
public int getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}
public String getBelongYear() {
return belongYear;
}
public void setBelongYear(String belongYear) {
this.belongYear = belongYear;
}
public double getBaseAmount() {
return baseAmount;
}
public void setBaseAmount(double baseAmount) {
this.baseAmount = baseAmount;
}
public double getUsedAmount() {
return usedAmount;
}
public void setUsedAmount(double usedAmount) {
this.usedAmount = usedAmount;
}
public double getExtraAmount() {
return extraAmount;
}
public void setExtraAmount(double extraAmount) {
this.extraAmount = extraAmount;
}
public double getBaseAmount2() {
return baseAmount2;
}
public void setBaseAmount2(double baseAmount2) {
this.baseAmount2 = baseAmount2;
}
public double getUsedAmount2() {
return usedAmount2;
}
public void setUsedAmount2(double usedAmount2) {
this.usedAmount2 = usedAmount2;
}
public double getExtraAmount2() {
return extraAmount2;
}
public void setExtraAmount2(double extraAmount2) {
this.extraAmount2 = extraAmount2;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(String expirationDate) {
this.expirationDate = expirationDate;
}
public String getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
public int getMinimumUnit() {
return minimumUnit;
}
public void setMinimumUnit(int minimumUnit) {
this.minimumUnit = minimumUnit;
}
public boolean equals(KQBalanceOfLeaveEntity entity) {
if (this.baseAmount != entity.getBaseAmount()
|| this.extraAmount != entity.getExtraAmount()
|| this.usedAmount != entity.getUsedAmount()
|| this.baseAmount2 != entity.getBaseAmount2()
|| this.extraAmount2 != entity.getExtraAmount2()
|| this.usedAmount2 != entity.getUsedAmount2()) {
return false;
} else {
return true;
}
}
public boolean equalsByBaseAmount(KQBalanceOfLeaveEntity entity) {
if (this.baseAmount != entity.getBaseAmount()
|| this.baseAmount2 != entity.getBaseAmount2()) {
return false;
} else {
return true;
}
}
}

@ -1,19 +0,0 @@
package com.engine.kq.jucailin.util;
import java.sql.Date;
import java.sql.Timestamp;
public class KQDateUtil {
public static Date getUpdateDate(){
Long now = System.currentTimeMillis();
Date date = new Date(now);
return date;
}
public static Timestamp getUpdateTimeStamp(){
Long now = System.currentTimeMillis();
Timestamp timestamp = new Timestamp(now);
return timestamp;
}
}

@ -1,24 +0,0 @@
package com.engine.mzgsecond.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/12/23 2:13 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BirthdayRemindVo {
private String lastname;
private Integer day;
}

@ -1,39 +0,0 @@
package com.engine.mzgsecond.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/12/23 2:13 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PersonInfoVo {
private Integer id;
private String imageUrl;
private String lastname;
private String status;
private String jobTitle;
private Integer day;
private String amount;
private String txAmount;
private String performance;
}

@ -1,27 +0,0 @@
package com.engine.mzgsecond.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/12/23 2:19 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TodoNoticeTrainVo {
private String title;
private Integer count;
private String key;
private String url;
}

@ -1,45 +0,0 @@
package com.engine.mzgsecond.service;
import com.engine.mzgsecond.entity.BirthdayRemindVo;
import com.engine.mzgsecond.entity.PersonInfoVo;
import com.engine.mzgsecond.entity.TodoNoticeTrainVo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @Author liang.cheng
* @Date 2024/12/23 11:21 AM
* @Description:
* @Version 1.0
*/
public interface PortalElementCusService {
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/12/23 2:17 PM
* @param: []
* @return: com.engine.mzgsecond.entity.PersonInfoVo
*/
PersonInfoVo personInfo();
/**
* @Description:
* @Author: liang.cheng
* @Date: 2024/12/23 2:21 PM
* @param: []
* @return: com.engine.mzgsecond.entity.TodoNoticeTrainVo
*/
List<TodoNoticeTrainVo> todoNoticeTrain(HttpServletRequest request, HttpServletResponse response);
/**
* @Description: ()
* @Author: liang.cheng
* @Date: 2024/12/23 2:23 PM
* @param: []
* @return: com.engine.mzgsecond.entity.BirthdayRemindVo
*/
List<BirthdayRemindVo> birthdayRemind();
}

@ -1,240 +0,0 @@
package com.engine.mzgsecond.service.impl;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.api.doc.mobile.systemDoc.util.CategoryUtil;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.kq.biz.KQBalanceOfLeaveBiz;
import com.engine.mzgsecond.entity.BirthdayRemindVo;
import com.engine.mzgsecond.entity.PersonInfoVo;
import com.engine.mzgsecond.entity.TodoNoticeTrainVo;
import com.engine.mzgsecond.service.PortalElementCusService;
import com.engine.workflow.service.impl.RequestListServiceImpl;
import org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.common.database.dialect.DialectUtil;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author liang.cheng
* @Date 2024/12/23 11:21 AM
* @Description: TODO
* @Version 1.0
*/
public class PortalElementCusServiceImpl extends Service implements PortalElementCusService {
@Override
public PersonInfoVo personInfo() {
RecordSet rs = new RecordSet();
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
String amountId = rs.getPropValue("mzgsecond", "amountId");
String currentDate = DateUtil.getCurrentDate();
String restAmount = KQBalanceOfLeaveBiz.getRestAmount(String.valueOf(user.getUID()),amountId,currentDate);
String txAmountId = rs.getPropValue("mzgsecond", "txAmountId");
String txRestAmount = KQBalanceOfLeaveBiz.getRestAmount(String.valueOf(user.getUID()),txAmountId,currentDate);
PersonInfoVo personInfo = PersonInfoVo.builder()
.id(user.getUID())
.imageUrl(getImageFile(String.valueOf(user.getUID())))
.lastname(Util.formatMultiLang(user.getLastname(),String.valueOf(user.getLanguage())))
.jobTitle(jobTitlesComInfo.getJobTitlesname(user.getJobtitle()))
.day(0)
.amount(restAmount)
.txAmount(txRestAmount)
.performance("未开始")
.build();
String companystartdate = "";
Integer status = null;
rs.executeQuery("select companystartdate,status from hrmresource where id = ?",user.getUID());
if (rs.next()) {
companystartdate = Util.null2String(rs.getString("companystartdate"));
status = Util.getIntValue(rs.getString("status"));
}
if (status != null) {
personInfo.setStatus(getStatus(status));
}else {
personInfo.setStatus("未设置");
}
if (StringUtils.isNotEmpty(companystartdate)) {
personInfo.setDay(getCompanyDay(companystartdate));
}
return personInfo;
}
@Override
public List<TodoNoticeTrainVo> todoNoticeTrain(HttpServletRequest request, HttpServletResponse response) {
RecordSet rs = new RecordSet();
List<TodoNoticeTrainVo> list = new ArrayList<>();
// 待办事项
TodoNoticeTrainVo todo = TodoNoticeTrainVo.builder()
.key("todo")
.title("待办事项")
.count(0)
.url(rs.getPropValue("mzgsecond", "todoUrl").replace("'", ""))
.build();
Map<String, Object> todoMap = ServiceUtil.getService(RequestListServiceImpl.class, user).doingCountInfo(request);
JSONObject totDatas = JSONObject.parseObject(JSONObject.toJSONString(todoMap));
if (totDatas.containsKey("totalcount")) {
JSONObject totalCount = totDatas.getJSONObject("totalcount");
String flowAll = totalCount.getString("flowAll");
todo.setCount(Convert.toInt(flowAll, 0));
}
list.add(todo);
// 通知公告
TodoNoticeTrainVo notice = TodoNoticeTrainVo.builder()
.key("notice")
.title("通知公告")
.count(0)
.url(rs.getPropValue("mzgsecond", "noticeUrl").replace("'", ""))
.build();
List<String> secCategoryList = new ArrayList<>();
String rootDirectory = rs.getPropValue("mzgsecond", "docId");
getSubdirectories(rootDirectory, secCategoryList);
Map<String, Object> params = ParamUtil.request2Map(request);
try {
params.put("secid", StringUtils.join(secCategoryList, ","));
Map<String, Object> result = CategoryUtil.getHasDocOfCategoryNum(user, CategoryUtil.NEWS_DOC, params);
String allNoReadNum = Util.null2String(result.get("allnoReadNum"));
notice.setCount(Convert.toInt(allNoReadNum, 0));
} catch (Exception e) {
rs.writeLog(e);
}
list.add(notice);
// 培训活动
TodoNoticeTrainVo train = TodoNoticeTrainVo.builder()
.key("train")
.title("培训活动")
.count(0)
.url(rs.getPropValue("mzgsecond", "trainUrl").replace("'", ""))
.build();
rs.executeQuery("select count(1) as num from uf_pxgcjl where zt = 0 ");
if (rs.next()) {
String number = rs.getString("num");
train.setCount(Convert.toInt(number, 0));
}
list.add(train);
return list;
}
@Override
public List<BirthdayRemindVo> birthdayRemind() {
List<BirthdayRemindVo> birthdayRemindVos = new ArrayList<>();
String currentMonth = DateUtil.getCurrentDate().substring(5, 7);
int day = Integer.parseInt(DateUtil.getCurrentDate().substring(8, 10));
RecordSet rs = new RecordSet();
String substrFun = ("oracle".equals(rs.getDBType()) || DialectUtil.isMySql(rs.getDBType())) ? "substr" : "substring";
rs.executeQuery("select lastname,"+substrFun+"(birthday,9,2) as days from hrmresource where status < 4 and birthday is not null and birthday <> ''\n" +
" and "+substrFun+"(birthday,6,2) = ? order by secLevel desc",currentMonth);
while (rs.next()) {
String lastname = Util.null2String(rs.getString("lastname"));
int days = Util.getIntValue(rs.getString("days"));
int betweenDay = days - day;
if (betweenDay >= 0) {
birthdayRemindVos.add(BirthdayRemindVo.builder()
.lastname(lastname)
.day(betweenDay)
.build());
}
}
//获取前3条数据
return birthdayRemindVos.stream()
.sorted(Comparator.comparing(BirthdayRemindVo::getDay))
.limit(3)
.collect(Collectors.toList());
}
/**
*
*
* @param rootDirectory
* @param seccategoryList
*/
private void getSubdirectories(String rootDirectory, List<String> seccategoryList) {
RecordSet rs = new RecordSet();
seccategoryList.add(rootDirectory);
rs.executeQuery("select id from DocSecCategory where parentid = ?", rootDirectory);
while (rs.next()) {
String id = rs.getString("id");
getSubdirectories(id, seccategoryList);
}
}
private String getStatus(int status) {
String statusName = "";
switch (status){
case 0:
statusName="试用";break;
case 1:
statusName="正式";break;
case 2:
statusName="临时";break;
case 3:
statusName="试用延期";break;
case 4:
statusName="解聘";break;
case 5:
statusName="离职";break;
case 6:
statusName="退休";break;
case 7:
statusName="无效";break;
default: statusName="未设置";
break;
}
return statusName;
}
private String getImageFile(String uId) {
String imageUrl = "";
try {
imageUrl = new ResourceComInfo().getMessagerUrls(uId);
if ("/messager/images/icon_w_wev8.jpg".equals(imageUrl) || "/messager/images/icon_m_wev8.jpg".equals(imageUrl)) {
imageUrl = "";
}
} catch (Exception e) {
e.printStackTrace();
}
return imageUrl;
}
private int getCompanyDay(String companyDate) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate startDate = LocalDate.parse(companyDate, formatter);
LocalDate currentDate = LocalDate.now();
return (int)ChronoUnit.DAYS.between(startDate, currentDate);
}
}

@ -1,80 +0,0 @@
package com.engine.mzgsecond.web;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.engine.common.util.ServiceUtil;
import com.engine.mzgsecond.service.PortalElementCusService;
import com.engine.mzgsecond.service.impl.PortalElementCusServiceImpl;
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.HashMap;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2024/12/23 11:09 AM
* @Description:
* @Version 1.0
*/
public class PortalElementCusAction {
private PortalElementCusService getService(User user) {
return ServiceUtil.getService(PortalElementCusServiceImpl.class, user);
}
@GET
@Path("/element/personInfo")
@Produces(MediaType.TEXT_PLAIN)
public String personInfo(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("datas",getService(user).personInfo());
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data,SerializerFeature.DisableCircularReferenceDetect);
}
@GET
@Path("/element/todoNoticeTrain")
@Produces(MediaType.TEXT_PLAIN)
public String todoNoticeTrain(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("datas",getService(user).todoNoticeTrain(request, response));
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
}
@GET
@Path("/element/birthdayRemind")
@Produces(MediaType.TEXT_PLAIN)
public String birthdayRemind(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("datas",getService(user).birthdayRemind());
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
}
}

@ -1,7 +1,5 @@
package test;
import weaver.common.DateUtil;
/**
* @Author weaver_cl
* @Description:
@ -11,11 +9,6 @@ import weaver.common.DateUtil;
public class MainTest {
public static void main(String[] args) {
String currentMonth = DateUtil.getCurrentDate().substring(5, 7);
int day = Integer.parseInt(DateUtil.getCurrentDate().substring(8, 10));
System.out.println(currentMonth);
System.out.println(day);
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save