705 lines
31 KiB
Java
705 lines
31 KiB
Java
|
package com.zcloud.controller.keyProjects;
|
|||
|
|
|||
|
import com.zcloud.controller.base.BaseController;
|
|||
|
import com.zcloud.entity.Page;
|
|||
|
import com.zcloud.entity.PageData;
|
|||
|
import com.zcloud.entity.system.Department;
|
|||
|
import com.zcloud.service.bus.ImgFilesService;
|
|||
|
import com.zcloud.service.keyProjects.AIWarningService;
|
|||
|
import com.zcloud.service.keyProjects.OutSourcedService;
|
|||
|
import com.zcloud.service.system.DepartmentService;
|
|||
|
import com.zcloud.service.system.UsersService;
|
|||
|
import com.zcloud.util.*;
|
|||
|
import org.apache.commons.lang.StringUtils;
|
|||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
|
import org.apache.shiro.session.Session;
|
|||
|
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 AIWarningService aiWarningService;
|
|||
|
@Autowired
|
|||
|
private DepartmentService departmentService;
|
|||
|
@Autowired
|
|||
|
private UsersService usersService;
|
|||
|
@Autowired
|
|||
|
private ImgFilesService imgfilesService;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**新增
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/add")
|
|||
|
@RequiresPermissions("outsourced:add")
|
|||
|
@ResponseBody
|
|||
|
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,
|
|||
|
@RequestParam(value="file9",required=false) MultipartFile[] file9) 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.getUSER_ID()); //添加人
|
|||
|
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
|||
|
pd.put("ISDELETE", "0"); //是否删除
|
|||
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID
|
|||
|
pd.put("MANAGE_NAME", Jurisdiction.getCORPINFO_ID()); //辖区单位
|
|||
|
//pd.put("INVOLVING_CORPS", Jurisdiction.getCORPINFO_ID()); //理单位名称
|
|||
|
pd.put("IS_CORP_TYPE", "1"); //是否企业重点工程0监管重点工程;1企业重点工程
|
|||
|
|
|||
|
|
|||
|
if (null != file && !file.isEmpty()) {
|
|||
|
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("UNITS_APTITUDE", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file1 && !file1.isEmpty()) {
|
|||
|
String suffixName = file1.getOriginalFilename().substring(file1.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file1.getOriginalFilename().substring(file1.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file1, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("MEASURES", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file2 && !file2.isEmpty()) {
|
|||
|
String suffixName = file2.getOriginalFilename().substring(file2.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file2.getOriginalFilename().substring(file2.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file2, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("MANAGE_APTITUDE", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file3 && !file3.isEmpty()) {
|
|||
|
String suffixName = file3.getOriginalFilename().substring(file3.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file3.getOriginalFilename().substring(file3.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file3, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("DESIGE", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file4 && !file4.isEmpty()) {
|
|||
|
String suffixName = file4.getOriginalFilename().substring(file4.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file4.getOriginalFilename().substring(file4.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file4, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("ATTACHMENTS", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file5 && !file5.isEmpty()) {
|
|||
|
String suffixName = file5.getOriginalFilename().substring(file5.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file5.getOriginalFilename().substring(file5.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file5, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("RECORDS", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file6 && !file6.isEmpty()) {
|
|||
|
String suffixName = file6.getOriginalFilename().substring(file6.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file6.getOriginalFilename().substring(file6.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file6, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("SHEET", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file7 && !file7.isEmpty()) {
|
|||
|
String suffixName = file7.getOriginalFilename().substring(file7.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file7.getOriginalFilename().substring(file7.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file7, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("EXAMINATION", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file8 && !file8.isEmpty()) {
|
|||
|
String suffixName = file8.getOriginalFilename().substring(file8.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file8.getOriginalFilename().substring(file8.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file8, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("OATTACHMENTS", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
|
|||
|
if (null != file9 && file9.length > 0 ) {
|
|||
|
//校验
|
|||
|
for (int i=0;i<file9.length ;i++){
|
|||
|
MultipartFile file9One = file9[i];
|
|||
|
String suffixName = file9One.getOriginalFilename().substring(file9One.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
map.put("result", "fail");
|
|||
|
map.put("exception", "上传文件格式不正确");
|
|||
|
return map;
|
|||
|
}
|
|||
|
}
|
|||
|
for (int i=0;i<file9.length ;i++){
|
|||
|
MultipartFile file9One = file9[i];
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID() + file9One.getOriginalFilename().
|
|||
|
substring(file9One.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file9One, fileName,Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile);
|
|||
|
PageData pdImg = new PageData();
|
|||
|
String fileUpdateName = file9One.getOriginalFilename();
|
|||
|
pdImg.put("IMGFILES_ID", this.get32UUID());
|
|||
|
pdImg.put("FILE_NAME", fileUpdateName);
|
|||
|
pdImg.put("FILEPATH", Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
|
|||
|
pdImg.put("TYPE", "300");
|
|||
|
pdImg.put("FOREIGN_KEY", pd.getString("OUTSOURCED_ID"));
|
|||
|
imgfilesService.save(pdImg);
|
|||
|
}
|
|||
|
}
|
|||
|
// 把自己添加到辖区单位
|
|||
|
//if (!pd.getString("INVOLVING_CORPS").contains(Jurisdiction.getCORPINFO_ID())) {
|
|||
|
// String involvingCorps = pd.getString("INVOLVING_CORPS");
|
|||
|
// involvingCorps = Jurisdiction.getCORPINFO_ID()+","+involvingCorps;
|
|||
|
// pd.put("INVOLVING_CORPS",involvingCorps);
|
|||
|
//}
|
|||
|
pd.put("INVOLVING_CORPS",Jurisdiction.getCORPINFO_ID());
|
|||
|
outsourcedService.save(pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**删除
|
|||
|
* @param out
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/delete")
|
|||
|
@RequiresPermissions("outsourced:del")
|
|||
|
@ResponseBody
|
|||
|
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")
|
|||
|
@ResponseBody
|
|||
|
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,
|
|||
|
@RequestParam(value="file9",required=false) MultipartFile[] file9) 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 suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("UNITS_APTITUDE", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file1 && !file1.isEmpty()) {
|
|||
|
String suffixName = file1.getOriginalFilename().substring(file1.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file1.getOriginalFilename().substring(file1.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file1, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("MEASURES", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file2 && !file2.isEmpty()) {
|
|||
|
String suffixName = file2.getOriginalFilename().substring(file2.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file2.getOriginalFilename().substring(file2.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file2, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("MANAGE_APTITUDE", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file3 && !file3.isEmpty()) {
|
|||
|
String suffixName = file3.getOriginalFilename().substring(file3.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file3.getOriginalFilename().substring(file3.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file3, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("DESIGE", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file4 && !file4.isEmpty()) {
|
|||
|
String suffixName = file4.getOriginalFilename().substring(file4.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file4.getOriginalFilename().substring(file4.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file4, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("ATTACHMENTS", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file5 && !file5.isEmpty()) {
|
|||
|
String suffixName = file5.getOriginalFilename().substring(file5.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file5.getOriginalFilename().substring(file5.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file5, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("RECORDS", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file6 && !file6.isEmpty()) {
|
|||
|
String suffixName = file6.getOriginalFilename().substring(file6.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file6.getOriginalFilename().substring(file6.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file6, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("SHEET", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file7 && !file7.isEmpty()) {
|
|||
|
String suffixName = file7.getOriginalFilename().substring(file7.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file7.getOriginalFilename().substring(file7.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file7, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("EXAMINATION", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
if (null != file8 && !file8.isEmpty()) {
|
|||
|
String suffixName = file8.getOriginalFilename().substring(file8.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
errInfo = "fail";
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("msg", "文件格式不正确!");
|
|||
|
return map;
|
|||
|
}
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID()+file8.getOriginalFilename().substring(file8.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file8, fileName, Const.FILEPATHFILE + ffile);
|
|||
|
pd.put("OATTACHMENTS", Const.FILEPATHFILE + ffile + "/" + fileName);
|
|||
|
}
|
|||
|
|
|||
|
if (null != file9 && file9.length > 0 ) {
|
|||
|
//校验
|
|||
|
for (int i=0;i<file9.length ;i++){
|
|||
|
MultipartFile file9One = file9[i];
|
|||
|
String suffixName = file9One.getOriginalFilename().substring(file9One.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
|||
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
|||
|
map.put("result", "fail");
|
|||
|
map.put("exception", "上传文件格式不正确");
|
|||
|
return map;
|
|||
|
}
|
|||
|
}
|
|||
|
for (int i=0;i<file9.length ;i++){
|
|||
|
MultipartFile file9One = file9[i];
|
|||
|
String ffile = DateUtil.getDays();
|
|||
|
String fileName = this.get32UUID() + file9One.getOriginalFilename().
|
|||
|
substring(file9One.getOriginalFilename().lastIndexOf("."));
|
|||
|
Smb.sshSftp(file9One, fileName,Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile);
|
|||
|
PageData pdImg = new PageData();
|
|||
|
String fileUpdateName = file9One.getOriginalFilename();
|
|||
|
pdImg.put("IMGFILES_ID", this.get32UUID());
|
|||
|
pdImg.put("FILE_NAME", fileUpdateName);
|
|||
|
pdImg.put("FILEPATH", Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
|
|||
|
pdImg.put("TYPE", "300");
|
|||
|
pdImg.put("FOREIGN_KEY", pd.getString("OUTSOURCED_ID"));
|
|||
|
imgfilesService.save(pdImg);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
// 把自己添加到辖区单位
|
|||
|
//if (!pd.getString("INVOLVING_CORPS").contains(Jurisdiction.getCORPINFO_ID())) {
|
|||
|
//involvingCorps = pd.getString("INVOLVING_CORPS");
|
|||
|
|
|||
|
pd.put("INVOLVING_CORPS",Jurisdiction.getCORPINFO_ID());
|
|||
|
//}
|
|||
|
outsourcedService.edit(pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 列表
|
|||
|
* @param page
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/list")
|
|||
|
@ResponseBody
|
|||
|
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();
|
|||
|
if(!StringUtils.equals(Jurisdiction.getUsername(),"admin")){
|
|||
|
if(!StringUtils.equals(Jurisdiction.getCORPINFO_ID(),"1e6dbbe16004402f8d2c0e52afd9a676")&&!StringUtils.equals(Jurisdiction.getCORPINFO_ID(),"3a854eefa7894e06aaa1a2611bca80f6")&&
|
|||
|
!StringUtils.equals(Jurisdiction.getCORPINFO_ID(),"020578a4c1f04bc692ee25145c2efbe5")&&!StringUtils.equals(Jurisdiction.getCORPINFO_ID(),"90966974de3c4b83aca6f8fd6432d5c2")){
|
|||
|
pd.put("DeptId",outsourcedService.getDeptId(Jurisdiction.getUSER_ID()));
|
|||
|
pd.put("UserId",Jurisdiction.getUSER_ID());
|
|||
|
}
|
|||
|
}
|
|||
|
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
|||
|
if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
|
|||
|
String corpinfo = Jurisdiction.getCORPINFO_ID();
|
|||
|
pd.put("CORPINFO_ID",corpinfo);
|
|||
|
page.setPd(pd);
|
|||
|
List<PageData> varList = outsourcedService.list(page); //列出OutSourced列表
|
|||
|
|
|||
|
/**
|
|||
|
* 相关责任人可以正常添加 ,
|
|||
|
*
|
|||
|
* 1.获取重点工程的id 放到list里面
|
|||
|
* 2.根据重点工程id,获取ia报警的相关责任人
|
|||
|
* 3.根据重点工程id整理相关责任人,放到map里面, map的key值是终端工程id,value是人员名称或者id(已;分割)
|
|||
|
*/
|
|||
|
|
|||
|
List<String> outIds = new ArrayList<>();
|
|||
|
for (PageData pageData:varList){
|
|||
|
outIds.add(pageData.getString("OUTSOURCED_ID"));
|
|||
|
}
|
|||
|
pd.put("outIds",outIds);
|
|||
|
List<PageData> userList = aiWarningService.getPeopleListByIds(pd);
|
|||
|
|
|||
|
Map<String,String> putUserMap = new HashMap<>(); // key value
|
|||
|
for (PageData pageData :userList ){
|
|||
|
String OUTSOURCED_ID =pageData.getString("OUTSOURCED_ID");
|
|||
|
if(Tools.notEmpty(pageData.getString("NAME"))){
|
|||
|
String userName = pageData.getString("NAME");
|
|||
|
String userNames = userName;
|
|||
|
if(putUserMap.containsKey(OUTSOURCED_ID)){
|
|||
|
userNames = putUserMap.get(OUTSOURCED_ID) + ";" +userName;
|
|||
|
}else{
|
|||
|
userNames = userName;
|
|||
|
}
|
|||
|
putUserMap.put(OUTSOURCED_ID,userNames);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//* shuachu
|
|||
|
for (PageData pageData :varList ){
|
|||
|
String userNames = "";
|
|||
|
String OUTSOURCED_ID =pageData.getString("OUTSOURCED_ID");
|
|||
|
if(putUserMap.containsKey(OUTSOURCED_ID)){
|
|||
|
userNames = putUserMap.get(OUTSOURCED_ID);
|
|||
|
if(userNames.length()>1){
|
|||
|
pageData.put("userNames",userNames);
|
|||
|
}
|
|||
|
}else{
|
|||
|
pageData.put("userNames","");
|
|||
|
}
|
|||
|
}
|
|||
|
//* shuachu
|
|||
|
|
|||
|
map.put("varList", varList);
|
|||
|
map.put("page", page);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**去修改页面获取数据
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/goEdit")
|
|||
|
@ResponseBody
|
|||
|
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读取
|
|||
|
PageData selectPageData = new PageData();
|
|||
|
selectPageData.put("CORPINFO_ID",pd.get("PUNISH_THE_PERSON"));
|
|||
|
List<PageData> deptList = departmentService.listAll(selectPageData); //根据ID读取
|
|||
|
String userStr = pd.getString("PUNISH_THE_PERSON");
|
|||
|
if (!Tools.isEmpty(userStr)) {
|
|||
|
String[] split = userStr.split(",");
|
|||
|
selectPageData.put("ids",split);
|
|||
|
// List<PageData> pageData = usersService.listUserAndDept(selectPageData);
|
|||
|
// 监管与企业的
|
|||
|
List<PageData> pageData = usersService.selectUserListByUserIds(selectPageData);
|
|||
|
map.put("punishThePerson", pageData);
|
|||
|
}
|
|||
|
PageData pd3 = new PageData();
|
|||
|
pd3.put("TYPE", 300);
|
|||
|
pd3.put("FOREIGN_KEY", pd.getString("OUTSOURCED_ID"));
|
|||
|
List<PageData> file9 = imgfilesService.listAll(pd3);
|
|||
|
|
|||
|
map.put("pd", pd);
|
|||
|
map.put("deptList", deptList);
|
|||
|
map.put("file9", file9);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**批量删除
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/deleteAll")
|
|||
|
@RequiresPermissions("outsourced:del")
|
|||
|
@ResponseBody
|
|||
|
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 = "fail";
|
|||
|
}
|
|||
|
map.put("result", errInfo); //返回结果
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**导出到excel
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/excel")
|
|||
|
@RequiresPermissions("toExcel")
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
/**去修改页面获取数据
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/getListAllSel")
|
|||
|
@ResponseBody
|
|||
|
public Object getListAllSel() throws Exception{
|
|||
|
Map<String,Object> map = new HashMap<String,Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = new PageData();
|
|||
|
pd = this.getPageData();
|
|||
|
pd.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
|
|||
|
List<PageData> varList = outsourcedService.listAll(pd); //根据ID读取
|
|||
|
|
|||
|
map.put("pd", pd);
|
|||
|
map.put("varList", varList);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 删除
|
|||
|
*
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/jie")
|
|||
|
@ResponseBody
|
|||
|
public Object jie() throws Exception {
|
|||
|
Map<String, String> map = new HashMap<String, String>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = new PageData();
|
|||
|
pd = this.getPageData();
|
|||
|
pd = outsourcedService.findById(pd);
|
|||
|
outsourcedService.jie(pd);
|
|||
|
map.put("result", errInfo); //返回结果
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
}
|