package com.zcloud.controller.relatedparty; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.logs.LogAnno; import com.zcloud.service.relatedparty.OutSourcedService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import java.util.*; /** * 说明:外包工程 * 作者:luoxiaobao * 时间:2022-06-14 * 官网:www.zcloudchina.com */ @Controller @RequestMapping("/outsourced") public class OutSourcedController extends BaseController { @Autowired private OutSourcedService outsourcedService; @Autowired private Smb smb; /**新增 * @param * @throws Exception */ @RequestMapping(value="/add") // @RequiresPermissions("outsourced:add") @ResponseBody @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "新增") public Object add(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam(value="file1",required=false) MultipartFile file1, @RequestParam(value="file2",required=false) MultipartFile file2, @RequestParam(value="file3",required=false) MultipartFile file3, @RequestParam(value="file4",required=false) MultipartFile file4, @RequestParam(value="file5",required=false) MultipartFile file5, @RequestParam(value="file6",required=false) MultipartFile file6, @RequestParam(value="file7",required=false) MultipartFile file7, @RequestParam(value="file8",required=false) MultipartFile file8) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("OUTSOURCED_ID", this.get32UUID()); //主键 pd.put("CREATOR", Jurisdiction.getUsername()); //添加人 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("ISDELETE", "0"); //是否删除 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID if (null != file && !file.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("UNITS_APTITUDE", file.getOriginalFilename()); pd.put("UNITS_APTITUDEPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file1 && !file1.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file1.getOriginalFilename().substring(file1.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file1, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("MEASURES", file2.getOriginalFilename()); pd.put("MEASURESPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file2 && !file2.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file2.getOriginalFilename().substring(file2.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file2, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("MANAGE_APTITUDE", file2.getOriginalFilename()); pd.put("MANAGE_APTITUDEPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file3 && !file3.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file3.getOriginalFilename().substring(file3.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file3, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("DESIGE", file3.getOriginalFilename()); pd.put("DESIGEPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file4 && !file4.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file4.getOriginalFilename().substring(file4.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file4, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("ATTACHMENTS", file4.getOriginalFilename()); pd.put("ATTACHMENTSPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file5 && !file5.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file5.getOriginalFilename().substring(file5.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file5, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("RECORDS", file5.getOriginalFilename()); pd.put("RECORDSPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file6 && !file6.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file6.getOriginalFilename().substring(file6.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file6, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("SHEET", file6.getOriginalFilename()); pd.put("SHEETPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file7 && !file6.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file7.getOriginalFilename().substring(file7.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file7, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("EXAMINATION", file7.getOriginalFilename()); pd.put("EXAMINATIONPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file8 && !file6.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file8.getOriginalFilename().substring(file8.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file8, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("OATTACHMENTS", file8.getOriginalFilename()); pd.put("OATTACHMENTSPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } outsourcedService.save(pd); map.put("result", errInfo); return map; } /**删除 * @param out * @throws Exception */ @RequestMapping(value="/delete") // @RequiresPermissions("outsourced:del") @ResponseBody @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "删除") public Object delete() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); outsourcedService.delete(pd); map.put("result", errInfo); //返回结果 return map; } /**修改 * @param * @throws Exception */ @RequestMapping(value="/edit") // @RequiresPermissions("outsourced:edit") @ResponseBody @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "修改") public Object edit(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam(value="file1",required=false) MultipartFile file1, @RequestParam(value="file2",required=false) MultipartFile file2, @RequestParam(value="file3",required=false) MultipartFile file3, @RequestParam(value="file4",required=false) MultipartFile file4, @RequestParam(value="file5",required=false) MultipartFile file5, @RequestParam(value="file6",required=false) MultipartFile file6, @RequestParam(value="file7",required=false) MultipartFile file7, @RequestParam(value="file8",required=false) MultipartFile file8 ) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); if (null != file && !file.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("UNITS_APTITUDE", file.getOriginalFilename()); pd.put("UNITS_APTITUDEPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file1 && !file1.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file1.getOriginalFilename().substring(file1.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file1, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("MEASURES", file2.getOriginalFilename()); pd.put("MEASURESPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file2 && !file2.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file2.getOriginalFilename().substring(file2.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file2, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("MANAGE_APTITUDE", file2.getOriginalFilename()); pd.put("MANAGE_APTITUDEPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file3 && !file3.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file3.getOriginalFilename().substring(file3.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file3, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("DESIGE", file3.getOriginalFilename()); pd.put("DESIGEPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file4 && !file4.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file4.getOriginalFilename().substring(file4.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file4, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("ATTACHMENTS", file4.getOriginalFilename()); pd.put("ATTACHMENTSPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file5 && !file5.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file5.getOriginalFilename().substring(file5.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file5, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("RECORDS", file5.getOriginalFilename()); pd.put("RECORDSPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file6 && !file6.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file6.getOriginalFilename().substring(file6.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file6, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("SHEET", file6.getOriginalFilename()); pd.put("SHEETPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file7 && !file6.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file7.getOriginalFilename().substring(file7.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file7, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("EXAMINATION", file7.getOriginalFilename()); pd.put("EXAMINATIONPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } if (null != file8 && !file6.isEmpty()) { String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file8.getOriginalFilename().substring(file8.getOriginalFilename().lastIndexOf(".")); smb.sshSftp(file8, fileName, Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("OATTACHMENTS", file8.getOriginalFilename()); pd.put("OATTACHMENTSPATH", Const.FILEPATHFXGFGL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } outsourcedService.edit(pd); map.put("result", errInfo); return map; } /**列表 * @param page * @throws Exception */ @RequestMapping(value="/list") // @RequiresPermissions("outsourced:list") @ResponseBody @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "列表") public Object list(Page page) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID page.setPd(pd); List varList = outsourcedService.list(page); //列出OutSourced列表 map.put("varList", varList); map.put("page", page); map.put("result", errInfo); return map; } /**去修改页面获取数据 * @param * @throws Exception */ @RequestMapping(value="/goEdit") // @RequiresPermissions("outsourced:edit") @ResponseBody @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "去修改页面获取数据") public Object goEdit() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd = outsourcedService.findById(pd); //根据ID读取 map.put("pd", pd); map.put("result", errInfo); return map; } /**批量删除 * @param * @throws Exception */ @RequestMapping(value="/deleteAll") // @RequiresPermissions("outsourced:del") @ResponseBody @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "批量删除") public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ String ArrayDATA_IDS[] = DATA_IDS.split(","); outsourcedService.deleteAll(ArrayDATA_IDS); errInfo = "success"; }else{ errInfo = "error"; } map.put("result", errInfo); //返回结果 return map; } /**导出到excel * @param * @throws Exception */ @RequestMapping(value="/excel") // @RequiresPermissions("toExcel") @LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "导出到excel") public ModelAndView exportExcel() throws Exception{ ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); Map dataMap = new HashMap(); List titles = new ArrayList(); titles.add("发包部门"); //1 titles.add("发包部门负责人"); //2 titles.add("外包工程名称"); //3 titles.add("计划工期开始时间"); //4 titles.add("计划工期结束时间"); //5 titles.add("合同起止时间"); //6 titles.add("相关方单位名称 "); //7 titles.add("合同号 "); //8 titles.add("相关方单位资质"); //9 titles.add("相关方单位本项目负责人"); //10 titles.add("相关方单位本项目负责人手机"); //11 titles.add("监理单位名称 "); //12 titles.add("监理单位资质"); //13 titles.add("监理单位本项目负责人姓名"); //14 titles.add("监理单位本项目负责人手机"); //15 titles.add("安全技术措施"); //16 titles.add("附件"); //17 titles.add("备注 "); //18 titles.add("培训管理单位"); //19 titles.add("培训管理负责人"); //20 titles.add("培训时间"); //21 titles.add("安全培训记录 "); //22 titles.add("培训签名表"); //23 titles.add("外包工程考试题"); //24 titles.add("其他附件"); //25 titles.add("添加人"); //26 titles.add("添加时间"); //27 titles.add("修改人"); //28 titles.add("修改时间"); //29 titles.add("是否删除"); //30 titles.add("企业ID"); //31 titles.add("申请人"); //32 titles.add("状态"); //33 dataMap.put("titles", titles); List varOList = outsourcedService.listAll(pd); List varList = new ArrayList(); for(int i=0;i