ysh 3 anos atrás
pai
commit
84125bd7e0

+ 26 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/controller/viewClockInController.java

@@ -133,6 +133,11 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 //		 System.out.println(sdf.parse("2021-12-12 20:12:12"));
 	 }
 
+	 /**
+	  * 同步考勤月报至U8
+	  * @param jsonObject
+	  * @return
+	  */
 	 @RequestMapping(value = "/syMonthReport", method = RequestMethod.PUT)
 	 public Result<?> syMonthReport(@RequestBody JSONObject jsonObject) {
 
@@ -143,7 +148,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 //		 List<bdClockinMonth> list = bdClockinMonthService.selectAllByMonth(viewDate,userId);
 		 	try {
 				String err = bdClockinMonthService.reportIntoU8Job(viewDate,userId);
-				if(StringUtil.isNullOrEmpty(err)){
+				if(!StringUtil.isNullOrEmpty(err)){
 					return Result.error(err);
 				}
 			}catch (Exception e){
@@ -153,6 +158,11 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 		 return Result.OK("true");
 	 }
 
+	 /**
+	  * 生成考勤月报
+	  * @param jsonObject
+	  * @return
+	  */
 	 @RequestMapping(value = "/monthReport", method = RequestMethod.PUT)
 	 public Result<?> monthReport(@RequestBody JSONObject jsonObject) {
 
@@ -178,12 +188,27 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 
 			 List<bdClockinMonth> list = bdClockinMonthService.selectByMonth(nowDate,userList);
 
+//			 List<bdClockinMonth> list2 = bdClockinMonthService.selectSyByMonth(nowDate,userList);
+
 			 if(list.size() == 0){
 				 return Result.error("当前月份没有考勤数据,无法生成月报!");
 			 }
 
 			 bdClockinMonthService.deleteByMonth(nowDate,userList);
 			 for(bdClockinMonth o:list){
+
+			 	if(o.getSyU8() != null && (o.getSyU8().equals(1) || o.getSyU8() == 1)){
+					System.out.println(o.getPersonName());
+			 		continue;
+				}
+
+			 	if(!StringUtil.isNullOrEmpty(o.getDepartId())){
+			 		String[] dept = o.getDepartId().split(",");
+			 		if(dept.length > 0){
+			 			o.setDepartId(dept[0]);
+					}
+				}
+
 			 	o.setMonthTime(nowDate);
 			 	o.setYears(date[0]);
 			 	o.setMonths(date[1]);

+ 4 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/bdClockinMonth.java

@@ -50,12 +50,15 @@ public class bdClockinMonth {
 	private String isAttendance;//免打卡 (0打卡,1免打卡)
 	private String isSalary;//是否算薪(0是,1否)
 	private String syFund;//公积金账号
+	private String category;//人员类别
 
 	private String years;//年度
 
 	private String months;//月份
 
-	private int syU8;//是否同步至u8(0否,1是)
+	private String departId;//月份
+
+	private Integer syU8;//是否同步至u8(0否,1是)
 
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
 	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/bdClockinMonthMapper.java

@@ -30,6 +30,14 @@ public interface bdClockinMonthMapper extends BaseMapper<bdClockinMonth> {
      */
     public List<bdClockinMonth> selectAllByMonth(@Param("nowDate") String nowDate,@Param("userId") String[] userId);
 
+    /**
+     * 查询已同步的数据
+     * @param nowDate
+     * @param userId
+     * @return
+     */
+    public List<bdClockinMonth> selectSyByMonth(@Param("nowDate") String nowDate,@Param("userId") String[] userId);
+
     int deleteByMonth(@Param("nowDate") String nowDate,@Param("userId")List<String> userId);
 
     @DS("multi-datasource1")

+ 46 - 25
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/bdClockinMonthMapper.xml

@@ -4,7 +4,8 @@
 
     <select id="selectByMonth" parameterType="java.util.List" resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
 
-        select c.sy_fund,c.is_salary,c.is_attendance,c.id personId,c.work_no personCode,c.realname personName,c.depart_ids,c.wages_one basePay,
+        select m.sy_u8, c.depart_ids departId,c.category,c.sy_fund,c.is_salary,c.is_attendance,c.id personId,c.work_no personCode,
+               c.realname personName,c.depart_ids,c.wages_one basePay,
                c.wages_two,c.security,c.wages_base,B.duration
              ,sj.holiday_time_sj,bj.holiday_time_bj
         from sys_user C left join  (
@@ -42,6 +43,8 @@
         group by user_id
         ) bj on bj.user_id = C.id
 
+        left join bd_clockin_month m on c.id = m.person_id and m.month_time = #{nowDate}
+
         where C.del_flag='0' and C.info_sy in(2,3)
         and c.employment_status = '10'
           <if test="userId != null and userId != '' and userId.size >0">
@@ -52,27 +55,6 @@
               )
           </if>
 
-<!--        select a.view_date monthTime,a.years,a.months,a.realname personName,a.user_id personId,a.username personCode,
-            sum(a.lateTime_s) latetimeS,sum(a.lateTime_x) latetimeX ,sum(a.duration) duration,sum(a.sj_time) holidayTime
-            from (
-                select realname,user_id,username,DATE_FORMAT(view_date,'%Y-%m') view_date,
-                    DATE_FORMAT(view_date,'%Y') years,
-                    DATE_FORMAT(view_date,'%m') months,
-                case
-                    when lateTime_s &lt; 0 then 0
-                    else lateTime_s
-                end lateTime_s,
-                case
-                    when lateTime_x &lt; 0 then 0
-                    else lateTime_x
-                end lateTime_x,
-                duration,
-                TIMESTAMPDIFF(day,holiday_start_date,holiday_end_date) sj_time,
-                holiday_type,holiday_start_date,holiday_end_date from view_clock_in_1
-                where DATE_FORMAT(view_date,'%Y-%m') = #{nowDate}
-            ) as a
-        group by a.realname,a.user_id,a.username,a.view_date,a.years,a.months
--->
     </select>
 
     <select id="selectAllByMonth"  resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
@@ -87,8 +69,21 @@
         </if>
     </select>
 
+
+    <select id="selectSyByMonth"  resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
+        select * from
+               bd_clockin_month where sy_u8 = 1 and is_salary ='0' and month_time = #{nowDate}
+        <if test="userId != null and userId != '' and userId.length >0">
+            and id in(
+            <foreach collection="userId" item="item" index="index" separator=",">
+                #{item}
+            </foreach>
+            )
+        </if>
+    </select>
+
     <delete id="deleteByMonth">
-        delete from bd_clockin_month where month_time = #{nowDate}
+        delete from bd_clockin_month where sy_u8 = 0 and month_time = #{nowDate}
         <if test="userId != null and userId != '' and userId.size >0">
             and person_id in(
             <foreach collection="userId" item="item" index="index" separator=",">
@@ -110,7 +105,21 @@
              cPsn_Name ,<!--人员姓名-->
              iYear,<!--工资年份 -->
              iMonth,<!--工资月份 -->
-             cDept_Num<!--部门编码 -->
+             cDept_Num,<!--部门编码 -->
+        <!-- iRecordID,不为空 -->
+             F_1099,F_1100, F_1101,F_1102, F_1103,F_1104,F_1105,F_1106,F_1107,F_1108,F_1112,F_1113,F_1114,F_1115,F_1116,F_1117,F_1118,
+             F_8,<!-- 基本工资-->
+             F_52,<!-- 基本工资2-->
+             F_10,<!--考勤天数-->
+        <!--  F_26,节假日加班小时数-->
+        <!--  F_29,病假天数-->
+        <!--  F_33, 平时加班结算小时数-->
+             F_51,<!-- 缴费基数-->
+             F_53,<!-- 工作天数-->
+             F_54,<!-- 工作天数1-->
+             F_55,<!-- 加班小时-->
+             F_56,<!-- 请假天数-->
+             F_58<!-- 公积金账号-->
             )
         values
         <foreach collection="list" item="item" index="index" separator=",">
@@ -120,7 +129,19 @@
                #{item.personName},
                #{item.years},
                #{item.months},
-               '01'
+               #{item.departId},
+              <!--  '111',-->
+               '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0',
+               #{item.basePay},
+               #{item.basePay_2},
+               #{item.workDay},
+               '0.9',
+               #{item.workDayReal},
+               #{item.workDayReal_2},
+               #{item.duration},
+               #{item.holidayTimeSj},
+               #{item.syFund}
+
             )
         </foreach>
     </insert>

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/IbdClockinMonthService.java

@@ -19,6 +19,7 @@ public interface IbdClockinMonthService extends IService<bdClockinMonth> {
     List<bdClockinMonth> selectByMonth(String nowDate,List<String> userId);
 
     List<bdClockinMonth> selectAllByMonth(String nowDate,String[] userId);
+    List<bdClockinMonth> selectSyByMonth(String nowDate,String[] userId);
 
     int deleteByMonth(String nowDate,List<String> userId);
 

+ 5 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/impl/bdClockinMonthServiceImpl.java

@@ -33,6 +33,10 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
         return clockinMonthMapper.selectAllByMonth(nowDate,userId);
     }
 
+    public List<bdClockinMonth> selectSyByMonth(String nowDate,String[] userId){
+        return clockinMonthMapper.selectSyByMonth(nowDate,userId);
+    }
+
     public int deleteByMonth(String nowDate,List<String> userId){
         return clockinMonthMapper.deleteByMonth(nowDate,userId);
     }
@@ -61,7 +65,7 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
                 clockinMonthMapper.updateSy(list);//更新月报同步状态
             }
         }else{
-            return "所选条件,无匹配数据上传";
+            return "所选条件,未匹配到可上传数据";
         }
 
         return "";