Przeglądaj źródła

后台事物提交更新-

huchenghua 6 miesięcy temu
rodzic
commit
807af157f7

+ 4 - 4
metadata/com/kingdee/eas/hr/project/app/WorkHoursFacade.facade

@@ -40,7 +40,7 @@
                     <alias>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[initWorkHoursReport].parameters.parameter[star].alias</alias>
                     <description>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[initWorkHoursReport].parameters.parameter[star].description</description>
                     <direction>in</direction>
-                    <dataType>Date</dataType>
+                    <dataType>String</dataType>
                     <metadataRef />
                     <userDefined>true</userDefined>
                 </parameter>
@@ -49,7 +49,7 @@
                     <alias>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[initWorkHoursReport].parameters.parameter[end].alias</alias>
                     <description>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[initWorkHoursReport].parameters.parameter[end].description</description>
                     <direction>in</direction>
-                    <dataType>Date</dataType>
+                    <dataType>String</dataType>
                     <metadataRef />
                     <userDefined>true</userDefined>
                 </parameter>
@@ -99,7 +99,7 @@
                     <alias>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[updateWorkHoursReport].parameters.parameter[star].alias</alias>
                     <description>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[updateWorkHoursReport].parameters.parameter[star].description</description>
                     <direction>in</direction>
-                    <dataType>Date</dataType>
+                    <dataType>String</dataType>
                     <metadataRef />
                     <userDefined>true</userDefined>
                 </parameter>
@@ -108,7 +108,7 @@
                     <alias>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[updateWorkHoursReport].parameters.parameter[end].alias</alias>
                     <description>facade[com.kingdee.eas.hr.project.app.WorkHoursFacade].methods.method[updateWorkHoursReport].parameters.parameter[end].description</description>
                     <direction>in</direction>
-                    <dataType>Date</dataType>
+                    <dataType>String</dataType>
                     <metadataRef />
                     <userDefined>true</userDefined>
                 </parameter>

+ 4 - 5
src/com/kingdee/eas/hr/project/app/AbstractWorkHoursFacadeControllerBean.java

@@ -21,7 +21,6 @@ import com.kingdee.eas.framework.exception.EASMultiException;
 import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
 
 import com.kingdee.eas.common.EASBizException;
-import java.util.Date;
 import java.lang.String;
 
 
@@ -37,7 +36,7 @@ public abstract class AbstractWorkHoursFacadeControllerBean extends AbstractBizC
         return new BOSObjectType("BAE52A17");
     }
 
-    public void initWorkHoursReport(Context ctx, String number, Date star, Date end, int day) throws BOSException, EASBizException
+    public void initWorkHoursReport(Context ctx, String number, String star, String end, int day) throws BOSException, EASBizException
     {
         try {
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("f7623cd7-2ef0-4404-bee8-5266f4be2259"), new Object[]{ctx, number, star, end, new Integer(day)});
@@ -54,12 +53,12 @@ public abstract class AbstractWorkHoursFacadeControllerBean extends AbstractBizC
             super.cleanUpServiceState();
         }
     }
-    protected void _initWorkHoursReport(Context ctx, String number, Date star, Date end, int day) throws BOSException, EASBizException
+    protected void _initWorkHoursReport(Context ctx, String number, String star, String end, int day) throws BOSException, EASBizException
     {    	
         return;
     }
 
-    public void updateWorkHoursReport(Context ctx, String number, Date star, Date end, int day) throws BOSException, EASBizException
+    public void updateWorkHoursReport(Context ctx, String number, String star, String end, int day) throws BOSException, EASBizException
     {
         try {
             ServiceContext svcCtx = createServiceContext(new MetaDataPK("04b73688-3af9-41e8-97bf-47318cdddd69"), new Object[]{ctx, number, star, end, new Integer(day)});
@@ -76,7 +75,7 @@ public abstract class AbstractWorkHoursFacadeControllerBean extends AbstractBizC
             super.cleanUpServiceState();
         }
     }
-    protected void _updateWorkHoursReport(Context ctx, String number, Date star, Date end, int day) throws BOSException, EASBizException
+    protected void _updateWorkHoursReport(Context ctx, String number, String star, String end, int day) throws BOSException, EASBizException
     {    	
         return;
     }

+ 2 - 3
src/com/kingdee/eas/hr/project/app/WorkHoursFacadeController.java

@@ -9,7 +9,6 @@ import com.kingdee.bos.Context;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.util.*;
 import com.kingdee.eas.common.EASBizException;
-import java.util.Date;
 import java.lang.String;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.framework.*;
@@ -19,6 +18,6 @@ import com.kingdee.bos.framework.ejb.BizController;
 
 public interface WorkHoursFacadeController extends BizController
 {
-    public void initWorkHoursReport(Context ctx, String number, Date star, Date end, int day) throws BOSException, EASBizException, RemoteException;
-    public void updateWorkHoursReport(Context ctx, String number, Date star, Date end, int day) throws BOSException, EASBizException, RemoteException;
+    public void initWorkHoursReport(Context ctx, String number, String star, String end, int day) throws BOSException, EASBizException, RemoteException;
+    public void updateWorkHoursReport(Context ctx, String number, String star, String end, int day) throws BOSException, EASBizException, RemoteException;
 }

+ 84 - 13
src/com/kingdee/eas/hr/project/app/WorkHoursFacadeControllerBean.java

@@ -16,6 +16,8 @@ import org.apache.log4j.Logger;
 import com.kingdee.bos.BOSException;
 import com.kingdee.bos.Context;
 import com.kingdee.bos.util.BOSUuid;
+import com.kingdee.eas.basedata.person.PersonCollection;
+import com.kingdee.eas.basedata.person.PersonFactory;
 import com.kingdee.eas.basedata.person.PersonInfo;
 import com.kingdee.eas.common.EASBizException;
 import com.kingdee.eas.framework.CoreBaseCollection;
@@ -42,7 +44,7 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
     /**
      * 生产打卡确认单
      */
-    protected void _initWorkHoursConfirm(Context ctx, String number, Date star, Date end, int day)
+    protected void _initWorkHoursConfirm(Context ctx, String number, String star, String end, int day)
     		throws BOSException, EASBizException {
     	IRowSet rs = null;
     	List<String> keyList = new ArrayList<String>();
@@ -72,9 +74,9 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
     	sb.append("	and t.fid not in (select FSOURCEBILLID from CT_PRO_WorkHoursConfirm  where FSOURCEBILLID is not null ) ").append(" \n");
     	//按照时间过滤
     	if(star != null) {
-    		sb.append("	and t.FPUNCHCARDTIME  >= TO_CHAR("+simpleDateFormat.format(star)+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
+    		sb.append("	and t.FPUNCHCARDTIME  >= TO_CHAR("+star+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
     	}else if(end != null) {
-    		sb.append("	and t.FPUNCHCARDTIME  <= TO_CHAR("+simpleDateFormat.format(end)+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
+    		sb.append("	and t.FPUNCHCARDTIME  <= TO_CHAR("+end+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
     	}else {
     		sb.append("	and t.FPUNCHCARDTIME >= sysdate -"+day).append(" \n");
     	}
@@ -110,7 +112,7 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
 					mapproid.put(key, proid);
 					mapdate.put(key, CFCLOCKTIME);
 				}
-				wInfo = getWConfirmInfo(pid, proid,CFCLOCKLOCATION,FPUNCHCARDPLACE,simpleDateFormat.parse(CFCLOCKTIME),tfid);
+				wInfo = getWConfirmInfo(ctx,pid, proid,CFCLOCKLOCATION,FPUNCHCARDPLACE,simpleDateFormat.parse(CFCLOCKTIME),tfid);
 				listInfo.add(wInfo);
 				mapInfo.put(key, listInfo);
 			}
@@ -202,13 +204,27 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
      * @param clockTime
      * @return
      */
-    private WorkHoursConfirmInfo getWConfirmInfo(String pid,String proid,String p1,String p2,Date clockTime,String FSOURCEBILLID) {
+    private WorkHoursConfirmInfo getWConfirmInfo(Context ctx,String pid,String proid,String p1,String p2,Date clockTime,String FSOURCEBILLID) {
     	WorkHoursConfirmInfo wInfo = new WorkHoursConfirmInfo();
     	PersonInfo pinfo = new PersonInfo();pinfo.setId(BOSUuid.read(pid)); //人员
+    	
+    	PersonCollection personCollection = null;
+		try {
+			personCollection = PersonFactory.getLocalInstance(ctx).getPersonCollection(" select * where id = '"+pid+"'");
+		} catch (BOSException e) {
+			e.printStackTrace();
+		}
+		if(personCollection != null && personCollection.size()>0){
+			pinfo = personCollection.get(0);
+		}
+		
 		ProjectManagementInfo proinfo = new ProjectManagementInfo();proinfo.setId(BOSUuid.read(proid)); //所属项目
+		wInfo.setEmployee(pinfo);
 		wInfo.setProject(proinfo); //所属项目
 		wInfo.setClockDate(clockTime); //打卡日期
 		wInfo.setSourceBillId(FSOURCEBILLID);//来源id
+		wInfo.setHrOrgUnit(pinfo.getHrOrgUnit());
+		wInfo.setCU(pinfo.getCU());
 		Timestamp t = new Timestamp(clockTime.getTime());
 		wInfo.setClockTime(t); //打卡--------------------------------------------------------------------------------------------------------------
 		//打卡位置 clockLocation 
@@ -225,7 +241,7 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
     /**
      * 工时计算
      */
-    protected void _updateWorkHoursReport(Context ctx, String number, Date star, Date end, int day)
+    protected void _updateWorkHoursReport(Context ctx, String number, String star, String end, int day)
     		throws BOSException, EASBizException {
     	//获取工时确认单生成工时单
     	String CFCLOCKTIME = null; //年月日-时分秒
@@ -258,9 +274,9 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
     			+ " and CFPROJECTID is not null ").append(" \n");
     	//按照时间过滤
     	if(star != null) {
-    		sb.append("	and CFCLOCKDATE  >= TO_CHAR("+sdf.format(star)+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
+    		sb.append("	and CFCLOCKDATE  >= TO_CHAR("+star+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
     	}else if(end != null) {
-    		sb.append("	and CFCLOCKDATE  <= TO_CHAR("+sdf.format(end)+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
+    		sb.append("	and CFCLOCKDATE  <= TO_CHAR("+end+", 'YYYY-MM-DD HH24:MI:SS')").append(" \n");
     	}else {
     		sb.append("	and CFCLOCKDATE >= sysdate -"+day).append(" \n");
     	}
@@ -283,6 +299,7 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
 				map.put("CFCLOCKDATE", CFCLOCKDATE);
 				map.put("CFPROJECTID", CFPROJECTID);
 				map.put("CFEMPLOYEEID", CFEMPLOYEEID);
+				map.put("fid", fid);
 				if(!listDate.contains(CFCLOCKDATE)){
 					listDate.add(CFCLOCKDATE);
 					dateMap = new HashMap<String,List<Map<String,String>>>();
@@ -334,16 +351,23 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
 					}
 					//跟上一次的不一致情况下
 					if(!oldCFPROJECTID.equals(CFPROJECTID)) {
+						map = listMap.get(j2-1);
+						CFCLOCKTIME = map.get("CFCLOCKTIME"); //年月日-时分秒
+						CFPROJECTID = map.get("CFPROJECTID"); //项目id
+						CFEMPLOYEEID = map.get("CFEMPLOYEEID"); //人员id
+						CFCLOCKLOCATION = map.get("CFEMPLOYEEID"); //位置
+						fid = map.get("fid"); //fid
+						//取上一次的数据与第一次数据进行比较计算
 						//计算两者时间差几个小时
 						try {
 							Date oldDate = sdf.parse(oldCFCLOCKTIME);
-							Date date = sdf.parse(oldCFPROJECTID);
+							Date date = sdf.parse(CFCLOCKTIME);
 					        long diffInMillies = date.getTime() - oldDate.getTime();
 					        // 将毫秒数转换为小时
 					        long diffInHours = diffInMillies / (60 * 60 * 1000);
 					        BigDecimal hours = new BigDecimal(diffInHours);
 					        //组装数据
-					        info = initInfo(CFEMPLOYEEID, oldCFPROJECTID, date, null, CFCLOCKLOCATION, hours,oldfid+","+fid);
+					        info = initInfo(ctx,CFEMPLOYEEID, oldCFPROJECTID, date, null, CFCLOCKLOCATION, hours,oldfid+","+fid);
 					        if(!delist.contains(oldfid)) {
 					        	delist.add(oldfid);
 					        }
@@ -351,8 +375,43 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
 					        	delist.add(fid);
 					        }
 					        coll.add(info);
-						} catch (ParseException e) {
-							e.printStackTrace();
+						} catch (ParseException ee) {
+							ee.printStackTrace();
+						}
+						//当前重新开始
+						map = listMap.get(j2);
+						CFCLOCKTIME = map.get("CFCLOCKTIME"); //年月日-时分秒
+						CFPROJECTID = map.get("CFPROJECTID"); //项目id
+						CFEMPLOYEEID = map.get("CFEMPLOYEEID"); //人员id
+						CFCLOCKLOCATION = map.get("CFEMPLOYEEID"); //位置
+						fid = map.get("fid"); //fid
+						oldCFPROJECTID = CFPROJECTID;
+						oldCFCLOCKTIME = CFCLOCKTIME;
+						oldfid = fid;
+					}
+					
+					//最后一次记录
+					if(j2 == listMap.size()-1){
+						if(oldCFPROJECTID.equals(CFPROJECTID) && !oldCFCLOCKTIME.equals(CFCLOCKTIME)) { //项目相同时间相同情况下
+							try {
+								Date oldDate = sdf.parse(oldCFCLOCKTIME);
+								Date date = sdf.parse(CFCLOCKTIME);
+						        long diffInMillies = date.getTime() - oldDate.getTime();
+						        // 将毫秒数转换为小时
+						        long diffInHours = diffInMillies / (60 * 60 * 1000);
+						        BigDecimal hours = new BigDecimal(diffInHours);
+						        //组装数据
+						        info = initInfo(ctx,CFEMPLOYEEID, oldCFPROJECTID, date, null, CFCLOCKLOCATION, hours,oldfid+","+fid);
+						        if(!delist.contains(oldfid)) {
+						        	delist.add(oldfid);
+						        }
+						        if(!delist.contains(fid)) {
+						        	delist.add(fid);
+						        }
+						        coll.add(info);
+							} catch (ParseException ee) {
+								ee.printStackTrace();
+							}
 						}
 					}
 				}
@@ -376,17 +435,29 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
      * @param hours
      * @return
      */
-    private WorkHoursReportInfo initInfo(String pid,String proid,Date data,String ClockTime
+    private WorkHoursReportInfo initInfo(Context ctx,String pid,String proid,Date data,String ClockTime
     		,String ClockLocation,BigDecimal hours,String ids) {
     	WorkHoursReportInfo info = new WorkHoursReportInfo();
     	WorkHoursReportEntryInfo einfo = new WorkHoursReportEntryInfo();
     	PersonInfo pinfo = new PersonInfo();pinfo.setId(BOSUuid.read(pid)); //人员
+    	PersonCollection personCollection = null;
+		try {
+			personCollection = PersonFactory.getLocalInstance(ctx).getPersonCollection(" select * where id = '"+pid+"'");
+		} catch (BOSException e) {
+			e.printStackTrace();
+		}
+		if(personCollection != null && personCollection.size()>0){
+			pinfo = personCollection.get(0);
+		}
 		ProjectManagementInfo proinfo = new ProjectManagementInfo();
 		proinfo.setId(BOSUuid.read(proid)); //所属项目
+		info.setHrOrgUnit(pinfo.getHrOrgUnit());
+		info.setCU(pinfo.getCU());
 		info.setDataSource(dataSource.workHoursCal);
     	info.setAffiliatedProject(proinfo);
     	info.setBillState(HRBillStateEnum.AUDITED); //审核通过
     	info.setSourceBillId(ids);
+    	einfo.setEmployee(pinfo);
     	einfo.setClockLocation("");
     	einfo.setClockTime(ClockTime); //打卡时间
     	einfo.setData(data); //日期