LiGuang há 3 anos atrás
pai
commit
e4211fcb59

+ 2 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/salary/mapper/SalaryMapper.java

@@ -18,4 +18,6 @@ public interface SalaryMapper extends BaseMapper<Salary> {
 
     int addSalaryByU8(List<Salary>list);
 
+    int delSalaryByUserId(@Param("userid")String userid,@Param("date")String date);
+
 }

+ 9 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/salary/mapper/xml/SalaryMapper.xml

@@ -50,6 +50,15 @@
             )
         </foreach>
     </insert>
+    <delete id="delSalaryByUserId">
+        delete from geke_gz_body where 1=1
+        <if test="userid!=null and ''!=userid">
+            and user_id=#{userid}
+        </if>
+        <if test="date!=null and ''!=date">
+         and date_format(wages_date,'%Y-%m')=date_format(#{date},'%Y-%m')
+        </if>
+    </delete>
 
     <select id="querySalary" resultType="org.jeecg.modules.geke.salary.entity.Salary">
         select *from geke_gz_body where 1=1

+ 1 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/salary/service/ISalaryService.java

@@ -15,4 +15,5 @@ import java.util.List;
 public interface ISalaryService extends IService<Salary> {
     List<Salary> querySalary(String headerId,String date);
     int addSalaryByU8(List<Salary>list);
+    int delSalaryByUserId(String userid,String date);
 }

+ 5 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/salary/service/impl/SalaryServiceImpl.java

@@ -33,4 +33,9 @@ public class SalaryServiceImpl extends ServiceImpl<SalaryMapper, Salary> impleme
     public int addSalaryByU8(List<Salary> list) {
         return salaryMapper.addSalaryByU8(list);
     }
+
+    @Override
+    public int delSalaryByUserId(String userid, String date) {
+        return salaryMapper.delSalaryByUserId(userid,date);
+    }
 }

+ 15 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/sysFile/controller/SysFileController.java

@@ -112,7 +112,21 @@ public class SysFileController extends JeecgController<SysFile, ISysFileService>
 		sysFileService.removeById(id);
 		return Result.OK("删除成功!");
 	}
