省厅系统行业信息对接

This commit is contained in:
mythxb 2025-03-26 13:56:36 +08:00
parent 8114d59e0c
commit 686cc6ac02
7 changed files with 142 additions and 7 deletions

View File

@ -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);

View File

@ -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;
/**
* <p>
* 省厅系统行业 Mapper 接口
* </p>
*
* @author
* @since 2025-03-26
*/
@Repository
public interface PvIndustryMapper extends BaseMapper<PvIndustry> {
}

View File

@ -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;
/**
* <p>
* 省厅系统行业
* </p>
*
* @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;
}

View File

@ -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;
}

View File

@ -589,6 +589,10 @@ public class BaseService {
@Autowired
protected ExScoreRecordMapper exScoreRecordMapper;
//
@Autowired
protected PvIndustryMapper pvIndustryMapper;
//redis
@Resource
protected RedisUtil redisUtil;

View File

@ -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<List<DeptInfo>>() {}.getType();
// ProvData<List<DeptInfo>> data = JsonUtils.fromJsonComplex(responseStr,ProvData.class, userListType);
System.out.println("responseStr ---> "+responseStr);
System.out.println("responseStr --> "+responseStr);
Type dataListType = new TypeToken<List<PvIndustry>>() {}.getType();
ProvData<List<PvIndustry>> 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));
}
//获取隐患类型信息

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.rzyc.mapper.ent.PvIndustryMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.rzyc.model.ent.PvIndustry">
<id column="industry_id" property="industryId" />
<result column="industry_name" property="industryName" />
<result column="sort_id" property="sortId" />
<result column="create_time" property="createTime" />
<result column="create_by" property="createBy" />
<result column="modify_time" property="modifyTime" />
<result column="modify_by" property="modifyBy" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
industry_id, industry_name, sort_id, create_time, create_by, modify_time, modify_by
</sql>
</mapper>