integrated_traffic/src/main/java/com/zcloud/controller/relatedparty/OutSourcedController.java

398 lines
19 KiB
Java
Raw Normal View History

2024-01-05 08:51:44 +08:00
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")
2024-01-05 08:51:44 +08:00
@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<String,Object> map = new HashMap<String,Object>();
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")
2024-01-05 08:51:44 +08:00
@ResponseBody
@LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "删除")
public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>();
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")
2024-01-05 08:51:44 +08:00
@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<String,Object> map = new HashMap<String,Object>();
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")
2024-01-05 08:51:44 +08:00
@ResponseBody
@LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "列表")
public Object list(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
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<PageData> 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")
2024-01-05 08:51:44 +08:00
@ResponseBody
@LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "去修改页面获取数据")
public Object goEdit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
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")
2024-01-05 08:51:44 +08:00
@ResponseBody
@LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "批量删除")
public Object deleteAll() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
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")
2024-01-05 08:51:44 +08:00
@LogAnno(menuType= "综合管理",menuServer= "相关方管理",instructionsOperate = "外包工程管理",instructionsType = "导出到excel")
public ModelAndView exportExcel() throws Exception{
ModelAndView mv = new ModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
Map<String,Object> dataMap = new HashMap<String,Object>();
List<String> titles = new ArrayList<String>();
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<PageData> varOList = outsourcedService.listAll(pd);
List<PageData> varList = new ArrayList<PageData>();
for(int i=0;i<varOList.size();i++){
PageData vpd = new PageData();
vpd.put("var1", varOList.get(i).getString("CONTRACT_ID")); //1
vpd.put("var2", varOList.get(i).getString("CONTRACT_PIC")); //2
vpd.put("var3", varOList.get(i).getString("OUTSOURCED_NAME")); //3
vpd.put("var4", varOList.get(i).getString("STARTTIME")); //4
vpd.put("var5", varOList.get(i).getString("ENDTIME")); //5
vpd.put("var6", varOList.get(i).getString("CONTRACTTIME")); //6
vpd.put("var7", varOList.get(i).getString("UNITS_NAME")); //7
vpd.put("var8", varOList.get(i).getString("CONTRACT_NUM")); //8
vpd.put("var9", varOList.get(i).getString("UNITS_APTITUDE")); //9
vpd.put("var10", varOList.get(i).getString("UNITS_PIC")); //10
vpd.put("var11", varOList.get(i).get("UNITS_PHONE").toString()); //11
vpd.put("var12", varOList.get(i).getString("MANAGE_NAME")); //12
vpd.put("var13", varOList.get(i).getString("MANAGE_APTITUDE")); //13
vpd.put("var14", varOList.get(i).getString("MANAGE_PIC")); //14
vpd.put("var15", varOList.get(i).get("MANAGE_PHONE").toString()); //15
vpd.put("var16", varOList.get(i).getString("MEASURES")); //16
vpd.put("var17", varOList.get(i).getString("ATTACHMENTS")); //17
vpd.put("var18", varOList.get(i).getString("REMARKS")); //18
vpd.put("var19", varOList.get(i).getString("TRAINING_NAME")); //19
vpd.put("var20", varOList.get(i).getString("TRAINING_PIC")); //20
vpd.put("var21", varOList.get(i).getString("TRAINING_TIME")); //21
vpd.put("var22", varOList.get(i).getString("RECORDS")); //22
vpd.put("var23", varOList.get(i).getString("SHEET")); //23
vpd.put("var24", varOList.get(i).getString("EXAMINATION")); //24
vpd.put("var25", varOList.get(i).getString("OATTACHMENTS")); //25
vpd.put("var26", varOList.get(i).getString("CREATOR")); //26
vpd.put("var27", varOList.get(i).getString("CREATTIME")); //27
vpd.put("var28", varOList.get(i).getString("OPERATOR")); //28
vpd.put("var29", varOList.get(i).getString("OPERATTIME")); //29
vpd.put("var30", varOList.get(i).getString("ISDELETE")); //30
vpd.put("var31", varOList.get(i).getString("CORPINFO_ID")); //31
vpd.put("var32", varOList.get(i).getString("APPLICANT")); //32
vpd.put("var33", varOList.get(i).getString("STATE")); //33
varList.add(vpd);
}
dataMap.put("varList", varList);
ObjectExcelView erv = new ObjectExcelView();
mv = new ModelAndView(erv,dataMap);
return mv;
}
}