修改登录,增加统计

master
杜函宇 6 days ago
parent 5ede8ba0a8
commit 4639e020b7

@ -4,6 +4,7 @@ package com.ruoyi.docking.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.docking.entity.ProjectProgress;
import com.ruoyi.docking.entity.request.YdxxtjRequest;
import com.ruoyi.docking.service.ProjectProgressService;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import io.swagger.annotations.Api;
@ -84,5 +85,14 @@ public class ProjectProgressController extends BaseController {
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
return success(projectProgressService.removeByIds(idList));
}
/**
*
*/
@ApiOperation("项目月度信息投资统计")
@GetMapping("/ydxxtj")
public AjaxResult ydxxtj(@Valid YdxxtjRequest projectLegend) {
return success(projectProgressService.ydxxtj(projectLegend));
}
}

@ -0,0 +1,28 @@
package com.ruoyi.docking.entity.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
*
* @author du
* @since 2025/5/8 10:10
*/
@Data
public class YdxxtjRequest {
@NotNull(message = "年份不能为空!")
@ApiModelProperty("年份")
private String years;
@NotNull(message = "项目id不能为空!")
@ApiModelProperty("项目id")
private Long xmId;
@NotNull(message = "请选择类别!")
@ApiModelProperty("1年度 2季度")
private Integer type;
}

@ -6,6 +6,7 @@ import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.docking.entity.ProjectProgress;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -27,5 +28,16 @@ public interface ProjectProgressMapper extends BaseMapper<ProjectProgress> {
*/
@DataSource(value = DataSourceType.SLAVE)
List<ProjectProgress> page( @Param("name") String name);
/**
* id
*/
List<ProjectProgress> getXmId(@Param("id")Long id);
/**
*
*/
@DataSource(value = DataSourceType.SLAVE)
List<YdxxtjResponse> ydxxtj();
}

@ -3,7 +3,9 @@ package com.ruoyi.docking.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.docking.entity.ProjectProgress;
import com.ruoyi.docking.entity.request.YdxxtjRequest;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import javax.validation.Valid;
import java.util.List;
@ -23,5 +25,10 @@ public interface ProjectProgressService extends IService<ProjectProgress> {
* @return
*/
List<ProjectProgress> page( ZwIdPageReq zwIdPageReq);
/**
*
*/
List<YdxxtjResponse> ydxxtj(YdxxtjRequest projectLegend);
}

