LiGuang 2 years ago
parent
commit
3665c79194

+ 74 - 34
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/WeixinUserImpl.java

@@ -729,7 +729,7 @@ public class WeixinUserImpl implements IWeixinUserService{
             for (BdAnnualLeave ls:years){
             for (BdAnnualLeave ls:years){
                 if(ls.getYearName().equals("2022")){
                 if(ls.getYearName().equals("2022")){
                     if (oConvertUtils.isNotEmpty(userByid.getYearCount())) {
                     if (oConvertUtils.isNotEmpty(userByid.getYearCount())) {
-                        yearCount += Integer.parseInt(userByid.getYearCount());
+                        yearCount += Double.parseDouble(userByid.getYearCount());
                     }else {
                     }else {
                         yearCount+=0;
                         yearCount+=0;
                     }
                     }
@@ -751,10 +751,10 @@ public class WeixinUserImpl implements IWeixinUserService{
         } else {
         } else {
             syYearCount=String.valueOf(yearCount);
             syYearCount=String.valueOf(yearCount);
         }
         }
-        String moth = vacationMapper.getMoth();
-        if (moth!=null&&!"".equals(moth)){
-            moths=Integer.parseInt(moth);
-        }
+//        String moth = vacationMapper.getMoth();
+//        if (moth!=null&&!"".equals(moth)){
+//            moths=Integer.parseInt(moth);
+//        }
         Date dBefore = new Date();
         Date dBefore = new Date();
         Calendar calendar = Calendar.getInstance(); //得到日历
         Calendar calendar = Calendar.getInstance(); //得到日历
         calendar.setTime(newDate);//把当前时间赋给日历
         calendar.setTime(newDate);//把当前时间赋给日历
@@ -785,6 +785,7 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getToken();
         UrlData.getToken();
         String msg="ok";
         String msg="ok";
         List<String> list =new ArrayList<>();
         List<String> list =new ArrayList<>();
+        List<String> lists =new ArrayList<>();
         Calendar now = Calendar.getInstance();//获取系统时间实列
         Calendar now = Calendar.getInstance();//获取系统时间实列
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -798,16 +799,25 @@ public class WeixinUserImpl implements IWeixinUserService{
             long endDate;
             long endDate;
         endDate =now.getTime().getTime()/1000;
         endDate =now.getTime().getTime()/1000;
        // enDate = now.getTime();
        // enDate = now.getTime();
-       // now.add(Calendar.DAY_OF_MONTH, -30);
-        String format = sdff.format(now.getTime());
-        Date date = DateUtils.str2Date(format + "-01 00:00:00", sdf);
-        startDate = date.getTime()/1000;
+        now.add(Calendar.DAY_OF_MONTH, -30);
+//        String format = sdff.format(now.getTime());
+//        Date date = DateUtils.str2Date(format + "-01 00:00:00", sdf);
+        startDate = now.getTime().getTime()/1000;
 //        stDate = now.getTime();
 //        stDate = now.getTime();
-//        now.add(Calendar.DAY_OF_MONTH, -30);
-//        startDate2 = now.getTime().getTime()/1000;
+        now.add(Calendar.DAY_OF_MONTH, -15);
+        startDate2 = now.getTime().getTime()/1000;
 //        stDate2 = now.getTime();
 //        stDate2 = now.getTime();
-        list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVJmnEQTwW4cFS"));
-        //list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVJmnEQTwW4cFS"));
+        //获取审批通过的数据
+        list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVJmnEQTwW4cFS","2"));
+        list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVJmnEQTwW4cFS","2"));
+
+        //获取审批通过后又撤销的
+        lists.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVJmnEQTwW4cFS","6"));
+        lists.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVJmnEQTwW4cFS","6"));
+
+        if (lists!=null&&lists.size()>0){
+               iworkOvertimeService.removeByIds(lists);
+           }
             for (String ls:list){//循环审批id
             for (String ls:list){//循环审批id
                 workOvertime workOvertime = WeixinWorks(ls);
                 workOvertime workOvertime = WeixinWorks(ls);
                 if (workOvertime!=null) {
                 if (workOvertime!=null) {
@@ -818,6 +828,7 @@ public class WeixinUserImpl implements IWeixinUserService{
                     }
                     }
                 }
                 }
             }
             }
+        iworkOvertimeService.deleteByDate();
         return null;
         return null;
     }
     }
 
 
@@ -833,6 +844,7 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getToken();
         UrlData.getToken();
         String msg="ok";
         String msg="ok";
         List<UserQuit>lst=new ArrayList<>();
         List<UserQuit>lst=new ArrayList<>();
+        List<String>lsts=new ArrayList<>();
         Calendar now = Calendar.getInstance();//获取系统时间实列
         Calendar now = Calendar.getInstance();//获取系统时间实列
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -848,7 +860,11 @@ public class WeixinUserImpl implements IWeixinUserService{
         now.add(Calendar.DAY_OF_MONTH, -30);
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
         startDate = now.getTime().getTime()/1000;
         stDate = now.getTime();
         stDate = now.getTime();
-        List<String> list = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),"","3TmB1h5HqrhfjGe3iK6YAB3WaBu47w6FXugmpQea");
+        List<String> list = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),"","3TmB1h5HqrhfjGe3iK6YAB3WaBu47w6FXugmpQea","2");
+         lsts = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),"","3TmB1h5HqrhfjGe3iK6YAB3WaBu47w6FXugmpQea","6");
+         if (lsts!=null&&lsts.size()>0){
+             userQuitService.removeByIds(lsts);
+         }
        // userQuitService.deleteQuit(sDate,eDate);
        // userQuitService.deleteQuit(sDate,eDate);
         for (String ls:list){//循环审批id
         for (String ls:list){//循环审批id
            UserQuit quit = WeixinUserQuit(ls);
            UserQuit quit = WeixinUserQuit(ls);
@@ -910,6 +926,7 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getVacationToken();
         UrlData.getVacationToken();
         String msg="ok";
         String msg="ok";
         List<UserQuit>lst=new ArrayList<>();
         List<UserQuit>lst=new ArrayList<>();
+        List<String>lsts=new ArrayList<>();
         Calendar now = Calendar.getInstance();//获取系统时间实列
         Calendar now = Calendar.getInstance();//获取系统时间实列
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -925,7 +942,11 @@ public class WeixinUserImpl implements IWeixinUserService{
         now.add(Calendar.DAY_OF_MONTH, -30);
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
         startDate = now.getTime().getTime()/1000;
         stDate = now.getTime();
         stDate = now.getTime();
-        List<String> list = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),"","BsAbvVsPKdVX8a66FKM3PseMkbVo53fdL9U31eqar");
+        List<String> list = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),"","BsAbvVsPKdVX8a66FKM3PseMkbVo53fdL9U31eqar","2");
+        lsts = WeixinVacationList(String.valueOf(startDate),String.valueOf(endDate),"","BsAbvVsPKdVX8a66FKM3PseMkbVo53fdL9U31eqar","6");
+        if (lsts!=null&&lsts.size()>0){
+            userChageService.removeByIds(lsts);
+        }
         for (String ls:list){//循环审批id
         for (String ls:list){//循环审批id
             UserChage userChage = WeixinUserChange(ls);
             UserChage userChage = WeixinUserChange(ls);
             boolean f=false;
             boolean f=false;
@@ -989,6 +1010,7 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getToken();
         UrlData.getToken();
         String msg="ok";
         String msg="ok";
         List<String> list=new ArrayList<>();
         List<String> list=new ArrayList<>();
+        List<String> lists=new ArrayList<>();
         Calendar now = Calendar.getInstance();//获取系统时间实列
         Calendar now = Calendar.getInstance();//获取系统时间实列
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -1003,12 +1025,19 @@ public class WeixinUserImpl implements IWeixinUserService{
         //enDate = now.getTime();
         //enDate = now.getTime();
         now.add(Calendar.DAY_OF_MONTH, -30);
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
         startDate = now.getTime().getTime()/1000;
-       /* stDate = now.getTime();
-        now.add(Calendar.DAY_OF_MONTH, -30);
+        //stDate = now.getTime();
+        now.add(Calendar.DAY_OF_MONTH, -15);
         startDate2 = now.getTime().getTime()/1000;
         startDate2 = now.getTime().getTime()/1000;
-        stDate2 = now.getTime();*/
-        list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","3TmB1h5HqrhwHanzxLTSX1x44zz7djoVyWTbQHWn"));
-        //list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","3TmB1h5HqrhwHanzxLTSX1x44zz7djoVyWTbQHWn"));
+        //stDate2 = now.getTime();
+        //获取审批通过
+        list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","3TmB1h5HqrhwHanzxLTSX1x44zz7djoVyWTbQHWn","2"));
+        list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","3TmB1h5HqrhwHanzxLTSX1x44zz7djoVyWTbQHWn","2"));
+        //获取审批通过后又撤销
+        lists.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","3TmB1h5HqrhwHanzxLTSX1x44zz7djoVyWTbQHWn","6"));
+        lists.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","3TmB1h5HqrhwHanzxLTSX1x44zz7djoVyWTbQHWn","6"));
+        if (list!=null&&lists.size()>0){
+            makeUpCardService.removeByIds(lists);
+        }
         //makeUpCardService.deleteDate(sdf.format(startDate2),sdf.format(endDate));
         //makeUpCardService.deleteDate(sdf.format(startDate2),sdf.format(endDate));
         List<MakeUpCard>ls=new ArrayList<>();
         List<MakeUpCard>ls=new ArrayList<>();
         list.forEach(str->{
         list.forEach(str->{
@@ -1025,11 +1054,13 @@ public class WeixinUserImpl implements IWeixinUserService{
                        // attendanceService.save()
                        // attendanceService.save()
                     }*/
                     }*/
                 }
                 }
+
                // System.out.println(makeUpCard);
                // System.out.println(makeUpCard);
             }catch (Exception e){
             }catch (Exception e){
                 e.printStackTrace();
                 e.printStackTrace();
             }
             }
         });
         });
