diff --git a/pom.xml b/pom.xml
index 688c015..dbbf159 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
jar
材料管理系统
- 2.3.6.8-SNAPSHOT
+ 2.3.6.10-SNAPSHOT
@@ -128,8 +128,28 @@
${mjkf-xinke.version}
+
+
+ com.baomidou
+ mybatis-plus-generator
+ ${mybatis.plus.version}
+
+
+
+
+ org.freemarker
+ freemarker
+
+
+
+ org.mitre.dsmiley.httpproxy
+ smiley-http-proxy-servlet
+ 1.12.1
+
+
+
diff --git a/src/main/java/mjkf/xinke/core/config/GlobalConfigure.java b/src/main/java/mjkf/xinke/core/config/GlobalConfigure.java
index 1311cc5..e1f2a55 100644
--- a/src/main/java/mjkf/xinke/core/config/GlobalConfigure.java
+++ b/src/main/java/mjkf/xinke/core/config/GlobalConfigure.java
@@ -74,7 +74,7 @@ import java.util.*;
* @date 2021/10/9 14:24
**/
@Configuration
-@MapperScan(basePackages = {"mjkf.xinke.**.mapper, com.bstek.**.mapper"})
+@MapperScan(basePackages = {"mjkf.xinke.**.mapper, mjkf.xinke.**.dao, com.bstek.**.mapper"})
public class GlobalConfigure implements WebMvcConfigurer {
private static final String COMMON_REPEAT_SUBMIT_CACHE_KEY = "common-repeatSubmit:";
@@ -142,6 +142,8 @@ public class GlobalConfigure implements WebMvcConfigurer {
"/pay/wx/authNotifyUrl",
"/pay/wx/jsPay",
"/pay/order/sample/doCreateOrder",
+
+ "/solr/**",
};
/**
diff --git a/src/main/java/mjkf/xinke/core/handler/GlobalExceptionUtil.java b/src/main/java/mjkf/xinke/core/handler/GlobalExceptionUtil.java
index 00ca200..4ce9131 100644
--- a/src/main/java/mjkf/xinke/core/handler/GlobalExceptionUtil.java
+++ b/src/main/java/mjkf/xinke/core/handler/GlobalExceptionUtil.java
@@ -5,6 +5,7 @@ import cn.dev33.satoken.exception.SaTokenException;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
+import com.jgy.xxs.core.http.exp.NcHttpException;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.exceptions.PersistenceException;
import org.mybatis.spring.MyBatisSystemException;
@@ -120,6 +121,10 @@ public class GlobalExceptionUtil {
log.error(">>> 数据操作异常:", e);
commonResult = CommonResult.error("数据操作异常");
}
+ } else if (e instanceof NcHttpException) {
+ // 通用业务异常,直接返回给前端
+ NcHttpException ncHttpException = (NcHttpException) e;
+ commonResult = CommonResult.get(ncHttpException.getMetaCode(), ncHttpException.getMessage(), null);
} else if (e instanceof CommonException) {
// 通用业务异常,直接返回给前端
diff --git a/src/main/java/mjkf/xinke/main/common/generator/DataDbMpGenerator.java b/src/main/java/mjkf/xinke/main/common/generator/DataDbMpGenerator.java
index f02442e..b9b127a 100644
--- a/src/main/java/mjkf/xinke/main/common/generator/DataDbMpGenerator.java
+++ b/src/main/java/mjkf/xinke/main/common/generator/DataDbMpGenerator.java
@@ -28,6 +28,10 @@ public class DataDbMpGenerator {
"STEEL_PLATE",
"STEEL_REBAR",
"STEEL_STRAND",
+ "MATERIAL",
+ "MATERIAL_TASK",
+ "PRICE_PUBLISH",
+ "PRICE_RESULT",
};
@@ -92,6 +96,7 @@ public class DataDbMpGenerator {
.controllerBuilder()
.enableRestStyle()
+ .enableHyphenStyle()
;
}
diff --git a/src/main/java/mjkf/xinke/main/common/http/FuHttpResponse.java b/src/main/java/mjkf/xinke/main/common/http/FuHttpResponse.java
new file mode 100644
index 0000000..9c06dca
--- /dev/null
+++ b/src/main/java/mjkf/xinke/main/common/http/FuHttpResponse.java
@@ -0,0 +1,36 @@
+package mjkf.xinke.main.common.http;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jgy.xxs.core.http.NcMeta;
+import com.jgy.xxs.core.http.NcPagination;
+import com.jgy.xxs.core.http.resp.HttpResponse;
+import com.jgy.xxs.core.http.resp.NcHttpResponse;
+import lombok.Getter;
+
+
+@Getter
+public class FuHttpResponse extends NcHttpResponse {
+ @JsonIgnore
+ private NcMeta meta;
+ @JsonIgnore
+ private NcPagination pagination;
+
+ private String msg;
+ private int code;
+ private T data;
+
+ public static HttpResponse Builder() {
+ return new FuHttpResponse();
+ }
+
+ @Override
+ public HttpResponse build() {
+ this.msg = this._message;
+ this.code = this._code;
+ this.data = this._data;
+ return this;
+ }
+}
+
+
+
diff --git a/src/main/java/mjkf/xinke/main/constant/HttpErrorResponseEnum.java b/src/main/java/mjkf/xinke/main/constant/HttpErrorResponseEnum.java
new file mode 100644
index 0000000..74d030e
--- /dev/null
+++ b/src/main/java/mjkf/xinke/main/constant/HttpErrorResponseEnum.java
@@ -0,0 +1,51 @@
+package mjkf.xinke.main.constant;
+
+import com.jgy.xxs.core.http.exp.NcHttpErrorResponseInterface;
+import org.apache.http.HttpStatus;
+
+/**
+ * HttpErrorResponseEnum
+ *
+ * @author han0
+ * @date 2019-08-19
+ */
+public enum HttpErrorResponseEnum implements NcHttpErrorResponseInterface {
+ // 通用异常
+ SYSTEM_ERROR("系统异常", 500, HttpStatus.SC_INTERNAL_SERVER_ERROR),
+ BAD_REQUEST("请求数据错误!", 400, HttpStatus.SC_BAD_REQUEST),
+ FORBIDDEN("没权限访问,请退出重新登录!", 403, HttpStatus.SC_FORBIDDEN),
+ NOT_FOUND("找不到指定资源", 404, HttpStatus.SC_NOT_FOUND),
+ //
+ MATERIAL_NOT_FOUND("找不到指定材料", 404, HttpStatus.SC_NOT_FOUND),
+ MATERIAL_CANNOT_DELETE_BUILTIN("内建材料不允许删除", 400, HttpStatus.SC_NOT_FOUND),
+ MATERIAL_ID_REPEAT("材料 id 重复", 400, HttpStatus.SC_NOT_FOUND),
+ MATERIAL_ID_INVALID("材料 id 无效", 400, HttpStatus.SC_NOT_FOUND),
+ MATERIAL_PARENT_ID_INVALID("材料 parent_id 无效", 400, HttpStatus.SC_NOT_FOUND),
+ ;
+
+ private String message;
+ private int code;
+ private int httpStatus;
+
+ HttpErrorResponseEnum(String message, int code, int httpStatus) {
+ this.message = message;
+ this.code = code;
+ this.httpStatus = httpStatus;
+ }
+
+ @Override
+ public String getMessage() {
+ return this.message;
+ }
+
+ @Override
+ public int getCode() {
+ return this.code;
+ }
+
+ @Override
+ public int getHttpStatusCode() {
+ return this.httpStatus;
+ }
+
+}
diff --git a/src/main/java/mjkf/xinke/main/controller/MaterialController.java b/src/main/java/mjkf/xinke/main/controller/MaterialController.java
new file mode 100644
index 0000000..3c2d94d
--- /dev/null
+++ b/src/main/java/mjkf/xinke/main/controller/MaterialController.java
@@ -0,0 +1,136 @@
+package mjkf.xinke.main.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jgy.xxs.core.common.util.CommonUtil;
+import com.jgy.xxs.core.http.exp.NcHttpException;
+import com.jgy.xxs.core.http.resp.HttpResponse;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import mjkf.xinke.auth.core.pojo.SaBaseLoginUser;
+import mjkf.xinke.auth.core.util.StpLoginUserUtil;
+import mjkf.xinke.main.common.http.FuHttpResponse;
+import mjkf.xinke.main.constant.HttpErrorResponseEnum;
+import mjkf.xinke.main.model.db.Material;
+import mjkf.xinke.main.model.vo.MaterialCreateRequest;
+import mjkf.xinke.main.model.vo.MaterialEditRequest;
+import mjkf.xinke.main.service.MaterialService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * 材料 前端控制器
+ *
+ *
+ * @author han0
+ * @since 2023-11-09
+ */
+@RestController
+@RequestMapping("/material")
+public class MaterialController {
+ @Resource
+ MaterialService materialService;
+
+ @ApiOperation("获取材料树")
+ @GetMapping("/tree")
+ public HttpResponse getTree () {
+ QueryWrapper query = new QueryWrapper<>();
+ List