ysh 3 năm trước cách đây
mục cha
commit
0446faac1b

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

@@ -29,6 +29,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 public class ViewClockIn {
 	@TableField(exist = false)
 	private String allDate;//当月所有日期
+	private String ifwork;//固定班次是否需要考勤 (0不需要,其他需要)
 
 	private String pkId;//临时主键 (例:100131&2021-12-01)
 	/**真实姓名*/

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

@@ -56,7 +56,7 @@ public class bdClockinMonth {
 
 	private String months;//月份
 
-	private String departId;//月份
+	private String departId;//
 
 	private Integer syU8;//是否同步至u8(0否,1是)
 

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

@@ -43,6 +43,16 @@ public interface bdClockinMonthMapper extends BaseMapper<bdClockinMonth> {
     @DS("multi-datasource1")
     List<Map<String,Object>> selectTest();
 
+    /**
+     * 查询U8薪资表中是否存在人员数据
+     * @param cPsnNum
+     * @param iYear
+     * @param iMonth
+     * @return
+     */
+   @DS("multi-datasource1")
+    List<Map<String,Object>> selectIsExist(@Param("cPsnNum") String cPsnNum,@Param("iYear") String iYear,@Param("iMonth") int iMonth);
+
     /**
      * 批量插入U8月报
      * @param list
@@ -51,6 +61,14 @@ public interface bdClockinMonthMapper extends BaseMapper<bdClockinMonth> {
     @DS("multi-datasource1")
     int insertU8WaGZData(List<bdClockinMonth> list);
 
+    /**
+     * 批量更新U8月报
+     * @param list
+     * @return
+     */
+    @DS("multi-datasource1")
+    int updateU8WaGZData(@Param("list") List<bdClockinMonth> list);
+
     int updateSy(@Param("list") List<bdClockinMonth> list);
 
 }

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

@@ -97,6 +97,82 @@
     <select id="selectTest" resultType="Map">
         select * from U8_CRM_Stock
     </select>
+
+    <select id="selectIsExist" resultType="Map">
+        select cPsn_Num from WA_GZData where cPsn_Num = #{cPsnNum} and iYear = #{iYear} and iMonth = #{iMonth}
+    </select>
+
+    <update id="updateU8WaGZData" parameterType="java.util.List">
+
+     <!--   <foreach collection="list" item="item" index="index" separator=",">
+            update WA_GZData
+                <set>
+            <if test="item.basePay != null and item.basePay != ''">
+                 F_8 = #{item.basePay},
+            </if>
+            <if test="item.basePay_2 != null and item.basePay_2 != ''">
+                F_52 = #{item.basePay_2},
+             </if>
+            <if test="item.workDay != null and item.workDay != ''">
+                F_10 = #{item.workDay},
+            </if>
+            <if test="item.wagesBase != null and item.wagesBase != ''">
+                F_51 = #{item.wagesBase},
+            </if>
+            <if test="item.workDayReal != null and item.workDayReal != ''">
+                F_53 = #{item.workDayReal},
+            </if>
+            <if test="item.workDayReal1 != null and item.workDayReal1 != ''">
+                F_54 = #{item.workDayReal1},
+            </if>
+            <if test="item.duration != null and item.duration != ''">
+                F_55 = #{item.duration},
+            </if>
+            <if test="item.holidayTimeSj != null and item.holidayTimeSj != ''">
+                F_56 = #{item.holidayTimeSj},
+            </if>
+            <if test="item.syFund != null and item.syFund != ''">
+                F_58 = #{item.syFund}
+            </if>
+                </set>
+        where cPsn_Num = #{item.personCode} and iYear = #{item.years} and iMonth = #{item.months}
+        </foreach>
+-->
+        <foreach collection="list" item="item" index="index" separator=",">
+            update WA_GZData set cPsn_Num = #{item.personCode}
+                <if test="item.basePay != null and item.basePay != ''">
+                    ,F_8 = #{item.basePay} <!-- 基本工资1-->
+                </if>
+                <if test="item.basePay_2 != null and item.basePay_2 != ''">
+                    ,F_52 = #{item.basePay_2} <!-- 基本工资2-->
+                </if>
+                <if test="item.workDay != null and item.workDay != ''">
+                    , F_10 = #{item.workDay} <!-- 考勤天数1 -->
+                </if>
+                <if test="item.workDay_2 != null and item.workDay_2 != ''">
+                    , F_10 = #{item.workDay_2} <!-- 考勤天数2 -->
+                </if>
+                <if test="item.workDayReal != null and item.workDayReal != ''">
+                    , F_53 = #{item.workDayReal} <!-- 实际考勤天数1-->
+                </if>
+                <if test="item.workDayReal_2 != null and item.workDayReal_2 != ''">
+                    ,F_54 = #{item.workDayReal_2} <!-- 实际考勤天数2-->
+                </if>
+                <if test="item.wagesBase != null and item.wagesBase != ''">
+                    , F_51 = #{item.wagesBase} <!-- 缴交基数1-->
+                </if>
+                <if test="item.duration != null and item.duration != ''">
+                    ,F_55 = #{item.duration} <!-- 本月加班时长-->
+                </if>
+                <if test="item.holidayTimeSj != null and item.holidayTimeSj != ''">
+                    , F_56 = #{item.holidayTimeSj} <!-- 本月请假时长-->
+                </if>
+                <if test="item.syFund != null and item.syFund != ''">
+                    ,F_58 = #{item.syFund} <!-- 公积金账号-->
+                </if>
+            where cPsn_Num = #{item.personCode} and iYear = #{item.years} and iMonth = #{item.months}
+        </foreach>
+    </update>
     
     <insert id="insertU8WaGZData" parameterType="java.util.List" useGeneratedKeys="false">
         insert into WA_GZData

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

@@ -45,7 +45,7 @@
         select A.depart_name,count(b.username) errornum from sys_depart A left join (
         select b.username,b.depart_names from view_clock_in_1 b
         where DATE_FORMAT(b.view_date,'%Y-%m') = #{viewDate}
-        and (b.lateTime_s &lt; 0 or b.lateTime_x > 0 || b.shift_real_time_s is null || b.shift_real_time_s = '')
+        and (b.lateTime_s &lt; 0 or b.lateTime_x > 0 || b.shift_real_time_s is null || b.shift_real_time_s = '' || (b.ifwork !=0 and attendance_Count &lt; 2))
         and (b.set_info is null or b.set_info = '')
         group by b.username,b.depart_names
 
@@ -62,7 +62,7 @@
         select a.username,a.realname,a.depart_ids departids,a.category,b.errornum from sys_user A left join (
         select b.username,count(1) as errornum from view_clock_in_1 b
         where DATE_FORMAT(b.view_date,'%Y-%m') = #{viewDate}
-        and (b.lateTime_s &lt; 0 or b.lateTime_x > 0 || b.shift_real_time_s is null || b.shift_real_time_s = '')
+        and (b.lateTime_s &lt; 0 or b.lateTime_x > 0 || b.shift_real_time_s is null || b.shift_real_time_s = '' || (b.ifwork !=0 and attendance_Count &lt; 2))
         and (b.set_info is null or b.set_info = '')
         group by b.username
         ) B

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

@@ -60,7 +60,22 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
     public String reportIntoU8Job(String nowDate,String[] arr){
         List<bdClockinMonth> list = clockinMonthMapper.selectAllByMonth(nowDate,arr);//获取当月要同步的数据
         if(list.size() > 0){
-            int st = clockinMonthMapper.insertU8WaGZData(list);//插入u8数据库表WA_GZData
+
+            String cPsnNum = "";//人员编码
+            String iYear = "";//年度
+            int iMonth = 0;//月份
+
+            for(bdClockinMonth o:list){
+                cPsnNum = o.getPersonCode();
+                iYear = o.getYears();
+                iMonth = Integer.valueOf(o.getMonths());
+                List<Map<String,Object>> map = clockinMonthMapper.selectIsExist(cPsnNum,iYear,iMonth);
+                if(map.size() < 1){
+                    return "人员:"+cPsnNum+o.getPersonName()+" 没有在U8中维护数据,请维护后再次操作";
+                }
+            }
+
+            int st = clockinMonthMapper.updateU8WaGZData(list);//更新u8数据库表WA_GZData
             if(st != 0){
                 clockinMonthMapper.updateSy(list);//更新月报同步状态
             }