登录修改

master
杜函宇 4 weeks ago
parent 960f1e3382
commit 31fa480c07

@ -46,7 +46,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.37</version>
<version>5.8.23</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>

@ -3,6 +3,8 @@ package com.ruoyi.gysl.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.crypto.SmUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -17,6 +19,9 @@ import com.ruoyi.gysl.entity.request.AuditRequest;
import com.ruoyi.gysl.entity.request.BasicInformationPageReq;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
import com.ruoyi.gysl.entity.response.ProjectExcelInfo;
import com.ruoyi.gysl.login.util.SM2Demo;
import com.ruoyi.gysl.login.util.SM4Demo;
import com.ruoyi.gysl.login.util.StringUtil;
import com.ruoyi.gysl.service.*;
import com.ruoyi.system.mapper.SysDictDataMapper;
import io.swagger.annotations.Api;
@ -29,16 +34,15 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
@ -99,6 +103,176 @@ public class BasicInformationController extends BaseController {
@Resource
private ProjectOtherInfoService projectOtherInfoService;
@Value("${isZs}")
private Boolean isZs;
private static final String BOUNDARY = "----WebKitFormBoundary7MA4YWxkTrZu0gW"; // 边界字符串(需唯一)
@Value("${sm2}")
private String sm2;
@Value("${sm4}")
private String sm4;
@Value("${accessId}")
private String accessId;
@Value("${sceneId}")
private String sceneId;
/**
*
*/
@ApiOperation("建筑工程施工许可")
@GetMapping("/getJzgcsgxk")
public AjaxResult getJzgcsgxk() throws Exception {
if (isZs) {
String czztdm = "91320594608197761G";
String contacts = "http://172.21.10.46/api/invoke/323018/jzgcsgxk";
String a1 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(accessId.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
String a2 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(czztdm.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
String a4 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(sceneId.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
//生成sm3签名
String input = "accessId=" + accessId + "&czztdm=" + czztdm + "&sceneId=" + sceneId;
try {
// 1. 构建 URL含签名参数处理特殊符号
String encodedSignature = URLEncoder.encode(SmUtil.sm3(input), "UTF-8")
.replace("+", "%20"); // 确保 + 不被编码为空格
String fullUrl = contacts + "?signature=" + encodedSignature;
// 2. 创建连接
URL url = new URL(fullUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
// 3. 构建请求体(严格对齐 curl -F 格式)
try (DataOutputStream out = new DataOutputStream(conn.getOutputStream())) {
writeFormField(out, "accessId", a1);
writeFormField(out, "czztdm", a2);
writeFormField(out, "sceneId", a4);
// 结束标记
out.writeBytes("--" + BOUNDARY + "--\r\n");
}
// 4. 处理响应
int statusCode = conn.getResponseCode();
StringBuilder response = getResponse(statusCode, conn);
if (statusCode == 200) {
JSONObject jsonObj = JSONObject.parseObject(String.valueOf(response));
// if ("200".equals(jsonObj.getString("code"))) { // 使用 getString 避免类型问题
// 直接获取 data 字段为 JSONObject无需转换 String
JSONObject reqData = jsonObj.getJSONObject("data");
String responseParams = reqData.getString("responseParams");
String s = new String((byte[]) SM2Demo.dexec(
Base64.getDecoder().decode(responseParams), "C1C2C3",
Base64.getDecoder().decode(sm2)),
StandardCharsets.UTF_8);
return AjaxResult.success(StringUtil.getFinalData(s));
}
// }
} catch (Exception y) {
y.printStackTrace();
}
}
return success();
}
/**
*
*/
@ApiOperation("建筑工程竣工验收备案表")
@GetMapping("/getJgysbab")
public AjaxResult getJgysbab() throws Exception {
if (isZs) {
String czztdm = "9132059456176406XP";
String czztmc = "苏州纳米科技发展有限公司";
System.out.println(czztdm);
System.out.println(czztmc);
String contacts = "http://172.21.10.46/api/invoke/323018/jzgcjgysbab";
String a1 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(accessId.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
String a2 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(czztdm.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
String a3 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(czztmc.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
String a4 = Base64.getEncoder().encodeToString((byte[])
SM4Demo.exec(sceneId.getBytes(),
"ECB", "PKCS5Padding", "random", sm4.getBytes(), null));
//生成sm3签名
String input = "accessId=" + accessId + "&czztdm=" + czztdm + "&czztmc=" + czztmc + "&sceneId=" + sceneId;
try {
// 1. 构建 URL含签名参数处理特殊符号
String encodedSignature = URLEncoder.encode(SmUtil.sm3(input), "UTF-8")
.replace("+", "%20"); // 确保 + 不被编码为空格
String fullUrl = contacts + "?signature=" + encodedSignature;
// 2. 创建连接
URL url = new URL(fullUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
// 3. 构建请求体(严格对齐 curl -F 格式)
try (DataOutputStream out = new DataOutputStream(conn.getOutputStream())) {
writeFormField(out, "accessId", a1);
writeFormField(out, "czztdm", a2);
writeFormField(out, "czztmc", a3);
writeFormField(out, "sceneId", a4);
// 结束标记
out.writeBytes("--" + BOUNDARY + "--\r\n");
}
// 4. 处理响应
int statusCode = conn.getResponseCode();
StringBuilder response = getResponse(statusCode, conn);
if (statusCode == 200) {
JSONObject jsonObj = JSONObject.parseObject(String.valueOf(response));
// if ("200".equals(jsonObj.getString("code"))) { // 使用 getString 避免类型问题
// 直接获取 data 字段为 JSONObject无需转换 String
JSONObject reqData = jsonObj.getJSONObject("data");
String responseParams = reqData.getString("responseParams");
String s = new String((byte[]) SM2Demo.dexec(
Base64.getDecoder().decode(responseParams), "C1C2C3",
Base64.getDecoder().decode(sm2)),
StandardCharsets.UTF_8);
System.out.println(s);
return AjaxResult.success(StringUtil.getFinalData(s));
}
} catch (Exception y) {
y.printStackTrace();
}
}
return success();
}
private static StringBuilder getResponse(int statusCode, HttpURLConnection conn) throws IOException {
StringBuilder response = new StringBuilder();
try (BufferedReader in = new BufferedReader(new InputStreamReader(
(statusCode >= 200 && statusCode < 300) ? conn.getInputStream() : conn.getErrorStream(),
StandardCharsets.UTF_8))) {
String line;
while ((line = in.readLine()) != null) {
response.append(line);
}
}
return response;
}
private static void writeFormField(DataOutputStream out, String name, String value) throws Exception {
out.writeBytes("--" + BOUNDARY + "\r\n");
out.writeBytes("Content-Disposition: form-data; name=\"" + name + "\"\r\n");
out.writeBytes("Content-Type: text/plain; charset=UTF-8\r\n\r\n");
out.writeBytes(value + "\r\n");
}
/**
*
*
@ -272,7 +446,6 @@ public class BasicInformationController extends BaseController {
}
/**
*
*/
@ -373,12 +546,12 @@ public class BasicInformationController extends BaseController {
map.put("issuingTime", a1.getBasicInformation().getIssuingTime() != null ? a1.getBasicInformation().getIssuingTime() : "/");
map.put("jsjd", a1.getBasicInformation().getJsjd() != null ? a1.getBasicInformation().getJsjd() : "/");
map.put("xzfl", a1.getBasicInformation().getXzfl() != null ?
basicInformationService.getDictLabel("xzfl", String.valueOf(a1.getBasicInformation().getXzfl()),sysDictData) : "/");
basicInformationService.getDictLabel("xzfl", String.valueOf(a1.getBasicInformation().getXzfl()), sysDictData) : "/");
map.put("nature", a1.getBasicInformation().getNature() != null ?
basicInformationService.getDictLabel("xmfrdwxz", String.valueOf(a1.getBasicInformation().getNature()),sysDictData) : "/");
basicInformationService.getDictLabel("xmfrdwxz", String.valueOf(a1.getBasicInformation().getNature()), sysDictData) : "/");
map.put("name", a1.getBasicInformation().getName() != null ? a1.getBasicInformation().getName() : "/");
map.put("ssgnq", a1.getBasicInformation().getSsgnq() != null ?
basicInformationService.getDictLabel("ssgnq", String.valueOf(a1.getBasicInformation().getSsgnq()),sysDictData) : "/");
basicInformationService.getDictLabel("ssgnq", String.valueOf(a1.getBasicInformation().getSsgnq()), sysDictData) : "/");
map.put("jsdd", a1.getBasicInformation().getJsdd() != null ? a1.getBasicInformation().getJsdd() : "/");
map.put("xmfrdwxz", a1.getBasicInformation().getXmfrdwxz() != null ? a1.getBasicInformation().getXmfrdwxz() : "/");
map.put("tyshxydm", a1.getBasicInformation().getTyshxydm() != null ? a1.getBasicInformation().getTyshxydm() : "/");
@ -412,7 +585,7 @@ public class BasicInformationController extends BaseController {
map.put("kzczmj", a1.getQyrzInformation().getKzczmj() != null ? a1.getQyrzInformation().getKzczmj() : "/");
map.put("gycfpjzj", a1.getQyrzInformation().getGycfpjzj() != null ? a1.getQyrzInformation().getGycfpjzj() : "/");
try {
String itemsFileName = fatherFile + "/" + a1.getBasicInformation().getName()+".docx";
String itemsFileName = fatherFile + "/" + a1.getBasicInformation().getName() + ".docx";
Path targetPath = Paths.get(itemsFileName);
Files.createDirectories(targetPath.getParent());
// 2. 打开输出流(自动覆盖已有文件)
@ -420,7 +593,7 @@ public class BasicInformationController extends BaseController {
Files.newOutputStream(targetPath,
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING))) {
basicInformationService.generateDocument(map,"xmdtcl.docx",out);
basicInformationService.generateDocument(map, "xmdtcl.docx", out);
}
} catch (Exception e) {
throw new RuntimeException("文件下载失败");

@ -33,27 +33,30 @@ public class GyslProjectHandbook extends BaseModel {
@NotBlank(message = "手册名称不能为空!")
private String name;
@ApiModelProperty(value ="副标题" )
private String subtitle;
@ApiModelProperty(value ="副标题1" )
private String subtitle1;
@ApiModelProperty(value ="封面图片" )
@NotBlank(message = "封面图片不能为空!")
private String coverImg;
@ApiModelProperty(value ="副标题2" )
private String subtitle2;
@ApiModelProperty(value ="项目id" )
@NotBlank(message = "请选择项目id!")
private String xmId;
@ApiModelProperty(value ="单位名称" )
private String dwname;
@ApiModelProperty(value ="封尾图片" )
@NotBlank(message = "封尾图片不能为空!")
private String tailingImg;
@ApiModelProperty(value ="联系人" )
private String lxname;
@ApiModelProperty(value ="手机号" )
private String phone;
@ApiModelProperty(value ="日期" )
private String date;
@ApiModelProperty(value ="封尾标题" )
private String tail;
@ApiModelProperty(value ="地址" )
private String address;
@ApiModelProperty(value ="项目名称数组" )
@TableField(exist = false)

@ -0,0 +1,52 @@
package com.ruoyi.gysl.entity.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author du
* @since 2025/5/21 2:30
*/
@Data
public class JgysbabResponse {
@ApiModelProperty(value ="证照颁发日期" )
private String ZZBFRQ;
@ApiModelProperty(value ="证照颁发机构" )
private String ZZBFJG;
@ApiModelProperty(value ="证照有效期截至日期" )
private String ZZYXQJZRQ;
@ApiModelProperty(value ="持证主体代码类型代码" )
private String CZZTDMLXDM;
@ApiModelProperty(value ="持证主体代码" )
private String CZZTDM;
@ApiModelProperty(value ="证照编号" )
private String ZZBH;
@ApiModelProperty(value ="持证主体" )
private String CZZT;
@ApiModelProperty(value ="证照文件流" )
private String pdfBase64;
@ApiModelProperty(value ="持证主体代码类型" )
private String CZZTDMLX;
@ApiModelProperty(value ="证照有效期起始日期" )
private String ZZYXQQSRQ;
@ApiModelProperty(value ="证照标识" )
private String ZZBS;
@ApiModelProperty(value ="证照名称" )
private String ZZMC;
@ApiModelProperty(value ="证照颁发机构代码" )
private String ZZBFJGDM;
}

@ -6,20 +6,14 @@ package com.ruoyi.gysl.login.controller;
*/
import cn.hutool.crypto.digest.DigestUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.gysl.login.dto.response.UserMainResponse;
import com.ruoyi.gysl.login.dto.response.UserResponse;
import com.ruoyi.gysl.login.service.LoginTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -43,7 +37,8 @@ import java.util.Map;
@RestController
@RequestMapping("/system/singlelogin")
public class SingleLoginController {
private static final Logger log = LoggerFactory.getLogger(SingleLoginController.class);
private static final String BOUNDARY = "----WebKitFormBoundary7MA4YWxkTrZu0gW"; // 边界字符串(需唯一)
@Value("${url}")
private String url;
@ -57,8 +52,6 @@ public class SingleLoginController {
@Value("${returnUrl}")
private String returnUrl;
@Resource
private RedisCache redisCache;
@Resource
private LoginTokenService loginTokenService;
@ -96,42 +89,47 @@ public class SingleLoginController {
@ApiOperation(value = "获取用户信息", response = UserResponse.class)
@GetMapping("/getInfo")
public AjaxResult getInfo(String clientToken) throws Exception {
HttpResponse response = HttpUtil.createGet(infoUrl)
.form("clienttoken", clientToken)
// .addHeaders(generationHeader())
String url = infoUrl + "?clienttoken=" + clientToken;
HttpResponse response = HttpRequest.get(URLEncoder.encode(url, "UTF-8"))
.addHeaders(generationHeader())
.execute();
String responseBody;
System.out.println(url);
System.out.println("appid:"+enterpriseAppId);
System.out.println("time:"+generationHeader().get("time"));
System.out.println("sign:"+generationHeader().get("sign"));
System.out.println(response.body());
// String responseBody;
// 获取响应状态码
int statusCode = response.getStatus();
if (statusCode == 200) {
// 获取响应内容
responseBody = response.body();
JSONObject jsonObj = JSONUtil.parseObj(responseBody);
JSONObject dataObj = jsonObj.getJSONObject("data");
// 设置过期时间(可选)
// int expirationSeconds = 24 * 60;
// 将用户信息存储到Redis中
// String key = "user:" + clientToken;
//判断是法人用户
if ("ep".equals(dataObj.get("usertype"))) {
JSONObject mainobj = dataObj.getJSONObject("mainbody");
UserResponse res = JSONUtil.toBean(dataObj, UserResponse.class);
UserMainResponse req = JSONUtil.toBean(mainobj, UserMainResponse.class);
String token = loginTokenService.singleLogin(req.getUscc(), req.getEpname(),
"02", null, null);
res.setToken(token);
res.setMain(req);
return AjaxResult.success(res);
} else {
log.error(response.body());
throw new ServiceException("该用户不是企业法人");
}
} else {
log.error(response.body());
throw new ServiceException("未知异常请联系管理员");
}
// int statusCode = response.getStatus();
// if (statusCode == 200) {
// // 获取响应内容
// responseBody = response.body();
// JSONObject jsonObj = JSONUtil.parseObj(responseBody);
// JSONObject dataObj = jsonObj.getJSONObject("data");
// //判断是法人用户
// if ("ep".equals(dataObj.get("usertype"))) {
// JSONObject mainobj = dataObj.getJSONObject("mainbody");
// UserResponse res = JSONUtil.toBean(dataObj, UserResponse.class);
// UserMainResponse req = JSONUtil.toBean(mainobj, UserMainResponse.class);
// String token = loginTokenService.singleLogin(req.getUscc(), req.getEpname(),
// "02", null, null);
// res.setToken(token);
// res.setMain(req);
// return AjaxResult.success(res);
// } else {
// log.error(response.body());
// throw new ServiceException("该用户不是企业法人");
// }
// } else {
// log.error(response.body());
// throw new ServiceException("未知异常请联系管理员");
// }
return null;
}
/**
* 退
*
@ -143,7 +141,7 @@ public class SingleLoginController {
public AjaxResult enterpriseLogout(@RequestParam("clienttoken") String clienttoken) {
String url = logoutUrl + "?clienttoken=" + clienttoken;
HttpResponse execute = HttpUtil.createGet(url)
// .addHeaders(generationHeader())
.addHeaders(generationHeader())
.execute();
String str;
// 获取响应状态码

@ -0,0 +1,163 @@
package com.ruoyi.gysl.login.util;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.gysl.entity.response.JgysbabResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
*
* @author du
* @since 2024/6/20 10:15
*/
public class StringUtil {
public static void main(String[] args) {
}
public static List<JgysbabResponse> getFinalData(String content) throws Exception {
String result = content.replaceAll(", pdfBase64=[^,}]*", "");
//pdfbase64保存的集合
List<String> segments = new ArrayList<>();
Pattern pattern = Pattern.compile(", pdfBase64=([^,]+)");
Matcher matcher = pattern.matcher(content);
while (matcher.find()) {
segments.add(matcher.group(1));
}
JSONObject newS = JSONObject.parseObject(result);
// 1. 分割多个对象
List<String> objects = splitObjects(newS.getString("data"));
List<String> jsonObjects = new ArrayList<>();
// 2. 遍历每个对象并解析
for (String obj : objects) {
jsonObjects.add(parseObject(obj));
}
// 3. 构建最终 JSON 数组
String json = buildJsonArray(jsonObjects);
JSONArray newArray = JSONArray.parseArray(json);
// 转换为 Java 对象列表
List<JgysbabResponse> returnData = new ArrayList<>();
for (int i = 0; i < newArray.size(); i++) {
JSONObject item = newArray.getJSONObject(i);
JgysbabResponse res = item.toJavaObject(JgysbabResponse.class);
res.setPdfBase64(segments.get(i));
returnData.add(res);
}
return returnData;
}
/**
*
*/
private static List<String> splitObjects(String input) {
List<String> objects = new ArrayList<>();
int start = input.indexOf('{') + 1;
int depth = 0;
StringBuilder currentObj = new StringBuilder();
for (int i = start; i < input.length(); i++) {
char c = input.charAt(i);
if (c == '{') depth++;
if (c == '}') {
if (depth == 0) {
objects.add(currentObj.toString());
currentObj.setLength(0);
i++; // 跳过下一个逗号或闭合括号
} else {
depth--;
}
}
if (depth >= 0) currentObj.append(c);
}
return objects;
}
/**
*
*/
private static String parseObject(String objStr) {
List<String[]> keyValuePairs = new ArrayList<>();
StringBuilder key = new StringBuilder();
StringBuilder value = new StringBuilder();
boolean isKey = true;
boolean inQuotes = false;
for (int i = 0; i < objStr.length(); i++) {
char c = objStr.charAt(i);
// 处理转义字符
if (c == '\\' && i < objStr.length() - 1) {
char next = objStr.charAt(++i);
if (isKey) key.append(next);
else value.append(next);
continue;
}
// 处理引号
if (c == '"') {
inQuotes = !inQuotes;
continue;
}
// 键值分隔符(不在引号内)
if (c == '=' && !inQuotes && isKey) {
isKey = false;
continue;
}
// 键值对结束符(不在引号内)
if (c == ',' && !inQuotes) {
keyValuePairs.add(new String[]{key.toString().trim(), value.toString().trim()});
key.setLength(0);
value.setLength(0);
isKey = true;
continue;
}
// 积累字符
if (isKey) key.append(c);
else value.append(c);
}
// 添加最后一个键值对
if (key.length() > 0) {
keyValuePairs.add(new String[]{key.toString().trim(), value.toString().trim()});
}
return buildJsonObject(keyValuePairs);
}
/**
* JSON
*/
private static String buildJsonObject(List<String[]> pairs) {
StringBuilder json = new StringBuilder("{");
for (int i = 0; i < pairs.size(); i++) {
String[] pair = pairs.get(i);
json.append('"')
.append(pair[0])
.append("\":\"")
.append(pair[1].replace("\"", "\\\"")) // 处理值中的双引号
.append('"');
if (i < pairs.size() - 1) json.append(",");
}
return json.append("}").toString();
}
/**
* JSON
*/
private static String buildJsonArray(List<String> objects) {
StringBuilder json = new StringBuilder("[");
for (int i = 0; i < objects.size(); i++) {
json.append(objects.get(i));
if (i < objects.size() - 1) json.append(",");
}
return json.append("]").toString();
}
}

@ -11,7 +11,6 @@ import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.kernel.utils.PdfMerger;
import com.itextpdf.layout.font.FontProvider;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDictData;
@ -46,7 +45,6 @@ import java.util.*;
public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookMapper, GyslProjectHandbook> implements GyslProjectHandbookService {
@Resource
private BasicInformationMapper basicInformationMapper;
@ -84,10 +82,9 @@ public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookM
String htmlHead = RuoYiConfig.getProfile() + "/head.txt";
String s = getHtml(htmlHead);
s = s.replace("{{scname}}", handbook.getName() != null ? handbook.getName() : "/");
s = s.replace("{{fmbt}}", handbook.getSubtitle() != null ? handbook.getSubtitle() : "/");
s = s.replace("{{fmimgurl}}", handbook.getCoverImg() != null ?
Paths.get(RuoYiConfig.getProfile() + StringUtils.substringAfter(handbook.getCoverImg(), Constants.RESOURCE_PREFIX)).toUri().toString()
: Paths.get(RuoYiConfig.getProfile() + "/OIP-C.jpg").toUri().toString());
s = s.replace("{{subtitleone}}", handbook.getSubtitle1() != null ? handbook.getSubtitle1() : "/");
s = s.replace("{{subtitletwo}}", handbook.getSubtitle2() != null ? handbook.getSubtitle2() : "/");
s = s.replace("{{fmimgurl}}", Paths.get(RuoYiConfig.getProfile() + "/1.png").toUri().toString());
String headPdf = RuoYiConfig.getProfile() + "/pdfml" + "/head" + ".pdf";
hbpdf.add(headPdf);
FileUtil.touch(headPdf);
@ -97,9 +94,29 @@ public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookM
}
//内容目录
String htmlUrl = RuoYiConfig.getProfile() + "/gysl.txt";
String original = getHtml(htmlUrl);
for (int i = 0; i < basicInfoList.size(); i++) {
//查看每个项目对应的附件
StringBuilder result = new StringBuilder(original);
if (basicInfoList.get(i).getBasicInformation().getFj() != null) {
String[] split = basicInfoList.get(i).getBasicInformation().getFj().split(",");
String target = "<!-- 图片区域 -->"; // 要查找的子字符串
int startIndex = original.indexOf(target);
if (startIndex == -1) {
throw new IllegalArgumentException("未找到目标子字符串");
}
int insertPosition = startIndex + target.length();
result = new StringBuilder(original.substring(0, insertPosition));
for (int i1 = 0; i1 < split.length; i1++) {
String changeStr = "<div class=\"image-container\">\n" +
"\t\t<img src=\"{{fjimg"+i1+"}}\" alt=\"\" class=\"content-img\">\n" +
"\t</div>"; // 要插入的内容
result.append(changeStr);
}
result.append(original.substring(insertPosition));
}
//获取当前的信息并替换为可用html
String htmlNew = changeData(getHtml(htmlUrl), basicInfoList.get(i));
String htmlNew = changeData(String.valueOf(result), basicInfoList.get(i));
//新建pdf
String newPdf = "/pdfml" + "/p" + i + ".pdf";
String outputPath = RuoYiConfig.getProfile() + newPdf;
@ -113,10 +130,13 @@ public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookM
//封尾
String htmlFoot = RuoYiConfig.getProfile() + "/foot.txt";
String a = getHtml(htmlFoot);
a = a.replace("{{fwbt}}", handbook.getTail() != null ? handbook.getTail() : "/");
a = a.replace("{{fmimgurl}}", handbook.getTailingImg() != null ?
Paths.get(RuoYiConfig.getProfile() + StringUtils.substringAfter(handbook.getTailingImg(), Constants.RESOURCE_PREFIX)).toUri().toString()
: Paths.get(RuoYiConfig.getProfile() + "/OIP-C.jpg").toUri().toString());
a = a.replace("{{dwname}}", handbook.getDwname() != null ? handbook.getDwname() : "/");
a = a.replace("{{name}}", handbook.getLxname() != null ? handbook.getLxname() : "/");
a = a.replace("{{phone}}", handbook.getPhone() != null ? handbook.getPhone() : "/");
a = a.replace("{{date}}", handbook.getDate() != null ? handbook.getDate() : "/");
a = a.replace("{{Address}}", handbook.getAddress() != null ? handbook.getAddress() : "/");
a = a.replace("{{fmimgurl}}",
Paths.get(RuoYiConfig.getProfile() + "/2.png").toUri().toString());
String foodPdf = RuoYiConfig.getProfile() + "/pdfml" + "/food" + ".pdf";
hbpdf.add(foodPdf);
FileUtil.touch(foodPdf);
@ -180,9 +200,13 @@ public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookM
public String changeData(String handbook, BasicInformationResponse b) {
List<SysDictData> sysDictData = sysDictDataMapper.selectDictDataList(new SysDictData());
Map<String, Object> dt = new HashMap<>();
dt.put("{{fj}}", b.getBasicInformation().getFj() == null ?
Paths.get(RuoYiConfig.getProfile() + "/OIP-C.jpg").toUri().toString()
: Paths.get(RuoYiConfig.getProfile() + b.getBasicInformation().getFj()).toUri().toString());
if (b.getBasicInformation().getFj() != null) {
String[] split = b.getBasicInformation().getFj().split(",");
for (int i = 0; i < split.length; i++) {
dt.put("{{fjimg"+i+"}}",
Paths.get(RuoYiConfig.getProfile() + StringUtils.substringAfter(split[i], Constants.RESOURCE_PREFIX)).toUri().toString());
}
}
dt.put("{{name}}", b.getBasicInformation().getName());
dt.put("{{ztze}}", b.getBasicInformation().getZtze());
dt.put("{{xmbq}}", b.getBasicInformation().getLabel());

@ -61,10 +61,18 @@ spring:
multi-statement-allow: true
# 是否是正式环境
isZs: false
#企业端单点登陆url
url: http://114.216.202.175:8008/api/usercenter/User/ssoLogin
#企业端用户信息url
infoUrl: http://114.216.202.175:8008/api/usercenter/User/getInfo
#企业端退出登录url
logoutUrl: http://114.216.202.175:8008/api/usercenter/User/ssoLogOut
#企业端正式环境应用系统编号
enterpriseAppId: 193d64ab-316e-11f0-b7ab-9c5c8e847e61
# 应用私钥
enterpriseAppsecret: 7C21B5B9316E11F0B7AB9C5C8E847E61
#自己客户端地址
returnUrl: http://192.168.0.119:80
#returnUrl: http://39.101.188.84:9999/demo/Gyyq-Upstairs/
#returnUrl: http://192.168.0.119:80
returnUrl: http://39.101.188.84:9999/demo/Gyyq-Upstairs/

@ -116,6 +116,13 @@ swagger:
pathMapping: /
# 是否是正式环境
isZs: true
#企业端单点登陆url
url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin
#企业端用户信息url
infoUrl: http://172.21.14.70/api/usercenter/User/getInfo
#企业端退出登录url
logoutUrl: http://172.21.14.70/api/usercenter/User/ssoLogOut
#企业端正式环境应用系统编号
enterpriseAppId: 193d64ab-316e-11f0-b7ab-9c5c8e847e61
# 应用私钥

@ -52,7 +52,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: internet
# 文件上传
servlet:
multipart:
@ -141,14 +141,7 @@ getInfoId: https://172.21.10.12/enterprise-gateway/sipsg-enterprise/sys/third/us
getAllInfo: http://172.21.10.14/open/api/identity/data/FindUserById
#企业端单点登陆url
#url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin
url: http://114.216.202.175:8008/api/usercenter/User/ssoLogin
#企业端用户信息url
#infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo
infoUrl: http://114.216.202.175:8008/api/usercenter/User/getInfo
#企业端退出登录url
#logoutUrl: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogOut
logoutUrl: http://114.216.202.175:8008/api/usercenter/User/ssoLogOut
sm4: ef5323158e0d43e69442718cd4932116
sm2: MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgefIcY79Be48T8ryF9tMOKDFZ4XmeB9JzBSmEZHGmvhKhRANCAAQmjPisOvJfv2r7mpj06FszOkAlJiyVL6OoefMmXmqSANNqyT8ZxnFpnToYgtqjQqX44IG8fXk49eLjKXQSfJ2J
accessId: d8bc5ba2-7114-46aa-b4e0-141804e4df1c
sceneId: 202505210001

@ -367,6 +367,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="prioritize" column="prioritize"/>
<result property="ssgnq" column="ssgnq"/>
<result property="jsms" column="jsms"/>
<result property="fj" column="fj"/>
</resultMap>
<resultMap type="com.ruoyi.gysl.entity.PlanInformation" id="PlanInfor">
<result property="id" column="id"/>
@ -402,6 +403,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</where>
group by a.id
order by a.create_time desc
</select>

@ -117,8 +117,8 @@ public class SecurityConfig
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers("/system/chief/**").permitAll()
.antMatchers("/system/singlelogin/**").permitAll()
// .antMatchers("/gysl/Cybq/getCybq").permitAll()
.antMatchers("/gysl/basicInformation/**").permitAll()
.antMatchers("/gysl/handbook/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

@ -73,7 +73,7 @@ public class SysLoginService {
*/
public String login(String username, String password, String code, String uuid, Integer loginRole) {
// 验证码校验
// validateCaptcha(username, code, uuid);
// validateCaptcha(username, code, uuid);
// 登录前置校验
String strP;
try {

Loading…
Cancel
Save