消防资源

pull/14/head
dearlin 2023-12-21 14:18:19 +08:00
parent 5503a64b6d
commit e4a311fdb2
9 changed files with 2100 additions and 1907 deletions

View File

@ -7,6 +7,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.zcloud.aspect.DockAnnotation;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.service.mq.DockSendMessageService;
import com.zcloud.util.*; import com.zcloud.util.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -34,327 +37,357 @@ import com.zcloud.service.bus.ImgFilesService;
@RequestMapping("/app/imgfiles") @RequestMapping("/app/imgfiles")
public class AppImgFilesController extends BaseController { public class AppImgFilesController extends BaseController {
@Autowired @Autowired
private ImgFilesService imgfilesService; private ImgFilesService imgfilesService;
@Autowired
private DockSendMessageService dockSendMessageService;
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/add", headers = "content-type=multipart/form-data") * @throws Exception
@ResponseBody */
@Transactional @RequestMapping(value = "/add", headers = "content-type=multipart/form-data")
public Object finish( @ResponseBody
@RequestParam(value="FFILE",required=false) MultipartFile[] files, @Transactional
@RequestParam(value="TYPE",required=false) String TYPE, @DockAnnotation(hasAnnex = true)
@RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY public Object finish(
) throws Exception{ @RequestParam(value = "FFILE", required = false) MultipartFile[] files,
Map<String,Object> map = new HashMap<String,Object>(); @RequestParam(value = "TYPE", required = false) String TYPE,
String errInfo = "success"; @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY
) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail"; errInfo = "fail";
map.put("result", errInfo); map.put("result", errInfo);
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
} }
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i]; MultipartFile file = files[i];
// 保存文件 // 保存文件
File tempFile = new File(file.getOriginalFilename()); File tempFile = new File(file.getOriginalFilename());
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型 if (!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型
tempFile.delete(); tempFile.delete();
map.put("result", "failed"); map.put("result", "failed");
map.put("exception", "上传图片格式不正确,请重新上传"); map.put("exception", "上传图片格式不正确,请重新上传");
return map; return map;
} }
if (tempFile.exists()) { if (tempFile.exists()) {
tempFile.delete(); tempFile.delete();
} }
if(TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图 if (TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图
PageData pd2 = new PageData(); PageData pd2 = new PageData();
pd2.put("FOREIGN_KEY",FOREIGN_KEY); pd2.put("FOREIGN_KEY", FOREIGN_KEY);
pd2.put("TYPE",TYPE); pd2.put("TYPE", TYPE);
List<PageData> four = imgfilesService.listAll(pd2); List<PageData> four = imgfilesService.listAll(pd2);
for (PageData pageData : four) { for (PageData pageData : four) {
File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH")); File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH"));
old.delete(); old.delete();
imgfilesService.delete(pageData); imgfilesService.delete(pageData);
} pageData.put("delete","1");
} TenCorpDto tenCorpDto = new TenCorpDto();
PageData pd = new PageData(); tenCorpDto.setMessage("删除文件消息");
pd = this.getPageData(); tenCorpDto.setId(UuidUtil.get32UUID());
String ffile = DateUtil.getDays(); tenCorpDto.setTopic("docking");
tenCorpDto.setProducer_name("qa-prevention-czks");
tenCorpDto.setData(pageData);
dockSendMessageService.sendMessagePictureDelete(tenCorpDto);
}
}
PageData pd = new PageData();
pd = this.getPageData();
String ffile = DateUtil.getDays();
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
// String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); String IMGFILES_ID = this.get32UUID();
pd.put("IMGFILES_ID", IMGFILES_ID);
pd.put("IMGFILES_ID", this.get32UUID()); pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("TYPE", TYPE);
pd.put("TYPE", TYPE); pd.put("FOREIGN_KEY", FOREIGN_KEY);
pd.put("FOREIGN_KEY", FOREIGN_KEY); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile, IMGFILES_ID, FOREIGN_KEY, TYPE);
imgfilesService.save(pd); imgfilesService.save(pd);
} }
} }
map.put("result", errInfo);
map.put("result", errInfo); return map;
return map; }
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/add64") * @throws Exception
@ResponseBody */
public Object add64() throws Exception{ @RequestMapping(value = "/add64")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object add64() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH")); PageData pd = new PageData();
String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); pd = this.getPageData();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH"));
errInfo = "fail"; String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
map.put("result", errInfo); if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
map.put("msg", "文件格式不正确!"); errInfo = "fail";
return map; map.put("result", errInfo);
} map.put("msg", "文件格式不正确!");
String ffile = DateUtil.getDays(); return map;
String fileName = this.get32UUID()+img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")); }
Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); String ffile = DateUtil.getDays();
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); String fileName = this.get32UUID() + img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf("."));
pd.put("IMGFILES_ID", this.get32UUID()); Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("TYPE", pd.getString("TYPE")); pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY")); pd.put("IMGFILES_ID", this.get32UUID());
imgfilesService.save(pd); pd.put("TYPE", pd.getString("TYPE"));
map.put("pd", pd); pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY"));
map.put("result", errInfo); imgfilesService.save(pd);
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/edit", headers = "content-type=multipart/form-data") * @throws Exception
@ResponseBody */
@Transactional @RequestMapping(value = "/edit", headers = "content-type=multipart/form-data")
public Object edit( @ResponseBody
@RequestParam(value="FFILE",required=false) MultipartFile[] files, @Transactional
@RequestParam(value="TYPE",required=false) String TYPE, public Object edit(
@RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY @RequestParam(value = "FFILE", required = false) MultipartFile[] files,
) throws Exception{ @RequestParam(value = "TYPE", required = false) String TYPE,
Map<String,Object> map = new HashMap<String,Object>(); @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY
String errInfo = "success"; ) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail"; errInfo = "fail";
map.put("result", errInfo); map.put("result", errInfo);
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
} }
PageData pd2 = new PageData(); PageData pd2 = new PageData();
pd2.put("FOREIGN_KEY",FOREIGN_KEY); pd2.put("FOREIGN_KEY", FOREIGN_KEY);
pd2.put("TYPE",TYPE); pd2.put("TYPE", TYPE);
List<PageData> four = imgfilesService.listAll(pd2); List<PageData> four = imgfilesService.listAll(pd2);
for (PageData pageData : four) { for (PageData pageData : four) {
File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH")); File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH"));
old.delete(); old.delete();
imgfilesService.delete(pageData); imgfilesService.delete(pageData);
} }
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i]; MultipartFile file = files[i];
// 保存文件 // 保存文件
File tempFile = new File(file.getOriginalFilename()); File tempFile = new File(file.getOriginalFilename());
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型 if (!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型
tempFile.delete(); tempFile.delete();
map.put("result", "failed"); map.put("result", "failed");
map.put("exception", "上传图片格式不正确,请重新上传"); map.put("exception", "上传图片格式不正确,请重新上传");
return map; return map;
} }
if (tempFile.exists()) { if (tempFile.exists()) {
tempFile.delete(); tempFile.delete();
} }
PageData pd = new PageData(); PageData pd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
// String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("IMGFILES_ID", this.get32UUID()); pd.put("IMGFILES_ID", this.get32UUID());
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd.put("TYPE", TYPE); pd.put("TYPE", TYPE);
pd.put("FOREIGN_KEY", FOREIGN_KEY); pd.put("FOREIGN_KEY", FOREIGN_KEY);
imgfilesService.save(pd); imgfilesService.save(pd);
} }
} }
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param out *
* @throws Exception *
*/ * @param out
@RequestMapping(value="/delete") * @throws Exception
@ResponseBody */
public Object delete() throws Exception{ @RequestMapping(value = "/delete")
Map<String,String> map = new HashMap<String,String>(); @ResponseBody
String errInfo = "success"; public Object delete() throws Exception {
PageData pd = new PageData(); Map<String, String> map = new HashMap<String, String>();
pd = this.getPageData(); String errInfo = "success";
pd = imgfilesService.findById(pd); //根据ID读取 PageData pd = new PageData();
File file = new File(PathUtil.getProjectpath()+pd.getString("FILEPATH")); pd = this.getPageData();
file.delete(); pd = imgfilesService.findById(pd); //根据ID读取
imgfilesService.delete(pd); File file = new File(PathUtil.getProjectpath() + pd.getString("FILEPATH"));
map.put("result", errInfo); //返回结果 file.delete();
return map; imgfilesService.delete(pd);
} map.put("result", errInfo); //返回结果
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/edit") * @throws Exception
@RequiresPermissions("imgfiles:edit") */
@ResponseBody @RequestMapping(value = "/edit")
public Object edit() throws Exception{ @RequiresPermissions("imgfiles:edit")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object edit() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
imgfilesService.edit(pd); PageData pd = new PageData();
map.put("result", errInfo); pd = this.getPageData();
return map; imgfilesService.edit(pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param page *
* @throws Exception *
*/ * @param page
@RequestMapping(value="/list") * @throws Exception
@RequiresPermissions("imgfiles:list") */
@ResponseBody @RequestMapping(value = "/list")
public Object list(Page page) throws Exception{ @RequiresPermissions("imgfiles:list")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object list(Page page) throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 PageData pd = new PageData();
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); pd = this.getPageData();
page.setPd(pd); String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
List<PageData> varList = imgfilesService.list(page); //列出ImgFiles列表 if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
map.put("varList", varList); page.setPd(pd);
map.put("page", page); List<PageData> varList = imgfilesService.list(page); //列出ImgFiles列表
map.put("result", errInfo); map.put("varList", varList);
return map; map.put("page", page);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/goEdit") * @throws Exception
@RequiresPermissions("imgfiles:edit") */
@ResponseBody @RequestMapping(value = "/goEdit")
public Object goEdit() throws Exception{ @RequiresPermissions("imgfiles:edit")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object goEdit() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
pd = imgfilesService.findById(pd); //根据ID读取 PageData pd = new PageData();
map.put("pd", pd); pd = this.getPageData();
map.put("result", errInfo); pd = imgfilesService.findById(pd); //根据ID读取
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/deleteAll") * @throws Exception
@RequiresPermissions("imgfiles:del") */
@ResponseBody @RequestMapping(value = "/deleteAll")
public Object deleteAll() throws Exception{ @RequiresPermissions("imgfiles:del")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object deleteAll() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
String DATA_IDS = pd.getString("DATA_IDS"); PageData pd = new PageData();
if(Tools.notEmpty(DATA_IDS)){ pd = this.getPageData();
String ArrayDATA_IDS[] = DATA_IDS.split(","); String DATA_IDS = pd.getString("DATA_IDS");
imgfilesService.deleteAll(ArrayDATA_IDS); if (Tools.notEmpty(DATA_IDS)) {
errInfo = "success"; String ArrayDATA_IDS[] = DATA_IDS.split(",");
}else{ imgfilesService.deleteAll(ArrayDATA_IDS);
errInfo = "fail"; errInfo = "success";
} } else {
map.put("result", errInfo); //返回结果 errInfo = "fail";
return map; }
} map.put("result", errInfo); //返回结果
return map;
}
/**excel /**
* @param * excel
* @throws Exception *
*/ * @param
@RequestMapping(value="/excel") * @throws Exception
@RequiresPermissions("toExcel") */
public ModelAndView exportExcel() throws Exception{ @RequestMapping(value = "/excel")
ModelAndView mv = new ModelAndView(); @RequiresPermissions("toExcel")
PageData pd = new PageData(); public ModelAndView exportExcel() throws Exception {
pd = this.getPageData(); ModelAndView mv = new ModelAndView();
Map<String,Object> dataMap = new HashMap<String,Object>(); PageData pd = new PageData();
List<String> titles = new ArrayList<String>(); pd = this.getPageData();
titles.add("路径"); //1 Map<String, Object> dataMap = new HashMap<String, Object>();
titles.add("类型"); //2 List<String> titles = new ArrayList<String>();
titles.add("外键"); //3 titles.add("路径"); //1
dataMap.put("titles", titles); titles.add("类型"); //2
List<PageData> varOList = imgfilesService.listAll(pd); titles.add("外键"); //3
List<PageData> varList = new ArrayList<PageData>(); dataMap.put("titles", titles);
for(int i=0;i<varOList.size();i++){ List<PageData> varOList = imgfilesService.listAll(pd);
PageData vpd = new PageData(); List<PageData> varList = new ArrayList<PageData>();
vpd.put("var1", varOList.get(i).getString("FILEPATH")); //1 for (int i = 0; i < varOList.size(); i++) {
vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2 PageData vpd = new PageData();
vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3 vpd.put("var1", varOList.get(i).getString("FILEPATH")); //1
varList.add(vpd); vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2
} vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3
dataMap.put("varList", varList); varList.add(vpd);
ObjectExcelView erv = new ObjectExcelView(); }
mv = new ModelAndView(erv,dataMap); dataMap.put("varList", varList);
return mv; ObjectExcelView erv = new ObjectExcelView();
} mv = new ModelAndView(erv, dataMap);
return mv;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/listImgs") * @throws Exception
@ResponseBody */
public Object listImgs() throws Exception{ @RequestMapping(value = "/listImgs")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object listImgs() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
List<PageData> imgs = imgfilesService.listAll(pd); //根据ID读取 PageData pd = new PageData();
map.put("imgs", imgs); pd = this.getPageData();
map.put("result", errInfo); List<PageData> imgs = imgfilesService.listAll(pd); //根据ID读取
return map; map.put("imgs", imgs);
} map.put("result", errInfo);
return map;
}
} }

