消防资源
parent
5503a64b6d
commit
e4a311fdb2
File diff suppressed because it is too large
Load Diff
|
@ -7,6 +7,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -34,327 +37,357 @@ import com.zcloud.service.bus.ImgFilesService;
|
|||
@RequestMapping("/app/imgfiles")
|
||||
public class AppImgFilesController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ImgFilesService imgfilesService;
|
||||
@Autowired
|
||||
private ImgFilesService imgfilesService;
|
||||
@Autowired
|
||||
private DockSendMessageService dockSendMessageService;
|
||||
|
||||
/**完成
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/add", headers = "content-type=multipart/form-data")
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
public Object finish(
|
||||
@RequestParam(value="FFILE",required=false) MultipartFile[] files,
|
||||
@RequestParam(value="TYPE",required=false) String TYPE,
|
||||
@RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY
|
||||
) throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
/**
|
||||
* 完成
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/add", headers = "content-type=multipart/form-data")
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
@DockAnnotation(hasAnnex = true)
|
||||
public Object finish(
|
||||
@RequestParam(value = "FFILE", required = false) MultipartFile[] files,
|
||||
@RequestParam(value = "TYPE", required = false) String TYPE,
|
||||
@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) {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
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)) {
|
||||
errInfo = "fail";
|
||||
map.put("result", errInfo);
|
||||
map.put("msg", "文件格式不正确!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
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)) {
|
||||
errInfo = "fail";
|
||||
map.put("result", errInfo);
|
||||
map.put("msg", "文件格式不正确!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
// 保存文件
|
||||
File tempFile = new File(file.getOriginalFilename());
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
|
||||
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型
|
||||
tempFile.delete();
|
||||
map.put("result", "failed");
|
||||
map.put("exception", "上传图片格式不正确,请重新上传");
|
||||
return map;
|
||||
}
|
||||
if (tempFile.exists()) {
|
||||
tempFile.delete();
|
||||
}
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
|
||||
if (!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型
|
||||
tempFile.delete();
|
||||
map.put("result", "failed");
|
||||
map.put("exception", "上传图片格式不正确,请重新上传");
|
||||
return map;
|
||||
}
|
||||
if (tempFile.exists()) {
|
||||
tempFile.delete();
|
||||
}
|
||||
|
||||
if(TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图
|
||||
PageData pd2 = new PageData();
|
||||
pd2.put("FOREIGN_KEY",FOREIGN_KEY);
|
||||
pd2.put("TYPE",TYPE);
|
||||
List<PageData> four = imgfilesService.listAll(pd2);
|
||||
for (PageData pageData : four) {
|
||||
File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH"));
|
||||
old.delete();
|
||||
imgfilesService.delete(pageData);
|
||||
}
|
||||
}
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
String ffile = DateUtil.getDays();
|
||||
if (TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图
|
||||
PageData pd2 = new PageData();
|
||||
pd2.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||
pd2.put("TYPE", TYPE);
|
||||
List<PageData> four = imgfilesService.listAll(pd2);
|
||||
for (PageData pageData : four) {
|
||||
File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH"));
|
||||
old.delete();
|
||||
imgfilesService.delete(pageData);
|
||||
pageData.put("delete","1");
|
||||
TenCorpDto tenCorpDto = new TenCorpDto();
|
||||
tenCorpDto.setMessage("删除文件消息");
|
||||
tenCorpDto.setId(UuidUtil.get32UUID());
|
||||
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 fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
|
||||
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
|
||||
|
||||
pd.put("IMGFILES_ID", this.get32UUID());
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
|
||||
pd.put("TYPE", TYPE);
|
||||
pd.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||
imgfilesService.save(pd);
|
||||
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String IMGFILES_ID = this.get32UUID();
|
||||
pd.put("IMGFILES_ID", IMGFILES_ID);
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
|
||||
pd.put("TYPE", TYPE);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**新增
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/add64")
|
||||
@ResponseBody
|
||||
public Object add64() throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH"));
|
||||
String suffixName = img.getOriginalFilename().substring(img.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()+img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf("."));
|
||||
Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
|
||||
pd.put("IMGFILES_ID", this.get32UUID());
|
||||
pd.put("TYPE", pd.getString("TYPE"));
|
||||
pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY"));
|
||||
imgfilesService.save(pd);
|
||||
map.put("pd", pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/add64")
|
||||
@ResponseBody
|
||||
public Object add64() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH"));
|
||||
String suffixName = img.getOriginalFilename().substring(img.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() + img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf("."));
|
||||
Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
|
||||
pd.put("IMGFILES_ID", this.get32UUID());
|
||||
pd.put("TYPE", pd.getString("TYPE"));
|
||||
pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY"));
|
||||
imgfilesService.save(pd);
|
||||
map.put("pd", pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**完成
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/edit", headers = "content-type=multipart/form-data")
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
public Object edit(
|
||||
@RequestParam(value="FFILE",required=false) MultipartFile[] files,
|
||||
@RequestParam(value="TYPE",required=false) String TYPE,
|
||||
@RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY
|
||||
) throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
/**
|
||||
* 完成
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/edit", headers = "content-type=multipart/form-data")
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
public Object edit(
|
||||
@RequestParam(value = "FFILE", required = false) MultipartFile[] files,
|
||||
@RequestParam(value = "TYPE", required = false) String TYPE,
|
||||
@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) {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
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)) {
|
||||
errInfo = "fail";
|
||||
map.put("result", errInfo);
|
||||
map.put("msg", "文件格式不正确!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
PageData pd2 = new PageData();
|
||||
pd2.put("FOREIGN_KEY",FOREIGN_KEY);
|
||||
pd2.put("TYPE",TYPE);
|
||||
List<PageData> four = imgfilesService.listAll(pd2);
|
||||
for (PageData pageData : four) {
|
||||
File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH"));
|
||||
old.delete();
|
||||
imgfilesService.delete(pageData);
|
||||
}
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
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)) {
|
||||
errInfo = "fail";
|
||||
map.put("result", errInfo);
|
||||
map.put("msg", "文件格式不正确!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
PageData pd2 = new PageData();
|
||||
pd2.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||
pd2.put("TYPE", TYPE);
|
||||
List<PageData> four = imgfilesService.listAll(pd2);
|
||||
for (PageData pageData : four) {
|
||||
File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH"));
|
||||
old.delete();
|
||||
imgfilesService.delete(pageData);
|
||||
}
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
// 保存文件
|
||||
File tempFile = new File(file.getOriginalFilename());
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
|
||||
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型
|
||||
tempFile.delete();
|
||||
map.put("result", "failed");
|
||||
map.put("exception", "上传图片格式不正确,请重新上传");
|
||||
return map;
|
||||
}
|
||||
if (tempFile.exists()) {
|
||||
tempFile.delete();
|
||||
}
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
String ffile = DateUtil.getDays();
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
|
||||
if (!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型
|
||||
tempFile.delete();
|
||||
map.put("result", "failed");
|
||||
map.put("exception", "上传图片格式不正确,请重新上传");
|
||||
return map;
|
||||
}
|
||||
if (tempFile.exists()) {
|
||||
tempFile.delete();
|
||||
}
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
String ffile = DateUtil.getDays();
|
||||
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
|
||||
// String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
|
||||
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
|
||||
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
|
||||
|
||||
pd.put("IMGFILES_ID", this.get32UUID());
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
|
||||
pd.put("TYPE", TYPE);
|
||||
pd.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||
imgfilesService.save(pd);
|
||||
pd.put("IMGFILES_ID", this.get32UUID());
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
|
||||
pd.put("TYPE", TYPE);
|
||||
pd.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||
imgfilesService.save(pd);
|
||||
}
|
||||
}
|
||||
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**删除
|
||||
* @param out
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public Object delete() throws Exception{
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
pd = imgfilesService.findById(pd); //根据ID读取
|
||||
File file = new File(PathUtil.getProjectpath()+pd.getString("FILEPATH"));
|
||||
file.delete();
|
||||
imgfilesService.delete(pd);
|
||||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param out
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/delete")
|
||||
@ResponseBody
|
||||
public Object delete() throws Exception {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
pd = imgfilesService.findById(pd); //根据ID读取
|
||||
File file = new File(PathUtil.getProjectpath() + pd.getString("FILEPATH"));
|
||||
file.delete();
|
||||
imgfilesService.delete(pd);
|
||||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
|
||||
/**修改
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/edit")
|
||||
@RequiresPermissions("imgfiles:edit")
|
||||
@ResponseBody
|
||||
public Object edit() throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
imgfilesService.edit(pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/edit")
|
||||
@RequiresPermissions("imgfiles:edit")
|
||||
@ResponseBody
|
||||
public Object edit() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
imgfilesService.edit(pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**列表
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/list")
|
||||
@RequiresPermissions("imgfiles: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();
|
||||
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
||||
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
|
||||
page.setPd(pd);
|
||||
List<PageData> varList = imgfilesService.list(page); //列出ImgFiles列表
|
||||
map.put("varList", varList);
|
||||
map.put("page", page);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/list")
|
||||
@RequiresPermissions("imgfiles: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();
|
||||
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
||||
if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
|
||||
page.setPd(pd);
|
||||
List<PageData> varList = imgfilesService.list(page); //列出ImgFiles列表
|
||||
map.put("varList", varList);
|
||||
map.put("page", page);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**去修改页面获取数据
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/goEdit")
|
||||
@RequiresPermissions("imgfiles:edit")
|
||||
@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 = imgfilesService.findById(pd); //根据ID读取
|
||||
map.put("pd", pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 去修改页面获取数据
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/goEdit")
|
||||
@RequiresPermissions("imgfiles:edit")
|
||||
@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 = imgfilesService.findById(pd); //根据ID读取
|
||||
map.put("pd", pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**批量删除
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/deleteAll")
|
||||
@RequiresPermissions("imgfiles: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(",");
|
||||
imgfilesService.deleteAll(ArrayDATA_IDS);
|
||||
errInfo = "success";
|
||||
}else{
|
||||
errInfo = "fail";
|
||||
}
|
||||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/deleteAll")
|
||||
@RequiresPermissions("imgfiles: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(",");
|
||||
imgfilesService.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
|
||||
dataMap.put("titles", titles);
|
||||
List<PageData> varOList = imgfilesService.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("FILEPATH")); //1
|
||||
vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2
|
||||
vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3
|
||||
varList.add(vpd);
|
||||
}
|
||||
dataMap.put("varList", varList);
|
||||
ObjectExcelView erv = new ObjectExcelView();
|
||||
mv = new ModelAndView(erv,dataMap);
|
||||
return mv;
|
||||
}
|
||||
/**
|
||||
* 导出到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
|
||||
dataMap.put("titles", titles);
|
||||
List<PageData> varOList = imgfilesService.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("FILEPATH")); //1
|
||||
vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2
|
||||
vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3
|
||||
varList.add(vpd);
|
||||
}
|
||||
dataMap.put("varList", varList);
|
||||
ObjectExcelView erv = new ObjectExcelView();
|
||||
mv = new ModelAndView(erv, dataMap);
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
/**查询图片集合
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/listImgs")
|
||||
@ResponseBody
|
||||
public Object listImgs() throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
List<PageData> imgs = imgfilesService.listAll(pd); //根据ID读取
|
||||
map.put("imgs", imgs);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 查询图片集合
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/listImgs")
|
||||
@ResponseBody
|
||||
public Object listImgs() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
List<PageData> imgs = imgfilesService.listAll(pd); //根据ID读取
|
||||
map.put("imgs", imgs);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -118,7 +118,9 @@ public class MfolderController extends BaseController {
|
|||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
|
||||
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+
|
||||
"@@"
|
||||
+fileName);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
package com.zcloud.controller.firemanager.app;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zcloud.aspect.DockAnnotation;
|
||||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.dto.TenCorpDto;
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.mapper.datasource.firemanager.FireDeviceMapper;
|
||||
import com.zcloud.service.bus.ImgFilesService;
|
||||
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.InitPageDataUtil;
|
||||
import com.zcloud.util.Jurisdiction;
|
||||
|
@ -35,7 +39,8 @@ public class AppFireRecordController extends BaseController {
|
|||
|
||||
@Resource
|
||||
private ImgFilesService imgFilesService;
|
||||
|
||||
@Resource
|
||||
private DockSendMessageService dockSendMessageService;
|
||||
@Resource
|
||||
private FireCheckStandardService fireCheckStandardService;
|
||||
@Autowired
|
||||
|
@ -47,7 +52,6 @@ public class AppFireRecordController extends BaseController {
|
|||
@Autowired
|
||||
private FirePointService firePointService;
|
||||
|
||||
|
||||
@Resource
|
||||
private InitPageDataUtil initPageDataUtil;
|
||||
|
||||
|
@ -67,7 +71,7 @@ public class AppFireRecordController extends BaseController {
|
|||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pageData = this.getPageData();
|
||||
pageData.put("TYPE",115);
|
||||
pageData.put("TYPE", 115);
|
||||
List<PageData> dataList = fireQualifiedPhotosService.getPointQualifiedPhotos(pageData);
|
||||
map.put("varList", dataList);
|
||||
map.put("result", errInfo);
|
||||
|
@ -134,6 +138,7 @@ public class AppFireRecordController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 清单列表总数
|
||||
* @Author: dearLin
|
||||
|
@ -173,6 +178,7 @@ public class AppFireRecordController extends BaseController {
|
|||
map.put("varList", res);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 所有清单的检查记录最外层
|
||||
* @Author: dearLin
|
||||
|
@ -194,6 +200,7 @@ public class AppFireRecordController extends BaseController {
|
|||
map.put("varList", res);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 清单下的检查记录
|
||||
* @Author: dearLin
|
||||
|
@ -274,7 +281,7 @@ public class AppFireRecordController extends BaseController {
|
|||
String errInfo = "success";
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
PageData pageData = this.getPageData();
|
||||
List<PageData>varList = fireRecordService.getDeviceRecordByPoint(pageData);
|
||||
List<PageData> varList = fireRecordService.getDeviceRecordByPoint(pageData);
|
||||
map.put("varList", varList);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
|
@ -306,41 +313,41 @@ public class AppFireRecordController extends BaseController {
|
|||
* @Return: java.lang.Object
|
||||
*/
|
||||
@RequestMapping("/editDeviceCheck")
|
||||
@DockAnnotation
|
||||
public Object editDeviceCheck() throws Exception {
|
||||
String errInfo = "success";
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
PageData pd = this.getPageData();
|
||||
List<PageData> list = JSONObject.parseArray(pd.getString("CHECK_DATA"), PageData.class);
|
||||
ArrayList<PageData> dataArrayList = new ArrayList<>();
|
||||
// 点位下设备检查记录
|
||||
list.forEach(itemCheck -> {
|
||||
PageData itemCheckData = new PageData();
|
||||
itemCheckData.putAll(itemCheck);
|
||||
itemCheckData.put("FOREIGN_KEY", itemCheck.getString("EQUIPMENT_RECORD_ID"));
|
||||
itemCheckData.put("TYPE", "14");
|
||||
List<PageData> data = null;
|
||||
try {
|
||||
data = imgFilesService.listAll(itemCheckData);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
List<PageData> data = imgFilesService.listAll(itemCheckData);
|
||||
// 不合格
|
||||
if (!"0".equals(itemCheckData.getString("ISNORMAL"))) {
|
||||
// 删除合格得照片
|
||||
data.forEach(item -> {
|
||||
imgFilesService.delete(item);
|
||||
TenCorpDto tenCorpDto = new TenCorpDto();
|
||||
tenCorpDto.setData(item);
|
||||
try {
|
||||
imgFilesService.delete(item);
|
||||
dockSendMessageService.sendMessagePictureDelete(tenCorpDto);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
fireRecordService.editDeviceCheckByApp(itemCheckData);
|
||||
|
||||
dataArrayList.add(itemCheckData);
|
||||
});
|
||||
// todo 校验一下有没有点位图片
|
||||
|
||||
// fireRecordService.modifyPointRecord(pd);
|
||||
map.put("result", errInfo);
|
||||
pd.put("dataArrayList",dataArrayList);
|
||||
map.put("dockData", pd);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -352,12 +359,14 @@ public class AppFireRecordController extends BaseController {
|
|||
* @Return: java.lang.Object
|
||||
*/
|
||||
@RequestMapping("/editDeviceCheckFine")
|
||||
@DockAnnotation
|
||||
public Object editDeviceCheckFine() throws Exception {
|
||||
String errInfo = "success";
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
PageData pd = this.getPageData();
|
||||
fireRecordService.modifyPointRecord(pd);
|
||||
map.put("result", errInfo);
|
||||
map.put("dockData", pd);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -542,7 +551,7 @@ public class AppFireRecordController extends BaseController {
|
|||
if (deviceListByPointId.size() > 0) {
|
||||
deviceListByPointId.forEach(item -> {
|
||||
String[] fireCheckStandardItems = item.getString("FIRE_CHECK_STANDARD_ITEM").split("@@");
|
||||
item.put("FIRE_CHECK_STANDARD_ITEM",fireCheckStandardItems);
|
||||
item.put("FIRE_CHECK_STANDARD_ITEM", fireCheckStandardItems);
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface ImgFilesService{
|
|||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void delete(PageData pd)throws Exception;
|
||||
public void delete(PageData pd);
|
||||
|
||||
/**删除
|
||||
* @param pd
|
||||
|
@ -47,7 +47,7 @@ public interface ImgFilesService{
|
|||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listAll(PageData pd)throws Exception;
|
||||
public List<PageData> listAll(PageData pd);
|
||||
|
||||
/**通过id获取数据
|
||||
* @param pd
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zcloud.dto.TenCorpDto;
|
||||
import com.zcloud.service.mq.DockSendMessageService;
|
||||
import com.zcloud.util.*;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -28,7 +30,8 @@ public class ImgFilesServiceImpl implements ImgFilesService{
|
|||
|
||||
@Autowired
|
||||
private ImgFilesMapper imgfilesMapper;
|
||||
|
||||
@Autowired
|
||||
private DockSendMessageService dockSendMessageService;
|
||||
/**新增
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
|
@ -41,8 +44,10 @@ public class ImgFilesServiceImpl implements ImgFilesService{
|
|||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void delete(PageData pd)throws Exception{
|
||||
@Override
|
||||
public void delete(PageData pd){
|
||||
imgfilesMapper.delete(pd);
|
||||
|
||||
}
|
||||
|
||||
/**删除
|
||||
|
|
|
@ -6,6 +6,7 @@ public interface DockSendMessageService {
|
|||
|
||||
void sendMessage(TenCorpDto tenCorpDto) throws Exception;
|
||||
void sendMessagePicture(TenCorpDto tenCorpDto) throws Exception;
|
||||
void sendMessagePictureDelete(TenCorpDto tenCorpDto) throws Exception;
|
||||
|
||||
void SendDelayQueue(TenCorpDto tenCorpDto);
|
||||
void SendDelayQueue(String message);
|
||||
|
|
|
@ -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
|
||||
public void SendDelayQueue(TenCorpDto tenCorpDto) {
|
||||
PageData log = tenCorpDto.getPd();
|
||||
|
|
Loading…
Reference in New Issue