瀏覽代碼

瑞思ehr第三版

hxx 11 月之前
父節點
當前提交
7fa57fa024

+ 13 - 5
pom.xml

@@ -79,11 +79,11 @@
 
         </dependency>
 
-        <dependency>
-            <groupId>com.oracle.database.jdbc</groupId>
-            <artifactId>ojdbc8</artifactId>
-            <version>21.9.0.0</version>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>com.oracle.database.jdbc</groupId>-->
+<!--            <artifactId>ojdbc8</artifactId>-->
+<!--            <version>21.9.0.0</version>-->
+<!--        </dependency>-->
 
         <dependency>
             <groupId>com.alibaba</groupId>
@@ -144,6 +144,14 @@
             <systemPath>${project.basedir}/src/main/resources/lib/kingdee_Ltpa.jar</systemPath>
         </dependency>
 
+        <dependency>
+            <groupId>ruisi.yida</groupId>
+            <artifactId>ojdbc</artifactId>
+            <scope>system</scope>
+            <version>21.9.0.0</version>
+            <systemPath>${project.basedir}/src/main/resources/lib/ojdbc8-21.9.0.0.jar</systemPath>
+        </dependency>
+
 
 
 

+ 3 - 1
src/main/java/ruisi/com/ruisiehr/Utils/OSFWSClientSSOUtils.java

@@ -31,8 +31,10 @@ public class OSFWSClientSSOUtils {
 		//URL resourceUrl = classLoader.getResource("conf/LtpaToken.properties");
 		//String path = URLDecoder.decode(resourceUrl.getPath(), StandardCharsets.UTF_8);//path 改成绝对路径,然后把LtpaToken.properties文件抛到这个路径下,
 		//根据密钥生成的密码串
+
 		String path="/home/server/ruisi_ehr/conf/LtpaToken.properties";
-//		String path = "D:/Items/ruiSiEhr/src/conf/LtpaToken.properties";
+//
+//	String path = "D:/Items/ruiSiEhr/src/conf/LtpaToken.properties";
 		LtpaTokenManager2.loadConfig(path);
 
 		String password = LtpaTokenManager.generate("user",path).toString();

+ 2 - 0
src/main/java/ruisi/com/ruisiehr/mapper/ScheduleTaskMapper.java

@@ -23,4 +23,6 @@ public interface ScheduleTaskMapper {
 
 
     List<Map<String, String>> getHolidayTypeByUserId(Map  param);
+
+    List<Map<String, String>> getOrg();
 }

+ 18 - 0
src/main/java/ruisi/com/ruisiehr/schedule/ScheduleTask.java

@@ -93,6 +93,24 @@ public class ScheduleTask {
             e.printStackTrace();
         }
     }
+//    hr部门同步
+    @Scheduled(cron = "0 0 0 * * ?")
+    public void syncDept() {
+
+        log.info("开始上传hr部门");
+
+        try {
+             holidayTypeServer.syncDept();
+            System.out.println(LocalDateTime.now());
+        } catch (Exception e) {
+            // 记录错误信息
+            e.printStackTrace();
+        }
+    }
+
+
+
+
 
 //    @Scheduled(cron = "0/1 * * * * ?")
 //    public void syncDelete() {

+ 2 - 0
src/main/java/ruisi/com/ruisiehr/service/IScheduleTaskServer.java

@@ -13,4 +13,6 @@ public interface IScheduleTaskServer {
     void syncPerson() throws ParseException;
 
     void syncDelete();
+
+    void syncDept();
 }

+ 345 - 67
src/main/java/ruisi/com/ruisiehr/service/serviceImpl/HRVacationInfoServiceImpl.java

@@ -30,6 +30,7 @@ import ruisi.com.ruisiehr.service.IHRVacationInfoServer;
 import javax.annotation.Resource;
 import java.net.URISyntaxException;
 import java.sql.Timestamp;
+import java.text.DecimalFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
@@ -77,8 +78,23 @@ public class HRVacationInfoServiceImpl implements IHRVacationInfoServer {
                         .formInstanceId(formInstanceId)
                         .build(), YDConf.FORM_QUERY.retrieve_id);
                 Map formData =ddrNewL.getFormData();
-                msg = saveVacationInfo("saveLeaveBill",formData, onlyCheck);
-                break;
+                if (formData.get("textField_luuvaham").equals("RS052")) {
+                //单独写一个哺乳假的校验。
+                //请假校验的时候把请假时长回写到Portal
+                //请假结束的时候把HR生成的单据编号回写到Portal
+                //1、截止日期不能超过子女出生日期的一年 2、起始时间需是产假结束日期的后一天3、附件必传
+                if (onlyCheck.equals(CheckStatusConstans.Check_go)) {
+
+                    //生成哺乳假请假单
+                    msg = saveBreastfeed(formData);
+                }else if(onlyCheck.equals(CheckStatusConstans.Check_stop)){
+                    //校验
+                    msg = checkBreastfeed(formData);
+                }
+            } else {
+                    msg = saveVacationInfo("saveLeaveBill",formData, onlyCheck);
+            }
+            break;
             // 出差
             case "496":
                 DDR_New ddrNewT = ydClient.queryData(YDParam.builder()
@@ -149,6 +165,23 @@ public class HRVacationInfoServiceImpl implements IHRVacationInfoServer {
 //        endTime = UtilDateTime.formatLocal(LocalDateTime.parse(endDate),"yyyy-MM-dd HH:mm:ss");
         startTime = UtilDateTime.formatLocal(startDate.toLocalDateTime(),"yyyy-MM-dd HH:mm:ss");
         endTime = UtilDateTime.formatLocal(endDate.toLocalDateTime(),"yyyy-MM-dd HH:mm:ss");
+        if(holidayType.equals("RS052")){
+            int length = daysBetween(startDate, endDate) + 1;
+            int realLength = 0;
+            if ("上午晚到一小时".equals(params.get("brType"))
+                    || "上午下午各休一半".equals(params.get("brType"))
+                    || "下午早走一小时".equals(params.get("brType"))) {
+                // 长度
+                realLength = length;
+
+            } else {// 双胞胎请假时长*2
+                // 长度
+                realLength = length * 2;
+            }
+            returnMap.put("wholeLen", realLength);
+            return McR.success(returnMap);
+
+        }else{
         leaveLengthMap.put("holidayTypeId", hoildayId);
         leaveLengthMap.put("beginTimeCount",startTime);
         leaveLengthMap.put("endTimeCount", endTime);
@@ -184,71 +217,6 @@ public class HRVacationInfoServiceImpl implements IHRVacationInfoServer {
                 returnmsg = "系统不可提交本月之前的请假单,请重新选择请假开始时间。";
                 return McR.errorParam(returnmsg);
             }
-//
-//            param.put("timeOffApplyType",holidayType);
-//            param.put("timeOffStartDate", startTime);
-//            param.put("timeOffEndDate", endTime);
-//            param.put("excuse", excuse);
-//            param.put("personNum", params.get("personId"));
-//            String res =OSFWSClientSSOUtils.OSFWSClientSSO("getAtsLeaveLengthOSF", param);
-//            System.out.println("res::::::::::::::::"+res);
-//
-//            if (!res.isEmpty()) {
-//                JSONObject jsonObj = JSON.parseObject(res);
-//                String msg = jsonObj.get("msg").toString();
-//
-//                if (!"成功".equals(msg)) {
-//                    String vacaLen = "";
-//                    if("day".equals(unit)){
-//                        vacaLen = String.valueOf(Double.valueOf(wholeLen) * 8);
-//                    }else{
-//                        vacaLen = wholeLen;
-//                    }
-//
-//                    returnmsg = jsonObj.get("reason").toString();
-//                    if(returnmsg.equals("剩余额度不足,请假失败!")){
-//                        returnmsg = returnmsg+"当前请假时长为:"+vacaLen;
-//                    }
-//                }else{
-//                    Map mapaLike = new HashMap();
-//                    mapaLike.put("ygbh", personId);
-//                    mapaLike.put("start_date",startTime);
-//                    mapaLike.put("end_date", endDate);
-//
-//                    Map resMap1 = hRPortalInfoMapper.getAlikeLeave1(mapaLike);
-//                    Map resMap2 = hRPortalInfoMapper.getAlikeLeave2(mapaLike);
-//                    Map resMap3 = hRPortalInfoMapper.getAlikeLeave3(mapaLike);
-//                    Map resMap4 = hRPortalInfoMapper.getAlikeLeave4(mapaLike);
-//
-//                    if(resMap1 ==null && resMap2 == null && resMap3 == null && resMap4 == null){
-//
-//                        String vacaLen = "";
-//                        if("day".equals(unit)){
-//                            vacaLen = String.valueOf(Double.valueOf(wholeLen) * 8);
-//                        }else{
-//                            vacaLen = wholeLen;
-//                        }
-//                        Map map = new HashMap();
-//                        map.put("holiday_hours", vacaLen);
-//                        map.put("ygbh", endTime);
-//
-////                        hRPortalInfoMapper.updateVacaLength(map);
-//                    }else{
-//                        Map<String, String> resultMap = new HashMap<String, String>();
-//                        if(resMap1 != null){
-//                            resultMap = hRPortalInfoMapper.getAlikeLeave1(mapaLike);
-//                        }else if(resMap2 != null){
-//                            resultMap = hRPortalInfoMapper.getAlikeLeave2(mapaLike);
-//                        }else if(resMap3 != null){
-//                            resultMap = hRPortalInfoMapper.getAlikeLeave3(mapaLike);
-//                        }else if(resMap4 != null){
-//                            resultMap = hRPortalInfoMapper.getAlikeLeave4(mapaLike);
-//                        }
-//                        returnmsg = "您已申请过包含当前请假时间的请假单,不可重复申请!单据编号为"+resultMap.get("lcbh");
-//                    }
-//                }
-////                return McR.errorParam(returnmsg);
-//            }
 
 
         }
@@ -257,6 +225,8 @@ public class HRVacationInfoServiceImpl implements IHRVacationInfoServer {
         return McR.success(returnMap);
     }
 
+    }
+
     /**
      * 获取请假类型
      * @param params
@@ -268,6 +238,264 @@ public class HRVacationInfoServiceImpl implements IHRVacationInfoServer {
 
     }
 
+
+    // 哺乳假生成请假单
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    private String saveBreastfeed(Map<String, Object> params) {
+        //校验哺乳假规则
+        checkBreastfeed(params);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
+
+        Map<String, String> personInfoMap = hrVacationInfoMapper.getPersonId((String) params.get("textField_lts1mg31"));// 参数为personcode
+
+        // 创建者id
+        String creatorId = hrVacationInfoMapper.getCreatorId();
+
+        Map leaveBillMap = new HashMap();
+        String fid = hrVacationInfoMapper.getFid().toString();
+        leaveBillMap.put("FID", fid);
+        leaveBillMap.put("FCREATORID", creatorId);// 创建者
+        leaveBillMap.put("FCREATETIME",
+                Timestamp.valueOf(sdf.format(new Date())));// 创建时间
+        leaveBillMap.put("FLASTUPDATEUSERID", creatorId);// 最后修改者
+        leaveBillMap.put("FLASTUPDATETIME",
+                Timestamp.valueOf(sdf.format(new Date())));// 最后修改时间
+        leaveBillMap.put("FCONTROLUNITID",
+                "00000000-0000-0000-0000-000000000000CCE7AED4");// //控制单元
+        // 单据编号
+        String fnumber = sdf1.format(new Date()).toString();
+        String maxCount = hrVacationInfoMapper.getFNumberInfo(fnumber + "-1");
+        if (maxCount == "" || maxCount == null) {
+            fnumber = fnumber + "-1" + getNum("0000");
+        } else {
+            fnumber = fnumber + "-1" + getNum(maxCount.substring(10, 14));
+        }
+
+        leaveBillMap.put("FNUMBER", fnumber);// 单据编号
+        leaveBillMap.put("FADMINORGUNITID", personInfoMap.get("ADMINFID"));// 行政组织
+        leaveBillMap.put("FHRORGUNITID",
+                "00000000-0000-0000-0000-000000000000CCE7AED4");// hr组织
+        leaveBillMap.put("FBILLSTATE", "3");// 单据状态
+        leaveBillMap.put("FAPPROVETYPE", "0");// 审批类型(0-直接审批,1-工作流)
+        leaveBillMap.put("FISMULTIENTRY", "0");// 是否多分录
+        leaveBillMap.put("FPROPOSER", personInfoMap.get("PERSONFID"));// 申请人
+        leaveBillMap.put("FAPPLYDATE",
+                Timestamp.valueOf(sdf.format(new Date())));// 申请日期
+        leaveBillMap.put("FBILLTYPE", "1");// 请假单类型
+
+        hrVacationInfoMapper.insertLeaveBill(leaveBillMap);
+
+        try {
+            Map leaveBillEntryMap = new HashMap();
+            leaveBillEntryMap.put("FID", "");
+            leaveBillEntryMap.put("FSEQ", 1);
+            leaveBillEntryMap.put("FPERSONID", personInfoMap.get("PERSONFID"));
+            leaveBillEntryMap.put("FPOSITIONID",
+                    personInfoMap.get("POSITIONFID"));// 职位
+            leaveBillEntryMap.put("FADMINORGUNITID",
+                    personInfoMap.get("ADMINFID"));// 部门
+            leaveBillEntryMap.put("FBILLID", fid);// 所属单据体
+
+//            Date c;
+            String fstartTime = "";
+            String fendTime = "";
+
+            // startTime = UtilDateTime.formatLocal(UtilDateTime.getLocalDateTimeFromTimestamp(UtilMap.getLong(formDate,"dateField_lts3bfky")),
+            fstartTime=UtilDateTime.formatLocal(UtilDateTime.getLocalDateTimeFromTimestamp(UtilMap.getLong(params,"dateField_lts1mg3q")),"yyyy-MM-dd HH:mm:ss");
+
+
+//                c = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(params.get(
+//                        "dateField_lts1mg3q").toString());
+//                fstartTime = sdf.format(c);
+
+//                c = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(params.get(
+//                        "dateField_lts1mg3r").toString());
+//                fendTime = sdf.format(c);
+            fendTime=UtilDateTime.formatLocal(UtilDateTime.getLocalDateTimeFromTimestamp(UtilMap.getLong(params,"dateField_lts1mg3r")),"yyyy-MM-dd HH:mm:ss");
+
+            leaveBillEntryMap.put("FBEGINTIME", Timestamp.valueOf(fstartTime));// 请假开始时间
+            leaveBillEntryMap.put("FENDTIME", Timestamp.valueOf(fendTime));// 请假结束时间
+
+            // 长度
+            // leaveBillEntryMap.put("FLEAVELENGTH",
+            // daysBetween(sdf.parse(leaveBillEntryMap.get("FBEGINTIME").toString()),
+            // sdf.parse(leaveBillEntryMap.get("FENDTIME").toString())) + 1);
+            leaveBillEntryMap.put("FPOLICYID", "Dy8AAAE0JEdfwQkQ");// 假期类型
+            leaveBillEntryMap.put("FREMARK", "小时");
+            leaveBillEntryMap.put("FREALBEGINTIME",
+                    Timestamp.valueOf(fstartTime));// 实际请假开始时间
+            leaveBillEntryMap.put("FREALENDTIME", Timestamp.valueOf(fendTime));// 实际请假结束时间
+            // 实际长度
+            // leaveBillEntryMap.put("FREALLEAVELENGTH",
+            // daysBetween(sdf.parse(leaveBillEntryMap.get("FBEGINTIME").toString()),
+            // sdf.parse(leaveBillEntryMap.get("FENDTIME").toString())) + 1);
+            leaveBillEntryMap.put("FREALUNIT", 2);
+            leaveBillEntryMap.put("FISCANCELLEAVE", 0);
+            leaveBillEntryMap.put("FISDEFAULTMANAGE", 1);
+            leaveBillEntryMap.put("FISELASTICCALLEN", 0);
+            String childBir = "";
+            String birthEnd = "";
+
+            //
+            childBir=UtilDateTime.formatLocal(UtilDateTime.getLocalDateTimeFromTimestamp(UtilMap.getLong(params,"dateField_lzay8yt4")),"yyyy-MM-dd HH:mm:ss");
+            birthEnd=UtilDateTime.formatLocal(UtilDateTime.getLocalDateTimeFromTimestamp(UtilMap.getLong(params,"dateField_lzay8yt5")),"yyyy-MM-dd HH:mm:ss");
+
+//                c = new SimpleDateFormat("yyyy-MM-dd").parse(params.get(
+//                        "dateField_lzay8yt4").toString());
+//                childBir = sdf.format(c);
+//
+//                c = new SimpleDateFormat("yyyy-MM-dd").parse(params.get(
+//                        "dateField_lzay8yt5").toString());
+//                birthEnd = sdf.format(c);
+            leaveBillEntryMap.put("FCHILDBIRTHDAY", Timestamp.valueOf(childBir));// 出生日期
+            leaveBillEntryMap.put("FMLENDTIME", Timestamp.valueOf(birthEnd));// 产假结束日期
+            if(params.get("selectField_lzay8ysz").equals("上午晚到一小时")){
+                leaveBillEntryMap.put("FBFTYPEID", "8r0AAAA09qFIT3K3");// 哺乳假类型
+            }else if(params.get("selectField_lzay8ysz").equals("下午早走一小时")){
+                leaveBillEntryMap.put("FBFTYPEID", "8r0AAAA09qVIT3K3");// 哺乳假类型
+            }else if(params.get("selectField_lzay8ysz").equals("上午下午各休一半")){
+                leaveBillEntryMap.put("FBFTYPEID", "8r0AAAA09qNIT3K3");// 哺乳假类型
+            }
+
+
+            String startTime = leaveBillEntryMap.get("FBEGINTIME").toString();
+            String endTime = leaveBillEntryMap.get("FENDTIME").toString();
+            Date startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm")
+                    .parse(startTime);
+            Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm")
+                    .parse(endTime);
+
+            int length = daysBetween(startDate, endDate) + 1;
+            int realLength = daysBetween(startDate, endDate) + 1;
+            if ("8r0AAAA09qFIT3K3".equals(leaveBillEntryMap.get("FBFTYPEID"))
+                    || "8r0AAAA09qNIT3K3".equals(leaveBillEntryMap
+                    .get("FBFTYPEID"))
+                    || "8r0AAAA09qVIT3K3".equals(leaveBillEntryMap
+                    .get("FBFTYPEID"))) {
+                // 长度
+                leaveBillEntryMap.put("FLEAVELENGTH", length);
+                // 实际长度
+                leaveBillEntryMap.put("FREALLEAVELENGTH", realLength);
+
+            } else {// 双胞胎请假时长*2
+                // 长度
+                leaveBillEntryMap.put("FLEAVELENGTH", length * 2);
+                // 实际长度
+                leaveBillEntryMap.put("FREALLEAVELENGTH", realLength * 2);
+            }
+
+            hrVacationInfoMapper.insertLeaveBillEntry(leaveBillEntryMap);
+
+            Map leaveBillDetail = new HashMap();
+            leaveBillDetail.put("FID", "");
+            leaveBillDetail.put("FPROPOSERID", personInfoMap.get("PERSONFID"));// 员工
+            leaveBillDetail.put("FADMINORGUNITID",
+                    personInfoMap.get("ADMINFID"));// 行政组织(部门)
+            leaveBillDetail.put("FLEAVEBILLID", fid);
+            leaveBillDetail.put("FLEAVEDATE",
+                    Timestamp.valueOf(sdf.format(new Date())));// 请假日期
+            leaveBillDetail.put("FLEAVELENGTH",
+                    daysBetween(startDate, endDate) + 1);// 请假时长
+            leaveBillDetail.put("FLEAVEUNIT", 2);
+            leaveBillDetail.put("FPOLICYID", "Dy8AAAE0JEdfwQkQ");// 假期类型
+
+            hrVacationInfoMapper.insertLeaveBillDetail(leaveBillDetail);
+
+            //请假结束的时候把HR生成的单据编号回写到Portal
+//            Map map = new HashMap();
+//            map.put("hr_order_id", fnumber);
+//            map.put("requestid", params.get("requestid"));
+//            hRPortalInfoMapper.updateVacaFnumber(map);
+
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return e.getMessage();
+        }
+        return "";
+
+    }
+
+    // 哺乳假校验请假单
+    //单独写一个哺乳假的校验。
+    //请假校验的时候把请假时长回写到Portal
+    //请假结束的时候把HR生成的单据编号回写到Portal
+    //1、截止日期不能超过子女出生日期的一年 2、起始时间需是产假结束日期的后一天3、附件必传
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    private String checkBreastfeed(Map<String, Object> params) {
+        String msg = "";
+        try {
+
+            //截止日期不能超过子女出生日期的一年
+            String endTime = params.get("dateField_lts1mg3r").toString();
+
+            String childBirth = params.get("dateField_lzay8yt4").toString();
+            String realEndDate = nextYear(childBirth);
+            String endSubTime = endTime.substring(0, endTime.indexOf(" "));
+
+            int compare = endSubTime.compareTo(realEndDate);
+            if(compare>0){
+                return msg="哺乳假结束日期不可超过子女出生日期后的一年,请重新选择哺乳假结束日期。";
+            }
+
+            //起始时间需是产假结束日期的后一天
+            String startTime = params.get("dateField_lts1mg3q").toString();
+            String birthEndDate = params.get("dateField_lzay8yt5").toString();
+
+//			String realStartDate = nextDay(birthEndDate);
+            String startSubTime = startTime.substring(0, startTime.indexOf(" "));
+//			if(!realStartDate.equals(startSubTime)){
+//				return msg = "哺乳假开始日期必须是产假结束日期的后一天,请重新选择哺乳假开始日期。";
+//			}
+            int birthCompare = startSubTime.compareTo(birthEndDate);
+            int endCompare = startTime.compareTo(endTime);
+            if(birthCompare<0 || endCompare>0){
+                return msg = "哺乳假开始日期必须在产假结束日期之后并且在哺乳假结束日期之前,请重新选择哺乳假开始日期。";
+            }
+
+            //附件必须上传
+            if(params.get("attachmentField_lts1mg42").toString().isEmpty()){
+                return msg = "请上传附件。";
+            }
+
+            //请假校验的时候把请假时长回写到Portal
+            Date startDate;
+
+            startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm")
+                    .parse(startTime);
+
+            Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm")
+                    .parse(endTime);
+
+            int length = daysBetween(startDate, endDate) + 1;
+            int realLength = 0;
+            if ("8r0AAAA09qFIT3K3".equals(params.get("selectField_lzay8ysz"))
+                    || "8r0AAAA09qNIT3K3".equals(params.get("selectField_lzay8ysz"))
+                    || "8r0AAAA09qVIT3K3".equals(params.get("selectField_lzay8ysz"))) {
+                // 长度
+                realLength = length;
+
+            } else {// 双胞胎请假时长*2
+                // 长度
+                realLength = length * 2;
+            }
+//            Map map = new HashMap();
+//            map.put("holiday_hours", realLength);
+//            map.put("requestid", params.get("requestid"));
+//
+//            hRPortalInfoMapper.updateVacaLength(map);
+
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        return msg;
+    }
+
+
     //    请假单,出差逻辑实现
     private String saveVacationInfo(String serviceName,Map formDate, String onlyCheck) throws URISyntaxException, ParseException {
 
@@ -587,6 +815,56 @@ public class HRVacationInfoServiceImpl implements IHRVacationInfoServer {
         return returnmsg;
     }
 
+    public static String getNum(String code) {
+        String roundCode = "0001";
+
+        if (code != null && !code.isEmpty()) {
+            int intCode = Integer.parseInt(code) + 1;
+            if (intCode < 99) {
+                roundCode = String.format(String.valueOf(intCode));
+            }
+        }
+
+        DecimalFormat df = new DecimalFormat("0000");
+        String newCode = df.format(Integer.parseInt(roundCode));
+
+        return newCode;
+    }
+
+
+    public static int daysBetween(Date smdate, Date bdate)
+            throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        smdate = sdf.parse(sdf.format(smdate));
+        bdate = sdf.parse(sdf.format(bdate));
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(smdate);
+        long time1 = cal.getTimeInMillis();
+        cal.setTime(bdate);
+        long time2 = cal.getTimeInMillis();
+        long between_days = (time2 - time1) / (1000 * 3600 * 24);
+
+        return Integer.parseInt(String.valueOf(between_days));
+    }
+
+    public static String nextYear(String date){
+
+        Calendar ca = Calendar.getInstance();
+        String nextYear ="";
+        try {
+            ca.setTime(new SimpleDateFormat("yyyy-MM-dd").parse(date));
+            ca.add(Calendar.YEAR, +1);
+            ca.add(Calendar.MONTH, -0);
+            ca.add(Calendar.DATE, -1);
+
+            nextYear = new SimpleDateFormat("yyyy-MM-dd").format(ca.getTime());
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return nextYear;
+    }
+
     private Date formatdate(String date) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 

+ 12 - 7
src/main/java/ruisi/com/ruisiehr/service/serviceImpl/PortalPreempServerImpl.java

@@ -57,7 +57,7 @@ public class PortalPreempServerImpl  implements IPortalPreempServer {
                 .formInstanceId(formInstanceId)
                 .build(), YDConf.FORM_QUERY.retrieve_id);
 
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd ");
 
 
        Map formData =ddrNew.getFormData();
@@ -183,8 +183,10 @@ public class PortalPreempServerImpl  implements IPortalPreempServer {
 
 //         创建人
             if (formData.get("employeeField_lu9hg3m7") != null) {
-                user.setCreated_by(((List) formData.get("employeeField_lu9hg3m7")).get(0).toString());
-                user.setFapplier_no(((List) formData.get("employeeField_lu9hg3m7")).get(0).toString());
+                user.setCreated_by( formData.get("textField_lzo1pfxa").toString());
+                user.setFapplier_no( formData.get("textField_lzo1pfx9").toString());
+//                user.setCreated_by(((List) formData.get("textField_lzo1pfxa")).get(0).toString());
+//                user.setFapplier_no(((List) formData.get("textField_lzo1pfx9")).get(0).toString());
 
             }
 //
@@ -227,18 +229,21 @@ public class PortalPreempServerImpl  implements IPortalPreempServer {
             }
 
 //        性别,男1女2
-            if (formData.get("selectField_lu9hg3q6") != null) {
-                if (formData.get("selectField_lu9hg3q6").toString() == "男") {
+            if (formData.get("selectField_lu9hg3ps") != null) {
+                //System.out.println("性别:"+formData.get("selectField_lu9hg3ps").toString());
+                if (formData.get("selectField_lu9hg3ps").toString() .equals("男")) {
                     user.setAttr3("1");
-                } else if (formData.get("selectField_lu9hg3q6").toString() == "女") {
+                } else if (formData.get("selectField_lu9hg3ps").toString().equals("女")) {
                     user.setAttr3("2");
                 }
 
             }
 
 //        招聘来源,关联表单往数据库里填写的是招聘编码
-            if (formData.get("associationFormField_lu9hg3q2") != null) {
+            if (!formData.get("textField_lvar50ho").toString().equals("") ) {
+               // System.out.println("招聘来源:"+formData.get("textField_lvar50ho").toString());
                 user.setFenrollsource_type(formData.get("textField_lvar50ho").toString());
+
             }
 
 //        备注

+ 17 - 0
src/main/java/ruisi/com/ruisiehr/service/serviceImpl/ScheduleTaskServiceImpl.java

@@ -223,5 +223,22 @@ public class ScheduleTaskServiceImpl implements IScheduleTaskServer {
                        .build(),YDConf.FORM_OPERATION.delete_batch);
 
     }
+
+    @Override
+    public void syncDept() {
+        List<Map<String, String>> orgs = scheduleTaskMapper.getOrg();
+        for (Map<String, String> oragination : orgs)
+            if (oragination.get("ORGCODE") != null) {
+                String PS = "textField_lznzj6k6, textField_lznyrc7r, textField_lznyrc7q, radioField_lznz2nsy";
+                String SC = "textField_lznzj6k6, textField_lznyrc7r, textField_lznyrc7q";
+                ydClient.operateData(YDParam.builder()
+                        .formUuid("FORM-52CB950F462C44D8B187EA9169D3CA99506A")
+                        .searchCondition(JSONObject.toJSONString(UtilMap.map(SC,oragination.get("ORGNAME"), oragination.get("ORGCODE"), oragination.get("ORGLINENAME"))))
+                        .formDataJson(JSONObject.toJSONString(UtilMap.map(PS, oragination.get("ORGNAME"), oragination.get("ORGCODE"), oragination.get("ORGLINENAME"), "开启")))
+                        .build(), YDConf.FORM_OPERATION.upsert);
+            }
+
+
+    }
 }
 

二進制
src/main/resources/lib/ojdbc8-21.9.0.0.jar


+ 22 - 17
src/main/resources/ruisi/com/ruisiehr/mapper/ScheduleTaskMapper.xml

@@ -2,9 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="ruisi.com.ruisiehr.mapper.ScheduleTaskMapper">
 
-    <!-- 查询节假日定时版 -->
+    <!-- 查询节假日 -->
     <select id="getHolidayTypeByUserId" parameterType="java.util.Map" resultType="java.util.Map">
-        SELECT people, holidayName, holidayCode, realLimit, freezeLimit, unit,validYear, peopleCode, telphone
+        SELECT people, holidayName, holidayCode, realLimit, freezeLimit, unit,validYear, peopleCode, telphone,  usedLimit, remainLimit
         FROM (
                  SELECT HOLIDAYTYPE.FNAME_L2 holidayName,
                         ( CASE WHEN HOLIDAYLIMIT.FHolidayUnit = 1 THEN '天' ELSE '小时' END ) unit,
@@ -12,14 +12,14 @@
                         PROPOSER.fnumber peopleCode,
                         PROPOSER.FNAME_L2 people,
                         PROPOSER.FCELL telphone,
-                        HOLIDAYLIMIT.FCycleBeginDate 周期开始时间,
-                        HOLIDAYLIMIT.FCycleEndDate 周期结束时间,
-                        HOLIDAYLIMIT.FDelayDate 延期时间,
+                        HOLIDAYLIMIT.FCycleBeginDate BeginDate,
+                        HOLIDAYLIMIT.FCycleEndDate EndDate,
+                        HOLIDAYLIMIT.FDelayDate DelayDate,
                         to_char(HOLIDAYLIMIT.fyear ) validYear,
                         HOLIDAYLIMIT.FRealLimit realLimit,
-                        HOLIDAYLIMIT.FUsedLimit 已用额度,
+                        HOLIDAYLIMIT.FUsedLimit usedLimit,
                         HOLIDAYLIMIT.FreezeLimit freezeLimit,
-                        HOLIDAYLIMIT.FRemainLimit 剩余,
+                        HOLIDAYLIMIT.FRemainLimit remainLimit,
                         ( CASE WHEN PROPOSER.FGender = 1 AND HOLIDAYTYPE.fnumber IN ( 'RS010', 'RS01401', 'RS01402', 'RS01403', 'RS01404', 'RS016', 'RS018', 'RS019', 'RS020', 'RS028', 'RS052', 'RS053' ) THEN '隐藏'
                                WHEN PROPOSER.FGender = 2 AND HOLIDAYTYPE.fnumber IN ( 'RS015' ) THEN '隐藏' ELSE '不隐藏' END ) isread
                  FROM T_HR_ATS_AtsHolidayFile ATSHOLIDAYFILE
@@ -28,11 +28,11 @@
                           LEFT JOIN T_HR_ATS_HolidayType HOLIDAYTYPE ON HOLIDAYPOLICY.FHolidayTypeID = HOLIDAYTYPE.FID
                           LEFT OUTER JOIN T_BD_Person PROPOSER ON ATSHOLIDAYFILE.FProposerID = PROPOSER.FID WHERE HOLIDAYTYPE.FState = 1 ) tmp
         WHERE isread = '不隐藏'
-          AND (to_char( 延期时间, 'yyyymmdd' ) >= to_char( SYSDATE, 'yyyymmdd' ) OR 延期时间 IS NULL)
+          AND (to_char( DelayDate, 'yyyymmdd' ) >= to_char( SYSDATE, 'yyyymmdd' ) OR DelayDate IS NULL)
           AND (validYear= extract(year from sysdate) OR validYear IS NULL)
           AND peopleCode = #{peopleCode}
         union all
-        select people, holidayName, holidayCode, realLimit, freezeLimit, unit,validYear, peopleCode, telphone
+        select people, holidayName, holidayCode, realLimit, freezeLimit, unit,validYear, peopleCode, telphone, usedLimit, remainLimit
         from
             (SELECT HOLIDAYTYPE.FNAME_L2 holidayName,
                     ( CASE WHEN HOLIDAYPOLICY.FUnit = 1 THEN '天' ELSE '小时' END ) unit,
@@ -40,14 +40,14 @@
                     PROPOSER.fnumber peopleCode,
                     PROPOSER.FNAME_L2 people,
                     PROPOSER.FCELL telphone,
-                    null 周期开始时间,
-                    null 周期结束时间,
+                    null BeginDate,
+                    null EndDate,
                     null validYear,
                     '' 有效期年度,
                     null realLimit,
-                    null 已用额度,
+                    null usedLimit,
                     null freezeLimit,
-                    null 剩余,
+                    null remainLimit,
                     ( CASE WHEN PROPOSER.FGender = 1 AND HOLIDAYTYPE.fnumber IN ( 'RS010', 'RS01401', 'RS01402', 'RS01403', 'RS01404', 'RS016', 'RS018', 'RS019', 'RS020', 'RS028', 'RS052', 'RS053' ) THEN '隐藏'
                            WHEN PROPOSER.FGender = 2 AND HOLIDAYTYPE.fnumber IN ( 'RS015' ) THEN '隐藏' ELSE '不隐藏' END ) isread
              FROM T_HR_ATS_AtsHolidayFile ATSHOLIDAYFILE
@@ -80,9 +80,9 @@
                    HOLIDAYLIMIT.FDelayDate 延期时间,
                    to_char(HOLIDAYLIMIT.fyear ) validYear,
                    HOLIDAYLIMIT.FRealLimit realLimit,
-                   HOLIDAYLIMIT.FUsedLimit 已用额度,
+                   HOLIDAYLIMIT.FUsedLimit usedLimit,
                    HOLIDAYLIMIT.FreezeLimit freezeLimit,
-                   HOLIDAYLIMIT.FRemainLimit 剩余,
+                   HOLIDAYLIMIT.FRemainLimit remainLimit,
                    ( CASE WHEN PROPOSER.FGender = 1 AND HOLIDAYTYPE.fnumber IN ( 'RS010', 'RS01401', 'RS01402', 'RS01403', 'RS01404', 'RS016', 'RS018', 'RS019', 'RS020', 'RS028', 'RS052', 'RS053' ) THEN '隐藏'
                        WHEN PROPOSER.FGender = 2 AND HOLIDAYTYPE.fnumber IN ( 'RS015' ) THEN '隐藏' ELSE '不隐藏' END ) isread
             FROM T_HR_ATS_AtsHolidayFile ATSHOLIDAYFILE
@@ -107,9 +107,9 @@
                 null validYear,
                 '' 有效期年度,
                 null realLimit,
-                null 已用额度,
+                null usedLimit,
                 null freezeLimit,
-                null 剩余,
+                null remainLimit,
                 ( CASE WHEN PROPOSER.FGender = 1 AND HOLIDAYTYPE.fnumber IN ( 'RS010', 'RS01401', 'RS01402', 'RS01403', 'RS01404', 'RS016', 'RS018', 'RS019', 'RS020', 'RS028', 'RS052', 'RS053' ) THEN '隐藏'
                     WHEN PROPOSER.FGender = 2 AND HOLIDAYTYPE.fnumber IN ( 'RS015' ) THEN '隐藏' ELSE '不隐藏' END ) isread
          FROM T_HR_ATS_AtsHolidayFile ATSHOLIDAYFILE
@@ -178,5 +178,10 @@
 
     </select>
 
+<!--    查询部门  T_ORG_ADMIN-->
+    <select id="getOrg" parameterType="String" resultType="java.util.Map">
+        SELECT FNAME_L2 orgName, FNUMBER orgCode, FDISPLAYNAME_L2 orgLineName FROM T_ORG_ADMIN
+    </select>
+
 
 </mapper>

+ 19 - 0
src/test/java/ruisi/com/ruisiehr/RuiSiEhrApplicationTests.java

@@ -6,9 +6,16 @@ import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import static ruisi.com.ruisiehr.service.serviceImpl.HRVacationInfoServiceImpl.daysBetween;
+
 @SpringBootTest
 class RuiSiEhrApplicationTests {
 
@@ -57,4 +64,16 @@ class RuiSiEhrApplicationTests {
 
     }
 
+    @Test
+
+    void test1() throws ParseException {
+
+        Date startDate = Date.from(Instant.ofEpochMilli(1691664000000L)); // 2023-08-10T00:00:00Z
+        Date endDate = Date.from(Instant.ofEpochMilli(1691836800000L));// 2023-08-12T00:00:00Z
+
+        int days = daysBetween(startDate, endDate);
+        System.out.println(days);
+
+    }
+
 }