mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
数据结构修改
This commit is contained in:
+9
-5
@@ -44,9 +44,13 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CUSTOM_ORDER_EXISTS = new ErrorCode(1_001_117_000, "自定义生产单号存在");
|
||||
ErrorCode SALESMAN_ORDER_NOT_EXISTS = new ErrorCode(1_001_118_000, "业务员不存在");
|
||||
ErrorCode SPLITTER_ORDER_NOT_EXISTS = new ErrorCode(1_001_119_000, "拆单员不存在");
|
||||
ErrorCode ORDER_PROCESS_NOT_EXISTS = new ErrorCode(1_001_119_000, "工序组不存在");
|
||||
ErrorCode ORDER_PROCESS_EXISTS = new ErrorCode(1_001_119_000, "该生产单工序组已经存在");
|
||||
ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_029_000, "工序组不存在");
|
||||
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_029_000, "此生产单中柜体并不存在不存在");
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_029_000, "生产单中未用到此板材");
|
||||
ErrorCode ORDER_PROCESS_NOT_EXISTS = new ErrorCode(1_001_119_001, "工序组不存在");
|
||||
ErrorCode ORDER_PROCESS_EXISTS = new ErrorCode(1_001_119_002, "该生产单工序组已经存在");
|
||||
ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_029_003, "工序组不存在");
|
||||
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_029_004, "此生产单中柜体并不存在不存在");
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_029_005, "生产单中未用到此板材");
|
||||
ErrorCode ORDER_STATUS_ERROR = new ErrorCode(1_002_029_006, "生产单不允许删除");
|
||||
ErrorCode APP_TOKEN_ERROR = new ErrorCode(1_002_029_006, "token获取失败");
|
||||
ErrorCode PLATE_DATA_ERROR = new ErrorCode(1_002_029_006, "板材数据获取错误");
|
||||
ErrorCode PARTS_DATA_ERROR = new ErrorCode(1_002_029_006, "配件数据获取错误");
|
||||
}
|
||||
|
||||
+28
-104
@@ -2,17 +2,12 @@ package com.cf.imes.module.executor.controller.admin.order;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderImportRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
|
||||
import com.cf.imes.module.executor.service.order.ApiOrderService;
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.PlateImportVO;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
@@ -107,14 +102,14 @@ public class OrderController {
|
||||
}
|
||||
|
||||
// 获取当前条件下所有生产单信息
|
||||
@GetMapping("/allOrder")
|
||||
@Operation(summary = "获得所有生产单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<PageResult<OrderRespVO>> getAllOrder(@Valid OrderPageReqVO pageReqVO) {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
}
|
||||
// @GetMapping("/allOrder")
|
||||
// @Operation(summary = "获得所有生产单")
|
||||
// @PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
// public CommonResult<PageResult<OrderRespVO>> getAllOrder(@Valid OrderPageReqVO pageReqVO) {
|
||||
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
// PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
|
||||
// return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
// }
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单分页")
|
||||
@@ -164,64 +159,6 @@ public class OrderController {
|
||||
}
|
||||
}
|
||||
|
||||
// @PostMapping("/import")
|
||||
// @Operation(summary = "导入生产单新增")
|
||||
// @Parameters({
|
||||
// @Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
// @Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
|
||||
// @Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
|
||||
// @Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true)
|
||||
// })
|
||||
// @PreAuthorize("@ss.hasPermission('executor:order:import')")
|
||||
// public CommonResult<Map<Boolean, String>> importExcel(@RequestPart("file") MultipartFile file,
|
||||
// @RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
|
||||
// @RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
|
||||
// @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO) throws IOException {
|
||||
// Map<Boolean, String> map = new HashMap<>();
|
||||
//// 判断是否更新板材
|
||||
// if (!isAddPlate) {//不需要添加板材
|
||||
// if (upload) {
|
||||
// orderService.updateOrder(createReqVO);//更新
|
||||
// map.put(true, "单独更新生产单成功");
|
||||
// } else {
|
||||
// Long id = orderService.createOrder(createReqVO);//新建
|
||||
// map.put(true, "单独新增生产单成功");
|
||||
// }
|
||||
// return success(map);
|
||||
// } else {
|
||||
// Long id = 0L;
|
||||
// if (upload) {
|
||||
// orderService.updateOrder(createReqVO);//更新
|
||||
// id = createReqVO.getId();
|
||||
// map.put(true, "单独更新生产单成功");
|
||||
// } else {
|
||||
// id = orderService.createOrder(createReqVO);//新建
|
||||
// map.put(true, "单独新增生产单成功");
|
||||
// }
|
||||
//// 解析导入文件,生成统一格式
|
||||
// List<?> list = new ArrayList<>();
|
||||
// if (createReqVO.getDataType() == 1) {//CAD
|
||||
//
|
||||
// } else if (createReqVO.getDataType() == 2) {//WebCAD
|
||||
//
|
||||
// } else if (createReqVO.getDataType() == 3) {//Excel
|
||||
//// 文件数据读取
|
||||
// list = fileTypeChangeUtil.fileDataChange(file);
|
||||
// }
|
||||
// if (list == null || list.size() == 0) {
|
||||
// map.put(false, "导入文件有误");
|
||||
// return success(map);
|
||||
// }
|
||||
//// OrderImportRespVO respVO = orderService.importOrderList(list , id , orderImportRespVO);
|
||||
// orderInputProcessor.input((List<Detail>) list, id);
|
||||
//// 是否新增成功需要返回
|
||||
// map.putIfAbsent(true, "文件导入成功");
|
||||
// return success(map);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// 导出错误的excel
|
||||
// @PostMapping("/import-excel")
|
||||
// @Operation(summary = "生产单导入新增")
|
||||
@@ -333,41 +270,13 @@ public class OrderController {
|
||||
return success(BeanUtils.toBean(orderService.getBody(orderId), OrderBodyRespVO.class));
|
||||
}
|
||||
|
||||
// @PostMapping("file-import")
|
||||
// @Operation(summary = "文件上传接口--完善中")
|
||||
// @Parameters({
|
||||
// @Parameter(name = "file", description = "文件", required = false),
|
||||
// @Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
|
||||
// @Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
|
||||
// @Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true),
|
||||
// @Parameter(name = "type", description = "文件类型", required = true)
|
||||
// })
|
||||
// @PreAuthorize("@ss.hasPermission('executor:fileData:import')")
|
||||
// public CommonResult<OrderImportRespVO> apiImport(@RequestPart(value = "file", required = false) MultipartFile file,
|
||||
// @RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
|
||||
// @RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
|
||||
// @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO,
|
||||
// @RequestParam(value = "type", required = false, defaultValue = "cf_cad") String type,
|
||||
// final HttpServletResponse respons) throws IOException {
|
||||
//
|
||||
// OrderImportRespVO orderImportRespVO = OrderImportRespVO.builder().createOrder(new ArrayList<>())
|
||||
// .updateOrder(new ArrayList<>()).failureOrder(new LinkedHashMap<>()).build();
|
||||
//
|
||||
//// 数据格式转换,返回转换完成的数据(传入文件类型,和文件类容),判断需要使用那种解析之后,进行数据的转换
|
||||
// List<?> list = fileTypeChangeUtil.chooseType(file, type);
|
||||
// if (fileTypeChangeUtil.getFlag()) {//文件数据转换成功,进行数据填入
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return success(orderImportRespVO);
|
||||
// }
|
||||
|
||||
|
||||
// 测试接口
|
||||
@GetMapping("getTest")
|
||||
@Operation(summary = "测试接口(忽略)")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
@GetMapping("getApiData")
|
||||
@Operation(summary = "api数据获取")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:getApiData')")
|
||||
public CommonResult<JSONObject> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo) {
|
||||
|
||||
// orderService.importApiData(orderNo);
|
||||
// 获取token
|
||||
JSONObject json = apiOrderService.getApiTokenMessage("CF7526AD51", "5f467b508061eff60bdacc7230357d2f");
|
||||
// 判断获取token是否成功
|
||||
@@ -378,8 +287,21 @@ public class OrderController {
|
||||
jsonObject.put("order_no", orderNo);//生产单号需要传入赋值
|
||||
jsonObject.put("format", "json");
|
||||
|
||||
JSONObject partsObject = new JSONObject();
|
||||
partsObject.put("curr_page", 1);//生产单号需要传入赋值
|
||||
partsObject.put("page_count", "100");
|
||||
partsObject.put("order_no", orderNo);
|
||||
// 数据解析
|
||||
JSONObject data = apiOrderService.getApiOrderMessage(token, jsonObject);
|
||||
JSONObject parts = apiOrderService.getApiOrderPartsMessage(token, partsObject);
|
||||
// if (parts.getString("err_code").equals("0")) {
|
||||
// System.out.println("获取数据成功");
|
||||
// String value = parts.getString("value");
|
||||
// System.out.println("value " + parts.getString("value") );
|
||||
//// System.out.println("list " + toListMap(value));
|
||||
//// 数据格式进行转换
|
||||
// System.out.println("order " + value.substring(1, value.length() - 1));
|
||||
// }
|
||||
if (data.getString("err_code").equals("0")) {
|
||||
System.out.println("获取数据成功");
|
||||
String value = data.getString("value");
|
||||
@@ -387,6 +309,8 @@ public class OrderController {
|
||||
// System.out.println("list " + toListMap(value));
|
||||
// 数据格式进行转换
|
||||
System.out.println("order " + value.substring(1, value.length() - 1));
|
||||
}else {
|
||||
System.out.println("获取数据shibai");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -22,15 +22,19 @@ public class OrderPageReqVO extends PageParam {
|
||||
@Schema(description = "父单号")
|
||||
private Long parentNo;
|
||||
|
||||
@Schema(description = "生产单日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] orderDate;
|
||||
|
||||
@Schema(description = "交付日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] deliveryDate;
|
||||
|
||||
@Schema(description = "生产单类型,1主单 2子单", example = "1")
|
||||
private Boolean type;
|
||||
private Boolean orderType;
|
||||
|
||||
@Schema(description = "生产单排序号")
|
||||
private Integer sort;
|
||||
private Integer orderSort;
|
||||
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", example = "1")
|
||||
private Integer dataType;
|
||||
|
||||
+6
-2
@@ -19,17 +19,21 @@ public class OrderRespVO {
|
||||
@ExcelProperty("父单号")
|
||||
private Long parentNo;
|
||||
|
||||
@Schema(description = "生产单日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("交付日期")
|
||||
private LocalDateTime orderDate;
|
||||
|
||||
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("交付日期")
|
||||
private LocalDateTime deliveryDate;
|
||||
|
||||
@Schema(description = "生产单类型,1主单 2子单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("生产单类型,1主单 2子单")
|
||||
private Boolean type;
|
||||
private Boolean orderType;
|
||||
|
||||
@Schema(description = "生产单排序号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("生产单排序号")
|
||||
private Integer sort;
|
||||
private Integer orderSort;
|
||||
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("CAD数据类型,1CAD 2WebCAD 3Excel")
|
||||
|
||||
+6
-2
@@ -19,17 +19,21 @@ public class OrderSaveReqVO {
|
||||
@NotNull(message = "父单号不能为空,无父单时为0")
|
||||
private Long parentNo;
|
||||
|
||||
@Schema(description = "生产单日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "交付日期不能为空")
|
||||
private LocalDateTime orderDate;
|
||||
|
||||
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "交付日期不能为空")
|
||||
private LocalDateTime deliveryDate;
|
||||
|
||||
@Schema(description = "生产单类型,1主单 2子单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "生产单类型,1主单 2子单不能为空")
|
||||
private Boolean type;
|
||||
private Boolean orderType;
|
||||
|
||||
@Schema(description = "生产单排序号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "生产单排序号不能为空")
|
||||
private Integer sort;
|
||||
private Integer orderSort;
|
||||
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "CAD数据类型,1CAD 2WebCAD 3Excel不能为空")
|
||||
|
||||
+6
-2
@@ -33,6 +33,10 @@ public class OrderDO extends OrganBaseDO {
|
||||
* 父单号
|
||||
*/
|
||||
private Long parentNo;
|
||||
/**
|
||||
* 生产单日期
|
||||
*/
|
||||
private LocalDateTime orderDate;
|
||||
/**
|
||||
* 交付日期
|
||||
*/
|
||||
@@ -40,11 +44,11 @@ public class OrderDO extends OrganBaseDO {
|
||||
/**
|
||||
* 生产单类型,1主单 2子单
|
||||
*/
|
||||
private Boolean type;
|
||||
private Boolean orderType;
|
||||
/**
|
||||
* 生产单排序号
|
||||
*/
|
||||
private Integer sort;
|
||||
private Integer orderSort;
|
||||
/**
|
||||
* CAD数据类型,1CAD 2WebCAD 3Excel
|
||||
*/
|
||||
|
||||
+5
-4
@@ -29,8 +29,9 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getParentNo, reqVO.getParentNo())
|
||||
.betweenIfPresent(OrderDO::getDeliveryDate, reqVO.getDeliveryDate())
|
||||
.eqIfPresent(OrderDO::getType, reqVO.getType())
|
||||
.eqIfPresent(OrderDO::getSort, reqVO.getSort())
|
||||
.betweenIfPresent(OrderDO::getOrderDate, reqVO.getOrderDate())
|
||||
.eqIfPresent(OrderDO::getOrderType, reqVO.getOrderType())
|
||||
.eqIfPresent(OrderDO::getOrderSort, reqVO.getOrderSort())
|
||||
.eqIfPresent(OrderDO::getDataType, reqVO.getDataType())
|
||||
.eqIfPresent(OrderDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(OrderDO::getCustomOrderNo, reqVO.getCustomOrderNo())
|
||||
@@ -53,8 +54,8 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
default List<OrderDO> selectOrderCheck(OrderPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<OrderDO> wrapper = new MPJLambdaWrapper<OrderDO>()
|
||||
.eqIfExists(OrderDO::getParentNo, reqVO.getParentNo())
|
||||
.eqIfExists(OrderDO::getType, reqVO.getType())
|
||||
.eqIfExists(OrderDO::getSort, reqVO.getSort())
|
||||
.eqIfExists(OrderDO::getOrderType, reqVO.getOrderType())
|
||||
.eqIfExists(OrderDO::getOrderSort, reqVO.getOrderSort())
|
||||
.eqIfExists(OrderDO::getDataType, reqVO.getDataType())
|
||||
.eqIfExists(OrderDO::getStatus, reqVO.getStatus())
|
||||
.eqIfExists(OrderDO::getCustomOrderNo, reqVO.getCustomOrderNo())
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.executor.framework.rpc.config;
|
||||
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||
import com.cf.imes.module.system.api.process.ProcessGroupApi;
|
||||
@@ -14,6 +15,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class,
|
||||
FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class})
|
||||
FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class, ApplicationApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
+3
@@ -14,4 +14,7 @@ public interface ApiOrderService {
|
||||
|
||||
@RequestMapping(value = "/Api-erpOrders-orderPlanData",method = RequestMethod.POST)
|
||||
JSONObject getApiOrderMessage(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
|
||||
@RequestMapping(value = "/Api-erpOrders-partsList",method = RequestMethod.POST)
|
||||
JSONObject getApiOrderPartsMessage(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
}
|
||||
|
||||
+7
@@ -113,4 +113,11 @@ public interface OrderService {
|
||||
*/
|
||||
List<OrderBodyDO> getBody(Long orderId);
|
||||
|
||||
/**
|
||||
* @param orderNo:生产单号
|
||||
* @return Boolean
|
||||
* @author Administrator
|
||||
* @date 2024/3/30
|
||||
*/
|
||||
Boolean importApiData(String orderNo);
|
||||
}
|
||||
+85
-2
@@ -1,5 +1,7 @@
|
||||
package com.cf.imes.module.executor.service.order;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.smallbun.screw.core.util.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
@@ -23,6 +25,10 @@ import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.deviseData.dataTwo.PlateDetail;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeChangeRealize;
|
||||
import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||
import com.cf.imes.module.system.api.user.AdminUserApi;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -96,10 +102,18 @@ public class OrderServiceImpl implements OrderService {
|
||||
private OrderModuleExtraMapper orderModuleExtraMapper;
|
||||
|
||||
@Resource
|
||||
private FileTypeChangeUtil fileTypeChangeUtil;
|
||||
private ApiTypeChangeRealize apiTypeChangeRealize;
|
||||
|
||||
@Resource
|
||||
private ApplicationApi applicationApi;
|
||||
|
||||
@Resource
|
||||
private ApiOrderService apiOrderService;
|
||||
|
||||
private static final int DEFAULT_DAYS_TO_ADD = 30;
|
||||
|
||||
private static final int PARTS_PAGE_MAX = 1000;
|
||||
|
||||
@Override
|
||||
public Long createOrder(OrderSaveReqVO createReqVO) {
|
||||
//校验手机号是否合法
|
||||
@@ -344,6 +358,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public void deleteBodyByOrder(Long orderId, Collection<Long> bodyIds) {
|
||||
validateOrderExists(orderId);
|
||||
// 校验生产单的状态 1 为新单状态,才可以修改
|
||||
if (orderMapper.selectOne(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getId, orderId).eq(OrderDO::getStatus, 1)).getStatus() == 1) {
|
||||
throw exception(ORDER_STATUS_ERROR);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(bodyIds)) {
|
||||
bodyIds.forEach(bodyId -> {
|
||||
// 校验存在
|
||||
@@ -359,13 +377,78 @@ public class OrderServiceImpl implements OrderService {
|
||||
return orderBodyMapper.selectList(new LambdaQueryWrapper<OrderBodyDO>().eq(OrderBodyDO::getOrderId, orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean importApiData(String orderNo) {
|
||||
// 获取token
|
||||
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
JSONObject app = applicationApi.getApplicationByOrganId(organId);
|
||||
String appId = app.getString("appId");
|
||||
String appSecret = app.getString("appSecret");
|
||||
|
||||
JSONObject json = apiOrderService.getApiTokenMessage(appId, appSecret);
|
||||
System.out.println("json " + json);
|
||||
if (!json.getString("err_msg").equals("success")) {
|
||||
throw exception(APP_TOKEN_ERROR);
|
||||
}
|
||||
String token = json.getJSONObject("info").getString("access_token");
|
||||
// 获取生产信息
|
||||
JSONObject jsonPlates = new JSONObject();
|
||||
jsonPlates.put("order_no", orderNo);//生产单号需要传入赋值
|
||||
jsonPlates.put("format", "json");
|
||||
JSONObject dataPlates = apiOrderService.getApiOrderMessage(token, jsonPlates);
|
||||
System.out.println(dataPlates);
|
||||
if (!dataPlates.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_DATA_ERROR);
|
||||
}
|
||||
// 获取配件信息
|
||||
JSONObject jsonParts = new JSONObject();
|
||||
jsonParts.put("curr_page", 1);
|
||||
jsonParts.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonParts.put("order_no", orderNo);
|
||||
JSONObject parts = apiOrderService.getApiOrderPartsMessage(token, jsonParts);
|
||||
if (!dataPlates.getString("err_code").equals("0")) {
|
||||
throw exception(PARTS_DATA_ERROR);
|
||||
}
|
||||
JSONObject dataParts = new JSONObject();
|
||||
for (int i = 1; i <= parts.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonParts.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiOrderPartsMessage(token, jsonParts).getJSONObject("value");
|
||||
mergeJSONObjects(dataParts, value);
|
||||
}
|
||||
// 转换
|
||||
List<PlateDetail> plateDetails = (List<PlateDetail>) apiTypeChangeRealize.apiPlateDataChange(dataPlates,dataParts);
|
||||
System.out.println(plateDetails);
|
||||
return null;
|
||||
}
|
||||
|
||||
// 合并两个 JSON 对象的方法
|
||||
public JSONObject mergeJSONObjects(JSONObject object1, JSONObject object2) {
|
||||
JSONObject mergedObject = new JSONObject();
|
||||
|
||||
// 获取第一个 JSON 对象中 "name" 的值
|
||||
Object value1 = object1.get("List");
|
||||
|
||||
// 获取第二个 JSON 对象中 "name" 的值
|
||||
Object value2 = object2.get("List");
|
||||
|
||||
// 创建一个 JSON 数组,将两个值添加进去
|
||||
JSONArray array = new JSONArray();
|
||||
array.add(value1);
|
||||
array.add(value2);
|
||||
|
||||
// 将数组作为值设置到合并后的 JSON 对象中
|
||||
mergedObject.put("List", array);
|
||||
|
||||
return mergedObject;
|
||||
}
|
||||
|
||||
private void validateOrderBodyExists(Long orderId, Long bodyId) {
|
||||
if (orderBodyMapper.selectCount(new LambdaQueryWrapper<OrderBodyDO>().eq(OrderBodyDO::getOrderId, orderId).eq(OrderBodyDO::getId, bodyId)) == 0) {
|
||||
throw exception(ORDER_BODY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 对数据进行分类
|
||||
// 对数据进行分类
|
||||
private HashMap<String, List<Detail>> classifyGoods(List<Detail> list) {
|
||||
HashMap<String, List<Detail>> map = new HashMap<>();
|
||||
List<Detail> plateLists = new ArrayList<>();
|
||||
|
||||
+7
-10
@@ -1,8 +1,5 @@
|
||||
package com.cf.imes.module.executor.util;
|
||||
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -11,19 +8,19 @@ import java.util.List;
|
||||
/**
|
||||
* 生产单新增传入文件格式转换工具
|
||||
*/
|
||||
public interface FileTypeChangeUtil {
|
||||
// 文件数据格式转换
|
||||
public interface FileTypeChangeUtil {
|
||||
// 文件数据格式转换
|
||||
<T> List<?> fileDataChange(MultipartFile file) throws IOException;
|
||||
|
||||
// Api数据格式转换
|
||||
// Api数据格式转换
|
||||
|
||||
// ds数据转换
|
||||
// ds数据转换
|
||||
|
||||
// 数据转换成功判断
|
||||
// 数据转换成功判断
|
||||
boolean getFlag();
|
||||
|
||||
// 根据文件类型判断使用那种方式进行数据转换
|
||||
default <T> List<?> chooseType(MultipartFile file,String type) throws IOException {
|
||||
// 根据文件类型判断使用那种方式进行数据转换
|
||||
default <T> List<?> chooseType(MultipartFile file, String type) throws IOException {
|
||||
if (type.equals("cf_cad"))
|
||||
return fileDataChange(file);
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -16,9 +16,9 @@ public class DrillsInfo {
|
||||
|
||||
private String name; // 排钻名称
|
||||
|
||||
private String type; // 排钻类型
|
||||
private String type; // 排钻类型名称
|
||||
|
||||
private String face; // 排钻朝向
|
||||
private String face; // 排钻朝向名称
|
||||
|
||||
private Double count; // 排钻数量
|
||||
}
|
||||
|
||||
+5
-3
@@ -14,10 +14,12 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class HoleDetail {
|
||||
|
||||
private String faceType; // 打孔面(0正面, 1反面, 2侧面)
|
||||
private String holeType;// 孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)
|
||||
private String holeName;// 孔名称,用于类型相同的孔,进行分组区分,一组的孔名称相同
|
||||
|
||||
private Integer faceType; // 打孔面(0正面, 1反面, 2侧面)
|
||||
private Integer holeType;// 孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)
|
||||
|
||||
|
||||
// 孔的起点坐标
|
||||
private Double startX;
|
||||
private Double startY;
|
||||
@@ -31,6 +33,6 @@ public class HoleDetail {
|
||||
private Double endY;
|
||||
private Double endZ;
|
||||
|
||||
private Double angle; //角度
|
||||
private Double depth; // 深度
|
||||
|
||||
}
|
||||
|
||||
+4
-3
@@ -17,12 +17,13 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
public class ModelDetail {
|
||||
|
||||
private Double depth; //造型深度
|
||||
|
||||
private Integer faceType; //使用字典进行解析 造型排版面 0正面, 1反面, 2侧面
|
||||
|
||||
private Double depth; //造型深度
|
||||
|
||||
|
||||
private String knifeName; //造像使用刀具名称
|
||||
private float knifeRadius; //刀半径
|
||||
private Double knifeRadius; //刀半径
|
||||
|
||||
|
||||
private IOriginModelingData originModeling;//造型数据
|
||||
|
||||
+4
-4
@@ -19,13 +19,13 @@ import lombok.experimental.Accessors;
|
||||
public class OffSetList {
|
||||
|
||||
// 刀路的偏移值
|
||||
private float value; // 刀路的偏倚值
|
||||
private float deep;//下刀的深度
|
||||
private float angle;//角度
|
||||
private Double value; // 刀路的偏倚值
|
||||
private Double depth;//下刀的深度
|
||||
private Double angle;//角度
|
||||
|
||||
// 二维刀路的属性
|
||||
private String name; //刀的名称
|
||||
private float radius;//刀的半径
|
||||
private Double radius;//刀的半径
|
||||
|
||||
private String faceType;// 面向类型(0正面, 1反面, 2侧面)
|
||||
}
|
||||
|
||||
+20
-11
@@ -14,19 +14,22 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class PartsInfo {
|
||||
|
||||
// 配件所属信息
|
||||
private String roomsName; //房间名称
|
||||
private String bodyName; //柜体名
|
||||
private String id; // 配件标识
|
||||
private String name; // 配件名称
|
||||
|
||||
// 柜体成倍拆单的倍数
|
||||
|
||||
// 配件所属信息
|
||||
private String roomName; //房间名称
|
||||
private String bodyName; //柜体名
|
||||
private String bodyNo; // 柜体编号
|
||||
|
||||
|
||||
// 柜体成倍拆单的倍数
|
||||
private Integer multiNum;
|
||||
|
||||
// 商品信息
|
||||
private String goodsName; //商品名称
|
||||
private String goodsNo; // 商品编码
|
||||
private Long goodId; // 商品id
|
||||
|
||||
|
||||
private Long goodId; // 商品对应标识
|
||||
private String material; //材质
|
||||
private String color; //颜色
|
||||
private String factory; //商品生产厂商
|
||||
@@ -34,10 +37,16 @@ public class PartsInfo {
|
||||
private String model; //商品型号
|
||||
private String spec; //商品规格
|
||||
private String unit; //商品单位
|
||||
private Double price; // 配件价格
|
||||
|
||||
private Boolean isComposite; // 是否为配件
|
||||
private String groupName; // 组件名称
|
||||
private String objectType; // 五金类型
|
||||
private String objectSpecExtras; // 五金额外规格
|
||||
private String partsSpec; // 配件属性
|
||||
private String doorRemark; // 门板组件铰链备注
|
||||
private String hingeRemark; // 门板组件拉手备注
|
||||
|
||||
private Boolean isComposite; // 是否为复合配件
|
||||
private String groupName; //
|
||||
private String objectType;
|
||||
|
||||
private Double goodsNumber; //产品数量为特殊处理,板件和配件都有数量
|
||||
|
||||
|
||||
+12
-4
@@ -23,9 +23,16 @@ public class PlateDetail {
|
||||
// 自定义板号
|
||||
private String customPlateNo;
|
||||
|
||||
private Integer texture; //纹路 纹路(0正纹1可翻转2反纹)
|
||||
private Integer typographicFace; //排版面 排钻类型(0正面1反面2随意面)
|
||||
private Integer openDoorType; //开门类型 0非门板,1左开,2右开,3上翻,4下翻 字典转换
|
||||
private String boardType; // 小板类型
|
||||
|
||||
|
||||
// 板件所属信息
|
||||
private String roomsName; //房间名称
|
||||
private String bodyName; //柜体名
|
||||
private String bodyNo; // 柜体号
|
||||
|
||||
// 柜体成倍拆单的倍数
|
||||
private Integer multiNum;
|
||||
@@ -54,9 +61,6 @@ public class PlateDetail {
|
||||
private Double sealUp;
|
||||
private Double sealDown;
|
||||
|
||||
private Integer texture; //纹路 纹路(0正纹1可翻转2反纹)
|
||||
private Integer typographicFace; //排版面 排钻类型(0正面1反面2随意面)
|
||||
private Integer openDoorType; //开门类型 0非门板,1左开,2右开,3上翻,4下翻 字典转换
|
||||
|
||||
// 偏移量
|
||||
private Double offsetX;
|
||||
@@ -69,6 +73,11 @@ public class PlateDetail {
|
||||
// 排钻类型
|
||||
private List<DrillsInfo> drillsInfos;
|
||||
|
||||
private Double throughHoleCount; // 挖孔的孔数
|
||||
private Double throughModelCount; // 挖穿的造型数
|
||||
|
||||
private Boolean has2DModel; // 是否有二维刀路
|
||||
private Boolean has3DModel; // 是否有三维刀路
|
||||
|
||||
// 轮廓数据、造型数据
|
||||
private List<PointDetail> pointDetail ; //点明细,表示小板外围轮廓的几个转折点(不含封边)
|
||||
@@ -78,7 +87,6 @@ public class PlateDetail {
|
||||
private List<ModelDetail> contourDetail ; //造型明细
|
||||
|
||||
private List<HoleDetail> sideHoleDetail;//侧面孔明细
|
||||
private List<ModelDetail> sideModelDetail ; //侧面造型明细
|
||||
|
||||
// 备注
|
||||
private Map<String,String> remark;// 板件备注
|
||||
|
||||
+3
-2
@@ -22,9 +22,10 @@ public class PointList {
|
||||
// 点的位置信息
|
||||
private Double pointX;
|
||||
private Double pointY;
|
||||
private Double pointZ;
|
||||
private Double radius;
|
||||
|
||||
private float curve; // 曲线
|
||||
private float depth; //曲线深度
|
||||
private Double curve; // 曲线
|
||||
private Double depth; //曲线深度
|
||||
|
||||
}
|
||||
|
||||
+342
-60
File diff suppressed because one or more lines are too long
-17
@@ -1,17 +0,0 @@
|
||||
package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
@Data// lombok注解,给字段添加getter和setter
|
||||
@XmlAccessorType(XmlAccessType.FIELD)// 映射所有的字段
|
||||
@XmlRootElement(name = "Point ")// XML根节点名称,此处为nation
|
||||
public class Point {
|
||||
|
||||
@XmlAttribute// 解析节点的属性
|
||||
private String type;
|
||||
|
||||
@XmlValue// 解析nation节点的内容,字段名称无所谓
|
||||
private String nationValue;
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.order.OrderMapper">
|
||||
|
||||
<select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
select a.id as orderId, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
|
||||
select a.id as orderId, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
|
||||
count(c.id) as num, sum(c.area) as area, p.goods_name, p.color, p.material, p.goods_id
|
||||
from `order` a
|
||||
left join order_plate c ON a.id = c.order_id and c.is_cancel = 0
|
||||
|
||||
+5
-5
@@ -107,9 +107,9 @@ public class PlateController {
|
||||
// 手动创建导出 demo
|
||||
List<PlateImportExcelVO> list = Arrays.asList(
|
||||
PlateImportExcelVO.builder().goodsId("SP1123456").goodsName("xixih").material("颗粒板").width(String.valueOf(1212.3)).height(String.valueOf(12131.6))
|
||||
.thickness(String.valueOf(0.2)).brand("鹅厂").spec("大厂").remark("测试").price(String.valueOf(33333.2)).color("黑色").build(),
|
||||
.thickness(String.valueOf(0.2)).brand("鹅厂").spec("大厂").remark("测试").price(String.valueOf(33333.2)).color("黑色").texture("交换机1").build(),
|
||||
PlateImportExcelVO.builder().goodsId("SP1123457").goodsName("2L").material("yuanma@cf.com").width(String.valueOf(21.6)).height(String.valueOf(12231.6))
|
||||
.thickness(String.valueOf(5.3)).brand("kkkkkk").spec("大厂").remark("测试").price(String.valueOf(333.555)).color("黑色").build()
|
||||
.thickness(String.valueOf(5.3)).brand("kkkkkk").spec("大厂").remark("测试").price(String.valueOf(333.555)).color("黑色").texture("交换机2").build()
|
||||
);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "板材导入模板.xlsx", "板材列表", PlateImportExcelVO.class, list);
|
||||
@@ -129,12 +129,12 @@ public class PlateController {
|
||||
HttpServletResponse response) throws Exception {
|
||||
PlateExcelUtil plateExcelUtil = new PlateExcelUtil();
|
||||
List<PlateImportExcelVO> list = plateExcelUtil.read(file, PlateImportExcelVO.class);
|
||||
|
||||
// 判断文件是否导入成功
|
||||
if (!plateExcelUtil.getFlag())
|
||||
ExcelUtils.write(response, "板材导入模板.xlsx", "板材列表", PlateImportExcelVO.class, list);
|
||||
else
|
||||
plateService.importPlateList(list, updateSupport, organId);// 成功,批量导入
|
||||
else {
|
||||
PlateImportRespVO respVO = plateService.importPlateList(list, updateSupport, organId);// 成功,批量导入
|
||||
}
|
||||
|
||||
plateExcelUtil.clear();
|
||||
}
|
||||
|
||||
+4
@@ -36,6 +36,10 @@ public class PlateImportExcelVO {
|
||||
@NotEmpty(message = "颜色不能为空")
|
||||
private String color;
|
||||
|
||||
@ExcelProperty("纹路")
|
||||
@NotEmpty(message = "纹路不能为空")
|
||||
private String texture;
|
||||
|
||||
@ExcelProperty("宽度")
|
||||
@NotEmpty(message = "宽度不能为空")
|
||||
private String width;
|
||||
|
||||
+6
@@ -1,10 +1,13 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -27,6 +30,9 @@ public class PlatePageReqVO extends PageParam {
|
||||
@Schema(description = "颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹路")
|
||||
private String texture;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
private Double width;
|
||||
|
||||
|
||||
+4
@@ -31,6 +31,10 @@ public class PlateRespVO {
|
||||
@ExcelProperty("颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹路", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("纹路")
|
||||
private String texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("宽度")
|
||||
private Double width;
|
||||
|
||||
+5
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
@@ -28,6 +29,10 @@ public class PlateSaveReqVO {
|
||||
@NotEmpty(message = "颜色不能为空")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹路", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "纹路不能为空")
|
||||
private String texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
private Double width;
|
||||
|
||||
+4
@@ -41,6 +41,10 @@ public class PlateDO extends BaseDO {
|
||||
* 颜色
|
||||
*/
|
||||
private String color;
|
||||
/**
|
||||
* 纹路
|
||||
*/
|
||||
private String texture;
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
|
||||
+5
-9
@@ -46,7 +46,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Override
|
||||
public Long createPlate(PlateSaveReqVO createReqVO) {
|
||||
PlateDO plate = BeanUtils.toBean(createReqVO, PlateDO.class);
|
||||
if (createReqVO.getOrganId() != null && createReqVO.getOrganId() != 0 ){
|
||||
if (createReqVO.getOrganId() == null && createReqVO.getOrganId() == 0 ){
|
||||
validateOrganExists(createReqVO.getOrganId());
|
||||
validateGoodExists(createReqVO.getGoodsId(), createReqVO.getOrganId());
|
||||
plate.setOrganId(OrganContextHolder.getOrganId());
|
||||
@@ -118,20 +118,16 @@ public class PlateServiceImpl implements PlateService {
|
||||
// 判断如果不存在,在进行插入
|
||||
PlateDO existPlate = plateMapper.selectByGoodID(importPlate.getGoodsId(), organId);
|
||||
if (existPlate == null) {
|
||||
respVO.getCreatePlateNames().add(importPlate.getGoodsName());
|
||||
insertList.add(BeanUtils.toBean(importPlate, PlateDO.class).setOrganId(organId));
|
||||
// plateMapper.insert(BeanUtils.toBean(importPlate, PlateDO.class).setOrganId(organId));
|
||||
// respVO.getCreatePlateNames().add(importPlate.getGoodsName());
|
||||
return;
|
||||
}
|
||||
// 如果存在,判断是否允许更新
|
||||
// 判断是否允许更新
|
||||
if (!isUpdateSupport) {
|
||||
respVO.getFailurePlateNames().put(importPlate.getGoodsName(), ErrorCodeConstants.PLATE_EXISTS.getMsg());
|
||||
return;
|
||||
PlateDO plateDO = BeanUtils.toBean(importPlate, PlateDO.class).setOrganId(organId).setId(existPlate.getId());
|
||||
updateList.add(plateDO);
|
||||
}
|
||||
PlateDO plateDO = BeanUtils.toBean(importPlate, PlateDO.class).setOrganId(organId).setId(existPlate.getId());
|
||||
updateList.add(plateDO);
|
||||
// plateMapper.updateById(plateDO);
|
||||
// respVO.getUpdatePlateNames().add(importPlate.getGoodsName());
|
||||
});
|
||||
// 批量插入,批量更新
|
||||
if (insertList.size() > 0 && insertList != null) {
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.cf.imes.module.system.api.application;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 应用管理")
|
||||
public interface ApplicationApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/application";
|
||||
|
||||
@GetMapping(PREFIX + "/login")
|
||||
@Operation(summary = "应用登陆")
|
||||
@Parameter(name = "organId", description = "组织信息", required = true)
|
||||
JSONObject getApplicationByOrganId(@RequestParam("organId") Long organId);
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.cf.imes.module.system.api.application;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO;
|
||||
import com.cf.imes.module.system.service.application.ApplicationService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class ApplicationApiImpl implements ApplicationApi{
|
||||
|
||||
@Resource
|
||||
private ApplicationService applicationService;
|
||||
|
||||
@Override
|
||||
public JSONObject getApplicationByOrganId(Long organId) {
|
||||
// 获取数值
|
||||
ApplicationDO applicationDO = applicationService.getApplicationByOrganId(organId);
|
||||
if (applicationDO == null){
|
||||
throw exception(APPLICATION_NOT_EXISTS);
|
||||
}
|
||||
// 数据转json
|
||||
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(applicationDO);
|
||||
System.out.println(" jsonObject " + jsonObject);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -16,9 +16,9 @@ public class ApplicationSaveReqVO{
|
||||
@NotNull(message = "应用标识不能为空")
|
||||
private String appId;
|
||||
|
||||
// @Schema(description = "应用密钥", example = "121gfrsg5sb4gs")
|
||||
// @NotNull(message = "应用密钥不能为空")
|
||||
// private String appKey;
|
||||
@Schema(description = "应用密钥", example = "121gfrsg5sb4gs")
|
||||
@NotNull(message = "应用密钥不能为空")
|
||||
private String appKey;
|
||||
|
||||
// private String appSecret;
|
||||
|
||||
|
||||
+4
-1
@@ -62,5 +62,8 @@ public class ApplicationDO extends BaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long organId;
|
||||
}
|
||||
|
||||
+4
-1
@@ -22,7 +22,6 @@ public interface ApplicationMapper extends BaseMapperX<ApplicationDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ApplicationDO>()
|
||||
.likeIfPresent(ApplicationDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ApplicationDO::getAppId, reqVO.getAppId())
|
||||
.eqIfPresent(ApplicationDO::getAppKey, reqVO.getAppKey())
|
||||
.eqIfPresent(ApplicationDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(ApplicationDO::getServerIp, reqVO.getServerIp())
|
||||
.eqIfPresent(ApplicationDO::getCompany, reqVO.getCompany())
|
||||
@@ -35,4 +34,8 @@ public interface ApplicationMapper extends BaseMapperX<ApplicationDO> {
|
||||
default ApplicationDO selectByAppId(String appId) {
|
||||
return selectOne(ApplicationDO::getAppId, appId);
|
||||
}
|
||||
|
||||
default ApplicationDO selectByOrganId(Long organId) {
|
||||
return selectOne(ApplicationDO::getOrganId, organId);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -50,12 +50,6 @@ public interface ApplicationService {
|
||||
*/
|
||||
PageResult<ApplicationDO> getApplicationPage(ApplicationPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得所有应用信息表 application
|
||||
*
|
||||
* @return 工序信息表 application
|
||||
*/
|
||||
List<ApplicationDO> getAllApplication();
|
||||
|
||||
/**
|
||||
* 应用登陆
|
||||
@@ -63,4 +57,11 @@ public interface ApplicationService {
|
||||
* @return 登录结果
|
||||
*/
|
||||
ApplicationLoginRespVO loginApplication(@Valid ApplicationRespVO reqVO);
|
||||
|
||||
/**
|
||||
* 应用信息
|
||||
* @param organId: 组织信息
|
||||
* @return 登录结果
|
||||
*/
|
||||
ApplicationDO getApplicationByOrganId(Long organId);
|
||||
}
|
||||
|
||||
+5
-5
@@ -98,11 +98,6 @@ public class ApplicationServiceImpl implements ApplicationService{
|
||||
return applicationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationDO> getAllApplication() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationLoginRespVO loginApplication(ApplicationRespVO reqVO) {
|
||||
ApplicationDO app = applicationMapper.selectByAppId(reqVO.getAppId());
|
||||
@@ -118,6 +113,11 @@ public class ApplicationServiceImpl implements ApplicationService{
|
||||
return BeanUtils.toBean(createTokenAfterLoginSuccess(app.getId(), app.getAppId(), LoginLogTypeEnum.LOGIN_USERNAME), ApplicationLoginRespVO.class).setAppId(app.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationDO getApplicationByOrganId(Long organId) {
|
||||
return applicationMapper.selectByOrganId(organId);
|
||||
}
|
||||
|
||||
private AuthLoginRespVO createTokenAfterLoginSuccess(Integer userId, String username, LoginLogTypeEnum logType) {
|
||||
// Long organId = OrganContextHolder.getOrganId();
|
||||
// OrganizationDO organ = organService.getOrgan(organId);
|
||||
|
||||
Reference in New Issue
Block a user