增加政务测试

master
杜函宇 2 days ago
parent 4639e020b7
commit e5e1ef80e1

@ -3,15 +3,18 @@ package com.ruoyi.docking.controller;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.docking.entity.ProjectProgress; import com.ruoyi.docking.entity.ProjectProgress;
import com.ruoyi.docking.entity.request.YdxxtjRequest; import com.ruoyi.docking.entity.request.YdxxtjRequest;
import com.ruoyi.docking.service.ProjectProgressService; import com.ruoyi.docking.service.ProjectProgressService;
import com.ruoyi.gysl.entity.BuildingInformation;
import com.ruoyi.gysl.entity.request.ZwIdPageReq; import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
@ -94,5 +97,16 @@ public class ProjectProgressController extends BaseController {
public AjaxResult ydxxtj(@Valid YdxxtjRequest projectLegend) { public AjaxResult ydxxtj(@Valid YdxxtjRequest projectLegend) {
return success(projectProgressService.ydxxtj(projectLegend)); return success(projectProgressService.ydxxtj(projectLegend));
} }
/**
*
*/
@ApiOperation(value = "根据条件导出所有月度信息")
@PostMapping(value = "/export")
public void export(HttpServletResponse response, @Valid ZwIdPageReq zwIdPageReq) throws Exception {
List<ProjectProgress> p1 = projectProgressService.page( zwIdPageReq);
ExcelUtil<ProjectProgress> util = new ExcelUtil<>(ProjectProgress.class);
util.exportExcel(response, p1, "月度信息");
}
} }

@ -4,6 +4,7 @@ package com.ruoyi.docking.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -39,15 +40,18 @@ public class ProjectProgress {
@ApiModelProperty(value ="月份" ) @ApiModelProperty(value ="月份" )
@Excel(name = "月份")
@NotBlank(message = "请填写月份") @NotBlank(message = "请填写月份")
private String month; private String month;
@ApiModelProperty(value ="状态" ) @ApiModelProperty(value ="状态" )
@Excel(name = "状态")
private String status; private String status;
@ApiModelProperty(value ="本月完成投资" ) @ApiModelProperty(value ="本月完成投资" )
@Excel(name = "当月完成投资")
private Float monthDoneAmount; private Float monthDoneAmount;
@ -56,6 +60,7 @@ public class ProjectProgress {
@ApiModelProperty(value ="项目累计完成投资" ) @ApiModelProperty(value ="项目累计完成投资" )
@Excel(name = "累计完成投资")
private Float totalDoneAmount; private Float totalDoneAmount;
@ -135,9 +140,11 @@ public class ProjectProgress {
private Float nextTax; private Float nextTax;
//--------------- //---------------
@ApiModelProperty(value ="截止目前累计建成面积(平方米)" ) @ApiModelProperty(value ="截止目前累计建成面积(平方米)" )
@Excel(name = "截止目前累计建成面积(平方米)")
private String jzmqjc; private String jzmqjc;
@ApiModelProperty(value ="项目进展详情" ) @ApiModelProperty(value ="项目进展详情" )
@Excel(name = "项目进展详情")
private String xmjzxq; private String xmjzxq;
} }

@ -34,10 +34,6 @@ public interface ProjectProgressMapper extends BaseMapper<ProjectProgress> {
*/ */
List<ProjectProgress> getXmId(@Param("id")Long id); List<ProjectProgress> getXmId(@Param("id")Long id);
/**
*
*/
@DataSource(value = DataSourceType.SLAVE)
List<YdxxtjResponse> ydxxtj();
} }