-	
+
+
+	 /**
+	  * 通过userid删除
+	  *
+	  * @param id
+	  * @return
+	  */
+	 @AutoLog(value = "文件-通过userid删除")
+	 @ApiOperation(value="文件-通过userid删除", notes="文件-通过userid删除")
+	 @DeleteMapping(value = "/deleteById")
+	 public Result<?> deleteById(@RequestParam(name="userid",required=true) String userid,@RequestParam(name="name",required=true) String name) {
+		 sysFileService.deleteById(userid,name);
+		 return Result.OK("删除成功!");
+	 }
 	/**
 	 * 批量删除
 	 *

+ 2 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/sysFile/mapper/SysFileMapper.java

@@ -18,4 +18,6 @@ public interface SysFileMapper extends BaseMapper<SysFile> {
 
     int deleteByUserId(@Param("userid")String userid);
 
+    int deleteById(@Param("userid")String userid,@Param("name")String name);
+
 }

+ 9 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/sysFile/mapper/xml/SysFileMapper.xml

@@ -7,6 +7,15 @@
             and user_id=#{userid}
         </if>
     </delete>
+    <delete id="deleteById">
+        delete from sys_txt where 1=1
+        <if test="userid!=null and''!=userid">
+            and user_id=#{userid}
+        </if>
+<if test="name!=null and ''!=name">
+    and txt_name=#{name}
+</if>
+    </delete>
 
     <select id="queryByUserId" resultType="org.jeecg.modules.geke.sysFile.entity.SysFile">
         select *from sys_txt where 1=1

+ 3 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/sysFile/service/ISysFileService.java

@@ -16,4 +16,7 @@ public interface ISysFileService extends IService<SysFile> {
     List<SysFile> queryByUserId(String userid);
 
     int deleteByUserId(String userid);
+
+    int deleteById(String userid,String name);
+
 }

+ 5 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/sysFile/service/impl/SysFileServiceImpl.java

@@ -30,4 +30,9 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
     public int deleteByUserId(String userid) {
         return sysFileMapper.deleteByUserId(userid);
     }
+
+    @Override
+    public int deleteById(String userid, String name) {
+        return sysFileMapper.deleteById(userid,name);
+    }
 }

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml

@@ -399,9 +399,9 @@ on a.depart_name=b.orgCodeTxt
     <select id="tpUser" resultType="org.jeecg.modules.system.entity.SysUser">
 		select *from sys_user where sy_state='0'
 	<if test="state!=null and ''!=state">
-	and	info_sy=#{state} or info_sy='3'
+	and	info_sy in (#{state},'3')
 	</if>
-
+	and del_flag='0'
 	</select>
 	<select id="usersByIds" resultType="org.jeecg.modules.system.entity.SysUser">
 		select *from sys_user where 1=1

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

@@ -211,13 +211,14 @@ public class WeixinUserImpl implements IWeixinUserService{
                     Boolean aBoolean = sysUserDepartService.saveUserDepart(sysUserDepart);
                 }
             }
-            sysUser.setCode(ls.getUserid());
-            sysUser.setUsername(ls.getUserid());
+            sysUser.setCode(workNo);
+            sysUser.setUsername(workNo);
             sysUser.setWorkNo(workNo);
             sysUser.setDepartIds(depids);
             sysUser.setCategory(101);
             sysUser.setEmploymentStatus(10);
             sysUser.setInfoSy(3);
+            sysUser.setSfzType("1");
             Boolean add = sysUserService.add(sysUser,sysUserRole);
         }catch (Exception e){
             e.printStackTrace();
@@ -383,7 +384,6 @@ public class WeixinUserImpl implements IWeixinUserService{
             SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
             Map<String, Object> params = Maps.newHashMap();
             List<SysUser> list = sysUserService.tpUser("1");
-
             List<String>idents=new ArrayList<>();
             if (list.size() > 0) {
                 for (SysUser ls : list) {
@@ -533,7 +533,7 @@ public class WeixinUserImpl implements IWeixinUserService{
             params.put("endtime", endDate);
             lists.add(userIds);
             if (userIds.size()>100){
-                lists= groupList(userIds);
+                lists= groupList(100,userIds);
             }
             for (List li:lists){
                 params.put("useridlist", li);
@@ -569,33 +569,34 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getToken();
         UrlData.getSignToken();
         String msg="ok";
+        List<WeixinSign> weixinSigns=new ArrayList<>();
+        List<Attendance>lists=new ArrayList<>();
         Calendar calendar = Calendar.getInstance();//获取系统时间实列
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         int actualMaximum = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);//获取前端传过来的时间获取月份的总天数
-//        String sDate = "";
-//        String eDate = "";
         Date stDate = null;
         Date enDate = null;
+        Date stDate2 = null;
         long startDate;
+        long startDate2;
         long endDate;
         Calendar now = Calendar.getInstance();
         endDate =now.getTime().getTime()/1000;
-        enDate = now.getTime();
+        enDate = now.getTime();//当前日期
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
-        stDate = now.getTime();
-//        sDate = simpleDateFormat.format(new Date()) + "-01 00:00:00";
-//        eDate = simpleDateFormat.format(new Date())  + "-" + actualMaximum + " 23:59:59";
-//        stDate = sdf.parse(sDate);
-//        enDate = sdf.parse(eDate);
-//        startDate = stDate.getTime() / 1000;
-//        endDate = enDate.getTime() / 1000;
+        stDate = now.getTime();//当前日期前30天
+        now.add(Calendar.DAY_OF_MONTH, -30);
+        startDate2 = now.getTime().getTime()/1000;
+        stDate2 = now.getTime();//当前日期前60天
+
         try {
             List<String> list = WeixinUserIdList();
             if (list != null && list.size() > 0) {
-                attendanceService.DeleteDateAttendance(sdf.format(stDate), sdf.format(enDate), list);
-                List<WeixinSign> weixinSigns = WeixinSignList(String.valueOf(startDate), String.valueOf(endDate), list);
+                attendanceService.DeleteDateAttendance(sdf.format(stDate2), sdf.format(enDate), list);
+                weixinSigns.addAll(WeixinSignList(String.valueOf(startDate), String.valueOf(endDate), list));
+                weixinSigns.addAll(WeixinSignList(String.valueOf(startDate2), String.valueOf(startDate), list));
                 if (weixinSigns != null && weixinSigns.size() > 0) {
                     for (WeixinSign wxlist : weixinSigns) {
                         Attendance attendance = new Attendance();
@@ -616,7 +617,13 @@ public class WeixinUserImpl implements IWeixinUserService{
                         }
                         Date dat = new Date(lt * 1000);
                         attendance.setUserDate(dat);
-                        Boolean aBoolean = attendanceService.saveAcctend(attendance);
+                       lists.add(attendance);
+                    }
+                    List<List<Attendance>> lt = groupWeixinSign(5000, lists);
+                    if (lt!=null&&lt.size()>0){
+                        lt.forEach(str->{
+                            attendanceService.saveBatch(str);
+                        });
                     }
                 }
             }
@@ -664,7 +671,7 @@ public class WeixinUserImpl implements IWeixinUserService{
             }
             syYearCount=new BigDecimal(syYearCount).divide(new BigDecimal("24"),1,BigDecimal.ROUND_DOWN).toString();
             syYearCount=new BigDecimal(yearCount).subtract(new BigDecimal(syYearCount)).toString();
-        }else {
+        } else {
             syYearCount=yearCount;
         }
 
@@ -697,29 +704,27 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getVacationToken();
         UrlData.getToken();
         String msg="ok";
-
-            Calendar now = Calendar.getInstance();//获取系统时间实列
+        List<String> list =new ArrayList<>();
+        Calendar now = Calendar.getInstance();//获取系统时间实列
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             int actualMaximum = now.getActualMaximum(Calendar.DAY_OF_MONTH);//获取前端传过来的时间获取月份的总天数
-            String sDate = "";
-            String eDate = "";
             Date stDate = null;
+            Date stDate2 = null;
             Date enDate = null;
             long startDate;
+            long startDate2;
             long endDate;
         endDate =now.getTime().getTime()/1000;
         enDate = now.getTime();
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
         stDate = now.getTime();
-//            sDate = simpleDateFormat.format(new Date()) + "-01 00:00:00";
-//            eDate = simpleDateFormat.format(new Date()) + "-" + actualMaximum + " 23:59:59";
-//            stDate = sdf.parse(sDate);
-//            enDate = sdf.parse(eDate);
-//            startDate = stDate.getTime() / 1000;
-//            endDate = enDate.getTime() / 1000;
-            List<String> list = WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"5");
+        now.add(Calendar.DAY_OF_MONTH, -30);
+        startDate2 = now.getTime().getTime()/1000;
+        stDate2 = now.getTime();
+        list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"5"));
+        list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"5"));
             for (String ls:list){//循环审批id
                 workOvertime workOvertime = WeixinWorks(ls);
                 if (workOvertime!=null) {
@@ -728,7 +733,6 @@ public class WeixinUserImpl implements IWeixinUserService{
                     }catch (Exception e){
                         e.printStackTrace();
                     }
-
                 }
             }
         return null;
@@ -761,12 +765,6 @@ public class WeixinUserImpl implements IWeixinUserService{
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
         stDate = now.getTime();
-//        sDate = simpleDateFormat.format(new Date()) + "-01 00:00:00";
-//        eDate = simpleDateFormat.format(new Date()) + "-" + actualMaximum + " 23:59:59";
-//        stDate = sdf.parse(sDate);
-//        enDate = sdf.parse(eDate);
-//        startDate = stDate.getTime() / 1000;
-//        endDate = enDate.getTime() / 1000;
         List<String> list = WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),null);
         userQuitService.deleteQuit(sDate,eDate);
         for (String ls:list){//循环审批id
@@ -792,29 +790,28 @@ public class WeixinUserImpl implements IWeixinUserService{
         UrlData.getVacationToken();
         UrlData.getToken();
         String msg="ok";
+        List<String> list=new ArrayList<>();
         Calendar now = Calendar.getInstance();//获取系统时间实列
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         int actualMaximum = now.getActualMaximum(Calendar.DAY_OF_MONTH);//获取前端传过来的时间获取月份的总天数
-        String sDate = "";
-        String eDate = "";
         Date stDate = null;
+        Date stDate2 = null;
         Date enDate = null;
         long startDate;
+        long startDate2;
         long endDate;
         endDate =now.getTime().getTime()/1000;
         enDate = now.getTime();
         now.add(Calendar.DAY_OF_MONTH, -30);
         startDate = now.getTime().getTime()/1000;
         stDate = now.getTime();
-//        sDate = simpleDateFormat.format(new Date()) + "-01 00:00:00";
-//        eDate = simpleDateFormat.format(new Date()) + "-" + actualMaximum + " 23:59:59";
-//        stDate = sdf.parse(sDate);
-//        enDate = sdf.parse(eDate);
-//        startDate = stDate.getTime() / 1000;
-//        endDate = enDate.getTime() / 1000;
-        List<String> list = WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"2");
-        makeUpCardService.deleteDate(sDate);
+        now.add(Calendar.DAY_OF_MONTH, -30);
+        startDate2 = now.getTime().getTime()/1000;
+        stDate2 = now.getTime();
+        list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"2"));
+        list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"2"));
+        makeUpCardService.deleteDate(sdf.format(startDate2));
         List<MakeUpCard>ls=new ArrayList<>();
         list.forEach(str->{
             try {
@@ -1179,30 +1176,28 @@ public class WeixinUserImpl implements IWeixinUserService{
       UrlData.getVacationToken();
       UrlData.getToken();
       String msg="ok";
+      List<String> list =new ArrayList<>();
         try {
             Calendar now = Calendar.getInstance();//获取系统时间实列
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");//日期格式化
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             int actualMaximum = now.getActualMaximum(Calendar.DAY_OF_MONTH);//获取前端传过来的时间获取月份的总天数
-            String sDate = "";
-            String eDate = "";
             Date stDate = null;
+            Date stDate2 = null;
             Date enDate = null;
             long startDate;
+            long startDate2;
             long endDate;
             endDate =now.getTime().getTime()/1000;
             enDate = now.getTime();
             now.add(Calendar.DAY_OF_MONTH, -30);
             startDate = now.getTime().getTime()/1000;
             stDate = now.getTime();
-//            sDate = simpleDateFormat.format(new Date()) + "-01 00:00:00";
-//            eDate = simpleDateFormat.format(new Date()) + "-" + actualMaximum + " 23:59:59";
-//            stDate = sdf.parse(sDate);
-//            enDate = sdf.parse(eDate);
-//            startDate = stDate.getTime() / 1000;
-//            endDate = enDate.getTime() / 1000;
-            UrlData.getVacationToken();
-            List<String> list = WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"1");
+            now.add(Calendar.DAY_OF_MONTH, -30);
+            startDate2 = now.getTime().getTime()/1000;
+            stDate2 = now.getTime();
+             list.addAll(WeixinVacationList(String.valueOf(startDate), String.valueOf(endDate),"1"));
+             list.addAll(WeixinVacationList(String.valueOf(startDate2), String.valueOf(startDate),"1"));
                     for (String ls:list){//循环审批id
                         Vacation vacation = WeixinVacationdetail(ls);
                         if (vacation!=null) {
@@ -1319,6 +1314,7 @@ public class WeixinUserImpl implements IWeixinUserService{
                     map.put("cpsnemail", ls.getEmail());
                     map.put("rIDType", "0");
                     map.put("rpersontype", ls.getCategory());
+                    map.put("vIDNo", ls.getSfzCode());
                     String tyname="";
                     if (ls.getCategory()!=null&&ls.getCategory().equals("101")){
                         tyname="正式工";
@@ -1386,6 +1382,7 @@ public class WeixinUserImpl implements IWeixinUserService{
         ObjectMapper mapper = new ObjectMapper();
         List<JSONObject> list=new ArrayList<>();
         Calendar cal = Calendar.getInstance();
+        cal.add(Calendar.MONTH,-1);
         int year = cal.get(Calendar.YEAR);
         int month = cal.get(Calendar.MONTH )+1;
         getToaccount();
@@ -1421,12 +1418,12 @@ public class WeixinUserImpl implements IWeixinUserService{
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         ObjectMapper mapper=new ObjectMapper();
         if (salary.size()>0){
+            salaryService.delSalaryByUserId("",salary.get(0).get("year").toString()+"-"+salary.get(0).get("month").toString()+"-01 00:00:00");
             for (JSONObject js:salary) {
                 Salary salarys = new Salary();
                 salarys.setUserId(js.get("personno").toString());
                 salarys.setId(UUIDGenerator.generate());
                 salarys.setWagesDate(sdf.parse(js.get("year").toString()+"-"+js.get("month").toString()+"-01 00:00:00"));
-                System.out.println(js.get("entry"));
                 List<Map> st=(List<Map>) js.get("entry");
                 st.forEach(lt->{
                     if (lt.get("name").equals("基本工资")){
@@ -1533,13 +1530,13 @@ public class WeixinUserImpl implements IWeixinUserService{
         getToaccount= prop.getProperty("to_account");
 
     }
-    public static List<List<String>> groupList(List<String> list) {
+    public static List<List<String>> groupList(int size,List<String> list) {
         List<List<String>> listGroup = new ArrayList<List<String>>();
         int listSize = list.size();
         //子集合的长度
-        int toIndex = 100;
-        for (int i = 0; i < list.size(); i += 100) {
-            if (i + 100 > listSize) {
+        int toIndex = size;
+        for (int i = 0; i < list.size(); i += toIndex) {
+            if (i + toIndex > listSize) {
                 toIndex = listSize - i;
             }
             List<String> newList = list.subList(i, i + toIndex);
@@ -1547,5 +1544,20 @@ public class WeixinUserImpl implements IWeixinUserService{
         }
         return listGroup;
     }
+
+    public static List<List<Attendance>> groupWeixinSign(int size,List<Attendance> list) {
+        List<List<Attendance>> listGroup = new ArrayList<List<Attendance>>();
+        int listSize = list.size();
+        //子集合的长度
+        int toIndex = size;
+        for (int i = 0; i < list.size(); i += toIndex) {
+            if (i + toIndex > listSize) {
+                toIndex = listSize - i;
+            }
+            List<Attendance> newList = list.subList(i, i + toIndex);
+            listGroup.add(newList);
+        }
+        return listGroup;
+    }
 }