@ -1,19 +1,20 @@
package com.ruoyi.docking.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.docking.entity.ProjectProgress;
import com.ruoyi.docking.entity.request.YdxxtjRequest;
import com.ruoyi.docking.mapper.ProjectProgressMapper;
import com.ruoyi.docking.service.ProjectProgressService;
import com.ruoyi.gysl.entity.BasicInformation;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import com.ruoyi.gysl.service.BasicInformationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -33,6 +34,7 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
@Resource
private ProjectProgressMapper projectProgressMapper;
/**
*
*
@ -45,7 +47,7 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
BasicInformation byId = basicInformationService.getById(zwIdPageReq.getXmId());
//获取对接的数据
List<ProjectProgress> page = projectProgressMapper.page(byId.getName());
List<ProjectProgress> list = lambdaQuery().eq(ProjectProgress::getXmId, byId.getId()).list();
List<ProjectProgress> list = projectProgressMapper.getXmId(byId.getId());
return new ArrayList<>(Stream.concat(list.stream(), page.stream())
.collect(Collectors.toMap(
ProjectProgress::getMonth,
@ -54,5 +56,66 @@ public class ProjectProgressServiceImpl extends ServiceImpl<ProjectProgressMappe
))
.values());
}
/**
*
*/
@Override
public List<YdxxtjResponse> ydxxtj(YdxxtjRequest zwIdPageReq) {
//查询对应的项目基础信息数据
BasicInformation byId = basicInformationService.getById(zwIdPageReq.getXmId());
//获取对接的数据
List<ProjectProgress> page = projectProgressMapper.page(byId.getName());
List<ProjectProgress> list = projectProgressMapper.getXmId(byId.getId());
List<ProjectProgress> projectProgresses = new ArrayList<>(Stream.concat(list.stream(), page.stream())
.collect(Collectors.toMap(
ProjectProgress::getMonth,
v -> v,
(existing, replacement) -> existing // 冲突时保留现有值即list中的值
))
.values());
List<YdxxtjResponse> res = new ArrayList<>();
if(zwIdPageReq.getType() == 1){
projectProgresses.forEach(x -> {
if (x.getMonth() != null && x.getMonth().substring(0, 4).equals(zwIdPageReq.getYears())) {
YdxxtjResponse yd = new YdxxtjResponse();
yd.setMonth(x.getMonth());
yd.setYtze(BigDecimal.valueOf(x.getMonthDoneAmount()));
yd.setYtzbl(BigDecimal.valueOf(x.getMonthDoneAmount()).divide(byId.getJhtze(), RoundingMode.HALF_UP));
yd.setLjtze(BigDecimal.valueOf(x.getTotalDoneAmount()));
res.add(yd);
}
});
return res;
}else if(zwIdPageReq.getType() == 2){
YdxxtjResponse yd1 = new YdxxtjResponse();
yd1.setJd(1);
YdxxtjResponse yd2 = new YdxxtjResponse();
yd2.setJd(2);
YdxxtjResponse yd3 = new YdxxtjResponse();
yd3.setJd(3);
YdxxtjResponse yd4 = new YdxxtjResponse();
yd4.setJd(4);
res.add(yd1);
res.add(yd2);
res.add(yd3);
res.add(yd4);
projectProgresses.forEach(x -> {
if (x.getMonth() != null && x.getMonth().substring(0, 4).equals(zwIdPageReq.getYears())) {
String monthStr = x.getMonth().substring(5, 7); // 提取 "MM"
// 计算季度1~3月为Q14~6月为Q27~9月为Q310~12月为Q4
int quarter = (Integer.parseInt(monthStr) - 1) / 3 + 1;
for (YdxxtjResponse re : res) {
if(re.getJd()==quarter){
re.setJdtze(re.getJdtze().add(BigDecimal.valueOf(x.getMonthDoneAmount())));
}
}
}
});
return res;
}else {
throw new ServiceException("查询失败");
}
}
}

@ -38,14 +38,14 @@ public class QyStatsController extends BaseController {
return success(qyStatsService.allProject(SecurityUtils.getUsername()));
}
/**
*
*/
@ApiOperation("整体项目情况")
@GetMapping("/relationalProject")
public AjaxResult relationalProject() {
return success(qyStatsService.relationalProject(SecurityUtils.getUsername()));
}
// /**
// * 关联项目
// */
// @ApiOperation("关联项目")
// @GetMapping("/relationalProject")
// public AjaxResult relationalProject() {
// return success(qyStatsService.relationalProject(SecurityUtils.getUsername()));
// }
/**
*

@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.gysl.entity.BasicInformation;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.stats.AllProjectResponse;
import com.ruoyi.gysl.entity.stats.RibbonResponse;
import com.ruoyi.gysl.service.BasicInformationService;
@ -120,6 +121,15 @@ public class ZwStatsController extends BaseController {
}
/**
*
*/
@ApiOperation("储备项目统计分析")
@GetMapping("/cbxmtj")
public AjaxResult cbxmtj() {
return success(zwStatsService.cbxmtj());
}
/**
*
*/
@ -130,6 +140,8 @@ public class ZwStatsController extends BaseController {
}
/**
*
*/

