Commit ef9ff575 by 胡懿

初步开发

parent ac295335
package com.ruoyi.web;
import com.ruoyi.system.domain.Bs;
import com.ruoyi.system.domain.Model;
public class PublicUrlDto {
private String url;
private Model model;
private Bs bs;
private Integer pageSize;
private Integer pageNum;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Model getModel() {
return model;
}
public void setModel(Model model) {
this.model = model;
}
public Bs getBs() {
return bs;
}
public void setBs(Bs bs) {
this.bs = bs;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
}
package com.ruoyi.system.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.Model;
import com.ruoyi.web.PublicUrlDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Bs;
import com.ruoyi.system.service.IBsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 标识管理Controller
*
* @author 胡懿
* @date 2025-03-25
*/
@RestController
@RequestMapping("/system/bs")
public class BsController extends BaseController
{
@Autowired
private IBsService bsService;
/**
* 查询标识管理列表
*/
@PreAuthorize("@ss.hasPermi('system:bs:list')")
@GetMapping("/list")
public TableDataInfo list(Bs bs)
{
startPage();
List<Bs> list = bsService.selectBsList(bs);
return getDataTable(list);
}
/**
* 导出标识管理列表
*/
@PreAuthorize("@ss.hasPermi('system:bs:export')")
@Log(title = "标识管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Bs bs)
{
List<Bs> list = bsService.selectBsList(bs);
ExcelUtil<Bs> util = new ExcelUtil<Bs>(Bs.class);
util.exportExcel(response, list, "标识管理数据");
}
/**
* 获取标识管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:bs:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(bsService.selectBsById(id));
}
/**
* 新增标识管理
*/
@PreAuthorize("@ss.hasPermi('system:bs:add')")
@Log(title = "标识管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Bs bs)
{
return toAjax(bsService.insertBs(bs));
}
/**
* 修改标识管理
*/
@PreAuthorize("@ss.hasPermi('system:bs:edit')")
@Log(title = "标识管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Bs bs)
{
return toAjax(bsService.updateBs(bs));
}
/**
* 删除标识管理
*/
@PreAuthorize("@ss.hasPermi('system:bs:remove')")
@Log(title = "标识管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(bsService.deleteBsByIds(ids));
}
@Anonymous
@GetMapping("/publicList")
public TableDataInfo publicList(Bs bs)
{
startPage();
List<Bs> list = bsService.publicList(bs);
return getDataTable(list);
}
@GetMapping("/getPublicList")
public TableDataInfo getPublicList(PublicUrlDto publicUrlDto)
{
if (StringUtils.isNotBlank(publicUrlDto.getUrl())) {
return bsService.getPublicList(publicUrlDto.getUrl(), publicUrlDto.getBs(), publicUrlDto.getPageSize(), publicUrlDto.getPageNum());
} else {
return getDataTable(new ArrayList<Bs>());
}
}
}
package com.ruoyi.system.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.web.PublicUrlDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Model;
import com.ruoyi.system.service.IModelService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 模版管理Controller
*
* @author ruoyi
* @date 2025-03-25
*/
@RestController
@RequestMapping("/system/model")
public class ModelController extends BaseController
{
@Autowired
private IModelService modelService;
/**
* 查询模版管理列表
*/
@PreAuthorize("@ss.hasPermi('system:model:list')")
@GetMapping("/list")
public TableDataInfo list(Model model)
{
startPage();
List<Model> list = modelService.selectModelList(model);
return getDataTable(list);
}
/**
* 导出模版管理列表
*/
@PreAuthorize("@ss.hasPermi('system:model:export')")
@Log(title = "模版管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Model model)
{
List<Model> list = modelService.selectModelList(model);
ExcelUtil<Model> util = new ExcelUtil<Model>(Model.class);
util.exportExcel(response, list, "模版管理数据");
}
/**
* 获取模版管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:model:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(modelService.selectModelById(id));
}
/**
* 新增模版管理
*/
@PreAuthorize("@ss.hasPermi('system:model:add')")
@Log(title = "模版管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Model model)
{
return toAjax(modelService.insertModel(model));
}
/**
* 修改模版管理
*/
@PreAuthorize("@ss.hasPermi('system:model:edit')")
@Log(title = "模版管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Model model)
{
return toAjax(modelService.updateModel(model));
}
/**
* 删除模版管理
*/
@PreAuthorize("@ss.hasPermi('system:model:remove')")
@Log(title = "模版管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(modelService.deleteModelByIds(ids));
}
/**
* 获取线上和线下所有标识字段
* @param id
* @return
*/
@GetMapping(value = "getModelInfo")
public AjaxResult getModelInfo(Long id)
{
return success(modelService.getModelInfo(id));
}
@Anonymous
@GetMapping("/publicList")
public TableDataInfo publicList(Model model)
{
startPage();
List<Model> list = modelService.publicModelList(model);
return getDataTable(list);
}
@GetMapping("/getPublicList")
public TableDataInfo getPublicList(PublicUrlDto publicUrlDto)
{
if (StringUtils.isNotBlank(publicUrlDto.getUrl())) {
return modelService.getPublicList(publicUrlDto.getUrl(), publicUrlDto.getModel(), publicUrlDto.getPageSize(), publicUrlDto.getPageNum());
} else {
return getDataTable(new ArrayList<Model>());
}
}
}
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Prefix;
import com.ruoyi.system.service.IPrefixService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 本公司信息Controller
*
* @author 胡懿
* @date 2025-03-25
*/
@RestController
@RequestMapping("/system/prefix")
public class PrefixController extends BaseController
{
@Autowired
private IPrefixService prefixService;
/**
* 查询本公司信息列表
*/
@PreAuthorize("@ss.hasPermi('system:prefix:list')")
@GetMapping("/list")
public TableDataInfo list(Prefix prefix)
{
startPage();
List<Prefix> list = prefixService.selectPrefixList(prefix);
return getDataTable(list);
}
/**
* 导出本公司信息列表
*/
@PreAuthorize("@ss.hasPermi('system:prefix:export')")
@Log(title = "本公司信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Prefix prefix)
{
List<Prefix> list = prefixService.selectPrefixList(prefix);
ExcelUtil<Prefix> util = new ExcelUtil<Prefix>(Prefix.class);
util.exportExcel(response, list, "本公司信息数据");
}
/**
* 获取本公司信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:prefix:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(prefixService.selectPrefixById(id));
}
/**
* 新增本公司信息
*/
@PreAuthorize("@ss.hasPermi('system:prefix:add')")
@Log(title = "本公司信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Prefix prefix)
{
return toAjax(prefixService.insertPrefix(prefix));
}
/**
* 修改本公司信息
*/
@PreAuthorize("@ss.hasPermi('system:prefix:edit')")
@Log(title = "本公司信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Prefix prefix)
{
return toAjax(prefixService.updatePrefix(prefix));
}
/**
* 删除本公司信息
*/
@PreAuthorize("@ss.hasPermi('system:prefix:remove')")
@Log(title = "本公司信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(prefixService.deletePrefixByIds(ids));
}
}
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.PublicConf;
import com.ruoyi.system.service.IPublicConfService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 外部公司配置Controller
*
* @author 胡懿
* @date 2025-03-25
*/
@RestController
@RequestMapping("/system/conf")
public class PublicConfController extends BaseController
{
@Autowired
private IPublicConfService publicConfService;
/**
* 查询外部公司配置列表
*/
@PreAuthorize("@ss.hasPermi('system:conf:list')")
@GetMapping("/list")
public TableDataInfo list(PublicConf publicConf)
{
startPage();
List<PublicConf> list = publicConfService.selectPublicConfList(publicConf);
return getDataTable(list);
}
/**
* 导出外部公司配置列表
*/
@PreAuthorize("@ss.hasPermi('system:conf:export')")
@Log(title = "外部公司配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PublicConf publicConf)
{
List<PublicConf> list = publicConfService.selectPublicConfList(publicConf);
ExcelUtil<PublicConf> util = new ExcelUtil<PublicConf>(PublicConf.class);
util.exportExcel(response, list, "外部公司配置数据");
}
/**
* 获取外部公司配置详细信息
*/
@PreAuthorize("@ss.hasPermi('system:conf:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(publicConfService.selectPublicConfById(id));
}
/**
* 新增外部公司配置
*/
@PreAuthorize("@ss.hasPermi('system:conf:add')")
@Log(title = "外部公司配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PublicConf publicConf)
{
return toAjax(publicConfService.insertPublicConf(publicConf));
}
/**
* 修改外部公司配置
*/
@PreAuthorize("@ss.hasPermi('system:conf:edit')")
@Log(title = "外部公司配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PublicConf publicConf)
{
return toAjax(publicConfService.updatePublicConf(publicConf));
}
/**
* 删除外部公司配置
*/
@PreAuthorize("@ss.hasPermi('system:conf:remove')")
@Log(title = "外部公司配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(publicConfService.deletePublicConfByIds(ids));
}
}
......@@ -6,9 +6,21 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.19.128:4000/bsjx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.19.142:3306/bsjx_zh?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
# master:
# url: jdbc:mysql://47.92.255.123:3306/bsjx_zh?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: SXyz@112023.
# master:
# url: jdbc:mysql://172.32.0.1:3306/bsjx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: SXyz@112023.
# master:
# url: jdbc:mysql://172.33.0.1:3306/bsjx_zh?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: SXyz@112023.
# 从库数据源
slave:
# 从数据源开关/默认关闭
......
......@@ -16,10 +16,10 @@ ruoyi:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8080
port: 8085
servlet:
# 应用的访问路径
context-path: /
context-path: /prod-api
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
......@@ -43,7 +43,7 @@ user:
# 密码最大错误次数
maxRetryCount: 5
# 密码锁定时间(默认10分钟)
lockTime: 10
lockTime: 120
# Spring配置
spring:
......@@ -69,6 +69,8 @@ spring:
redis:
# 地址
host: localhost
# host: 172.33.0.3
# host: 172.32.0.3
# 端口,默认为6379
port: 6379
# 数据库索引
......
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 标识管理对象 t_bs
*
* @author 胡懿
* @date 2025-03-25
*/
public class Bs extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/**
* 标识
*/
private String handle;
/** 咱自己的字段 */
@Excel(name = "咱自己的字段")
private String content;
/** 模版名称 */
@Excel(name = "模版名称")
private String modelName;
/** 模版id */
@Excel(name = "模版id")
private Long modelId;
/** 自己的url */
@Excel(name = "自己的url")
private String url;
/** 代理商的url */
@Excel(name = "代理商的url")
private String dlUrl;
/** 标识 */
@Excel(name = "标识")
private String sign;
/** 企业前缀 */
@Excel(name = "企业前缀")
private String prefix;
/** 推向线上的 */
@Excel(name = "推向线上的")
private String contentLine;
private Long dlId;
private String dlName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setModelName(String modelName)
{
this.modelName = modelName;
}
public String getModelName()
{
return modelName;
}
public void setModelId(Long modelId)
{
this.modelId = modelId;
}
public Long getModelId()
{
return modelId;
}
public void setUrl(String url)
{
this.url = url;
}
public String getUrl()
{
return url;
}
public void setDlUrl(String dlUrl)
{
this.dlUrl = dlUrl;
}
public String getDlUrl()
{
return dlUrl;
}
public void setSign(String sign)
{
this.sign = sign;
}
public String getSign()
{
return sign;
}
public void setPrefix(String prefix)
{
this.prefix = prefix;
}
public String getPrefix()
{
return prefix;
}
public void setContentLine(String contentLine)
{
this.contentLine = contentLine;
}
public String getContentLine()
{
return contentLine;
}
public Long getDlId() {
return dlId;
}
public void setDlId(Long dlId) {
this.dlId = dlId;
}
public String getDlName() {
return dlName;
}
public void setDlName(String dlName) {
this.dlName = dlName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("id", getHandle())
.append("content", getContent())
.append("modelName", getModelName())
.append("modelId", getModelId())
.append("url", getUrl())
.append("dlUrl", getDlUrl())
.append("dlId", getDlId())
.append("dlName", getDlName())
.append("sign", getSign())
.append("prefix", getPrefix())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("contentLine", getContentLine())
.toString();
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 模版管理对象 t_model
*
* @author ruoyi
* @date 2025-03-25
*/
public class Model extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 模版类型 */
@Excel(name = "模版类型")
private String type;
/** 咱们的字段 */
@Excel(name = "咱们的字段")
private String content;
// 线上的字段
private String dataTemplate;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public String getDataTemplate() {
return dataTemplate;
}
public void setDataTemplate(String dataTemplate) {
this.dataTemplate = dataTemplate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("content", getContent())
.toString();
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 本公司信息对象 t_prefix
*
* @author 胡懿
* @date 2025-03-25
*/
public class Prefix extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 公司名称 */
@Excel(name = "公司名称")
private String name;
/** 前缀 */
@Excel(name = "前缀")
private String prefix;
/** 用户名 */
@Excel(name = "用户名")
private String username;
/** 密码 */
@Excel(name = "密码")
private String password;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setPrefix(String prefix)
{
this.prefix = prefix;
}
public String getPrefix()
{
return prefix;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return username;
}
public void setPassword(String password)
{
this.password = password;
}
public String getPassword()
{
return password;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("prefix", getPrefix())
.append("username", getUsername())
.append("password", getPassword())
.toString();
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 外部公司配置对象 t_public_conf
*
* @author 胡懿
* @date 2025-03-25
*/
public class PublicConf extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 公司名称 */
@Excel(name = "公司名称")
private String name;
/** 标识公共接口 */
@Excel(name = "标识公共接口")
private String url;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setUrl(String url)
{
this.url = url;
}
public String getUrl()
{
return url;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("url", getUrl())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Bs;
/**
* 标识管理Mapper接口
*
* @author 胡懿
* @date 2025-03-25
*/
public interface BsMapper
{
/**
* 查询标识管理
*
* @param id 标识管理主键
* @return 标识管理
*/
public Bs selectBsById(Long id);
/**
* 查询标识管理列表
*
* @param bs 标识管理
* @return 标识管理集合
*/
public List<Bs> selectBsList(Bs bs);
/**
* 新增标识管理
*
* @param bs 标识管理
* @return 结果
*/
public int insertBs(Bs bs);
/**
* 修改标识管理
*
* @param bs 标识管理
* @return 结果
*/
public int updateBs(Bs bs);
/**
* 删除标识管理
*
* @param id 标识管理主键
* @return 结果
*/
public int deleteBsById(Long id);
/**
* 批量删除标识管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBsByIds(Long[] ids);
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Model;
/**
* 模版管理Mapper接口
*
* @author ruoyi
* @date 2025-03-25
*/
public interface ModelMapper
{
/**
* 查询模版管理
*
* @param id 模版管理主键
* @return 模版管理
*/
public Model selectModelById(Long id);
/**
* 查询模版管理列表
*
* @param model 模版管理
* @return 模版管理集合
*/
public List<Model> selectModelList(Model model);
/**
* 新增模版管理
*
* @param model 模版管理
* @return 结果
*/
public int insertModel(Model model);
/**
* 修改模版管理
*
* @param model 模版管理
* @return 结果
*/
public int updateModel(Model model);
/**
* 删除模版管理
*
* @param id 模版管理主键
* @return 结果
*/
public int deleteModelById(Long id);
/**
* 批量删除模版管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteModelByIds(Long[] ids);
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Prefix;
/**
* 本公司信息Mapper接口
*
* @author 胡懿
* @date 2025-03-25
*/
public interface PrefixMapper
{
/**
* 查询本公司信息
*
* @param id 本公司信息主键
* @return 本公司信息
*/
public Prefix selectPrefixById(Long id);
/**
* 查询本公司信息列表
*
* @param prefix 本公司信息
* @return 本公司信息集合
*/
public List<Prefix> selectPrefixList(Prefix prefix);
/**
* 新增本公司信息
*
* @param prefix 本公司信息
* @return 结果
*/
public int insertPrefix(Prefix prefix);
/**
* 修改本公司信息
*
* @param prefix 本公司信息
* @return 结果
*/
public int updatePrefix(Prefix prefix);
/**
* 删除本公司信息
*
* @param id 本公司信息主键
* @return 结果
*/
public int deletePrefixById(Long id);
/**
* 批量删除本公司信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePrefixByIds(Long[] ids);
public Prefix findOne();
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.PublicConf;
/**
* 外部公司配置Mapper接口
*
* @author 胡懿
* @date 2025-03-25
*/
public interface PublicConfMapper
{
/**
* 查询外部公司配置
*
* @param id 外部公司配置主键
* @return 外部公司配置
*/
public PublicConf selectPublicConfById(Long id);
/**
* 查询外部公司配置列表
*
* @param publicConf 外部公司配置
* @return 外部公司配置集合
*/
public List<PublicConf> selectPublicConfList(PublicConf publicConf);
/**
* 新增外部公司配置
*
* @param publicConf 外部公司配置
* @return 结果
*/
public int insertPublicConf(PublicConf publicConf);
/**
* 修改外部公司配置
*
* @param publicConf 外部公司配置
* @return 结果
*/
public int updatePublicConf(PublicConf publicConf);
/**
* 删除外部公司配置
*
* @param id 外部公司配置主键
* @return 结果
*/
public int deletePublicConfById(Long id);
/**
* 批量删除外部公司配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePublicConfByIds(Long[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.Bs;
/**
* 标识管理Service接口
*
* @author 胡懿
* @date 2025-03-25
*/
public interface IBsService
{
/**
* 查询标识管理
*
* @param id 标识管理主键
* @return 标识管理
*/
public Bs selectBsById(Long id);
/**
* 查询标识管理列表
*
* @param bs 标识管理
* @return 标识管理集合
*/
public List<Bs> selectBsList(Bs bs);
/**
* 新增标识管理
*
* @param bs 标识管理
* @return 结果
*/
public int insertBs(Bs bs);
/**
* 修改标识管理
*
* @param bs 标识管理
* @return 结果
*/
public int updateBs(Bs bs);
/**
* 批量删除标识管理
*
* @param ids 需要删除的标识管理主键集合
* @return 结果
*/
public int deleteBsByIds(Long[] ids);
/**
* 删除标识管理信息
*
* @param id 标识管理主键
* @return 结果
*/
public int deleteBsById(Long id);
List<Bs> publicList(Bs bs);
TableDataInfo getPublicList(String url, Bs bs, Integer pageSize, Integer pageNum);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.Model;
/**
* 模版管理Service接口
*
* @author ruoyi
* @date 2025-03-25
*/
public interface IModelService
{
/**
* 查询模版管理
*
* @param id 模版管理主键
* @return 模版管理
*/
public Model selectModelById(Long id);
/**
* 查询模版管理列表
*
* @param model 模版管理
* @return 模版管理集合
*/
public List<Model> selectModelList(Model model);
/**
* 新增模版管理
*
* @param model 模版管理
* @return 结果
*/
public int insertModel(Model model);
/**
* 修改模版管理
*
* @param model 模版管理
* @return 结果
*/
public int updateModel(Model model);
/**
* 批量删除模版管理
*
* @param ids 需要删除的模版管理主键集合
* @return 结果
*/
public int deleteModelByIds(Long[] ids);
/**
* 删除模版管理信息
*
* @param id 模版管理主键
* @return 结果
*/
public int deleteModelById(Long id);
Model getModelInfo(Long id);
List<Model> publicModelList(Model model);
TableDataInfo getPublicList(String url, Model model, Integer pageSize, Integer pageNum);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Prefix;
/**
* 本公司信息Service接口
*
* @author 胡懿
* @date 2025-03-25
*/
public interface IPrefixService
{
/**
* 查询本公司信息
*
* @param id 本公司信息主键
* @return 本公司信息
*/
public Prefix selectPrefixById(Long id);
/**
* 查询本公司信息列表
*
* @param prefix 本公司信息
* @return 本公司信息集合
*/
public List<Prefix> selectPrefixList(Prefix prefix);
/**
* 新增本公司信息
*
* @param prefix 本公司信息
* @return 结果
*/
public int insertPrefix(Prefix prefix);
/**
* 修改本公司信息
*
* @param prefix 本公司信息
* @return 结果
*/
public int updatePrefix(Prefix prefix);
/**
* 批量删除本公司信息
*
* @param ids 需要删除的本公司信息主键集合
* @return 结果
*/
public int deletePrefixByIds(Long[] ids);
/**
* 删除本公司信息信息
*
* @param id 本公司信息主键
* @return 结果
*/
public int deletePrefixById(Long id);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.PublicConf;
/**
* 外部公司配置Service接口
*
* @author 胡懿
* @date 2025-03-25
*/
public interface IPublicConfService
{
/**
* 查询外部公司配置
*
* @param id 外部公司配置主键
* @return 外部公司配置
*/
public PublicConf selectPublicConfById(Long id);
/**
* 查询外部公司配置列表
*
* @param publicConf 外部公司配置
* @return 外部公司配置集合
*/
public List<PublicConf> selectPublicConfList(PublicConf publicConf);
/**
* 新增外部公司配置
*
* @param publicConf 外部公司配置
* @return 结果
*/
public int insertPublicConf(PublicConf publicConf);
/**
* 修改外部公司配置
*
* @param publicConf 外部公司配置
* @return 结果
*/
public int updatePublicConf(PublicConf publicConf);
/**
* 批量删除外部公司配置
*
* @param ids 需要删除的外部公司配置主键集合
* @return 结果
*/
public int deletePublicConfByIds(Long[] ids);
/**
* 删除外部公司配置信息
*
* @param id 外部公司配置主键
* @return 结果
*/
public int deletePublicConfById(Long id);
}
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.Model;
import com.ruoyi.system.domain.Prefix;
import com.ruoyi.system.mapper.ModelMapper;
import com.ruoyi.system.mapper.PrefixMapper;
import com.ruoyi.system.utils.BsjxUtils;
import com.ruoyi.system.utils.MyDateUtils;
import com.ruoyi.system.utils.SignAddInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BsMapper;
import com.ruoyi.system.domain.Bs;
import com.ruoyi.system.service.IBsService;
import org.springframework.web.client.RestTemplate;
/**
* 标识管理Service业务层处理
*
* @author 胡懿
* @date 2025-03-25
*/
@Service
public class BsServiceImpl implements IBsService
{
@Autowired
private BsMapper bsMapper;
@Autowired
private ModelMapper modelMapper;
@Autowired
private PrefixMapper prefixMapper;
/**
* 查询标识管理
*
* @param id 标识管理主键
* @return 标识管理
*/
@Override
public Bs selectBsById(Long id)
{
return bsMapper.selectBsById(id);
}
/**
* 查询标识管理列表
*
* @param bs 标识管理
* @return 标识管理
*/
@Override
public List<Bs> selectBsList(Bs bs)
{
return bsMapper.selectBsList(bs);
}
/**
* 新增标识管理
*
* @param bs 标识管理
* @return 结果
*/
@Override
public int insertBs(Bs bs)
{
bs.setCreateTime(DateUtils.getNowDate());
Prefix prefix = prefixMapper.findOne();
String token = BsjxUtils.getToken(prefix.getUsername(), prefix.getPassword());
SignAddInfo signAddInfo = JSONObject.parseObject(bs.getContentLine(), SignAddInfo.class);
boolean b = BsjxUtils.addSign(token, signAddInfo);
if (b) {
return bsMapper.insertBs(bs);
} else {
return 0;
}
}
/**
* 修改标识管理
*
* @param bs 标识管理
* @return 结果
*/
@Override
public int updateBs(Bs bs)
{
bs.setUpdateTime(DateUtils.getNowDate());
Prefix prefix = prefixMapper.findOne();
String token = BsjxUtils.getToken(prefix.getUsername(), prefix.getPassword());
SignAddInfo signAddInfo = JSONObject.parseObject(bs.getContentLine(), SignAddInfo.class);
boolean b = BsjxUtils.updateSign(token, signAddInfo);
if (b) {
return bsMapper.updateBs(bs);
} else {
return 0;
}
}
/**
* 批量删除标识管理
*
* @param ids 需要删除的标识管理主键
* @return 结果
*/
@Override
public int deleteBsByIds(Long[] ids)
{
if (ids.length > 0) {
for (long id : ids) {
Bs bs = selectBsById(id);
Prefix prefix = prefixMapper.findOne();
String token = BsjxUtils.getToken(prefix.getUsername(), prefix.getPassword());
SignAddInfo signAddInfo = new SignAddInfo();
signAddInfo.setHandle(bs.getHandle());
BsjxUtils.deleteSign(token, signAddInfo);
bsMapper.deleteBsById(id);
}
}
return 1;
}
/**
* 删除标识管理信息
*
* @param id 标识管理主键
* @return 结果
*/
@Override
public int deleteBsById(Long id)
{
Bs bs = selectBsById(id);
Prefix prefix = prefixMapper.findOne();
String token = BsjxUtils.getToken(prefix.getUsername(), prefix.getPassword());
SignAddInfo signAddInfo = new SignAddInfo();
signAddInfo.setHandle(bs.getHandle());
BsjxUtils.deleteSign(token, signAddInfo);
return bsMapper.deleteBsById(id);
}
@Override
public List<Bs> publicList(Bs bs) {
return bsMapper.selectBsList(bs);
}
@Override
public TableDataInfo getPublicList(String url, Bs bs, Integer pageSize, Integer pageNum) {
url += "?pageSize=" + pageSize;
url += "&pageNum=" + pageNum;
if (null != bs) {
if (StringUtils.isNotBlank(bs.getHandle())){
url += "&handle=" + bs.getHandle();
}
if (StringUtils.isNotBlank(bs.getModelName())){
url += "&modelName=" + bs.getModelName();
}
if (null != bs.getModelId()){
url += "&modelId=" + bs.getModelId();
}
if (StringUtils.isNotBlank(bs.getPrefix())){
url += "&prefix=" + bs.getPrefix();
}
}
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>("", headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.GET,
entity,
String.class);
String body = response.getBody();
TableDataInfo list = JSONObject.parseObject(body, TableDataInfo.class);
return list;
}
}
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.Prefix;
import com.ruoyi.system.mapper.PrefixMapper;
import com.ruoyi.system.utils.BsjxUPBody;
import com.ruoyi.system.utils.BsjxUtils;
import com.ruoyi.system.utils.SignInfo;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ModelMapper;
import com.ruoyi.system.domain.Model;
import com.ruoyi.system.service.IModelService;
import org.springframework.web.client.RestTemplate;
/**
* 模版管理Service业务层处理
*
* @author ruoyi
* @date 2025-03-25
*/
@Service
public class ModelServiceImpl implements IModelService
{
@Autowired
private ModelMapper modelMapper;
@Autowired
private PrefixMapper prefixMapper;
/**
* 查询模版管理
*
* @param id 模版管理主键
* @return 模版管理
*/
@Override
public Model selectModelById(Long id)
{
return modelMapper.selectModelById(id);
}
/**
* 查询模版管理列表
*
* @param model 模版管理
* @return 模版管理
*/
@Override
public List<Model> selectModelList(Model model)
{
return modelMapper.selectModelList(model);
}
/**
* 新增模版管理
*
* @param model 模版管理
* @return 结果
*/
@Override
public int insertModel(Model model)
{
return modelMapper.insertModel(model);
}
/**
* 修改模版管理
*
* @param model 模版管理
* @return 结果
*/
@Override
public int updateModel(Model model)
{
return modelMapper.updateModel(model);
}
/**
* 批量删除模版管理
*
* @param ids 需要删除的模版管理主键
* @return 结果
*/
@Override
public int deleteModelByIds(Long[] ids)
{
return modelMapper.deleteModelByIds(ids);
}
/**
* 删除模版管理信息
*
* @param id 模版管理主键
* @return 结果
*/
@Override
public int deleteModelById(Long id)
{
return modelMapper.deleteModelById(id);
}
@Override
public Model getModelInfo(Long id) {
Model model = selectModelById(id);
Prefix prefix = prefixMapper.findOne();
String token = BsjxUtils.getToken(prefix.getUsername(), prefix.getPassword());
String dataTemplate = BsjxUtils.getDataTemplate(token, prefix.getPrefix(), model.getType());
model.setDataTemplate(dataTemplate);
return model;
}
@Override
public List<Model> publicModelList(Model model) {
return modelMapper.selectModelList(model);
}
@Override
public TableDataInfo getPublicList(String url, Model model, Integer pageSize, Integer pageNum) {
url += "?pageSize=" + pageSize;
url += "&pageNum=" + pageNum;
if (null != model) {
if (StringUtils.isNotBlank(model.getName())){
url += "&name=" + model.getName();
}
if (StringUtils.isNotBlank(model.getType())){
url += "&type=" + model.getType();
}
}
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>("", headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.GET,
entity,
String.class);
String body = response.getBody();
TableDataInfo list = JSONObject.parseObject(body, TableDataInfo.class);
return list;
}
}
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PrefixMapper;
import com.ruoyi.system.domain.Prefix;
import com.ruoyi.system.service.IPrefixService;
/**
* 本公司信息Service业务层处理
*
* @author 胡懿
* @date 2025-03-25
*/
@Service
public class PrefixServiceImpl implements IPrefixService
{
@Autowired
private PrefixMapper prefixMapper;
/**
* 查询本公司信息
*
* @param id 本公司信息主键
* @return 本公司信息
*/
@Override
public Prefix selectPrefixById(Long id)
{
return prefixMapper.selectPrefixById(id);
}
/**
* 查询本公司信息列表
*
* @param prefix 本公司信息
* @return 本公司信息
*/
@Override
public List<Prefix> selectPrefixList(Prefix prefix)
{
return prefixMapper.selectPrefixList(prefix);
}
/**
* 新增本公司信息
*
* @param prefix 本公司信息
* @return 结果
*/
@Override
public int insertPrefix(Prefix prefix)
{
return prefixMapper.insertPrefix(prefix);
}
/**
* 修改本公司信息
*
* @param prefix 本公司信息
* @return 结果
*/
@Override
public int updatePrefix(Prefix prefix)
{
return prefixMapper.updatePrefix(prefix);
}
/**
* 批量删除本公司信息
*
* @param ids 需要删除的本公司信息主键
* @return 结果
*/
@Override
public int deletePrefixByIds(Long[] ids)
{
return prefixMapper.deletePrefixByIds(ids);
}
/**
* 删除本公司信息信息
*
* @param id 本公司信息主键
* @return 结果
*/
@Override
public int deletePrefixById(Long id)
{
return prefixMapper.deletePrefixById(id);
}
}
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PublicConfMapper;
import com.ruoyi.system.domain.PublicConf;
import com.ruoyi.system.service.IPublicConfService;
/**
* 外部公司配置Service业务层处理
*
* @author 胡懿
* @date 2025-03-25
*/
@Service
public class PublicConfServiceImpl implements IPublicConfService
{
@Autowired
private PublicConfMapper publicConfMapper;
/**
* 查询外部公司配置
*
* @param id 外部公司配置主键
* @return 外部公司配置
*/
@Override
public PublicConf selectPublicConfById(Long id)
{
return publicConfMapper.selectPublicConfById(id);
}
/**
* 查询外部公司配置列表
*
* @param publicConf 外部公司配置
* @return 外部公司配置
*/
@Override
public List<PublicConf> selectPublicConfList(PublicConf publicConf)
{
return publicConfMapper.selectPublicConfList(publicConf);
}
/**
* 新增外部公司配置
*
* @param publicConf 外部公司配置
* @return 结果
*/
@Override
public int insertPublicConf(PublicConf publicConf)
{
return publicConfMapper.insertPublicConf(publicConf);
}
/**
* 修改外部公司配置
*
* @param publicConf 外部公司配置
* @return 结果
*/
@Override
public int updatePublicConf(PublicConf publicConf)
{
return publicConfMapper.updatePublicConf(publicConf);
}
/**
* 批量删除外部公司配置
*
* @param ids 需要删除的外部公司配置主键
* @return 结果
*/
@Override
public int deletePublicConfByIds(Long[] ids)
{
return publicConfMapper.deletePublicConfByIds(ids);
}
/**
* 删除外部公司配置信息
*
* @param id 外部公司配置主键
* @return 结果
*/
@Override
public int deletePublicConfById(Long id)
{
return publicConfMapper.deletePublicConfById(id);
}
}
package com.ruoyi.system.utils;
public class BsjxResult<T> {
private String message;
private Integer status;
private T data;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
package com.ruoyi.system.utils;
public class BsjxUPBody {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
package com.ruoyi.system.utils;
import com.alibaba.fastjson2.JSONObject;
import org.apache.commons.math3.analysis.function.Sin;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
import java.util.Base64;
public class BsjxUtils {
public static String getToken(String username, String password) {
RestTemplate restTemplate = new RestTemplate();
BsjxUPBody bsjxUPBody = new BsjxUPBody();
bsjxUPBody.setUsername(username);
bsjxUPBody.setPassword(password);
String url = "https://snms.sxlq.com/identity/token";
String response = restTemplate.postForObject(url, bsjxUPBody, String.class);
JSONObject jsonObject = JSONObject.parseObject(response);
String message = (String) jsonObject.get("message");
Integer status = (Integer) jsonObject.get("status");
if (null != status && -2 != status) {
JSONObject data = (JSONObject) jsonObject.get("data");
String token = (String) data.get("token");
return token;
} else {
return "";
}
}
public static String getDataTemplate(String token, String prefix, String modelType) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://snms.sxlq.com/snms/api/v3/template?prefix=" + prefix + "&version=" + modelType;
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + token);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.GET,
entity,
String.class);
String body = response.getBody();
JSONObject jsonObject = JSONObject.parseObject(body);
Integer status = (Integer) jsonObject.get("status");
if (null != status && -2 != status) {
JSONObject data = (JSONObject) jsonObject.get("data");
return data.toString();
} else {
return "";
}
}
/**
* 查询标识
* @param token
* @param handle
* @return
*/
public static SignInfo getSign(String token, String prefix, String handle) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://snms.sxlq.com/identityv2/data/detail?prefix=" + prefix + "&handle=" + handle;
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + token);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.GET,
entity,
String.class);
String body = response.getBody();
JSONObject jsonObject = JSONObject.parseObject(body);
Integer status = (Integer) jsonObject.get("status");
if (null != status && -2 != status) {
JSONObject data = (JSONObject) jsonObject.get("data");
System.out.println(data.toString());
SignInfo signInfo = JSONObject.parseObject(data.toString(), SignInfo.class);
return signInfo;
} else {
return null;
}
}
/**
* 添加标识
* @param signAddInfo
* @return
*/
public static boolean addSign(String token, SignAddInfo signAddInfo) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://snms.sxlq.com/identityv2/data";
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + token);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(signAddInfo), headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.POST,
entity,
String.class);
String body = response.getBody();
System.out.println(body);
JSONObject jsonObject = JSONObject.parseObject(body);
Integer status = (Integer) jsonObject.get("status");
if (null != status && -2 != status) {
return true;
} else {
return false;
}
}
/**
* 修改标识
* @param signAddInfo
* @return
*/
public static boolean updateSign(String token, SignAddInfo signAddInfo) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://snms.sxlq.com/identityv2/data";
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + token);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(signAddInfo), headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.PUT,
entity,
String.class);
String body = response.getBody();
System.out.println(body);
JSONObject jsonObject = JSONObject.parseObject(body);
Integer status = (Integer) jsonObject.get("status");
if (null != status && -2 != status) {
return true;
} else {
return false;
}
}
/**
* 删除标识
* @param signAddInfo
* @return
*/
public static boolean deleteSign(String token, SignAddInfo signAddInfo) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://snms.sxlq.com/identityv2/data";
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + token);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(signAddInfo), headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.DELETE,
entity,
String.class);
String body = response.getBody();
System.out.println(body);
JSONObject jsonObject = JSONObject.parseObject(body);
Integer status = (Integer) jsonObject.get("status");
if (null != status && -2 != status) {
return true;
} else {
return false;
}
}
public static void main(String[] args) {
String token = getToken("yingzhong", "SXyz@032025.");
// String data = getDataTemplate(token, "硬件设备");
// System.out.println(data);
// SignInfo signInfo = getSign(token, "88.550.1407010088/hardware_yz_202503240001");
// System.out.println(signInfo);
}
}
package com.ruoyi.system.utils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class MyDateUtils {
public static String getNowDateStr() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
// 获取当前时间并格式化
return LocalDateTime.now().format(formatter);
}
}
package com.ruoyi.system.utils;
import java.util.List;
/**
* 推送到线上的格式
*/
public class SignAddInfo {
private String handle;
private String templateVersion;
private List<SignValueInfo> value;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getTemplateVersion() {
return templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}
public List<SignValueInfo> getValue() {
return value;
}
public void setValue(List<SignValueInfo> value) {
this.value = value;
}
@Override
public String toString() {
return "SignAddInfo{" +
"handle='" + handle + '\'' +
", templateVersion='" + templateVersion + '\'' +
", value=" + value +
'}';
}
}
package com.ruoyi.system.utils;
public class SignData {
private String format;
private String value;
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
return "SignData{" +
"format='" + format + '\'' +
", value='" + value + '\'' +
'}';
}
}
package com.ruoyi.system.utils;
import java.util.List;
public class SignInfo {
private String code;
private String prefix;
private String handle;
private String templateVersion;
private List<SignValueInfo> value;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getTemplateVersion() {
return templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}
public List<SignValueInfo> getValue() {
return value;
}
public void setValue(List<SignValueInfo> value) {
this.value = value;
}
}
package com.ruoyi.system.utils;
/**
* 推送到线上的属性格式
*/
public class SignValueInfo {
private SignData data;
private String auth;
private Integer index;
private String type;
public SignData getData() {
return data;
}
public void setData(SignData data) {
this.data = data;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public Integer getIndex() {
return index;
}
public void setIndex(Integer index) {
this.index = index;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "SignValueInfo{" +
"data=" + data +
", auth='" + auth + '\'' +
", index=" + index +
", type='" + type + '\'' +
'}';
}
}
<?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.ruoyi.system.mapper.BsMapper">
<resultMap type="Bs" id="BsResult">
<result property="id" column="id" />
<result property="handle" column="handle" />
<result property="content" column="content" />
<result property="modelName" column="model_name" />
<result property="modelId" column="model_id" />
<result property="url" column="url" />
<result property="dlUrl" column="dl_url" />
<result property="dlId" column="dl_id" />
<result property="dlName" column="dl_name" />
<result property="sign" column="sign" />
<result property="prefix" column="prefix" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="contentLine" column="content_line" />
</resultMap>
<sql id="selectBsVo">
select id, handle, content, model_name, model_id, url, dl_url,dl_id,dl_name, sign, prefix, create_time, update_time, content_line from t_bs
</sql>
<select id="selectBsList" parameterType="Bs" resultMap="BsResult">
<include refid="selectBsVo"/>
<where>
<if test="handle != null and handle != ''"> and handle = #{handle}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
<if test="modelId != null "> and model_id = #{modelId}</if>
<if test="url != null and url != ''"> and url = #{url}</if>
<if test="dlUrl != null and dlUrl != ''"> and dl_url = #{dlUrl}</if>
<if test="dlId != null and dlId != ''"> and dl_id = #{dlId}</if>
<if test="dlName != null and dlName != ''"> and dl_name = #{dlName}</if>
<if test="sign != null and sign != ''"> and sign = #{sign}</if>
<if test="prefix != null and prefix != ''"> and prefix = #{prefix}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="contentLine != null and contentLine != ''"> and content_line = #{contentLine}</if>
</where>
</select>
<select id="selectBsById" parameterType="Long" resultMap="BsResult">
<include refid="selectBsVo"/>
where id = #{id}
</select>
<insert id="insertBs" parameterType="Bs" useGeneratedKeys="true" keyProperty="id">
insert into t_bs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="handle != null">handle,</if>
<if test="content != null">content,</if>
<if test="modelName != null">model_name,</if>
<if test="modelId != null">model_id,</if>
<if test="url != null">url,</if>
<if test="dlUrl != null">dl_url,</if>
<if test="dlId != null">dl_Id,</if>
<if test="dlName != null">dl_name,</if>
<if test="sign != null">sign,</if>
<if test="prefix != null">prefix,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="contentLine != null">content_line,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="handle != null">#{handle},</if>
<if test="content != null">#{content},</if>
<if test="modelName != null">#{modelName},</if>
<if test="modelId != null">#{modelId},</if>
<if test="url != null">#{url},</if>
<if test="dlUrl != null">#{dlUrl},</if>
<if test="dlId != null">#{dlId},</if>
<if test="dlName != null">#{dlName},</if>
<if test="sign != null">#{sign},</if>
<if test="prefix != null">#{prefix},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="contentLine != null">#{contentLine},</if>
</trim>
</insert>
<update id="updateBs" parameterType="Bs">
update t_bs
<trim prefix="SET" suffixOverrides=",">
<if test="handle != null">content = #{handle},</if>
<if test="content != null">content = #{content},</if>
<if test="modelName != null">model_name = #{modelName},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="url != null">url = #{url},</if>
<if test="dlUrl != null">dl_url = #{dlUrl},</if>
<if test="dlId != null">dl_id = #{dlId},</if>
<if test="dlName != null">dl_name = #{dlName},</if>
<if test="sign != null">sign = #{sign},</if>
<if test="prefix != null">prefix = #{prefix},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="contentLine != null">content_line = #{contentLine},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBsById" parameterType="Long">
delete from t_bs where id = #{id}
</delete>
<delete id="deleteBsByIds" parameterType="String">
delete from t_bs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.ruoyi.system.mapper.ModelMapper">
<resultMap type="Model" id="ModelResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="content" column="content" />
</resultMap>
<sql id="selectModelVo">
select id, name, type, content from t_model
</sql>
<select id="selectModelList" parameterType="Model" resultMap="ModelResult">
<include refid="selectModelVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
</where>
</select>
<select id="selectModelById" parameterType="Long" resultMap="ModelResult">
<include refid="selectModelVo"/>
where id = #{id}
</select>
<insert id="insertModel" parameterType="Model" useGeneratedKeys="true" keyProperty="id">
insert into t_model
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="content != null">content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="content != null">#{content},</if>
</trim>
</insert>
<update id="updateModel" parameterType="Model">
update t_model
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="content != null">content = #{content},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteModelById" parameterType="Long">
delete from t_model where id = #{id}
</delete>
<delete id="deleteModelByIds" parameterType="String">
delete from t_model where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.ruoyi.system.mapper.PrefixMapper">
<resultMap type="Prefix" id="PrefixResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="prefix" column="prefix" />
<result property="username" column="username" />
<result property="password" column="password" />
</resultMap>
<sql id="selectPrefixVo">
select id, name, prefix, username, password from t_prefix
</sql>
<select id="selectPrefixList" parameterType="Prefix" resultMap="PrefixResult">
<include refid="selectPrefixVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="prefix != null and prefix != ''"> and prefix = #{prefix}</if>
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
<if test="password != null and password != ''"> and password = #{password}</if>
</where>
</select>
<select id="selectPrefixById" parameterType="Long" resultMap="PrefixResult">
<include refid="selectPrefixVo"/>
where id = #{id}
</select>
<insert id="insertPrefix" parameterType="Prefix" useGeneratedKeys="true" keyProperty="id">
insert into t_prefix
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="prefix != null">prefix,</if>
<if test="username != null">username,</if>
<if test="password != null">password,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="prefix != null">#{prefix},</if>
<if test="username != null">#{username},</if>
<if test="password != null">#{password},</if>
</trim>
</insert>
<update id="updatePrefix" parameterType="Prefix">
update t_prefix
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="prefix != null">prefix = #{prefix},</if>
<if test="username != null">username = #{username},</if>
<if test="password != null">password = #{password},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePrefixById" parameterType="Long">
delete from t_prefix where id = #{id}
</delete>
<delete id="deletePrefixByIds" parameterType="String">
delete from t_prefix where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="findOne" parameterType="Prefix" resultMap="PrefixResult">
<include refid="selectPrefixVo"/>
limit 0,1
</select>
</mapper>
\ No newline at end of file
<?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.ruoyi.system.mapper.PublicConfMapper">
<resultMap type="PublicConf" id="PublicConfResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="url" column="url" />
</resultMap>
<sql id="selectPublicConfVo">
select id, name, url from t_public_conf
</sql>
<select id="selectPublicConfList" parameterType="PublicConf" resultMap="PublicConfResult">
<include refid="selectPublicConfVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="url != null and url != ''"> and url = #{url}</if>
</where>
</select>
<select id="selectPublicConfById" parameterType="Long" resultMap="PublicConfResult">
<include refid="selectPublicConfVo"/>
where id = #{id}
</select>
<insert id="insertPublicConf" parameterType="PublicConf" useGeneratedKeys="true" keyProperty="id">
insert into t_public_conf
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="url != null">url,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="url != null">#{url},</if>
</trim>
</insert>
<update id="updatePublicConf" parameterType="PublicConf">
update t_public_conf
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="url != null">url = #{url},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePublicConfById" parameterType="Long">
delete from t_public_conf where id = #{id}
</delete>
<delete id="deletePublicConfByIds" parameterType="String">
delete from t_public_conf where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment