|
|
@@ -51,6 +51,7 @@ public class UasOaService extends AbstractService {
|
|
|
public void saveAlitripList(String agentCode, String startTime, String endTime) {
|
|
|
List<OapiAlitripBtripApplySearchResponse.OpenApplyRs> alitripList = oaSdk.getAllAlitrip(agentCode,startTime,endTime);
|
|
|
if (!CollectionUtils.isEmpty(alitripList)) {
|
|
|
+ logger.info("出差申请单alitripList==" + alitripList.size());
|
|
|
for (OapiAlitripBtripApplySearchResponse.OpenApplyRs openApplyRs:alitripList) {
|
|
|
String inDate = DateUtil.format(openApplyRs.getGmtCreate(),"yyyy-MM-dd HH:mm:ss");
|
|
|
List<OapiAlitripBtripApplySearchResponse.OpenItineraryInfo> itineraryList = openApplyRs.getItineraryList();
|
|
|
@@ -80,27 +81,21 @@ public class UasOaService extends AbstractService {
|
|
|
* 保存离职申请
|
|
|
*/
|
|
|
public void saveEmpLeaveRecords(String agentCode) {
|
|
|
- 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;
|
|
|
- int con = (int) Math.ceil(count / size);
|
|
|
- logger.info("离职申请单con=="+con);
|
|
|
+ int con = (int) Math.ceil((double)count / size);
|
|
|
if (con>0) {
|
|
|
for (int j = 0; j < con; j++) {
|
|
|
int min = j * size, max = (j + 1) * size;
|
|
|
- logger.info("离职申请单min==" + min);
|
|
|
- logger.info("离职申请单max==" + max);
|
|
|
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.size());
|
|
|
for (int i = 0; i < empLeave.size(); i++) {
|
|
|
OapiSmartworkHrmEmployeeListdimissionResponse.EmpDimissionInfoVo empDimissionInfoVo = empLeave.get(i);
|
|
|
String deptName = empDimissionInfoVo.getMainDeptName();
|
|
|
@@ -112,16 +107,15 @@ public class UasOaService extends AbstractService {
|
|
|
}
|
|
|
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 + "'");
|
|
|
+ "select " + id + ",'" + code + "',em_code,em_name,to_date('" + leaves + "','yyyy-MM-dd HH24:mi:ss'),em_name,sysdate,'AUDITED','已审核','" + reasonMemo + "','" + userid + "' from 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 + "'");
|
|
|
+ "select " + id + ",'" + code + "',em_code,em_name,em_name,sysdate,'AUDITED','已审核','" + reasonMemo + "','" + userid + "' from employee where em_ding='" + userid + "'");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -135,27 +129,21 @@ 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;
|
|
|
- int con = (int) Math.ceil(count / size);
|
|
|
- logger.info("请假申请单con=="+con);
|
|
|
+ int con = (int) Math.ceil((double)count / size);
|
|
|
if (con>0) {
|
|
|
for (int i = 0; i < con; i++) {
|
|
|
int min = i * size, max = (i + 1) * size;
|
|
|
- logger.info("请假申请单min==" + min);
|
|
|
- logger.info("请假申请单max==" + max);
|
|
|
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<OapiAttendanceGetleavestatusResponse.LeaveStatusVO> leaveStatusVOS = oaSdk.getAllLeaves(agentCode, strings, startTime, endTime);
|
|
|
- logger.info("请假申请单leaveStatusVOS.size==" + leaveStatusVOS.size());
|
|
|
if (!CollectionUtils.isEmpty(leaveStatusVOS)) {
|
|
|
+ logger.info("请假申请单leaveStatusVOS==" + leaveStatusVOS.size());
|
|
|
for (int j = 0; j < leaveStatusVOS.size(); j++) {
|
|
|
OapiAttendanceGetleavestatusResponse.LeaveStatusVO leaveStatusVO = leaveStatusVOS.get(j);
|
|
|
Long durationPercent = leaveStatusVO.getDurationPercent() / 100;
|
|
|
@@ -166,7 +154,6 @@ 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);
|