From 1d1d34b48e6e80bea350d805d8ff2564ca226f25 Mon Sep 17 00:00:00 2001
From: 杜洪波 <1074825718@qq.com>
Date: 星期一, 19 八月 2024 13:44:17 +0800
Subject: [PATCH] Merge branch 'master' of http://nonxin.cn:8090/r/product/product-server-administration/V2.0.0
---
src/main/java/com/product/administration/controller/WorkAttendanceLocationController.java | 4
src/main/java/com/product/administration/controller/ConferenceManagerController.java | 43 +
src/main/java/com/product/administration/controller/EarlyWarningManagerController.java | 60 +
src/main/java/com/product/administration/service/PunchRecordService.java | 275 ++++++++++
src/main/java/com/product/administration/service/LeaveRequestService.java | 25
src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java | 455 ++++++++++++-----
src/main/java/com/product/administration/service/ConferenceManagerService.java | 115 ++++
src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java | 22
src/main/java/com/product/administration/service/CustomerInfoService.java | 6
src/main/java/com/product/administration/service/ide/IConferenceManagerService.java | 8
src/main/java/com/product/administration/service/EarlyWarningServer.java | 423 +++++++++------
src/main/java/com/product/administration/config/SystemCode.java | 15
src/main/java/com/product/administration/service/CooperatesService.java | 8
src/main/java/com/product/administration/service/EarlyWarningManagerService.java | 40 +
src/main/java/com/product/administration/controller/WorkAttendanceKanbanController.java | 2
src/main/java/com/product/administration/controller/LeaveRequestController.java | 3
16 files changed, 1,140 insertions(+), 364 deletions(-)
diff --git a/src/main/java/com/product/administration/config/SystemCode.java b/src/main/java/com/product/administration/config/SystemCode.java
index b998ed0..4ec5ef5 100644
--- a/src/main/java/com/product/administration/config/SystemCode.java
+++ b/src/main/java/com/product/administration/config/SystemCode.java
@@ -247,17 +247,17 @@
TEAM_MANAGER_DELETE_FAIL_HAS_SUB_TEAM("鍥㈤槦鍒犻櫎澶辫触,鍖呭惈瀛愬洟闃�", ModuleEnum.ADMINISTRAT.getValue() + "176"),
TEAM_MANAGER_DELETE_FAIL_HAS_STAFF_REFERED("鍥㈤槦鍒犻櫎澶辫触,鍛樺伐宸茬粡鍏宠仈", ModuleEnum.ADMINISTRAT.getValue() + "177"),
TEAM_SAVE_FAIL_DUPLICATE_NAME("淇濆瓨澶辫触,鍥㈤槦鍚嶇О閲嶅", ModuleEnum.ADMINISTRAT.getValue() + "178"),
-
+
COMPANY_NOT_CONFIG_PUNCH_TIME("鍏徃鏈厤缃墦鍗℃椂闂�", ModuleEnum.ADMINISTRAT.getValue() + "179"),
LIST_COOPERATES_MODEL_FAIL("鍗忓悓妯℃澘鍒楄〃鑾峰彇澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "180"),
FIND_COOPERATES_MODEL_FAIL("鍗忓悓妯℃澘鑾峰彇澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "181"),
-
+
ATTENDANCE_LOCATION_SAVE_FAIL("鑰冨嫟鐐逛繚瀛樺け璐�", ModuleEnum.ADMINISTRAT.getValue() + "182"),
ATTENDANCE_LOCATION_LIST_FAIL("鑰冨嫟鐐规煡璇㈠け璐�", ModuleEnum.ADMINISTRAT.getValue() + "183"),
WARN_NO_NORMAL_STATUS_RECORD("涓鸿幏鍙栧埌鍚敤鐨勯璀﹁褰�", ModuleEnum.ADMINISTRAT.getValue() + "184"),
-
+
COMPANY_PUNCH_TIME_NOT_CONFIG("鍏徃鎵撳崱鏃堕棿鏈厤缃�", ModuleEnum.ADMINISTRAT.getValue()+"185"),
KNOWLEDGE_SHARING_LIST_FAIL("鑾峰彇鐭ヨ瘑鍏变韩鍒楄〃澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "186"),
@@ -271,13 +271,16 @@
CONFERENCE_ROOM_SAVE_FIAL_DUPLICATE_NAME("浼氳瀹や繚瀛樺け璐�,宸插瓨鍦ㄥ悓鍚嶇О浼氳瀹�", ModuleEnum.ADMINISTRAT.getValue() + "193"),
WORK_ATTENDANCE_REPORT_FAIL("鑰冨嫟鎶ヨ〃鑾峰彇澶辫触锛�", ModuleEnum.ADMINISTRAT.getValue() + "194"),
-
+
ANNOUNCEMENT_FAIL("鍏憡璇︽儏", ModuleEnum.ADMINISTRAT.getValue() + "195"),
ANNOUNCEMENT_ADD("鍏憡鏂板", ModuleEnum.ADMINISTRAT.getValue() + "196"),
ANNOUNCEMENT_UPDATE("鍏憡淇敼", ModuleEnum.ADMINISTRAT.getValue() + "197"),
ANNOUNCEMENT_DELECT("鍏憡鍒犻櫎", ModuleEnum.ADMINISTRAT.getValue() + "198"),
- ANNOUNCEMENT_REMIND("宸茶鎻愰啋澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "199"),
-
+ ANNOUNCEMENT_REMIND("宸茶鎻愰啋澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "199"),
+
+ WARN_TRANSMIT_USER_IS_NULL("棰勮杞彂浜哄憳涓虹┖", ModuleEnum.ADMINISTRAT.getValue() + "200"),
+ WARN_TRANSMIT_USER_REPEAT("棰勮杞彂浜哄憳閲嶅", ModuleEnum.ADMINISTRAT.getValue() + "201"),
+
EXPORT_FILE_FAIL("瀵煎嚭鏂囦欢澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "998"),
IMPORT_FILE_FAIL("瀵煎叆鏂囦欢澶辫触", ModuleEnum.ADMINISTRAT.getValue() + "999"),
diff --git a/src/main/java/com/product/administration/controller/ConferenceManagerController.java b/src/main/java/com/product/administration/controller/ConferenceManagerController.java
index c39458f..76fd664 100644
--- a/src/main/java/com/product/administration/controller/ConferenceManagerController.java
+++ b/src/main/java/com/product/administration/controller/ConferenceManagerController.java
@@ -8,6 +8,7 @@
import com.product.administration.service.ide.IConferenceManagerService;
import com.product.core.config.CoreConst;
import com.product.core.controller.support.AbstractBaseController;
+import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
@@ -21,6 +22,7 @@
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
+import java.util.List;
/**
* @Author cheng
@@ -419,4 +421,45 @@
}
}
+ @PostMapping("/get_kb_Data/{version}")
+ @ApiVersion(1)
+ public String getkbData(HttpServletRequest request){
+
+ //鑾峰彇鍙傛暟
+ FieldSetEntity fse = null;
+ Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+ if (bean != null) {
+ RequestParameterEntity reqp = (RequestParameterEntity) bean;
+ fse = reqp.getFormData();
+ }
+ //鍒ゆ柇鍙傛暟鏄惁涓虹┖
+ if (bean == null || fse == null) {
+ return this.error(com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getValue(), com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getText());
+ }
+ List kbData = conferenceManagerService.getKbData(fse);
+
+ return OK(kbData);
+
+ }
+
+ @PostMapping("/get_Meeting_Details/{version}")
+ @ApiVersion(1)
+ public String getMeetingDetails(HttpServletRequest request){
+ //鑾峰彇鍙傛暟
+ FieldSetEntity fse = null;
+ /*Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+ if (bean != null) {
+ RequestParameterEntity reqp = (RequestParameterEntity) bean;
+ fse = reqp.getFormData();
+ }
+ //鍒ゆ柇鍙傛暟鏄惁涓虹┖
+ if (bean == null || fse == null) {
+ return this.error(com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getValue(), com.product.admin.config.SystemCode.SYSTEM_FORM_NODATA.getText());
+ }*/
+ DataTableEntity meetingDetails = conferenceManagerService.getMeetingDetails(fse);
+ return OK(meetingDetails);
+
+ }
+
+
}
diff --git a/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java b/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
index b6ddbfe..4343718 100644
--- a/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
+++ b/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
@@ -1,17 +1,7 @@
package com.product.administration.controller;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import com.product.admin.service.PublicService;
import com.product.admin.service.idel.IPublicService;
-import com.product.core.spring.context.SpringMVCContextHolder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
import com.product.administration.config.CmnConst;
import com.product.administration.config.SystemCode;
import com.product.administration.service.EarlyWarningManagerService;
@@ -25,7 +15,16 @@
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
+import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.module.sys.version.ApiVersion;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
/**
@@ -589,4 +588,45 @@
return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
}
}
+
+
+ /**
+ * 鎵归噺淇敼棰勮鏃堕棿
+ *
+ * @param request
+ * @return
+ */
+ @PostMapping("/transmit/{version}")
+ @ApiVersion(1)
+ public String transmit(HttpServletRequest request) {
+ try {
+ //鑾峰彇鍙傛暟
+ FieldSetEntity fse = null;
+ Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+ if (bean != null) {
+ RequestParameterEntity reqp = (RequestParameterEntity) bean;
+ fse = reqp.getFormData();
+ }
+ //鍒ゆ柇鍙傛暟鏄惁涓虹┖
+ if (bean == null || fse == null) {
+ SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+ return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+ }
+ if (fse.getTableName() == null) {
+ SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+ return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+ }
+ IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService);
+ service.transmit(fse);
+ return OK();
+ } catch (BaseException e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
+ }
+ }
}
diff --git a/src/main/java/com/product/administration/controller/LeaveRequestController.java b/src/main/java/com/product/administration/controller/LeaveRequestController.java
index 9a063de..0636551 100644
--- a/src/main/java/com/product/administration/controller/LeaveRequestController.java
+++ b/src/main/java/com/product/administration/controller/LeaveRequestController.java
@@ -140,6 +140,9 @@
return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
}
String uuid = leaveRequestService.saveLeaveRequest(fse);
+ if (uuid.equals("1")){
+ return error("璇ユ椂闂存宸茬粡鏈夎鍋囪褰曟棤娉曚繚瀛�");
+ }
if (!StringUtils.isEmpty(uuid)) {
return OK_Add(uuid);
}
diff --git a/src/main/java/com/product/administration/controller/WorkAttendanceKanbanController.java b/src/main/java/com/product/administration/controller/WorkAttendanceKanbanController.java
index 99850f8..a3c1a64 100644
--- a/src/main/java/com/product/administration/controller/WorkAttendanceKanbanController.java
+++ b/src/main/java/com/product/administration/controller/WorkAttendanceKanbanController.java
@@ -98,7 +98,7 @@
SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(),SystemCode.SYSTEM_TABLE_NODATA.getText());
return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
}
- DataTableEntity dt = workAttendanceKanbanService.listMonthKanBan(fse);
+ DataTableEntity dt = workAttendanceKanbanService.listMonthKanBanNew(fse);
return OK_List(dt);
} catch (BaseException e) {
e.printStackTrace();
diff --git a/src/main/java/com/product/administration/controller/WorkAttendanceLocationController.java b/src/main/java/com/product/administration/controller/WorkAttendanceLocationController.java
index 5dc203d..9aad411 100644
--- a/src/main/java/com/product/administration/controller/WorkAttendanceLocationController.java
+++ b/src/main/java/com/product/administration/controller/WorkAttendanceLocationController.java
@@ -48,10 +48,6 @@
if (bean == null || fse == null) {
return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
}
- //鍒ゆ柇琛ㄥ悕鏄惁姝e父
- if (!CmnConst.PRODUCT_OA_PUNCH_SITE.equals(fse.getTableName())) {
- return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
- }
FieldSetEntity fseData=new FieldSetEntity();
fseData.setTableName(CmnConst.PRODUCT_OA_PUNCH_SITE);
DataTableEntity dt = workAttendanceLocationService.listAttendanceLocationInfoByUser();
diff --git a/src/main/java/com/product/administration/service/ConferenceManagerService.java b/src/main/java/com/product/administration/service/ConferenceManagerService.java
index 758e224..6c8d85e 100644
--- a/src/main/java/com/product/administration/service/ConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ConferenceManagerService.java
@@ -122,10 +122,10 @@
if (nameVerification!=null) {
throw new BaseException(SystemCode.CONFERENCE_ROOM_SAVE_FIAL_DUPLICATE_NAME.getValue(), SystemCode.CONFERENCE_ROOM_SAVE_FIAL_DUPLICATE_NAME.getText());
}
-
+
BaseUtil.createCreatorAndCreationTime(SpringMVCContextHolder.getCurrentUser(), fse);
//閲嶅悕楠岃瘉
-
+
return baseDao.saveFieldSetEntity(fse);
}
@@ -200,6 +200,117 @@
return baseDao.delete(fse.getTableName(), fse.getUUID().split(","));
}
+ @Override
+ public List getKbData(FieldSetEntity fse) throws BaseException {
+
+ List<Object>param=new ArrayList<>();
+ String meeting_date= fse.getString("meeting_date");
+ String meeting_resource = fse.getString("meeting_resource");
+ param.add(meeting_date);
+ if(!StringUtils.isEmpty(meeting_resource)){
+ String replace_meeting_resource = meeting_resource.replace(",", "%");
+ meeting_resource="%"+replace_meeting_resource+"%";
+ param.add(meeting_resource);
+ }
+
+ StringBuilder bs=new StringBuilder();
+ bs.append(" SELECT DISTINCT y.*, g.room_name,g.uuid as meet_room_uuid ");
+ bs.append(" FROM product_oa_conference_apply y");
+ bs.append(" left JOIN product_oa_conference_room_config g ");
+ bs.append(" on y.meeting_room=g.uuid ");
+ bs.append(" where DATE_FORMAT(y.start_time,\"%Y-%m-%d\")=?");
+ if(!StringUtils.isEmpty(meeting_resource)){
+ bs.append(" and y.meeting_resource like ? ");
+ }
+ bs.append(" ORDER BY y.start_time");
+ DataTableEntity dataTableEntity = baseDao.listTable(bs.toString(), param.toArray());
+ List<String> list=new ArrayList();
+ List<HashMap> listDate=new ArrayList<>();
+ //鏋勯�犳墍闇�瑕佺殑鏍煎紡
+ for(int i=0;i<dataTableEntity.getRows();i++){
+ FieldSetEntity fieldSetEntity = dataTableEntity.getData().get(i);
+ if(!list.contains(fieldSetEntity.getValue("room_name").toString())){
+ HashMap<String,Object> hashMap=new HashMap<>();
+ hashMap.put("room_name",fieldSetEntity.getValue("room_name").toString());
+ hashMap.put("uuid",fieldSetEntity.getValue("meet_room_uuid").toString());
+ Object getStartTime = dataTableEntity.getData().get(0).getValue("start_time");
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String time = dateFormat.format(getStartTime);
+ hashMap.put("start_time",time);
+ list.add(fieldSetEntity.getValue("room_name").toString());
+ listDate.add(hashMap);
+
+ }
+ fieldSetEntity.setValue("parent",fieldSetEntity.getValue("meet_room_uuid").toString());
+ HashMap<String,Object> hashMap=new HashMap<>();
+ for (int j = 0; j < fieldSetEntity.getValues().keySet().size(); j++) {
+ if(fieldSetEntity.getValues().keySet().toArray()[j].toString().equals("start_time") || fieldSetEntity.getValues().keySet().toArray()[j].toString().equals("end_time")){
+ Object meeting_time = fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString());
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String time = dateFormat.format(meeting_time);
+ hashMap.put(fieldSetEntity.getValues().keySet().toArray()[j].toString(),time);
+ }else {
+ hashMap.put(fieldSetEntity.getValues().keySet().toArray()[j].toString(),fieldSetEntity.getValue(fieldSetEntity.getValues().keySet().toArray()[j].toString()));
+ }
+
+ }
+ listDate.add(hashMap);
+
+ }
+ return listDate;
+ }
+
+ @Override
+ public DataTableEntity getMeetingDetails(FieldSetEntity fse) throws BaseException {
+
+ //String uuid = fse.getString("uuid");
+ String uuid="96f161b4-6360-40ba-8dc1-72bb39d56be4";
+ /*if(!StringUtils.isEmpty(uuid)){*/
+ List<Object>param=new ArrayList<>();
+ param.add(uuid);
+ StringBuilder sb=new StringBuilder();
+ sb.append(" SELECT b.uuid,b.start_time,b.end_time,b.record_man,b.record_master,b.status, ");
+ sb.append(" CONCAT(DATE_FORMAT(b.start_time,\"%H-%i-%S\"),'~',DATE_FORMAT(b.end_time,\"%H-%i-%S\")) as time_quantum,");
+ sb.append(" DATE_FORMAT(b.start_time,\"%Y-%m-%d\") as meeting_date,");
+ sb.append(" GROUP_CONCAT(b.dict_label SEPARATOR ',') AS meeting_resouces ");
+ sb.append(" FROM (");
+ sb.append(" SELECT DISTINCT a.uuid,a.start_time,a.end_time,a.record_man,a.record_master,a.status,t.dict_label ");
+ sb.append(" FROM (");
+ sb.append(" SELECT T1.*, ");
+ sb.append(" SUBSTRING_INDEX( SUBSTRING_INDEX( T1.meeting_resource, ',', T2.digit + 1 ), ',',- 1 ) AS type ");
+ sb.append(" FROM product_oa_conference_apply T1 ");
+ sb.append(" JOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 ) T2");
+ sb.append(" ON T2.digit < ( length( T1.meeting_resource )- length( REPLACE ( T1.meeting_resource, ',', '' ))+ 1 )");
+ sb.append(" WHERE t1.uuid = ? ");
+ sb.append(" ) a");
+ sb.append(" LEFT JOIN product_sys_dict t ON a.type = t.dict_value ");
+ sb.append(" AND t.dict_name = '浼氳瀹よ祫婧�'");
+ sb.append(" )b ");
+ sb.append(" group by b.uuid,b.start_time,b.end_time,b.record_man,b.record_master,b.status ");
+ DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray());
+
+ for (int i = 0; i < dataTableEntity.getRows(); i++) {
+ Date date = new Date();
+ String uuid1 = dataTableEntity.getData().get(0).getString("uuid");
+ String filter="uuid = '"+uuid1+"'";
+ DataTableEntity product_oa_conference_apply = baseDao.listTable("product_oa_conference_apply", filter, new Object[]{});
+ if(date.before(dataTableEntity.getData().get(0).getDate("start_time"))){
+ product_oa_conference_apply.getData().get(0).setValue("status","鏈紑濮�");
+ }else if(date.after(dataTableEntity.getData().get(0).getDate("end_time"))){
+ product_oa_conference_apply.getData().get(0).setValue("status","宸插彇娑�");
+
+ }else {
+ product_oa_conference_apply.getData().get(0).setValue("status","浼氳涓�");
+ }
+ baseDao.update(product_oa_conference_apply);
+ }
+ return dataTableEntity;
+ /* }else {
+ return null;
+ }*/
+
+ }
+
/**
* 浼氳瀹や娇鐢ㄦ儏鍐�
diff --git a/src/main/java/com/product/administration/service/CooperatesService.java b/src/main/java/com/product/administration/service/CooperatesService.java
index fea9564..db00d55 100644
--- a/src/main/java/com/product/administration/service/CooperatesService.java
+++ b/src/main/java/com/product/administration/service/CooperatesService.java
@@ -79,7 +79,13 @@
FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_COOPERATES, fs.getString(CmnConst.UUID), true);
DataTableEntity copsub = fse.getSubDataTable(CmnConst.PRODUCT_OA_COOPERATE_SUB);
baseDao.loadPromptData(copsub);
-
+ for (int i = 0; i <copsub.getRows() ; i++) {
+ String userId = copsub.getString(i, "created_by_save_value");
+ String userAvatar = userService.getUserAvatar(userId);
+ if (!StringUtils.isEmpty(userAvatar)) {
+ copsub.setFieldValue(i, "avatar", userAvatar);
+ }
+ }
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(" select ifnull(concat(tricode,'-',receiver) ,receiver) code,uuid,title,cooperate_uuid,grade,receiver as id,receiver,sender, ");
stringBuilder.append(" receiver_name,(select user_name FROM product_sys_users where user_id=receiver) label,sender_name,status, ");
diff --git a/src/main/java/com/product/administration/service/CustomerInfoService.java b/src/main/java/com/product/administration/service/CustomerInfoService.java
index 480c465..638814f 100644
--- a/src/main/java/com/product/administration/service/CustomerInfoService.java
+++ b/src/main/java/com/product/administration/service/CustomerInfoService.java
@@ -8,7 +8,6 @@
import com.product.administration.config.CmnConst;
import com.product.administration.service.ide.ICustomerInfoService;
-import com.product.common.lang.StringUtils;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
@@ -49,7 +48,10 @@
sbSql.append(" CONCAT(B.linkman, '-', B.mobile) AS customer_contact \n");
sbSql.append("FROM product_project_customer A \n");
sbSql.append("LEFT JOIN product_project_customer_sub B ON B.customer_uuid = A.uuid \n");
- sbSql.append(searchFilter);
+ if (!BaseUtil.strIsNull(searchFilter)) {
+ sbSql.append("WHERE ").append(searchFilter);
+ }
+
// if(!StringUtils.isEmpty(dataFilter)) {
// if (!StringUtils.isEmpty(searchFilter)) {
// dataFilter+=" AND "+ searchFilter;
diff --git a/src/main/java/com/product/administration/service/EarlyWarningManagerService.java b/src/main/java/com/product/administration/service/EarlyWarningManagerService.java
index b3c34e0..ac7b876 100644
--- a/src/main/java/com/product/administration/service/EarlyWarningManagerService.java
+++ b/src/main/java/com/product/administration/service/EarlyWarningManagerService.java
@@ -27,6 +27,7 @@
import com.product.org.admin.service.StaffManagerService;
import com.product.quartz.service.impl.SysJobService;
import com.product.util.BaseUtil;
+import com.product.util.SystemParamReplace;
import org.apache.commons.codec.binary.Base64;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -304,13 +305,15 @@
Map<String, String> fieldReference = new HashMap<>(); //缁勫悎鐩稿叧瀛楁鐨勫弬鐓�,tableName1fieldName-->referenceName
StringBuilder concatField = new StringBuilder(); //缁勫悎鐩稿叧瀛楁,tableName1.fieldName tableName1fieldName
earlyWarningServer.parseWarningContent(warnCondition, concatField, tableNameAndAlias, fieldAndAlias, fieldReference);
+ // 鏇挎崲绯荤粺鍙傛暟
+ warnCondition = SystemParamReplace.systemParamsReplace(warnCondition);
//鐢熸垚涓诲瓙琛ㄥ叧鑱擲QL
String relationSQL = earlyWarningServer.createTableRelation(tableNameAndAlias, mainTableName);
StringBuilder serviceSQL = new StringBuilder();
serviceSQL.append(" SELECT ");
- serviceSQL.append(concatField.subSequence(1, concatField.length()));
+ serviceSQL.append(StringUtils.isEmpty(concatField) ? "*" : concatField.subSequence(1, concatField.length()));
serviceSQL.append(" FROM ");
serviceSQL.append(relationSQL);
serviceSQL.append(" WHERE ");
@@ -492,4 +495,39 @@
}
return dte;
}
+
+ /**
+ * 杞彂
+ * @param fse
+ */
+ @Override
+ public void transmit(FieldSetEntity fse) {
+ String uuid = fse.getUUID();
+ String messageAccepter = fse.getString("user");
+ FieldSetEntity warnMsgFse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO, uuid, false);
+ String preReceiver = warnMsgFse.getString(CmnConst.RECEIVER);
+ Set<String> preReceiverSet = Sets.newHashSet(preReceiver.split(","));
+ if (StringUtils.isEmpty(messageAccepter)) {
+ throw new BaseException(SystemCode.WARN_TRANSMIT_USER_IS_NULL);
+ }
+ Set<String> transmitUserSet = Sets.newHashSet(messageAccepter.split(","));
+ transmitUserSet.forEach(transmitUser -> {
+ if (preReceiverSet.contains(transmitUser)) {
+ FieldSetEntity transmitUserFse = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_SYS_USERS, "user_id=?", new Object[]{transmitUser}, false);
+ throw new BaseException(SystemCode.WARN_TRANSMIT_USER_REPEAT.getValue(), String.format("%s:%s", SystemCode.WARN_TRANSMIT_USER_REPEAT.getText(), transmitUserFse.getString(CmnConst.USER_NAME)));
+ }
+ });
+ // 鏇存柊棰勮淇℃伅琛�
+ warnMsgFse.setValue(CmnConst.RECEIVER, preReceiver + "," + messageAccepter);
+ baseDao.saveFieldSetEntity(warnMsgFse);
+
+ // 鍙戦�佹秷鎭粰杞彂浜�
+ SystemUser curUser = SpringMVCContextHolder.getCurrentUser();
+ FieldSetEntity msgFse = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_SYS_MESSAGE, "source_table=? and source_uuid=?", new Object[]{CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO, uuid}, false);
+ String title = String.format("%s鍚戞偍杞彂浜嗛璀︽秷鎭��%s銆�", curUser.getUser_name(), msgFse.getString(CmnConst.TITLE));
+ String content = msgFse.getString("content");
+ WebsocketMesssageServiceThread.getInstance().appendMessage(messageAccepter, content, title, curUser.getUser_id(),
+ "31", CmnConst.BUTTON_URL_WARN_MESSAGE_INFO + "?uuid=" + fse.getUUID(),
+ CmnConst.PRODUCT_SYS_EARLY_WARNING_INFO, fse.getUUID(), curUser.getUser_id(), 0, 0, null);
+ }
}
diff --git a/src/main/java/com/product/administration/service/EarlyWarningServer.java b/src/main/java/com/product/administration/service/EarlyWarningServer.java
index 8061dfe..d640dd8 100644
--- a/src/main/java/com/product/administration/service/EarlyWarningServer.java
+++ b/src/main/java/com/product/administration/service/EarlyWarningServer.java
@@ -3,10 +3,14 @@
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.cron.CronUtil;
import com.google.common.collect.Sets;
import com.product.administration.config.SystemCode;
import com.product.common.collect.SetUtils;
+import com.product.quartz.util.CronUtils;
import com.product.util.SystemParamReplace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -30,10 +34,10 @@
@Autowired
BaseDao baseDao;
-
+
@Autowired
FlowService flowService;
-
+
public BaseDao getBaseDao() {
return baseDao;
@@ -60,6 +64,7 @@
/**
* 棰勮-缁欏畾uuid鍗曚釜棰勮锛岄�氬父涓哄畾鏃朵换鍔¤Е鍙�
+ *
* @param uuid
*/
public void triggerSingleWarningTask(String uuid) {
@@ -76,6 +81,7 @@
/**
* 鍗曚釜棰勮
+ *
* @param fseWarningConfig
*/
private void singleWarningTask(FieldSetEntity fseWarningConfig) {
@@ -95,6 +101,22 @@
String flowCode = fseWarningConfig.getString(CmnConst.FLOW_CODE); //娴佺▼type_code
String flowParam = fseWarningConfig.getString(CmnConst.FLOW_PARAM); //娴佺▼鍙傛暟杞崲
+
+ //鑾峰彇鍙戦�佹秷鎭鐜�
+ Double cronExpression = fseWarningConfig.getDouble("reminder_frequency");
+
+ //鍙戦�佹秷鎭殑棰戠巼 1.23 灏忔暟鐐瑰墠闈唬琛ㄥぉ 灏忔暟鐐瑰悗闈唬琛ㄥ皬鏃�
+ double seconds = 0;
+ if (cronExpression != null && cronExpression > 0) {
+
+ //灏嗗彂閫佹秷鎭鐜囪浆鎹负灏忔椂
+ double hours = cronExpression * 24;
+ //灏嗗彂閫佹秷鎭鐜囪浆鎹负鍒嗛挓
+ double minutes = hours * 60;
+ //灏嗗彂閫佹秷鎭鐜囪浆鎹负绉�
+ seconds = minutes * 60;
+ }
+
Map<String, String> tableNameAndAlias = new HashMap<>(); //鐩稿叧琛ㄥ悕-->琛ㄥ埆鍚�,tableName-->tableName1
Map<String, String> fieldAndAlias = new HashMap<>(); //鐩稿叧瀛楁-->瀛楁鍒悕,tableName.fieldName-->tableName1fieldName
@@ -140,13 +162,53 @@
//鏌ヨ绗﹀悎棰勮鐨勬暟鎹�
DataTableEntity dtService = baseDao.listTable(serviceSQL.toString(), new Object[]{});
if (!BaseUtil.dataTableIsEmpty(dtService)) {
+ List<String> collect = dtService.getData().stream().map(item -> item.getString(mainTableAlias + "uuid")).collect(Collectors.toList());
+ //棰勮uuid
+ String warnUUID = fseWarningConfig.getUUID();
+ //灏嗛璀uid鏀惧埌collect 鐨勭涓�涓�
+
+ collect.add(0, warnUUID);
+ StringBuilder sql = new StringBuilder();
+ //鏌ヨ鏄惁宸茬粡瀛樺湪棰勮濡傛湁鐩稿悓data_uuid鐨勬暟鎹煡璇㈠嚭鏈�杩戠殑涓�鏉℃牴鎹璀︽椂闂村瓧娈� early_warning_datetime
+// SELECT e.*
+// FROM product_sys_early_warning_info e
+// JOIN (
+// SELECT data_uuid, MAX(early_warning_datetime) AS latest_datetime
+// FROM product_sys_early_warning_info
+// GROUP BY data_uuid
+// ) AS latest
+// ON e.data_uuid = latest.data_uuid AND e.early_warning_datetime = latest.latest_datetime;
+ sql.append("SELECT e.* FROM product_sys_early_warning_info e JOIN (");
+ sql.append("SELECT data_uuid, MAX(early_warning_datetime) AS latest_datetime FROM product_sys_early_warning_info ");
+ sql.append(" where early_warning_uuid=? and (").append(BaseUtil.buildQuestionMarkFilter("data_uuid", collect.size(), true)).append(") ");
+ sql.append("GROUP BY data_uuid) AS latest ON e.data_uuid = latest.data_uuid AND e.early_warning_datetime = latest.latest_datetime");
+ DataTableEntity dt = baseDao.listTable(sql.toString(), collect.toArray());
+
+ Map<String, FieldSetEntity> ff = new HashMap<>();
+ if (!DataTableEntity.isEmpty(dt)) {
+ for (int j = 0; j < dt.getRows(); j++) {
+ FieldSetEntity fse = dt.getFieldSetEntity(j);
+ ff.put(fse.getString("data_uuid"), fse);
+ }
+ }
+
+ //浠ata_uuid 杩涜鍒嗙粍
for (int j = 0; j < dtService.getRows(); j++) {
FieldSetEntity fseService = dtService.getFieldSetEntity(j);
//涓氬姟uuid
String serviceId = fseService.getString(mainTableAlias + "uuid");
- //棰勮uuid
- String warnUUID = fseWarningConfig.getUUID();
+
+ if (ff.containsKey(serviceId) && StringUtils.isEmpty(cronExpression)) {
+ //濡傛灉宸茬粡瀛樺湪棰勮淇℃伅 鏍规嵁cron琛ㄨ揪寮忓垽鏂槸鍚﹂渶瑕佸啀娆¢璀�
+ Date preTime = ff.get(serviceId).getDate("early_warning_datetime");
+ if (preTime != null) {
+ long time = new Date().getTime() - preTime.getTime();
+ if (time < seconds * 1000) {
+ continue;
+ }
+ }
+ }
//淇℃伅鎺ユ敹浜�
Set<String> receiverSet = Sets.newTreeSet();
@@ -241,20 +303,21 @@
}
}
}
-
-
+
+
/**
- * 鏍规嵁鎻愰啋鍐呭涓殑琛ㄥ睘鎬э紝杩涜鎷兼帴鎴愭爣鍑嗘牸寮�
- * @param content 棰勮鍐呭
- * @param concatField 缁勫悎瀛楁
- * @param tableNameAndAlias 琛ㄥ悕鍙婂埆鍚�
- * @param fieldAndAlias 瀛楁鍚嶅強鍒悕
- * @param fieldReference 瀛楁鍙婂弬鐓�
+ * 鏍规嵁鎻愰啋鍐呭涓殑琛ㄥ睘鎬э紝杩涜鎷兼帴鎴愭爣鍑嗘牸寮�
+ *
+ * @param content 棰勮鍐呭
+ * @param concatField 缁勫悎瀛楁
+ * @param tableNameAndAlias 琛ㄥ悕鍙婂埆鍚�
+ * @param fieldAndAlias 瀛楁鍚嶅強鍒悕
+ * @param fieldReference 瀛楁鍙婂弬鐓�
* @return
*/
- public Object[] parseWarningContent(String warnContent, StringBuilder concatField, Map<String, String> tableNameAndAlias, Map<String, String>fieldAndAlias, Map<String, String> fieldReference) {
+ public Object[] parseWarningContent(String warnContent, StringBuilder concatField, Map<String, String> tableNameAndAlias, Map<String, String> fieldAndAlias, Map<String, String> fieldReference) {
int s = 0;
- String tableAndField=null;
+ String tableAndField = null;
while (s >= 0) {
int c = warnContent.indexOf("{#", s);
if (c == -1) {
@@ -263,155 +326,158 @@
}
int m = warnContent.indexOf("#}", c);
s = c + 2;
-
+
//琛ㄥ悕.瀛楁鍚�
- tableAndField=warnContent.substring(s, m);
-
+ tableAndField = warnContent.substring(s, m);
+
//鑾峰彇琛ㄥ悕
- String relationTable=tableAndField.split("\\.")[0];
+ String relationTable = tableAndField.split("\\.")[0];
//琛ㄥ埆鍚�
- String relationTableAlias=relationTable+"1";
+ String relationTableAlias = relationTable + "1";
//瀛楁鍚�
- String fieldName=tableAndField.split("\\.")[1];
-
- if (tableNameAndAlias.get(relationTable)==null) {
+ String fieldName = tableAndField.split("\\.")[1];
+
+ if (tableNameAndAlias.get(relationTable) == null) {
concatField.append(",");
concatField.append(relationTableAlias);
concatField.append(".uuid ");
concatField.append(relationTableAlias);
concatField.append("uuid");
- fieldAndAlias.put(relationTable+".uuid", relationTable+"1uuid");
+ fieldAndAlias.put(relationTable + ".uuid", relationTable + "1uuid");
tableNameAndAlias.put(relationTable, relationTableAlias);
}
-
+
//鐢熸垚瀛楁鍒悕-->琛ㄥ悕1瀛楁鍚�
- String tableFieldAlias=tableAndField.replace(".", "1");
-
- if (fieldAndAlias.get(tableAndField)==null) {
- fieldAndAlias.put(tableAndField,tableFieldAlias);
+ String tableFieldAlias = tableAndField.replace(".", "1");
+
+ if (fieldAndAlias.get(tableAndField) == null) {
+ fieldAndAlias.put(tableAndField, tableFieldAlias);
concatField.append(",");
- concatField.append(relationTableAlias+"."+fieldName);
+ concatField.append(relationTableAlias + "." + fieldName);
concatField.append(" ");
concatField.append(tableFieldAlias);
fieldReference.put(tableFieldAlias, getReferenceByField(tableAndField));
}
}
- return new Object[]{concatField,tableNameAndAlias,fieldAndAlias,fieldReference};
+ return new Object[]{concatField, tableNameAndAlias, fieldAndAlias, fieldReference};
}
-
+
/**
- * 鏍规嵁鎻愰啋鍐呭涓殑琛ㄥ睘鎬э紝杩涜鎷兼帴鎴愭爣鍑嗘牸寮�
- * @param flowParam 棰勮鍐呭
- * @param concatField 缁勫悎瀛楁
- * @param tableNameAndAlias 琛ㄥ悕鍙婂埆鍚�
- * @param fieldAndAlias 瀛楁鍚嶅強鍒悕
- * @param fieldReference 瀛楁鍙婂弬鐓�
+ * 鏍规嵁鎻愰啋鍐呭涓殑琛ㄥ睘鎬э紝杩涜鎷兼帴鎴愭爣鍑嗘牸寮�
+ *
+ * @param flowParam 棰勮鍐呭
+ * @param concatField 缁勫悎瀛楁
+ * @param tableNameAndAlias 琛ㄥ悕鍙婂埆鍚�
+ * @param fieldAndAlias 瀛楁鍚嶅強鍒悕
+ * @param fieldReference 瀛楁鍙婂弬鐓�
* @return
*/
- public Object[] parseFlowParam(String flowParam, StringBuilder concatField, Map<String, String> tableNameAndAlias, Map<String, String>fieldAndAlias, Map<String, String> fieldReference) {
-
- String[] warnAndFlows=flowParam.split(",");
+ public Object[] parseFlowParam(String flowParam, StringBuilder concatField, Map<String, String> tableNameAndAlias, Map<String, String> fieldAndAlias, Map<String, String> fieldReference) {
+
+ String[] warnAndFlows = flowParam.split(",");
for (int i = 0; i < warnAndFlows.length; i++) {
- String[] warnAndFlow=warnAndFlows[i].split("=");
- String tableAndField=warnAndFlow[0];
-
+ String[] warnAndFlow = warnAndFlows[i].split("=");
+ String tableAndField = warnAndFlow[0];
+
//鑾峰彇琛ㄥ悕
- String relationTable=tableAndField.split("\\.")[0];
+ String relationTable = tableAndField.split("\\.")[0];
//琛ㄥ埆鍚�
- String relationTableAlias=relationTable+"1";
+ String relationTableAlias = relationTable + "1";
//瀛楁鍚�
- String fieldName=tableAndField.split("\\.")[1];
-
- if (tableNameAndAlias.get(relationTable)==null) {
+ String fieldName = tableAndField.split("\\.")[1];
+
+ if (tableNameAndAlias.get(relationTable) == null) {
concatField.append(",");
concatField.append(relationTableAlias);
concatField.append(".uuid ");
concatField.append(relationTableAlias);
concatField.append("uuid");
- fieldAndAlias.put(relationTable+".uuid", relationTable+"1uuid");
+ fieldAndAlias.put(relationTable + ".uuid", relationTable + "1uuid");
tableNameAndAlias.put(relationTable, relationTableAlias);
}
-
+
//鐢熸垚瀛楁鍒悕-->琛ㄥ悕1瀛楁鍚�
- String tableFieldAlias=tableAndField.replace(".", "1");
-
- if (fieldAndAlias.get(tableAndField)==null) {
- fieldAndAlias.put(tableAndField,tableFieldAlias);
+ String tableFieldAlias = tableAndField.replace(".", "1");
+
+ if (fieldAndAlias.get(tableAndField) == null) {
+ fieldAndAlias.put(tableAndField, tableFieldAlias);
concatField.append(",");
- concatField.append(relationTableAlias+"."+fieldName);
+ concatField.append(relationTableAlias + "." + fieldName);
concatField.append(" ");
concatField.append(tableFieldAlias);
fieldReference.put(tableFieldAlias, getReferenceByField(tableAndField));
}
}
- return new Object[]{concatField,tableNameAndAlias,fieldAndAlias,fieldReference};
+ return new Object[]{concatField, tableNameAndAlias, fieldAndAlias, fieldReference};
}
-
+
/**
- * 鏍规嵁琛ㄥ悕鍜屽瓧娈电殑鑾峰彇瀵瑰簲鍙傜収
- * @param tableAndField 琛ㄥ埆鍚�.瀛楁鍚�
+ * 鏍规嵁琛ㄥ悕鍜屽瓧娈电殑鑾峰彇瀵瑰簲鍙傜収
+ *
+ * @param tableAndField 琛ㄥ埆鍚�.瀛楁鍚�
* @return 鍙傜収鍚�
*/
public String getReferenceByField(String tableAndField) {
- String [] tableField=tableAndField.replace("1.", ".").split("\\.");
- String tableName=tableField[0];
- String fieldName=tableField[1];
- FieldSetEntity fseTableInfo=baseDao.getFieldSetEntityByFilter("product_sys_datamodel_table", "table_name=?",new Object[] {tableName}, false);
- FieldSetEntity fseFieldInfo=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_DATAMODEL_FIELD, "table_uuid=? and field_name=?", new Object[] {fseTableInfo.getUUID(),fieldName}, false);
- if (fseFieldInfo==null) {
+ String[] tableField = tableAndField.replace("1.", ".").split("\\.");
+ String tableName = tableField[0];
+ String fieldName = tableField[1];
+ FieldSetEntity fseTableInfo = baseDao.getFieldSetEntityByFilter("product_sys_datamodel_table", "table_name=?", new Object[]{tableName}, false);
+ FieldSetEntity fseFieldInfo = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_DATAMODEL_FIELD, "table_uuid=? and field_name=?", new Object[]{fseTableInfo.getUUID(), fieldName}, false);
+ if (fseFieldInfo == null) {
throw new BaseException("", "", this.getClass(), "");
}
- String fieldType=fseFieldInfo.getString(CmnConst.FIELD_TYPE);
+ String fieldType = fseFieldInfo.getString(CmnConst.FIELD_TYPE);
if (CmnConst.USERID.equals(fieldType)) {
return CmnConst.USERID;
- }else {
+ } else {
return fseFieldInfo.getString(CmnConst.FIELD_REFERENCE);
}
}
-
+
/**
- * 鐢熸垚鍏宠仈SQL
+ * 鐢熸垚鍏宠仈SQL
+ *
* @param tableNameAndAlias
- * @param subTable 褰撳墠琛�
+ * @param subTable 褰撳墠琛�
* @return
*/
- public String createTableRelation(Map<String,String>tableNameAndAlias, String subTable) {
+ public String createTableRelation(Map<String, String> tableNameAndAlias, String subTable) {
//鍏宠仈SQL
- StringBuilder relationSql=new StringBuilder();
- relationSql.append(subTable+" ");
- relationSql.append(subTable+"1");
-
+ StringBuilder relationSql = new StringBuilder();
+ relationSql.append(subTable + " ");
+ relationSql.append(subTable + "1");
+
//鍒ゆ柇鏄惁浣跨敤瀛愯〃
- if (tableNameAndAlias!=null) {
+ if (tableNameAndAlias != null) {
//鏍规嵁鍏宠仈瀛愯〃鐢熸垚鍏宠仈SQL
for (String mainTableName : tableNameAndAlias.keySet()) {
//鑾峰彇澶栭敭瀛楁
- String foreignKey=baseDao.getSubTableRelation(mainTableName, subTable);
+ String foreignKey = baseDao.getSubTableRelation(mainTableName, subTable);
if (!StringUtils.isEmpty(foreignKey)) {
relationSql.append(" LEFT JOIN ");
- relationSql.append(mainTableName+" ");
- relationSql.append(mainTableName+"1");
+ relationSql.append(mainTableName + " ");
+ relationSql.append(mainTableName + "1");
relationSql.append(" ON ");
- relationSql.append(mainTableName+"1.uuid=");
- relationSql.append(subTable+"1."+foreignKey);
+ relationSql.append(mainTableName + "1.uuid=");
+ relationSql.append(subTable + "1." + foreignKey);
}
}
}
return relationSql.toString();
}
-
-
- public String getContentByTableSource(FieldSetEntity fse,String content, Map<String, String> concatFieldReference) {
- if (content.indexOf("{#")==-1) {
+
+
+ public String getContentByTableSource(FieldSetEntity fse, String content, Map<String, String> concatFieldReference) {
+ if (content.indexOf("{#") == -1) {
return content;
}
- content=content.replace(".", "1");
+ content = content.replace(".", "1");
return replaceParamText(content, fse, concatFieldReference);
}
-
+
/**
* 鏇挎崲鏂囨湰鍙傛暟
- *
+ *
* @param paramText 鍘熸枃鏈�
* @param fseData 涓氬姟鏁版嵁
* @return 鏂版枃鏈�
@@ -428,8 +494,8 @@
Matcher m = p3.matcher(str);
while (m.find()) {
String group = m.group(2);
- String replaceValue= SystemParamReplace.replaceSystemParameter(group);
- if(StringUtils.isEmpty(replaceValue)) {
+ String replaceValue = SystemParamReplace.replaceSystemParameter(group);
+ if (StringUtils.isEmpty(replaceValue)) {
continue;
}
m.appendReplacement(sb1, replaceValue);
@@ -445,8 +511,8 @@
if (null != value) {
if (StringUtils.isEmpty(concatFieldReference.get(group))) {
m.appendReplacement(sb2, value);
- }else {
- m.appendReplacement(sb2, parseReference(concatFieldReference.get(group),value,fseData));
+ } else {
+ m.appendReplacement(sb2, parseReference(concatFieldReference.get(group), value, fseData));
}
}
}
@@ -454,136 +520,140 @@
}
return sb2.toString();
}
-
+
/**
- * 鍙傜収鏇挎崲
+ * 鍙傜収鏇挎崲
+ *
* @param referenceName
* @param originValue
* @param fseData
* @return
*/
public String parseReference(String referenceName, String originValue, FieldSetEntity fseData) {
- if (CmnConst.USERID.equals(referenceName)) { //浜哄憳
- FieldSetEntity fseUser=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_USERS, "user_id=?", new Object[] {originValue}, false);
- if (fseUser==null) {
+ if (CmnConst.USERID.equals(referenceName)) { //浜哄憳
+ FieldSetEntity fseUser = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_USERS, "user_id=?", new Object[]{originValue}, false);
+ if (fseUser == null) {
throw new BaseException("", "", this.getClass(), "");
- }else {
+ } else {
return fseUser.getString(CmnConst.USER_NAME);
}
- }else if (referenceName.indexOf("銆�")>-1) { //鏁版嵁瀛楀吀
+ } else if (referenceName.indexOf("銆�") > -1) { //鏁版嵁瀛楀吀
referenceName.replace("銆�", "").replace("銆�", "");
- FieldSetEntity fseDict=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_DICT, "dict_name=? AND dict_value=?", new Object[] {referenceName, originValue}, false);
- if (fseDict==null) {
+ FieldSetEntity fseDict = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_DICT, "dict_name=? AND dict_value=?", new Object[]{referenceName, originValue}, false);
+ if (fseDict == null) {
throw new BaseException("", "", this.getClass(), "");
- }else {
+ } else {
return fseDict.getString(CmnConst.DICT_LABEL);
}
- }else { //楂樼骇鍙傜収
- FieldSetEntity fsePrompt=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_PROMPT, "prompt_name=?", new Object[] {referenceName}, false);
- if (fsePrompt==null) {
- throw new BaseException("", "",this.getClass(),"");
- }else {
- String valueField=fsePrompt.getString("value_field");
- String viewField=fsePrompt.getString("view_fields");
- String sourceTable=fsePrompt.getString("source_table");
- FieldSetEntity fsePromptData=baseDao.getFieldSetEntityByFilter(sourceTable, valueField+"=?", new Object[] {originValue}, false);
- if (fsePromptData!=null) {
+ } else { //楂樼骇鍙傜収
+ FieldSetEntity fsePrompt = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_PROMPT, "prompt_name=?", new Object[]{referenceName}, false);
+ if (fsePrompt == null) {
+ throw new BaseException("", "", this.getClass(), "");
+ } else {
+ String valueField = fsePrompt.getString("value_field");
+ String viewField = fsePrompt.getString("view_fields");
+ String sourceTable = fsePrompt.getString("source_table");
+ FieldSetEntity fsePromptData = baseDao.getFieldSetEntityByFilter(sourceTable, valueField + "=?", new Object[]{originValue}, false);
+ if (fsePromptData != null) {
return fsePromptData.getString(viewField);
}
}
}
-
+
return originValue;
}
-
+
/**
- * 瑙f瀽鏉′欢琛ㄨ揪寮�
+ * 瑙f瀽鏉′欢琛ㄨ揪寮�
+ *
* @param warnCOnditon
* @param tableNameAndAlias
* @return
*/
public String parseWarnCondition(String warnConditon, Map<String, String> tableNameAndAlias) {
for (String tableName : tableNameAndAlias.keySet()) {
- if (warnConditon.indexOf(tableName)>-1) {
- warnConditon=warnConditon.replace(tableName, tableNameAndAlias.get(tableName));
+ if (warnConditon.indexOf(tableName) > -1) {
+ warnConditon = warnConditon.replace(tableName, tableNameAndAlias.get(tableName));
}
}
- warnConditon=warnConditon.replace("{#", "").replace("#}", "");
- warnConditon=warnConditon.replace("{%", "").replace("%}", "");
+ warnConditon = warnConditon.replace("{#", "").replace("#}", "");
+ warnConditon = warnConditon.replace("{%", "").replace("%}", "");
return warnConditon;
}
-
+
/**
- * 棰勮鍙戦偖浠惰В鏋�
+ * 棰勮鍙戦偖浠惰В鏋�
+ *
* @param content
* @param receiver
*/
- public void parseMail(String content,String receiver) {
- String[] user_ids=receiver.split(",");
+ public void parseMail(String content, String receiver) {
+ String[] user_ids = receiver.split(",");
for (int i = 0; i < user_ids.length; i++) {
- FieldSetEntity fseStaff=baseDao.getFieldSetEntityByFilter("product_sys_staffs", "user_id=?", new Object[] {user_ids[i]}, false);
- if (fseStaff==null) {
+ FieldSetEntity fseStaff = baseDao.getFieldSetEntityByFilter("product_sys_staffs", "user_id=?", new Object[]{user_ids[i]}, false);
+ if (fseStaff == null) {
continue;
}
- String org_level_uuid=fseStaff.getString(CmnConst.ORG_LEVEL_UUID);
- String userEmail=fseStaff.getString("staff_email");
- FieldSetEntity fseCompanySmtp=baseDao.getFieldSetEntityByFilter("product_sys_company_email_smtp", "org_level_uuid=?", new Object[] {org_level_uuid}, false);
-
- FieldSetEntity fseMailInfo=new FieldSetEntity();
+ String org_level_uuid = fseStaff.getString(CmnConst.ORG_LEVEL_UUID);
+ String userEmail = fseStaff.getString("staff_email");
+ FieldSetEntity fseCompanySmtp = baseDao.getFieldSetEntityByFilter("product_sys_company_email_smtp", "org_level_uuid=?", new Object[]{org_level_uuid}, false);
+
+ FieldSetEntity fseMailInfo = new FieldSetEntity();
fseMailInfo.setTableName(CmnConst.PRODUCT_SYS_MAIL_SEND);
fseMailInfo.setValue(CmnConst.ORG_LEVEL_UUID, org_level_uuid);
fseMailInfo.setValue(CmnConst.ADDRESSEE, userEmail);
fseMailInfo.setValue(CmnConst.MAIL_TITLE, "棰勮淇℃伅");
fseMailInfo.setValue(CmnConst.MAIL_CONTENT, content);
- if (fseCompanySmtp!=null) {
+ if (fseCompanySmtp != null) {
fseMailInfo.setValue(CmnConst.SMTP_SERVER_HOST, fseCompanySmtp.getString(CmnConst.SMTP_SERVER_HOST));
fseMailInfo.setValue(CmnConst.SMTP_SERVER_PORT, fseCompanySmtp.getString(CmnConst.SMTP_SERVER_PORT));
fseMailInfo.setValue(CmnConst.SMTP_USERNAME, fseCompanySmtp.getString(CmnConst.SMTP_USERNAME));
fseMailInfo.setValue(CmnConst.SMTP_LICENSE_CODE, fseCompanySmtp.getString(CmnConst.SMTP_LICENSE_CODE));
- }else {
- fseMailInfo.setValue(CmnConst.SMTP_SERVER_HOST, Global.getSystemConfig("spring.mail.host",""));
- fseMailInfo.setValue(CmnConst.SMTP_SERVER_PORT, Global.getSystemConfig("spring.mail.port",""));
- fseMailInfo.setValue(CmnConst.SMTP_USERNAME, Global.getSystemConfig("spring.mail.username",""));
- fseMailInfo.setValue(CmnConst.SMTP_LICENSE_CODE, Global.getSystemConfig("spring.mail.password",""));
+ } else {
+ fseMailInfo.setValue(CmnConst.SMTP_SERVER_HOST, Global.getSystemConfig("spring.mail.host", ""));
+ fseMailInfo.setValue(CmnConst.SMTP_SERVER_PORT, Global.getSystemConfig("spring.mail.port", ""));
+ fseMailInfo.setValue(CmnConst.SMTP_USERNAME, Global.getSystemConfig("spring.mail.username", ""));
+ fseMailInfo.setValue(CmnConst.SMTP_LICENSE_CODE, Global.getSystemConfig("spring.mail.password", ""));
}
fseMailInfo.setValue("send_mode", "smtp");
- SmtpSendMail.sendMail(fseMailInfo,null);
+ SmtpSendMail.sendMail(fseMailInfo, null);
//鍒涘缓浜哄拰鍒涘缓鏃堕棿
- if (SpringMVCContextHolder.getCurrentUser()!=null) {
+ if (SpringMVCContextHolder.getCurrentUser() != null) {
fseMailInfo.setValue(CmnConst.CREATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
}
- fseMailInfo.setValue(CmnConst.CREATED_UTC_DATETIME,new Date());
+ fseMailInfo.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
baseDao.add(fseMailInfo);
}
}
-
+
/**
- * 棰勮鍙戠煭淇¤В鏋�
+ * 棰勮鍙戠煭淇¤В鏋�
+ *
* @param content
* @param receiver
*/
- public void parseSMS(String content,String receiver) {
- String[] user_ids=receiver.split(",");
+ public void parseSMS(String content, String receiver) {
+ String[] user_ids = receiver.split(",");
for (int i = 0; i < user_ids.length; i++) {
- FieldSetEntity fseuser=baseDao.getFieldSetEntityByFilter("product_sys_users", "user_id=?", new Object[] {user_ids[i]}, false);
- FieldSetEntity fseStaff=baseDao.getFieldSetEntityByFilter("product_sys_staffs", "user_id=?", new Object[] {user_ids[i]}, false);
- if (fseStaff==null) {
+ FieldSetEntity fseuser = baseDao.getFieldSetEntityByFilter("product_sys_users", "user_id=?", new Object[]{user_ids[i]}, false);
+ FieldSetEntity fseStaff = baseDao.getFieldSetEntityByFilter("product_sys_staffs", "user_id=?", new Object[]{user_ids[i]}, false);
+ if (fseStaff == null) {
continue;
}
- String org_level_uuid=fseStaff.getString(CmnConst.ORG_LEVEL_UUID);
- String userPhone=fseuser.getString("user_phone_number");
-
- FieldSetEntity fseMessageInfo=new FieldSetEntity();
+ String org_level_uuid = fseStaff.getString(CmnConst.ORG_LEVEL_UUID);
+ String userPhone = fseuser.getString("user_phone_number");
+
+ FieldSetEntity fseMessageInfo = new FieldSetEntity();
fseMessageInfo.setTableName(CmnConst.PRODUCT_SYS_MESSAGE_SEND);
fseMessageInfo.setValue(CmnConst.ORG_LEVEL_UUID, org_level_uuid);
fseMessageInfo.setValue("send_user", "2");
- fseMessageInfo.setValue("receive_user",userPhone);
+ fseMessageInfo.setValue("receive_user", userPhone);
fseMessageInfo.setValue("content", content);
-
-
- FieldSetEntity fseCompanyMessage=baseDao.getFieldSetEntityByFilter("product_sys_company_email_smtp", "org_level_uuid=?", new Object[] {org_level_uuid}, false);
- if (fseCompanyMessage!=null) {
+
+
+ FieldSetEntity fseCompanyMessage = baseDao.getFieldSetEntityByFilter("product_sys_company_email_smtp", "org_level_uuid=?", new Object[]{org_level_uuid}, false);
+ if (fseCompanyMessage != null) {
fseMessageInfo.setValue(CmnConst.USER_ACCOUNT, fseCompanyMessage.getString(CmnConst.USER_ACCOUNT));
fseMessageInfo.setValue(CmnConst.SECRETKEY, fseCompanyMessage.getString(CmnConst.SECRETKEY));
fseMessageInfo.setValue(CmnConst.ECNAME, fseCompanyMessage.getString(CmnConst.ECNAME));
@@ -591,7 +661,7 @@
fseMessageInfo.setValue(CmnConst.ADDSERIAL, fseCompanyMessage.getString(CmnConst.ADDSERIAL));
fseMessageInfo.setValue(CmnConst.URL, fseCompanyMessage.getString(CmnConst.URL));
fseMessageInfo.setValue(CmnConst.TREATY, fseCompanyMessage.getString(CmnConst.TREATY));
- }else {
+ } else {
fseMessageInfo.setValue(CmnConst.USER_ACCOUNT, "zgctjt");
fseMessageInfo.setValue(CmnConst.SECRETKEY, "zgctjt2019");
fseMessageInfo.setValue(CmnConst.ECNAME, "鑷础甯傚煄甯傚缓璁炬姇璧勫紑鍙戦泦鍥㈡湁闄愬叕鍙�");
@@ -601,43 +671,44 @@
fseMessageInfo.setValue(CmnConst.TREATY, "HTTP");
}
fseMessageInfo.setValue("send_mode", "smtp");
-
+
HttpSmsSendUtil.sendMsg(fseMessageInfo);
fseMessageInfo.setValue(CmnConst.CREATED_BY, 1);
- fseMessageInfo.setValue(CmnConst.CREATED_UTC_DATETIME,new Date());
+ fseMessageInfo.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
baseDao.add(fseMessageInfo);
}
}
-
-
+
+
/**
- * 鑷姩鍙戣捣娴佺▼
+ * 鑷姩鍙戣捣娴佺▼
+ *
* @param flowCode
* @param flowParam
* @param fseService
* @param fieldAndAlias
*/
- public void autoStartFlow(String warnName,String flowCode, String flowParam, FieldSetEntity fseService, Map<String, String>fieldAndAlias, Integer createdBy) {
-
- if (flowCode==null) {
- return ;
+ public void autoStartFlow(String warnName, String flowCode, String flowParam, FieldSetEntity fseService, Map<String, String> fieldAndAlias, Integer createdBy) {
+
+ if (flowCode == null) {
+ return;
}
-
- FieldSetEntity fseFlowService=new FieldSetEntity();
-
- String [] warnAndFlows=flowParam.split(",");
+
+ FieldSetEntity fseFlowService = new FieldSetEntity();
+
+ String[] warnAndFlows = flowParam.split(",");
for (int i = 0; i < warnAndFlows.length; i++) {
- String [] warnAndFlow=warnAndFlows[i].split("=");
- String warnField=warnAndFlow[0];
- String flowField=warnAndFlow[1];
-
+ String[] warnAndFlow = warnAndFlows[i].split("=");
+ String warnField = warnAndFlow[0];
+ String flowField = warnAndFlow[1];
+
fseFlowService.setTableName(flowField.split("\\.")[0]);
fseFlowService.setValue(flowField.split("\\.")[1], fseService.getObject(fieldAndAlias.get(warnField.replace("{#", "").replace("#}", ""))));
}
-
+
baseDao.add(fseFlowService);
-
- FieldSetEntity fseFLow=new FieldSetEntity();
+
+ FieldSetEntity fseFLow = new FieldSetEntity();
fseFLow.setTableName(fseFlowService.getTableName());
fseFLow.setValue("flow_title", warnName);
fseFLow.setValue("uuid", fseFlowService.getUUID());
diff --git a/src/main/java/com/product/administration/service/LeaveRequestService.java b/src/main/java/com/product/administration/service/LeaveRequestService.java
index 8d32b7d..3eb4b21 100644
--- a/src/main/java/com/product/administration/service/LeaveRequestService.java
+++ b/src/main/java/com/product/administration/service/LeaveRequestService.java
@@ -61,16 +61,23 @@
* 璇峰亣鐢宠淇濆瓨
*/
public String saveLeaveRequest(FieldSetEntity fs) throws BaseException {
-// fs.setValue("org_level_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());//鍏徃
-// fs.setValue("fill_in_time", new Date());//濉崟鏃堕棿
-// fs.setValue("department_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());//閮ㄩ棬
- fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());//濮撳悕
- fs.setValue("flow_flag", 0);
- if(StringUtils.isEmpty(fs.getString(CmnConst.UUID))){
- return baseDao.add(fs);
+ DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_ASK_FOR_LEAVE, " uuid not in (?) and user_id=? and ((start_time<=? and end_time>=?) or(start_time<=? and end_time>=?))"
+ , new String[]{StringUtils.isEmpty(fs.getUUID())?"":fs.getUUID(), fs.getString("user_id"), fs.getString("start_time"), fs.getString("start_time"), fs.getString("end_time"), fs.getString("end_time")});
+ if (dataTableEntity.getRows()>0){
+ return "1";
}else {
- baseDao.update(fs);
- return fs.getString(CmnConst.UUID);
+ if (StringUtils.isEmpty(fs.getString(CmnConst.UUID))) {
+ fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
+ fs.setValue("created_utc_datetime", new Date());
+ fs.setValue("org_level_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());
+ return baseDao.add(fs);
+ } else {
+ fs.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
+ fs.setValue("updated_utc_datetime", new Date());
+ baseDao.update(fs);
+ return fs.getString(CmnConst.UUID);
+ }
+
}
}
/**
diff --git a/src/main/java/com/product/administration/service/PunchRecordService.java b/src/main/java/com/product/administration/service/PunchRecordService.java
index cbfc2c6..83f72f5 100644
--- a/src/main/java/com/product/administration/service/PunchRecordService.java
+++ b/src/main/java/com/product/administration/service/PunchRecordService.java
@@ -1,11 +1,23 @@
package com.product.administration.service;
+
+
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
+
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -34,29 +46,264 @@
@Autowired
BaseDao baseDao;
-
+
/**
* 鑰冨嫟鎵撳崱鍒楄〃
* @param fse
* @return
*/
- public DataTableEntity listRecordInfo(FieldSetEntity fse) {
+ 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));
- dt.setFieldFormat("punch_time_one", "yyyy-MM-dd HH:mm:ss");
- dt.setFieldFormat("punch_time_three", "yyyy-MM-dd HH:mm:ss");
+ for (int i=0;i<dt.getRows();i++){
+ FieldSetEntity fieldSetEntity = dt.getData().get(i);
+ String punch_time_one = fieldSetEntity.getValue("punch_time_one").toString();
+ Date date1=new Date(punch_time_one);
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ String sign_date = dateFormat.format(date1);
+ fieldSetEntity.setValue("sign_date",sign_date);
+ DateFormat dateFormatGet = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ //鑾峰彇鏃╅��杩熷埌鐨勫垎閽熸暟
+ List<Object>param1=new ArrayList<>();
+ param1.add(fieldSetEntity.getValue("created_by").toString());
+ param1.add(fieldSetEntity.getValue("punch_congfig_uuid").toString());
+ param1.add(fieldSetEntity.getValue("created_by").toString()+",");
+
+ //鑾峰彇浣跨敤鍒扮殑璁剧疆瑙勫垯
+ 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(" ) ");
+ DataTableEntity dataTableEntity = baseDao.listTable(sbPunchTime.toString(), param1.toArray());
+
+
+ //澶勭悊琛ュ崱鐨勬儏鍐�
+ List<Object>param2=new ArrayList<>();
+ param2.add(fieldSetEntity.getValue("created_by").toString());
+ 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 product_oa_replenish_punch 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' )=? ");
+ DataTableEntity dataTableEntity1 = baseDao.listTable(sbReplenish.toString(), param2.toArray());
+ if(dataTableEntity1.getRows()!=0){
+
+ for(int j=0;j<dataTableEntity1.getRows();j++){
+ String type = dataTableEntity1.getData().get(j).getValue("type").toString();
+ if(type.equals("1")){
+ String morning_work = dataTableEntity.getData().get(0).getValue("morning_work").toString();
+ Date parse = dateFormatGet.parse(morning_work);
+ fieldSetEntity.setValue("punch_time_one", new Timestamp(parse.getTime()));
+ }
+
+ if(type.equals("2")){
+ String morning_work_off = dataTableEntity.getData().get(0).getValue("morning_work_off").toString();
+ Date parse = dateFormatGet.parse(morning_work_off);
+ fieldSetEntity.setValue("punch_time_two", new Timestamp(parse.getTime()));
+ }
+
+ if(type.equals("3")){
+ String afternoon_work = dataTableEntity.getData().get(0).getValue("afternoon_work").toString();
+ Date parse = dateFormatGet.parse(afternoon_work);
+ fieldSetEntity.setValue("punch_time_three", new Timestamp(parse.getTime()));
+ }
+
+ if(type.equals("4")){
+ String afternoon_work_off = dataTableEntity.getData().get(0).getValue("afternoon_work_off").toString();
+ Date parse = dateFormatGet.parse(afternoon_work_off);
+ fieldSetEntity.setValue("punch_time_four", new Timestamp(parse.getTime()));
+ }
+ }
+ }
+
+ long beLate1 = 0;
+ long beLate2 = 0;
+ long beEarily1 = 0;
+ long beEarily2 = 0;
+ if(dataTableEntity.getRows()!=0){
+
+ String morning_work="";
+ String morning_work_off="";
+ String afternoon_work="";
+ String afternoon_work_off="";
+ Date morning_work_date;
+ Date morning_work_off_date;
+ Date afternoon_work_date;
+ Date afternoon_work_off_date;
+
+ DateTime punch_time_one_date;
+ DateTime punch_time_two_date;
+ DateTime punch_time_three_date;
+ DateTime punch_time_four_date;
+
+ SimpleDateFormat dateFormatHHmmss = new SimpleDateFormat("HH:mm:ss");
+
+ StringBuilder lateSb=new StringBuilder();
+ StringBuilder earilySb=new StringBuilder();
+ StringBuilder supereffective_distance=new StringBuilder();
+
+
+ if(!ObjectUtil.isNotEmpty(dataTableEntity.getData().get(0).getValue("morning_work_off")) && !ObjectUtil.isNotEmpty(dataTableEntity.getData().get(0).getValue("afternoon_work"))){
+
+ morning_work = dataTableEntity.getData().get(0).getValue("morning_work").toString();
+ afternoon_work_off = dataTableEntity.getData().get(0).getValue("afternoon_work_off").toString();
+ morning_work_date= DateUtil.parse(morning_work.split(" ")[1]);
+ afternoon_work_off_date= DateUtil.parse(afternoon_work_off.split(" ")[1]);
+ int distance = Integer.parseInt(dataTableEntity.getData().get(0).getValue("distance").toString());
+ if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_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)){
+ beLate1 = DateUtil.between(punch_time_one_date, morning_work_date, DateUnit.MINUTE);
+ lateSb.append("杩熷埌:"+beLate1+"鍒嗛挓");
+ //璁$畻瓒呭嚭鐨勬湁鏁堣窛绂�
+ int punch_range_one = Integer.parseInt(fieldSetEntity.getValue("punch_range_one").toString());
+ if(punch_range_one>distance){
+ int distanceMorning = punch_range_one- distance;
+ fieldSetEntity.setValue("supereffective_distance","涓婄彮瓒呮湁鏁堣窛绂�:"+distanceMorning);
+ }
+ }
+
+ }else {
+ lateSb.append("涓婄彮鏈墦鍗�");
+ }
+
+ if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_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)){
+ beEarily2 = DateUtil.between(punch_time_four_date, afternoon_work_off_date, DateUnit.MINUTE);
+ earilySb.append("鏃╅��:"+beEarily2+"鍒嗛挓");
+ int punch_range_four = Integer.parseInt(fieldSetEntity.getValue("punch_range_four").toString());
+ if(punch_range_four>distance){
+ int distanceMorning = punch_range_four- distance;
+ fieldSetEntity.setValue("supereffective_distance","涓嬬彮瓒呮湁鏁堣窛绂�:"+distanceMorning);
+ }
+ }
+
+ }else {
+ earilySb.append("涓嬬彮鏈墦鍗�");
+ }
+
+ }else {
+
+ morning_work = dataTableEntity.getData().get(0).getValue("morning_work").toString();
+ morning_work_date= DateUtil.parse(morning_work.split(" ")[1]);
+ morning_work_off = dataTableEntity.getData().get(0).getValue("morning_work_off").toString();
+ morning_work_off_date= DateUtil.parse(morning_work_off.split(" ")[1]);
+ afternoon_work =dataTableEntity.getData().get(0).getValue("afternoon_work").toString();
+ afternoon_work_date= DateUtil.parse(afternoon_work.split(" ")[1]);
+ afternoon_work_off = dataTableEntity.getData().get(0).getValue("afternoon_work_off").toString();
+ afternoon_work_off_date= DateUtil.parse(afternoon_work_off.split(" ")[1]);
+
+
+ int distance = Integer.parseInt(dataTableEntity.getData().get(0).getValue("distance").toString());
+
+ if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_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)){
+ beLate1 = DateUtil.between(punch_time_one_date, morning_work_date, DateUnit.MINUTE);
+ lateSb.append("鏃╀笂鐝繜鍒�:"+beLate1+" ");
+ int punch_range_one = Integer.parseInt(fieldSetEntity.getValue("punch_range_one").toString());
+ if(punch_range_one>distance){
+ int distanceMorning = punch_range_one- distance;
+ supereffective_distance.append("鏃╀笂鐝秴鏈夋晥璺濈:"+distanceMorning);
+ }
+
+ }
+
+ }else {
+ lateSb.append("鏃╀笂鐝湭鎵撳崱"+" ");
+
+ }
+
+ if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_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)){
+ beEarily1 = DateUtil.between(punch_time_two_date, morning_work_off_date, DateUnit.MINUTE);
+ earilySb.append("鏃╀笅鐝棭閫�:"+beEarily1+" ");
+ int punch_range_two = Integer.parseInt(fieldSetEntity.getValue("punch_range_two").toString());
+ if(punch_range_two>distance){
+ int distanceMorningoff = punch_range_two- distance;
+ supereffective_distance.append("鏃╀笅鐝秴鏈夋晥璺濈:"+distanceMorningoff);
+ }
+ }
+
+ }else {
+ earilySb.append("鏃╀笅鐝湭鎵撳崱"+" ");
+ }
+ if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_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)){
+ beLate2 = DateUtil.between(punch_time_three_date, afternoon_work_date, DateUnit.MINUTE);
+ lateSb.append("涓嬪崍涓婄彮杩熷埌:"+beLate2+" ");
+ int punch_range_three = Integer.parseInt(fieldSetEntity.getValue("punch_range_three").toString());
+ if(punch_range_three>distance){
+ int distanceAfternoon = punch_range_three- distance;
+ supereffective_distance.append("涓嬪崍涓婄彮瓒呮湁鏁堣窛绂�:"+distanceAfternoon);
+ }
+ }
+ }else {
+ lateSb.append("鏃╀笂鐝湭鎵撳崱"+" ");
+ }
+ if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_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)){
+ beEarily2 = DateUtil.between(punch_time_four_date, afternoon_work_off_date, DateUnit.MINUTE);
+ earilySb.append("涓嬪崍涓嬬彮鏃╅��:"+beEarily2+" ");
+ int punch_range_four = Integer.parseInt(fieldSetEntity.getValue("punch_range_four").toString());
+ if(punch_range_four>distance){
+ int distanceAfternoonoff = punch_range_four- distance;
+ supereffective_distance.append("涓嬪崍涓嬬彮瓒呮湁鏁堣窛绂�:"+distanceAfternoonoff);
+ }
+
+ }
+ }else {
+ earilySb.append("涓嬪崍涓嬬彮鏈墦鍗�"+" ");
+ }
+
+ }
+ fieldSetEntity.setValue("be_late",lateSb);
+ fieldSetEntity.setValue("ealy_leave",earilySb);
+ fieldSetEntity.setValue("supereffective_distance",supereffective_distance.toString());
+ }
+
+ }
+ 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;
}
-
+
/**
* 鑰冨嫟鎵撳崱璇︽儏
* @param uuid
- * @return
+ * @return
*/
public FieldSetEntity findRecordInfo(String uuid) {
return baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_PUNCH_RECORD, uuid, true);
}
-
+
/**
* 鑰冨嫟鎵撳崱鏂板
* @param fse
@@ -64,18 +311,18 @@
*/
public String addRecordInfo(FieldSetEntity fse) {
SimpleDateFormat df = new SimpleDateFormat(CmnConst.YYYYMMDDHHMMSS);
-
+
SystemUser currentUser=SpringMVCContextHolder.getCurrentUser(); //鑾峰彇鎵撳崱浜�
Date created_datetime=fse.getDate("created_datetime"); //鑾峰彇鎵撳崱鏃堕棿
// Date created_datetime=new Date(); //鑾峰彇鎵撳崱鏃堕棿
String string_created_datetime=df.format(created_datetime); //鏃堕棿杞瑂tring
-
+
//鑾峰彇鍏徃鎵撳崱鏃堕棿閰嶇疆淇℃伅
FieldSetEntity fseCompanyPunch=baseDao.getFieldSetEntityByFilter("product_oa_punch_time", "org_level_uuid=?", new Object[] {currentUser.getOrg_level_uuid()}, false);
if (fseCompanyPunch==null) {
throw new BaseException(SystemCode.SYSTEM_CONMAPNY_PUNCH_NO_EXIST.getValue(), SystemCode.SYSTEM_CONMAPNY_PUNCH_NO_EXIST.getText(), this.getClass(), "addRecordInfo");
}
-
+
//鑾峰彇褰撳ぉ鎵撳崱淇℃伅
FieldSetEntity fsePunchInfo=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_OA_PUNCH_RECORD, "created_by=? and DATE_FORMAT(created_utc_datetime,'%Y-%m-%d')like ?", new Object[] {currentUser.getUser_id(),string_created_datetime.substring(0, 10)+"%"}, false);
if (fsePunchInfo==null) {
@@ -89,13 +336,13 @@
//鏂板鎵撳崱淇℃伅
return baseDao.add(fseNewPunchInfo);
}else {
-
+
//鎵撳崱妯″紡(0:鍙屽崱 1:鍥涘崱)
int punchMode=0;
if (StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two"))) {
punchMode=1;
}
-
+
String punch_time_one=fsePunchInfo.getDate("punch_time_one", CmnConst.YYYYMMDDHHMMSS);
String punch_time_two=fsePunchInfo.getDate("punch_time_two", CmnConst.YYYYMMDDHHMMSS);
String punch_time_three=fsePunchInfo.getDate("punch_time_three", CmnConst.YYYYMMDDHHMMSS);
@@ -115,7 +362,7 @@
}
list.add(string_created_datetime);
Collections.sort(list);
-
+
for (int i = 0; i < list.size(); i++) {
if (punchMode==1) {
if (i==0) {
@@ -140,5 +387,5 @@
return fsePunchInfo.getUUID();
}
}
-
+
}
diff --git a/src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java b/src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java
index 09617fe..9ca15d7 100644
--- a/src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java
+++ b/src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java
@@ -1,9 +1,11 @@
package com.product.administration.service;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.List;
+import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -25,7 +27,7 @@
@Autowired
BaseDao baseDao;
-
+
/**
* 鑰冨嫟鎶ヨ〃
* @param dept_uuid 閮ㄩ棬
@@ -36,8 +38,8 @@
Integer monthNum=Integer.valueOf(year_of_month.substring(5, 7)); //鑾峰彇鏈堜唤
Integer yearNum=Integer.valueOf(year_of_month.substring(0,4)); //鑾峰彇骞翠唤
Integer totalDays=WorkDayUtil.getTotalDays(yearNum, monthNum);
-
-
+
+
StringBuilder sb=new StringBuilder();
sb.append(" SELECT USER_ID, ");
for (int i = 1; i <= totalDays; i++) {
@@ -68,10 +70,10 @@
sb.append(" )a GROUP BY USER_ID,DATETIME ORDER BY USER_ID,DATETIME ");
sb.append(" )a ");
sb.append(" GROUP BY USER_ID ");
-
+
return baseDao.listTable(sb.toString(), new Object[] {year_of_month,year_of_month,year_of_month});
}
-
+
/**
* 鎵撳崱鏈堢湅鏉�
* @param fse
@@ -82,173 +84,366 @@
SystemUser currentUser=SpringMVCContextHolder.getCurrentUser();
Integer user_id=currentUser.getUser_id(); //user_id
String org_level_uuid=currentUser.getOrg_level_uuid(); //鍏徃uuid
-
+
//鑾峰彇鍏徃宸ヤ綔鏃堕棿閰嶇疆淇℃伅
FieldSetEntity fseCompanyPunch=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_OA_PUNCH_TIME, "org_level_uuid=?", new Object[] {org_level_uuid}, false);
if (fseCompanyPunch==null) {
throw new BaseException(SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getValue(), SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getText(), this.getClass(), "listMonthKanBan");
}
-
+
//鑾峰彇鏌ヨ鏈堜唤
String yearAndMonth=fse.getString("yearAndMonth");
if (StringUtils.isEmpty(yearAndMonth)) {
yearAndMonth=DateUtils.formatDate(new Date(), "yyyy-MM");
}
-
+
int workTimeMethod=0;
if (!StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && !StringUtils.isEmpty(fseCompanyPunch.getString("work_time_three"))) {
workTimeMethod=1;
}
StringBuilder sb=new StringBuilder();
List<Object> param=new ArrayList<>();
-
+
sb.append(" SELECT ");
sb.append(" DATE_FORMAT(created_utc_datetime,'%Y-%m-%d')punch_date, ");
- sb.append(" punch_time_one,IF(punch_time_one IS TRUE,IF(DATE_FORMAT(punch_time_one,'%H:%i:%S')>?,'杩熷埌','姝e父'),'鏈墦鍗�')result_one, ");
+ sb.append(" punch_time_one,IF(punch_time_one IS TRUE,IF(DATE_FORMAT(punch_time_one,'%H:%i:%S')>?,'杩熷埌','姝e父'),'涓婂崍涓婄彮鏈墦鍗�')result_one, ");
param.add(fseCompanyPunch.getDate("work_time_one","HH:mm:ss"));
-
+
if (workTimeMethod==1) {
- sb.append(" punch_time_two,IF(punch_time_two IS TRUE,IF(DATE_FORMAT(punch_time_two,'%H:%i:%S')<?,'鏃╅��','姝e父'),'鏈墦鍗�')result_two, ");
+ sb.append(" punch_time_two,IF(punch_time_two IS TRUE,IF(DATE_FORMAT(punch_time_two,'%H:%i:%S')<?,'鏃╅��','姝e父'),'涓婂崍涓嬬彮鏈墦鍗�')result_two, ");
param.add(fseCompanyPunch.getDate("work_time_two","HH:mm:ss"));
- sb.append(" punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>?,'杩熷埌','姝e父'),'鏈墦鍗�')result_three, ");
+ sb.append(" punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>?,'杩熷埌','姝e父'),'涓嬪崍涓婄彮鏈墦鍗�')result_three, ");
param.add(fseCompanyPunch.getDate("work_time_three","HH:mm:ss"));
}
-
- sb.append(" punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<?,'鏃╅��','姝e父'),'鏈墦鍗�')result_four ");
+
+ sb.append(" punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<?,'鏃╅��','姝e父'),'涓嬪崍涓婄彮鏈墦鍗�')result_four ");
param.add(fseCompanyPunch.getDate("work_time_four","HH:mm:ss"));
-
+
sb.append(" FROM product_oa_punch_record WHERE created_by=?");
sb.append(" AND DATE_FORMAT(created_utc_datetime,'%Y-%m')=? ");
sb.append(" AND DATE_FORMAT(created_utc_datetime,'%Y-%m-%d') NOT IN (SELECT DATE_FORMAT(date_holiday,'%Y-%m-%d')FROM product_sys_company_holiday WHERE org_level_uuid=?) ");
param.add(user_id);
param.add(yearAndMonth);
param.add(org_level_uuid);
-
+
return baseDao.listTable(sb.toString(), param.toArray());
}
-
+ /**
+ * 鎵撳崱鏈堢湅鏉�(鏂�)
+ * @param fse
+ * @return
+ */
+ public DataTableEntity listMonthKanBanNew(FieldSetEntity fse) {
+ //鑾峰彇褰撳墠浜轰俊鎭�
+ Integer user_id=fse.getInteger("user_id"); //user_id
+ if(user_id==null){
+ return null;
+ }
+
+ //鑾峰彇鏌ヨ鏈堜唤
+ String yearAndMonth=fse.getString("yearAndMonth");
+ if (StringUtils.isEmpty(yearAndMonth)) {
+ yearAndMonth=DateUtils.formatDate(new Date(), "yyyy-MM");
+ }
+
+
+ StringBuilder sb=new StringBuilder();
+ List<Object> param=new ArrayList<>();
+
+ sb.append(" SELECT a.punch_date,e.bk,f.morning_work,f.morning_work_off,f.afternoon_work,f.afternoon_work_off, ");
+
+ sb.append(" CONCAT(if(d.punch_range_one is not null and d.punch_range_one>f.distance,'瓒呭嚭鎵撳崱鑼冨洿',0) ");
+ sb.append(" ,',',if(d.punch_range_two is not null and d.punch_range_two>f.distance,'瓒呭嚭鎵撳崱鑼冨洿',0) ");
+ sb.append(" ,',',if(d.punch_time_three is not null and d.punch_time_three>f.distance,'瓒呭嚭鎵撳崱鑼冨洿',0) ");
+ sb.append(" ,',',if(d.punch_range_four is not null and d.punch_range_four>f.distance,'瓒呭嚭鎵撳崱鑼冨洿',0)) dkfw, ");
+ sb.append(" CASE WHEN b.uuid is not null THEN c.dict_label ELSE ");
+ sb.append(" CASE WHEN d.uuid is not null THEN ");
+ sb.append(" CONCAT(IF(d.punch_time_one IS TRUE, IF ( DATE_FORMAT(d.punch_time_one, '%H:%i:%S' )>DATE_FORMAT(f.morning_work, '%H:%i:%S'), CONCAT('涓婂崍杩熷埌',TIMESTAMPDIFF(MINUTE, DATE_FORMAT(CONCAT(a.punch_date,' ',DATE_FORMAT(f.morning_work, '%H:%i:%S')),'%Y-%m-%d %H:%i:%S'),d.punch_time_one),'鍒嗛挓'), 0 ), '涓婂崍涓婄彮鏈墦鍗�' ) ");
+ sb.append(" ,',',IF(d.punch_time_two IS TRUE, IF ( DATE_FORMAT(d.punch_time_two, '%H:%i:%S' )<DATE_FORMAT(f.morning_work_off, '%H:%i:%S') and f.morning_work_off is not null, CONCAT('涓婂崍鏃╅��',TIMESTAMPDIFF(MINUTE,d.punch_time_two,DATE_FORMAT(CONCAT(a.punch_date,' ',DATE_FORMAT(f.morning_work_off, '%H:%i:%S')),'%Y-%m-%d %H:%i:%S')),'鍒嗛挓'), 0 ), '涓婂崍涓嬬彮鏈墦鍗�' ) ");
+ sb.append(" ,',',IF(d.punch_time_three IS TRUE, IF ( DATE_FORMAT(d.punch_time_three, '%H:%i:%S' )>DATE_FORMAT(f.afternoon_work, '%H:%i:%S') and f.afternoon_work is not null, CONCAT('涓嬪崍杩熷埌',TIMESTAMPDIFF(MINUTE, DATE_FORMAT(CONCAT(a.punch_date,' ',DATE_FORMAT(f.afternoon_work, '%H:%i:%S')),'%Y-%m-%d %H:%i:%S'),d.punch_time_three),'鍒嗛挓'), 0 ), '涓嬪崍涓婄彮鏈墦鍗�' ) ");
+ sb.append(" ,',',IF(d.punch_time_four IS TRUE, IF ( DATE_FORMAT(d.punch_time_four, '%H:%i:%S' )<DATE_FORMAT(f.afternoon_work_off, '%H:%i:%S'), CONCAT('涓嬪崍鏃╅��',TIMESTAMPDIFF(MINUTE,d.punch_time_four,DATE_FORMAT(CONCAT(a.punch_date,' ',DATE_FORMAT(f.afternoon_work_off, '%H:%i:%S')),'%Y-%m-%d %H:%i:%S')),'鍒嗛挓'), 0 ), '涓嬪崍涓嬬彮鏈墦鍗�' )) ");
+ sb.append(" ELSE '鍏ㄥぉ鏈墦鍗�' END END reidis,CASE WHEN b.uuid is not null THEN 1 ELSE CASE WHEN d.uuid is not null THEN 0 ELSE 2 END END type ");
+ sb.append(" FROM (SELECT CONCAT(DATE_FORMAT(?, '%Y-%m-'),IF(i<9,CONCAT('0',i + 1),i + 1)) punch_date ");
+ param.add(yearAndMonth+"-01");
+ sb.append(" FROM (SELECT @row := @row + 1 as i FROM ");
+ sb.append(" (SELECT 0 UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) t1, ");
+ sb.append(" (SELECT 0 UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) t2, ");
+ sb.append(" (SELECT 0 UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) t3, ");
+ sb.append(" (SELECT 0 UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) t4, ");
+ sb.append(" (SELECT @row := -1) t0) d WHERE i < DAY(last_day(DATE_FORMAT(?, '%Y-%m-01')))) a ");
+ param.add(yearAndMonth+"-01");
+ sb.append(" LEFT JOIN (SELECT * FROM product_oa_ask_for_leave WHERE user_id=?) b ");
+ param.add(user_id);
+ sb.append(" on DATE_FORMAT( a.punch_date, '%Y-%m-%d' )>= DATE_FORMAT( b.start_time, '%Y-%m-%d' ) and DATE_FORMAT( a.punch_date, '%Y-%m-%d' )<= DATE_FORMAT( b.end_time, '%Y-%m-%d' ) ");
+ sb.append(" LEFT JOIN (SELECT * FROM product_sys_dict where dict_name='Leave_Type') c on b.leave_type =c.dict_value ");
+ sb.append(" LEFT JOIN product_oa_punch_record d on a.punch_date=DATE_FORMAT( d.punch_time_one, '%Y-%m-%d' ) ");
+ sb.append(" LEFT JOIN (SELECT applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d') replenish_date,max(replacement_card_type) bk FROM product_oa_replenish_punch ");
+ sb.append(" where applicant=? GROUP BY applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d')) e on a.punch_date=e.replenish_date ");
+ param.add(user_id);
+ sb.append(" LEFT JOIN product_oa_punch_time f on d.punch_congfig_uuid =f.punch_site_uuid ");
+ sb.append(" where a.punch_date NOT IN (SELECT DATE_FORMAT( date_holiday, '%Y-%m-%d' ) FROM product_sys_company_holiday) ");
+ DataTableEntity dt = baseDao.listTable(sb.toString(), param.toArray());
+ for (int i = 0; i < dt.getRows(); i++) {
+ FieldSetEntity fs = dt.getFieldSetEntity(i);
+ //鑾峰彇琛ュ崱鏍囪瘑
+ List<String> bk=new ArrayList<>();
+ if (!StringUtils.isEmpty(fs.getString("bk"))){
+ bk= Arrays.asList(fs.getString("bk").split(","));
+ }
+ if (fs.getString("reidis").equals("鍏ㄥぉ鏈墦鍗�")&&!StringUtils.isEmpty(fs.getString("bk"))){
+ if (!bk.contains("1")){
+ fs.setValue("result_one", "涓婂崍涓婄彮鏈墦鍗�");
+ }
+ if (!bk.contains("2")&&!StringUtils.isEmpty(fs.getString("morning_work_off"))){
+ fs.setValue("result_two", "涓婂崍涓嬬彮鏈墦鍗�");
+ }
+ if (!bk.contains("3")&&!StringUtils.isEmpty(fs.getString("afternoon_work"))){
+ fs.setValue("result_three", "涓嬪崍涓婄彮鏈墦鍗�");
+ }
+ if (!bk.contains("4")){
+ fs.setValue("result_four", "涓嬪崍涓嬬彮鏈墦鍗�");
+ }
+ continue;
+ }
+ if ("0".equals(fs.getString("type"))){
+ String[] reidis = fs.getString("reidis").split(",");
+ String[] dkfwsArr = fs.getString("dkfw").split(",");
+ String a="1";
+ for (int j = 0; j < reidis.length; j++) {
+ String dkfws="";
+ if (!dkfwsArr[j].equals("0")){
+ dkfws=dkfwsArr[j];
+ }
+ if (reidis[j].contains("涓婂崍杩熷埌")) {
+ if (!bk.contains("1")) {
+ fs.setValue("result_one", reidis[j]+dkfws);
+ a = "2";
+ }
+ }
+ if (reidis[j].contains("涓婂崍鏃╅��")) {
+ if (!bk.contains("2")) {
+ fs.setValue("result_two", reidis[j]+dkfws);
+ a = "2";
+ }
+ }
+ if (reidis[j].contains("涓嬪崍杩熷埌")) {
+ if (!bk.contains("3")) {
+ fs.setValue("result_three", reidis[j]+dkfws);
+ a = "2";
+ }
+ }
+ if (reidis[j].contains("涓嬪崍鏃╅��")) {
+ if (!bk.contains("3")) {
+ fs.setValue("result_four", reidis[j]+dkfws);
+ a = "2";
+ }
+ }
+ }
+ if ("1".equals(a)){
+ fs.setValue("type",a);
+ fs.setValue("result_one","姝e父鎵撳崱");
+ }
+
+ }else {
+ fs.setValue("result_one",fs.getString("reidis"));
+ }
+ }
+ return dt;
+ }
/**
* 鑰冨嫟缁熻鎶ヨ〃
* @param fse
* @return
*/
public DataTableEntity listMonthReport(FieldSetEntity fse) {
-
+
//鑾峰彇褰撳墠浜轰俊鎭�
SystemUser currentUser=SpringMVCContextHolder.getCurrentUser();
- String org_level_uuid=currentUser.getOrg_level_uuid();
-
- //鑾峰彇鍏徃宸ヤ綔鏃堕棿閰嶇疆淇℃伅
- FieldSetEntity fseCompanyPunch=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_OA_PUNCH_TIME, "org_level_uuid=?", new Object[] {org_level_uuid}, false);
- if (fseCompanyPunch==null) {
- throw new BaseException(SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getValue(), SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getText(), this.getClass(), "listMonthReport");
+ List<Object>param1=new ArrayList<>();
+ param1.add(currentUser.getUser_id());
+ param1.add(currentUser.getUser_id()+",");
+ //鑾峰彇浣跨敤鍒扮殑璁剧疆瑙勫垯
+ StringBuilder sbPunchTime=new StringBuilder();
+ sbPunchTime.append(" SELECT DISTINCT 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=? ");
+ 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(" ) ");
+ DataTableEntity dataTableEntity = baseDao.listTable(sbPunchTime.toString(), param1.toArray());
+ List<DataTableEntity> dataTableEntityLits=new ArrayList<>();
+ for(int i=0;i<dataTableEntity.getRows();i++){
+
+ FieldSetEntity fseCompanyPunch = dataTableEntity.getData().get(i);
+ if (fseCompanyPunch==null) {
+ throw new BaseException(SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getValue(), SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getText(), this.getClass(), "listMonthReport");
+ }
+ //鑾峰彇鏌ヨ鏈堜唤
+ String yearAndMonth=fse.getString("yearAndMonth");
+ if (StringUtils.isEmpty(yearAndMonth)) {
+ yearAndMonth=DateUtils.formatDate(new Date(), "yyyy-MM");
+ }
+
+ //鑾峰彇姣忔湀澶╂暟
+ int dayOfMonth = DateUtils.getMonthHasDays(DateUtils.parseDate(yearAndMonth));
+ //鑾峰彇鏈湀鑺傚亣鏃�
+ DataTableEntity dtHoliday=baseDao.listTable("product_sys_company_holiday", "date_holiday like ?", new Object[] {yearAndMonth+"%"});
+ //鑾峰彇姣忔湀搴斾笂鐝ぉ鏁�
+ int dayOfWork = 0;
+ if (BaseUtil.dataTableIsEmpty(dtHoliday)) {
+ dayOfWork=dayOfMonth;
+ }else {
+ dayOfWork=dayOfMonth-dtHoliday.getRows();
+ }
+
+
+ StringBuilder sb=new StringBuilder();
+ List<Object>param=new ArrayList<>();
+ String morinng_work = fseCompanyPunch.getValue("morning_work").toString().split(" ")[1];
+ param.add(morinng_work);
+ if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
+ String morinng_work_off = fseCompanyPunch.getValue("morning_work_off").toString().split(" ")[1];
+ String afternoon_work = fseCompanyPunch.getValue("afternoon_work").toString().split(" ")[1];
+ param.add(afternoon_work);
+ param.add(morinng_work_off);
+ }
+
+ String afternoon_work_off = fseCompanyPunch.getValue("afternoon_work_off").toString().split(" ")[1];
+ String uuid = fseCompanyPunch.getValue("uuid").toString();
+
+ param.add(afternoon_work_off);
+ param.add(yearAndMonth);
+ param.add(uuid);
+ param.add(yearAndMonth);
+ param.add(yearAndMonth);
+ sb.append(" SELECT ");
+ sb.append(" (SELECT user_name FROM product_sys_users WHERE user_id=a.created_by)created_by, ");
+ sb.append(" (SELECT org_level_name FROM product_sys_org_levels WHERE uuid=dept_uuid)dept_uuid, ");
+ sb.append(" dayOfWork,workDayOfMonth,lateCome,leaveEarly,total_hours,casual_leave,medical_leave,marriage_leave,paid_leave,other_leave,(dayOfWork-workDayOfMonth)absenteeism ");
+ sb.append(" FROM ( ");
+ if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
+ sb.append(" SELECT b.created_by,b.dayOfWork,b.workDayOfMonth,b.dept_uuid,b.lateCome1+b.lateCome2 lateCome,b.leaveEarly1+b.leaveEarly2 leaveEarly");
+ }else {
+ sb.append(" SELECT b.created_by,b.dayOfWork,b.workDayOfMonth,b.dept_uuid,b.lateCome1 lateCome,b.leaveEarly2 leaveEarly");
+ }
+
+ sb.append(" FROM ( ");
+ sb.append(" SELECT ");
+ sb.append(" a.created_by,"+dayOfWork+" dayOfWork,COUNT(day_of_month)workDayOfMonth,a.dept_uuid, ");
+ sb.append(" COUNT(");
+ sb.append(" IF ");
+ sb.append(" ( result1 = '杩熷埌', TRUE, NULL )) lateCome1,");
+ if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
+ sb.append(" COUNT(");
+ sb.append(" IF ");
+ sb.append(" ( result2 = '杩熷埌', TRUE, NULL )) lateCome2,");
+ sb.append(" COUNT(");
+ sb.append(" IF ");
+ sb.append(" ( result3 = '鏃╅��', TRUE, NULL )) leaveEarly1,");
+
+ }
+ sb.append(" COUNT(");
+ sb.append(" IF ");
+ sb.append(" ( result4 = '鏃╅��', TRUE, NULL )) leaveEarly2 ");
+ sb.append(" FROM ( ");
+ sb.append(" SELECT d.created_by,d.dept_uuid,DATE_FORMAT( d.created_utc_datetime, '%Y-%m-%d' ) day_of_month,punch_time_one, ");
+ sb.append(" IF ");
+ sb.append(" ( punch_time_one IS TRUE, IF ( DATE_FORMAT( punch_time_one, '%H:%i:%S' )> ?, '杩熷埌', '姝e父' ), '鏈墦鍗�' ) ");
+ sb.append(" result1 ,");
+ if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
+ sb.append(" IF ");
+ sb.append(" ( punch_time_three IS TRUE, IF ( DATE_FORMAT( punch_time_three, '%H:%i:%S' )> ?, '杩熷埌', '姝e父' ), '鏈墦鍗�' ) ");
+ sb.append(" result2 ,");
+ sb.append(" IF ");
+ sb.append(" ( punch_time_two IS TRUE, IF ( DATE_FORMAT( punch_time_two, '%H:%i:%S' )< ?, '鏃╅��', '姝e父' ), '鏈墦鍗�' ) ");
+ sb.append(" result3 ,");
+ }
+
+ sb.append(" IF ");
+ sb.append(" ( punch_time_four IS TRUE, IF ( DATE_FORMAT( punch_time_four, '%H:%i:%S' ) < ?, '鏃╅��', '姝e父' ), '鏈墦鍗�' ) ");
+ sb.append(" result4 ");
+ sb.append(" FROM product_oa_punch_record d ");
+ sb.append(" left JOIN product_oa_punch_time e ");
+ sb.append(" on d.punch_congfig_uuid=e.punch_site_uuid ");
+ sb.append(" and DATE_FORMAT( d.created_utc_datetime,'%Y-%m')=? AND DATE_FORMAT(punch_time_one,'%Y-%m-%d') NOT IN(SELECT date_holiday FROM product_sys_company_holiday) ");
+ sb.append(" where e.uuid=? ");
+ sb.append(" )a ");
+ sb.append(" GROUP BY a.created_by,a.dept_uuid ");
+ sb.append(" )b");
+ sb.append(" )a ");
+ sb.append(" LEFT JOIN (SELECT user_id, sum( duration ) total_hours FROM product_oa_work_overtime o left join product_oa_work_overtime_sub b on o.uuid=b.main_uuid and DATE_FORMAT( b.start_time, '%Y-%m' )=? GROUP BY o.user_id)b ");
+ sb.append(" ON a.created_by=b.user_id ");
+ sb.append(" LEFT JOIN ( ");
+ sb.append(" SELECT ");
+ sb.append(" created_by,sum(IF(leave_type=1,TRUE,0))casual_leave,sum(IF(leave_type=2,TRUE,0))medical_leave, ");
+ sb.append(" sum(IF(leave_type=9,TRUE,0))marriage_leave,sum(IF(leave_type=4,TRUE,0))paid_leave, ");
+ sb.append(" sum(IF(leave_type!=1 && leave_type!=2 && leave_type!=4 && leave_type!=9,TRUE,0))other_leave ");
+ sb.append(" FROM product_oa_ask_for_leave ");
+ sb.append(" WHERE DATE_FORMAT(start_time,'%Y-%m')=? ");
+ sb.append(" GROUP BY created_by ");
+ sb.append(" )c ");
+ sb.append(" ON a.created_by=c.created_by ");
+ sb.append(" ORDER BY dept_uuid,a.created_by ");
+ DataTableEntity dataTableEntityReport = baseDao.listTable(sb.toString(), param.toArray());
+ if(dataTableEntityReport.getRows()!=0){
+ dataTableEntityLits.add(baseDao.listTable(sb.toString(), param.toArray()));
+ }
+
}
-
- //鑾峰彇鏌ヨ鏈堜唤
- String yearAndMonth=fse.getString("yearAndMonth");
- if (StringUtils.isEmpty(yearAndMonth)) {
- yearAndMonth=DateUtils.formatDate(new Date(), "yyyy-MM");
+ DataTableEntity dataTableEntity1=new DataTableEntity();
+ if(ObjectUtil.isNotEmpty(dataTableEntityLits)){
+ dataTableEntity1=dataTableEntityLits.get(0);
+ //鏈湀鍐呰繜鍒版棭閫�鏁扮殑绱姞
+ for (int i = 1; i < dataTableEntityLits.size(); i++) {
+ FieldSetEntity fieldSetEntity = dataTableEntityLits.get(i).getData().get(0);
+ FieldSetEntity fieldSetEntity1 = dataTableEntity1.getData().get(0);
+ dataTableEntity1.getData().get(0).setValue("lateCome",Integer.parseInt(fieldSetEntity.getValue("lateCome").toString())+Integer.parseInt(fieldSetEntity1.getValue("lateCome").toString()));
+ dataTableEntity1.getData().get(0).setValue("leaveEarly",Integer.parseInt(fieldSetEntity.getValue("leaveEarly").toString())+Integer.parseInt(fieldSetEntity1.getValue("leaveEarly").toString()));
+ dataTableEntity1.getData().get(0).setValue("workDayOfMonth",Integer.parseInt(fieldSetEntity.getValue("workDayOfMonth").toString())+Integer.parseInt(fieldSetEntity1.getValue("workDayOfMonth").toString()));
+ dataTableEntity1.getData().get(0).setValue("absenteeism",Integer.parseInt(fieldSetEntity1.getValue("absenteeism").toString())-Integer.parseInt(fieldSetEntity.getValue("workDayOfMonth").toString()));
+ }
+
+
+
}
-
- //鑾峰彇姣忔湀澶╂暟
- int dayOfMonth = DateUtils.getMonthHasDays(DateUtils.parseDate(yearAndMonth));
- //鑾峰彇鏈湀鑺傚亣鏃�
- DataTableEntity dtHoliday=baseDao.listTable("product_sys_company_holiday", "date_holiday like ?", new Object[] {yearAndMonth+"%"});
- //鑾峰彇姣忔湀搴斾笂鐝ぉ鏁�
- int dayOfWork = 0;
- if (BaseUtil.dataTableIsEmpty(dtHoliday)) {
- dayOfWork=dayOfMonth;
- }else {
- dayOfWork=dayOfMonth-dtHoliday.getRows();
+
+ //澶勭悊琛ュ崱鐨勬儏鍐�
+ List<Object>param2=new ArrayList<>();
+ param2.add(currentUser);
+ param2.add(fse.getString("yearAndMonth"));
+
+ StringBuilder sbReplenish=new StringBuilder();
+ sbReplenish.append(" SELECT DISTINCT replenish_date ");
+ sbReplenish.append(" FROM product_oa_replenish_punch ");
+ sbReplenish.append(" WHERE");
+ sbReplenish.append(" created_by =? ");
+ sbReplenish.append(" AND DATE_FORMAT( replenish_date, '%Y-%m' )=? ");
+ sbReplenish.append(" and DATE_FORMAT( replenish_date, '%Y-%m-%d') ");
+ sbReplenish.append(" not in (");
+ sbReplenish.append(" SELECT DISTINCT record_data FROM ");
+ sbReplenish.append(" ( ");
+ sbReplenish.append(" select DATE_FORMAT(punch_time_one, '%Y-%m-%d') as record_data from product_oa_punch_record ");
+ sbReplenish.append(" union all select DATE_FORMAT(punch_time_two, '%Y-%m-%d') as record_data from product_oa_punch_record");
+ sbReplenish.append(" union all select DATE_FORMAT(punch_time_three, '%Y-%m-%d') as record_data from product_oa_punch_record");
+ sbReplenish.append(" union all select DATE_FORMAT(punch_time_four, '%Y-%m-%d') as record_data from product_oa_punch_record");
+ sbReplenish.append(" )n )");
+ DataTableEntity dataTableEntityReplenish = baseDao.listTable(sbReplenish.toString(), param2.toArray());
+ if(dataTableEntityReplenish.getRows()!=0){
+ dataTableEntity1.getData().get(0).setValue("workDayOfMonth",Integer.parseInt(dataTableEntity1.getData().get(0).getString("workDayOfMonth"))+dataTableEntityReplenish.getRows());
+ dataTableEntity1.getData().get(0).setValue("dayOfWork",Integer.parseInt(dataTableEntity1.getData().get(0).getString("dayOfWork"))-dataTableEntityReplenish.getRows());
}
-
- //workTimeMethod 0:涓婂崍涓婄彮锛屼笅鍗堜笅鐝� 1:涓�鍗� 2:鍥涘崱 3:涓婂崍涓婄彮锛屼笅鍗堜笂鐝�
- int workTimeMethod=0;
- if (StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && StringUtils.isEmpty(fseCompanyPunch.getString("work_time_three")) && StringUtils.isEmpty(fseCompanyPunch.getString("work_time_four"))) {
- workTimeMethod=1;
- } else if (!StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && !StringUtils.isEmpty(fseCompanyPunch.getString("work_time_three")) && !StringUtils.isEmpty(fseCompanyPunch.getString("work_time_four"))) {
- workTimeMethod=2;
- } else if (StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && StringUtils.isEmpty(fseCompanyPunch.getString("work_time_four"))) {
- workTimeMethod=3;
- }
-
- StringBuilder sb=new StringBuilder();
- List<Object>param=new ArrayList<>();
- param.add(yearAndMonth);
- param.add(yearAndMonth);
- param.add(yearAndMonth);
- sb.append(" SELECT ");
- sb.append(" (SELECT user_name FROM product_sys_users WHERE user_id=a.created_by)created_by, ");
- sb.append(" (SELECT org_level_name FROM product_sys_org_levels WHERE uuid=dept_uuid)dept_uuid, ");
- sb.append(" dayOfWork,workDayOfMonth,lateCome,leaveEarly,total_hours,casual_leave,medical_leave,marriage_leave,paid_leave,other_leave,(dayOfWork-workDayOfMonth)absenteeism ");
- sb.append(" FROM ( ");
- sb.append(" SELECT ");
- sb.append(" a.created_by,"+dayOfWork+" dayOfWork,COUNT(day_of_month)workDayOfMonth,a.dept_uuid, ");
-
- if (workTimeMethod==0) {
- sb.append(" COUNT(IF(result1='杩熷埌',TRUE,NULL)) lateCome, ");
- sb.append(" COUNT(IF(result4='鏃╅��',TRUE,NULL)) leaveEarly ");
- }else if (workTimeMethod==1) {
- sb.append(" COUNT(IF(result1='杩熷埌',TRUE,NULL)) lateCome, ");
- sb.append(" 0 leaveEarly ");
- }else if (workTimeMethod==2) {
- sb.append(" COUNT(IF(result1='杩熷埌',TRUE,NULL))+COUNT(IF(result3='杩熷埌',TRUE,NULL)) lateCome, ");
- sb.append(" COUNT(IF(result2='鏃╅��',TRUE,NULL))+COUNT(IF(result4='鏃╅��',TRUE,NULL)) leaveEarly ");
- }else if (workTimeMethod==3) {
- sb.append(" COUNT(IF(result1='杩熷埌',TRUE,NULL))+COUNT(IF(result3='杩熷埌',TRUE,NULL)) lateCome, ");
- sb.append(" 0 leaveEarly ");
- }
- /*
- if (workTimeMethod==1) {
- sb.append(" COUNT(IF(result1='杩熷埌',TRUE,NULL))+COUNT(IF(result3='杩熷埌',TRUE,NULL)) lateCome, ");
- sb.append(" COUNT(IF(result2='鏃╅��',TRUE,NULL))+COUNT(IF(result4='鏃╅��',TRUE,NULL)) leaveEarly ");
- } else if (workTimeMethod==2) {
- sb.append("");
- } else if (workTimeMethod==3) {
-
- } else {
- sb.append(" COUNT(IF(result1='杩熷埌',TRUE,NULL)) lateCome, ");
- sb.append(" COUNT(IF(result4='鏃╅��',TRUE,NULL)) leaveEarly ");
- }
- */
- sb.append(" FROM ( ");
- sb.append(" SELECT ");
- sb.append(" created_by,dept_uuid, ");
- sb.append(" DATE_FORMAT(created_utc_datetime,'%Y-%m-%d') day_of_month, ");
- sb.append(" punch_time_one,IF(punch_time_one IS TRUE,IF(DATE_FORMAT(punch_time_one,'%H:%i:%S')>'09:00:00','杩熷埌','姝e父'),'鏈墦鍗�') result1 ");
-
-// sb.append(" punch_time_two,IF(punch_time_two IS TRUE,IF(DATE_FORMAT(punch_time_two,'%H:%i:%S')<'12:00:00','鏃╅��','姝e父'),'鏈墦鍗�') result2, ");
-// sb.append(" punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>'14:00:00','杩熷埌','姝e父'),'鏈墦鍗�') result3, ");
-// sb.append(" punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<'17:00:00','鏃╅��','姝e父'),'鏈墦鍗�') result4 ");
- if (workTimeMethod==0) {
- sb.append(", punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<'17:00:00','鏃╅��','姝e父'),'鏈墦鍗�') result4 ");
- }else if (workTimeMethod==2) {
- sb.append(", punch_time_two,IF(punch_time_two IS TRUE,IF(DATE_FORMAT(punch_time_two,'%H:%i:%S')<'12:00:00','鏃╅��','姝e父'),'鏈墦鍗�') result2 ");
- sb.append(", punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>'14:00:00','杩熷埌','姝e父'),'鏈墦鍗�') result3 ");
- sb.append(", punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<'17:00:00','鏃╅��','姝e父'),'鏈墦鍗�') result4 ");
- }else if (workTimeMethod==3) {
- sb.append(", punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>'14:00:00','杩熷埌','姝e父'),'鏈墦鍗�') result3 ");
- }
-
- sb.append(" FROM product_oa_punch_record ");
- sb.append(" WHERE DATE_FORMAT(created_utc_datetime,'%Y-%m')=? AND DATE_FORMAT(punch_time_one,'%Y-%m-%d') NOT IN(SELECT date_holiday FROM product_sys_company_holiday) ");
- sb.append(" )a ");
- sb.append(" GROUP BY a.created_by,a.dept_uuid ");
- sb.append(" )a ");
- sb.append(" LEFT JOIN (SELECT user_id,sum(total_hours)total_hours FROM product_oa_work_overtime WHERE flow_flag=2 AND DATE_FORMAT(start_time,'%Y-%m')=? GROUP BY user_id)b ");
- sb.append(" ON a.created_by=b.user_id ");
- sb.append(" LEFT JOIN ( ");
- sb.append(" SELECT ");
- sb.append(" created_by,sum(IF(leave_type=1,TRUE,0))casual_leave,sum(IF(leave_type=2,TRUE,0))medical_leave, ");
- sb.append(" sum(IF(leave_type=9,TRUE,0))marriage_leave,sum(IF(leave_type=4,TRUE,0))paid_leave, ");
- sb.append(" sum(IF(leave_type!=1 && leave_type!=2 && leave_type!=4 && leave_type!=9,TRUE,0))other_leave ");
- sb.append(" FROM product_oa_ask_for_leave ");
- sb.append(" WHERE DATE_FORMAT(start_time,'%Y-%m')=? ");
- sb.append(" GROUP BY created_by ");
- sb.append(" )c ");
- sb.append(" ON a.created_by=c.created_by ");
- sb.append(" ORDER BY dept_uuid,a.created_by ");
-
- return baseDao.listTable(sb.toString(), param.toArray());
+
+ return dataTableEntity1;
+
}
+
+
+
+
}
diff --git a/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java b/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
index 5e81d26..a842460 100644
--- a/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
+++ b/src/main/java/com/product/administration/service/ide/IConferenceManagerService.java
@@ -1,7 +1,10 @@
package com.product.administration.service.ide;
+import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.exception.BaseException;
+
+import java.util.List;
/**
* 浼氳瀹ょ鐞�
@@ -29,4 +32,9 @@
boolean delConferenceApply(FieldSetEntity fse)throws BaseException;
+ List getKbData(FieldSetEntity fse)throws BaseException;
+
+ DataTableEntity getMeetingDetails(FieldSetEntity fse)throws BaseException;
+
+
}
diff --git a/src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java b/src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java
index 2a9a4b6..67cd05c 100644
--- a/src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java
+++ b/src/main/java/com/product/administration/service/ide/IEarlyWarningManager.java
@@ -7,30 +7,30 @@
import com.product.core.exception.BaseException;
public interface IEarlyWarningManager {
-
+
/**
* 棰勮閰嶇疆鏂板
* @param fse
* @return
*/
String addWarning(FieldSetEntity fse) throws BaseException, SchedulerException, TaskException;
-
+
/**
* 棰勮閰嶇疆淇敼
* @param fse
* @return
- * @throws TaskException
- * @throws SchedulerException
- * @throws BaseException
+ * @throws TaskException
+ * @throws SchedulerException
+ * @throws BaseException
*/
boolean updateWarning(FieldSetEntity fse) throws BaseException, SchedulerException, TaskException;
-
+
/**
* 棰勮閰嶇疆鍒犻櫎
* @param uuid
* @return
- * @throws SchedulerException
- * @throws BaseException
+ * @throws SchedulerException
+ * @throws BaseException
*/
boolean deleteWarning(String uuid) throws BaseException, SchedulerException;
@@ -42,4 +42,10 @@
* @throws BaseException
*/
boolean updateEarlyWarningTime(FieldSetEntity fse)throws BaseException, SchedulerException, TaskException;
+
+ /**
+ * 杞彂
+ * @param fse
+ */
+ void transmit(FieldSetEntity fse);
}
--
Gitblit v1.9.2