From 686cc6ac023eb7c2ec4eea004442bb3a0ff4fd8e Mon Sep 17 00:00:00 2001 From: mythxb Date: Wed, 26 Mar 2025 13:56:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=81=E5=8E=85=E7=B3=BB=E7=BB=9F=E8=A1=8C?= =?UTF-8?q?=E4=B8=9A=E4=BF=A1=E6=81=AF=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rzyc/config/CodeGenerator.java | 4 +- .../com/rzyc/mapper/ent/PvIndustryMapper.java | 18 ++++++ .../java/com/rzyc/model/ent/PvIndustry.java | 56 +++++++++++++++++++ .../rzyc/provinceUtil/bean/IndustryVo.java | 20 +++++++ .../java/com/rzyc/service/BaseService.java | 4 ++ .../com/rzyc/service/ProvinceService.java | 26 +++++++-- .../resources/mapper/ent/PvIndustryMapper.xml | 21 +++++++ 7 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/ent/PvIndustryMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/ent/PvIndustry.java create mode 100644 inventory-dao/src/main/java/com/rzyc/provinceUtil/bean/IndustryVo.java create mode 100644 inventory-dao/src/main/resources/mapper/ent/PvIndustryMapper.xml diff --git a/inventory-dao/src/main/java/com/rzyc/config/CodeGenerator.java b/inventory-dao/src/main/java/com/rzyc/config/CodeGenerator.java index 44e110b..1a8b21e 100644 --- a/inventory-dao/src/main/java/com/rzyc/config/CodeGenerator.java +++ b/inventory-dao/src/main/java/com/rzyc/config/CodeGenerator.java @@ -35,7 +35,7 @@ public class CodeGenerator { public static String packgerParent = "com.rzyc"; //mysql相关信息 - public static String url = "jdbc:mysql://42.193.40.239:33063/inventory_23?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false"; + public static String url = "jdbc:mysql://42.193.40.239:33063/ganzi25?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false"; public static String DriverName = "com.mysql.cj.jdbc.Driver"; public static String Username = "zyjy"; public static String Password = "eaNCBySJdHLb23GW"; @@ -146,7 +146,7 @@ public class CodeGenerator { strategy.setColumnNaming(NamingStrategy.underline_to_camel); //strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!"); //【实体】是否为lombok模型(默认 false) - strategy.setEntityLombokModel(false); + strategy.setEntityLombokModel(true); //生成 @RestController 控制器 strategy.setRestControllerStyle(true); diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/PvIndustryMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/PvIndustryMapper.java new file mode 100644 index 0000000..b8e9f1c --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/PvIndustryMapper.java @@ -0,0 +1,18 @@ +package com.rzyc.mapper.ent; + +import com.rzyc.model.ent.PvIndustry; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 省厅系统行业 Mapper 接口 + *

+ * + * @author + * @since 2025-03-26 + */ +@Repository +public interface PvIndustryMapper extends BaseMapper { + +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/ent/PvIndustry.java b/inventory-dao/src/main/java/com/rzyc/model/ent/PvIndustry.java new file mode 100644 index 0000000..054c3f6 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/ent/PvIndustry.java @@ -0,0 +1,56 @@ +package com.rzyc.model.ent; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 省厅系统行业 + *

+ * + * @author + * @since 2025-03-26 + */ +@Data +@TableName("pv_industry") +@ApiModel(value="PvIndustry对象", description="省厅系统行业") +public class PvIndustry implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "行业id") + @TableId("industry_id") + private String industryId; + + @ApiModelProperty(value = "行业名") + @TableField("industry_name") + private String industryName; + + @ApiModelProperty(value = "排序") + @TableField("sort_id") + private Integer sortId; + + @ApiModelProperty(value = "创建时间") + @TableField("create_time") + private Date createTime; + + @ApiModelProperty(value = "创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty(value = "修改时间") + @TableField("modify_time") + private Date modifyTime; + + @ApiModelProperty(value = "修改人") + @TableField("modify_by") + private String modifyBy; + + +} diff --git a/inventory-dao/src/main/java/com/rzyc/provinceUtil/bean/IndustryVo.java b/inventory-dao/src/main/java/com/rzyc/provinceUtil/bean/IndustryVo.java new file mode 100644 index 0000000..5c8dde8 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/provinceUtil/bean/IndustryVo.java @@ -0,0 +1,20 @@ +package com.rzyc.provinceUtil.bean; + +import lombok.Data; + +/** + * @author dong + * @date 2025-03-26 10:46 + * @Version V1.0 + */ +@Data +public class IndustryVo { + + + //行业id + private String industryId; + + //行业名 + private String industryName; + +} diff --git a/inventory-dao/src/main/java/com/rzyc/service/BaseService.java b/inventory-dao/src/main/java/com/rzyc/service/BaseService.java index e257f70..0da29b8 100644 --- a/inventory-dao/src/main/java/com/rzyc/service/BaseService.java +++ b/inventory-dao/src/main/java/com/rzyc/service/BaseService.java @@ -589,6 +589,10 @@ public class BaseService { @Autowired protected ExScoreRecordMapper exScoreRecordMapper; + // + @Autowired + protected PvIndustryMapper pvIndustryMapper; + //redis @Resource protected RedisUtil redisUtil; diff --git a/inventory-dao/src/main/java/com/rzyc/service/ProvinceService.java b/inventory-dao/src/main/java/com/rzyc/service/ProvinceService.java index d56e87c..7bd21a0 100644 --- a/inventory-dao/src/main/java/com/rzyc/service/ProvinceService.java +++ b/inventory-dao/src/main/java/com/rzyc/service/ProvinceService.java @@ -7,13 +7,16 @@ import com.common.utils.StringUtils; import com.common.utils.TypeConversion; import com.google.gson.Gson; import com.google.zxing.Result; +import com.rzyc.model.ent.PvIndustry; import com.rzyc.provinceUtil.EnedUtils; import com.rzyc.provinceUtil.JsonUtils; import com.rzyc.provinceUtil.ProvData; import com.rzyc.provinceUtil.bean.DeptInfo; +import com.rzyc.provinceUtil.bean.IndustryVo; import com.rzyc.provinceUtil.bean.TokenData; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -102,8 +105,8 @@ public class ProvinceService extends BaseService{ System.out.println("data --> "+JSONArray.toJSONString(data)); } - //获取部门信息 - private static String GET_INDUSTRY = "/gov/sync/base/dept"; + //获取行业信息 + private static String GET_INDUSTRY = "/gov/sync/base/industry"; /** @@ -119,10 +122,23 @@ public class ProvinceService extends BaseService{ //加密请求参数 String responseStr = EnedUtils.doPost(BASE_URL+GET_INDUSTRY,JSONObject.toJSONString(params),token); -// Type userListType = new TypeToken>() {}.getType(); -// ProvData> data = JsonUtils.fromJsonComplex(responseStr,ProvData.class, userListType); + System.out.println("responseStr ---> "+responseStr); - System.out.println("responseStr --> "+responseStr); + Type dataListType = new TypeToken>() {}.getType(); + ProvData> data = JsonUtils.fromJsonComplex(responseStr,ProvData.class, dataListType); + + Integer index = 1; + for (PvIndustry pvIndustry : data.getData()){ + pvIndustry.setSortId(index); + pvIndustry.setCreateTime(new Date()); + pvIndustry.setModifyTime(new Date()); + pvIndustry.setCreateBy("excel"); + pvIndustry.setModifyBy("excel"); + pvIndustryMapper.insert(pvIndustry); + index++; + } + + System.out.println("data --> "+JSONArray.toJSONString(data)); } //获取隐患类型信息 diff --git a/inventory-dao/src/main/resources/mapper/ent/PvIndustryMapper.xml b/inventory-dao/src/main/resources/mapper/ent/PvIndustryMapper.xml new file mode 100644 index 0000000..3e9a02d --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/ent/PvIndustryMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + industry_id, industry_name, sort_id, create_time, create_by, modify_time, modify_by + + +