From 22d8b68b19e35bdd2086fd047296abe440639f32 Mon Sep 17 00:00:00 2001
From: 杜洪波 <1074825718@qq.com>
Date: 星期四, 18 九月 2025 15:52:27 +0800
Subject: [PATCH] 代码提交

---
 src/main/java/com/product/administration/service/PunchRecordService.java |   66 +++++++++++++++++---------------
 1 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/src/main/java/com/product/administration/service/PunchRecordService.java b/src/main/java/com/product/administration/service/PunchRecordService.java
index 5d4b7e2..f4192a6 100644
--- a/src/main/java/com/product/administration/service/PunchRecordService.java
+++ b/src/main/java/com/product/administration/service/PunchRecordService.java
@@ -31,6 +31,7 @@
 import com.product.core.service.support.AbstractBaseService;
 import com.product.core.spring.context.SpringMVCContextHolder;
 import com.product.module.sys.entity.SystemUser;
+import com.product.util.UnifySQLFunction;
 
 /**
  * 	鎵撳崱璁板綍
@@ -53,8 +54,8 @@
 	 * @return
 	 */
 	public DataTableEntity listRecordInfo(FieldSetEntity fse) throws ParseException {
-		DataTableEntity dt=baseDao.listTable(CmnConst.PRODUCT_OA_PUNCH_RECORD, "created_by=?", new Object[] {SpringMVCContextHolder.getCurrentUser().getUser_id()}, null, CmnConst.CREATED_UTC_DATETIME+" DESC", fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE));
-		for (int i=0;i<dt.getRows();i++){
+		DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_PUNCH_RECORD, "created_by=?", new Object[] {SpringMVCContextHolder.getCurrentUser().getUser_id()}, null, CmnConst.CREATED_UTC_DATETIME+" DESC", fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE));
+		for (int i = 0; i < dt.getRows(); i++){
 			FieldSetEntity fieldSetEntity = dt.getData().get(i);
 			String punch_time_one = null;
 			if (fieldSetEntity.getString("punch_time_one") != null) {
@@ -83,18 +84,18 @@
 
 			//鑾峰彇浣跨敤鍒扮殑璁剧疆瑙勫垯
 			StringBuilder sbPunchTime=new StringBuilder();
-			sbPunchTime.append(" SELECT c.* ");
-			sbPunchTime.append(" FROM ( ");
-			sbPunchTime.append(" SELECT d.* ");
-			sbPunchTime.append(" FROM product_oa_punch_time d ");
-			sbPunchTime.append(" left JOIN product_oa_punch_record b ");
-			sbPunchTime.append(" on d.punch_site_uuid=b.punch_congfig_uuid and d.created_by=? where d.punch_site_uuid= ? ");
-			sbPunchTime.append(" ) c ");
-			sbPunchTime.append(" where  c.uuid in ( ");
-			sbPunchTime.append(" SELECT DISTINCT uuid ");
-			sbPunchTime.append(" FROM product_oa_punch_time ");
-			sbPunchTime.append(" where LOCATE(?, concat(attendance_object,','))>0 ");
-			sbPunchTime.append(" ) ");
+			sbPunchTime.append("\nSELECT c.* ");
+			sbPunchTime.append("\nFROM ( ");
+			sbPunchTime.append("\n  SELECT d.* ");
+			sbPunchTime.append("\n  FROM product_oa_punch_time d ");
+			sbPunchTime.append("\n  left JOIN product_oa_punch_record b ");
+			sbPunchTime.append("\n  on d.punch_site_uuid=b.punch_congfig_uuid and d.created_by=? where d.punch_site_uuid= ? ");
+			sbPunchTime.append("\n) c ");
+			sbPunchTime.append("\nwhere  c.uuid in ( ");
+			sbPunchTime.append("\n  SELECT DISTINCT uuid ");
+			sbPunchTime.append("\n  FROM product_oa_punch_time ");
+			sbPunchTime.append("\n where ").append(UnifySQLFunction.locateFunction("?", "concat(attendance_object,',')")).append(" >0 ");
+			sbPunchTime.append("\n) ");
 			DataTableEntity dataTableEntity = baseDao.listTable(sbPunchTime.toString(), param1.toArray());
 
 
@@ -104,13 +105,16 @@
 			param2.add(sign_date);
 
 			StringBuilder sbReplenish=new StringBuilder();
-			sbReplenish.append(" SELECT T1.id,T1.uuid,T1.created_by,T1.applicant,T1.replenish_date,T1.reason,");
-			sbReplenish.append(" SUBSTRING_INDEX( SUBSTRING_INDEX( T1.replacement_card_type, ',', T2.digit + 1 ), ',',- 1 ) AS type ");
-			sbReplenish.append(" FROM (select * from product_oa_replenish_punch where flow_flag=2) T1 ");
-			sbReplenish.append(" JOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 ) T2");
-			sbReplenish.append(" ON T2.digit < ( length( T1.replacement_card_type )- length( REPLACE ( T1.replacement_card_type, ',', '' ))+ 1 )");
-			sbReplenish.append(" where t1.created_by=? ");
-			sbReplenish.append(" and DATE_FORMAT( t1.replenish_date, '%Y-%m-%d' )=? ");
+			sbReplenish.append("\nSELECT");
+			sbReplenish.append("\n  T1.id,T1.uuid,T1.created_by,T1.applicant,T1.replenish_date,T1.reason,");
+			sbReplenish.append("\n  ").append(UnifySQLFunction.substringIndexFuntion(UnifySQLFunction.substringIndexFuntion("T1.replacement_card_type", ",", "T2.digit + 1"), ",", "- 1")).append(" AS type ");
+			sbReplenish.append("\nFROM (");
+			sbReplenish.append("\n  select * from product_oa_replenish_punch where flow_flag=2");
+			sbReplenish.append("\n) T1 ");
+			sbReplenish.append("\nJOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 ) T2");
+			sbReplenish.append("\nON T2.digit < ( length( T1.replacement_card_type )- length( REPLACE ( T1.replacement_card_type, ',', '' ))+ 1 )");
+			sbReplenish.append("\nwhere t1.created_by=? ");
+			sbReplenish.append("\nAND ").append(UnifySQLFunction.timeFunction("t1.replenish_date", "year_month_day")).append(" =? ");
 			DataTableEntity dataTableEntity1 = baseDao.listTable(sbReplenish.toString(), param2.toArray());
 			if(dataTableEntity1.getRows()!=0){
 
@@ -194,7 +198,7 @@
 						lateSb.append("涓婄彮鏈墦鍗�");
 					}
 
-					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_four"))){
+					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_four"))&&ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_range_four"))){
 						String punch_time_four = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_four"));
 						punch_time_four_date = DateUtil.parse(punch_time_four);
 						if(punch_time_four_date.before(afternoon_work_off_date)){
@@ -225,7 +229,7 @@
 
 					int distance = Integer.parseInt(dataTableEntity.getData().get(0).getValue("distance").toString());
 
-					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_one"))){
+					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_one"))&&ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_range_one"))){
 						String punch_time_one1 = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_one"));
 						punch_time_one_date = DateUtil.parse(punch_time_one1);
 						if(punch_time_one_date.after(morning_work_date)){
@@ -244,7 +248,7 @@
 
 					}
 
-					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_two"))){
+					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_two"))&&ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_range_two"))){
 						String punch_time_two= dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_two"));
 						punch_time_two_date = DateUtil.parse(punch_time_two);
 						if(punch_time_two_date.before(morning_work_off_date)){
@@ -260,7 +264,7 @@
 					}else {
 						earilySb.append("鏃╀笅鐝湭鎵撳崱"+" ");
 					}
-					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_three"))){
+					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_three"))&&ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_range_three"))){
 						String punch_time_three = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_three"));
 						punch_time_three_date = DateUtil.parse(punch_time_three);
 						if(punch_time_three_date.after(afternoon_work_date)){
@@ -275,7 +279,7 @@
 					}else {
 						lateSb.append("鏃╀笂鐝湭鎵撳崱"+" ");
 					}
-					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_four"))){
+					if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_four"))&&ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_range_four"))){
 						String punch_time_four = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_four"));
 						punch_time_four_date = DateUtil.parse(punch_time_four);
 						if(punch_time_four_date.before(afternoon_work_off_date)){
@@ -299,10 +303,10 @@
 			}
 
 		}
-		dt.setFieldFormat("punch_time_one", " HH:mm");
-		dt.setFieldFormat("punch_time_two", " HH:mm");
-		dt.setFieldFormat("punch_time_three", " HH:mm");
-		dt.setFieldFormat("punch_time_four", " HH:mm");
+		dt.setFieldFormat("punch_time_one", "HH:mm");
+		dt.setFieldFormat("punch_time_two", "HH:mm");
+		dt.setFieldFormat("punch_time_three", "HH:mm");
+		dt.setFieldFormat("punch_time_four", "HH:mm");
 		baseDao.loadPromptData(dt);
 		return dt;
 	}
@@ -313,7 +317,7 @@
 	 * @return
 	 */
 	public FieldSetEntity findRecordInfo(String uuid) {
-		return baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_PUNCH_RECORD, uuid, true);
+		return baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_PUNCH_RECORD, uuid, false);
 	}
 
 	/**

--
Gitblit v1.9.2