|
@@ -5,14 +5,12 @@ import com.dingtalk.api.response.OapiAttendanceGetleavestatusResponse;
|
|
|
import com.dingtalk.api.response.OapiSmartworkHrmEmployeeListdimissionResponse;
|
|
import com.dingtalk.api.response.OapiSmartworkHrmEmployeeListdimissionResponse;
|
|
|
import com.usoftchina.dingtalk.sdk.OaSdk;
|
|
import com.usoftchina.dingtalk.sdk.OaSdk;
|
|
|
import com.usoftchina.uas.office.dingtalk.core.DateUtil;
|
|
import com.usoftchina.uas.office.dingtalk.core.DateUtil;
|
|
|
-import com.usoftchina.uas.office.dingtalk.util.BaseDao;
|
|
|
|
|
-import com.usoftchina.uas.office.dingtalk.util.SqlRowList;
|
|
|
|
|
import com.usoftchina.uas.office.service.AbstractService;
|
|
import com.usoftchina.uas.office.service.AbstractService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.jdbc.support.rowset.SqlRowSet;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -22,11 +20,9 @@ public class UasOaService extends AbstractService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OaSdk oaSdk;
|
|
private OaSdk oaSdk;
|
|
|
- @Autowired
|
|
|
|
|
- private BaseDao baseDao;
|
|
|
|
|
|
|
|
|
|
public void saveOa(String agentCode,int id){
|
|
public void saveOa(String agentCode,int id){
|
|
|
- SqlRowList rs = baseDao.queryForRowSet("select od_id,od_kind,to_char(od_startdate,'yyyy-MM-dd hh24:mi:ss') startdate,to_char(od_enddate,'yyyy-MM-dd hh24:mi:ss') enddate from OaDingTalklog where od_id=" + id);
|
|
|
|
|
|
|
+ SqlRowSet rs = jdbcTemplate.queryForRowSet("select od_id,od_kind,to_char(od_startdate,'yyyy-MM-dd hh24:mi:ss') startdate,to_char(od_enddate,'yyyy-MM-dd hh24:mi:ss') enddate from OaDingTalklog where od_id=" + id);
|
|
|
while (rs.next()){
|
|
while (rs.next()){
|
|
|
String odKind = rs.getString("od_kind");
|
|
String odKind = rs.getString("od_kind");
|
|
|
String startdate = rs.getString("startdate");
|
|
String startdate = rs.getString("startdate");
|
|
@@ -61,11 +57,11 @@ public class UasOaService extends AbstractService {
|
|
|
String projectTitle = openItineraryInfo.getProjectTitle();
|
|
String projectTitle = openItineraryInfo.getProjectTitle();
|
|
|
String projectCode = openItineraryInfo.getProjectCode();
|
|
String projectCode = openItineraryInfo.getProjectCode();
|
|
|
String statusDesc = openApplyRs.getStatusDesc()==null?"":openApplyRs.getStatusDesc();
|
|
String statusDesc = openApplyRs.getStatusDesc()==null?"":openApplyRs.getStatusDesc();
|
|
|
- int count = baseDao.getCountByCondition("FeePlease", "dp_ddid=" + rsId);
|
|
|
|
|
|
|
+ Integer count =queryForObject("select count(1) from FeePlease where dp_ddid=" + rsId, Integer.class);
|
|
|
if (count<=0&&"已同意".equals(statusDesc)) {
|
|
if (count<=0&&"已同意".equals(statusDesc)) {
|
|
|
- int id = baseDao.getSeqId("FEEPLEASE_SEQ");
|
|
|
|
|
- String code = baseDao.callProcedure("Sp_GetMaxNumber", new Object[]{"FeePlease!CCSQ!new", 2});
|
|
|
|
|
- baseDao.execute("insert into FeePlease (fp_id,fp_code,fp_kind,fp_v9,FP_PEOPLE2,fp_recordman,fp_recorddate,fp_statuscode,fp_status,fp_v3,fp_prestartdate,fp_preenddate,fp_n6,dp_ddid,fp_remark,fp_prjcode,fp_prjname) " +
|
|
|
|
|
|
|
+ int id = generateId("FEEPLEASE_SEQ");
|
|
|
|
|
+ String code = generateCode("FeePlease!CCSQ!new", 2);
|
|
|
|
|
+ jdbcTemplate.execute("insert into FeePlease (fp_id,fp_code,fp_kind,fp_v9,FP_PEOPLE2,fp_recordman,fp_recorddate,fp_statuscode,fp_status,fp_v3,fp_prestartdate,fp_preenddate,fp_n6,dp_ddid,fp_remark,fp_prjcode,fp_prjname) " +
|
|
|
"values (" + id + ",'" + code + "','出差申请单','" + openApplyRs.getDeptName() + "','" + openApplyRs.getUserName() + "','" + openApplyRs.getUserName() + "',to_date('" + inDate + "','yyyy-MM-dd HH24:mi:ss'),'AUDITED','已审核','" + openApplyRs.getTripCause() + "',to_date('" + startDate + "','yyyy-MM-dd HH24:mi:ss'),to_date('" + endDate + "','yyyy-MM-dd HH24:mi:ss')," + openApplyRs.getTripDay() + ","+rsId+",'"+statusDesc+"','"+projectCode+"','"+projectTitle+"')");
|
|
"values (" + id + ",'" + code + "','出差申请单','" + openApplyRs.getDeptName() + "','" + openApplyRs.getUserName() + "','" + openApplyRs.getUserName() + "',to_date('" + inDate + "','yyyy-MM-dd HH24:mi:ss'),'AUDITED','已审核','" + openApplyRs.getTripCause() + "',to_date('" + startDate + "','yyyy-MM-dd HH24:mi:ss'),to_date('" + endDate + "','yyyy-MM-dd HH24:mi:ss')," + openApplyRs.getTripDay() + ","+rsId+",'"+statusDesc+"','"+projectCode+"','"+projectTitle+"')");
|
|
|
/*jdbcTemplate.execute("insert into FeePleaseDetail(fpd_id,fpd_fpid,fpd_code,fpd_class,fpd_detno,fpd_d5,fpd_d6,fpd_date1,fpd_date2) " +
|
|
/*jdbcTemplate.execute("insert into FeePleaseDetail(fpd_id,fpd_fpid,fpd_code,fpd_class,fpd_detno,fpd_d5,fpd_d6,fpd_date1,fpd_date2) " +
|
|
|
"values(FeePleaseDetail_seq.nextval,"+id+",'"+code+"','出差申请单',1,'"+projectCode+"','"+projectTitle+"',to_date('" + startDate + "','yyyy-MM-dd HH24:mi:ss'),to_date('" + endDate + "','yyyy-MM-dd HH24:mi:ss'))");*/
|
|
"values(FeePleaseDetail_seq.nextval,"+id+",'"+code+"','出差申请单',1,'"+projectCode+"','"+projectTitle+"',to_date('" + startDate + "','yyyy-MM-dd HH24:mi:ss'),to_date('" + endDate + "','yyyy-MM-dd HH24:mi:ss'))");*/
|
|
@@ -87,12 +83,12 @@ public class UasOaService extends AbstractService {
|
|
|
Long lastWorkDay = empDimissionInfoVo.getLastWorkDay();
|
|
Long lastWorkDay = empDimissionInfoVo.getLastWorkDay();
|
|
|
String leaves = DateUtil.format(new Date(lastWorkDay), "yyyy-MM-dd HH:mm:ss");
|
|
String leaves = DateUtil.format(new Date(lastWorkDay), "yyyy-MM-dd HH:mm:ss");
|
|
|
String userid = empDimissionInfoVo.getUserid();
|
|
String userid = empDimissionInfoVo.getUserid();
|
|
|
- int count = baseDao.getCountByCondition("Turnover", "to_dingtalkid='" + userid + "'");
|
|
|
|
|
- int count1 = baseDao.getCountByCondition("employee", "em_ding='" + userid + "'");
|
|
|
|
|
|
|
+ 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){
|
|
if (count<=0&&count1>0){
|
|
|
- int id = baseDao.getSeqId("TURNOVER_SEQ");
|
|
|
|
|
- String code = baseDao.callProcedure("Sp_GetMaxNumber", new Object[]{"Turnover", 2});
|
|
|
|
|
- baseDao.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) " +
|
|
|
|
|
|
|
+ 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 + "'");
|
|
"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 + "'");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -103,15 +99,15 @@ public class UasOaService extends AbstractService {
|
|
|
* 请假申请
|
|
* 请假申请
|
|
|
*/
|
|
*/
|
|
|
public void saveLeaves(String agentCode, long startTime, long endTime){
|
|
public void saveLeaves(String agentCode, long startTime, long endTime){
|
|
|
- int count = baseDao.getCountByCondition("employee", "nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' '");
|
|
|
|
|
|
|
+ int count = queryForObject("select count(1) from employee where nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' '",Integer.class);
|
|
|
if (count>0){
|
|
if (count>0){
|
|
|
int size=100;
|
|
int size=100;
|
|
|
for (int i = 0; i < count/size; i++) {
|
|
for (int i = 0; i < count/size; i++) {
|
|
|
int min=i*size,max=(i+1)*size;
|
|
int min=i*size,max=(i+1)*size;
|
|
|
List<String> strings = new ArrayList<>();
|
|
List<String> strings = new ArrayList<>();
|
|
|
- SqlRowList rs = baseDao.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_class,' ')<>'离职' and nvl(em_ding,' ')<>' ') where rn>" + min + " and rn<=" + max);
|
|
|
while (rs.next()){
|
|
while (rs.next()){
|
|
|
- strings.add(rs.getGeneralString("em_ding"));
|
|
|
|
|
|
|
+ strings.add(rs.getString("em_ding"));
|
|
|
}
|
|
}
|
|
|
List<OapiAttendanceGetleavestatusResponse.LeaveStatusVO> leaveStatusVOS = oaSdk.getAllLeaves(agentCode, strings, startTime, endTime);
|
|
List<OapiAttendanceGetleavestatusResponse.LeaveStatusVO> leaveStatusVOS = oaSdk.getAllLeaves(agentCode, strings, startTime, endTime);
|
|
|
if (!CollectionUtils.isEmpty(leaveStatusVOS)) {
|
|
if (!CollectionUtils.isEmpty(leaveStatusVOS)) {
|
|
@@ -124,11 +120,11 @@ public class UasOaService extends AbstractService {
|
|
|
String userid = leaveStatusVO.getUserid();
|
|
String userid = leaveStatusVO.getUserid();
|
|
|
String startformat = DateUtil.format(new Date(startDate), "yyyy-MM-dd HH:mm:ss");
|
|
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");
|
|
String endformat = DateUtil.format(new Date(endDate), "yyyy-MM-dd HH:mm:ss");
|
|
|
- int count1 = baseDao.getCountByCondition("Vacation", "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 + "'");
|
|
|
|
|
|
|
+ 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);
|
|
|
if (count1<=0) {
|
|
if (count1<=0) {
|
|
|
- int id = baseDao.getSeqId("VACATION_SEQ");
|
|
|
|
|
- String code = baseDao.callProcedure("Sp_GetMaxNumber", new Object[]{"Ask4Leave", 2});
|
|
|
|
|
- baseDao.execute("insert into Vacation (va_id,va_code,va_statuscode,va_status,va_emcode,va_emname,va_date,va_department,va_position,va_recordor,va_recordorid,va_days,va_alltimes,va_startime,va_endtime,va_remark,va_dingtalkid) " +
|
|
|
|
|
|
|
+ int id = generateId("VACATION_SEQ");
|
|
|
|
|
+ String code = generateCode("Ask4Leave", 2);
|
|
|
|
|
+ jdbcTemplate.execute("insert into Vacation (va_id,va_code,va_statuscode,va_status,va_emcode,va_emname,va_date,va_department,va_position,va_recordor,va_recordorid,va_days,va_alltimes,va_startime,va_endtime,va_remark,va_dingtalkid) " +
|
|
|
"select " + id + ",'" + code + "','AUDITED','已审核',em_code,em_name,sysdate,em_depart,em_position,em_name,em_id,case when '" + durationUnit + "'='percent_day' then " + durationPercent + " else 0 end,case when '" + durationUnit + "'='percent_hour' then " + durationPercent + " else 0 end,to_date('" + startformat + "','yyyy-MM-dd hh24:mi:ss'),to_date('" + endformat + "','yyyy-MM-dd hh24:mi:ss'),'钉钉同步','" + userid + "' from employee where em_ding='" + userid + "'");
|
|
"select " + id + ",'" + code + "','AUDITED','已审核',em_code,em_name,sysdate,em_depart,em_position,em_name,em_id,case when '" + durationUnit + "'='percent_day' then " + durationPercent + " else 0 end,case when '" + durationUnit + "'='percent_hour' then " + durationPercent + " else 0 end,to_date('" + startformat + "','yyyy-MM-dd hh24:mi:ss'),to_date('" + endformat + "','yyyy-MM-dd hh24:mi:ss'),'钉钉同步','" + userid + "' from employee where em_ding='" + userid + "'");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|