@ -66,6 +66,12 @@ public class BasicInformation extends BaseModel {
@Excel(name = "施工单位", type = Excel.Type.EXPORT)
private String sgdw;
@ApiModelProperty("目录")
private Integer ml;
@ApiModelProperty("细分产业")
private Integer xfcy;
@ApiModelProperty("设计单位")
@Excel(name = "设计单位", type = Excel.Type.EXPORT)
private String sjdw;

@ -0,0 +1,33 @@
package com.ruoyi.gysl.entity.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
*
* @author du
* @since 2025/5/8 9:34
*/
@Data
public class YdxxtjResponse {
@ApiModelProperty("月度")
private String month;
@ApiModelProperty("季度")
private Integer jd;
@ApiModelProperty("季度投资额")
private BigDecimal jdtze;
@ApiModelProperty("月投资额")
private BigDecimal ytze;
@ApiModelProperty("月投资比例")
private BigDecimal ytzbl;
@ApiModelProperty("累计投资额")
private BigDecimal ljtze;
}

@ -12,7 +12,7 @@ import lombok.Data;
@Data
public class RibbonResponse {
@ApiModelProperty("所属功能区 / 单位性质 / 细分产业")
@ApiModelProperty("所属功能区 / 单位性质 / 细分产业 / 建设模式")
private String ssgnq;
@ApiModelProperty("数量")

@ -0,0 +1,125 @@
package com.ruoyi.gysl.login.controller;
import cn.hutool.core.codec.Base64;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.gysl.login.dto.request.UserInfoRequestDTO;
import com.ruoyi.gysl.login.dto.response.ChiefResponse;
import com.ruoyi.gysl.login.dto.response.ThirdUserInfoResponse;
import com.ruoyi.gysl.login.util.HMAC256Config;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.HashMap;
/**
*
*
* @author du
* @since 2024/6/4 9:53
*/
@Api(tags = "政务端单点登录")
@RequestMapping("/system/chief")
@RestController
public class ChiefController {
@Value("${clientId}")
private String clientId;
@Value("${clientSecret}")
private String clientSecret;
@Value("${appkey}")
private String appkey;
@Value("${getInfoId}")
private String getInfoId;
@Value("${getAllInfo}")
private String getAllInfo;
@ApiOperation("政务端登录")
@GetMapping
public AjaxResult login(
@RequestParam("userToken") String userToken,
@RequestParam("timespan") String timespan,
@RequestParam("signature") String signature
) throws Exception {
String encode = Base64.encode((HMAC256Config.HmacSHA256(clientId + timespan + userToken, clientSecret)));
if (encode.equals(signature)) {
//经济大脑(政务端)获取用户信息接口
UserInfoRequestDTO req = new UserInfoRequestDTO();
req.setClientId(clientId);
req.setUserToken(userToken);
//请求头
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
headers.put("signature", Base64.encode(HMAC256Config.HmacSHA256(JSONUtil.parse(req).toString() + timespan, clientSecret)));
headers.put("timespan", timespan);
//请求体
JSONObject jsonObject = new JSONObject();//存放参数
jsonObject.set("clientId", clientId);
jsonObject.set("userToken", userToken);
HttpResponse response = HttpRequest.post(getInfoId)
.addHeaders(headers)
.body(jsonObject.toString())
.execute();
// 获取响应状态码
if (response.getStatus() == 200) {
//经济大脑(政务端)获取用户信息接口
JSONObject jsonObj = JSONUtil.parseObj(response.body());
ThirdUserInfoResponse res = JSONUtil.toBean(jsonObj.get("data").toString(), ThirdUserInfoResponse.class);
//政务通获取用户信息接口(可选)
String getInfo = getAllInfo + "?id=" + res.getUserId() + "&appkey=" + appkey;
HttpResponse getMain = HttpRequest.get(getInfo).execute();
if (getMain.getStatus() == 200) {
JSONObject dataJson = JSONUtil.parseObj(getMain.body());
ChiefResponse bean = JSONUtil.toBean(dataJson, ChiefResponse.class);
//判断几个政务端用户,等待商量结果
//lj 102 其他是100 //要给dept部门id
// bean.setToken(singleLoginService.singleLogin(bean.getAccountName(), bean.getName(), null, "02", bean.getMobile(),bean.getEmail()));
return AjaxResult.success(bean);
} else {
throw new ServiceException("登陆失败");
}
}
} else {
throw new ServiceException("登陆失败");
}
throw new ServiceException("登陆失败");
}
@ApiOperation("政务根据信用代码返回跳转路由")
@GetMapping("/returnUrl")
public AjaxResult returnUrl(@RequestParam("code") String code,
@RequestParam("userToken") String userToken) throws Exception {
//请求的地址
StringBuilder url = new StringBuilder("http://qyt.sipac.gov.cn/sipsg-enterprise-mobile-manage/#/loginVerify?");
//当前时间的时间戳
String timespan = Long.toString(System.currentTimeMillis());
UserInfoRequestDTO req = new UserInfoRequestDTO();
req.setClientId(clientId);
req.setUserToken(userToken);
String signature = Base64.encode(HMAC256Config.HmacSHA256(JSONUtil.parse(req).toString() + timespan, clientSecret));
url.append("signature=").append(signature);
url.append("&timespan=").append(timespan);
url.append("&userToken=").append(userToken);
url.append("&gourl=")
.append(URLEncoder.encode("https://qyt.sipac.gov.cn/sipsg-enterprise-mobile-manage/#/workPlat/search/enterprise/detail?id="+code,"UTF-8"));
url.append("&clientid=").append(clientId);
return AjaxResult.success(url.toString());
}
}

@ -0,0 +1,15 @@
package com.ruoyi.gysl.login.dto.request;
import lombok.Data;
/**
*
*
* @author du
* @since 2024/6/20 11:20
*/
@Data
public class UserInfoRequestDTO {
private String clientId;
private String userToken;
}

@ -0,0 +1,47 @@
package com.ruoyi.gysl.login.dto.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
*
*
* @author du
* @since 2024/6/4 11:05
*/
@Data
@ApiModel("政务端用户")
public class ChiefResponse {
@ApiModelProperty("本系统token")
private String token;
private String id;
private String mainTopOrganizationId;
private String isEnabled;
private String isOfficial;
private String isUseOA;
private String name;
private String familyName;
private String givenName;
private String accountName;
private String email;
private String mobile;
private String sex;
private String idNumber;
private String birthday;
private String workPhone;
private String shortPhone;
private String workAddress;
private String state;
private String description;
// private String post;
private String secondaryEmail;
private String hasDomainAccount;
private SettingsResponse settings;
private List<OrganizationsResponse> organizations;
private String whenCreated;
private String whenUpdated;
}

@ -0,0 +1,27 @@
package com.ruoyi.gysl.login.dto.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* organizations
*
* @author du
* @since 2024/6/4 14:42
*/
@Data
@ApiModel("organizations其他响应类")
public class OrganizationsOtherResponse {
private String id;
private String parentId;
private String name;
private String path;
private String displayName;
private String description;
private String order;
private String whenCreated;
private String whenUpdated;
private String type;
private SettingsResponse settings;
}

@ -0,0 +1,22 @@
package com.ruoyi.gysl.login.dto.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* organizations
*
* @author du
* @since 2024/6/4 14:40
*/
@Data
@ApiModel("organizations响应类")
public class OrganizationsResponse {
private String userId;
private String isPrimary;
private String organizationId;
private String userOrder;
private String organizationOrder;
private String user;
private OrganizationsOtherResponse organization;
}

@ -0,0 +1,19 @@
package com.ruoyi.gysl.login.dto.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* settings
*
* @author du
* @since 2024/6/4 11:07
*/
@Data
@ApiModel("settings响应类")
public class SettingsResponse {
private String isContactsHidden;
private String isContactsHiddenMobile;
private String isContactsHiddenBirthday;
private String isContactsHiddenWorkPhone;
}

@ -0,0 +1,18 @@
package com.ruoyi.gysl.login.dto.response;
import lombok.Data;
/**
*
*
* @author du
* @since 2024/6/20 13:38
*/
@Data
public class ThirdUserInfoResponse {
private String userId;
private String name;
private String userType;
}

@ -0,0 +1,35 @@
package com.ruoyi.gysl.login.dto.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dong
* @since 2024/5/27 14:37
*/
@Data
@ApiModel("法人用户机构代码")
public class UserMainResponse {
/**
*
*/
@ApiModelProperty(value = "对应企业的组织机构代码")
private String organcode;
/**
*
*/
@ApiModelProperty(value = "对应企业的统一社会信用代码")
private String uscc;
/**
*
*/
@ApiModelProperty(value = "对应企业名称")
private String epname;
}

@ -0,0 +1,71 @@
package com.ruoyi.gysl.login.dto.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author dong
* @since 2024/5/27 10:55
*/
@ApiModel(value = "法人用户")
@Data
public class UserResponse implements Serializable {
private static final long serialVersionUID = -5117946174934452302L;
/**
*
*/
@ApiModelProperty(value = "登录账号名")
private String loginname;
/**
*
*/
@ApiModelProperty(value = "用户姓名")
private String username;
/**
* id
*/
@ApiModelProperty(value = "用户id")
private String userid;
/**
*
*/
@ApiModelProperty(value = "权限")
private String email;
/**
*
*/
@ApiModelProperty(value = "手机号码")
private String mobileno;
/**
* ep-
*/
@ApiModelProperty(value = "用户类型ep-表示法人用户")
private String usertype;
/**
* legal-,admin-,user
*/
@ApiModelProperty(value = "角色类型legal-法定代表人,admin-管理员,user-业务经办")
private String roletype;
/**
* token
*/
@ApiModelProperty(value = "若依token")
private String token;
@ApiModelProperty(value = "企业机构代码")
private UserMainResponse main;
}

@ -0,0 +1,74 @@
package com.ruoyi.gysl.login.util;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
/**
*
*
* @author du
* @since 2024/6/20 10:15
*/
public class HMAC256Config {
/**
*
*/
private final static String ENCODING = "utf-8";
/**
*
*/
private final static String ALGORITHM = "AES";
/**
*
*/
private final static String PATTERN = "AES/CBC/pkcs5padding";
//AES解密
/**
* @param content
* @param key aes
* @return
* @throws Exception
*/
public static String decrypt(String content, String key) throws Exception {
//反序列化AES密钥
SecretKeySpec keySpec = new SecretKeySpec(Base64.decodeBase64(key.getBytes()), ALGORITHM);
//128bit全零的IV向量
byte[] iv = new byte[16];
for (int i = 0; i < iv.length; i++) {
iv[i] = 0;
}
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
//初始化加密器并加密
Cipher deCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
deCipher.init(Cipher.DECRYPT_MODE, keySpec, ivParameterSpec);
byte[] encryptedBytes = Base64.decodeBase64(content.getBytes(ENCODING));
byte[] bytes = deCipher.doFinal(encryptedBytes);
return new String(bytes);
}
public static byte[] HmacSHA256(String data, String key) throws Exception {
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
sha256_HMAC.init(secret_key);
byte[] array = sha256_HMAC.doFinal(data.getBytes(StandardCharsets.UTF_8));
return array;
}
}

@ -19,10 +19,10 @@ public interface QyStatsMapper {
*/
AllProjectResponse allProject(@Param("userName") String userName);
/**
*
*/
List<BasicInformation> relationalProject(String username);
// /**
// * 关联项目
// */
// List<BasicInformation> relationalProject(String username);
/**
*

@ -1,6 +1,9 @@
package com.ruoyi.gysl.mapper;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.docking.entity.SmartDeclaration;
import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import com.ruoyi.gysl.entity.stats.AllProjectResponse;
import com.ruoyi.gysl.entity.stats.RibbonResponse;
import org.apache.ibatis.annotations.Param;
@ -58,5 +61,13 @@ public interface ZwStatsMapper {
*
*/
int allMlfx();
/**
*
*/
List<RibbonResponse> cbxmtj();
}

@ -19,10 +19,10 @@ public interface QyStatsService {
*/
AllProjectResponse allProject(String userName);
/**
*
*/
List<BasicInformation> relationalProject(String username);
// /**
// * 关联项目
// */
// List<BasicInformation> relationalProject(String username);
/**

@ -1,6 +1,8 @@
package com.ruoyi.gysl.service;
import com.ruoyi.docking.entity.SmartDeclaration;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import com.ruoyi.gysl.entity.stats.AllProjectResponse;
import com.ruoyi.gysl.entity.stats.RibbonResponse;
@ -54,5 +56,12 @@ public interface ZwStatsService {
*
*/
List<RibbonResponse> slfx();
/**
*
*/
List<RibbonResponse> cbxmtj();
}

@ -30,13 +30,13 @@ public class QyStatsServiceImpl implements QyStatsService {
return qyStatsMapper.allProject(userName);
}
/**
*
*/
@Override
public List<BasicInformation> relationalProject(String username) {
return qyStatsMapper.relationalProject(username);
}
// /**
// * 关联项目
// */
// @Override
// public List<BasicInformation> relationalProject(String username) {
// return qyStatsMapper.relationalProject(username);
// }
/**
*

@ -2,6 +2,8 @@ package com.ruoyi.gysl.service.impl;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.docking.entity.SmartDeclaration;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.YdxxtjResponse;
import com.ruoyi.gysl.entity.stats.AllProjectResponse;
import com.ruoyi.gysl.entity.stats.RibbonResponse;
import com.ruoyi.gysl.mapper.ZwStatsMapper;
@ -101,4 +103,14 @@ public class ZwStatsServiceImpl implements ZwStatsService {
a1.add(r2);
return a1;
}
/**
*
*/
@Override
public List<RibbonResponse> cbxmtj() {
return zwStatsMapper.cbxmtj();
}
}

@ -11,19 +11,19 @@ import com.ruoyi.common.utils.StringUtils;
*
* @author ruoyi
*/
@RestController
public class SysIndexController
{
//@RestController
//public class SysIndexController
//{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoyiConfig;
// @Autowired
// private RuoYiConfig ruoyiConfig;
/**
* 访
*/
@RequestMapping("/")
public String index()
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
}
}
// /**
// * 访问首页,提示语
// */
// @RequestMapping("/")
// public String index()
// {
// return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
// }
//}