@ -10,6 +10,7 @@ import com.ruoyi.gysl.entity.BasicInformation;
import com.ruoyi.gysl.entity.request.ZwIdPageReq; import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.YdxxtjResponse; import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import com.ruoyi.gysl.service.BasicInformationService; import com.ruoyi.gysl.service.BasicInformationService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -35,6 +36,9 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
@Resource @Resource
private ProjectProgressMapper projectProgressMapper; private ProjectProgressMapper projectProgressMapper;
@Value("${isZs}")
private Boolean isZs;
/** /**
* *
* *
@ -46,7 +50,10 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
//查询对应的项目基础信息数据 //查询对应的项目基础信息数据
BasicInformation byId = basicInformationService.getById(zwIdPageReq.getXmId()); BasicInformation byId = basicInformationService.getById(zwIdPageReq.getXmId());
//获取对接的数据 //获取对接的数据
List<ProjectProgress> page = projectProgressMapper.page(byId.getName()); List<ProjectProgress> page = new ArrayList<>();
if (isZs) {
page = projectProgressMapper.page(byId.getName());
}
List<ProjectProgress> list = projectProgressMapper.getXmId(byId.getId()); List<ProjectProgress> list = projectProgressMapper.getXmId(byId.getId());
return new ArrayList<>(Stream.concat(list.stream(), page.stream()) return new ArrayList<>(Stream.concat(list.stream(), page.stream())
.collect(Collectors.toMap( .collect(Collectors.toMap(
@ -65,7 +72,10 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
//查询对应的项目基础信息数据 //查询对应的项目基础信息数据
BasicInformation byId = basicInformationService.getById(zwIdPageReq.getXmId()); BasicInformation byId = basicInformationService.getById(zwIdPageReq.getXmId());
//获取对接的数据 //获取对接的数据
List<ProjectProgress> page = projectProgressMapper.page(byId.getName()); List<ProjectProgress> page = new ArrayList<>();
if (isZs) {
page = projectProgressMapper.page(byId.getName());
}
List<ProjectProgress> list = projectProgressMapper.getXmId(byId.getId()); List<ProjectProgress> list = projectProgressMapper.getXmId(byId.getId());
List<ProjectProgress> projectProgresses = new ArrayList<>(Stream.concat(list.stream(), page.stream()) List<ProjectProgress> projectProgresses = new ArrayList<>(Stream.concat(list.stream(), page.stream())
.collect(Collectors.toMap( .collect(Collectors.toMap(
@ -75,27 +85,35 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
)) ))
.values()); .values());
List<YdxxtjResponse> res = new ArrayList<>(); List<YdxxtjResponse> res = new ArrayList<>();
if(zwIdPageReq.getType() == 1){ if (zwIdPageReq.getType() == 1) {
projectProgresses.forEach(x -> { projectProgresses.forEach(x -> {
if (x.getMonth() != null && x.getMonth().substring(0, 4).equals(zwIdPageReq.getYears())) { if (x.getMonth() != null && x.getMonth().substring(0, 4).equals(zwIdPageReq.getYears())) {
YdxxtjResponse yd = new YdxxtjResponse(); YdxxtjResponse yd = new YdxxtjResponse();
yd.setMonth(x.getMonth()); yd.setMonth(x.getMonth());
yd.setYtze(BigDecimal.valueOf(x.getMonthDoneAmount())); yd.setYtze(BigDecimal.valueOf(x.getMonthDoneAmount()));
yd.setYtzbl(BigDecimal.valueOf(x.getMonthDoneAmount()).divide(byId.getJhtze(), RoundingMode.HALF_UP)); if(byId.getJhtze()==null||x.getMonthDoneAmount()==null){
yd.setYtzbl(new BigDecimal(0));
}else {
yd.setYtzbl(BigDecimal.valueOf(x.getMonthDoneAmount()).divide(byId.getJhtze(), RoundingMode.HALF_UP));
}
yd.setLjtze(BigDecimal.valueOf(x.getTotalDoneAmount())); yd.setLjtze(BigDecimal.valueOf(x.getTotalDoneAmount()));
res.add(yd); res.add(yd);
} }
}); });
return res; return res;
}else if(zwIdPageReq.getType() == 2){ } else if (zwIdPageReq.getType() == 2) {
YdxxtjResponse yd1 = new YdxxtjResponse(); YdxxtjResponse yd1 = new YdxxtjResponse();
yd1.setJd(1); yd1.setJd(1);
yd1.setJdtze(new BigDecimal(0));
YdxxtjResponse yd2 = new YdxxtjResponse(); YdxxtjResponse yd2 = new YdxxtjResponse();
yd2.setJd(2); yd2.setJd(2);
yd2.setJdtze(new BigDecimal(0));
YdxxtjResponse yd3 = new YdxxtjResponse(); YdxxtjResponse yd3 = new YdxxtjResponse();
yd3.setJd(3); yd3.setJd(3);
yd3.setJdtze(new BigDecimal(0));
YdxxtjResponse yd4 = new YdxxtjResponse(); YdxxtjResponse yd4 = new YdxxtjResponse();
yd4.setJd(4); yd4.setJd(4);
yd4.setJdtze(new BigDecimal(0));
res.add(yd1); res.add(yd1);
res.add(yd2); res.add(yd2);
res.add(yd3); res.add(yd3);
@ -106,14 +124,14 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
// 计算季度1~3月为Q14~6月为Q27~9月为Q310~12月为Q4 // 计算季度1~3月为Q14~6月为Q27~9月为Q310~12月为Q4
int quarter = (Integer.parseInt(monthStr) - 1) / 3 + 1; int quarter = (Integer.parseInt(monthStr) - 1) / 3 + 1;
for (YdxxtjResponse re : res) { for (YdxxtjResponse re : res) {
if(re.getJd()==quarter){ if (re.getJd() == quarter) {
re.setJdtze(re.getJdtze().add(BigDecimal.valueOf(x.getMonthDoneAmount()))); re.setJdtze(re.getJdtze().add(BigDecimal.valueOf(x.getMonthDoneAmount())));
} }
} }
} }
}); });
return res; return res;
}else { } else {
throw new ServiceException("查询失败"); throw new ServiceException("查询失败");
} }
} }

@ -10,6 +10,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.gysl.login.dto.request.UserInfoRequestDTO; import com.ruoyi.gysl.login.dto.request.UserInfoRequestDTO;
import com.ruoyi.gysl.login.dto.response.ChiefResponse; import com.ruoyi.gysl.login.dto.response.ChiefResponse;
import com.ruoyi.gysl.login.dto.response.ThirdUserInfoResponse; import com.ruoyi.gysl.login.dto.response.ThirdUserInfoResponse;
import com.ruoyi.gysl.login.service.LoginTokenService;
import com.ruoyi.gysl.login.util.HMAC256Config; import com.ruoyi.gysl.login.util.HMAC256Config;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -50,6 +52,8 @@ public class ChiefController {
@Value("${getAllInfo}") @Value("${getAllInfo}")
private String getAllInfo; private String getAllInfo;
@Resource
private LoginTokenService loginTokenService;
@ApiOperation("政务端登录") @ApiOperation("政务端登录")
@GetMapping @GetMapping
@ -88,8 +92,9 @@ public class ChiefController {
JSONObject dataJson = JSONUtil.parseObj(getMain.body()); JSONObject dataJson = JSONUtil.parseObj(getMain.body());
ChiefResponse bean = JSONUtil.toBean(dataJson, ChiefResponse.class); ChiefResponse bean = JSONUtil.toBean(dataJson, ChiefResponse.class);
//判断几个政务端用户,等待商量结果 //判断几个政务端用户,等待商量结果
//lj 102 其他是100 //要给dept部门id bean.setToken(loginTokenService.singleLogin(bean.getAccountName(),
// bean.setToken(singleLoginService.singleLogin(bean.getAccountName(), bean.getName(), null, "02", bean.getMobile(),bean.getEmail())); bean.getName(), null,
"01", bean.getMobile(),bean.getEmail()));
return AjaxResult.success(bean); return AjaxResult.success(bean);
} else { } else {
throw new ServiceException("登陆失败"); throw new ServiceException("登陆失败");
@ -102,24 +107,24 @@ public class ChiefController {
} }
@ApiOperation("政务根据信用代码返回跳转路由") // @ApiOperation("政务根据信用代码返回跳转路由")
@GetMapping("/returnUrl") // @GetMapping("/returnUrl")
public AjaxResult returnUrl(@RequestParam("code") String code, // public AjaxResult returnUrl(@RequestParam("code") String code,
@RequestParam("userToken") String userToken) throws Exception { // @RequestParam("userToken") String userToken) throws Exception {
//请求的地址 // //请求的地址
StringBuilder url = new StringBuilder("http://qyt.sipac.gov.cn/sipsg-enterprise-mobile-manage/#/loginVerify?"); // StringBuilder url = new StringBuilder("http://172.21.10.12/sipsg-enterprise-mobile-manage/#/loginVerify?");
//当前时间的时间戳 // //当前时间的时间戳
String timespan = Long.toString(System.currentTimeMillis()); // String timespan = Long.toString(System.currentTimeMillis());
UserInfoRequestDTO req = new UserInfoRequestDTO(); // UserInfoRequestDTO req = new UserInfoRequestDTO();
req.setClientId(clientId); // req.setClientId(clientId);
req.setUserToken(userToken); // req.setUserToken(userToken);
String signature = Base64.encode(HMAC256Config.HmacSHA256(JSONUtil.parse(req).toString() + timespan, clientSecret)); // String signature = Base64.encode(HMAC256Config.HmacSHA256(JSONUtil.parse(req).toString() + timespan, clientSecret));
url.append("signature=").append(signature); // url.append("signature=").append(signature);
url.append("&timespan=").append(timespan); // url.append("&timespan=").append(timespan);
url.append("&userToken=").append(userToken); // url.append("&userToken=").append(userToken);
url.append("&gourl=") // url.append("&gourl=")
.append(URLEncoder.encode("https://qyt.sipac.gov.cn/sipsg-enterprise-mobile-manage/#/workPlat/search/enterprise/detail?id="+code,"UTF-8")); // .append(URLEncoder.encode("https://172.21.10.12/sipsg-enterprise-mobile-manage/#/workPlat/search/enterprise/detail?id="+code,"UTF-8"));
url.append("&clientid=").append(clientId); // url.append("&clientid=").append(clientId);
return AjaxResult.success(url.toString()); // return AjaxResult.success(url.toString());
} // }
} }

@ -0,0 +1,15 @@
package com.ruoyi.gysl.login.service;
/**
*
* @author du
* @since 2025/5/9 2:24
*/
public interface LoginTokenService {
/**
* token
*/
String singleLogin(String accountName, String name, String a, String b, String mobile,String email);
}