+        makeUpCardService.deleteByDate();
         /*makeUpCardService.saveBatch(ls);
         /*makeUpCardService.saveBatch(ls);
         System.out.println(list);*/
         System.out.println(list);*/
         return null;
         return null;
@@ -1114,7 +1145,7 @@ public class WeixinUserImpl implements IWeixinUserService{
      * @return
      * @return
      * @throws UnsupportedEncodingException
      * @throws UnsupportedEncodingException
      */
      */
-    public List<String>WeixinVacationList(String startDate,String endDate,String type,String tepid) throws UnsupportedEncodingException {
+    public List<String>WeixinVacationList(String startDate,String endDate,String type,String tepid,String state) throws UnsupportedEncodingException {
         Map<String, Object> headers = Maps.newHashMap();//请求头集合
         Map<String, Object> headers = Maps.newHashMap();//请求头集合
         List<String>lt=new ArrayList<>();
         List<String>lt=new ArrayList<>();
         List<Map<String,Object>>ps=new ArrayList<>();
         List<Map<String,Object>>ps=new ArrayList<>();
@@ -1131,7 +1162,7 @@ public class WeixinUserImpl implements IWeixinUserService{
             params.put("endtime", endDate);//结束时间参数
             params.put("endtime", endDate);//结束时间参数
             params.put("size", 100);//获取数据大小最大100
             params.put("size", 100);//获取数据大小最大100
             mst.put("key","sp_status");
             mst.put("key","sp_status");
-            mst.put("value","2");
+            mst.put("value",state);
             ps.add(mst);
             ps.add(mst);
             if (type!=null&&!type.equals("")){
             if (type!=null&&!type.equals("")){
                 map.put("key", "record_type");
                 map.put("key", "record_type");
@@ -1536,6 +1567,7 @@ public class WeixinUserImpl implements IWeixinUserService{
       UrlData.getToken();
       UrlData.getToken();
       String msg="ok";
       String msg="ok";
       List<String> list =new ArrayList<>();
       List<String> list =new ArrayList<>();
+        List<String> lists =new ArrayList<>();
         try {
         try {
             Calendar now = Calendar.getInstance();//获取系统时间实列
             Calendar now = Calendar.getInstance();//获取系统时间实列
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
@@ -1549,24 +1581,32 @@ public class WeixinUserImpl implements IWeixinUserService{
             long startDate2;
             long startDate2;
             long endDate;
             long endDate;
             endDate =now.getTime().getTime()/1000;
             endDate =now.getTime().getTime()/1000;
-            //enDate = now.getTime();
-            String format = sdff.format(now.getTime());
-            Date date = DateUtils.str2Date(format + "-01 00:00:00", sdf);
-            startDate = date.getTime()/1000;
-            //now.add(Calendar.DAY_OF_MONTH, -30);
-           // startDate = now.getTime().getTime()/1000;
-//            stDate = now.getTime();
-//            now.add(Calendar.DAY_OF_MONTH, -30);
-//            startDate2 = now.getTime().getTime()/1000;
+            enDate = now.getTime();
+//          String format = sdff.format(now.getTime());
+//          Date date = DateUtils.str2Date(format + "-01 00:00:00", sdf);
+//          startDate = date.getTime()/1000;
+            now.add(Calendar.DAY_OF_MONTH, -30);
+            startDate = now.getTime().getTime()/1000;
+            //stDate = now.getTime();
+            now.add(Calendar.DAY_OF_MONTH, -15);
+            startDate2 = now.getTime().getTime()/1000;
 //            stDate2 = now.getTime();
 //            stDate2 = now.getTime();
-             list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVDd3Zpjq3Tycy"));
-            // list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVDd3Zpjq3Tycy"));
+            //获取审批通过
+             list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVDd3Zpjq3Tycy","2"));
+            list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVDd3Zpjq3Tycy","2"));
+            //获取审批通过又撤销
+             lists.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVDd3Zpjq3Tycy","6"));
+             lists.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"","Bs7yC3swLeNVwa2WyLsSXVL5XV6kVDd3Zpjq3Tycy","6"));
+             if (lists!=null&&lists.size()>0){
+                 vacationService.removeByIds(lists);
+             }
                     for (String ls:list){//循环审批id
                     for (String ls:list){//循环审批id
                         Vacation vacation = WeixinVacationdetail(ls);
                         Vacation vacation = WeixinVacationdetail(ls);
                         if (vacation!=null) {
                         if (vacation!=null) {
                             Boolean t = vacationService.saveVacation(vacation);
                             Boolean t = vacationService.saveVacation(vacation);
-                        }
+             }
             }
             }
+                vacationService.deleteByDate();
         }catch (Exception e){
         }catch (Exception e){
             e.printStackTrace();
             e.printStackTrace();
             StringWriter sw = new StringWriter();
             StringWriter sw = new StringWriter();