@ -127,3 +127,13 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
#政务端clientId
clientId: 9911336a2b67451fb9e1d78131c0e5e9
#政务端clientSecret
clientSecret: fXckuZrxMdh6nl/ISI2WTg==
#政务端appkey
appkey: db90cb33-6551-4d1f-875e-236d66af4fcc
#政务端经济大脑(政务端)获取用户信息接口
getInfoId: https://qyt.sipac.gov.cn/enterprise-gateway/sipsg-enterprise/sys/third/userInfo
#政务端政务通获取用户信息接口(可选)
getAllInfo: http://uid.sipac.gov.cn/open/api/identity/data/FindUserById

@ -5,10 +5,18 @@
SELECT
a.*
FROM
project_progress a
project_progress a
LEFT JOIN project b ON a.project_id = b.project_id
where b.project_name = #{name}
order by a.month desc
order by a.month asc
</select>
<select id="getXmId" resultType="com.ruoyi.docking.entity.ProjectProgress">
SELECT
*
FROM
project_progress a
where a.xm_id = #{id}
order by a.month asc
</select>
</mapper>

@ -33,44 +33,19 @@
), 0) AS currentBuilding3,
<!-- 当年_总投资额 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} THEN a.ztze ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN a.ztze ELSE 0 END
</otherwise>
</choose>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN a.ztze ELSE 0 END
), 0) AS currentAllInvest1,
<!-- 当年_计划投资额 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} THEN a.jhtze ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN a.jhtze ELSE 0 END
</otherwise>
</choose>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN a.jhtze ELSE 0 END
), 0) AS currentAllInvest2,
<!-- 当年_占地面积 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} THEN b.zydmj ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN b.zydmj ELSE 0 END
</otherwise>
</choose>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN b.zydmj ELSE 0 END
), 0) AS currentAllInvest3
FROM gysl_basic_information a
LEFT JOIN gysl_plan_information b ON a.id = b.xm_id
where a.tyshxydm = #{userName}
</select>
<select id="relationalProject" resultType="com.ruoyi.gysl.entity.BasicInformation">
</select>
<select id="qyNotice" resultType="com.ruoyi.docking.entity.SmartDeclaration">
select * from gysl_smart_declaration

@ -149,12 +149,12 @@
where zw_id = #{userId} and is_read = 1
</select>
<select id="xfcyfx" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
SELECT COUNT(a.cylb) AS count,
b.dict_label AS ssgnq
SELECT COUNT(a.xfcy) AS count,
b.dict_label AS ssgnq
FROM
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cylb' ) b
LEFT JOIN gysl_xfcygl a
ON a.cylb = b.dict_value
LEFT JOIN (select * from gysl_basic_information where status = 3 ) a
ON a.xfcy = b.dict_value
GROUP BY
b.dict_label,
b.dict_value
@ -162,12 +162,12 @@
b.dict_value;
</select>
<select id="mlfx" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
SELECT COUNT(a.slmllb) AS count,
b.dict_label AS ssgnq
SELECT COUNT(a.ml) AS count,
b.dict_label AS ssgnq
FROM
( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'shangloumulu' ) b
LEFT JOIN gysl_ml a
ON a.slmllb = b.dict_value
LEFT JOIN (select * from gysl_basic_information where status = 3 ) a
ON a.ml = b.dict_value
GROUP BY
b.dict_label,
b.dict_value
@ -188,5 +188,17 @@
LEFT JOIN gysl_ml a
ON a.slmllb = b.dict_value
</select>
<select id="cbxmtj" resultType="com.ruoyi.gysl.entity.stats.RibbonResponse">
SELECT
count(*) AS count,
jsms AS ssgnq
FROM
gysl_basic_information
WHERE
status = 3 and jsms is not null
GROUP BY
jsms
</select>
</mapper>

