Initial commit
commit
ba015b7012
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
@ -0,0 +1,33 @@
|
||||
<%@ page import="java.util.Set" %>
|
||||
<%@ page import="java.util.HashSet" %>
|
||||
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
|
||||
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
|
||||
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="org.apache.tika.utils.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
<%
|
||||
out.println("start");
|
||||
|
||||
RecordSet rs =new RecordSet();
|
||||
BaseBean basebean = new BaseBean();
|
||||
String overtimeTableName = basebean.getPropValue("omlKq_main","overtimeTableName");
|
||||
out.println("overtimeTableName: "+overtimeTableName);
|
||||
|
||||
Integer number = -1;
|
||||
|
||||
String checkOverTimeSql = "select count(*) as number from " + overtimeTableName + " where jbry = ? and sqyf = ? ";
|
||||
out.println("checkOverTimeSql: " + checkOverTimeSql);
|
||||
|
||||
rs.executeQuery(checkOverTimeSql, 45, "2023-08");
|
||||
while ( rs.next()) {
|
||||
number = Util.getIntValue( Util.null2String( rs.getString("number")));
|
||||
}
|
||||
out.println("number: " + number );
|
||||
|
||||
%>
|
@ -0,0 +1,32 @@
|
||||
<%@ page import="java.util.Set" %>
|
||||
<%@ page import="java.util.HashSet" %>
|
||||
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
|
||||
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
|
||||
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
<%
|
||||
out.println("start");
|
||||
|
||||
MessageType messageType = MessageType.newInstance(572); // 消息来源(见文档第四点补充 必填)
|
||||
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
|
||||
userIdList.add("71");
|
||||
String title = "测试"; // 标题
|
||||
String context = "测试呢"; // 内容
|
||||
String linkUrl = ""; // PC端链接
|
||||
String linkMobileUrl = ""; // 移动端链接
|
||||
try {
|
||||
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
|
||||
messageBean.setCreater(1);// 创建人id
|
||||
// message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
|
||||
//messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
|
||||
out.println("messageBean:"+ JSONObject.toJSONString(messageBean));
|
||||
|
||||
Util_Message.store(messageBean);
|
||||
} catch (IOException e) {
|
||||
out.println("--------e----------"+e);
|
||||
}
|
||||
|
||||
%>
|
@ -0,0 +1,13 @@
|
||||
<%@ page import="java.util.Set" %>
|
||||
<%@ page import="java.util.HashSet" %>
|
||||
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
|
||||
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
|
||||
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
<%
|
||||
out.println("start");
|
||||
|
||||
%>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
|
||||
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
|
||||
<%@ page import="com.engine.kq.entity.TimeScopeEntity" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
<%
|
||||
out.println("-----------start-------------");
|
||||
|
||||
String resourceid = "138";
|
||||
String belongDate = "2023-09-13";
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceid, belongDate);
|
||||
out.println("----------------getWorkTime end-----------");
|
||||
|
||||
List<TimeScopeEntity> workTime1 = workTime.getWorkTime();
|
||||
out.println("----------workTime1: "+ JSONObject.toJSONString(workTime1));
|
||||
|
||||
int workMins = workTime.getWorkMins();
|
||||
out.println("-------------workMins: "+ JSONObject.toJSONString(workMins));
|
||||
|
||||
%>
|
@ -0,0 +1,74 @@
|
||||
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
|
||||
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
|
||||
<%@ page import="com.engine.kq.entity.TimeScopeEntity" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.engine.workflow.cmd.publicApi.reqOperate.DoCreateRequestCmd" %>
|
||||
<%@ page import="com.engine.workflow.entity.publicApi.ReqOperateRequestEntity" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="weaver.workflow.webservices.WorkflowRequestTableField" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="com.wbi.util.StringUtil" %>
|
||||
<%@ page import="weaver.workflow.webservices.WorkflowRequestInfo" %>
|
||||
<%@ page import="cn.hutool.core.date.DateUtil" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="weaver.workflow.webservices.WorkflowBaseInfo" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
<%
|
||||
out.println("-----------start-------------");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
User user = new User();
|
||||
user.setUid(175);
|
||||
|
||||
String workflowId = "15";
|
||||
|
||||
String workflowName = "授乳假";
|
||||
|
||||
String tableName = "";
|
||||
|
||||
//获取拟稿人中文姓名
|
||||
String lastName = "";
|
||||
String acqLastNameSql = "select lastname from hrmresource where id = ?";
|
||||
rs.executeQuery(acqLastNameSql,user.getUID());
|
||||
while (rs.next()) {
|
||||
lastName = Util.null2String(rs.getString("lastname"));
|
||||
}
|
||||
|
||||
if ( StringUtil.isBlank(lastName)) {
|
||||
lastName = "未知人员";
|
||||
}
|
||||
|
||||
//工作流程请求信息
|
||||
WorkflowRequestInfo workflowRequestInfo = new WorkflowRequestInfo();
|
||||
//请求标题
|
||||
workflowRequestInfo.setRequestName(workflowName + "-" + lastName + "-" + DateUtil.format(new Date(),"yyyy-MM-dd"));
|
||||
//请求重要级别
|
||||
workflowRequestInfo.setRequestLevel("1");
|
||||
//显示
|
||||
workflowRequestInfo.setCanView(true);
|
||||
//创建者id
|
||||
workflowRequestInfo.setCreatorId(Util.null2String(user.getUID()));
|
||||
//工作流信息
|
||||
WorkflowBaseInfo workflowBaseInfo = new WorkflowBaseInfo();
|
||||
workflowBaseInfo.setWorkflowId(workflowId);
|
||||
workflowRequestInfo.setWorkflowBaseInfo(workflowBaseInfo);
|
||||
//主表赋值
|
||||
WorkflowRequestTableField[] workflowRequestTableField = new WorkflowRequestTableField[5];
|
||||
|
||||
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
private WorkflowRequestTableField createWorkflowRequestTableField(String fieldName, String fieldValue) {
|
||||
WorkflowRequestTableField tableField = new WorkflowRequestTableField();
|
||||
tableField.setFieldName(fieldName);
|
||||
tableField.setFieldValue(fieldValue);
|
||||
tableField.setView(true);
|
||||
tableField.setEdit(true);
|
||||
return tableField;
|
||||
}
|
||||
%>
|
@ -0,0 +1,7 @@
|
||||
package com.api.omron.controller;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/omron/OverTimeWorkflow")
|
||||
public class OverTimeController extends com.engine.omron.controller.OverTimeController {
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,585 @@
|
||||
package com.engine.kq.cmd.report;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String,Object> retmap = new HashMap<String,Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
String pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
String backFields = " a.id,a.lastname,b.subcompanyid, b.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and b.subcompanyid in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and b.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and b.resourceid in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,277 @@
|
||||
package com.engine.kq.cmd.reportdetial;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_TableMap;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQReportBiz;
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.enums.ReportColumnEnum;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 应出勤明细
|
||||
*/
|
||||
public class GetSignInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetSignInfoCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
String dialogTitle = SystemEnv.getHtmlLabelName(391409,user.getLanguage());
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
String keyWord = Util.null2String(params.get("keyWord"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String typeselect =Util.null2String(params.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
String viewScope = Util.null2String(params.get("viewScope"));
|
||||
String subCompanyId = Util.null2String(params.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(params.get("departmentId"));
|
||||
String allLevel = Util.null2String(params.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(params.get("isNoAccount"));
|
||||
String type = Util.null2String(params.get("type"));
|
||||
|
||||
// String backFields = " a.id, b.resourceid,a.departmentid, a.lastname, a.workcode, a.status, a.dsporder, kqdate, serialid,serialid as serialid1, serialid as serialid2," +
|
||||
// " workbegintime,workendtime,signintime,signouttime, attendanceMins, signMins ";
|
||||
// String sqlFrom = "from hrmresource a, kq_format_detail b ";
|
||||
// String sqlWhere = " where a.id = b.resourceid and (attendanceMins>0 or signMins>0)";
|
||||
// String orderby = " kqdate asc, workbegintime asc " ;
|
||||
// String tableString = "";
|
||||
//
|
||||
// String rightSql = new KQReportBiz().getReportRight("1",""+user.getUID(),"a");
|
||||
// if(rightSql.length()>0){
|
||||
// sqlWhere += rightSql;
|
||||
// }
|
||||
//
|
||||
// if (keyWord.length() > 0){
|
||||
// sqlWhere += " and lastname = "+keyWord;
|
||||
// }
|
||||
//
|
||||
// if (fromDate.length() > 0){
|
||||
// sqlWhere += " and kqdate >= '"+fromDate+"'";
|
||||
// }
|
||||
//
|
||||
// if (toDate.length() > 0){
|
||||
// sqlWhere += " and kqdate <= '"+toDate+"'";
|
||||
// }
|
||||
//
|
||||
// if(subCompanyId.length()>0){
|
||||
// sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
// }
|
||||
//
|
||||
// if(departmentId.length()>0){
|
||||
// sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
// }
|
||||
//
|
||||
// if (resourceId.length() > 0){
|
||||
// sqlWhere += " and b.resourceid in ( "+resourceId+")";
|
||||
// }
|
||||
//
|
||||
// if(viewScope.equals("4")){//我的下属
|
||||
// if(allLevel.equals("1")){//所有下属
|
||||
// sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
// }else{
|
||||
// sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
// }
|
||||
// }
|
||||
// if (!"1".equals(isNoAccount)) {
|
||||
// sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
// }
|
||||
//
|
||||
// if (type.equals("signdays")||type.equals("signmins")) {
|
||||
// sqlWhere += " and signmins >0 ";
|
||||
// }
|
||||
|
||||
//加班明细放入出勤明细 start
|
||||
String backFields = " u.id, u.resourceid,u.departmentid, u.lastname, u.workcode, u.status, u.dsporder, u.kqdate, u.serialid,u.serialid as serialid1, u.serialid as serialid2," +
|
||||
" u.workbegintime, u.workendtime, u.signintime, u.signouttime, u.attendanceMins, u.signMins ";
|
||||
String sqlFrom = "FROM " +
|
||||
" ( " +
|
||||
" ( " +
|
||||
" SELECT " +
|
||||
" a.subcompanyid1, " +
|
||||
" a.managerstr, " +
|
||||
" a.managerid, " +
|
||||
" a.loginid, " +
|
||||
" a.id, " +
|
||||
" b.resourceid, " +
|
||||
" a.departmentid, " +
|
||||
" a.lastname, " +
|
||||
" a.workcode, " +
|
||||
" a.status, " +
|
||||
" a.dsporder, " +
|
||||
" kqdate, " +
|
||||
" serialid, " +
|
||||
" serialid AS serialid1, " +
|
||||
" serialid AS serialid2, " +
|
||||
" workbegintime, " +
|
||||
" workendtime, " +
|
||||
" signintime, " +
|
||||
" signouttime, " +
|
||||
" attendanceMins, " +
|
||||
" signMins " +
|
||||
" FROM " +
|
||||
" hrmresource a, " +
|
||||
" kq_format_detail b " +
|
||||
" WHERE " +
|
||||
" a.id = b.resourceid " +
|
||||
" AND ( attendanceMins > 0 OR signMins > 0 ) " +
|
||||
" ) UNION ALL " +
|
||||
" ( " +
|
||||
" SELECT " +
|
||||
" a.subcompanyid1, " +
|
||||
" a.managerstr, " +
|
||||
" a.managerid, " +
|
||||
" a.loginid, " +
|
||||
" a.id, " +
|
||||
" cast(b.resourceid as int) as resourceid, " +
|
||||
" a.departmentid, " +
|
||||
" a.lastname, " +
|
||||
" a.workcode, " +
|
||||
" a.status, " +
|
||||
" a.dsporder, " +
|
||||
" b.belongdate AS kqdate, " +
|
||||
" null AS serialid, " +
|
||||
" null AS serialid1, " +
|
||||
" null AS serialid2, " +
|
||||
" b.fromtime AS workbegintime, " +
|
||||
" b.totime AS workendtime, " +
|
||||
" b.fromtime AS signintime, " +
|
||||
" b.totime AS signouttime, " +
|
||||
" cast ( cast (duration_min as float ) as int ) AS attendanceMins, " +
|
||||
" cast ( cast (duration_min as float ) as int ) AS signMins " +
|
||||
" FROM " +
|
||||
" hrmresource a, " +
|
||||
" kq_flow_overtime b " +
|
||||
" WHERE " +
|
||||
" a.id = b.resourceid " +
|
||||
" and b.changetype in (1,3) " +
|
||||
" and cast ( cast ( duration_min as float ) as int ) > 0 " +
|
||||
" ) " +
|
||||
" ) u";
|
||||
String sqlWhere = " where 1=1 ";
|
||||
String orderby = " u.kqdate asc, u.workbegintime asc " ;
|
||||
String tableString = "";
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1",""+user.getUID(),"a");
|
||||
if(rightSql.length()>0){
|
||||
sqlWhere += rightSql;
|
||||
}
|
||||
|
||||
if (keyWord.length() > 0){
|
||||
sqlWhere += " and u.lastname = "+keyWord;
|
||||
}
|
||||
|
||||
if (fromDate.length() > 0){
|
||||
sqlWhere += " and u.kqdate >= '"+fromDate+"'";
|
||||
}
|
||||
|
||||
if (toDate.length() > 0){
|
||||
sqlWhere += " and u.kqdate <= '"+toDate+"'";
|
||||
}
|
||||
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and u.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and u.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if (resourceId.length() > 0){
|
||||
sqlWhere += " and u.resourceid in ( "+resourceId+")";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and u.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and u.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and u.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and u.loginid<>'' ");
|
||||
}
|
||||
|
||||
if (type.equals("signdays")||type.equals("signmins")) {
|
||||
sqlWhere += " and u.signmins >0 ";
|
||||
}
|
||||
|
||||
BaseBean basebean = new BaseBean();
|
||||
basebean.writeLog("backFields: "+backFields);
|
||||
basebean.writeLog("sqlFrom: "+sqlFrom);
|
||||
basebean.writeLog("orderby: "+orderby);
|
||||
basebean.writeLog("sqlWhere: "+sqlWhere);
|
||||
//end
|
||||
|
||||
|
||||
String pageUid = PageUidFactory.getHrmPageUid("KQReportDetialList");
|
||||
|
||||
tableString=""+
|
||||
"<table pageUid=\""+pageUid+"\" pagesize=\"10\" tabletype=\"none\">"+
|
||||
"<sql backfields=\""+backFields+"\" sqlform=\""+Util.toHtmlForSplitPage(sqlFrom)+"\" sqlprimarykey=\"u.id\" sqlorderby=\""+orderby+"\" sqlsortway=\"asc\" sqldistinct=\"true\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\"/>"+
|
||||
"<head>"+
|
||||
" <col width=\"8%\" text=\""+SystemEnv.getHtmlLabelName(413,user.getLanguage())+"\" column=\"lastname\" orderkey=\"lastname\"/>"+
|
||||
" <col width=\"8%\" text=\""+SystemEnv.getHtmlLabelName(714,user.getLanguage())+"\" column=\"workcode\" orderkey=\"workcode\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(124,user.getLanguage())+"\" column=\"departmentid\" orderkey=\"departmentid\" transmethod=\"weaver.hrm.company.DepartmentComInfo.getDepartmentname\"/>"+
|
||||
" <col width=\"9%\" text=\""+SystemEnv.getHtmlLabelName(602,user.getLanguage())+"\" column=\"status\" orderkey=\"status\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getStatusName\" otherpara=\""+user.getLanguage()+"\"/>"+
|
||||
" <col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(97,user.getLanguage())+"\" column=\"kqdate\" orderkey=\"kqdate\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(390054,user.getLanguage())+"\" column=\"serialid\" orderkey=\"serialid\" transmethod=\"com.engine.kq.util.TransMethod.getSerailName\" otherpara=\"column:workbegintime+column:workendtime\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(390495,user.getLanguage())+"\" column=\"serialid1\" orderkey=\"signintime\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialSignInTime\" otherpara=\"column:signintime+column:kqdate+column:resourceid+"+user.getLanguage()+"\"/>"+
|
||||
" <col width=\"15%\" text=\""+SystemEnv.getHtmlLabelName(390496,user.getLanguage())+"\" column=\"serialid2\" orderkey=\"signouttime\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialSignOutTime\" otherpara=\"column:signouttime+column:kqdate+column:resourceid+"+user.getLanguage()+"\"/>"+
|
||||
" <col width=\"9%\" text=\""+SystemEnv.getHtmlLabelName(391040,user.getLanguage())+"\" column=\"attendanceMins\" orderkey=\"attendanceMins\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialMinToHour\" />"+
|
||||
" <col width=\"9%\" text=\""+SystemEnv.getHtmlLabelName(504433,user.getLanguage())+"\" column=\"signMins\" orderkey=\"signMins\" transmethod=\"com.engine.kq.util.TransMethod.getReportDetialMinToHour\" />"+
|
||||
"</head>"+
|
||||
"</table>";
|
||||
|
||||
//主要用于 显示定制列以及 表格 每页展示记录数选择
|
||||
String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
|
||||
Util_TableMap.setVal(sessionkey, tableString);
|
||||
|
||||
retmap.put("dialogTitle",dialogTitle);
|
||||
retmap.put("sessionkey", sessionkey);
|
||||
retmap.put("status", "1");
|
||||
}catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.engine.omron.controller;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.omron.service.OverTimeService;
|
||||
import com.engine.omron.service.impl.OverTimeServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
public class OverTimeController {
|
||||
|
||||
public OverTimeService getOverTimeService(User user) {
|
||||
return ServiceUtil.getService(OverTimeServiceImpl.class,user);
|
||||
}
|
||||
|
||||
@Path("/checkOverTimeWorkflow")
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String checkOverTimeWorkflow(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
User user = HrmUserVarify.getUser(request,response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
Map<String, Object> apiDatas = getOverTimeService(user).checkOverTimeWorkflow(params);
|
||||
return new Gson().toJson(apiDatas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.engine.omron.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface OverTimeService {
|
||||
/**
|
||||
* 检查加班申请流程是否重复提交
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> checkOverTimeWorkflow(Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package com.engine.omron.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.omron.service.OverTimeService;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class OverTimeServiceImpl extends Service implements OverTimeService {
|
||||
|
||||
BaseBean basebean = new BaseBean();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> checkOverTimeWorkflow(Map<String, Object> params) {
|
||||
basebean.writeLog("----------OverTimeServiceImpl checkOverTimeWorkflow Start----------");
|
||||
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
try {
|
||||
//申请人
|
||||
Integer applicant = Util.getIntValue(Util.null2String(params.get("applicant")));
|
||||
basebean.writeLog("applicant: " + applicant );
|
||||
|
||||
//申请月份
|
||||
String appMonth = Util.null2String(params.get("applicationMonth"));
|
||||
basebean.writeLog("appMonth: " + appMonth );
|
||||
|
||||
Integer requestId = Util.getIntValue(Util.null2String(params.get("requestId")));
|
||||
basebean.writeLog("requestId: " + requestId );
|
||||
|
||||
if ( applicant == -1 || applicant == 0 ) {
|
||||
result.put("code",500);
|
||||
result.put("msg","申请人不正确,请更换申请人!");
|
||||
return result;
|
||||
}
|
||||
|
||||
if ( applicant == 1 ) {
|
||||
result.put("code",500);
|
||||
result.put("msg","申请人为系统管理员,请确认是否需要更换申请人!");
|
||||
return result;
|
||||
}
|
||||
|
||||
if ( StringUtil.isEmpty(appMonth)) {
|
||||
result.put("code",500);
|
||||
result.put("msg","申请月份未填写,请先填写申请月份!");
|
||||
return result;
|
||||
}
|
||||
|
||||
String overtimeTableName = basebean.getPropValue("omlKq_main","overtimeTableName");
|
||||
basebean.writeLog("overtimeTableName: " + overtimeTableName );
|
||||
|
||||
if ( StringUtil.isEmpty( overtimeTableName)) {
|
||||
result.put("code",500);
|
||||
result.put("msg","请先配置加班申请表名至配置文件!");
|
||||
return result;
|
||||
}
|
||||
|
||||
Integer number = -1;
|
||||
|
||||
String checkOverTimeSql = "select count(*) as num from " + overtimeTableName + " where jbry = ? and sqyf = ? ";
|
||||
basebean.writeLog("checkOverTimeSql: " + checkOverTimeSql);
|
||||
|
||||
rs.executeQuery(checkOverTimeSql, applicant, appMonth);
|
||||
while ( rs.next()) {
|
||||
number = Util.getIntValue( Util.null2String( rs.getString("num")));
|
||||
}
|
||||
basebean.writeLog("number: " + number );
|
||||
|
||||
if ( number == 1 ) {//验证当前流程与已有流程是否为同一条
|
||||
if ( requestId > -1) {
|
||||
Integer checkReq = -1;
|
||||
String checkRequestIdSql = "select requestid from " + overtimeTableName + " where jbry = ? and sqyf = ? ";
|
||||
rs.executeQuery(checkRequestIdSql, applicant, appMonth);
|
||||
while (rs.next()) {
|
||||
checkReq = Util.getIntValue(Util.null2String(rs.getString("requestid")));
|
||||
}
|
||||
if ( checkReq > -1 && checkReq.equals(requestId) ) {//当前提交流程和流程表中的保存状态流程为同一条
|
||||
result.put("code",200);
|
||||
result.put("msg","可以提交该月份的加班申请。");
|
||||
return result;
|
||||
}
|
||||
} else {//流程为新建
|
||||
result.put("code",500);
|
||||
result.put("msg","该人员已经创建或者提交过该月份的加班申请,不可再提交!");
|
||||
return result;
|
||||
}
|
||||
|
||||
} else if ( number > 1 ) {
|
||||
result.put("code",500);
|
||||
result.put("msg","该人员已经提交过该月份的加班申请,不可再提交!");
|
||||
return result;
|
||||
}
|
||||
|
||||
result.put("code",200);
|
||||
result.put("msg","可以提交该月份的加班申请。");
|
||||
return result;
|
||||
}catch(Exception e){
|
||||
basebean.writeLog("OverTimeServiceImpl checkOverTimeWorkflow Exception: " + e);
|
||||
result.put("code",500);
|
||||
result.put("msg","检查异常");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
</web-app>
|
Loading…
Reference in New Issue