@ -0,0 +1,91 @@
package com.ruoyi.gysl.login.service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
*
*
* @author du
* @since 2025/5/9 2:30
*/
@Service
public class LoginTokenServiceImpl implements LoginTokenService {
@Resource
private ISysUserService userService;
@Resource
private AuthenticationManager authenticationManager;
@Resource
private TokenService tokenService;
@Override
public String singleLogin(String accountName,
String name,
String a,
String type,
String mobile,
String email) {
// 用户验证
Authentication authentication;
try {
SysUser user = new SysUser();
user.setUserName(accountName);
user.setNickName(name);
user.setPassword("Gysl@2025//**...");
user.setPhonenumber(mobile);
user.setEmail(email);
Long[] roles = new Long[1];
if ("01".equals(type)) {
roles[0] = 2L;
} else if ("02".equals(type)) {
roles[0] = 100L;
}
user.setRoleIds(roles);
user.setStatus("0");
//如果用户名也就是信用代码没有重复的就新增用户
if (userService.checkUserNameUnique(user)) {
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
userService.insertUser(user);
}
//新增user账号密码
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(accountName, "Gysl@2025//**...");
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
} catch (Exception e) {
if (e instanceof BadCredentialsException) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(accountName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(accountName, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
} finally {
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(accountName, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
return tokenService.createToken(loginUser);
}
}

@ -59,3 +59,5 @@ spring:
wall: wall:
config: config:
multi-statement-allow: true multi-statement-allow: true
# 是否是正式环境
isZs: false

@ -114,3 +114,5 @@ swagger:
enabled: false enabled: false
# 请求前缀 # 请求前缀
pathMapping: / pathMapping: /
# 是否是正式环境
isZs: true

@ -1,9 +1,9 @@
# 项目相关配置 # 项目相关配置
ruoyi: ruoyi:
# 名称 # 名称
name: RuoYi name: gysl
# 版本 # 版本
version: 3.8.9 version: 0.8.1
# 版权年份 # 版权年份
copyrightYear: 2025 copyrightYear: 2025
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
@ -52,7 +52,7 @@ spring:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: druid active: internet
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
@ -127,6 +127,8 @@ xss:
excludes: /system/notice excludes: /system/notice
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
# 是否是正式环境
isZs: false
#政务端clientId #政务端clientId
clientId: 9911336a2b67451fb9e1d78131c0e5e9 clientId: 9911336a2b67451fb9e1d78131c0e5e9
#政务端clientSecret #政务端clientSecret
@ -134,6 +136,7 @@ clientSecret: fXckuZrxMdh6nl/ISI2WTg==
#政务端appkey #政务端appkey
appkey: db90cb33-6551-4d1f-875e-236d66af4fcc appkey: db90cb33-6551-4d1f-875e-236d66af4fcc
#政务端经济大脑(政务端)获取用户信息接口 #政务端经济大脑(政务端)获取用户信息接口
getInfoId: https://qyt.sipac.gov.cn/enterprise-gateway/sipsg-enterprise/sys/third/userInfo getInfoId: https://172.21.10.12/enterprise-gateway/sipsg-enterprise/sys/third/userInfo
#政务端政务通获取用户信息接口(可选) #政务端政务通获取用户信息接口(可选)
getAllInfo: http://uid.sipac.gov.cn/open/api/identity/data/FindUserById getAllInfo: http://172.21.10.14/open/api/identity/data/FindUserById

@ -81,7 +81,6 @@ public class SysLoginService {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
loginPreCheck(username, strP); loginPreCheck(username, strP);
//判断当前登录用户名是否符合loginRole //判断当前登录用户名是否符合loginRole
List<String> role = sysUserMapper.selectRoleByUserName(username); List<String> role = sysUserMapper.selectRoleByUserName(username);

Loading…
Cancel
Save