View File

@ -118,7 +118,9 @@ public class MfolderController extends BaseController {
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
mfolderService.save(pd); //存入数据库表 mfolderService.save(pd); //存入数据库表
//存自己表里的附件 使用文件全路径加文件名的方式 示例 //存自己表里的附件 使用文件全路径加文件名的方式 示例
// /uploadFiles/yhtp/8415df13cc4c46f0ac32f579462dbb8f/20231215/d3bc85d1bbe84b75b1e6e8b6182dc547.jpg@@d3bc85d1bbe84b75b1e6e8b6182dc547.jpg // /uploadFiles/yhtp/8415df13cc4c46f0ac32f579462dbb8f/20231215/d3bc85d1bbe84b75b1e6e8b6182dc547.jpg
// @@
// d3bc85d1bbe84b75b1e6e8b6182dc547.jpg
pictureList.add(Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName+ pictureList.add(Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName+
"@@" "@@"
+fileName); +fileName);

View File

@ -0,0 +1,95 @@
package com.zcloud.controller.firemanager;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.fireresources.FireResourcesService;
import com.zcloud.util.DateUtil;
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 javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/fireResources")
public class FireResourcesController extends BaseController {
@Resource
private FireResourcesService fireResourcesService;
@RequestMapping(value = "/list")
@ResponseBody
public Object page(Page page) {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
page.setPd(pd);
//获取当前人的公司id
List<PageData> varList = fireResourcesService.datalistPage(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/getById")
@ResponseBody
public Object getById() {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pddata = this.getPageData();
//获取当前人的公司id
PageData pd = fireResourcesService.getDataById(pddata);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/add")
@ResponseBody
public Object add(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
String FIRERESOURCES_ID = this.get32UUID();
pd.put("FIRERESOURCES_ID", FIRERESOURCES_ID);
pd.put("CREATIME", DateUtil.date2Str(new Date()));
pd.put("OPERATIME", DateUtil.date2Str(new Date()));
pd.put("ISDELETE", "0");
fireResourcesService.save(pd,files);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/edit")
@ResponseBody
public Object edit(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATIME", DateUtil.date2Str(new Date()));
pd.put("ISDELETE", "0");
fireResourcesService.edit(pd,files);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/delete")
@ResponseBody
public Object delete(Page page) {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
fireResourcesService.delete(pd);
map.put("result", errInfo);
return map;
}
}

View File

@ -1,12 +1,16 @@
package com.zcloud.controller.firemanager.app; package com.zcloud.controller.firemanager.app;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zcloud.aspect.DockAnnotation;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.firemanager.FireDeviceMapper; import com.zcloud.mapper.datasource.firemanager.FireDeviceMapper;
import com.zcloud.service.bus.ImgFilesService; import com.zcloud.service.bus.ImgFilesService;
import com.zcloud.service.firemanager.*; import com.zcloud.service.firemanager.*;
import com.zcloud.service.mq.DockSendMessageService;
import com.zcloud.service.mq.SendMessageService;
import com.zcloud.util.DateUtil; import com.zcloud.util.DateUtil;
import com.zcloud.util.InitPageDataUtil; import com.zcloud.util.InitPageDataUtil;
import com.zcloud.util.Jurisdiction; import com.zcloud.util.Jurisdiction;
@ -35,7 +39,8 @@ public class AppFireRecordController extends BaseController {
@Resource @Resource
private ImgFilesService imgFilesService; private ImgFilesService imgFilesService;
@Resource
private DockSendMessageService dockSendMessageService;
@Resource @Resource
private FireCheckStandardService fireCheckStandardService; private FireCheckStandardService fireCheckStandardService;
@Autowired @Autowired
@ -47,7 +52,6 @@ public class AppFireRecordController extends BaseController {
@Autowired @Autowired
private FirePointService firePointService; private FirePointService firePointService;
@Resource @Resource
private InitPageDataUtil initPageDataUtil; private InitPageDataUtil initPageDataUtil;
@ -67,7 +71,7 @@ public class AppFireRecordController extends BaseController {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
pageData.put("TYPE",115); pageData.put("TYPE", 115);
List<PageData> dataList = fireQualifiedPhotosService.getPointQualifiedPhotos(pageData); List<PageData> dataList = fireQualifiedPhotosService.getPointQualifiedPhotos(pageData);
map.put("varList", dataList); map.put("varList", dataList);
map.put("result", errInfo); map.put("result", errInfo);
@ -134,6 +138,7 @@ public class AppFireRecordController extends BaseController {
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -173,6 +178,7 @@ public class AppFireRecordController extends BaseController {
map.put("varList", res); map.put("varList", res);
return map; return map;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -194,6 +200,7 @@ public class AppFireRecordController extends BaseController {
map.put("varList", res); map.put("varList", res);
return map; return map;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -274,7 +281,7 @@ public class AppFireRecordController extends BaseController {
String errInfo = "success"; String errInfo = "success";
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
List<PageData>varList = fireRecordService.getDeviceRecordByPoint(pageData); List<PageData> varList = fireRecordService.getDeviceRecordByPoint(pageData);
map.put("varList", varList); map.put("varList", varList);
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
@ -306,41 +313,41 @@ public class AppFireRecordController extends BaseController {
* @Return: java.lang.Object * @Return: java.lang.Object
*/ */
@RequestMapping("/editDeviceCheck") @RequestMapping("/editDeviceCheck")
@DockAnnotation
public Object editDeviceCheck() throws Exception { public Object editDeviceCheck() throws Exception {
String errInfo = "success"; String errInfo = "success";
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData(); PageData pd = this.getPageData();
List<PageData> list = JSONObject.parseArray(pd.getString("CHECK_DATA"), PageData.class); List<PageData> list = JSONObject.parseArray(pd.getString("CHECK_DATA"), PageData.class);
ArrayList<PageData> dataArrayList = new ArrayList<>();
// 点位下设备检查记录 // 点位下设备检查记录
list.forEach(itemCheck -> { list.forEach(itemCheck -> {
PageData itemCheckData = new PageData(); PageData itemCheckData = new PageData();
itemCheckData.putAll(itemCheck); itemCheckData.putAll(itemCheck);
itemCheckData.put("FOREIGN_KEY", itemCheck.getString("EQUIPMENT_RECORD_ID")); itemCheckData.put("FOREIGN_KEY", itemCheck.getString("EQUIPMENT_RECORD_ID"));
itemCheckData.put("TYPE", "14"); itemCheckData.put("TYPE", "14");
List<PageData> data = null; List<PageData> data = imgFilesService.listAll(itemCheckData);
try {
data = imgFilesService.listAll(itemCheckData);
} catch (Exception e) {
throw new RuntimeException(e);
}
// 不合格 // 不合格
if (!"0".equals(itemCheckData.getString("ISNORMAL"))) { if (!"0".equals(itemCheckData.getString("ISNORMAL"))) {
// 删除合格得照片 // 删除合格得照片
data.forEach(item -> { data.forEach(item -> {
imgFilesService.delete(item);
TenCorpDto tenCorpDto = new TenCorpDto();
tenCorpDto.setData(item);
try { try {
imgFilesService.delete(item); dockSendMessageService.sendMessagePictureDelete(tenCorpDto);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });
} }
fireRecordService.editDeviceCheckByApp(itemCheckData); fireRecordService.editDeviceCheckByApp(itemCheckData);
dataArrayList.add(itemCheckData);
}); });
// todo 校验一下有没有点位图片
// fireRecordService.modifyPointRecord(pd);
map.put("result", errInfo); map.put("result", errInfo);
pd.put("dataArrayList",dataArrayList);
map.put("dockData", pd);
return map; return map;
} }
@ -352,12 +359,14 @@ public class AppFireRecordController extends BaseController {
* @Return: java.lang.Object * @Return: java.lang.Object
*/ */
@RequestMapping("/editDeviceCheckFine") @RequestMapping("/editDeviceCheckFine")
@DockAnnotation
public Object editDeviceCheckFine() throws Exception { public Object editDeviceCheckFine() throws Exception {
String errInfo = "success"; String errInfo = "success";
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData(); PageData pd = this.getPageData();
fireRecordService.modifyPointRecord(pd); fireRecordService.modifyPointRecord(pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("dockData", pd);
return map; return map;
} }
@ -542,7 +551,7 @@ public class AppFireRecordController extends BaseController {
if (deviceListByPointId.size() > 0) { if (deviceListByPointId.size() > 0) {
deviceListByPointId.forEach(item -> { deviceListByPointId.forEach(item -> {
String[] fireCheckStandardItems = item.getString("FIRE_CHECK_STANDARD_ITEM").split("@@"); String[] fireCheckStandardItems = item.getString("FIRE_CHECK_STANDARD_ITEM").split("@@");
item.put("FIRE_CHECK_STANDARD_ITEM",fireCheckStandardItems); item.put("FIRE_CHECK_STANDARD_ITEM", fireCheckStandardItems);
}); });
} }

View File

@ -23,7 +23,7 @@ public interface ImgFilesService{
* @param pd * @param pd
* @throws Exception * @throws Exception
*/ */
public void delete(PageData pd)throws Exception; public void delete(PageData pd);
/** /**
* @param pd * @param pd
@ -47,7 +47,7 @@ public interface ImgFilesService{
* @param pd * @param pd
* @throws Exception * @throws Exception
*/ */
public List<PageData> listAll(PageData pd)throws Exception; public List<PageData> listAll(PageData pd);
/**id /**id
* @param pd * @param pd

View File

@ -5,6 +5,8 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.service.mq.DockSendMessageService;
import com.zcloud.util.*; import com.zcloud.util.*;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -28,7 +30,8 @@ public class ImgFilesServiceImpl implements ImgFilesService{
@Autowired @Autowired
private ImgFilesMapper imgfilesMapper; private ImgFilesMapper imgfilesMapper;
@Autowired
private DockSendMessageService dockSendMessageService;
/** /**
* @param pd * @param pd
* @throws Exception * @throws Exception
@ -41,8 +44,10 @@ public class ImgFilesServiceImpl implements ImgFilesService{
* @param pd * @param pd
* @throws Exception * @throws Exception
*/ */
public void delete(PageData pd)throws Exception{ @Override
public void delete(PageData pd){
imgfilesMapper.delete(pd); imgfilesMapper.delete(pd);
} }
/** /**

View File

@ -6,6 +6,7 @@ public interface DockSendMessageService {
void sendMessage(TenCorpDto tenCorpDto) throws Exception; void sendMessage(TenCorpDto tenCorpDto) throws Exception;
void sendMessagePicture(TenCorpDto tenCorpDto) throws Exception; void sendMessagePicture(TenCorpDto tenCorpDto) throws Exception;
void sendMessagePictureDelete(TenCorpDto tenCorpDto) throws Exception;
void SendDelayQueue(TenCorpDto tenCorpDto); void SendDelayQueue(TenCorpDto tenCorpDto);
void SendDelayQueue(String message); void SendDelayQueue(String message);

View File

@ -84,6 +84,29 @@ public class DockSendMessageServiceImpl implements DockSendMessageService {
} }
} }
@Override
public void sendMessagePictureDelete(TenCorpDto tenCorpDto) throws Exception {
try {
PageData log = tenCorpDto.getPd();
log.put("MESSAGE_LOG_ID", Warden.get32UUID());
log.put("CREATE_TIME", DateUtil.getTime());
mqMessageLogMapper.save(log);
System.out.println("生产者:" + tenCorpDto.toString());
SendResult sendResult = rocketMQTemplate.syncSend(this.dockingPicture, tenCorpDto.toString());
if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) {
throw new RuntimeException("产品入栈失败");
}
} catch (Exception e) {
e.printStackTrace();
PageData log = tenCorpDto.getPd();
log.put("MESSAGE_ERROR_LOG_ID", Warden.get32UUID());
log.put("ERROR_MESSAGE", e.getMessage());
log.put("TYPE", "0");
log.put("TIME", DateUtil.getTime());
mqErrorMessageLogMapper.save(log);
}
}
@Override @Override
public void SendDelayQueue(TenCorpDto tenCorpDto) { public void SendDelayQueue(TenCorpDto tenCorpDto) {
PageData log = tenCorpDto.getPd(); PageData log = tenCorpDto.getPd();