Commit 12c9ac3d authored by yff's avatar yff

附件修改中间为工艺路线,右边为标准工序

parent ab9c06a7
package com.gavel.kwell.controller;
import java.io.FileInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.SystemOperation;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.attachment.persistent.Attachment;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.utils.ThreadContext;
import com.gavel.gygl.service.BzgxService;
import com.gavel.kwell.service.GpfkfjService;
@Controller
@RequestMapping("gygl/bzgx")
public class BzgxFjController extends BaseController {
private static final String ATTACHMENT_FOLDER = "bzgx";
@Autowired
private BzgxService bzgxService;
@Autowired
private GpfkfjService gpfkfjService;
@RequestMapping(value = "attachment/list", method = RequestMethod.POST)
@ResponseBody
public Object attachmentListSub(@RequestBody JSONObject param) {
return buildReturnData(getAttachmentListSub(ATTACHMENT_FOLDER, param), Attachment.class);
}
@ResourcePermissions({SystemOperation.BottonResource.ADD, SystemOperation.BottonResource.EDIT})
@PostMapping(value = "attachment/upload")
@ResponseBody
public Object attachmentUpload(HttpServletRequest request, @RequestParam("groupid") String groupid,
@RequestParam("folder") String folder) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultiValueMap<String, MultipartFile> multiValueMap = multipartRequest.getMultiFileMap();
for (MultipartFile multipartFile : multiValueMap.toSingleValueMap().values()) {
gpfkfjService.checkGxfjIfFitRule(multipartFile, getFolder(folder, ATTACHMENT_FOLDER), groupid);
bzgxService.attachmentUpload(multipartFile, getFolder(folder, ATTACHMENT_FOLDER), groupid);
}
return ThreadContext.getReturnData();
}
@ResourcePermissions({SystemOperation.BottonResource.ADD, SystemOperation.BottonResource.EDIT})
@PostMapping(value = "attachment/upload/update")
@ResponseBody
public Object attachmentUploadUpdate(HttpServletRequest request, @RequestParam("id") String id,
@RequestParam("message") String message) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultiValueMap<String, MultipartFile> multiValueMap = multipartRequest.getMultiFileMap();
for (MultipartFile multipartFile : multiValueMap.toSingleValueMap().values()) {
bzgxService.attachmentUploadUpdate(multipartFile, id, message);
}
return ThreadContext.getReturnData();
}
@RequestMapping(value = "attachment/download/{id}")
public void attachmentDownLoad(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) {
FileInputStream fileInputStream = bzgxService.attachmentDownload(id);
doAttachmentDownLoad(id, request, response, fileInputStream);
}
@RequestMapping(value = "attachment/preview/{id}")
public void attachmentPreview(HttpServletResponse response, @PathVariable String id) {
FileInputStream fileInputStream = bzgxService.attachmentDownload(id);
doAttachmentPreview(id, response, fileInputStream);
}
@ResourcePermissions({SystemOperation.BottonResource.ADD, SystemOperation.BottonResource.DELETE})
@PostMapping(value = "attachment/delete")
@ResponseBody
public Object attachmentDelete(@RequestBody JSONObject param) {
JSONArray idArray = param.getJSONArray("id");
for(int i = 0; i < idArray.size(); i++) {
String id = idArray.getString(i);
bzgxService.attachmentDelete(id);
}
return ThreadContext.getReturnData();
}
}
package com.gavel.kwell.controller;
import java.io.FileInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.SystemOperation;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.attachment.persistent.Attachment;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.utils.ThreadContext;
import com.gavel.gygl.service.GylxService;
import com.gavel.kwell.service.GpfkfjService;
@Controller
@RequestMapping("gygl/gylx")
public class GylxFjController extends BaseController {
private static final String ATTACHMENT_FOLDER = "gylx";
@Autowired
private GylxService gylxService;
@Autowired
private GpfkfjService gpfkfjService;
@RequestMapping(value = "attachment/list", method = RequestMethod.POST)
@ResponseBody
public Object attachmentListSub(@RequestBody JSONObject param) {
return buildReturnData(getAttachmentListSub(ATTACHMENT_FOLDER, param), Attachment.class);
}
@ResourcePermissions({SystemOperation.BottonResource.ADD, SystemOperation.BottonResource.EDIT})
@PostMapping(value = "attachment/upload")
@ResponseBody
public Object attachmentUpload(HttpServletRequest request, @RequestParam("groupid") String groupid,
@RequestParam("folder") String folder) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultiValueMap<String, MultipartFile> multiValueMap = multipartRequest.getMultiFileMap();
for (MultipartFile multipartFile : multiValueMap.toSingleValueMap().values()) {
gpfkfjService.checkGxfjIfFitRule(multipartFile, getFolder(folder, ATTACHMENT_FOLDER), groupid);
gylxService.attachmentUpload(multipartFile, getFolder(folder, ATTACHMENT_FOLDER), groupid);
}
return ThreadContext.getReturnData();
}
@ResourcePermissions({SystemOperation.BottonResource.ADD, SystemOperation.BottonResource.EDIT})
@PostMapping(value = "attachment/upload/update")
@ResponseBody
public Object attachmentUploadUpdate(HttpServletRequest request, @RequestParam("id") String id,
@RequestParam("message") String message) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultiValueMap<String, MultipartFile> multiValueMap = multipartRequest.getMultiFileMap();
for (MultipartFile multipartFile : multiValueMap.toSingleValueMap().values()) {
gylxService.attachmentUploadUpdate(multipartFile, id, message);
}
return ThreadContext.getReturnData();
}
@RequestMapping(value = "attachment/download/{id}")
public void attachmentDownLoad(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) {
FileInputStream fileInputStream = gylxService.attachmentDownload(id);
doAttachmentDownLoad(id, request, response, fileInputStream);
}
@RequestMapping(value = "attachment/preview/{id}")
public void attachmentPreview(HttpServletResponse response, @PathVariable String id) {
FileInputStream fileInputStream = gylxService.attachmentDownload(id);
doAttachmentPreview(id, response, fileInputStream);
}
@ResourcePermissions({SystemOperation.BottonResource.ADD, SystemOperation.BottonResource.DELETE})
@PostMapping(value = "attachment/delete")
@ResponseBody
public Object attachmentDelete(@RequestBody JSONObject param) {
JSONArray idArray = param.getJSONArray("id");
for(int i = 0; i < idArray.size(); i++) {
String id = idArray.getString(i);
gylxService.attachmentDelete(id);
}
return ThreadContext.getReturnData();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment