24 changed files with 1050 additions and 12 deletions
@ -0,0 +1,124 @@ |
|||||
|
package com.zdxt.code.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.zdxt.common.ZDResponse; |
||||
|
import com.zdxt.common.controller.BaseController; |
||||
|
import com.zdxt.common.util.TableDataInfo; |
||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.ModelMap; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import com.zdxt.code.domain.LawEnforcementWarningList; |
||||
|
import com.zdxt.code.service.ILawEnforcementWarningListService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 执法预警列表Controller |
||||
|
* |
||||
|
* @author chenrui |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/code/LawEnforcementWarningList") |
||||
|
public class LawEnforcementWarningListController extends BaseController |
||||
|
{ |
||||
|
private String prefix = "code/LawEnforcementWarningList"; |
||||
|
|
||||
|
@Autowired |
||||
|
private ILawEnforcementWarningListService lawEnforcementWarningListService; |
||||
|
|
||||
|
@RequiresPermissions("code:LawEnforcementWarningList:view") |
||||
|
@GetMapping() |
||||
|
public String LawEnforcementWarningList() |
||||
|
{ |
||||
|
return prefix + "/LawEnforcementWarningList"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询执法预警列表列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("code:LawEnforcementWarningList:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<LawEnforcementWarningList> list = lawEnforcementWarningListService.selectLawEnforcementWarningListList(lawEnforcementWarningList); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 查询执法预警列表列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("code:LawEnforcementWarningList:queryList") |
||||
|
@GetMapping("/queryList") |
||||
|
@ResponseBody |
||||
|
public ZDResponse queryList(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
List<LawEnforcementWarningList> list = lawEnforcementWarningListService.selectLawEnforcementWarningListList(lawEnforcementWarningList); |
||||
|
return ZDResponse.success("查询成功",list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增执法预警列表 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() |
||||
|
{ |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存执法预警列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("code:LawEnforcementWarningList:add") |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public ZDResponse addSave(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
return lawEnforcementWarningListService.insertLawEnforcementWarningList(lawEnforcementWarningList) |
||||
|
> 0 ? ZDResponse.success("保存成功") : ZDResponse.error("保存成功"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改执法预警列表 |
||||
|
*/ |
||||
|
@GetMapping("/edit/{id}") |
||||
|
public String edit(@PathVariable("id") String id, ModelMap mmap) |
||||
|
{ |
||||
|
LawEnforcementWarningList lawEnforcementWarningList = lawEnforcementWarningListService.selectLawEnforcementWarningListById(id); |
||||
|
mmap.put("lawEnforcementWarningList", lawEnforcementWarningList); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存执法预警列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("code:LawEnforcementWarningList:edit") |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public ZDResponse editSave(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
return lawEnforcementWarningListService.updateLawEnforcementWarningList(lawEnforcementWarningList) |
||||
|
> 0 ? ZDResponse.success("修改成功"): ZDResponse.error("修改失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除执法预警列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("code:LawEnforcementWarningList:remove") |
||||
|
@PostMapping( "/remove") |
||||
|
@ResponseBody |
||||
|
public ZDResponse remove(String ids) |
||||
|
{ |
||||
|
return lawEnforcementWarningListService.deleteLawEnforcementWarningListByIds(ids) > 0? |
||||
|
ZDResponse.success("删除成功") : ZDResponse.error("删除失败"); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,132 @@ |
|||||
|
package com.zdxt.code.domain; |
||||
|
|
||||
|
import com.zdxt.common.BaseDomain; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 执法预警列表对象 law_enforcement_warning_list |
||||
|
* |
||||
|
* @author chenrui |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public class LawEnforcementWarningList extends BaseDomain |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键ID */ |
||||
|
private String id; |
||||
|
|
||||
|
/** 预警时间 */ |
||||
|
private Date warningTime; |
||||
|
|
||||
|
/** 预警原因 */ |
||||
|
private String warningCause; |
||||
|
|
||||
|
/** 预警级别: 1 一级 2 二级 3 三级 */ |
||||
|
private Integer warningLevel; |
||||
|
|
||||
|
/** 企业名称 */ |
||||
|
private String enterpriseName; |
||||
|
|
||||
|
/** 企业统一信用编码 */ |
||||
|
private String enterpriseNumber; |
||||
|
|
||||
|
/** 执法次数 */ |
||||
|
private Integer enforcementNumber; |
||||
|
|
||||
|
/** |
||||
|
* 搜索日期 |
||||
|
*/ |
||||
|
private String searchDate; |
||||
|
|
||||
|
public void setId(String id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
public void setWarningTime(Date warningTime) |
||||
|
{ |
||||
|
this.warningTime = warningTime; |
||||
|
} |
||||
|
|
||||
|
public Date getWarningTime() |
||||
|
{ |
||||
|
return warningTime; |
||||
|
} |
||||
|
public void setWarningCause(String warningCause) |
||||
|
{ |
||||
|
this.warningCause = warningCause; |
||||
|
} |
||||
|
|
||||
|
public String getWarningCause() |
||||
|
{ |
||||
|
return warningCause; |
||||
|
} |
||||
|
public void setWarningLevel(Integer warningLevel) |
||||
|
{ |
||||
|
this.warningLevel = warningLevel; |
||||
|
} |
||||
|
|
||||
|
public Integer getWarningLevel() |
||||
|
{ |
||||
|
return warningLevel; |
||||
|
} |
||||
|
public void setEnterpriseName(String enterpriseName) |
||||
|
{ |
||||
|
this.enterpriseName = enterpriseName; |
||||
|
} |
||||
|
|
||||
|
public String getEnterpriseName() |
||||
|
{ |
||||
|
return enterpriseName; |
||||
|
} |
||||
|
public void setEnterpriseNumber(String enterpriseNumber) |
||||
|
{ |
||||
|
this.enterpriseNumber = enterpriseNumber; |
||||
|
} |
||||
|
|
||||
|
public String getEnterpriseNumber() |
||||
|
{ |
||||
|
return enterpriseNumber; |
||||
|
} |
||||
|
|
||||
|
public static long getSerialVersionUID() { |
||||
|
return serialVersionUID; |
||||
|
} |
||||
|
|
||||
|
public Integer getEnforcementNumber() { |
||||
|
return enforcementNumber; |
||||
|
} |
||||
|
|
||||
|
public void setEnforcementNumber(Integer enforcementNumber) { |
||||
|
this.enforcementNumber = enforcementNumber; |
||||
|
} |
||||
|
|
||||
|
public String getSearchDate() { |
||||
|
return searchDate; |
||||
|
} |
||||
|
|
||||
|
public void setSearchDate(String searchDate) { |
||||
|
this.searchDate = searchDate; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("warningTime", getWarningTime()) |
||||
|
.append("warningCause", getWarningCause()) |
||||
|
.append("warningLevel", getWarningLevel()) |
||||
|
.append("createTime", getCreateTime()) |
||||
|
.append("enterpriseName", getEnterpriseName()) |
||||
|
.append("enterpriseNumber", getEnterpriseNumber()) |
||||
|
.toString(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.zdxt.code.mapper; |
||||
|
|
||||
|
import com.zdxt.code.domain.LawEnforcementWarningList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 执法预警列表Mapper接口 |
||||
|
* |
||||
|
* @author chenrui |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface LawEnforcementWarningListMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询执法预警列表 |
||||
|
* |
||||
|
* @param id 执法预警列表ID |
||||
|
* @return 执法预警列表 |
||||
|
*/ |
||||
|
public LawEnforcementWarningList selectLawEnforcementWarningListById(String id); |
||||
|
|
||||
|
/** |
||||
|
* 查询执法预警列表列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 执法预警列表集合 |
||||
|
*/ |
||||
|
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList); |
||||
|
|
||||
|
/** |
||||
|
* 新增执法预警列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList); |
||||
|
|
||||
|
/** |
||||
|
* 修改执法预警列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList); |
||||
|
|
||||
|
/** |
||||
|
* 删除执法预警列表 |
||||
|
* |
||||
|
* @param id 执法预警列表ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteLawEnforcementWarningListById(String id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除执法预警列表 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteLawEnforcementWarningListByIds(String[] ids); |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.zdxt.code.service; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 获取登录令牌接口 包含粤政易,市认证平台 |
||||
|
*/ |
||||
|
public interface IAccessTokenService { |
||||
|
|
||||
|
/** |
||||
|
* 获取粤政易令牌 |
||||
|
*/ |
||||
|
void getYZYToken(Map<String,Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 获取市认证平台token |
||||
|
* @param params |
||||
|
*/ |
||||
|
void getSRZToken(Map<String,Object> params); |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.zdxt.code.service; |
||||
|
|
||||
|
import com.zdxt.code.domain.LawEnforcementWarningList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 执法预警列表Service接口 |
||||
|
* |
||||
|
* @author chenrui |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface ILawEnforcementWarningListService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询执法预警列表 |
||||
|
* |
||||
|
* @param id 执法预警列表ID |
||||
|
* @return 执法预警列表 |
||||
|
*/ |
||||
|
public LawEnforcementWarningList selectLawEnforcementWarningListById(String id); |
||||
|
|
||||
|
/** |
||||
|
* 查询执法预警列表列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 执法预警列表集合 |
||||
|
*/ |
||||
|
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList); |
||||
|
|
||||
|
/** |
||||
|
* 新增执法预警列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList); |
||||
|
|
||||
|
/** |
||||
|
* 修改执法预警列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除执法预警列表 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteLawEnforcementWarningListByIds(String ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除执法预警列表信息 |
||||
|
* |
||||
|
* @param id 执法预警列表ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteLawEnforcementWarningListById(String id); |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
package com.zdxt.code.service; |
||||
|
|
||||
|
/** |
||||
|
* 市认证 |
||||
|
*/ |
||||
|
public interface SRZApiService { |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.zdxt.code.service; |
||||
|
|
||||
|
/** |
||||
|
* 对接粤政易接口 |
||||
|
*/ |
||||
|
public interface YZYApiService { |
||||
|
|
||||
|
void getUserInfo(); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.zdxt.code.service.impl; |
||||
|
|
||||
|
import com.zdxt.code.service.IAccessTokenService; |
||||
|
import com.zdxt.code.utils.HttpUtil; |
||||
|
import org.apache.poi.hssf.record.DVALRecord; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 获取登录令牌接口 包含粤政易,市认证平台 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class AccessTokenServiceImpl implements IAccessTokenService { |
||||
|
|
||||
|
//粤政易 认证信息
|
||||
|
// @Value("${yzy.yzyUr}")
|
||||
|
private String YZYUrl; |
||||
|
// @Value("${yzy.corpid}")
|
||||
|
private String YZYCorpid; |
||||
|
// @Value("${yzy.corpsecret}")
|
||||
|
private String YZYCorpsecret; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void getYZYToken(Map<String, Object> params) { |
||||
|
|
||||
|
try { |
||||
|
//获取粤政易令牌信息
|
||||
|
String s = HttpUtil.HttpSendGet(YZYUrl + "/ebus/yzyapi/cgi-bin/gettoken?corpid=" + YZYCorpid + |
||||
|
"&corpsecret=" + YZYCorpsecret, ""); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void getSRZToken(Map<String, Object> params) { |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,98 @@ |
|||||
|
package com.zdxt.code.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import cn.hutool.core.convert.Convert; |
||||
|
import com.zdxt.common.util.DateUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.zdxt.code.mapper.LawEnforcementWarningListMapper; |
||||
|
import com.zdxt.code.domain.LawEnforcementWarningList; |
||||
|
import com.zdxt.code.service.ILawEnforcementWarningListService; |
||||
|
|
||||
|
/** |
||||
|
* 执法预警列表Service业务层处理 |
||||
|
* |
||||
|
* @author chenrui |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class LawEnforcementWarningListServiceImpl implements ILawEnforcementWarningListService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private LawEnforcementWarningListMapper lawEnforcementWarningListMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询执法预警列表 |
||||
|
* |
||||
|
* @param id 执法预警列表ID |
||||
|
* @return 执法预警列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public LawEnforcementWarningList selectLawEnforcementWarningListById(String id) |
||||
|
{ |
||||
|
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询执法预警列表列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 执法预警列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListList(lawEnforcementWarningList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增执法预警列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
lawEnforcementWarningList.setCreateTime(DateUtils.getNowDate()); |
||||
|
return lawEnforcementWarningListMapper.insertLawEnforcementWarningList(lawEnforcementWarningList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改执法预警列表 |
||||
|
* |
||||
|
* @param lawEnforcementWarningList 执法预警列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList) |
||||
|
{ |
||||
|
lawEnforcementWarningList.setUpdateTime(DateUtils.getNowDate()); |
||||
|
return lawEnforcementWarningListMapper.updateLawEnforcementWarningList(lawEnforcementWarningList); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除执法预警列表对象 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteLawEnforcementWarningListByIds(String ids) |
||||
|
{ |
||||
|
return lawEnforcementWarningListMapper.deleteLawEnforcementWarningListByIds(Convert.toStrArray(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除执法预警列表信息 |
||||
|
* |
||||
|
* @param id 执法预警列表ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteLawEnforcementWarningListById(String id) |
||||
|
{ |
||||
|
return lawEnforcementWarningListMapper.deleteLawEnforcementWarningListById(id); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,58 @@ |
|||||
|
package com.zdxt.code.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import com.zdxt.code.service.IAccessTokenService; |
||||
|
import com.zdxt.code.service.YZYApiService; |
||||
|
import com.zdxt.code.utils.HttpUtil; |
||||
|
import com.zdxt.code.utils.PasswordTools; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class YZYApiServiceImpl implements YZYApiService { |
||||
|
|
||||
|
@Autowired |
||||
|
private IAccessTokenService accessTokenService; |
||||
|
|
||||
|
//应用ID
|
||||
|
private String paasid; |
||||
|
//粤政易 认证信息
|
||||
|
// @Value("${yzy.yzyUr}")
|
||||
|
private String YZYUrl; |
||||
|
// @Value("${yzy.corpid}")
|
||||
|
private String YZYCorpid; |
||||
|
// @Value("${yzy.corpsecret}")
|
||||
|
private String YZYCorpsecret; |
||||
|
|
||||
|
@Override |
||||
|
public void getUserInfo() { |
||||
|
|
||||
|
//随机ID
|
||||
|
String nonceId = IdUtil.simpleUUID(); |
||||
|
//当前时间戳
|
||||
|
long unix = System.currentTimeMillis(); |
||||
|
String token = ""; |
||||
|
//获取登录令牌
|
||||
|
accessTokenService.getYZYToken(null); |
||||
|
String h256Str = unix + token + nonceId + unix; |
||||
|
String s = PasswordTools.SHA256(h256Str); |
||||
|
|
||||
|
Map<String,Object> headerParams = new HashMap<>(); |
||||
|
headerParams.put("x-tif-paasid",paasid); |
||||
|
headerParams.put("x-tif-signature",s); |
||||
|
headerParams.put("x-tif-timestamp",unix); |
||||
|
//粤政易参数
|
||||
|
headerParams.put("x-tif-nonce", nonceId); |
||||
|
|
||||
|
try { |
||||
|
HttpUtil.HttpSendPost(YZYUrl + "/ebus/yzyapi/cgi_bin/gettoken?corpid=wl2bee594e73&corpsecret=",null,headerParams,""); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,187 @@ |
|||||
|
package com.zdxt.code.utils; |
||||
|
|
||||
|
import cn.hutool.core.map.MapUtil; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.zdxt.auth.dto.DictDataBean; |
||||
|
import com.zdxt.common.util.StringUtils; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.http.Header; |
||||
|
import org.apache.http.HttpEntity; |
||||
|
import org.apache.http.NameValuePair; |
||||
|
import org.apache.http.client.config.RequestConfig; |
||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity; |
||||
|
import org.apache.http.client.methods.CloseableHttpResponse; |
||||
|
import org.apache.http.client.methods.HttpDelete; |
||||
|
import org.apache.http.client.methods.HttpGet; |
||||
|
import org.apache.http.client.methods.HttpPost; |
||||
|
import org.apache.http.config.Registry; |
||||
|
import org.apache.http.config.RegistryBuilder; |
||||
|
import org.apache.http.conn.socket.ConnectionSocketFactory; |
||||
|
import org.apache.http.conn.socket.PlainConnectionSocketFactory; |
||||
|
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
||||
|
import org.apache.http.entity.StringEntity; |
||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||
|
import org.apache.http.impl.client.HttpClients; |
||||
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
||||
|
import org.apache.http.message.BasicHeader; |
||||
|
import org.apache.http.message.BasicNameValuePair; |
||||
|
import org.apache.http.util.EntityUtils; |
||||
|
|
||||
|
import javax.net.ssl.SSLContext; |
||||
|
import javax.net.ssl.TrustManager; |
||||
|
import javax.net.ssl.X509TrustManager; |
||||
|
import java.security.cert.X509Certificate; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
@Slf4j |
||||
|
public class HttpUtil { |
||||
|
|
||||
|
public static String getDictName(List<DictDataBean> list, String name){ |
||||
|
String value = ""; |
||||
|
for(DictDataBean bean : list){ |
||||
|
if(name.equals(bean.getDictLabel())){ |
||||
|
value = bean.getDictValue(); |
||||
|
return value; |
||||
|
} |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public static String HttpSendPost(String url, Map<String,? extends Object> param,Map<String,? extends Object> headerParams,String accessToken) throws Exception{ |
||||
|
HttpPost post = new HttpPost(url); |
||||
|
log.info("url:"+url); |
||||
|
log.info("param:"+ JSONObject.toJSONString(param)); |
||||
|
CloseableHttpResponse response=null; |
||||
|
SSLContext sc = SSLContext.getInstance("SSL"); |
||||
|
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
||||
|
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create() |
||||
|
.register("http", PlainConnectionSocketFactory.INSTANCE) |
||||
|
.register("https",new SSLConnectionSocketFactory(sc)) |
||||
|
.build(); |
||||
|
PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(registry); |
||||
|
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(manager).build(); |
||||
|
if(null != param){ |
||||
|
HttpEntity entity = new StringEntity(JSONObject.toJSONString(param),"utf-8"); |
||||
|
post.setEntity(entity); |
||||
|
} |
||||
|
RequestConfig config = RequestConfig.custom(). |
||||
|
setConnectTimeout(300000). |
||||
|
setSocketTimeout(300000). |
||||
|
build(); |
||||
|
post.setConfig(config); |
||||
|
if(StringUtils.isNotEmpty(accessToken)){ |
||||
|
post.setHeader("accessToken",accessToken); |
||||
|
} |
||||
|
if(MapUtil.isNotEmpty(headerParams)){ |
||||
|
Set<String> strings = headerParams.keySet(); |
||||
|
for (Object o : strings) { |
||||
|
System.out.println(o+""+headerParams.get(o)); |
||||
|
post.setHeader(o.toString(),headerParams.get(o).toString()); |
||||
|
} |
||||
|
} |
||||
|
post.setHeader("Content-Type","application/json"); |
||||
|
|
||||
|
response = httpClient.execute(post); |
||||
|
return EntityUtils.toString(response.getEntity(),"utf-8"); |
||||
|
} |
||||
|
|
||||
|
public static String HttpSendGet(String url,String accessToken) throws Exception{ |
||||
|
HttpGet httpGet = new HttpGet(url); |
||||
|
CloseableHttpResponse response=null; |
||||
|
SSLContext sc = SSLContext.getInstance("SSL"); |
||||
|
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
||||
|
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create() |
||||
|
.register("http", PlainConnectionSocketFactory.INSTANCE) |
||||
|
.register("https",new SSLConnectionSocketFactory(sc)) |
||||
|
.build(); |
||||
|
PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(registry); |
||||
|
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(manager).build(); |
||||
|
RequestConfig config = RequestConfig.custom(). |
||||
|
setConnectTimeout(300000). |
||||
|
setSocketTimeout(300000). |
||||
|
build(); |
||||
|
httpGet.setConfig(config); |
||||
|
httpGet.setHeader("accessToken",accessToken); |
||||
|
httpGet.setHeader("Content-Type","application/json"); |
||||
|
response = httpClient.execute(httpGet); |
||||
|
return EntityUtils.toString(response.getEntity(),"utf-8"); |
||||
|
} |
||||
|
|
||||
|
public static String HttpSendDelete(String url,Map<String,? extends Object> param,String accessToken) throws Exception{ |
||||
|
HttpDelete httpDelete = new HttpDelete(url); |
||||
|
CloseableHttpResponse response = null; |
||||
|
SSLContext sc = SSLContext.getInstance("SSL"); |
||||
|
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
||||
|
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create() |
||||
|
.register("http", PlainConnectionSocketFactory.INSTANCE) |
||||
|
.register("https",new SSLConnectionSocketFactory(sc)) |
||||
|
.build(); |
||||
|
PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(registry); |
||||
|
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(manager).build(); |
||||
|
RequestConfig config = RequestConfig.custom(). |
||||
|
setConnectTimeout(3000). |
||||
|
setSocketTimeout(3000). |
||||
|
build(); |
||||
|
httpDelete.setConfig(config); |
||||
|
httpDelete.setHeader("accessToken",accessToken); |
||||
|
httpDelete.setHeader("Content-Type","application/json"); |
||||
|
response = httpClient.execute(httpDelete); |
||||
|
return EntityUtils.toString(response.getEntity(),"utf-8"); |
||||
|
} |
||||
|
|
||||
|
public static String HttpSendForm(String url, Map<String,String> param,String accessToken) throws Exception{ |
||||
|
HttpPost post = new HttpPost(url); |
||||
|
List<NameValuePair> paramList = new ArrayList<>(); |
||||
|
for(String key : param.keySet()){ |
||||
|
NameValuePair pair = new BasicNameValuePair(key,param.get(key)); |
||||
|
paramList.add(pair); |
||||
|
} |
||||
|
CloseableHttpResponse response=null; |
||||
|
SSLContext sc = SSLContext.getInstance("SSL"); |
||||
|
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
||||
|
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create() |
||||
|
.register("http", PlainConnectionSocketFactory.INSTANCE) |
||||
|
.register("https",new SSLConnectionSocketFactory(sc)) |
||||
|
.build(); |
||||
|
PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(registry); |
||||
|
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(manager).build(); |
||||
|
HttpEntity entity = new UrlEncodedFormEntity(paramList,"utf-8"); |
||||
|
post.setEntity(entity); |
||||
|
RequestConfig config = RequestConfig.custom(). |
||||
|
setConnectTimeout(3000). |
||||
|
setSocketTimeout(3000). |
||||
|
build(); |
||||
|
post.setConfig(config); |
||||
|
if(StringUtils.isNotEmpty(accessToken)){ |
||||
|
Header header = new BasicHeader("accessToken",accessToken); |
||||
|
post.setHeader(header); |
||||
|
} |
||||
|
response = httpClient.execute(post); |
||||
|
return EntityUtils.toString(response.getEntity(),"utf-8"); |
||||
|
} |
||||
|
|
||||
|
public static class TrustAnyTrustManager implements X509TrustManager |
||||
|
{ |
||||
|
@Override |
||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public X509Certificate[] getAcceptedIssuers() |
||||
|
{ |
||||
|
return new X509Certificate[] {}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
<?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.zdxt.code.mapper.LawEnforcementWarningListMapper"> |
||||
|
|
||||
|
<resultMap type="LawEnforcementWarningList" id="LawEnforcementWarningListResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="warningTime" column="warning_time" /> |
||||
|
<result property="warningCause" column="warning_cause" /> |
||||
|
<result property="warningLevel" column="warning_level" /> |
||||
|
<result property="createTime" column="create_time" /> |
||||
|
<result property="enterpriseName" column="enterprise_name" /> |
||||
|
<result property="enterpriseNumber" column="enterprise_number" /> |
||||
|
<result property="enforcementNumber" column="enforcement_number" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectLawEnforcementWarningListVo"> |
||||
|
select id, warning_time, warning_cause, warning_level, create_time, enterprise_name, enterprise_number,enforcement_number from law_enforcement_warning_list |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectLawEnforcementWarningListList" parameterType="LawEnforcementWarningList" resultMap="LawEnforcementWarningListResult"> |
||||
|
<include refid="selectLawEnforcementWarningListVo"/> |
||||
|
<where> |
||||
|
<if test="warningTime != null "> and warning_time = #{warningTime}</if> |
||||
|
<if test="warningCause != null and warningCause != ''"> and warning_cause = #{warningCause}</if> |
||||
|
<if test="warningLevel != null "> and warning_level = #{warningLevel}</if> |
||||
|
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if> |
||||
|
<if test="enterpriseNumber != null and enterpriseNumber != ''"> and enterprise_number = #{enterpriseNumber}</if> |
||||
|
<if test="searchValue != null and searchValue != ''"> and ( |
||||
|
enterprise_name like concat('%',#{searchValue},'%') |
||||
|
)</if> |
||||
|
<if test="searchDate != null and searchDate != ''"> |
||||
|
and DATE_FORMAT(warning_time, '%Y-%m') = #{searchDate} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectLawEnforcementWarningListById" parameterType="String" resultMap="LawEnforcementWarningListResult"> |
||||
|
<include refid="selectLawEnforcementWarningListVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertLawEnforcementWarningList" parameterType="LawEnforcementWarningList"> |
||||
|
insert into law_enforcement_warning_list |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null and id != ''">id,</if> |
||||
|
<if test="warningTime != null ">warning_time,</if> |
||||
|
<if test="warningCause != null and warningCause != ''">warning_cause,</if> |
||||
|
<if test="warningLevel != null ">warning_level,</if> |
||||
|
<if test="createTime != null ">create_time,</if> |
||||
|
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name,</if> |
||||
|
<if test="enterpriseNumber != null and enterpriseNumber != ''">enterprise_number,</if> |
||||
|
<if test="enforcementNumber != null and enforcementNumber != ''">enforcement_number,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null and id != ''">#{id},</if> |
||||
|
<if test="warningTime != null ">#{warningTime},</if> |
||||
|
<if test="warningCause != null and warningCause != ''">#{warningCause},</if> |
||||
|
<if test="warningLevel != null ">#{warningLevel},</if> |
||||
|
<if test="createTime != null ">#{createTime},</if> |
||||
|
<if test="enterpriseName != null and enterpriseName != ''">#{enterpriseName},</if> |
||||
|
<if test="enterpriseNumber != null and enterpriseNumber != ''">#{enterpriseNumber},</if> |
||||
|
<if test="enforcementNumber != null and enforcementNumber != ''">#{enforcementNumber},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateLawEnforcementWarningList" parameterType="LawEnforcementWarningList"> |
||||
|
update law_enforcement_warning_list |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="warningTime != null ">warning_time = #{warningTime},</if> |
||||
|
<if test="warningCause != null and warningCause != ''">warning_cause = #{warningCause},</if> |
||||
|
<if test="warningLevel != null ">warning_level = #{warningLevel},</if> |
||||
|
<if test="createTime != null ">create_time = #{createTime},</if> |
||||
|
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name = #{enterpriseName},</if> |
||||
|
<if test="enterpriseNumber != null and enterpriseNumber != ''">enterprise_number = #{enterpriseNumber},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteLawEnforcementWarningListById" parameterType="String"> |
||||
|
delete from law_enforcement_warning_list where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteLawEnforcementWarningListByIds" parameterType="String"> |
||||
|
delete from law_enforcement_warning_list where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue