Merge branch 'release/2.9.8.2311.02' into release/个税版本
This commit is contained in:
commit
1d1d322188
|
|
@ -0,0 +1,371 @@
|
||||||
|
package com.engine.salary.remote.attend.cmd;
|
||||||
|
|
||||||
|
import com.api.hrm.bean.HrmFieldBean;
|
||||||
|
import com.api.hrm.util.HrmFieldUtil;
|
||||||
|
import com.engine.common.biz.AbstractCommonCommand;
|
||||||
|
import com.engine.common.entity.BizLogContext;
|
||||||
|
import com.engine.core.interceptor.CommandContext;
|
||||||
|
import com.engine.kq.biz.KQBalanceOfLeaveBiz;
|
||||||
|
import com.engine.kq.biz.KQLeaveRulesBiz;
|
||||||
|
import com.engine.kq.biz.KQLeaveRulesComInfo;
|
||||||
|
import com.engine.kq.biz.KQReportBiz;
|
||||||
|
import com.engine.kq.util.KQTransMethod;
|
||||||
|
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.systeminfo.SystemEnv;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工假期余额报表--获取查询列表
|
||||||
|
*/
|
||||||
|
public class GetSearchListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||||
|
|
||||||
|
public GetSearchListCmd(Map<String, Object> params, User user) {
|
||||||
|
this.user = user;
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BizLogContext getLogContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||||||
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||||
|
/**
|
||||||
|
* 分页控件返回的值
|
||||||
|
* currentPage:当前页数
|
||||||
|
* pageSize:每页多少条数据
|
||||||
|
*/
|
||||||
|
int currentPage = Util.getIntValue((String) params.get("currentPage"), 1);
|
||||||
|
int pageSize = Util.getIntValue((String) params.get("pageSize"), 10);
|
||||||
|
/**
|
||||||
|
* 时间范围选择的年份
|
||||||
|
* dateScope:5-本年、8-上一年
|
||||||
|
* selectedYear:指定年份
|
||||||
|
*/
|
||||||
|
String dateScope = Util.null2String(params.get("dateScope"));
|
||||||
|
String selectedYear = Util.null2String(params.get("selectedYear"));
|
||||||
|
if (dateScope.equals("5") || dateScope.equals("8")) {
|
||||||
|
selectedYear = TimeUtil.getDateByOption(dateScope, "0").substring(0, 4);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 数据范围
|
||||||
|
* dataScope:0-总部、1-分部、2-分部、3-人员、4-我的下属
|
||||||
|
* subcomId:指定分部ID
|
||||||
|
* deptId:指定部门ID
|
||||||
|
* resourceId:指定人员ID
|
||||||
|
* allLevel:是否包含下级下属:0-不包含、1-包含
|
||||||
|
*/
|
||||||
|
String dataScope = Util.null2String(params.get("dataScope"));
|
||||||
|
String subcomId = Util.null2String(params.get("subcomId"));
|
||||||
|
String deptId = Util.null2String(params.get("deptId"));
|
||||||
|
String resourceId = Util.null2String(params.get("resourceId"));
|
||||||
|
String allLevel = Util.null2String(params.get("allLevel"));
|
||||||
|
/**
|
||||||
|
* isNoAccount:是否显示无账号人员:true-显示、false-不显示
|
||||||
|
*/
|
||||||
|
String isNoAccount = Util.null2String(params.get("isNoAccount"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
/**
|
||||||
|
* 获取考勤报表权限共享设置
|
||||||
|
*/
|
||||||
|
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||||
|
// String rightStr = kqReportBiz.getReportRight("4", "" + user.getUID(), "a");
|
||||||
|
String rightStr ="";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼凑查询结果列表的表头
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> columnsList = new ArrayList<Map<String, Object>>();
|
||||||
|
List<HrmFieldBean> hrmFieldBeanList = new ArrayList<HrmFieldBean>();
|
||||||
|
HrmFieldBean hrmFieldBean = null;
|
||||||
|
String[] tempArr = new String[]{"lastName,413", "subcom,141", "dept,124", "jobtitle,6086","workcode,714", "companyStartDate,1516"};
|
||||||
|
for (int i = 0; i < tempArr.length; i++) {
|
||||||
|
String[] fieldInfo = tempArr[i].split(",");
|
||||||
|
hrmFieldBean = new HrmFieldBean();
|
||||||
|
hrmFieldBean.setFieldname(fieldInfo[0]);
|
||||||
|
hrmFieldBean.setFieldlabel(fieldInfo[1]);
|
||||||
|
hrmFieldBean.setFieldhtmltype("1");
|
||||||
|
hrmFieldBean.setType("1");
|
||||||
|
hrmFieldBean.setViewAttr(1);
|
||||||
|
hrmFieldBean.setIsFormField(true);
|
||||||
|
hrmFieldBeanList.add(hrmFieldBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************/
|
||||||
|
|
||||||
|
/**获取假期类型的相关设置*/
|
||||||
|
|
||||||
|
/*请假类型的ID*/
|
||||||
|
String leaveRulesId = "";
|
||||||
|
|
||||||
|
/*假期类型的名称,用作查询结果列表的表头显示*/
|
||||||
|
String leaveName = "";
|
||||||
|
|
||||||
|
/*最小请假单位:1-按天请假、2-按半天请假、3-按小时请假、4-按整天请假*/
|
||||||
|
int minimumUnit = 1;
|
||||||
|
|
||||||
|
/*请假单位的显示名称是天还是小时*/
|
||||||
|
String unitName = "";
|
||||||
|
|
||||||
|
/*是否开启假期余额,没有开启假期余额时需要提示“不限制余额*/
|
||||||
|
int balanceEnable = 0;
|
||||||
|
|
||||||
|
/**********************************************************************************************************/
|
||||||
|
|
||||||
|
/*是否是混合模式(福利年假+法定年假)*/
|
||||||
|
boolean isMixMode = false;
|
||||||
|
|
||||||
|
//是否是调休
|
||||||
|
boolean isTiaoXiu = false;
|
||||||
|
|
||||||
|
/**********************************************************************************************************/
|
||||||
|
|
||||||
|
/*获取当前日期*/
|
||||||
|
String currentDate = DateUtil.getCurrentDate();
|
||||||
|
|
||||||
|
Map<String, BigDecimal> balanceMap = new HashMap<String, BigDecimal>();
|
||||||
|
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
|
||||||
|
rulesComInfo.setTofirstRow();
|
||||||
|
while (rulesComInfo.next()) {
|
||||||
|
if (rulesComInfo.getIsEnable().equals("0")) {
|
||||||
|
continue;//此假期类型没有启用
|
||||||
|
}
|
||||||
|
|
||||||
|
/*获取假期类型的设置 start*/
|
||||||
|
leaveRulesId = rulesComInfo.getId();
|
||||||
|
leaveName = Util.formatMultiLang(rulesComInfo.getLeaveName(), "" + user.getLanguage());
|
||||||
|
minimumUnit = Util.getIntValue(rulesComInfo.getMinimumUnit(), 1);
|
||||||
|
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
|
||||||
|
unitName = SystemEnv.getHtmlLabelName(389325, user.getLanguage());//(天)
|
||||||
|
} else {
|
||||||
|
unitName = SystemEnv.getHtmlLabelName(389326, user.getLanguage());//(小时)
|
||||||
|
}
|
||||||
|
String showName = leaveName + unitName;
|
||||||
|
balanceEnable = Util.getIntValue(rulesComInfo.getBalanceEnable(), 0);
|
||||||
|
|
||||||
|
isMixMode = KQLeaveRulesBiz.isMixMode(leaveRulesId);
|
||||||
|
isTiaoXiu = KQLeaveRulesBiz.isTiaoXiu(leaveRulesId);
|
||||||
|
/*获取假期类型的设置 end*/
|
||||||
|
|
||||||
|
hrmFieldBean = new HrmFieldBean();
|
||||||
|
hrmFieldBean.setFieldname(rulesComInfo.getId());
|
||||||
|
hrmFieldBean.setFieldlabelname(showName);
|
||||||
|
hrmFieldBean.setFieldhtmltype("1");
|
||||||
|
hrmFieldBean.setType("1");
|
||||||
|
hrmFieldBean.setViewAttr(1);
|
||||||
|
hrmFieldBean.setIsFormField(true);
|
||||||
|
hrmFieldBeanList.add(hrmFieldBean);
|
||||||
|
|
||||||
|
/*判断该假期规则是否开启了假期余额,若没有开启,则无需查找该假期的余额,直接遍历下一个假期*/
|
||||||
|
if (balanceEnable == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//如果是调休,获取假期余额的方式有些不同
|
||||||
|
if(isTiaoXiu){
|
||||||
|
params.put("leaveRulesId",leaveRulesId);
|
||||||
|
params.put("showAll","false");
|
||||||
|
Map<String, BigDecimal> _balanceMap = KQBalanceOfLeaveBiz.getRestAmountMapByDis5(params,user);
|
||||||
|
balanceMap.putAll(_balanceMap);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*查询指定年份指定假期的余额数据,并放入集合中,用于后续拼凑查询结果数据*/
|
||||||
|
KQTransMethod transMethod = new KQTransMethod();
|
||||||
|
RecordSet recordSet = new RecordSet();
|
||||||
|
String sql = "select a.id hrmResourceId,a.companyStartDate,a.workStartDate,b.* from HrmResource a left join kq_balanceOfLeave b on a.id=b.resourceId " +
|
||||||
|
"and belongYear='" + selectedYear + "' and b.leaveRulesId=" + leaveRulesId + " where 1=1 ";
|
||||||
|
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||||
|
sql = "select a.id hrmResourceId,a.companyStartDate,a.workStartDate,b.*,ROW_NUMBER() OVER(order by dspOrder,a.id) as rn from HrmResource a left join kq_balanceOfLeave b on a.id=b.resourceId " +
|
||||||
|
"and belongYear='" + selectedYear + "' and b.leaveRulesId=" + leaveRulesId + " where 1=1 ";
|
||||||
|
} else if (recordSet.getDBType().equalsIgnoreCase("mysql")) {
|
||||||
|
sql = "select a.id hrmResourceId,a.companyStartDate,a.workStartDate,b.* from HrmResource a left join kq_balanceOfLeave b on a.id=b.resourceId " +
|
||||||
|
"and belongYear='" + selectedYear + "' and b.leaveRulesId=" + leaveRulesId + " where 1=1 ";
|
||||||
|
}
|
||||||
|
if (dataScope.equals("0")) {
|
||||||
|
//总部
|
||||||
|
} else if (dataScope.equals("1")) {
|
||||||
|
sql += " and a.subcompanyId1 in (" + subcomId + ") ";
|
||||||
|
} else if (dataScope.equals("2")) {
|
||||||
|
sql += " and a.departmentId in (" + deptId + ") ";
|
||||||
|
} else if (dataScope.equals("3")) {
|
||||||
|
sql += " and a.id in (" + resourceId + ")";
|
||||||
|
} else if (dataScope.equals("4")) {
|
||||||
|
if (allLevel.equals("1")) {
|
||||||
|
sql += " and (a.id=" + user.getUID() + " or a.managerStr like '%," + user.getUID() + ",%' )";
|
||||||
|
} else {
|
||||||
|
sql += " and (a.id=" + user.getUID() + " or a.managerid = " + user.getUID() + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNoAccount.equals("false")) {
|
||||||
|
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")
|
||||||
|
|| recordSet.getDBType().equalsIgnoreCase("mysql")) {
|
||||||
|
sql += " and (loginId is not null and loginId<>'')";
|
||||||
|
} else {
|
||||||
|
sql += " and (loginId is not null)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//考勤报表共享设置
|
||||||
|
if (!rightStr.equals("") && !dataScope.equals("4")) {
|
||||||
|
sql += rightStr;
|
||||||
|
}
|
||||||
|
if (!recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||||
|
sql += " order by dspOrder,hrmResourceId ";
|
||||||
|
}
|
||||||
|
|
||||||
|
String pageSql = "select * from (select tmp.*,rownum rn from (" + sql + ") tmp where rownum<=" + (pageSize * currentPage) + ") where rn>=" + (pageSize * (currentPage - 1) + 1);
|
||||||
|
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||||
|
pageSql = "select t.* from (" + sql + ") t where 1=1 and rn>=" + (pageSize * (currentPage - 1) + 1) + " and rn<=" + (pageSize * currentPage);
|
||||||
|
} else if (recordSet.getDBType().equalsIgnoreCase("mysql")) {
|
||||||
|
pageSql = sql + " limit " + (currentPage - 1) * pageSize + "," + pageSize;
|
||||||
|
}
|
||||||
|
recordSet.executeQuery(pageSql);
|
||||||
|
while (recordSet.next()) {
|
||||||
|
String hrmResourceId = recordSet.getString("hrmResourceId");
|
||||||
|
//所属年份
|
||||||
|
String belongYear = recordSet.getString("belongYear");
|
||||||
|
//失效日期
|
||||||
|
String effectiveDate = recordSet.getString("effectiveDate");
|
||||||
|
//失效日期
|
||||||
|
String expirationDate = recordSet.getString("expirationDate");
|
||||||
|
/*判断假期余额的有效期*/
|
||||||
|
boolean status = KQBalanceOfLeaveBiz.getBalanceStatus(leaveRulesId, hrmResourceId, belongYear, currentDate,effectiveDate,expirationDate);
|
||||||
|
if (!status) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BigDecimal baseAmount = new BigDecimal(Util.getDoubleValue(recordSet.getString("baseAmount"), 0.00));//假期基数
|
||||||
|
BigDecimal usedAmount = new BigDecimal(Util.getDoubleValue(recordSet.getString("usedAmount"), 0.00));//已用假期
|
||||||
|
BigDecimal extraAmount = new BigDecimal(Util.getDoubleValue(recordSet.getString("extraAmount"), 0.00));//额外假期
|
||||||
|
BigDecimal baseAmount2 = new BigDecimal(Util.getDoubleValue(recordSet.getString("baseAmount2"), 0.00));//用于混合模式时:福利年假基数
|
||||||
|
BigDecimal usedAmount2 = new BigDecimal(Util.getDoubleValue(recordSet.getString("usedAmount2"), 0.00));//用于混合模式时:已用福利年假
|
||||||
|
BigDecimal extraAmount2 = new BigDecimal(Util.getDoubleValue(recordSet.getString("extraAmount2"), 0.00));//用于混合模式时:额外福利年假
|
||||||
|
|
||||||
|
BigDecimal restAmount = new BigDecimal(0);
|
||||||
|
if (isMixMode) {
|
||||||
|
/*释放规则*/
|
||||||
|
baseAmount = KQBalanceOfLeaveBiz.getCanUseAmount(hrmResourceId, leaveRulesId, belongYear, baseAmount, "legal", currentDate);
|
||||||
|
baseAmount2 = KQBalanceOfLeaveBiz.getCanUseAmount(hrmResourceId, leaveRulesId, belongYear, baseAmount2, "welfare", currentDate);
|
||||||
|
|
||||||
|
restAmount = baseAmount.add(extraAmount).subtract(usedAmount).add(baseAmount2).add(extraAmount2).subtract(usedAmount2);
|
||||||
|
} else {
|
||||||
|
/*释放规则*/
|
||||||
|
baseAmount = KQBalanceOfLeaveBiz.getCanUseAmount(hrmResourceId, leaveRulesId, belongYear, baseAmount, "", currentDate);
|
||||||
|
|
||||||
|
restAmount = baseAmount.add(extraAmount).subtract(usedAmount);
|
||||||
|
}
|
||||||
|
balanceMap.put(hrmResourceId + "_" + leaveRulesId, restAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于拼凑查询结果列表的表数据
|
||||||
|
*/
|
||||||
|
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||||
|
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||||
|
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||||
|
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
|
||||||
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||||
|
RecordSet recordSet = new RecordSet();
|
||||||
|
String sql = "select * from HrmResource a where 1=1 ";
|
||||||
|
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||||
|
sql = "select *,ROW_NUMBER() OVER(order by dspOrder,id) as rn from HrmResource a where 1=1 ";
|
||||||
|
}
|
||||||
|
if (dataScope.equals("0")) {
|
||||||
|
//总部
|
||||||
|
} else if (dataScope.equals("1")) {
|
||||||
|
sql += " and a.subcompanyId1 in (" + subcomId + ") ";
|
||||||
|
} else if (dataScope.equals("2")) {
|
||||||
|
sql += " and a.departmentId in (" + deptId + ") ";
|
||||||
|
} else if (dataScope.equals("3")) {
|
||||||
|
sql += " and a.id in (" + resourceId + ")";
|
||||||
|
} else if (dataScope.equals("4")) {
|
||||||
|
if (allLevel.equals("1")) {
|
||||||
|
sql += " and (a.id=" + user.getUID() + " or a.managerStr like '%," + user.getUID() + ",%' )";
|
||||||
|
} else {
|
||||||
|
sql += " and (a.id=" + user.getUID() + " or a.managerid = " + user.getUID() + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNoAccount.equals("false")) {
|
||||||
|
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")
|
||||||
|
|| recordSet.getDBType().equalsIgnoreCase("mysql")) {
|
||||||
|
sql += " and (a.loginId is not null and a.loginId<>'')";
|
||||||
|
} else {
|
||||||
|
sql += " and (a.loginId is not null)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//考勤报表共享设置
|
||||||
|
if (!rightStr.equals("") && !dataScope.equals("4")) {
|
||||||
|
sql += rightStr;
|
||||||
|
}
|
||||||
|
if (!recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||||
|
sql += " order by dspOrder,id ";
|
||||||
|
}
|
||||||
|
String pageSql = "select * from (select tmp.*,rownum rn from (" + sql + ") tmp where rownum<=" + (pageSize * currentPage) + ") where rn>=" + (pageSize * (currentPage - 1) + 1);
|
||||||
|
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) {
|
||||||
|
pageSql = "select t.* from (" + sql + ") t where 1=1 and rn>=" + (pageSize * (currentPage - 1) + 1) + " and rn<=" + (pageSize * currentPage);
|
||||||
|
} else if (recordSet.getDBType().equalsIgnoreCase("mysql")) {
|
||||||
|
pageSql = sql + " limit " + (currentPage - 1) * pageSize + "," + pageSize;
|
||||||
|
}
|
||||||
|
recordSet.executeQuery(pageSql);
|
||||||
|
while (recordSet.next()) {
|
||||||
|
dataMap = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
String id = recordSet.getString("id");
|
||||||
|
String lastName = Util.formatMultiLang(recordSet.getString("lastName"), "" + user.getLanguage());
|
||||||
|
String departmentId = recordSet.getString("departmentId");
|
||||||
|
String subcompanyId = recordSet.getString("subcompanyId1");
|
||||||
|
String jobtitleId = recordSet.getString("jobtitle");
|
||||||
|
String workcode = recordSet.getString("workcode");
|
||||||
|
String companyStartdate = recordSet.getString("companyStartdate");
|
||||||
|
|
||||||
|
dataMap.put("id", id);
|
||||||
|
dataMap.put("lastName", lastName);
|
||||||
|
dataMap.put("subcom", Util.formatMultiLang(subCompanyComInfo.getSubcompanyname(subcompanyId), "" + user.getLanguage()));
|
||||||
|
dataMap.put("dept", Util.formatMultiLang(departmentComInfo.getDepartmentname(departmentId), "" + user.getLanguage()));
|
||||||
|
dataMap.put("jobtitle", Util.formatMultiLang(jobTitlesComInfo.getJobTitlesname(jobtitleId), "" + user.getLanguage()));
|
||||||
|
dataMap.put("workcode", workcode);
|
||||||
|
dataMap.put("companyStartDate", companyStartdate);
|
||||||
|
dataMap.put("subcomId", subcompanyId);
|
||||||
|
dataMap.put("deptId", departmentId);
|
||||||
|
dataMap.put("jobtitleId", jobtitleId);
|
||||||
|
|
||||||
|
rulesComInfo.setTofirstRow();
|
||||||
|
while (rulesComInfo.next()) {
|
||||||
|
if (rulesComInfo.getIsEnable().equals("0")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/*该假期没有开启余额限制,显示不限制余额*/
|
||||||
|
if (rulesComInfo.getBalanceEnable().equals("0")) {
|
||||||
|
dataMap.put(rulesComInfo.getId(), SystemEnv.getHtmlLabelName(389731, user.getLanguage()));//不限制余额
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BigDecimal restAmount = balanceMap.get(id + "_" + rulesComInfo.getId());
|
||||||
|
dataMap.put(rulesComInfo.getId(), restAmount != null ? restAmount.setScale(2, RoundingMode.HALF_UP).toPlainString() : "0");
|
||||||
|
}
|
||||||
|
dataList.add(dataMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
columnsList = HrmFieldUtil.getHrmDetailTable(hrmFieldBeanList, null, user);
|
||||||
|
resultMap.put("columns", columnsList);
|
||||||
|
resultMap.put("datas", dataList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,8 +3,8 @@ package com.engine.salary.remote.attend.service.impl;
|
||||||
import com.alibaba.druid.support.json.JSONUtils;
|
import com.alibaba.druid.support.json.JSONUtils;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.engine.core.impl.Service;
|
import com.engine.core.impl.Service;
|
||||||
import com.engine.kq.cmd.balanceofleaverp.GetSearchListCmd;
|
|
||||||
import com.engine.kq.cmd.report.GetKQReportCmd;
|
import com.engine.kq.cmd.report.GetKQReportCmd;
|
||||||
|
import com.engine.salary.remote.attend.cmd.GetSearchListCmd;
|
||||||
import com.engine.salary.remote.attend.entity.Attend4Salary;
|
import com.engine.salary.remote.attend.entity.Attend4Salary;
|
||||||
import com.engine.salary.remote.attend.service.RemoteAttend4SalaryService;
|
import com.engine.salary.remote.attend.service.RemoteAttend4SalaryService;
|
||||||
import com.engine.salary.util.SalaryDateUtil;
|
import com.engine.salary.util.SalaryDateUtil;
|
||||||
|
|
@ -106,8 +106,9 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> getDatas(Attend4Salary attend4Salary) {
|
public List<Map<String, String>> getDatas(Attend4Salary attend4Salary) {
|
||||||
ValidUtil.doValidator(attend4Salary);
|
ValidUtil.doValidator(attend4Salary);
|
||||||
log.info("开始获取的考勤数据,参数{}", attend4Salary);
|
log.info("salaryAttend开始获取的考勤数据,参数{}", attend4Salary);
|
||||||
List<Map<String, String>> list = new ArrayList<>();
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
||||||
paramsMap.put("pageIndex", 1);
|
paramsMap.put("pageIndex", 1);
|
||||||
|
|
@ -126,10 +127,13 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
|
||||||
temp.put("reportType", "month");
|
temp.put("reportType", "month");
|
||||||
list = (List<Map<String, String>>) commandExecutor.execute(new GetKQReportCmd(temp, user)).get("datas");
|
list = (List<Map<String, String>>) commandExecutor.execute(new GetKQReportCmd(temp, user)).get("datas");
|
||||||
if (isLog) {
|
if (isLog) {
|
||||||
log.info("获取的考勤数据,{}", JSONUtils.toJSONString(list));
|
log.info("salaryAttend获取的考勤数据,{}", JSONUtils.toJSONString(list));
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("salaryAttend获取考勤数据失败", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
//假期余额信息
|
//假期余额信息
|
||||||
List<Map<String, String>> balanceOfLeaveDatas = getBalanceOfLeaveDatas(attend4Salary);
|
List<Map<String, String>> balanceOfLeaveDatas = getBalanceOfLeaveDatas(attend4Salary);
|
||||||
Map<String, Map<String, String>> balanceMap = SalaryEntityUtil.convert2Map(balanceOfLeaveDatas, m -> m.get("id"));
|
Map<String, Map<String, String>> balanceMap = SalaryEntityUtil.convert2Map(balanceOfLeaveDatas, m -> m.get("id"));
|
||||||
|
|
@ -159,7 +163,7 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
list.addAll(balanceOfLeaveList);
|
list.addAll(balanceOfLeaveList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取考勤数据失败", e);
|
log.error("salaryAttend获取假期数据失败", e);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +195,8 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> getBalanceOfLeaveDatas(Attend4Salary attend4Salary) {
|
public List<Map<String, String>> getBalanceOfLeaveDatas(Attend4Salary attend4Salary) {
|
||||||
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
||||||
paramsMap.put("dateScope", "6");
|
paramsMap.put("currentPage", "1");
|
||||||
|
paramsMap.put("pageSize", "500");
|
||||||
paramsMap.put("selectedYear", SalaryDateUtil.date2Year(attend4Salary.getBeginDate()));
|
paramsMap.put("selectedYear", SalaryDateUtil.date2Year(attend4Salary.getBeginDate()));
|
||||||
paramsMap.put("dataScope", "3");
|
paramsMap.put("dataScope", "3");
|
||||||
paramsMap.put("resourceId", attend4Salary.getOnlyEmpIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
paramsMap.put("resourceId", attend4Salary.getOnlyEmpIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||||
|
|
|
||||||
|
|
@ -450,11 +450,11 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
|
||||||
// AttendQuoteDataBO.buildAttendDataFromRemote("day", attendResult.getData(), attendQuoteFields, attendQuoteSyncData);
|
// AttendQuoteDataBO.buildAttendDataFromRemote("day", attendResult.getData(), attendQuoteFields, attendQuoteSyncData);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage()), e);
|
log.error("salaryAttend获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage()), e);
|
||||||
return attendQuoteSyncData;
|
return attendQuoteSyncData;
|
||||||
}
|
}
|
||||||
if (isLog) {
|
if (isLog) {
|
||||||
log.info("同步的考勤数据:{}", JSONUtils.toJSONString(attendQuoteSyncData));
|
log.info("salaryAttend同步的考勤数据:{}", JSONUtils.toJSONString(attendQuoteSyncData));
|
||||||
}
|
}
|
||||||
return attendQuoteSyncData;
|
return attendQuoteSyncData;
|
||||||
}
|
}
|
||||||
|
|
@ -484,7 +484,6 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
|
||||||
dataValueBiz.deleteByAttendQuoteIds(quoteIds);
|
dataValueBiz.deleteByAttendQuoteIds(quoteIds);
|
||||||
// 新增考勤值数据
|
// 新增考勤值数据
|
||||||
if (CollectionUtils.isNotEmpty(values)) {
|
if (CollectionUtils.isNotEmpty(values)) {
|
||||||
log.info("考勤数据:{}", values);
|
|
||||||
//去除空值
|
//去除空值
|
||||||
values = values.stream().filter(po -> StringUtils.isNotBlank(po.getDataValue())).collect(Collectors.toList());
|
values = values.stream().filter(po -> StringUtils.isNotBlank(po.getDataValue())).collect(Collectors.toList());
|
||||||
dataValueBiz.insertData(values);
|
dataValueBiz.insertData(values);
|
||||||
|
|
@ -539,7 +538,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
|
||||||
|
|
||||||
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("下载模板失败", e);
|
log.error("salaryAttend下载模板失败", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -779,15 +779,19 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
||||||
List<SalaryAcctRecordPO> salaryAcctRecordPOS = listByTaxCycle(yearRange, salarySobIds);
|
List<SalaryAcctRecordPO> salaryAcctRecordPOS = listByTaxCycle(yearRange, salarySobIds);
|
||||||
List<SalaryAcctRecordPO> selfSalaryAcctRecordPOS = filterByAuthority(salaryAcctRecordPOS);
|
List<SalaryAcctRecordPO> selfSalaryAcctRecordPOS = filterByAuthority(salaryAcctRecordPOS);
|
||||||
|
|
||||||
// 如果已经存在之后月份的薪资核算记录了,就不允许重新核算本月了
|
// 获取个税申报功能状态
|
||||||
SalaryAcctRecordPO afterSalaryAcctRecordPO = selfSalaryAcctRecordPOS.stream()
|
TaxDeclarationFunctionEnum taxDeclarationFunctionEnum = getSalarySysConfService(user).getTaxDeclaration();
|
||||||
.filter(po -> po.getSalaryMonth().compareTo(salaryAcctRecordPO.getSalaryMonth()) > 0)
|
if (!taxDeclarationFunctionEnum.getValue().equals(TaxDeclarationFunctionEnum.CLOSURE.getValue())) {
|
||||||
.findAny()
|
// 如果已经存在之后月份的薪资核算记录了,就不允许重新核算本月了
|
||||||
.orElse(null);
|
SalaryAcctRecordPO afterSalaryAcctRecordPO = selfSalaryAcctRecordPOS.stream()
|
||||||
if (Objects.nonNull(afterSalaryAcctRecordPO)) {
|
.filter(po -> po.getSalaryMonth().compareTo(salaryAcctRecordPO.getSalaryMonth()) > 0)
|
||||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(105826, "已经存在{0}的薪资核算记录了,不能重新核算{1}的薪资了")
|
.findAny()
|
||||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(afterSalaryAcctRecordPO.getSalaryMonth()).toString())
|
.orElse(null);
|
||||||
.replace("{1}", SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()).toString()));
|
if (Objects.nonNull(afterSalaryAcctRecordPO)) {
|
||||||
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(105826, "已经存在{0}的薪资核算记录了,不能重新核算{1}的薪资了")
|
||||||
|
.replace("{0}", SalaryDateUtil.localDate2YearMonth(afterSalaryAcctRecordPO.getSalaryMonth()).toString())
|
||||||
|
.replace("{1}", SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()).toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isReCalc) {
|
if (!isReCalc) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue