Index: forgon-core/src/main/java/com/forgon/attachfile/model/AttachFile.java =================================================================== diff -u -r12331 -r13695 --- forgon-core/src/main/java/com/forgon/attachfile/model/AttachFile.java (.../AttachFile.java) (revision 12331) +++ forgon-core/src/main/java/com/forgon/attachfile/model/AttachFile.java (.../AttachFile.java) (revision 13695) @@ -21,8 +21,49 @@ private String contentType; + private String UUIDFileName; + + private String objectId; + + private String attachType; + + // 路径 + private String attachFilePath; + private Integer referenceCount = Integer.valueOf(0); + + public String getObjectId() { + return objectId; + } + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getAttachFilePath() { + return attachFilePath; + } + + public void setAttachFilePath(String attachFilePath) { + this.attachFilePath = attachFilePath; + } + + public String getAttachType() { + return attachType; + } + + public void setAttachType(String attachType) { + this.attachType = attachType; + } + + public String getUUIDFileName() { + return UUIDFileName; + } + + public void setUUIDFileName(String uUIDFileName) { + UUIDFileName = uUIDFileName; + } + public Blob getAttachFileBinary() { return attachFileBinary; } Index: forgon-core/src/main/resources/com/forgon/attachfile/model/AttachFile.hbm.xml =================================================================== diff -u -r12331 -r13695 --- forgon-core/src/main/resources/com/forgon/attachfile/model/AttachFile.hbm.xml (.../AttachFile.hbm.xml) (revision 12331) +++ forgon-core/src/main/resources/com/forgon/attachfile/model/AttachFile.hbm.xml (.../AttachFile.hbm.xml) (revision 13695) @@ -8,6 +8,10 @@ + + + + Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/StaffArchiveManager.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/StaffArchiveManager.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/StaffArchiveManager.java (revision 13695) @@ -0,0 +1,31 @@ +package com.forgon.disinfectsystem.basedatamanager.staffArchives.service; +import com.forgon.disinfectsystem.entity.basedatamanager.staffArchives.StaffArchive; + +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +/** + *@author JC 2016-05-18 + */ +public interface StaffArchiveManager { + public void saveOrUpdate(StaffArchive employee); + + public StaffArchive getById(String id); + + public void delete(StaffArchive employee); + + public void delByIds(String ids); + + public boolean isExist(String id, String identityCardNumber); + + public Long getIdByIdentityCardNumber(String identityCardNumber); + + public void saveOrUpdate(List employeeList); + + public boolean verifyStaffArchive(String id,String name); + + public StaffArchive getByIdentityCardNumber(String identityCardNumber); + + public void downloadAttachFile(HttpServletResponse response, String id); +} Index: ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveView.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveView.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveView.jsp (revision 13695) @@ -0,0 +1,75 @@ +<%@page import="java.util.List"%> +<%@page import="com.forgon.systemsetting.service.HttpOptionManager"%> +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> + + + +员工档案 + + + + + +<%@ include file="/common/includeExtJsAndCss.jsp"%> +<%@ include file="/common/includeExtJs4_2.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+ + \ No newline at end of file Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/imagefilemanager/ImageFile.java =================================================================== diff -u -r12991 -r13695 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/imagefilemanager/ImageFile.java (.../ImageFile.java) (revision 12991) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/imagefilemanager/ImageFile.java (.../ImageFile.java) (revision 13695) @@ -30,6 +30,7 @@ public static final String IMAGE_TYPE_MATERIAL = "材料图片"; public static final String IMAGE_TYPE_TOUSSEPACKING = "器械包装配教学图片"; public static final String IMAGE_TYPE_QUALITYMONITORING = "质量监测图片"; + public static final String IMAGE_TYPE_STAFFARCHIVE = "员工头像"; private Long id; Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/dwr/table/StaffArchiveTableManager.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/dwr/table/StaffArchiveTableManager.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/dwr/table/StaffArchiveTableManager.java (revision 13695) @@ -0,0 +1,42 @@ +package com.forgon.disinfectsystem.basedatamanager.staffArchives.dwr.table; + +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; + +import com.forgon.component.grid.GridManager; +import com.forgon.disinfectsystem.entity.basedatamanager.staffArchives.StaffArchive; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilizer.Sterilizer; + +/** + * + * @author JC 2016-05-19 + * + */ + +public class StaffArchiveTableManager { + + private GridManager gridManager; + + public void setGridManager(GridManager gridManager) { + this.gridManager = gridManager; + } + + public String findStaffArchiveTableList(Map> parameterMap) { + + + Map sqlWhereParamMap = gridManager + .getParamFromView(parameterMap); + + String sterilizerSearch = sqlWhereParamMap.get("staffArchiveSearch"); + String sql = "where 1=1 "; + if(StringUtils.isNotBlank(sterilizerSearch)){ + sql = sql + "and po.name = '" +sterilizerSearch + "'"; + } + String retStr = gridManager.renderGrid(parameterMap, StaffArchive.class + .getSimpleName(), sql, new String[] {}); + return retStr; + } + +} Index: ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml =================================================================== diff -u -r13416 -r13695 --- ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 13416) +++ ssts-web/src/main/resources/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 13695) @@ -1145,6 +1145,11 @@ + + + + @@ -1695,4 +1700,22 @@ + + + + + + + + + + PROPAGATION_REQUIRED + + + + + + \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/staffArchives/downloadAttachFile.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/staffArchives/downloadAttachFile.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/staffArchives/downloadAttachFile.jsp (revision 13695) @@ -0,0 +1,5 @@ +<%@page import="com.forgon.disinfectsystem.basedatamanager.staffArchives.service.StaffArchiveManager"%><%@page import="com.forgon.tools.SpringBeanManger"%><% + String id = request.getParameter("id"); + StaffArchiveManager staffArchiveManager = (StaffArchiveManager)SpringBeanManger.getBean("staffArchiveManager"); + staffArchiveManager.downloadAttachFile(response, id); +%> \ No newline at end of file Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/imagefilemanager/action/UploadImageFileAction.java =================================================================== diff -u -r12991 -r13695 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/imagefilemanager/action/UploadImageFileAction.java (.../UploadImageFileAction.java) (revision 12991) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/imagefilemanager/action/UploadImageFileAction.java (.../UploadImageFileAction.java) (revision 13695) @@ -261,8 +261,11 @@ qualityMonitor.setImages(imageFileList); objectDao.saveOrUpdate(qualityMonitor); } + }else if( ImageFile.IMAGE_TYPE_STAFFARCHIVE.equals(objectType)) + { + for (ImageFile imageFile : uploadImageList) { + imageFileManager.saveImage(imageFile); } - }else { success = false; msg = "对不起,请先保存质量监测记录后再上传图片!"; @@ -321,7 +324,8 @@ // e.printStackTrace(); // } } - } catch (Throwable e) { + } + }catch (Throwable e) { e.printStackTrace(); success = false; msg = e.getMessage(); Index: ssts-web/src/main/webapp/homepage/menuconfigure.js =================================================================== diff -u -r13678 -r13695 --- ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 13678) +++ ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 13695) @@ -115,6 +115,14 @@ {hidden :SSTS_TousseOperateCountReport,text:"科室运作监控",href:WWWROOT+'/disinfectsystem/reportforms/tousseOperate.jsp',hrefTarget:linkTarget,leaf:true} ] }; +DisinfectsystemTreeData[11] = { + text:"档案管理", + singleClickExpand:singleClickExpandTree, + hidden:(!sstsConfig.hasOwnProperty('hideStaffArchive')) || sstsConfig.hideStaffArchive, + children:[ + {hidden :false,text:"人员档案管理",href:WWWROOT+'/disinfectsystem/staffArchives/staffArchiveView.jsp',hrefTarget:linkTarget,leaf:true} + ] + }; //DisinfectsystemTreeData[11] = { // text:"打印回收单设置", // singleClickExpand:singleClickExpandTree, Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/action/StaffArchiveAction.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/action/StaffArchiveAction.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/action/StaffArchiveAction.java (revision 13695) @@ -0,0 +1,500 @@ +package com.forgon.disinfectsystem.basedatamanager.staffArchives.action; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.Map.Entry; +import java.util.Set; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import net.sf.json.JsonConfig; +import net.sf.json.processors.DefaultValueProcessor; +import net.sf.json.util.PropertyFilter; + +import org.apache.commons.lang.StringUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; +import org.apache.struts2.convention.annotation.ParentPackage; +import org.hibernate.Query; +import org.hibernate.Session; + +import com.forgon.attachfile.model.AttachFile; +import com.forgon.attachfile.service.AttachFileManager; +import com.forgon.directory.acegi.tools.AcegiHelper; +import com.forgon.directory.model.BarcodeDevice; +import com.forgon.disinfectsystem.barcode.service.BarcodeManager; +import com.forgon.disinfectsystem.basedatamanager.staffArchives.service.StaffArchiveManager; +import com.forgon.disinfectsystem.basedatamanager.sterilisation.service.SterilisationManager; +import com.forgon.disinfectsystem.basedatamanager.sterilizer.service.SterilizerManager; +import com.forgon.disinfectsystem.basedatamanager.supplier.service.SupplierManager; +import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.entity.basedatamanager.deviceinterface.DeviceInterface; +import com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile; +import com.forgon.disinfectsystem.entity.basedatamanager.staffArchives.StaffArchive; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilisation.Sterilisation; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilizer.ConsumptiveConfig; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilizer.DetectionItem; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilizer.Sterilizer; +import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; +import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; +import com.forgon.tools.FileSystemHelper; +import com.forgon.tools.StrutsParamUtils; +import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.json.JsonPropertyFilter; + +import java.text.SimpleDateFormat; + +import com.opensymphony.xwork2.ModelDriven; +import com.opensymphony.xwork2.Preparable; +/** + * + * @author JC 2016-05-18 + * + */ + +@ParentPackage(value = "default") +@Namespace(value = "/disinfectSystem/baseData") +@Action(value = "staffArchiveAction") +public class StaffArchiveAction implements ModelDriven, Preparable { + + private String objectID; + + private String objectType; + + private File[] uploadFiles; + + private String[] uploadFilesFileName; + + private StaffArchive staffArchive; + + private StaffArchiveManager staffArchiveManager; + + private SupplyRoomConfigManager supplyRoomConfigManager; + + private AttachFileManager attachFileManager; + + private ObjectDao objectDao; + + public void setObjectDao(ObjectDao objectDao) { + this.objectDao = objectDao; + } + + public File[] getUploadFiles() { + return uploadFiles; + } + + public void setUploadFiles(File[] uploadFiles) { + this.uploadFiles = uploadFiles; + } + + public String[] getUploadFilesFileName() { + return uploadFilesFileName; + } + + public void setUploadFilesFileName(String[] uploadFilesFileName) { + this.uploadFilesFileName = uploadFilesFileName; + } + + + + public void setAttachFileManager(AttachFileManager attachFileManager) { + this.attachFileManager = attachFileManager; + } + + + public void setStaffArchiveManager(StaffArchiveManager staffArchiveManager) { + this.staffArchiveManager = staffArchiveManager; + } + + + public void setSupplyRoomConfigManager( + SupplyRoomConfigManager supplyRoomConfigManager) { + this.supplyRoomConfigManager = supplyRoomConfigManager; + } + + /** + * 保存前检查是否重复 + * + * @return + */ + public String validate() { + String id = StrutsParamUtils.getPraramValue("validateId", null); + String name = StrutsParamUtils.getPraramValue("valifateName", null); + String message = "{success:true,message:'验证成功',stauts:1}"; + boolean result = staffArchiveManager.verifyStaffArchive(id, name); + if (!result) { + message = "{success:false,message:'已存在相同员工档案名字',stauts:0}"; + ; + } + HttpServletResponse httpServletResponse = StrutsParamUtils + .getResponse(); + httpServletResponse.setContentType("text/html;charset=UTF-8"); + try { + httpServletResponse.getWriter().print(message); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 保存staffArchive + */ + public String saveStaffArchive() { + if (staffArchive != null) { + if(staffArchive.getId() != null && staffArchive.getId() == 0){ + staffArchive.setId(null); + } + objectDao.saveOrUpdate(staffArchive); + } + return null; + } +/** + * 删除员工档案 + */ + public void deleteStaffArchive() { + String idStr = StrutsParamUtils.getPraramValue("ids", ""); + String message = ""; + try { + if (StringUtils.isNotBlank(idStr)) { + staffArchiveManager.delByIds(idStr); + message = "{success:true}"; + } + } catch (Exception e) { + message = "{success:false}"; + e.printStackTrace(); + } + HttpServletResponse httpServletResponse = StrutsParamUtils + .getResponse(); + httpServletResponse.setCharacterEncoding("UTF-8"); + try { + httpServletResponse.getWriter().print(message); + } catch (IOException e) { + e.printStackTrace(); + } + } +/** + * 加载员工档案 + */ + public void loadStaffArchive() { + StrutsParamUtils.getResponse().setCharacterEncoding("UTF-8"); + JsonConfig config = new JsonConfig(); + PropertyFilter propertyFilter = new JsonPropertyFilter(new String[] {}); + config.setJsonPropertyFilter(propertyFilter); + + Map map = new HashMap(); + map.put("success", true); + map.put("data", staffArchive); + JSONObject jsonObject = JSONObject.fromObject(map, config); + String jsonStr = jsonObject.toString(); + try { + StrutsParamUtils.getResponse().getWriter().println(jsonStr); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void iniInfo() { + + try { + String id = StrutsParamUtils.getPraramValue("id", ""); +// if (StringUtils.isNotBlank(id) && !id.equals("0")) { +// sterilizer = sterilizerManager.getSterilizerById(id); +// } else { +// sterilizer = new Sterilizer(); +// } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public StaffArchive getModel() { + return staffArchive; + } + + public void prepare() throws Exception { + String id = StrutsParamUtils.getPraramValue("id", ""); + if (StringUtils.isNotBlank(id) && !id.equals("0")) { + staffArchive = staffArchiveManager.getById(id); + } else { + staffArchive = new StaffArchive(); + } + } + /** + * 获取员工头像 + */ + public void getStaffArchivePic() + { + byte[] img = null; + long imageId = 0; + + SupplyRoomConfig systemParamsObj = supplyRoomConfigManager + .getSystemParamsObj(); + String saveImagePath = systemParamsObj.getSaveImagePath(); + + if (staffArchive.getId() != null && staffArchive.getId() != 0) { + ImageFile picture = staffArchive.getImage(objectDao); + if( picture != null) + { + imageId = picture.getId(); + img = picture.getImage(); + if (img == null) { + img = new byte[4096 * 1024]; + String thumbnailImageDirectory = picture + .getThumbnailImagePath(); + String uuidImageName = picture.getUUIDAndImageName(); + String Directory = saveImagePath + thumbnailImageDirectory + + "\\" + uuidImageName; + FileInputStream fis = null; + File imgFile = new File(Directory); + if (!imgFile.exists()) { + img = FileSystemHelper + .readBlankImageBytes(StrutsParamUtils + .getServletContext().getRealPath("/")); + } else { + try { + fis = new FileInputStream(imgFile); + fis.read(img); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + } + } + OutputStream outputStream = null; + if (img == null || img.length == 0) { + img = FileSystemHelper.readBlankImageBytes(StrutsParamUtils + .getServletContext().getRealPath("/")); + } + try { + HttpServletResponse response = StrutsParamUtils.getResponse(); + response.setContentType("image/jpeg"); + outputStream = response.getOutputStream(); + outputStream.write(img, 0, img.length); + + HttpSession session = StrutsParamUtils.getRequest().getSession(); + session.setAttribute("delImageID", "" + imageId); + } catch (IOException e) { + e.printStackTrace(); + } + } + /** + * 上传附件 + */ + public void uploadAttachFile() { + objectID = StrutsParamUtils.getPraramValue("objectId", null); + objectType = StrutsParamUtils.getPraramValue("attachType", null); + boolean success = true; + String msg = "上传成功!"; + SupplyRoomConfig supplyRoomConfig = supplyRoomConfigManager + .getSystemParamsObj(); + String saveImageDirectory = supplyRoomConfig.getSaveImagePath(); + try { + if(StringUtils.isNotBlank(objectID) && StringUtils.isNotBlank(objectType)){ + //上传图片 + List uploadImageList = new ArrayList(); + for(int i = 0,size = uploadFiles.length;i list = query.list(); + + JSONArray array = new JSONArray(); + + if (list != null && list.size() >0){ + for(Object[] arr : list){ + JSONObject obj = new JSONObject(); + obj.put("id", arr[0]); + obj.put("fileName", arr[1]); + array.add(obj); + } + } + + StrutsParamUtils.getResponse().setCharacterEncoding("UTF-8"); + + Map map = new HashMap(); + map.put("success", true); + map.put("data", array); + try { + JSONObject jsonObject = JSONObject.fromObject(map); + StrutsParamUtils.getResponse().getWriter() + .println(jsonObject.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + /** + * 删除附件 + */ + public void deleteAttachFile() + { + String id = StrutsParamUtils.getPraramValue("attachId", null); + AttachFile attachFile = attachFileManager.getById(id); + boolean success = true; + try { + if (attachFile != null) { + SupplyRoomConfig systemParamsObj = supplyRoomConfigManager + .getSystemParamsObj(); + String saveImagePath = systemParamsObj.getSaveImagePath();// 默认的保存路径 + + String imagePath = attachFile.getAttachFilePath(); // 相对路径 + String uuidFileName = attachFile.getUUIDFileName(); + String ImagePath = saveImagePath + imagePath + "\\" + + uuidFileName; + + File file = new File(ImagePath); + if (file.exists()) { + file.delete(); + } + objectDao.delete(attachFile); + } + } catch (Exception e) { + success = false; + } + try { + String jsonData = "{success:" + success + "}"; + HttpServletResponse response = StrutsParamUtils.getResponse(); + response.setCharacterEncoding("utf-8"); + response.getWriter().print(jsonData); + } catch (IOException e) { + e.printStackTrace(); + } + } +} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/ExportStaffArchiveManagerImpl.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/ExportStaffArchiveManagerImpl.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/ExportStaffArchiveManagerImpl.java (revision 13695) @@ -0,0 +1,31 @@ +package com.forgon.disinfectsystem.basedatamanager.staffArchives.service; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +import com.forgon.disinfectsystem.entity.basedatamanager.staffArchives.StaffArchive; +import com.forgon.excel.service.CommonExportManager; +/** + *@author JC 2016-05-18 + */ +public class ExportStaffArchiveManagerImpl implements ExportStaffArchiveManager { + private CommonExportManager commonExportManager; + + public void setCommonExportManager(CommonExportManager commonExportManager) { + this.commonExportManager = commonExportManager; + } + + public void exportEmployee(OutputStream ops) { + HSSFWorkbook workbook = commonExportManager.getWorkbook(StaffArchive.class); + try { + workbook.write(ops); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} Index: ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveForm.js (revision 13695) @@ -0,0 +1,868 @@ +var id; +var formObj; +var sterilizerWin; + +function removeGridItem(gridName){ + var configGrid = top.Ext.getCmp(gridName); + var rows = configGrid.getSelectionModel().getSelections();// 返回值为 Record 数组 + if (rows) { + for ( var i = 0; i < rows.length; i++) { + configGrid.getStore().remove(rows[i]); + } + } +} + + +function getConsumableStoreData(){ + var result = ''; + var configGrid2 = top.Ext.getCmp('configGrid2').getStore(); + for(var i= 0 ;i',{ + xtype : 'button', + text : '上传头像', + hidden:id == 0?true:false, + handler : function(){ + uploadPortraitWindow("员工头像"); + } + }] + },imagePanel] + }); + + formObj = new top.Ext.FormPanel({ + id : 'sterilizerForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + labelAlign:'right', + labelWidth : 100, + autoHeight:true, + autoScroll : true, + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'supplierID', + id : 'supplierID' + },{ + layout : 'column', + items : [{ + columnWidth : 0.5, + layout : 'form', + labelWidth : 80, + items : [{ + xtype : 'textfield', + fieldLabel : "姓名", + allowBlank : false, + blankText : '请输入姓名!', + name : "name", + id : "name", + anchor : '95%' + },{ + xtype : 'textfield', + fieldLabel : "编号", + allowBlank : true, + name : "number_", + id : "number_", + anchor : '95%' + },{ + layout : 'column', + items : [ + { + layout : 'form', + columnWidth : 0.5, + items : [{ + xtype : 'combo', + fieldLabel : '性别', + id : 'sex', + name : 'sex', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [['男'],['女']] + } + ), + forceSelection : true, + allowBlank : false, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 0.48, + items : [{ + xtype : 'textfield', + fieldLabel : '年龄', + allowBlank : false, + name : 'age', + id : 'age', + anchor : '95%' + }] + } + ] + },{ + xtype : 'dateextensiablefield', + width : 150, + fieldLabel : '出生日期', + id : 'birthDate', + name : 'birthDate', + format : 'Y-m-d', + readOnly : true, + minWidth : 177, + anchor : '95%' + },{ + layout : 'column', + items : [ + { + layout : 'form', + columnWidth : 0.5, + items : [{ + xtype : 'textfield', + fieldLabel : '民族', + allowBlank : false, + name : 'nation', + id : 'nation', + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 0.48, + items : [{ + xtype : 'combo', + fieldLabel : '籍贯', + id : 'nativePlace', + name : 'nativePlace', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [['北京'],['天津'],['河北'],['山西'],['内蒙古'],['辽宁'],['吉林'],['黑龙江'],['上海'],['江苏'],['浙江'],['安徽'],['福建'],['江西'],['山东'],['河南'],['湖北'],['湖南'],['广东'],['广西'],['海南'],['重庆'],['四川'],['贵州'],['云南'],['西藏'],['陕西'],['甘肃'],['青海'],['宁夏'],['新疆'],['台湾'],['香港'],['澳门']] + } + ), + forceSelection : true, + allowBlank : false, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '95%' + }] + } + ] + },{ + xtype : 'textfield', + fieldLabel : '户口所在地', + allowBlank : true, + name : 'registeredPermanentResidence', + id : 'registeredPermanentResidence', + anchor : '95%' + },{ + xtype : 'textfield', + fieldLabel : '身份证号码', + allowBlank : true, + name : 'identityCardNumber', + id : 'identityCardNumber', + anchor : '95%' + },{ + layout : 'column', + items : [ + { + layout : 'form', + columnWidth : 0.5, + labelWidth : 80, + items : [{ + xtype : 'combo', + fieldLabel : '婚姻状况', + id : 'marriageStatus', + name : 'marriageStatus', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [['未婚'],['已婚'],['离异'],['丧偶']] + } + ), + forceSelection : true, + allowBlank : false, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 80, + items : [{ + xtype : 'combo', + fieldLabel : '学历', + id : 'educationBackground', + name : 'educationBackground', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [['小学'],['初中'],['高中'],['技校'],['中专'],['大专'],['本科'],['研究生'],['博士'],['博士后']] + } + ), + forceSelection : true, + allowBlank : true, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '95%' + }] + } + ] + },{ + xtype : 'textfield', + fieldLabel : '专业', + allowBlank : true, + name : 'profession', + id : 'profession', + anchor : '95%' + },{ + xtype : 'textfield', + fieldLabel : '毕业院校', + allowBlank : true, + name : 'schoolGraduateFrom', + id : 'schoolGraduateFrom', + anchor : '95%' + },{ + xtype : 'dateextensiablefield', + width : 150, + fieldLabel : '参加工作时间', + id : 'firstWorkDate', + name : 'firstWorkDate', + format : 'Y-m-d', + readOnly : true, + minWidth : 177, + anchor : '95%' + },{ + xtype : 'dateextensiablefield', + width : 150, + fieldLabel : '入职时间', + id : 'enterCurrentCompanyDate', + name : 'enterCurrentCompanyDate', + format : 'Y-m-d', + readOnly : true, + minWidth : 177, + anchor : '95%' + },{ + xtype : 'textfield', + fieldLabel : '员工职务', + allowBlank : true, + name : 'duty', + id : 'duty', + anchor : '95%' + },{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 80, + items : [{ + xtype : 'combo', + fieldLabel : '用工类型', + id : 'engageType', + name : 'engageType', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [['临时员工'],['正式员工'],['合同员工']] + } + ), + forceSelection : true, + allowBlank : false, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '50%' + }] + },{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 80, + items : [{ + xtype : 'combo', + fieldLabel : '职称', + id : 'theTitleOfATechnicalPost', + name : 'theTitleOfATechnicalPost', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [[' '],['高级职称'],['助理工程师'],['工程师'],['高级工程师']] + } + ), + forceSelection : true, + allowBlank : false, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '70%' + }] + },{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 80, + items : [{ + xtype : 'combo', + fieldLabel : '政治面貌', + id : 'politicalStatus', + name : 'politicalStatus', + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [[' '],['群众'],['共青团员'],['中共预备党员'],['中共党员'],['民主党派'],['无党派人士']] + } + ), + forceSelection : true, + allowBlank : true, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '70%' + }] + } + ] + },{ + columnWidth : 0.4, + layout : 'form', + labelWidth : 80, + items : [{ + // 图片信息 + layout: 'form', + width : 180, + height : 220, + bodyStyle : 'border:2px solid #afd7af', + items: [ + showArchiveImage + ] + },{ + columnWidth : .5, + layout : 'form', + labelWidth : 30, + items:[{ + xtype: 'textfield', + fieldLabel: "邮箱", + allowBlank : true, + name: 'email', + id: 'email', + anchor: '95%' + }] + },{ + columnWidth : .5, + layout : 'form', + labelWidth : 30, + items:[{ + xtype: 'textfield', + fieldLabel: "住址", + allowBlank : true, + name: 'address', + id: 'address', + anchor: '95%' + }] + },{ + columnWidth : .5, + layout : 'form', + labelWidth : 30, + items:[ + { + xtype : 'textfield', + fieldLabel : "电话", + allowBlank : true, + name : 'phoneNumber', + id : 'phoneNumber', + anchor : '95%' + } + ] + },{ + layout : 'form', + labelWidth : 30, + items:[ + { + xtype : 'textfield', + fieldLabel : '备注', + height : 80, + allowBlank : true, + name : 'otherImformation', + id : 'otherImformation', + anchor : '95%' + } + ] + }] + }] + } ], + buttons : [ { + id : 'preview', + hidden : true, + text : '打印预览', + handler : printBarcode + }, { + id : 'saveAndPrint', + hidden : true, + text : '保存并打印', + handler : saveAndPrint + }, { + id : 'saveBtn', + text : '保存', + handler : save + }, { + text : '取消', + id : 'saveAndNewBtn', + handler : cancel + }, { + text : '附件管理', + id : 'attachFile', + hidden:id == 0?true:false, + handler : function(){ + uploadStaffArchiveImageFile("附件"); + } + } ] + }); + + sterilizerWin = new top.Ext.Window( { + id : 'sterilizerWin', + layout : 'fit', + title : '添加员工档案信息', + width : 700, + border : false, + modal : true, + autoHeight : true, + plain : true, + items : [ formObj ] + }); + sterilizerWin.show(); + + if(id != 0){ + formObj.form.load( { + url : WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!loadStaffArchive.do', + method : 'GET', + waitMsg : '正在加载数据,请稍候', + success : function(form, action) { + if(id == 0){ + } + }, + failure : function(form, action) { + }, + params : { + id : id + } + }); + }else{ +// top.Ext.getCmp('isEveryDayReset').setValue('是'); +// top.Ext.getCmp('isCheckSterilizationTime').setValue('否'); + } +} + +function uploadStaffArchiveImageFile(imageType){ + + StaffArchiveAttachStore = new top.Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url:WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!loadStaffArchiveAttach.do?attachType='+encodeURI("档案附件")+'&objectId='+id , + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'fileName',mapping : 'fileName'} + ] + ) + }); + StaffArchiveAttachStore.load(); + + var cm = new top.Ext.grid.ColumnModel([ + { + name:'id', + hidden :true, + dataIndex : 'id' + },{ + id:'imageName', + menuDisabled: true, + header : "附件名称", + width:200, + dataIndex : 'fileName' + },{ + id:'deleteAction', + menuDisabled: true, + header:'删除 | 下载', + width:100, + renderer: deleteOrDownLoad, + dataIndex:'button' + }]); + + var tbar = [{ + text : '上传附件', + handler:function(){ + uploadWindow(imageType); + } + }]; + + var uploadImageForm = new top.Ext.FormPanel({ + id : 'deviceMaintenanceForm', + frame : true, + labelAlign:'right', + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + autoWidth : true, + autoHeight : true, + autoScroll : true, + items:[{ + layout : 'column', + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + columnWidth : 1, + layout: 'form', + items : [ + new top.Ext.grid.GridPanel({ + id : 'configGrid', + store : StaffArchiveAttachStore, + tbar : tbar, + cm : cm, + height: 240, + frame : false, + autoExpandColumn : 'deleteAction', + bodyStyle : 'border:1px solid #afd7af', + anchor : '100%', + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }) + }) + ] + }] + }], + buttons : [{ + id : 'cancleBtn', + text : '取消', + handler : function() { + formWindow.close(); + } + }] + }); + + formWindow = new top.Ext.Window( { + id : 'deviceMaintenanceWin', + layout : 'fit', + title : imageType+"管理", + width : 600, + modal : true, + autoHeight : true, + border : false, + plain : true, + items : [uploadImageForm] + }); + formWindow.show(); + } + +function moveUpDown(v, p, record){ + var html = ''; + html += '向上移动     '; + html += ''; + html += '向下移动'; + return html; +} + +function deleteOrDownLoad(v, p, record){ + var html = ''; + html += '向上移动     '; + html += ''; + html += '向下移动'; + return html; +} + +function uploadWindow(imageType){ + var dialog = new top.Ext.ux.UploadDialog.Dialog({ + title: "上传" + imageType, + url:WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!uploadAttachFile.do?attachType='+"档案附件"+'&objectId='+id , //这里我用struts2做后台处理 + post_var_name:'uploadFiles',//这里是自己定义的,默认的名字叫file + width : 450, + height : 300, + minWidth : 450, + minHeight : 300, + draggable : true , + resizable : true , + constraintoviewport: true , +// permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','png','PNG'], + modal: true , + reset_on_hide: false , + allow_close_on_upload: false , //关闭上传窗口是否仍然上传文件 + upload_autostart: false + }); + dialog.show(); + dialog.on('uploadcomplete',onUploadComplete); //定义上传完成回调函数 +} + +//文件上传成功后的回调函数 +/*var onUploadSuccess = function(dialog, filename, resp_data, record){ + alert(resp_data.data);//resp_data是json格式的数据 +} +//文件上传失败后的回调函数 +var onUploadFailed = function(dialog, filename, resp_data, record){ + alert(resp_data.data); +} */ +//文件上传完成后的回调函数 +var onUploadComplete = function(dialog){ + showResult("文件上传成功!"); + StaffArchiveAttachStore.reload(); + dialog.hide(); +}; + +function printBarcode(barcodeStr,type){ + + var name = top.Ext.getCmp('name').getValue(); + var unit = ""; + DWREngine.setAsync(false); + SupplyRoomConfigTableManager.getUnitName(function(unitName){ + if(unitName != null && unitName != ""){ + unit = unitName; + } + }); + DWREngine.setAsync(true); + if(type == 0){//直接打印 + defaultPrint(barcodeStr,name,unit); + }else{//打印预览 + var barcode = top.Ext.getCmp('barcode').getValue(); + preview(barcode,name,unit); + } +} + +function validateAndSubmit(print){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!validate.do', + params : {validateId : top.Ext.getCmp('id').getValue(),valifateName:top.Ext.getCmp('name').getValue()}, + success : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.stauts==1){ + formObj.form.submit( { + url : WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!saveStaffArchive.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + if(print){ + var barcodeStr = action.result.barcode; + printBarcode(barcodeStr,0); + } + sterilizerWin.close(); + showResult('保存成功'); + grid.dwrReload(); + },failure : function(form, action) { + showResult(action.result.message); + top.Ext.getCmp('saveBtn').enable(); + top.Ext.getCmp('saveAndPrint').enable(); + } + }); + }else{ + showResult(result.message); + top.Ext.getCmp('saveBtn').enable(); + top.Ext.getCmp('saveAndPrint').enable(); + } + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + showResult(result.cause); + } + }); +} + +function save() { + this.disable(); + if (!formObj.form.isValid()) { + showResult('请正确填写表单各值'); + this.enable(); + return false; + } + var print = false; + validateAndSubmit(print); +} +function saveAndPrint(){ + this.disable(); + if (!formObj.form.isValid()) { + showResult('请正确填写表单各值'); + this.enable(); + return false; + } + var print = true; + validateAndSubmit(print); +} + + +function cancel() { + sterilizerWin.close(); +} + +function deleteAttachFile(id, imageType, objectId){ + if(id != null && id != ""){ + top.Ext.MessageBox.confirm("请确认","是否确定要删除此附件?", + function(button, text) { + if ("yes" == button){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!deleteAttachFile.do', + params : {attachId : id}, + success : function(response, options) { + showResult("删除成功"); + StaffArchiveAttachStore.load(); + grid.dwrReload(); + }, + failure : function(response, options) { + showResult("删除失败"); + } + }); + } + }); + } +} + +function downLoadAttachFile(id, imageType, objectId) +{ + location.href = WWWROOT + "/disinfectsystem/staffArchives/downloadAttachFile.jsp?id="+id; +} + Index: ssts-web/src/main/webapp/disinfectsystem/config/zsxlrmyy/config.js =================================================================== diff -u -r13401 -r13695 --- ssts-web/src/main/webapp/disinfectsystem/config/zsxlrmyy/config.js (.../config.js) (revision 13401) +++ ssts-web/src/main/webapp/disinfectsystem/config/zsxlrmyy/config.js (.../config.js) (revision 13695) @@ -53,5 +53,7 @@ //入库单是否显示生物检测信息 godownEntryShowBiologicalTestReport:true, //金额的小数位数 - moneyDigitCount:4 + moneyDigitCount:4, + //隐藏档案管理 + hideStaffArchive : false } \ No newline at end of file Index: ssts-web/src/main/webapp/WEB-INF/dwr.xml =================================================================== diff -u -r13416 -r13695 --- ssts-web/src/main/webapp/WEB-INF/dwr.xml (.../dwr.xml) (revision 13416) +++ ssts-web/src/main/webapp/WEB-INF/dwr.xml (.../dwr.xml) (revision 13695) @@ -451,6 +451,11 @@ + + + + + Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/staffArchives/StaffArchive.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/staffArchives/StaffArchive.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/staffArchives/StaffArchive.java (revision 13695) @@ -0,0 +1,309 @@ +package com.forgon.disinfectsystem.entity.basedatamanager.staffArchives; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.commons.collections4.CollectionUtils; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +import com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile; +import com.forgon.tools.hibernate.ObjectDao; + +/** + *@JC 2016-5-18 + */ +@Entity +@Table(name = "StaffArchive") +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class StaffArchive { + private static final long serialVersionUID = 1L; + + public static Map ColumnNameAndPoPropertyNameMap = new LinkedHashMap(); + public static String ExportSheetName = "员工档案表"; + + private Long id; + private String number_;// 员工编号 + private String name;// 员工姓名 + private String sex;// 员工性别 + private String age;// 员工年龄 + private String birthDate;// 员工出生日期 + private String identityCardNumber;// 员工身份证编号 + private String nation;// 员工所属民族 + private String nativePlace;// 员工籍贯 + private String registeredPermanentResidence;// 员工户口所在地 + private String marriageStatus;// 员工婚姻状况 + private String educationBackground;// 员工学历 + private String profession;// 员工专业 + private String schoolGraduateFrom;// 员工毕业院校 + private String firstWorkDate;// 员工参加工作时间 + private String enterCurrentCompanyDate;// 员工加入本公司时间 + private String engageType;// 员工用工类型 + private String duty;// 员工职务 + private String theTitleOfATechnicalPost;// 员工职称 + private String politicalStatus;// 员工政治面貌 + private String otherImformation;// 员工其他信息 + private String orgUnitName;// 员工所属组织名称 + private String phoneNumber;// 员工电话号码 + private String address;// 员工地址 + private String email;// 员工邮箱 + + static { + ColumnNameAndPoPropertyNameMap.put("编号", "number"); + ColumnNameAndPoPropertyNameMap.put("姓名", "name"); + ColumnNameAndPoPropertyNameMap.put("性别", "sex"); + ColumnNameAndPoPropertyNameMap.put("出生日期", "birthDate"); + ColumnNameAndPoPropertyNameMap.put("身份证号码", "identityCardNumber"); + ColumnNameAndPoPropertyNameMap.put("民族", "nation"); + ColumnNameAndPoPropertyNameMap.put("籍贯", "nativePlace"); + ColumnNameAndPoPropertyNameMap.put("政治面貌", "politicalStatus"); + ColumnNameAndPoPropertyNameMap.put("婚姻状况", "marriageStatus"); + ColumnNameAndPoPropertyNameMap.put("学历", "educationBackground"); + ColumnNameAndPoPropertyNameMap.put("毕业院校", "schoolGraduateFrom"); + ColumnNameAndPoPropertyNameMap.put("专业", "profession"); + ColumnNameAndPoPropertyNameMap.put("户口所在地", + "registeredPermanentResidence"); + ColumnNameAndPoPropertyNameMap.put("家庭电话", "phoneNumber"); + ColumnNameAndPoPropertyNameMap.put("电子邮箱", "email"); + ColumnNameAndPoPropertyNameMap.put("家庭住址", "address"); + ColumnNameAndPoPropertyNameMap.put("所在部门", "orgUnitName"); + ColumnNameAndPoPropertyNameMap.put("用工类型", "engageType"); + ColumnNameAndPoPropertyNameMap.put("职务", "duty"); + ColumnNameAndPoPropertyNameMap.put("职称", "theTitleOfATechnicalPost"); + ColumnNameAndPoPropertyNameMap.put("参加工作时间", "firstWorkDate"); + ColumnNameAndPoPropertyNameMap.put("进入单位时间", "enterCurrentCompanyDate"); + ColumnNameAndPoPropertyNameMap.put("其他信息", "otherImformation"); + + } + + public String getOrgUnitName() { + + return orgUnitName; + } + + public void setOrgUnitName(String orgUnitName) { + this.orgUnitName = orgUnitName; + } + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getNumber_() { + return number_; + } + + public void setNumber_(String number_) { + this.number_ = number_; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAge() { + return age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getBirthDate() { + return birthDate; + } + + public void setBirthDate(String birthDate) { + this.birthDate = birthDate; + } + + public String getIdentityCardNumber() { + return identityCardNumber; + } + + public void setIdentityCardNumber(String identityCardNumber) { + this.identityCardNumber = identityCardNumber; + } + + public String getNation() { + return nation; + } + + public void setNation(String nation) { + this.nation = nation; + } + + public String getNativePlace() { + return nativePlace; + } + + public void setNativePlace(String nativePlace) { + this.nativePlace = nativePlace; + } + + public String getRegisteredPermanentResidence() { + return registeredPermanentResidence; + } + + public void setRegisteredPermanentResidence( + String registeredPermanentResidence) { + this.registeredPermanentResidence = registeredPermanentResidence; + } + + public String getMarriageStatus() { + return marriageStatus; + } + + public void setMarriageStatus(String marriageStatus) { + this.marriageStatus = marriageStatus; + } + + public String getEducationBackground() { + return educationBackground; + } + + public void setEducationBackground(String educationBackground) { + this.educationBackground = educationBackground; + } + + public String getProfession() { + return profession; + } + + public void setProfession(String profession) { + this.profession = profession; + } + + public String getSchoolGraduateFrom() { + return schoolGraduateFrom; + } + + public void setSchoolGraduateFrom(String schoolGraduateFrom) { + this.schoolGraduateFrom = schoolGraduateFrom; + } + + public String getFirstWorkDate() { + return firstWorkDate; + } + + public void setFirstWorkDate(String firstWorkDate) { + this.firstWorkDate = firstWorkDate; + } + + public String getEnterCurrentCompanyDate() { + return enterCurrentCompanyDate; + } + + public void setEnterCurrentCompanyDate(String enterCurrentCompanyDate) { + this.enterCurrentCompanyDate = enterCurrentCompanyDate; + } + + public String getEngageType() { + return engageType; + } + + public void setEngageType(String engageType) { + this.engageType = engageType; + } + + public String getDuty() { + return duty; + } + + public void setDuty(String duty) { + this.duty = duty; + } + + public String getTheTitleOfATechnicalPost() { + return theTitleOfATechnicalPost; + } + + public void setTheTitleOfATechnicalPost(String theTitleOfATechnicalPost) { + this.theTitleOfATechnicalPost = theTitleOfATechnicalPost; + } + + public String getPoliticalStatus() { + return politicalStatus; + } + + public void setPoliticalStatus(String politicalStatus) { + this.politicalStatus = politicalStatus; + } + + public String getOtherImformation() { + return otherImformation; + } + + public void setOtherImformation(String otherImformation) { + this.otherImformation = otherImformation; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public ImageFile getImage(ObjectDao objectDao) { + + Session session = objectDao.getHibernateSession(); + Query query = session.createQuery("select img from ImageFile img where img.objectId = :id" + + " and img.imageType = :imgType" + + " order by img.id asc"); + query.setParameter("id", id.toString()); + query.setParameter("imgType", "员工头像"); + List images = query.list(); + if( images != null && CollectionUtils.isNotEmpty(images)) + { + // 返回最后一张图片 + ImageFile image = (ImageFile)images.get(images.size() -1); + return image; + } + return null; + } +} Index: ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveView.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveView.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/staffArchives/staffArchiveView.js (revision 13695) @@ -0,0 +1,307 @@ +var entityName = "员工档案"; +var grid; + +// 删除 +function deleteSterilizer(grid) { + + var records = grid.getSelectionModel().getSelections(); + + if (records.length == 0) { + showResult("请选择要删除的员工档案!"); + return false; + } + var ids = null; + for ( var i = 0, len = records.length; i < len; i++) { + if (ids == null) { + ids = records[i].data['id']; + } else { + ids = ids + ';' + records[i].data['id']; + } + } + top.Ext.MessageBox + .confirm("请确认", + "是否确定要删除选中的档案信息?", + function(button, text) { + if ("yes" == button){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!deleteStaffArchive.do', + params : { + ids : ids + },success : function(response, options) { + var result = Ext.decode(response.responseText); + var success = result.success; + if (true == success) { + showResult('删除成功'); + grid.dwrReload(); + } + }, + failure : function(response, options) { + showResult('删除失败.'); + } + });} + }); + +} + +var loadFormData = function(grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要修改的消员工档案!"); + return false; + } + if (records.length > 1) { + showResult("一次只能修改一个员工档案!"); + return false; + } + id = records[0].data['id']; + addAndEditSterilizer(id); + top.Ext.getCmp('sterilizerWin').setTitle('修改员工档案'); +}; + +/** + * 修改记录 + * modifyRecord函数 触发modify函数调用,并传入当前列的值以及record.data对象 + * 页面中需要定义 modify(v,data) 函数 + */ +function modify(v,data){ + loadFormData(grid); +} + +function dealNullObject(v, p, record){ + if(record.data.supplier == null){ + return ""; + }else{ + return record.data.supplier.companyName; + } +} + +Ext.onReady(function() { + Ext.QuickTips.init(); + // 记录cookie(3步) + var columns = [ { + header : "名字", + width : 160, + dataIndex : 'name', + renderer : modifyRecord + } ,{ + header : "编号", + width : 100, + dataIndex : 'number_' + },{ + header : "性别", + width : 100, + dataIndex : 'sex' + }, { + header : '年龄', + width : 120, + dataIndex : 'age' + },{ + header : "出生日期", + width : 80, + dataIndex : 'birthDate' + }, { + header : "身份证号码", + width : 100, + dataIndex : 'identityCardNumber', + renderer : dealNullObject + },{ + header : "民族", + width : 80, + dataIndex : 'nation' + },{ + header : "户口所在地", + width : 80, + dataIndex : 'registeredPermanentResidence', + renderer:myDateFormat + },{ + header : "婚姻状况", + width : 80, + dataIndex : 'marriageStatus' + },{ + header : "学历", + width : 80, + dataIndex : 'educationBackground' + },{ + id : 'profession', + header : "专业", + width : 80, + dataIndex : 'profession' + },{ + id : 'schoolGraduateFrom', + header : "毕业院校", + width : 80, + dataIndex : 'schoolGraduateFrom' + },{ + header : "参加工作时间", + width : 80, + dataIndex : 'firstWorkDate' + },{ + header : "入职时间", + width : 80, + dataIndex : 'enterCurrentCompanyDate' + },{ + header : "用工类型", + width : 80, + dataIndex : 'engageType' + },{ + header : "职务", + width : 80, + dataIndex : 'duty' + },{ + header : "职称", + width : 80, + dataIndex : 'theTitleOfATechnicalPost' + },{ + header : "政治面貌", + width : 80, + dataIndex : 'politicalStatus' + },{ + header : "联系电话", + width : 80, + dataIndex : 'phoneNumber' + },{ + header : "地址", + width : 80, + dataIndex : 'address' + },{ + header : "邮箱", + width : 80, + dataIndex : 'email' + } + ]; + + var filters = new Ext.grid.GridFilters({ + filters : [ + {type:'string',dataIndex:'name'}, + {type:'string',dataIndex:'number_'}, + {type:'string',dataIndex:'sex'}, + {type:'string',dataIndex:'age'}, + {type:'string',dataIndex:'birthDate'}, + {type:'string',dataIndex:'identityCardNumber'}, + {type:'string',dataIndex:'nation'}, + {type:'date',dataIndex:'nativePlace'}, + {type:'string',dataIndex:'registeredPermanentResidence'}, + {type:'string',dataIndex:'marriageStatus'}, + {type:'numeric',dataIndex:'educationBackground'}, + {type:'numeric',dataIndex:'profession'}, + {type:'numeric',dataIndex:'schoolGraduateFrom'}, + {type:'numeric',dataIndex:'firstWorkDate'}, + {type:'numeric',dataIndex:'enterCurrentCompanyDate'}, + {type:'numeric',dataIndex:'engageType'}, + {type:'numeric',dataIndex:'duty'}, + {type:'numeric',dataIndex:'theTitleOfATechnicalPost'}, + {type:'numeric',dataIndex:'politicalStatus'}, + {type:'numeric',dataIndex:'otherImformation'}, + {type:'numeric',dataIndex:'orgUnitName'}, + {type:'numeric',dataIndex:'phoneNumber'}, + {type:'numeric',dataIndex:'address'}, + {type:'numeric',dataIndex:'email'} + ] + + }); + + var readerDetail = [ { + name : 'id' + }, { + name : 'name' + },{ + name : 'number_' + },{ + name : 'sex' + },{ + name : 'age' + }, { + name : 'birthDate' + },{ + name : 'identityCardNumber' + }, { + name : 'nation' + },{ + name : 'registeredPermanentResidence' + },{ + name : 'marriageStatus' + },{ + name : 'educationBackground' + },{ + name : 'profession' + },{ + name : 'schoolGraduateFrom' + },{ + name : 'firstWorkDate' + },{ + name : 'enterCurrentCompanyDate' + },{ + name : 'duty' + },{ + name : 'engageType' + },{ + name : 'theTitleOfATechnicalPost' + },{ + name : 'politicalStatus' + },{ + name : 'phoneNumber' + },{ + name : 'address' + },{ + name : 'email' + }]; + + var sign = true; + var tbar = [ { + text : '添加', + hidden : SSTS_Sterilizer_Create, + iconCls : 'btn_ext_application_add', + handler : function() { + addAndEditSterilizer(0); + } + }, '-', { + text : '修改', + hidden : SSTS_Sterilizer_Update, + iconCls : 'btn_ext_application_edit', + id : 'editTbar', + handler : function() { + loadFormData(grid); + } + }, '-', { + text : '删除', + hidden : SSTS_Sterilizer_Delete, + iconCls : 'btn_ext_application_del', + handler : function() { + deleteSterilizer(grid); + } + } ]; + var dwrCallParams = null; + + Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function() { + + }; + + grid = new Ext.ux.ForgonPageGrid( { + tbar : tbar, + pageSize : 20, + defaultSortField : 'id', + defaultSortDirection : 'ASC', + title : '人员档案列表', + isCheckboxSelectionModel : true, + isShowSearchField : false,//取消搜索框 + rememberSelected :false,//取消清除已选 + columns : columns, + plugins : filters, + renderTo : 'gridDiv', + frame : false + }, readerDetail, + StaffArchiveTableManager.findStaffArchiveTableList, + dwrCallParams // 这个参数只是占位作用 + ); + + var viewport = new Ext.Viewport( { + layout : 'border', + items : [ /*form,*/ { + region : 'center', + margins : '0 0 0 0', + layout : 'fit', + items : grid + } ] + }); + + }); \ No newline at end of file Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/StaffArchiveManagerImpl.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/StaffArchiveManagerImpl.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/StaffArchiveManagerImpl.java (revision 13695) @@ -0,0 +1,223 @@ +package com.forgon.disinfectsystem.basedatamanager.staffArchives.service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; + +import com.forgon.attachfile.model.AttachFile; +import com.forgon.attachfile.service.AttachFileManager; +import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.entity.basedatamanager.staffArchives.StaffArchive; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilizer.Sterilizer; +import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; +import com.forgon.reflect.ReflectUtil; +import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.treenode.service.THTreeNodeManager; + +/** + *@author JC 2016-05-18 + */ +public class StaffArchiveManagerImpl implements StaffArchiveManager { + private ObjectDao objectDao; + private THTreeNodeManager thTreeNodeManager; + private static final String SEARCH_CONDITION_TYPE_IN = "inCondition"; + private static final String SEARCH_CONDITION_TYPE_EQUAL = "equalCondition"; + private static final String SEARCH_CONDITION_TYPE_BETWEEN = "betweenCondition"; + + private SupplyRoomConfigManager supplyRoomConfigManager; + private AttachFileManager attachFileManager; + + + public void setObjectDao(ObjectDao objectDao) { + this.objectDao = objectDao; + } + + public void setAttachFileManager(AttachFileManager attachFileManager) { + this.attachFileManager = attachFileManager; + } + + public void setSupplyRoomConfigManager( + SupplyRoomConfigManager supplyRoomConfigManager) { + this.supplyRoomConfigManager = supplyRoomConfigManager; + } + + public void setThTreeNodeManager(THTreeNodeManager thTreeNodeManager) { + this.thTreeNodeManager = thTreeNodeManager; + } + + public void delByIds(String ids) { + if (StringUtils.isNotBlank(ids)) { + String[] keyIdArray = ids.split(";"); + List idList = new ArrayList(); + for (String keyId : keyIdArray) { + idList.add(Long.parseLong(keyId)); + } + objectDao.delete(StaffArchive.class.getSimpleName(), idList); + } + + } + + public void delete(StaffArchive po) { + objectDao.delete(po); + } + + public StaffArchive getById(String id) { + StaffArchive po = (StaffArchive) objectDao.getByProperty(StaffArchive.class + .getSimpleName(), "id", Long.valueOf(id)); + return po; + } + + public void saveOrUpdate(StaffArchive po) { + if (po != null) { + if (po.getId() != null) { + update(po); + } else { + save(po); + } + } + } + + public void save(StaffArchive po) { + String identityCardNumber = po.getIdentityCardNumber(); + if (StringUtils.isNotBlank(identityCardNumber)) { + StaffArchive oldPo = getByIdentityCardNumber(identityCardNumber); + if (oldPo != null) { + copyNotBlankProperties(po, oldPo); + update(oldPo); + return; + } + } + objectDao.save(po); + } + + public void update(StaffArchive po) { + objectDao.update(po); + } + + private void copyNotBlankProperties(StaffArchive po, StaffArchive oldPo) { + List listProNotToCopy = new ArrayList(); + listProNotToCopy.add("id"); + ReflectUtil.copyProperties(po, oldPo, false, listProNotToCopy); + } + + @SuppressWarnings("unchecked") + public Long getIdByIdentityCardNumber(String identityCardNumber) { + Long id = null; + String hql = "select po.id from " + StaffArchive.class.getSimpleName() + + " po where po.identityCardNumber='" + identityCardNumber + + "'"; + List list = objectDao.findByHql(hql); + if (list != null && list.size() > 0) { + id = (Long) list.get(0); + } + return id; + } + + public StaffArchive getByIdentityCardNumber(String identityCardNumber) { + StaffArchive po = (StaffArchive) objectDao.getByProperty(StaffArchive.class + .getSimpleName(), "identityCardNumber", identityCardNumber); + return po; + } + + public boolean isExist(String id, String identityCardNumber) { + if (StringUtils.isBlank(id)) { + id = "0"; + } + if (StringUtils.isBlank(identityCardNumber)) { + return false; + } + String sql = "where po.identityCardNumber='" + identityCardNumber + + "' and po.id!=" + id; + int amount = objectDao.countObjectBySql(StaffArchive.class.getSimpleName(), + sql); + if (amount == 0) { + return false; + } + return true; + } + + @SuppressWarnings("unchecked") + public void saveOrUpdate(List poList) { + if (poList != null) { + for (Object obj : poList) { + StaffArchive po = (StaffArchive) obj; + saveOrUpdate(po); + } + } + } + + public boolean verifyStaffArchive(String id,String name){ + String sql = "where po.name = '" + name + "'"; + if (StringUtils.isNotEmpty(id)) { + sql += " and po.id != " + id; + } + if (objectDao.getBySql(StaffArchive.class.getSimpleName(), sql) != null) { + return false; + } else { + return true; + } + } + /** + * 下载附件 + * @param response + * @param id + */ + public void downloadAttachFile(HttpServletResponse response, String id) { + SupplyRoomConfig systemParamsObj = supplyRoomConfigManager.getSystemParamsObj(); + String saveImageDirectory = systemParamsObj.getSaveImagePath(); + if (StringUtils.isNotBlank(id)) { + AttachFile attachFile = attachFileManager.getById(id); + if (attachFile != null ) { + byte[] img = new byte[4096* 1024]; + String attachFilePath = attachFile.getAttachFilePath(); + String fileName = attachFile.getUUIDFileName(); + String absoluteFilePath = saveImageDirectory+attachFilePath+"\\"+fileName; + FileInputStream fis = null; + OutputStream outputStream = null; + + try { + fis = new FileInputStream(new File(absoluteFilePath)); + + response.setHeader( + "Content-disposition", + "attachment;filename=" + + URLEncoder.encode( + attachFile.getFileName(), "utf-8")); + response.setContentType("image/jpeg;charset=utf-8"); + outputStream = response.getOutputStream(); + int len = 0; + while( (len = fis.read(img)) != -1 ) + { + outputStream.write(img, 0, len); + } + }catch (Exception e) { + e.printStackTrace(); + }finally { + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + }finally{ + if(fis!=null){ + try { + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + } + } + } +} Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/ExportStaffArchiveManager.java =================================================================== diff -u --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/ExportStaffArchiveManager.java (revision 0) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/staffArchives/service/ExportStaffArchiveManager.java (revision 13695) @@ -0,0 +1,10 @@ +package com.forgon.disinfectsystem.basedatamanager.staffArchives.service; + +import java.io.OutputStream; + +/** + * @author JC 2016-05-18 + */ +public interface ExportStaffArchiveManager { + public void exportEmployee(OutputStream ops); +}