From f79458bb457b76d84e8166839524f0f79ffb4f53 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Sat, 9 Dec 2023 23:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E6=B3=B0=E6=96=B0=E5=A2=9E=E9=85=8D?= =?UTF-8?q?=E9=80=81=E4=BA=A7=E5=93=81=EF=BC=8C=E7=89=A9=E8=B5=84=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/ThrProductTypeCotroller.java | 47 ++++++++++++++++ .../api/dao/thrsys/ThrProductTypeMapper.java | 16 ++++++ .../entity/thrsys/ThrProductTypeEntity.java | 55 +++++++++++++++++++ .../glxp/api/http/sync/SpGetHttpClient.java | 11 ++++ .../thrsys/FilterThrProductTypeRequest.java | 28 ++++++++++ .../service/thrsys/ThrProductTypeService.java | 32 +++++++++++ .../thrsys/impl/ThrProductsServiceImpl.java | 5 ++ src/main/resources/application-dev.yml | 2 +- .../mapper/thrsys/ThrProductTypeMapper.xml | 33 +++++++++++ src/main/resources/schemas/schema_v2.4.sql | 8 +++ 10 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/glxp/api/controller/thrsys/ThrProductTypeCotroller.java create mode 100644 src/main/java/com/glxp/api/dao/thrsys/ThrProductTypeMapper.java create mode 100644 src/main/java/com/glxp/api/entity/thrsys/ThrProductTypeEntity.java create mode 100644 src/main/java/com/glxp/api/req/thrsys/FilterThrProductTypeRequest.java create mode 100644 src/main/java/com/glxp/api/service/thrsys/ThrProductTypeService.java create mode 100644 src/main/resources/mybatis/mapper/thrsys/ThrProductTypeMapper.xml diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductTypeCotroller.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductTypeCotroller.java new file mode 100644 index 000000000..e377a0e07 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductTypeCotroller.java @@ -0,0 +1,47 @@ +package com.glxp.api.controller.thrsys; + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.enums.ResultEnum; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.thrsys.ThrHslbEntity; +import com.glxp.api.entity.thrsys.ThrProductTypeEntity; +import com.glxp.api.req.thrsys.FilterThrHslbRequest; +import com.glxp.api.req.thrsys.FilterThrProductTypeRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.thrsys.ThrHslbService; +import com.glxp.api.service.thrsys.ThrProductTypeService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +@Slf4j +@RestController +public class ThrProductTypeCotroller { + + @Resource + ThrProductTypeService thrProductTypeService; + + @AuthRuleAnnotation("") + @GetMapping("/udiwms/thrsys/getHslbs") + public BaseResponse getProductTypes(FilterThrProductTypeRequest filterThrProductTypeRequest, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + List thrProductTypeEntityList + = thrProductTypeService.getProductTypes(filterThrProductTypeRequest); + PageInfo pageInfo; + pageInfo = new PageInfo(thrProductTypeEntityList); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(thrProductTypeEntityList); + return ResultVOUtils.success(pageSimpleResponse); + } +} diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrProductTypeMapper.java b/src/main/java/com/glxp/api/dao/thrsys/ThrProductTypeMapper.java new file mode 100644 index 000000000..c3112ab22 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrProductTypeMapper.java @@ -0,0 +1,16 @@ +package com.glxp.api.dao.thrsys; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.glxp.api.entity.thrsys.ThrProductTypeEntity; +import com.glxp.api.req.thrsys.FilterThrHslbRequest; +import com.glxp.api.req.thrsys.FilterThrProductTypeRequest; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface ThrProductTypeMapper extends BaseMapper { + + List getProductTypes(FilterThrProductTypeRequest filterThrProductTypeRequest); + +} diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThrProductTypeEntity.java b/src/main/java/com/glxp/api/entity/thrsys/ThrProductTypeEntity.java new file mode 100644 index 000000000..febde5a88 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/thrsys/ThrProductTypeEntity.java @@ -0,0 +1,55 @@ +package com.glxp.api.entity.thrsys; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@ApiModel(value="com-glxp-api-entity-thrsys-ThrProductType") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "thr_product_type") +public class ThrProductTypeEntity implements Serializable { + @TableId(value = "id", type = IdType.INPUT) + @ApiModelProperty(value="") + private Integer id; + + /** + * 类别编码 + */ + @TableField(value = "code") + @ApiModelProperty(value="类别编码") + private String code; + + /** + * 类别名称 + */ + @TableField(value = "`name`") + @ApiModelProperty(value="类别名称") + private String name; + + /** + * 第三系统标识 + */ + @TableField(value = "thirdSys") + @ApiModelProperty(value="第三系统标识") + private String thirdSys; + + /** + * 备注 + */ + @TableField(value = "remark") + @ApiModelProperty(value="备注") + private String remark; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java b/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java index b2d77ef35..f6d3930fc 100644 --- a/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java +++ b/src/main/java/com/glxp/api/http/sync/SpGetHttpClient.java @@ -10,6 +10,7 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.BasicExportTypeEnum; import com.glxp.api.constant.SyncDelType; import com.glxp.api.entity.basic.ProductInfoEntity; +import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.sync.BasicExportStatusEntity; import com.glxp.api.entity.sync.IOOrderStatusEntity; @@ -620,4 +621,14 @@ public class SpGetHttpClient { } + public BaseResponse postBasicRl(UdiRelevanceEntity udiRelevanceEntity) { + String json = JSONUtil.toJsonStr(udiRelevanceEntity); + String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/spssync/basic/udirl/update", json, buildHeader()); + BaseResponse response = + JSONObject.parseObject(result, new TypeReference>() { + }); + return response; + } + + } diff --git a/src/main/java/com/glxp/api/req/thrsys/FilterThrProductTypeRequest.java b/src/main/java/com/glxp/api/req/thrsys/FilterThrProductTypeRequest.java new file mode 100644 index 000000000..1a33d253d --- /dev/null +++ b/src/main/java/com/glxp/api/req/thrsys/FilterThrProductTypeRequest.java @@ -0,0 +1,28 @@ +package com.glxp.api.req.thrsys; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.glxp.api.util.page.ListPageRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class FilterThrProductTypeRequest extends ListPageRequest { + + + /** + * 类别编码 + */ + private String code; + + /** + * 类别名称 + */ + private String name; + + /** + * 第三系统标识 + */ + private String thirdSys; + + private String key; +} diff --git a/src/main/java/com/glxp/api/service/thrsys/ThrProductTypeService.java b/src/main/java/com/glxp/api/service/thrsys/ThrProductTypeService.java new file mode 100644 index 000000000..54ec5a904 --- /dev/null +++ b/src/main/java/com/glxp/api/service/thrsys/ThrProductTypeService.java @@ -0,0 +1,32 @@ +package com.glxp.api.service.thrsys; + +import com.github.pagehelper.PageHelper; +import com.glxp.api.entity.thrsys.ThrHslbEntity; +import com.glxp.api.req.thrsys.FilterThrHslbRequest; +import com.glxp.api.req.thrsys.FilterThrProductTypeRequest; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.glxp.api.entity.thrsys.ThrProductTypeEntity; +import com.glxp.api.dao.thrsys.ThrProductTypeMapper; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class ThrProductTypeService extends ServiceImpl { + @Resource + ThrProductTypeMapper thrProductTypeMapper; + + public List getProductTypes(FilterThrProductTypeRequest filterThrProductTypeRequest) { + if (filterThrProductTypeRequest == null) { + return Collections.emptyList(); + } + if (filterThrProductTypeRequest.getPage() != null) { + int offset = (filterThrProductTypeRequest.getPage() - 1) * filterThrProductTypeRequest.getLimit(); + PageHelper.offsetPage(offset, filterThrProductTypeRequest.getLimit()); + } + List data = thrProductTypeMapper.getProductTypes(filterThrProductTypeRequest); + return data; + } +} diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java index d456f5011..9479ac69f 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java @@ -1,6 +1,7 @@ package com.glxp.api.service.thrsys.impl; import cn.hutool.core.bean.BeanUtil; +import com.glxp.api.http.sync.SpGetHttpClient; import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.thrsys.PostRelProductRequest; import com.glxp.api.service.basic.UdiRelevanceService; @@ -354,6 +355,9 @@ public class ThrProductsServiceImpl extends ServiceImpl + + + + + + + + + + + + + + id, code, `name`, thirdSys, remark + + + + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 35049876b..6481ee33c 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -103,3 +103,11 @@ UPDATE `auth_menu` SET `menu_name` = '耗材字典维护', `parent_id` = 1644, ` UPDATE `auth_menu` SET `menu_name` = '产品信息导出', `parent_id` = 1616, `order_num` = 2, `path` = 'basic/product/product', `component` = 'basic/product/product', `query_param` = '{\"vueRouteSource\":2}', `is_frame` = 1, `is_cache` = 0, `menu_type` = 'C', `visible` = '0', `status` = '0', `perms` = 'thirdSys:product:export', `icon` = '', `create_by` = '超级用户', `create_time` = '2022-12-28 11:30:58', `update_by` = NULL, `update_time` = NULL, `remark` = NULL WHERE `menu_id` = 1618; +CREATE TABLE IF NOT EXISTS `thr_product_type` ( + `id` int NOT NULL, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类别编码', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类别名称', + `thirdSys` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '第三系统标识', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;