Browse Source

新增、修改、删除、列表、详情、上传标准文件接口新增

anderx 1 year ago
parent
commit
2c8d3315ae

+ 4 - 0
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -49,6 +49,10 @@ public class WebpageController extends BaseController {
 	public String adminLogin(HttpServletRequest request, ModelAndView modelview) {
 		return "/admin/login";
 	}
+	@RequestMapping(value = "/admin/standard", method = RequestMethod.GET)
+	public String adminStandard(HttpServletRequest request, ModelAndView modelview) {
+		return "/admin/standard";
+	}
 
 
 	@RequestMapping(value = "/RD/admin/login", method = RequestMethod.GET)

+ 3 - 1
src/main/java/com/goafanti/common/enums/AttachmentType.java

@@ -57,7 +57,9 @@ public enum AttachmentType {
 	VARIETIES_PICTURE("varieties_picture","业务品类图片"),
 	ORGANIZATION_APPLICATION("organization_application","企业申报书"),
 	DUN_LOG_ATTACHMENT("dun_log_attachment","催款日志附件"),
-	LEGAL_LOG_ATTACHMENT("legal_log_attachment","催款日志附件");
+	LEGAL_LOG_ATTACHMENT("legal_log_attachment","催款日志附件"),
+	STANDARD_DOCUMENT("standard_document","标准文档");
+
 
 
 	private AttachmentType(String code, String desc) {

+ 17 - 0
src/main/java/com/goafanti/common/mapper/StandardDocumentMapper.xml

@@ -150,4 +150,21 @@
         left join department c on a.dep_id=c.id
         where  a.id = #{id,jdbcType=INTEGER}
     </select>
+    <select id="standardList"  resultMap="DetailsMap">
+        select
+            a.*,b.name adminName,c.name depName
+        from standard_document a left join admin b on a.aid=b.id
+                                 left join department c on a.dep_id=c.id
+        where  1=1
+    </select>
+
+    <select id="standardCount"  resultType="java.lang.Integer">
+        select
+            count(*)
+        from standard_document a
+        where  1=1
+    </select>
+
+
+
 </mapper>

+ 1 - 1
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -111,7 +111,7 @@ public class FileUtils {
 			if (uniq) {
 				fileName = path + uid + "/" + System.nanoTime() + "_" + sign + suffix;
 			} else {
-				fileName = path + uid + "/" +  sign + suffix;
+				fileName = path + uid + "/"  +  sign + suffix;
 			}
 		} else {
 			fileName = path + uid + "/" + System.nanoTime() + suffix;

+ 2 - 2
src/main/java/com/goafanti/core/mybatis/page/Pagination.java

@@ -9,7 +9,7 @@ public class Pagination<T> extends SimplePage implements java.io.Serializable, P
 	/**
 	 * 当前页的数据
 	 */
-	private List<?> list = new ArrayList<>();
+	private List<T> list = new ArrayList<>();
 
 	public Pagination() {
 	}
@@ -31,7 +31,7 @@ public class Pagination<T> extends SimplePage implements java.io.Serializable, P
 		return list;
 	}
 
-	public void setList(List<?> list) {
+	public void setList(List list) {
 		this.list = list;
 	}
 

+ 46 - 0
src/main/java/com/goafanti/standard/bo/InputStandardList.java

@@ -3,6 +3,52 @@ package com.goafanti.standard.bo;
 public class InputStandardList {
     private Integer pageNo;
     private Integer pageSize;
+    private String name;
+    private String depId;
+    private Integer status;
+
+    private String startTime;
+    private String endTime;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDepId() {
+        return depId;
+    }
+
+    public void setDepId(String depId) {
+        this.depId = depId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
 
     public Integer getPageNo() {
         return pageNo;

+ 23 - 1
src/main/java/com/goafanti/standard/controller/StandardApiController.java

@@ -1,15 +1,20 @@
 package com.goafanti.standard.controller;
 
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.model.StandardDocument;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.standard.bo.InputStandardList;
+import com.goafanti.standard.bo.OutStandardDocument;
 import com.goafanti.standard.service.StandardService;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 
 @RestController
 @RequestMapping(value = "/api/admin/standard")
@@ -26,7 +31,7 @@ public class StandardApiController extends CertifyApiController {
      */
     @RequestMapping(value = "/list", method = RequestMethod.GET)
     public Result list(InputStandardList in) {
-        Result res = res();
+        Result res = new Result<Pagination<OutStandardDocument>>();
         return res.data(standardService.list(in));
     }
     /**
@@ -73,4 +78,21 @@ public class StandardApiController extends CertifyApiController {
         Result res = res();
         return res.data(standardService.update(in));
     }
+
+    /**
+     * 图片上传
+     */
+    @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+    public Result uploadPicture(HttpServletRequest req, String sign) {
+        Result res = new Result();
+        AttachmentType attachmentType = AttachmentType.getField(sign);
+
+        if (attachmentType == AttachmentType.STANDARD_DOCUMENT
+        ) {
+            res.setData(handleFiles(res, "/standard/", false, req, sign, ""));
+        } else {
+            res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "图片"));
+        }
+        return res;
+    }
 }

+ 2 - 1
src/main/java/com/goafanti/standard/service/StandardService.java

@@ -3,6 +3,7 @@ package com.goafanti.standard.service;
 import com.goafanti.common.model.StandardDocument;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.standard.bo.InputStandardList;
+import com.goafanti.standard.bo.OutStandardDocument;
 
 public interface StandardService {
     Object add(StandardDocument in);
@@ -11,7 +12,7 @@ public interface StandardService {
 
     Object update(StandardDocument in);
 
-    Pagination<?> list(InputStandardList in);
+    Pagination<OutStandardDocument> list(InputStandardList in);
 
     Object get(StandardDocument in);
 }

+ 5 - 0
src/main/java/com/goafanti/standard/service/impl/StandardServiceImpl.java

@@ -35,6 +35,11 @@ public class StandardServiceImpl extends BaseMybatisDao<StandardDocumentMapper>
     @Override
     public Pagination<OutStandardDocument> list(InputStandardList in) {
         Map<String,Object> params = new HashMap();
+        if (in.getStatus()!=null)params.put("status",in.getStatus());
+        if (in.getStartTime()!=null)params.put("startTime",in.getStartTime());
+        if (in.getEndTime()!=null)params.put("endTime",in.getEndTime()+" 23:59:59");
+        if (in.getDepId()!=null)params.put("depId",in.getDepId());
+        if (in.getName()!=null)params.put("name",in.getName());
         return (Pagination<OutStandardDocument>) findPage("standardList","standardCount",params,in.getPageNo(),in.getPageSize());
     }
 

+ 18 - 0
src/main/webapp/WEB-INF/views/admin/standard.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:th="http://www.thymeleaf.org">
+<head th:replace="common::header(~{::title},~{::link})">
+	<title>科技成果页</title>
+	<link th:href="${staticHost+'/dll/dll.css'}" rel="stylesheet">
+	<link th:href="${staticHost+'/admin/standard.css'}" rel="stylesheet">
+</head>
+<body>
+	<div id="root"></div>
+	
+	<div th:replace="common::footer(~{::script})">
+		<script type="text/javascript" th:src="${staticHost+'/vendors.js'}"></script>
+		<script type="text/javascript" th:src="${staticHost+'/dll/dll.js'}"></script>
+		<script type="text/javascript" th:src="${staticHost+'/admin/standard.js'}"></script>
+	</div>
+</body>
+</html>