Commit 37c8f0c8 authored by lisong's avatar lisong

修改文件上传路径

parent 90065ac3
package com.yeejoin.amos.api.openapi.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.SimpleFormatter;
import com.yeejoin.amos.api.openapi.enums.FileFolderPathEnum;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -39,7 +43,7 @@ public class FilesController {
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,"cylinder");
JSONObject jsonObj = uploadFile(file,FileFolderPathEnum.CYLINDER.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -49,7 +53,7 @@ public class FilesController {
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,"csei");
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.JY.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
......@@ -57,8 +61,10 @@ public class FilesController {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/"+tag);
Date today = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String path = format.format(today);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/" + tag + "/" + path);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
......@@ -76,16 +82,17 @@ public class FilesController {
@ApiOperation(value = "上传附件")
@PostMapping("/supma")
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file){
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
return ResponseHelper.buildResponse(jsonObj);
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.JG.getPath());
// FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
// JSONObject jsonObj = new JSONObject();
// if (date != null) {
// Map<String, String> map = date.getResult();
// Iterator<String> it = map.keySet().iterator();
// String urlString=it.next();
// jsonObj.put("fileUrl", urlString);
// jsonObj.put("fileName", map.get(urlString));
// }
return ResponseHelper.buildResponse(jsonObject);
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum FileFolderPathEnum {
/**
* 小程序
*/
WE_APP("app","/app"),
/**
* 96333
*/
ELEVATOR("elevator","/elevator"),
/**
* 气瓶
*/
CYLINDER("cylinder","/cylinder"),
/**
* 一码通
*/
YMT("ymt","/ymt"),
/**
* 两个规定
*/
PATROL("patrol","/patrol"),
/**
* TCM
*/
TCM("tcm","/tcm"),
/**
* 监管
*/
JG("jg","/supma"),
/**
* 检验报告
*/
JY("jg","/csei")
;
private String module;
private String path;
}
......@@ -174,12 +174,14 @@
af.check_results AS checkResult
FROM
( SELECT * FROM tz_cylinder_filling_record WHERE is_not_es IS NULL AND filling_before_id IS NOT NULL
AND filling_check_id IS NOT NULL LIMIT 5000 ) r
AND filling_check_id IS NOT NULL and LENGTH(filling_startTime) >= 10 LIMIT 5000 ) r
LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id
AND r.filling_before_id IS NOT NULL and b.inspection_date NOT LIKE'16%'
AND date_format ( b.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' ) and b.sequence_code is not null AND b.app_id is not null
LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format ( af.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
and LENGTH(b.inspection_date) >= 10
and LENGTH(af.inspection_date) >= 10
LEFT JOIN tz_cylinder_unit tcn ON tcn.app_id = r.app_id
</select>
......
......@@ -38,6 +38,7 @@
WHEN (SELECT COUNT(1)
FROM tz_cylinder_inspection ins
WHERE ins.app_id = tcu.app_id
and LENGTH(ins.next_inspection_date) >= 10
and TO_DAYS(ins.next_inspection_date) - TO_DAYS(NOW()) &lt;= 30) > 0 THEN
1
WHEN (SELECT COUNT(1) FROM view_unit_outofdate v WHERE v.credit_code = tcu.credit_code) > 0 THEN
......
......@@ -377,6 +377,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
}
builder.query(boolMust);
builder.sort("inspectionDateMs",SortOrder.DESC);
builder.sort("sequenceNbr",SortOrder.DESC);
builder.from((pageNum - 1) * pageSize);
builder.size(pageSize);
......
......@@ -3,7 +3,9 @@ package com.yeejoin.amos.patrol.business.controller;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskFeedbackBo;
......@@ -26,6 +28,7 @@ import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -35,8 +38,13 @@ import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.*;
......@@ -44,6 +52,7 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -890,5 +899,33 @@ public class TaskController extends AbstractBaseController{
return map;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "图片上传按月分文件夹")
@PostMapping(value = "/imageUpload")
public ResponseModel<Object> uploadTaskFiles (@RequestBody MultipartFile file) throws Exception {
JSONObject jsonObject = uploadFile(file, "/twoRegulations");
return ResponseHelper.buildResponse(jsonObject);
}
private JSONObject uploadFile(MultipartFile file, String tag) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
Date today = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String path = format.format(today);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/" + tag + "/" + path);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
}
return jsonObj;
}
}
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