@ -0,0 +1,45 @@
package com.ruoyi.common.utils;
import javax.crypto.Cipher;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.spec.PKCS8EncodedKeySpec;
/**
* RSA
*
* @author ruoyi
**/
public class RsaUtils
{
// Rsa 私钥
private static final String PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXxtLWRhOIyEhLkxlTbndtzS6RrGsDWV8LOIAEXFCsLZzT20ytAaO4fpXXHah80EwaE4P25Y3+qQBDL8fA5780pSoLDo3Si/qC5KuowNb8F1ncGXSuYzX/3mNMLXF98UW96PvFY198hto8j5snhYtf01WI2L0eZPQFE3Mnh3ZHzos88Jr5vEto+OyHZHa0GRsuRSi33vr1olo8+LA8JkcyS5B6eMdKalYvSiSV6owfwQZfuPoDkD/ghRc8w0owzOSJJGmwgnrkYmYMBudHdldF8LwzNUEEkHrOvk3QXg33Fl8X4lL9jHvbq0K76sDoYMLJPG1D/Ccqk93AU/mdRYJZAgMBAAECggEAG+w3M7aWt25pZoX8fc3v6OJ7s88trOMPSkgtvR+is9p8ZLmOxLFthm67cGUDb1r+9Tkr6QtYcUZ0RugObt3z3mKYdopJ6zdXcidRsW0w4BYHsSd5wO99qsImMIiXvZzawNKRJ0Jd+dHxanzdBYtbFdkSfmepe2MFRb3LTLVuPE1oCTKbzwqPSGWERpkejZJz+Cthc/xp7PWNFtfmEASEuAmYV0tdWC0H6NJqTtg2Stotp4hlk/jTKLoYQW/m3pmnkw1QbVRh1B9mtxTVtGV6HzhiQbuc5HWaUvBm4ysiXjFEtCTpBeDjwvnD1wkDXR1SyVdYiAfDYM2zCCs5OvWPFQKBgQD3MONf6Jn7x6Xo2uwsKwca4HFkfIHpK5TdiFB9p2eCZ4V8JZNPv02fPRldFb56nYVmdNVoo8/z4WG9t6uNoTLDMqTI0wVkrJCufQCI/50XnKITEmLfXOKXkwhekRLi1oho0nEsbaQllFFrlfx4NkcgoW6XL1TW8eRx8JD7EORI9wKBgQCdL3mZ5gumLLhB/RTK5G786jJtztNxQ4jpFtClv25uPJgqsRgSVoLnnTCmLm/yGsHNna/CHbA4mYOYzXiM10WUK1tEqPwYm0nalQAxtXJjNgERKjWWaopZW/f4pCBPV8RG4dk/+13zjPCYTeS4i7J89psHljqoeQoLe4xazLKLLwKBgHgV+f/34gadIQ6UfDOg25zE+JFWo04BbBqLRH8munRxkjmTj5MoXq9DYXUFQToUGGCD1cE2A6p5DaC6/86YRy7pBYDCc1ZLNyZtd7sWYty7rUkSn5Hfb/0u4tv+ImysyCwUQALTaPEQstVPUg2cYMWLZ0xvJAogDVkFA4nU1PJVAoGAEBQ7LDMMHgOVFar95YNYlyad4f22Q2/VIYLj9RCQC1bHehaDj9ypp2e9AkLd0LZL/OyUfhbrX97UR109Z6rdwzpsK6ndn+bCt0lmq68T9HIhyc+3i5t6a4ms5BJl+7fOrDGON61O/wr70ZimPPqNV5siYLRNa8516JbK1L77xKECgYEAyaTui+7B27219nwgoin9AuM0H7B+rzz0GkXmYXzWhxgKB+eBuJbZsrUTOBVkk66j3Ss4cJvQJ9utcFBnS6msEAUCYU6OuInIb/PMv8I7DC7SrrTZpyD9LXKIB4aYtqPrntZSo+75EAHgXNpRYqUwkpZbCuYSIXebno4JOxB1RK8=" +
"CfhCau4K5xqFfYnCDxwN6EfWtl118/RC/H1G6YUH9VZ02hTsIKtcdoz/w3knVDuL/i1uCtKtJDdyejF8osix2IVVA2HNoUPEG+3VH0IJjOoFTZTP76LcuQvgig6pjAtB5+GFPVkkrdxWZc3rn+psCdzYBueVhDRDFatKxfvAQMk90SMNVOLApB8u4aWUdxGju3vOKO5ShBUVutyczTzAOW39hHdzXX5CvGPXNYNv7S55AVAI5ZVdn11dyxgPr6u7n7AuHtc2pvUddHTRM/UczNN5lkpdMvISQy4iHwCw9wGVax3kvRxMzhYiBricSKJWbl4LiAMRV3P15LWkaBwSkw==";
/**
*
*/
public static String decryptByPrivateKey(String decodeString) throws Exception {
// 将传入的Base64编码字符串解码为字节数组
byte[] encryptedBytes = java.util.Base64.getDecoder().decode(decodeString);
// 使用私钥解密
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(org.apache.commons.codec.binary.Base64.decodeBase64(PRIVATE_KEY));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
byte[] decryptedBytes = decrypt(encryptedBytes, privateKey);
// 返回解密后的字符串
return new String(decryptedBytes);
}
/**
*
*/
private static byte[] decrypt(byte[] data, PrivateKey privateKey) throws Exception {
// 获取RSA算法的Cipher实例
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");
// 用私钥初始化Cipher实例设置为解密模式
cipher.init(Cipher.DECRYPT_MODE, privateKey);
// 执行解密操作,返回解密后的字节数组
return cipher.doFinal(data);
}
}

