新创元
parent
ac914f59d2
commit
980fd933bd
@ -0,0 +1,7 @@
|
||||
package com.api.xcy.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/xcy/kq")
|
||||
public class KQXCYAction extends com.engine.xcy.web.KQXCYAction {
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.engine.xcy.cmd;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQGroupMemberComInfo;
|
||||
import com.engine.kq.biz.KQOvertimeRulesBiz;
|
||||
import com.engine.kq.biz.KQWorkTime;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.enums.DurationTypeEnum;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class GetOverTimeWorkDurationXcyCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetOverTimeWorkDurationXcyCmd(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 resourceId = Util.null2String(params.get("resourceId"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String fromTime = Util.null2String(params.get("fromTime"));
|
||||
String toTime = Util.null2String(params.get("toTime"));
|
||||
String overtime_type = Util.null2String(params.get("overtime_type"));
|
||||
String timestamp = Util.null2String(params.get("timestamp"));
|
||||
|
||||
int minimumUnit = KQOvertimeRulesBiz.getMinimumUnit();
|
||||
//
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity kqWorkTimeEntity = kqWorkTime.getWorkTime(resourceId,fromDate);
|
||||
if(kqWorkTimeEntity != null){
|
||||
String kqType = Util.null2String(kqWorkTimeEntity.getKQType());
|
||||
if("3".equalsIgnoreCase(kqType)){
|
||||
writeLog("自由班制不计算加班");
|
||||
retmap.put("status", "1");
|
||||
retmap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005330,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
return retmap;
|
||||
}
|
||||
}
|
||||
ResourceComInfo rci = new ResourceComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupid = kqGroupMemberComInfo.getKQGroupId(resourceId,fromDate);
|
||||
if(resourceId.length() > 0 && groupid.length() == 0){
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", rci.getLastname(resourceId)+","+fromDate+""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005329,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
//加班默认是工作日加班
|
||||
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceId).
|
||||
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).computingModeParam("1").
|
||||
durationRuleParam(minimumUnit+"").durationTypeEnumParam(DurationTypeEnum.OVERTIME).
|
||||
overtime_typeParam(overtime_type).build();
|
||||
|
||||
Map<String,Object> durationMap = kqDurationCalculatorUtil.getWorkDuration();
|
||||
|
||||
retmap.put("duration", Util.null2String(durationMap.get("min_duration")));
|
||||
retmap.put("timestamp", timestamp);
|
||||
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,16 @@
|
||||
package com.engine.xcy.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.xcy.cmd.GetOverTimeWorkDurationXcyCmd;
|
||||
import com.engine.xcy.service.KQXCYService;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class KQXCYServiceImpl extends Service implements KQXCYService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getOverTimeDuration(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new GetOverTimeWorkDurationXcyCmd(params, user));
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.engine.xcy.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.xcy.service.KQXCYService;
|
||||
import com.engine.xcy.service.impl.KQXCYServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class KQXCYAction {
|
||||
|
||||
private final BaseBean logger = new BaseBean();
|
||||
|
||||
private KQXCYService getService(User user) {
|
||||
return (KQXCYServiceImpl) ServiceUtil.getService(KQXCYServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加班的工作时长
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getOverTimeDurationXcy")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getOverTimeDuration(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser (request , response) ;
|
||||
// 调用新创元处理逻辑
|
||||
apidatas = getService(user).getOverTimeDuration(ParamUtil.request2Map(request), user);
|
||||
} catch (Exception e) {
|
||||
apidatas.put("status", "-1");
|
||||
logger.writeLog(e);
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue