|
|
@@ -80,22 +80,47 @@ public class UasOaService extends AbstractService {
|
|
|
* 保存离职申请
|
|
|
*/
|
|
|
public void saveEmpLeaveRecords(String agentCode) {
|
|
|
- List<OapiSmartworkHrmEmployeeListdimissionResponse.EmpDimissionInfoVo> empLeave = oaSdk.getAllEmpLeaveRecords(agentCode);
|
|
|
- if (!CollectionUtils.isEmpty(empLeave)){
|
|
|
- for (int i = 0; i < empLeave.size(); i++) {
|
|
|
- OapiSmartworkHrmEmployeeListdimissionResponse.EmpDimissionInfoVo empDimissionInfoVo = empLeave.get(i);
|
|
|
- String deptName = empDimissionInfoVo.getMainDeptName();
|
|
|
- String reasonMemo = empDimissionInfoVo.getReasonMemo();
|
|
|
- Long lastWorkDay = empDimissionInfoVo.getLastWorkDay();
|
|
|
- String leaves = DateUtil.format(new Date(lastWorkDay), "yyyy-MM-dd HH:mm:ss");
|
|
|
- String userid = empDimissionInfoVo.getUserid();
|
|
|
- int count = queryForObject("select count(1) from Turnover where to_dingtalkid='" + userid + "'",Integer.class);
|
|
|
- int count1 = queryForObject("select count(1) from employee where em_ding='" + userid + "'", Integer.class);
|
|
|
- if (count<=0&&count1>0){
|
|
|
- int id = generateId("TURNOVER_SEQ");
|
|
|
- String code = generateCode("Turnover", 2);
|
|
|
- jdbcTemplate.execute("insert into Turnover (to_id,to_code,to_applymancode,to_applyman,to_leavedate,to_recordor,to_date,to_statuscode,to_status,to_otherreason,to_dingtalkid) " +
|
|
|
- "select " + id + ",'" + code + "',em_code,em_name,to_date('" + leaves + "','yyyy-MM-dd HH24:mi:ss'),em_name,sysdate,'AUDITED','已审核','" + reasonMemo + "','"+userid+"' employee where em_ding='" + userid + "'");
|
|
|
+ logger.info("离职申请单");
|
|
|
+ int count = queryForObject("select count(1) from employee where nvl(em_ding,' ')<>' '",Integer.class);
|
|
|
+ logger.info("离职申请单count=="+count);
|
|
|
+ if (count>0) {
|
|
|
+ int size=50;
|
|
|
+ for (int j = 0; j < count/size; j++) {
|
|
|
+ int min = j * size, max = (j + 1) * size;
|
|
|
+ List<String> strings = new ArrayList<>();
|
|
|
+ SqlRowSet rs = jdbcTemplate.queryForRowSet("select em_ding from (select em_ding,rownum rn from employee where nvl(em_ding,' ')<>' ') where rn>" + min + " and rn<=" + max);
|
|
|
+ while (rs.next()) {
|
|
|
+ strings.add(rs.getString("em_ding"));
|
|
|
+ }
|
|
|
+ logger.info("离职申请单emdings=="+strings.size());
|
|
|
+ List<OapiSmartworkHrmEmployeeListdimissionResponse.EmpDimissionInfoVo> empLeave = oaSdk.getEmpLeave(agentCode,strings);
|
|
|
+ logger.info("离职申请单empLeavesize=="+empLeave.size());
|
|
|
+ if (!CollectionUtils.isEmpty(empLeave)) {
|
|
|
+ logger.info("离职申请单empLeave=="+empLeave.toString());
|
|
|
+ for (int i = 0; i < empLeave.size(); i++) {
|
|
|
+ OapiSmartworkHrmEmployeeListdimissionResponse.EmpDimissionInfoVo empDimissionInfoVo = empLeave.get(i);
|
|
|
+ String deptName = empDimissionInfoVo.getMainDeptName();
|
|
|
+ String reasonMemo = empDimissionInfoVo.getReasonMemo();
|
|
|
+ Long lastWorkDay = empDimissionInfoVo.getLastWorkDay();
|
|
|
+ String leaves=null;
|
|
|
+ if (lastWorkDay>0) {
|
|
|
+ leaves= DateUtil.format(new Date(lastWorkDay), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+ String userid = empDimissionInfoVo.getUserid();
|
|
|
+ int count1 = queryForObject("select count(1) from Turnover where to_dingtalkid='" + userid + "'", Integer.class);
|
|
|
+ logger.info("离职申请单count1=="+count1);
|
|
|
+ if (count1 <= 0) {
|
|
|
+ int id = generateId("TURNOVER_SEQ");
|
|
|
+ String code = generateCode("Turnover", 2);
|
|
|
+ if (leaves!=null) {
|
|
|
+ jdbcTemplate.execute("insert into Turnover (to_id,to_code,to_applymancode,to_applyman,to_leavedate,to_recordor,to_date,to_statuscode,to_status,to_otherreason,to_dingtalkid) " +
|
|
|
+ "select " + id + ",'" + code + "',em_code,em_name,to_date('" + leaves + "','yyyy-MM-dd HH24:mi:ss'),em_name,sysdate,'AUDITED','已审核','" + reasonMemo + "','" + userid + "' employee where em_ding='" + userid + "'");
|
|
|
+ }else {
|
|
|
+ jdbcTemplate.execute("insert into Turnover (to_id,to_code,to_applymancode,to_applyman,to_recordor,to_date,to_statuscode,to_status,to_otherreason,to_dingtalkid) " +
|
|
|
+ "select " + id + ",'" + code + "',em_code,em_name,em_name,sysdate,'AUDITED','已审核','" + reasonMemo + "','" + userid + "' employee where em_ding='" + userid + "'");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -105,18 +130,23 @@ public class UasOaService extends AbstractService {
|
|
|
* 请假申请
|
|
|
*/
|
|
|
public void saveLeaves(String agentCode, long startTime, long endTime){
|
|
|
+ logger.info("请假申请单");
|
|
|
int count = queryForObject("select count(1) from employee where nvl(em_ding,' ')<>' '",Integer.class);
|
|
|
+ logger.info("请假申请单count=="+count);
|
|
|
if (count>0){
|
|
|
int size=100;
|
|
|
for (int i = 0; i < count/size; i++) {
|
|
|
int min=i*size,max=(i+1)*size;
|
|
|
List<String> strings = new ArrayList<>();
|
|
|
- SqlRowSet rs = jdbcTemplate.queryForRowSet("select em_ding from (select em_ding,rownum rn from employee where nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' ') where rn>" + min + " and rn<=" + max);
|
|
|
+ SqlRowSet rs = jdbcTemplate.queryForRowSet("select em_ding from (select em_ding,rownum rn from employee where nvl(em_ding,' ')<>' ') where rn>" + min + " and rn<=" + max);
|
|
|
while (rs.next()){
|
|
|
strings.add(rs.getString("em_ding"));
|
|
|
}
|
|
|
+ logger.info("请假申请单emdings=="+strings.size());
|
|
|
List<OapiAttendanceGetleavestatusResponse.LeaveStatusVO> leaveStatusVOS = oaSdk.getAllLeaves(agentCode, strings, startTime, endTime);
|
|
|
+ logger.info("请假申请单leaveStatusVOS.size=="+leaveStatusVOS.size());
|
|
|
if (!CollectionUtils.isEmpty(leaveStatusVOS)) {
|
|
|
+ logger.info("请假申请单leaveStatusVOS=="+leaveStatusVOS.toString());
|
|
|
for (int j = 0; j < leaveStatusVOS.size(); j++) {
|
|
|
OapiAttendanceGetleavestatusResponse.LeaveStatusVO leaveStatusVO = leaveStatusVOS.get(j);
|
|
|
Long durationPercent = leaveStatusVO.getDurationPercent()/100;
|
|
|
@@ -127,6 +157,7 @@ public class UasOaService extends AbstractService {
|
|
|
String startformat = DateUtil.format(new Date(startDate), "yyyy-MM-dd HH:mm:ss");
|
|
|
String endformat = DateUtil.format(new Date(endDate), "yyyy-MM-dd HH:mm:ss");
|
|
|
int count1 = queryForObject("select count(1) from Vacation where va_dingtalkid='" + userid + "' and to_char(va_startime,'yyyy-MM-dd HH24:mi:ss')='" + startformat + "' and to_char(va_endtime,'yyyy-MM-dd HH24:mi:ss')='" + endformat + "'",Integer.class);
|
|
|
+ logger.info("请假申请单count1=="+count1);
|
|
|
if (count1<=0) {
|
|
|
int id = generateId("VACATION_SEQ");
|
|
|
String code = generateCode("Ask4Leave", 2);
|