@ -114,7 +114,8 @@ public class SecurityConfig
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/gysl/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers("/system/chief/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

@ -10,6 +10,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.*;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.RsaUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.manager.AsyncManager;
@ -74,30 +75,37 @@ public class SysLoginService {
// 验证码校验
validateCaptcha(username, code, uuid);
// 登录前置校验
loginPreCheck(username, password);
String strP;
try {
strP = RsaUtils.decryptByPrivateKey(password);
} catch (Exception e) {
throw new RuntimeException(e);
}
loginPreCheck(username, strP);
//判断当前登录用户名是否符合loginRole
List<String> role = sysUserMapper.selectRoleByUserName(username);
if (!role.isEmpty()) {
if (loginRole == null) {
throw new ServiceException("无法登录!");
throw new ServiceException("登录失败");
} else {
if (loginRole == 1) {
if (!CollectionUtils.containsAny(role, ZW_ROLES)) {
throw new ServiceException("请登录企业用户!");
throw new ServiceException("登录失败");
}
} else if (loginRole == 2) {
if (!CollectionUtils.containsAny(role, QY_ROLES)) {
throw new ServiceException("请登录政务用户!");
throw new ServiceException("登录失败");
}
}
}
} else {
throw new ServiceException("暂无该用户!");
throw new ServiceException("登录失败");
}
// 用户验证
Authentication authentication = null;
try {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, strP);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);

Loading…
Cancel
Save