Compare commits

...

42 Commits

Author SHA1 Message Date
杜函宇 fee0e42d53 修改定时更新
2 weeks ago
杜函宇 49794f8c56 企业登录修改
3 weeks ago
杜函宇 67d51a0e9a bugfix
4 weeks ago
杜函宇 c6387f598f bugfix
2 months ago
杜函宇 403dedb981 政务端统计更新数据
2 months ago
杜函宇 07b6015175 数据更新
3 months ago
杜函宇 755071c7bb 去除字典缓存
4 months ago
杜函宇 3657913149 bugfix
4 months ago
杜函宇 4b2f6ddbf8 2.11新增在线模板修改
4 months ago
杜函宇 6186827e27 bugfix
5 months ago
杜函宇 9a8e73d2c7 修改短信模板
5 months ago
杜函宇 03d35e0d8b 异步
6 months ago
杜函宇 1d818f74da bugfix
6 months ago
杜函宇 74755c6e28 bugfix
6 months ago
杜函宇 bf276c3902 bugfix
6 months ago
杜函宇 59720dcab8 增加发送邮件功能
6 months ago
杜函宇 40fda3defd bugfix
6 months ago
杜函宇 9773f9680b bugfix
6 months ago
杜函宇 b074ca703a bugfix
6 months ago
杜函宇 bc64c9ef5b 短信修改
6 months ago
杜函宇 b5165c5919 规上工业数据更新
7 months ago
杜函宇 fcdb5e60c7 正式环境修改
7 months ago
杜函宇 3ac23096b8 正式环境修改
7 months ago
杜函宇 44492d18bb bugfix
7 months ago
杜函宇 4fb1e98d32 正式环境
7 months ago
杜函宇 a214fa6fc8 正式环境跳转某企业详细信息
8 months ago
杜函宇 2463035346 正式环境
8 months ago
杜函宇 4d312550a2 正式环境bugfix
8 months ago
杜函宇 27bfc22357 项目库排序修改
8 months ago
杜函宇 568ee6650f Merge branch 'duhanyu' of http://39.101.188.84:7000/suzhou-jichuang-lanhai/JinJiHuJava
8 months ago
杜函宇 d9fc75048b 数据大屏总部企业数量修改
8 months ago
杜函宇 053f43a46b 测试环境
8 months ago
杜函宇 4e5f88dc75 bugfix
8 months ago
杜函宇 bc27886dc7 Merge branch 'duhanyu' of http://39.101.188.84:7000/suzhou-jichuang-lanhai/JinJiHuJava
8 months ago
杜函宇 363ab8a27b bugfix
8 months ago
杜函宇 cc55f3ecef bugfix
8 months ago
杜函宇 15546d7b4c 去除代码生成模块
8 months ago
杜函宇 a38d58d91d 更改RSA加密方式
8 months ago
杜函宇 430052617d 正式环境
8 months ago
杜函宇 a3e17ceb04 脱敏bug中途修改提交
8 months ago
吴顺杰 031d6ae375 bugfix
8 months ago
杜函宇 32c1de479c Origin修改
8 months ago

@ -161,11 +161,11 @@
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.ruoyi</groupId>-->
<!-- <artifactId>ruoyi-generator</artifactId>-->
<!-- <version>${ruoyi.version}</version>-->
<!-- </dependency>-->
<!-- 核心模块-->
<dependency>
@ -203,7 +203,7 @@
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<!-- <module>ruoyi-generator</module>-->
<module>ruoyi-common</module>
<module>ruoyi-flowable</module>
</modules>

@ -16,6 +16,33 @@
</description>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.2.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
@ -32,12 +59,6 @@
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
@ -63,10 +84,10 @@
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.ruoyi</groupId>-->
<!-- <artifactId>ruoyi-generator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

@ -0,0 +1,83 @@
package com.ruoyi.jjh.declaration.component;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.mail.*;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;
/**
*
* @author du
* @since 2024/12/12 9:55
*/
@Component("EmailEnterImpl")
public class EmailEnterImpl implements EmailEnterService{
/**
*
*/
@Value("${isTiming}")
private Boolean isTiming;
/**
* SMTP
*/
@Value("${smtp}")
private String smtp;
/**
* SMTP IP
*/
@Value("${smtpIp}")
private String smtpIp;
/**
* SMTP
*/
@Value("${smtpDk}")
private String smtpDk;
/**
*
*/
@Override
public Boolean toEnter(String subject, String body,String toEmail) {
// 发件人邮箱的登录凭证
String username = "jjdn@sipac.gov.cn"; // 发件人邮箱用户名(一般为邮箱地址)
String password = "N!4lsU.T_#2T2Z"; // 发件人邮箱的授权码
// 设置邮件服务器属性
Properties properties = new Properties();
properties.put("mail.smtp.host", smtpIp);
properties.put("mail.smtp.port", smtpDk);
properties.put("mail.smtp.auth", "true"); // 启用身份验证
properties.put("mail.smtp.starttls.enable", "true"); // 启用 TLS
// 获取邮件会话
Session session = Session.getInstance(properties, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
// 获取邮件会话
try {
// 创建邮件消息
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(username));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmail));
message.setSubject(subject);
message.setText(body);
// 发送邮件
Transport.send(message);
System.out.println("邮件发送成功");
} catch (AddressException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
}
return null;
}
}

@ -0,0 +1,13 @@
package com.ruoyi.jjh.declaration.component;
/**
*
* @author du
* @since 2024/12/12 9:50
*/
public interface EmailEnterService {
/**
*
*/
Boolean toEnter(String subject, String body,String toEmail);
}

@ -1,9 +1,13 @@
package com.ruoyi.jjh.declaration.component;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
import com.ruoyi.jjh.ent.entity.JContacts;
import com.ruoyi.jjh.ent.entity.JEnterpriseContact;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.service.JContactsService;
import com.ruoyi.jjh.ent.service.JEnterpriseContactService;
import com.ruoyi.jjh.ent.service.JSmartDeclarationService;
import com.ruoyi.jjh.ent.service.SmsAlertsService;
@ -12,12 +16,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
*
@ -25,7 +31,7 @@ import java.util.List;
* @author du
* @since 2024/7/18 9:55
*/
@Component("TimingRemind")
@Service
public class TimingRemindImpl implements TimingRemindService {
private static final Logger log = LoggerFactory.getLogger(TimingRemindImpl.class);
@ -45,6 +51,12 @@ public class TimingRemindImpl implements TimingRemindService {
@Resource
private JEnterpriseContactService jEnterpriseContactService;
/**
*
*/
@Resource
private JContactsService jContactsService;
/**
*
*/
@ -57,6 +69,8 @@ public class TimingRemindImpl implements TimingRemindService {
@Resource
private SmsAlertsService smsAlertsService;
@Resource
private EmailEnterService emailEnterService;
/**
*
@ -64,6 +78,9 @@ public class TimingRemindImpl implements TimingRemindService {
@Resource
private SysUserMapper sysUserMapper;
@Autowired
private IBmsEnterpriseDirectoryService enterpriseDirectoryService;
/**
*
*/
@ -86,15 +103,38 @@ public class TimingRemindImpl implements TimingRemindService {
/**
*
*/
@Async("chrisThreadPool")
public void getContact(String code, String s) {
if (isTiming) {
List<JEnterpriseContact> list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list();
list1.forEach(y -> {
//先添加工单再发送短信
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone());
log.info(y.getEnterpriseName() + "发送短信成功!");
});
try {
List<JEnterpriseContact> list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list();
if (list1 != null && !list1.isEmpty()) {
list1.forEach(y -> {
//先添加工单再发送短信
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone());
log.info(y.getEnterpriseName() + "发送短信成功!");
//发送邮件
emailEnterService.toEnter(y.getEnterpriseName(), s + "此邮件为系统自动发送,无需回复!", y.getContactEmail());
log.info(y.getEnterpriseName() + "发送邮件成功!");
});
} else {
List<JContacts> list = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, code)
.eq(JContacts::getDefaultcontact, "1").list();
list.forEach(y -> {
//先添加工单再发送短信
smsAlertsService.addSsmPhone(y.getYddh());
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getQymc(), s, y.getYddh());
log.info(y.getQymc() + "发送短信成功!");
//发送邮件
emailEnterService.toEnter(y.getQymc(), s + "此邮件为系统自动发送,无需回复!", y.getDzyx());
log.info(y.getQymc() + "发送邮件成功!");
});
}
} catch (Exception e) {
throw new ServiceException(code + "发送邮件失败!");
}
}
}
@ -108,7 +148,7 @@ public class TimingRemindImpl implements TimingRemindService {
SysUser user = new SysUser();
user.setUserType("02");
for (SysUser x : sysUserMapper.selectUserList(user)) {
if("0".equals(x.getDelFlag()) & "0".equals(x.getStatus())){
if ("0".equals(x.getDelFlag()) & "0".equals(x.getStatus())) {
JSmartDeclaration sd = new JSmartDeclaration();
sd.setIsRead(1);
sd.setAlertTime(LocalDateTime.parse(t));
@ -120,11 +160,19 @@ public class TimingRemindImpl implements TimingRemindService {
}
sd.setZwId(x.getUserId());
if (isTiming) {
if (sd.getProjectId() != null & !x.getPhonenumber().isEmpty()) {
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看", x.getPhonenumber());
if (sd.getProjectId() != null && x.getPhonenumber() != null) {
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", x.getPhonenumber());
if (!Objects.equals(x.getEmail(), "") && x.getEmail() != null) {
//发送邮件
emailEnterService.toEnter("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", x.getEmail());
}
}
if (!x.getPhonenumber().isEmpty() & sd.getProjectId() == null) {
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看", x.getPhonenumber());
if (x.getPhonenumber() != null && sd.getProjectId() == null) {
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", x.getPhonenumber());
if (!Objects.equals(x.getEmail(), "") && x.getEmail() != null) {
//发送邮件
emailEnterService.toEnter("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", x.getEmail());
}
}
}
listAdd.add(sd);

@ -13,6 +13,7 @@ public interface TimingRemindService {
*/
void enterpriseTiming(String t, Long id);
/**
*
*/

@ -0,0 +1,29 @@
package com.ruoyi.jjh.declaration.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author du
* @since 2025/1/7 15:49
*/
@Configuration
@EnableAsync
public class AsyncConfig {
@Bean(name ="chrisThreadPool")
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(10);
executor.setMaxPoolSize(50);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("chrisThread-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
executor.initialize();
return executor;
}
}

@ -2,14 +2,18 @@ package com.ruoyi.jjh.declaration.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.dto.ApprovalDeclarationRecordsQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsApprovalInfoUpdateDto;
@ -20,26 +24,21 @@ import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.List;
/**
@ -58,15 +57,17 @@ public class BmsDeclarationRecordsController extends BaseController {
@Value("${ruoyi.profile}")
private String fileAddress;
@Value("${server.port}")
private String port;
@Value("${server.servlet.context-path}")
private String path;
@Resource
private BmsDeclarationRecordsMapper bmsDeclarationRecordsMapper;
@Autowired
private ServerConfig serverConfig;
/**
*
*/
@ -93,7 +94,7 @@ public class BmsDeclarationRecordsController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov,ent')")
@ApiOperation(value = "查询在线申报记录列表")
@GetMapping("/list")
public TableDataInfo list(BmsDeclarationRecordsDto bmsDeclarationRecordsDto) {
public AjaxResult list(Page<BmsDeclarationRecordsQueryVo> page,BmsDeclarationRecordsDto bmsDeclarationRecordsDto) {
// 获取当前登录用户是否是企业端
boolean admin = false;
boolean b = false;
@ -107,9 +108,9 @@ public class BmsDeclarationRecordsController extends BaseController {
if (!admin && b) {
bmsDeclarationRecordsDto.setCreditCode(str);
}
startPage();
List<BmsDeclarationRecordsQueryVo> list = bmsDeclarationRecordsService.selectBmsDeclarationRecordsList(bmsDeclarationRecordsDto);
return getDataTable(list);
Page<BmsDeclarationRecordsQueryVo> bmsDeclarationRecordsQueryVoPage = bmsDeclarationRecordsService.selectBmsDeclarationRecordsList(page
,bmsDeclarationRecordsDto);
return success(bmsDeclarationRecordsQueryVoPage);
}
/**
@ -118,43 +119,47 @@ public class BmsDeclarationRecordsController extends BaseController {
// @RequiresPermissions("system:declarationRecords:list")
@GetMapping("/fileList")
@ApiOperation("根据列表id集合压缩所有文件")
public ResponseEntity<byte[]> fileList(@RequestParam(name = "list") List<Long> list) throws FileNotFoundException, UnsupportedEncodingException {
public void fileList(@RequestParam(name = "list") List<Long> list, HttpServletResponse response) throws IOException {
List<BmsDeclarationRecordsQueryVo> rd = bmsDeclarationRecordsMapper.selectDeclarationRecordsToIdList(list);
// 创建父文件目录
String fatherFile = fileAddress + "/" + "项目压缩文件";
String fatherFile = fileAddress + "/项目压缩文件";
FileUtil.mkdir(fatherFile);
for (BmsDeclarationRecordsQueryVo item : rd) {
String itemsFileName = fatherFile + "/" +item.getEnterpriseName()+ item.getProjectName();
FileUtil.mkdir(itemsFileName);
List<String> splitList = bmsDeclarationRecordsService.getAllFile(item.getTemplateJson());
for (String s : splitList) {
// 下载文件
try {
HttpUtil.downloadFile("http://localhost:" + port + s, itemsFileName);
String urls = RuoYiConfig.getProfile() + StringUtils.substringAfter(s, Constants.RESOURCE_PREFIX);
Path sourcePath = Paths.get(urls);
String itemsFileName = fatherFile + "/" + item.getEnterpriseName() + item.getProjectName() + "/" + sourcePath.getFileName();
FileUtil.touch(itemsFileName);
// 目标文件路径
Path targetPath = Paths.get(itemsFileName);
try {
Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
System.out.println("文件成功复制到新的位置!");
} catch (IOException e) {
throw new RuntimeException("暂无该文件!");
}
} catch (Exception e) {
throw new RuntimeException(itemsFileName + "某文件下载失败");
throw new RuntimeException("文件下载失败");
}
}
}
// 压缩后的文件路径
String zipFilePath = fatherFile + ".zip";
// 使用Hutool压缩文件夹
ZipUtil.zip(fatherFile, zipFilePath);
// 从本地读取压缩文件
File zipFile = FileUtil.file(zipFilePath);
// FileSystemResource resource = new FileSystemResource(zipFile);
// 读取本地压缩文件并转为字节数组
byte[] bytes = FileUtil.readBytes(zipFile);
// 设置响应头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode("项目压缩文件.zip", "UTF-8"));
// 删除压缩之前的文件夹
File file = new File(zipFilePath);// 创建File对象
response.setContentType("application/zip");// 设置内容类型为ZIP文件
response.setHeader("Content-Disposition", "attachment; filename=\"file.zip\"");//设置文件名
try (FileInputStream fileInputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream()) {
byte[] buffer = new byte[4096];
int by;
while ((by = fileInputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, by);
}
}
FileUtil.del(zipFilePath);
// 删除压缩包
FileUtil.del(fatherFile);
// 创建响应实体
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
}
/**
@ -176,9 +181,9 @@ public class BmsDeclarationRecordsController extends BaseController {
@Log(title = "在线申报记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BmsDeclarationRecordsDto bmsDeclarationRecordsDto) {
List<BmsDeclarationRecordsQueryVo> list = bmsDeclarationRecordsService.selectBmsDeclarationRecordsList(bmsDeclarationRecordsDto);
Page<BmsDeclarationRecordsQueryVo> bmsDeclarationRecordsQueryVoPage = bmsDeclarationRecordsService.selectBmsDeclarationRecordsList(new Page<>(),bmsDeclarationRecordsDto);
ExcelUtil<BmsDeclarationRecordsQueryVo> util = new ExcelUtil<BmsDeclarationRecordsQueryVo>(BmsDeclarationRecordsQueryVo.class);
util.exportExcel(response, list, "在线申报记录数据");
util.exportExcel(response, bmsDeclarationRecordsQueryVoPage.getRecords(), "在线申报记录数据");
}
/**

@ -9,24 +9,25 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoRequest;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoWorkRequest;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.ent.service.JHeadQuartersRevenueService;
import com.ruoyi.jjh.ent.service.JServicesListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
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.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Controller
@ -42,6 +43,11 @@ public class BmsEnterpriseBasicInfoController extends BaseController {
@Autowired
private IBmsEnterpriseBasicInfoService bmsEnterpriseBasicInfoService;
@Resource
private JServicesListService jServicesListService;
@Resource
private JHeadQuartersRevenueService jHeadQuartersRevenueService;
/**
*
@ -49,8 +55,8 @@ public class BmsEnterpriseBasicInfoController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov,sightseer')")
@ApiOperation(value = "查询企业基础信息列表", response = BmsEnterpriseBasicInfo.class)
@GetMapping("/list")
public AjaxResult list(Page<BmsEnterpriseBasicInfo> page, BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo) {
return success(bmsEnterpriseBasicInfoService.page(page, bmsEnterpriseBasicInfo));
public AjaxResult list(Page<BmsEnterpriseBasicInfo> page, EnterpriseInfoRequest e) {
return success(bmsEnterpriseBasicInfoService.page(page, e));
}
/**
@ -70,8 +76,8 @@ public class BmsEnterpriseBasicInfoController extends BaseController {
@ApiOperation(value = "导出企业基础信息列表")
@Log(title = "企业基础信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo) {
List<BmsEnterpriseBasicInfo> list = bmsEnterpriseBasicInfoService.page(bmsEnterpriseBasicInfo);
public void export(HttpServletResponse response, EnterpriseInfoRequest e) {
List<BmsEnterpriseBasicInfo> list = bmsEnterpriseBasicInfoService.page(e);
ExcelUtil<BmsEnterpriseBasicInfo> util = new ExcelUtil<BmsEnterpriseBasicInfo>(BmsEnterpriseBasicInfo.class);
util.exportExcel(response, list, "企业基础信息数据");
}
@ -80,11 +86,11 @@ public class BmsEnterpriseBasicInfoController extends BaseController {
*
*/
@Transactional(rollbackFor = Exception.class)
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov')")
// @PreAuthorize("@ss.hasAnyRoles('admin,other-gov')")
@ApiOperation(value = "导入企业基础信息列表")
@Log(title = "导入企业基础信息列表", businessType = BusinessType.IMPORT)
@PostMapping(value = "/importEnterprise", consumes = "multipart/form-data")
public AjaxResult importEnterprise(@RequestPart("file") MultipartFile file) throws Exception {
public AjaxResult importEnterprise(@RequestPart("file") MultipartFile file, String type) throws Exception {
List<BmsEnterpriseBasicInfo> allList = bmsEnterpriseBasicInfoService.list();
ExcelUtil<BmsEnterpriseBasicInfo> util = new ExcelUtil<>(BmsEnterpriseBasicInfo.class);
List<BmsEnterpriseBasicInfo> proList = util.importExcel(file.getInputStream());
@ -92,11 +98,11 @@ public class BmsEnterpriseBasicInfoController extends BaseController {
if (proList == null || proList.isEmpty()) {
throw new ServiceException("企业导入数据不能为空");
} else {
proList.forEach(entityA ->{
entityA.setType(2);
proList.forEach(entityA -> {
entityA.setType(type != null ? type : "2");
boolean b = allList.stream().anyMatch(entityB -> entityB.getTyshxydm().equals(entityA.getTyshxydm()));
if(b){
throw new ServiceException(entityA.getQymc()+"在企业库已重复,无法新增!");
if (b) {
throw new ServiceException(entityA.getQymc() + "在企业库已重复,无法新增!");
}
});
bmsEnterpriseBasicInfoService.saveBatch(proList);
@ -138,4 +144,37 @@ public class BmsEnterpriseBasicInfoController extends BaseController {
return success(bmsEnterpriseBasicInfoService.getById(id));
}
/**
*
*/
@ApiOperation(value = "将企业库企业更改分类", response = BmsEnterpriseBasicInfo.class)
@PreAuthorize("@ss.hasAnyRoles('admin')")
@PostMapping(value = "/changeType", consumes = "multipart/form-data")
public AjaxResult changeType(@RequestPart("file") MultipartFile file) throws IOException {
List<BmsEnterpriseBasicInfo> list = bmsEnterpriseBasicInfoService.list();
ExcelUtil<BmsEnterpriseBasicInfo> util = new ExcelUtil<>(BmsEnterpriseBasicInfo.class);
List<BmsEnterpriseBasicInfo> proList = util.importExcel(file.getInputStream());
//存储所有导入的信用代码
Set<String> tyshxydmSet = new HashSet<>();
for (BmsEnterpriseBasicInfo y : proList) {
tyshxydmSet.add(y.getTyshxydm());
}
for (BmsEnterpriseBasicInfo x : list) {
if (tyshxydmSet.contains(x.getTyshxydm())) {
x.setType(x.getType() + "," + "7");
bmsEnterpriseBasicInfoService.updateById(x);
}
}
for (BmsEnterpriseBasicInfo y : list) {
proList.removeIf(x -> x.getTyshxydm().equals(y.getTyshxydm()));
}
proList.forEach(x -> {
x.setType("7");
bmsEnterpriseBasicInfoService.save(x);
});
return success();
}
}

@ -6,26 +6,31 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jjh.declaration.component.EmailEnterService;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseDirectory;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
import com.ruoyi.jjh.ent.entity.JContacts;
import com.ruoyi.jjh.ent.service.JContactsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Controller
*
* @author farben
* @date 2023-08-31
* @date 2023-08-3100
*/
@Api(tags = "企业名录")
@RestController
@ -34,6 +39,22 @@ public class BmsEnterpriseDirectoryController extends BaseController {
@Autowired
private IBmsEnterpriseDirectoryService bmsEnterpriseDirectoryService;
@Resource
private IBmsEnterpriseBasicInfoService iBmsEnterpriseBasicInfoService;
@Resource
private JContactsService jContactsService;
@Resource
private EmailEnterService emailEnterService;
@ApiOperation(value = "导出用名字和企业库名字做对比企业库没有的企业")
@PostMapping(value = "/g1")
public void check(String email,String user,String toEmail) {
emailEnterService.toEnter(email,user,toEmail);
}
/**
*
*/
@ -97,4 +118,59 @@ public class BmsEnterpriseDirectoryController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bmsEnterpriseDirectoryService.deleteBmsEnterpriseDirectoryByIds(ids));
}
/**
*
*/
// @PreAuthorize("@ss.hasAnyRoles('admin')")
// @ApiOperation(value = "导出用名字和企业库名字做对比企业库没有的企业")
// @PostMapping(value = "/check", consumes = "multipart/form-data")
// public void check(@RequestPart("file") MultipartFile file, HttpServletResponse response) throws Exception {
// //利用企业名录的东西来获取所有企业
// ExcelUtil<BmsEnterpriseDirectory> util = new ExcelUtil<>(BmsEnterpriseDirectory.class);
// List<BmsEnterpriseDirectory> proList = util.importExcel(file.getInputStream());
// //获取企业库的所有企业
// List<BmsEnterpriseBasicInfo> list = iBmsEnterpriseBasicInfoService.list();
// Set<String> bNames = list.stream()
// .map(BmsEnterpriseBasicInfo::getQymc)
// .collect(Collectors.toSet());
// List<BmsEnterpriseDirectory> filteredList = proList.stream()
// .filter(a -> !bNames.contains(a.getEnterpriseName()))
// .collect(Collectors.toList());
//// System.out.println(filteredList.size());
// //导出
// util.exportExcel(response, filteredList, "企业名录数据");
// }
/**
*
*/
// @PreAuthorize("@ss.hasAnyRoles('admin')")
// @ApiOperation(value = "查询联系人")
// @PostMapping(value = "/searchContact", consumes = "multipart/form-data")
// public AjaxResult searchContact(@RequestPart("file") MultipartFile file) throws Exception {
// //利用企业名录的东西来获取所有企业
// ExcelUtil<BmsEnterpriseDirectory> util = new ExcelUtil<>(BmsEnterpriseDirectory.class);
// List<BmsEnterpriseDirectory> proList = util.importExcel(file.getInputStream());
// //获取企业库的所有企业
// List<BmsEnterpriseBasicInfo> list = iBmsEnterpriseBasicInfoService.list();
// Set<String> bNames = proList.stream()
// .map(BmsEnterpriseDirectory::getEnterpriseName)
// .collect(Collectors.toSet());
// List<BmsEnterpriseBasicInfo> filteredList = list.stream()
// .filter(a -> bNames.contains(a.getQymc()))
// .collect(Collectors.toList());
//// System.out.println(filteredList.size());
//// System.out.println(proList.size());
// filteredList.forEach(x -> {
// List<JContacts> list1 = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, x.getTyshxydm()).list();
// if (!list1.isEmpty()) {
// System.out.println(x.getQymc() + "----" + list1.size());
// } else {
// System.out.println(x.getQymc() + "----" + 0);
// }
// });
// return success();
// }
}

@ -84,8 +84,8 @@ public class BmsTemplateInfoController extends BaseController {
@Log(title = "导出模板表单", businessType = BusinessType.EXPORT)
@ApiOperation(value = "导出模板表单")
@GetMapping(value = "/exportTemplate/{id}")
public void exportTemplate(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") Long id) {
bmsTemplateInfoService.exportTemplate(request, response, id);
public void exportTemplate(HttpServletResponse response, @PathVariable("id") Long id) {
bmsTemplateInfoService.exportTemplate( response,id);
}
/**

@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@ -105,10 +106,19 @@ public class BmsTemplateRecordController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov')")
@Log(title = "在线模板", businessType = BusinessType.INSERT)
@PostMapping
@Transactional(rollbackFor = Exception.class)
public AjaxResult add(@RequestBody BmsTemplateRecordAddDto bmsTemplateRecordAddDto) {
return toAjax(bmsTemplateRecordService.insertBmsTemplateRecord(bmsTemplateRecordAddDto));
}
/**
*
*/
@ApiOperation(value = "根据信用代码集合查询企业信息")
@PostMapping("/searchEntCodeToInfo")
public AjaxResult searchEntCodeToInfo(@RequestBody List<String> code) {
return success(bmsTemplateRecordService.searchEntCodeToInfo(code));
}
// /**
// * 修改在线模板

@ -9,6 +9,7 @@ import com.ruoyi.common.annotation.Excels;
import com.ruoyi.jjh.common.entity.BaseInfoEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import liquibase.pro.packaged.S;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -38,12 +39,12 @@ public class BmsEnterpriseBasicInfo extends BaseInfoEntity {
private Integer multiple;
/**
* 1. 2
* 1. 2 3 4 5 6
*/
@ApiModelProperty("分类 1.规上服务业 2其他")
@ApiModelProperty("分类 1.规上服务业 2其他 3规上工业 4总部企业 5生产性服务业 6限上批零住餐 7生活性服务业")
@JSONField(serialize = false)
@Excel(name = "分类", readConverterExp = "1=规上服务业,2=其他")
private Integer type;
@Excel(name = "分类", readConverterExp = "1.规上服务业 2其他 3规上工业 4总部企业 5生产性服务业 6限上批零住餐 7生活性服务业")
private String type;
/**

@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.time.LocalDate;
/**
@ -85,4 +86,8 @@ public class BmsTemplateRecord extends BaseInfoEntity {
@Excel(name = "是否需要审批", readConverterExp = "0=不需要审批,1=需要审批")
@ApiModelProperty(value = "0=不需要审批,1=需要审批")
private Integer isApproval;
@NotBlank
@ApiModelProperty(value = "短信内容")
private String smsInfo;
}

@ -18,7 +18,7 @@ import java.util.List;
* @create: 2023-08-28 17:54
*/
@Data
@EqualsAndHashCode(callSuper = true)
//@EqualsAndHashCode(callSuper = true)
public class BmsDeclarationRecordsDto extends BmsDeclarationRecords {
@ -26,6 +26,10 @@ public class BmsDeclarationRecordsDto extends BmsDeclarationRecords {
@Excel(name = "申报任务标题")
private String enterpriseDirectory;
// private Integer pageSize;
//
// private Integer pageNum;
@ApiModelProperty(value = "申报单位")
@Excel(name = "申报单位")

@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**

@ -0,0 +1,40 @@
package com.ruoyi.jjh.declaration.entity.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author du
* @since 2024/11/21 9:10
*/
@Data
@ApiModel("企业库查询请求体")
public class EnterpriseInfoRequest {
/**
* 1. 2 3 4 5 6
*/
@ApiModelProperty("分类 1.规上服务业 2其他 3规上工业 4总部企业 5生产性服务业 6限上批零住餐")
private Integer type;
/**
*
*/
@ApiModelProperty("企业名称")
private String qymc;
/**
*
*/
@ApiModelProperty("统一社会信用代码")
private String tyshxydm;
/**
* 01
*/
@ApiModelProperty("是否删除0未删除1已删除")
private Long isDeleted;
}

@ -99,6 +99,11 @@ public class BmsDeclarationRecordsQueryVo implements Serializable {
@Excel(name = "审批状态", readConverterExp = "0=待填报,1=初审中,2=复审中,3=终审中,5=评审通过,6=已填报,7=复审不通过,8=初审驳回,9=终审不通过10=退回修改")
private Long status;
@ApiModelProperty(value = "在线模板状态")
@Excel(name = "在线模板状态", readConverterExp = " 0=未开始 1=过期 2=有效 3=长期有效")
private Long templateRecordStatus;
/**
* json

@ -1,6 +1,7 @@
package com.ruoyi.jjh.declaration.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.dto.ApprovalDeclarationRecordsQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsDto;
@ -33,7 +34,7 @@ public interface BmsDeclarationRecordsMapper extends BaseMapper<BmsDeclarationRe
* @param bmsDeclarationRecordsDto 线
* @return 线
*/
public List<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsList(BmsDeclarationRecordsDto bmsDeclarationRecordsDto);
public Page<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsList(Page<BmsDeclarationRecordsQueryVo> page,@Param("req") BmsDeclarationRecordsDto bmsDeclarationRecordsDto);
public List<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsZwList(BmsDeclarationRecordsDto bmsDeclarationRecordsDto);

@ -3,6 +3,7 @@ package com.ruoyi.jjh.declaration.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoRequest;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoWorkRequest;
import org.apache.ibatis.annotations.Param;
@ -21,7 +22,7 @@ public interface BmsEnterpriseBasicInfoMapper extends BaseMapper<BmsEnterpriseBa
* @param bmsEnterpriseBasicInfo
* @return
*/
public Page<BmsEnterpriseBasicInfo> page(Page<BmsEnterpriseBasicInfo> page, @Param("req") BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo);
public Page<BmsEnterpriseBasicInfo> page(Page<BmsEnterpriseBasicInfo> page, @Param("req") EnterpriseInfoRequest bmsEnterpriseBasicInfo);
/**
@ -30,7 +31,7 @@ public interface BmsEnterpriseBasicInfoMapper extends BaseMapper<BmsEnterpriseBa
* @param bmsEnterpriseBasicInfo
* @return
*/
List<BmsEnterpriseBasicInfo> page(@Param("req") BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo);
List<BmsEnterpriseBasicInfo> page(@Param("req") EnterpriseInfoRequest bmsEnterpriseBasicInfo);
/**
*

@ -2,6 +2,7 @@ package com.ruoyi.jjh.declaration.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseDirectory;
import com.ruoyi.jjh.declaration.entity.BmsTemplateRecord;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordQueryDto;
import com.ruoyi.jjh.declaration.entity.vo.BmsTemplateRecordQueryVo;
@ -58,6 +59,12 @@ public interface BmsTemplateRecordMapper extends BaseMapper<BmsTemplateRecord> {
*/
public Page<BmsTemplateRecordQueryVo> selectTemplateRecordVo(Page<BmsTemplateRecordQueryVo> page, @Param("req") BmsTemplateRecordQueryDto bmsTemplateRecordQueryDto);
/**
*
*/
List<BmsEnterpriseDirectory> searchEntCodeToInfo(@Param("code") List<String> code);
// /**
// * 企业端选择表单模板列表
// * @param bmsTemplateQueryDto

@ -1,6 +1,7 @@
package com.ruoyi.jjh.declaration.regular;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.jjh.declaration.component.EmailEnterService;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import com.ruoyi.jjh.ent.service.SmsAlertsService;
@ -35,6 +36,9 @@ public class SmsEnterChange {
@Value("${isTiming}")
private Boolean isTiming;
@Resource
private EmailEnterService emailEnterService;
// 每三小时执行一次
@Scheduled(cron = "0 0 */12 * * *")
private void runTask() {
@ -48,7 +52,8 @@ public class SmsEnterChange {
list1.removeIf(x -> x.getPhonenumber().isEmpty());
for (SysUser items : list1) {
if("0".equals(items.getDelFlag()) & "0".equals(items.getStatus())) {
smsAlertsService.enterSms("政府人员-" + items.getNickName(), "您有" + count + "个新的申报审核任务[待初审]", items.getPhonenumber());
emailEnterService.toEnter("政府人员-" + items.getNickName(),"您有" + count + "个新的申报审核任务[待初审],"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login"+"此邮件为系统自动发送,无需回复!",items.getEmail());
smsAlertsService.enterSms("政府人员-" + items.getNickName(), "您有" + count + "个新的申报审核任务[待初审],"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login", items.getPhonenumber());
}
}
}
@ -61,7 +66,8 @@ public class SmsEnterChange {
list2.removeIf(x -> x.getPhonenumber().isEmpty());
for (SysUser items : list2) {
if("0".equals(items.getDelFlag()) & "0".equals(items.getStatus())) {
smsAlertsService.enterSms("政府人员-" + items.getNickName(), "您有" + count1 + "个新的申报审核任务[待复审]", items.getPhonenumber());
emailEnterService.toEnter("政府人员-" + items.getNickName(),"您有" + count1 + "个新的申报审核任务[待复审],"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login"+"此邮件为系统自动发送,无需回复!",items.getEmail());
smsAlertsService.enterSms("政府人员-" + items.getNickName(), "您有" + count1 + "个新的申报审核任务[待复审],"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login", items.getPhonenumber());
}
}
}
@ -74,7 +80,8 @@ public class SmsEnterChange {
list3.removeIf(x -> x.getPhonenumber().isEmpty());
for (SysUser items : list3) {
if("0".equals(items.getDelFlag()) & "0".equals(items.getStatus())) {
smsAlertsService.enterSms("政府人员-" + items.getNickName(), "您有" + count2 + "个新的申报审核任务[待终审]", items.getPhonenumber());
emailEnterService.toEnter("政府人员-" + items.getNickName(),"您有" + count2 + "个新的申报审核任务[待终审],"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login"+"此邮件为系统自动发送,无需回复!",items.getEmail());
smsAlertsService.enterSms("政府人员-" + items.getNickName(), "您有" + count2 + "个新的申报审核任务[待终审],"+"登录网址为:https://idp.sipac.gov.cn/bms/#/login", items.getPhonenumber());
}
}
}

@ -6,6 +6,7 @@ import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.jjh.declaration.component.EmailEnterService;
import com.ruoyi.jjh.declaration.component.TimingRemindService;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.BmsTemplateInfo;
@ -18,11 +19,7 @@ import com.ruoyi.jjh.ent.entity.JContacts;
import com.ruoyi.jjh.ent.entity.JProject;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.entity.JSmartReminders;
import com.ruoyi.jjh.ent.service.JContactsService;
import com.ruoyi.jjh.ent.service.JProjectService;
import com.ruoyi.jjh.ent.service.JSmartDeclarationService;
import com.ruoyi.jjh.ent.service.JSmartRemindersService;
import com.ruoyi.jjh.ent.service.SmsAlertsService;
import com.ruoyi.jjh.ent.service.*;
import com.ruoyi.quartz.service.ISysJobService;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -126,6 +123,9 @@ public class TimeChange {
@Resource
private JProjectService jProjectService;
@Resource
private EmailEnterService emailEnterService;
/**
*
*/
@ -139,20 +139,17 @@ public class TimeChange {
}
public void getTime(BmsTemplateRecord items) {
LocalDate currentDate = LocalDate.now();
LocalDate startDate = LocalDate.of(items.getStartTime().getYear(), items.getStartTime().getMonth(), items.getStartTime().getDayOfMonth());
LocalDate endDate = LocalDate.of(items.getEndTime().getYear(), items.getEndTime().getMonth(), items.getEndTime().getDayOfMonth());
if (currentDate.isBefore(startDate)) {
items.setStatus(0);
}
if (currentDate.isAfter(endDate)) {
items.setStatus(1);
}
if (currentDate.equals(startDate) || currentDate.equals(endDate)) {
items.setStatus(2);
}
if (currentDate.isAfter(startDate) && currentDate.isBefore(endDate)) {
items.setStatus(2);
if (items.getIsTime() == 0) {
LocalDate currentDate = LocalDate.now();
LocalDate startDate = items.getStartTime();
LocalDate endDate = items.getEndTime();
if (currentDate.isBefore(startDate)) {
items.setStatus(0); // 未开始
} else if (currentDate.isAfter(endDate)) {
items.setStatus(1); // 已结束
} else {
items.setStatus(2); // 进行中(包含在区间内和边界值)
}
}
}
@ -197,7 +194,7 @@ public class TimeChange {
if (total > 0) {
// 直接转换第一个元素为BmsEnterpriseBasicInfo对象
BmsEnterpriseBasicInfo res = JSONUtil.toBean(arr.getJSONObject(0).toString(), BmsEnterpriseBasicInfo.class);
if(items.getType() != 1){
if (!"1".equals(items.getType())) {
res.setQygm("其他");
}
res.setId(items.getId());
@ -240,7 +237,15 @@ public class TimeChange {
JContacts res = JSONUtil.toBean(o.toString(), JContacts.class);
allList.add(res);
}
jContactsService.saveOrUpdateBatch(allList);
List<JContacts> list1 = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, items.getTyshxydm()).list();
List<String> str = new ArrayList<>();
list1.forEach(x -> str.add(x.getDwAgencykey()));
if (!list1.isEmpty()) {
jContactsService.removeBatchByIds(str);
jContactsService.saveBatch(allList);
} else {
jContactsService.saveBatch(allList);
}
}
}
}
@ -270,7 +275,6 @@ public class TimeChange {
y.setAlertTime(y.getEndTime().minusDays(qy.getDaysAdvance()));
if (y.getTyshxydm() != null) {
if (isTiming) {
//发送短信
timingRemindImpl.getContact(y.getTyshxydm(), "您有1个申报任务即将结束,请前往系统首页查看");
}
}
@ -285,7 +289,7 @@ public class TimeChange {
SysUser user = new SysUser();
user.setUserType("02");
for (SysUser o : sysUserMapper.selectUserList(user)) {
if("0".equals(o.getDelFlag()) & "0".equals(o.getStatus())) {
if ("0".equals(o.getDelFlag()) & "0".equals(o.getStatus())) {
JSmartDeclaration y = new JSmartDeclaration();
y.setSmartRemindersId(2L);
y.setIsRead(1);
@ -294,7 +298,8 @@ public class TimeChange {
y.setZwId(o.getUserId());
bmsDeclarationRecords.add(y);
if (isTiming) {
smsAlertsService.enterSms("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。", o.getPhonenumber());
emailEnterService.toEnter("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。" + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", o.getEmail());
smsAlertsService.enterSms("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。" + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", o.getPhonenumber());
}
}
}

@ -1,5 +1,6 @@
package com.ruoyi.jjh.declaration.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.dto.ApprovalDeclarationRecordsQueryDto;
@ -8,6 +9,7 @@ import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsDto;
import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.DeclarationRecordsVo;
import com.ruoyi.jjh.ent.entity.JMemorandum;
import com.ruoyi.jjh.ent.entity.JProject;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
@ -34,7 +36,7 @@ public interface IBmsDeclarationRecordsService extends IService<BmsDeclarationRe
* @param bmsDeclarationRecordsDto 线
* @return 线
*/
public List<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsList(BmsDeclarationRecordsDto bmsDeclarationRecordsDto);
public Page<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsList(Page<BmsDeclarationRecordsQueryVo> page, BmsDeclarationRecordsDto bmsDeclarationRecordsDto);
public List<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsZwList(BmsDeclarationRecordsDto bmsDeclarationRecordsDto);

@ -3,6 +3,7 @@ package com.ruoyi.jjh.declaration.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoRequest;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoWorkRequest;
import java.util.List;
@ -19,18 +20,18 @@ public interface IBmsEnterpriseBasicInfoService extends IService<BmsEnterpriseBa
/**
*
*
* @param bmsEnterpriseBasicInfo
* @param e
* @return
*/
Page<BmsEnterpriseBasicInfo> page(Page<BmsEnterpriseBasicInfo> page, BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo);
Page<BmsEnterpriseBasicInfo> page(Page<BmsEnterpriseBasicInfo> page, EnterpriseInfoRequest e);
/**
*
*
* @param bmsEnterpriseBasicInfo
* @param e
* @return
*/
List<BmsEnterpriseBasicInfo> page(BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo);
List<BmsEnterpriseBasicInfo> page(EnterpriseInfoRequest e);
List<BmsEnterpriseBasicInfo> workSearch(EnterpriseInfoWorkRequest enterpriseInfoWorkRequest);

@ -36,14 +36,12 @@ public interface IBmsTemplateInfoService extends IService<BmsTemplateInfo> {
/**
*
*
* @param request
* @param response
* @param id
* @return
* @author emiya.xie
* @create 2023/8/31 10:25
*/
public void exportTemplate(HttpServletRequest request, HttpServletResponse response, Long id);
public void exportTemplate(HttpServletResponse response,Long id);
/**

@ -2,6 +2,7 @@ package com.ruoyi.jjh.declaration.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseDirectory;
import com.ruoyi.jjh.declaration.entity.BmsTemplateRecord;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordQueryDto;
@ -89,5 +90,8 @@ public interface IBmsTemplateRecordService extends IService<BmsTemplateRecord> {
*/
public int deleteBmsTemplateRecordById(Long id);
/**
*
*/
List<BmsEnterpriseDirectory> searchEntCodeToInfo(List<String> code);
}

@ -4,16 +4,13 @@ import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.jjh.declaration.component.TimingRemindService;
import com.ruoyi.jjh.declaration.entity.BmsApprovalInfo;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.BmsProcessInfo;
import com.ruoyi.jjh.declaration.entity.BmsTemplateRecord;
import com.ruoyi.jjh.declaration.entity.*;
import com.ruoyi.jjh.declaration.entity.dto.ApprovalDeclarationRecordsQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsApprovalInfoUpdateDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsDto;
@ -21,12 +18,7 @@ import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.DeclarationRecordsVo;
import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper;
import com.ruoyi.jjh.declaration.service.IBmsApprovalInfoService;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsProcessInfoService;
import com.ruoyi.jjh.declaration.service.IBmsTemplateRecordService;
import com.ruoyi.jjh.declaration.service.ICommonService;
import com.ruoyi.jjh.declaration.service.*;
import com.ruoyi.jjh.ent.entity.JProject;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.service.JProjectService;
@ -106,7 +98,6 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
return declarationRecordsVo;
}
/**
* 线
*
@ -114,10 +105,11 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
* @return 线
*/
@Override
public List<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsList(BmsDeclarationRecordsDto bmsDeclarationRecordsDto) {
return baseMapper.selectBmsDeclarationRecordsList(bmsDeclarationRecordsDto);
public Page<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsList(Page<BmsDeclarationRecordsQueryVo> page, BmsDeclarationRecordsDto bmsDeclarationRecordsDto) {
return baseMapper.selectBmsDeclarationRecordsList(page, bmsDeclarationRecordsDto);
}
@Override
public List<BmsDeclarationRecordsQueryVo> selectBmsDeclarationRecordsZwList(BmsDeclarationRecordsDto bmsDeclarationRecordsDto) {
return baseMapper.selectBmsDeclarationRecordsZwList(bmsDeclarationRecordsDto);

@ -3,6 +3,7 @@ package com.ruoyi.jjh.declaration.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoRequest;
import com.ruoyi.jjh.declaration.entity.request.EnterpriseInfoWorkRequest;
import com.ruoyi.jjh.declaration.mapper.BmsEnterpriseBasicInfoMapper;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
@ -23,23 +24,23 @@ public class BmsEnterpriseBasicInfoServiceImpl extends ServiceImpl<BmsEnterprise
/**
*
*
* @param bmsEnterpriseBasicInfo
* @param e
* @return
*/
@Override
public Page<BmsEnterpriseBasicInfo> page(Page<BmsEnterpriseBasicInfo> page, BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo) {
return baseMapper.page(page, bmsEnterpriseBasicInfo);
public Page<BmsEnterpriseBasicInfo> page(Page<BmsEnterpriseBasicInfo> page, EnterpriseInfoRequest e) {
return baseMapper.page(page, e);
}
/**
*
*
* @param bmsEnterpriseBasicInfo
* @param e
* @return
*/
@Override
public List<BmsEnterpriseBasicInfo> page(BmsEnterpriseBasicInfo bmsEnterpriseBasicInfo) {
return baseMapper.page(bmsEnterpriseBasicInfo);
public List<BmsEnterpriseBasicInfo> page(EnterpriseInfoRequest e) {
return baseMapper.page(e);
}

@ -1,10 +1,10 @@
package com.ruoyi.jjh.declaration.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.jjh.declaration.entity.BmsTemplateInfo;
import com.ruoyi.jjh.declaration.mapper.BmsTemplateInfoMapper;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
@ -12,12 +12,12 @@ import com.ruoyi.jjh.declaration.service.IBmsTemplateInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
@ -57,41 +57,39 @@ public class BmsTemplateInfoServiceImpl extends ServiceImpl<BmsTemplateInfoMappe
/**
*
*
* @param request
* @param response
* @param id
* @return
* @author emiya.xie
* @create 2023/8/31 10:25
*/
@Override
public void exportTemplate(HttpServletRequest request, HttpServletResponse response, Long id) {
public void exportTemplate(HttpServletResponse response, Long id) {
BmsTemplateInfo bmsTemplateInfo = baseMapper.selectById(id);
if (BeanUtil.isEmpty(bmsTemplateInfo)) {
throw new ServiceException("没有找到合适的模板!");
JSONArray js1 = JSONObject.parse(bmsTemplateInfo.getTemplateJson()).getJSONArray("fields");
List<List<String>> list = new ArrayList<>();
for (Object o : js1) {
JSONObject parse = JSONObject.parse(o.toString());
List<String> head0 = new ArrayList<>();
head0.add(parse.get("label").toString());
list.add(head0);
}
String fileName = bmsTemplateInfo.getTemplateName() + ".xlsx";
String file = "/template/" + fileName;
InputStream is = this.getClass().getResourceAsStream(file);
byte[] fileData = new byte[0];
try {
fileData = input2byte(is);
// 创建 Excel 写入流
// 设置响应头,告诉浏览器下载文件
// 设置响应头,告诉浏览器下载文件
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename="+fileName);
try (ServletOutputStream outputStream = response.getOutputStream()) {
// 使用 EasyExcel 写数据到响应流
EasyExcel.write(outputStream)
// 这里放入动态头
.head(list).sheet("模板")
// 当然这里数据也可以用 List<List<String>> 去传入
.doWrite(new ArrayList<>());
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
FileUtils.downloadFile(response, request, fileName, fileData);
}
private byte[] input2byte(InputStream inStream)
throws IOException {
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100];
int rc = 0;
while ((rc = inStream.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] in2b = swapStream.toByteArray();
return in2b;
}

@ -5,11 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.jjh.declaration.component.TimingRemindService;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseDirectory;
import com.ruoyi.jjh.declaration.entity.BmsTemplateInfo;
import com.ruoyi.jjh.declaration.entity.BmsTemplateRecord;
import com.ruoyi.jjh.declaration.entity.*;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordUpdateDto;
@ -17,20 +13,19 @@ import com.ruoyi.jjh.declaration.entity.vo.BmsTemplateRecordQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsTemplateRecordVo;
import com.ruoyi.jjh.declaration.mapper.BmsTemplateRecordMapper;
import com.ruoyi.jjh.declaration.regular.TimeChange;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
import com.ruoyi.jjh.declaration.service.IBmsTemplateInfoService;
import com.ruoyi.jjh.declaration.service.IBmsTemplateRecordService;
import com.ruoyi.jjh.declaration.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.time.Year;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* 线Service
@ -194,7 +189,7 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertBmsTemplateRecord(BmsTemplateRecordAddDto bmsTemplateRecordAddDto) {
public int insertBmsTemplateRecord(@Valid BmsTemplateRecordAddDto bmsTemplateRecordAddDto) {
// 1 新增申报任务时,增加一个选项:是否审批(需要审批/不需要审批),选了“不需要审批”的企业填报后,状态变为“已填报”,不再进行后续流程,并且这种情况不对接到项目库。
// 2、新增申报任务时若项目分类选择了“企业信息收集”里面的则只能选择“不需要审批”这类申报都不对接项目库。
BmsTemplateInfo tp = iBmsTemplateInfoService.getById(bmsTemplateRecordAddDto.getTemplateId());
@ -226,13 +221,19 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
List<BmsDeclarationRecords> drlist = new ArrayList<>();
//如果前端部分企业名录集合为空
if (null != enterpriseDirectoryList && enterpriseDirectoryList.size() > 0) {
enterpriseDirectoryList.forEach(x -> {
List<BmsEnterpriseDirectory> deduplicatedList = new ArrayList<>(enterpriseDirectoryList.stream()
.collect(Collectors.toMap(
BmsEnterpriseDirectory::getCreditCode,
p -> p, // 映射为 Person 对象
(existing, replacement) -> existing)) // 如果 id 重复,保留第一个
.values());
deduplicatedList.forEach(x -> {
getDeclarationRecordsList(bmsTemplateRecordAddDto, drlist, x.getCreditCode().trim(), tp.getTemplateJson());
x.setTemplateRecordId(bmsTemplateRecordAddDto.getId());
x.setCreditCode(x.getCreditCode().trim());
x.setEnterpriseName(x.getEnterpriseName().trim());
});
enterpriseDirectoryService.saveBatch(enterpriseDirectoryList);
enterpriseDirectoryService.saveBatch(deduplicatedList);
} else {
List<BmsEnterpriseBasicInfo> list = iBmsEnterpriseBasicInfoService.list();
List<BmsEnterpriseDirectory> copyList = new ArrayList<>();
@ -251,10 +252,19 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
//获取每个企业对应的常用联系人
if (isTiming) {
List<BmsEnterpriseDirectory> list = enterpriseDirectoryService.lambdaQuery().eq(BmsEnterpriseDirectory::getTemplateRecordId, bmsTemplateRecordAddDto.getId()).list();
for (BmsEnterpriseDirectory x : list) {
timingRemindImpl.getContact(x.getCreditCode(), "您有1个新的申报任务[待填报]");
List<CompletableFuture<Void>> list2 = new ArrayList<>();
int batchSize = 49; // 每批处理的数据量
for (int i = 0; i < list.size(); i += batchSize) {
final List<BmsEnterpriseDirectory> batch = list.subList(i, Math.min(i + batchSize, list.size()));
list2.add(CompletableFuture.runAsync(() -> {
batch.forEach(data -> {
// 处理每条数据
timingRemindImpl.getContact(data.getCreditCode(), bmsTemplateRecordAddDto.getSmsInfo());
});
}));
}
}
System.out.println("主进程结束!");
return num;
}
@ -350,5 +360,13 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
return baseMapper.deleteBmsTemplateRecordById(id);
}
/**
*
*/
@Override
public List<BmsEnterpriseDirectory> searchEntCodeToInfo(List<String> code) {
return baseMapper.searchEntCodeToInfo(code);
}
}

@ -92,7 +92,11 @@ public class ChiefController {
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.setToken(
singleLoginService.singleLogin(
bean.getAccountName(),
bean.getName(), null,
"02", bean.getMobile(),bean.getEmail()));
return AjaxResult.success(bean);
} else {
throw new ServiceException("登陆失败");
@ -103,4 +107,26 @@ public class ChiefController {
}
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());
}
}

@ -6,6 +6,7 @@ package com.ruoyi.jjh.declaration.single.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;
@ -81,7 +82,7 @@ public class SingleLoginController {
@GetMapping("/login")
public void login(HttpServletResponse response) throws IOException {
//变成参数模式,appid 用于校验提交的来源地址,生产环境会校验,试用环境暂不校验
String scUrl = "clientUrl=" + URLEncoder.encode(returnUrl, "UTF-8") + "?appid=" + enterpriseAppId;
String scUrl = "clientUrl=" + URLEncoder.encode(returnUrl, "UTF-8") + "&appid=" + enterpriseAppId;
//加密后的客户端地址
scUrl = Base64.getEncoder().encodeToString(scUrl.getBytes());
//最终跳转地址
@ -101,10 +102,11 @@ public class SingleLoginController {
@ApiOperation(value = "获取用户信息", response = UserResponse.class)
@GetMapping("/getInfo")
public AjaxResult getInfo(String clientToken) throws Exception {
HttpResponse response = HttpUtil.createGet(infoUrl)
HttpResponse response = HttpRequest.get(infoUrl)
.form("clienttoken", clientToken)
// .addHeaders(generationHeader())
.addHeaders(generationHeader())
.execute();
System.out.println(response.body());
String responseBody;
// 获取响应状态码
int statusCode = response.getStatus();
@ -131,7 +133,7 @@ public class SingleLoginController {
id = bmsEnterpriseBasicInfo.getId();
}
// 设置过期时间为8小时
String token = singleLoginService.singleLogin(req.getUscc(), req.getEpname(), id, "01", null);
String token = singleLoginService.singleLogin(req.getUscc(), req.getEpname(), id, "01", null,null);
res.setToken(token);
res.setMain(req);
redisCache.setCacheObject(key, res, expirationSeconds, TimeUnit.MINUTES);
@ -158,7 +160,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;
// 获取响应状态码

@ -11,6 +11,6 @@ public interface SingleLoginService {
/**
* token
*/
String singleLogin(String userName, String nickName, Long id, String userType, String phone);
String singleLogin(String userName, String nickName, Long id, String userType, String phone,String email);
}

@ -50,15 +50,16 @@ public class SingleLoginServiceImpl implements SingleLoginService {
* token
*/
@Override
public String singleLogin(String userName, String nickName, Long id, String userType, String phone) {
public String singleLogin(String userName, String nickName, Long id, String userType, String phone,String email) {
// 用户验证
Authentication authentication;
try {
SysUser user = new SysUser();
user.setUserName(userName);
user.setNickName(nickName);
user.setPassword("admin123");
user.setPassword("Jinjihu@2024//**...");
user.setPhonenumber(phone);
user.setEmail(email);
Long[] roles = new Long[1];
if ("01".equals(userType)) {
roles[0] = 101L;
@ -83,7 +84,7 @@ public class SingleLoginServiceImpl implements SingleLoginService {
// }
}
//新增user账号密码
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(userName, "admin123");
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(userName, "Jinjihu@2024//**...");
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);

@ -52,7 +52,7 @@ public class HMAC256Config {
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
//初始化加密器并加密
Cipher deCipher = Cipher.getInstance(PATTERN);
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);

@ -16,7 +16,8 @@ public class AESEncryptor {
public static String encrypt(String data) throws Exception {
SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY.getBytes(), ALGORITHM);
Cipher cipher = Cipher.getInstance(ALGORITHM);
// Cipher cipher = Cipher.getInstance(ALGORITHM);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
byte[] encryptedBytes = cipher.doFinal(data.getBytes());
return Base64.getEncoder().encodeToString(encryptedBytes);
@ -24,7 +25,8 @@ public class AESEncryptor {
public static String decrypt(String encryptedData) throws Exception {
SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY.getBytes(), ALGORITHM);
Cipher cipher = Cipher.getInstance(ALGORITHM);
// Cipher cipher = Cipher.getInstance(ALGORITHM);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
byte[] decryptedBytes = cipher.doFinal(Base64.getDecoder().decode(encryptedData));
return new String(decryptedBytes);

@ -1,6 +1,11 @@
package com.ruoyi.jjh.ent.controller;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -8,12 +13,15 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.regular.TimeChange;
import com.ruoyi.jjh.ent.entity.JContacts;
import com.ruoyi.jjh.ent.entity.JMemorandum;
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
import com.ruoyi.jjh.ent.service.JMemorandumService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -25,6 +33,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
@ -46,6 +56,9 @@ public class JMemorandumController extends BaseController {
@Resource
private TimeChange ts;
@Value("${enterpriseUrl}")
private String enterpriseUrl;
/**
*
*
@ -75,6 +88,31 @@ public class JMemorandumController extends BaseController {
return AjaxResult.success();
}
@PreAuthorize("@ss.hasAnyRoles('admin')")
@ApiOperation(value = "查看法人库-企业联络人员")
@GetMapping("/getOneContacts/{tyshxydm}")
public AjaxResult selectAll3(@PathVariable String tyshxydm) {
String contacts = enterpriseUrl + "/645383/qyllrytyshxydm";
JSONArray arr = null;
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
headers.put("Content-Type", "application/json;charset=utf-8");
//请求体
JSONObject jsonObject = new JSONObject();//存放参数
jsonObject.set("tyshxydm", tyshxydm);
jsonObject.set("pageIndex", 0);
HttpResponse response = HttpRequest.post(contacts)
.addHeaders(headers)
.body(jsonObject.toString())
.execute();
if (response.getStatus() == 200) {
JSONObject jsonObj = JSONUtil.parseObj(response.body());
if ("200".equals(jsonObj.get("code"))) {
JSONObject reqData = JSONUtil.parseObj(jsonObj.get("data"));
arr = JSONUtil.parseArray(reqData.get("data"));
}
}
return AjaxResult.success(arr);
}
/**
* IDIDID

@ -1,23 +1,34 @@
package com.ruoyi.jjh.ent.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
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;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.ent.entity.JPolicyFile;
import com.ruoyi.jjh.ent.entity.request.JPolicyFileRequest;
import com.ruoyi.jjh.ent.service.JMemorandumService;
import com.ruoyi.jjh.ent.service.JPolicyFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* j_policy_file
@ -36,6 +47,9 @@ public class JPolicyFileController extends BaseController {
@Resource
private JPolicyFileService jPolicyFileService;
@Resource
private JMemorandumService jMemorandumService;
/**
*
*
@ -49,6 +63,105 @@ public class JPolicyFileController extends BaseController {
return success(jPolicyFileService.page(page, jPolicyFileRequest));
}
@ApiOperation(value = "获取某个模板的已填报数据并且导出")
@GetMapping("/getYtb")
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
public void getYtb(HttpServletResponse response, @RequestParam(name = "list") List<Long> list1) {
List<BmsDeclarationRecords> ytb = jMemorandumService.getYtb(list1);
int size1 = 0;
if(ytb!=null&& !ytb.isEmpty()){
Long trId = ytb.get(0).getTemplateRecordId();
for (BmsDeclarationRecords item : ytb) {
if (item.getTemplateRecordId().equals(trId)) {
size1++;
}
}
if(size1!=ytb.size()){
throw new ServiceException("请选择同一在线模板数据!");
}
}else {
throw new ServiceException("请选择企业填报数据!");
}
List<List<String>> data = new ArrayList<>();
List<List<String>> final1 = new ArrayList<>();
// 创建一个 Map 用于存储不同的列表,键为字符串表示“变量名”,值为列表
Map<String, List<String>> list = new LinkedHashMap<>();
List<String> head0 = new ArrayList<>();
head0.add("企业名称");
List<String> head1 = new ArrayList<>();
head1.add("统一社会信用代码");
list.put("head0", head0);
list.put("head1", head1);
//根据数据添加近excel
for (int i = 0; i < ytb.size(); i++) {
JSONArray js1 = JSONObject.parse(ytb.get(i).getTemplateJson()).getJSONArray("fields");
//要添加的数据
List<String> addData = new ArrayList<>();
addData.add(ytb.get(i).getMatter());
addData.add(ytb.get(i).getCreditCode());
for (int i1 = 0; i1 < js1.size(); i1++) {
//获取每个组件
JSONObject lb = JSON.parseObject(js1.get(i1).toString());
if ("el-select".equals(lb.get("tag").toString()) || "el-radio-group".equals(lb.get("tag").toString())) {
List<String> head6 = new ArrayList<>();
head6.add(lb.get("label").toString());
list.put("headi" + i1, head6);
JSONArray op1 = JSONObject.parse(js1.get(i1).toString()).getJSONArray("options");
for (Object s1 : op1) {
JSONObject parse = JSONObject.parse(s1.toString());
if (parse.get("value").toString().equals(lb.get("defaultValue").toString())) {
addData.add(parse.get("label").toString());
break;
}
}
} else if ("el-checkbox-group".equals(lb.get("tag").toString())) {
List<String> head7 = new ArrayList<>();
head7.add(lb.get("label").toString());
list.put("headi" + i1, head7);
JSONArray op1 = JSONObject.parse(js1.get(i1).toString()).getJSONArray("options");
StringBuilder as = new StringBuilder();
JSONArray jsonArray = JSONObject.parse(js1.get(i1).toString()).getJSONArray("defaultValue");
for (Object o : jsonArray) {
for (Object s1 : op1) {
JSONObject parse = JSONObject.parse(s1.toString());
if(parse.get("value").toString().equals(o.toString())){
as.append(parse.get("label")).append(",");
break;
}
}
}
addData.add(as.toString());
} else {
List<String> head2 = new ArrayList<>();
head2.add(lb.get("label").toString());
list.put("head2" + i1, head2);
addData.add(lb.get("defaultValue").toString());
}
}
data.add(addData);
}
for (Map.Entry<String, List<String>> st : list.entrySet()) {
final1.add(st.getValue());
}
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment; filename=data.xlsx");
try {
ServletOutputStream outputStream = response.getOutputStream();
// 使用 EasyExcel 写数据到响应流
EasyExcel.write(outputStream)
// 这里放入动态头
.head(final1).sheet("模板")
// 当然这里数据也可以用 List<List<String>> 去传入
.doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
*

@ -43,6 +43,8 @@ public class JContacts extends BaseInfoEntity {
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateId;
/**
*
*/
@ -64,6 +66,12 @@ public class JContacts extends BaseInfoEntity {
@ApiModelProperty("统一社会信用代码")
private String tyshxydm;
/**
*
*/
@ApiModelProperty("默认联系人")
private String defaultcontact;
/**
*
*/

@ -1,5 +1,6 @@
package com.ruoyi.jjh.ent.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -32,6 +33,7 @@ public class JHeadQuartersRevenue {
*/
@ApiModelProperty("总部类别")
@TableField(exist = false)
private String type;
/**
@ -47,32 +49,44 @@ public class JHeadQuartersRevenue {
private String hydm;
/**
*
* 2022
*/
@ApiModelProperty("营收")
@ApiModelProperty("2022年营收 (单位:千元)")
private String revenue;
/**
*
* 2022
*/
@ApiModelProperty("税收")
@ApiModelProperty("2022年税收(单位:千元)")
private String taxation;
/**
*
*/
@ApiModelProperty("年份")
private String years;
// /**
// * 年份
// */
// @ApiModelProperty("年份")
// private String years;
/**
*
* 2023
*/
@ApiModelProperty("产值")
@ApiModelProperty("2023产值")
private String output;
/**
*
* 2023
*/
@ApiModelProperty("销售额")
@ApiModelProperty("2023销售额")
private String sales;
/**
* 2024
*/
@ApiModelProperty("2024产值")
private String output2024;
/**
* 2024
*/
@ApiModelProperty("2024销售额")
private String sales2024;
}

@ -32,6 +32,12 @@ public class JEnterpriseContactRequest {
@ApiModelProperty("常用联系人姓名")
private String contactName;
/**
*
*/
@ApiModelProperty("常用联系人手机号")
private String contactPhone;
/**
*
*/

@ -30,4 +30,10 @@ public class JHqCountResponse {
@ApiModelProperty("区级")
private Integer count3;
/**
*
*/
@ApiModelProperty("全部")
private Integer allCount;
}

@ -21,39 +21,39 @@ import java.util.Date;
public class ProjectTrackingResponse {
@ApiModelProperty("项目大类名字")
private String enterpriseDirectory;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "填报开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDate startTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "填报结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDate endTime;
@ApiModelProperty("数量")
private Integer count;
// /**
// * 项目小类
// */
// @ApiModelProperty("项目小类")
// private Integer projectSmallType;
// @ApiModelProperty("项目大类名字")
// private String enterpriseDirectory;
//
//
// @JsonFormat(pattern = "yyyy-MM-dd")
// @Excel(name = "填报开始时间", width = 30, dateFormat = "yyyy-MM-dd")
// private LocalDate startTime;
//
// /**
// * 提醒时间
// */
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// @Excel(name = "提醒时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// private Date alertTime;
// @JsonFormat(pattern = "yyyy-MM-dd")
// @Excel(name = "填报结束时间", width = 30, dateFormat = "yyyy-MM-dd")
// private LocalDate endTime;
//
//
// /**
// * 提醒内容
// */
// @ApiModelProperty("提醒内容")
// private String alertContent;
// @ApiModelProperty("数量")
// private Integer count;
/**
*
*/
@ApiModelProperty("项目小类")
private Integer projectSmallType;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "提醒时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date alertTime;
/**
*
*/
@ApiModelProperty("提醒内容")
private String alertContent;
}

@ -25,8 +25,14 @@ public interface JHeadQuartersRevenueMapper extends BaseMapper<JHeadQuartersReve
*/
Page<JHeadQuartersRevenue> page(Page<JHeadQuartersRevenue> page, @Param("req") JHeadQuartersRevenueRequest js);
Page<JHeadQuartersRevenue> page1(Page<JHeadQuartersRevenue> page,@Param("req") JHeadQuartersRevenueRequest js);
/**
*
*/
JHqCountResponse selectZbCount();
/**
*
*/
Integer selectAllCount();
}

@ -2,6 +2,7 @@ package com.ruoyi.jjh.ent.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.ent.entity.JMemorandum;
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
import org.apache.ibatis.annotations.Param;
@ -34,5 +35,8 @@ public interface JMemorandumMapper extends BaseMapper<JMemorandum> {
* @return
*/
List<JMemorandum> selectIdToAll(@Param("req") JMemorandumRequest jMemorandumRequest);
List<BmsDeclarationRecords> getYtb(@Param("list") List<Long> list);
}

@ -2,6 +2,7 @@ package com.ruoyi.jjh.ent.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.ent.entity.JMemorandum;
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
@ -33,5 +34,7 @@ public interface JMemorandumService extends IService<JMemorandum> {
* @return
*/
List<JMemorandum> selectIdToAll(JMemorandumRequest jMemorandumRequest);
List<BmsDeclarationRecords> getYtb(List<Long> list);
}

@ -27,7 +27,11 @@ public class JHeadQuartersRevenueServiceImpl extends ServiceImpl<JHeadQuartersRe
*/
@Override
public Page<JHeadQuartersRevenue> page(Page<JHeadQuartersRevenue> page, JHeadQuartersRevenueRequest js) {
return baseMapper.page(page, js);
if(js.getProjectSmallType()!=null){
return baseMapper.page1(page, js);
}else {
return baseMapper.page(page, js);
}
}
@ -36,6 +40,8 @@ public class JHeadQuartersRevenueServiceImpl extends ServiceImpl<JHeadQuartersRe
*/
@Override
public JHqCountResponse selectZbCount() {
return baseMapper.selectZbCount();
JHqCountResponse jHqCountResponse = baseMapper.selectZbCount();
jHqCountResponse.setAllCount(baseMapper.selectAllCount());
return jHqCountResponse;
}
}

@ -2,6 +2,7 @@ package com.ruoyi.jjh.ent.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.ent.entity.JMemorandum;
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
import com.ruoyi.jjh.ent.mapper.JMemorandumMapper;
@ -47,5 +48,10 @@ public class JMemorandumServiceImpl extends ServiceImpl<JMemorandumMapper, JMemo
return baseMapper.selectIdToAll(jMemorandumRequest);
}
@Override
public List<BmsDeclarationRecords> getYtb(List<Long> list) {
return baseMapper.getYtb(list);
}
}

@ -29,11 +29,11 @@ public class JServicesListServiceImpl extends ServiceImpl<JServicesListMapper, J
*/
@Override
public Page<JServicesList> page(Page<JServicesList> page, JServicesListRequest js) {
// if("3".equals(js.getServicesType())){
// return baseMapper.page1(page, js);
// }else {
if("3".equals(js.getServicesType())){
return baseMapper.page1(page, js);
}else {
return baseMapper.page(page, js);
// }
}
}
/**

@ -111,18 +111,18 @@ spring:
max-wait: -1ms
knife4j:
#true会关闭文档
production: false
production: true
#自己客户端地址
returnUrl: https://idp.sipac.gov.cn/bms
#定时任务更新企业信息和联系人的开启
updateEnterprise: true
#发送短信
isTiming: false
isTiming: true
#企业端正式环境应用系统编号
enterpriseAppId: 03f70874-39e9-11ef-bbd6-fa163e2b2e10
# 应用私钥
enterpriseAppsecret: 03f70874-39e9-11ef-bbd6-fa163e2b2e10
enterpriseAppsecret: 03f71c58-39e9-11ef-bbd6-fa163e2b2e10
#企业端单点登陆url
url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin
#url: http://114.216.202.175:8008/api/usercenter/User/ssoLogin

@ -16,8 +16,8 @@ ruoyi:
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
com.ruoyi: error
org.springframework: error
# 用户配置
user:
@ -34,7 +34,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: test
active: internet
# 文件上传
servlet:
multipart:
@ -121,6 +121,13 @@ getInfoId: https://qyt.sipac.gov.cn/enterprise-gateway/sipsg-enterprise/sys/thir
getAllInfo: http://uid.sipac.gov.cn/open/api/identity/data/FindUserById
#法人库-企业联络人员(统一社会信用代码)和法人库-法人基本信息(统一社会信用代码)生产环境
enterpriseUrl: http://172.21.10.46/api/invoke
#SMTP 服务器
smtp: smtp.sipac.gov.cn
#SMTP IP
smtpIp: 172.16.1.68
#SMTP 端口
smtpDk: 25

@ -113,7 +113,7 @@
FROM
bms_declaration_records AS a
inner join bms_template_record f on a.template_record_id = f.id
LEFT JOIN bms_enterprise_basic_info b ON a.enterprise_id = b.id
LEFT JOIN bms_enterprise_basic_info b ON a.credit_code = b.tyshxydm
left join sys_dict_data e on a.status = e.dict_value and e.dict_type='bms_approval_status'
<where>
<if test="list != null and list.size>0">
@ -172,46 +172,48 @@
a.remark,
b.qymc as enterpriseName,
f.road,
f.enterprise_directory
f.enterprise_directory,
f.status as templateRecordStatus
FROM
bms_declaration_records AS a
LEFT JOIN bms_enterprise_basic_info b ON a.credit_code = b.tyshxydm
inner join bms_template_record f on a.template_record_id = f.id
left join bms_template_record f on a.template_record_id = f.id
LEFT JOIN bms_template_info c on a.template_id = c.id
left join sys_dict_data e on a.status = e.dict_value and e.dict_type='bms_approval_status'
<where>
<if test="enterpriseDirectory != null and enterpriseDirectory != ''">and f.enterprise_directory like
concat('%', #{enterpriseDirectory},
<if test="req.enterpriseDirectory != null and req.enterpriseDirectory != ''">and f.enterprise_directory like
concat('%', #{req.enterpriseDirectory},
'%')
</if>
<if test="templateName != null and templateName != ''">and c.template_name like concat('%',
#{templateName}, '%')
<if test="req.templateName != null and req.templateName != ''">and c.template_name like concat('%',
#{req.templateName}, '%')
</if>
<if test="creditCode != null ">and a.credit_code = #{creditCode}</if>
<if test="enterpriseId != null ">and a.enterprise_id = #{enterpriseId}</if>
<if test="level != null ">and c.level = #{level}</if>
<if test="year != null and year != ''">and year = #{year}</if>
<if test="responsibilityUnit != null ">and c.responsibility_unit = #{responsibilityUnit}</if>
<if test="status != null ">and a.status = #{status}</if>
<if test="statusStr != null and statusStr.size>0">
<if test="req.creditCode != null ">and a.credit_code = #{req.creditCode}</if>
<if test="req.enterpriseId != null ">and a.enterprise_id = #{req.enterpriseId}</if>
<if test="req.level != null ">and c.level = #{req.level}</if>
<if test="req.year != null and req.year != ''">and year = #{req.year}</if>
<if test="req.responsibilityUnit != null ">and c.responsibility_unit = #{req.responsibilityUnit}</if>
<if test="req.status != null ">and a.status = #{req.status}</if>
<if test="req.statusStr != null and req.statusStr.size>0">
and a.status in
<foreach collection="statusStr" item="item" separator="," open="(" close=")">
<foreach collection="req.statusStr" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="statusChange == 0">
<if test="req.statusChange == 0">
and a.status in (0,10)
</if>
<if test="statusChange == 1">
<if test="req.statusChange == 1">
and a.status not in (0,10)
</if>
<if test="isDeleted != null ">and a.is_deleted = #{isDeleted}</if>
<if test="req.isDeleted != null ">and a.is_deleted = #{req.isDeleted}</if>
</where>
<if test="orderChange == 0">
<if test="req.orderChange == 0">
order by a.create_time desc
</if>
<if test="orderChange == 1">
order by FIELD(a.status, 0, 1, 2, 3,10,8,7,9,5),a.create_time desc, e.dict_sort desc
<if test="req.orderChange == 1">
order by FIELD(a.status, 0, 1, 2, 3,10,8,7,9,5),a.create_time desc, e.dict_sort desc,
a.id DESC
</if>
</select>
<select id="getAddProject" resultType="com.ruoyi.jjh.ent.entity.JProject">

@ -8,7 +8,6 @@
<where>
<if test="req.enterpriseInfo != null and req.enterpriseInfo != ''">
qymc like concat('%', #{req.enterpriseInfo}, '%')
or tyshxydm like concat('%', #{req.enterpriseInfo}, '%')
</if>
</where>
</select>
@ -24,7 +23,7 @@
<select id="page" resultType="com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo">
select * from bms_enterprise_basic_info
<where>
<if test="req.type != null and req.type != ''">and type = #{req.type}</if>
<if test="req.type != null">and type like concat('%',#{req.type},'%') </if>
<if test="req.qymc != null and req.qymc != ''">and qymc like concat('%', #{req.qymc}, '%')</if>
<if test="req.tyshxydm != null and req.tyshxydm != ''">and tyshxydm = #{req.tyshxydm}</if>
<if test="req.isDeleted != null ">and is_deleted = #{req.isDeleted}</if>

@ -118,5 +118,18 @@
</where>
order by a.create_time desc
</select>
<select id="searchEntCodeToInfo" resultType="com.ruoyi.jjh.declaration.entity.BmsEnterpriseDirectory">
SELECT qymc as enterpriseName,
tyshxydm as creditCode
FROM bms_enterprise_basic_info
<where>
<if test="code != null and code.size>0">
and tyshxydm in
<foreach collection="code" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

@ -6,30 +6,32 @@
<select id="servicesDevelop" resultType="com.ruoyi.jjh.ent.entity.response.JServicesDevelopResponse">
SELECT
a.develop_year,
a.quarterly AS quarterly,
IFNULL( a.value_added, 0 ) AS valueAdded,
IFNULL( a.increase_speed, 0 ) AS increaseSpeed,
IFNULL( a.gdp_proportion, 0 ) AS gdpProportion
IFNULL(a.develop_year, YEAR(NOW()) - 1) AS develop_year,
IFNULL(a.quarterly, 0) AS quarterly,
IFNULL(a.value_added, 0) AS valueAdded,
IFNULL(a.increase_speed, 0) AS increaseSpeed,
IFNULL(a.gdp_proportion, 0) AS gdpProportion
FROM
j_services_develop a
WHERE
YEAR (
NOW()) - 1 = a.develop_year
AND a.quarterly IS NULL UNION
(SELECT 1) AS temp
LEFT JOIN j_services_develop a
ON YEAR(NOW()) - 1 = a.develop_year
AND a.quarterly IS NULL
UNION
(
SELECT
c.develop_year,
c.quarterly AS quarterly,
IFNULL( c.value_added, 0 ) AS valueAdded,
IFNULL( c.increase_speed, 0 ) AS increaseSpeed,
IFNULL( c.gdp_proportion, 0 ) AS gdpProportion
IFNULL(c.develop_year, YEAR(NOW())) AS develop_year,
IFNULL(c.quarterly, 0) AS quarterly,
IFNULL(c.value_added, 0) AS valueAdded,
IFNULL(c.increase_speed, 0) AS increaseSpeed,
IFNULL(c.gdp_proportion, 0) AS gdpProportion
FROM
j_services_develop c
WHERE
YEAR (
NOW()) = c.develop_year
AND c.quarterly IS NOT NULL
(SELECT 1) AS temp
LEFT JOIN j_services_develop c
ON YEAR(NOW()) = c.develop_year
AND c.quarterly IS NOT NULL
ORDER BY
c.quarterly DESC
LIMIT 1)
@ -49,10 +51,10 @@
and a.project_name != '区级总部'
</if>
<if test="req.yearsChange == 1 ">
and a.appropriation_time like concat('%',YEAR(NOW())-1,'%')
and a.appropriation_time like concat('%',YEAR(NOW()),'%')
</if>
<if test="req.yearsChange != 1 ">
and SUBSTRING(a.appropriation_time, 1, 4) BETWEEN YEAR(DATE_SUB(CURDATE(), INTERVAL 3 YEAR)) AND YEAR(NOW())-1
and SUBSTRING(a.appropriation_time, 1, 4) BETWEEN YEAR(DATE_SUB(CURDATE(), INTERVAL 3 YEAR)) AND YEAR(NOW())
</if>
</where>
group by

@ -13,7 +13,7 @@
c.dict_label AS projectSmallName,
c.dict_value AS projectSmallType,
IFNULL(us.count, '-') AS count3,
IFNULL(ns.count, '-') AS currentYearAdd
IFNULL(ns.count, '-' ) AS currentYearAdd
FROM sys_dict_data a
JOIN sys_dict_data b ON a.remark = b.dict_type
JOIN sys_dict_data c ON b.remark = c.dict_type
@ -54,22 +54,22 @@
ORDER BY CAST(c.dict_value AS UNSIGNED);
</select>
<select id="getProjectTracking" resultType="com.ruoyi.jjh.ent.entity.response.ProjectTrackingResponse">
SELECT b.enterprise_directory,
b.start_time,
b.end_time,
COUNT(*) as count
FROM bms_declaration_records a
INNER JOIN bms_template_record b ON a.template_record_id = b.id
WHERE a.status != 0
GROUP BY a.template_record_id
order by count desc
# SELECT a.alert_time,
# a.alert_content,
# b.project_small_type
# FROM j_smart_reminders a
# left JOIN j_project b on a.project_id = b.id
# where a.alert_type = 4 and NOW() > a.alert_time
# order by a.alert_time desc
# SELECT b.enterprise_directory,
# b.start_time,
# b.end_time,
# COUNT(*) as count
# FROM bms_declaration_records a
# INNER JOIN bms_template_record b ON a.template_record_id = b.id
# WHERE a.status != 0
# GROUP BY a.template_record_id
# order by count desc
SELECT a.alert_time,
a.alert_content,
b.project_small_type
FROM j_smart_reminders a
left JOIN j_project b on a.project_id = b.id
where a.alert_type = 4 and NOW() > a.alert_time
order by a.alert_time desc
</select>
<select id="servicesDevelop" resultType="com.ruoyi.jjh.ent.entity.response.JServicesDevelopResponse">
SELECT
@ -80,27 +80,43 @@
IFNULL(a.gdp_proportion,0) as gdpProportion
FROM
j_services_develop a
<where>
<if test="type == 1 ">
YEAR(NOW()) > a.develop_year
</if>
<if test="type != 1 ">
YEAR(NOW()) = a.develop_year
</if>
</where>
<!-- <where>-->
<!-- <if test="type == 1 ">-->
<!-- YEAR(NOW()) > a.develop_year-->
<!-- </if>-->
<!-- <if test="type != 1 ">-->
<!-- YEAR(NOW()) = a.develop_year-->
<!-- </if>-->
<!-- </where>-->
ORDER BY
a.develop_year ASC
LIMIT 5
</select>
<select id="getIndustryDepth" resultType="com.ruoyi.jjh.ent.entity.response.JIndustryDepthResponse">
SELECT a.years,
a.industry_categories,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1) , '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.gdp_proportion, 2), '-') AS gdpProportion
FROM j_industry_depth a
WHERE a.years = YEAR(NOW()) - 1
UNION ALL
SELECT a.years,
a.industry_categories,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.gdp_proportion, 2), '-') AS gdpProportion
FROM j_industry_depth a
WHERE a.years = YEAR(NOW()) - 2
AND NOT EXISTS (
SELECT 1
FROM j_industry_depth b
WHERE b.years = YEAR(NOW()) - 1
)
</select>
<select id="getMiddleIndustry"
resultType="com.ruoyi.jjh.ent.entity.response.JBigMiddleIndustryResponse">

@ -9,7 +9,9 @@
'-' AS years,
count(*) AS count
FROM
bms_enterprise_basic_info UNION
bms_enterprise_basic_info
where type not like concat('%','3','%')
UNION
SELECT
'规上企业总数' AS dataName,
'-' AS years,
@ -33,7 +35,7 @@
WHEN '2' THEN
'生活性服务业企业数'
WHEN '3' THEN
'新兴服务业企业数' ELSE '限上批零住餐企业数'
'规上服务业企业数' ELSE '限上批零住餐企业数'
END AS dataName,
#{year} AS years,
IF
@ -48,7 +50,8 @@
FROM
j_services_list
GROUP BY
services_type UNION SELECT
services_type
UNION SELECT
a.dict_label AS dataName,
#{year} AS years,
IFNULL( rs.count, '-' ) AS count

@ -16,6 +16,9 @@
<if test="req.contactName != null and req.contactName != '' ">
and contact_name like concat('%',#{req.contactName},'%')
</if>
<if test="req.contactPhone != null and req.contactPhone != '' ">
and contact_phone like concat('%',#{req.contactPhone},'%')
</if>
<if test="req.contactOffice != null and req.contactOffice != '' ">
and contact_office like concat('%',#{req.contactOffice},'%')
</if>

@ -5,8 +5,8 @@
<mapper namespace="com.ruoyi.jjh.ent.mapper.JHeadQuartersRevenueMapper">
<select id="page" resultType="com.ruoyi.jjh.ent.entity.JHeadQuartersRevenue">
SELECT
a.qymc,
a.tyshxydm,
a.qymc,
CASE
WHEN a.hydm REGEXP
'^(06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46)'
@ -18,22 +18,64 @@
a.hydm,
IFNULL( ROUND( a.revenue / 10000, 1 ), '-' ) AS revenue,
IFNULL( ROUND( a.taxation / 10000, 1 ), '-' ) AS taxation,
a.years,
IFNULL( ROUND( a.output / 10000, 1 ), '-' ) AS output,
IFNULL( ROUND( a.sales / 10000, 1 ), '-' ) AS sales
FROM
j_headquarters_revenue a
LEFT JOIN j_project b ON a.tyshxydm = b.credit_code
j_headquarters_revenue a
<where>
b.project_middle_type = 1
<if test="req.qymc != null and req.qymc != '' ">
and a.qymc like concat('%',#{req.qymc},'%')
</if>
<if test="req.tyshxydm != null and req.tyshxydm != '' ">
and a.tyshxydm = #{req.tyshxydm}
</if>
<if test="req.years != null and req.years != '' ">
and a.years = #{req.years}
<if test="req.type == 1">
and a.hydm REGEXP
'^(06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46)'
</if>
<if test="req.type == 2">
and a.hydm REGEXP '^(47|48|49|50)'
</if>
<if test="req.type == 3">
and a.hydm REGEXP '^(51|52|61|62)'
</if>
<if test="req.type == 4">
</if>
<if test="req.type == 5">
and a.hydm not REGEXP
'^(51|52|61|62|47|48|49|50|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46)'
</if>
</where>
</select>
<select id="page1" resultType="com.ruoyi.jjh.ent.entity.JHeadQuartersRevenue">
SELECT
a.qymc,
b.credit_code AS tyshxydm,
CASE
WHEN a.hydm REGEXP '^(06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46)'
THEN '制造业总部'
WHEN a.hydm REGEXP '^(47|48|49|50)' THEN '建筑业总部'
WHEN a.hydm REGEXP '^(51|52|61|62)' THEN '批零住餐总部'
ELSE '服务业总部'
END AS type,
a.hydm,
MAX(IFNULL(ROUND(a.revenue / 10000, 1), '-')) AS revenue,
MAX(IFNULL(ROUND(a.taxation / 10000, 1), '-')) AS taxation,
MAX(IFNULL(ROUND(a.output / 10000, 1), '-')) AS output,
MAX(IFNULL(ROUND(a.sales / 10000, 1), '-')) AS sales
FROM
j_headquarters_revenue a
LEFT JOIN (
SELECT DISTINCT credit_code, project_small_type
FROM j_project
WHERE project_middle_type = 1 AND status = 5
) b ON a.tyshxydm = b.credit_code
<where>
<if test="req.qymc != null and req.qymc != '' ">
AND a.qymc LIKE CONCAT('%', #{req.qymc}, '%')
</if>
<if test="req.tyshxydm != null and req.tyshxydm != '' ">
AND a.tyshxydm = #{req.tyshxydm}
</if>
<if test="req.type == 1">
and a.hydm REGEXP
@ -55,22 +97,24 @@
and b.project_small_type = #{req.projectSmallType}
</if>
</where>
GROUP BY a.qymc,b.credit_code, type, a.hydm
</select>
<select id="selectZbCount" resultType="com.ruoyi.jjh.ent.entity.response.JHqCountResponse">
SELECT DISTINCT
SUM(
IF
( b.project_small_type = 1, 1, 0 )) AS count1,
SUM(
IF
( b.project_small_type = 2, 1, 0 )) AS count2,
sum(
IF
( b.project_small_type = 3, 1, 0 )) AS count3
FROM
j_headquarters_revenue a
LEFT JOIN j_project b ON a.tyshxydm = b.credit_code
WHERE
b.project_middle_type = 1
SELECT
NULL AS allCount,
SUM(IF(distinct_projects.project_small_type = 1, 1, 0)) AS count1,
SUM(IF(distinct_projects.project_small_type = 2, 1, 0)) AS count2,
SUM(IF(distinct_projects.project_small_type = 3, 1, 0)) AS count3
FROM (
SELECT DISTINCT a.tyshxydm, b.project_small_type
FROM j_headquarters_revenue a
LEFT JOIN j_project b ON a.tyshxydm = b.credit_code
WHERE b.project_middle_type = 1
) AS distinct_projects
</select>
<select id="selectAllCount" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM j_headquarters_revenue
</select>
</mapper>

@ -33,4 +33,22 @@
</if>
</where>
</select>
<select id="getYtb" resultType="com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords">
SELECT
a.credit_code,
b.qymc as matter,
a.template_json,
a.template_record_id
FROM
bms_declaration_records as a
LEFT JOIN bms_enterprise_basic_info as b ON a.credit_code = b.tyshxydm
<where>
<if test="list != null and list.size>0">
and a.id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

@ -29,7 +29,7 @@
and project_year = #{req.projectYear}
</if>
</where>
order by create_time desc ,project_year desc
order by project_year desc,FIELD(status, 0, 1, 2, 3,10,8,7,9,5)
</select>
<select id="getApprovalInfoList" resultType="com.ruoyi.jjh.declaration.entity.vo.BmsApprovalInfoQueryVo">
SELECT c.id,

@ -41,7 +41,7 @@
b.years
FROM
bms_enterprise_basic_info a
LEFT JOIN j_business_revenue b ON a.tyshxydm = b.tyshxydm COLLATE utf8mb4_general_ci
LEFT JOIN j_business_revenue b ON a.tyshxydm = b.tyshxydm
<where>
a.type = 1
<if test="req.qymc != null and req.qymc != '' ">
@ -54,34 +54,26 @@
</select>
<select id="selectAllServicesCount"
resultType="com.ruoyi.jjh.ent.entity.response.JServicesListCountResponse">
SELECT
IFNULL( ROUND( SUM( a.revenue ) / 100000, 1 ), '-' ) AS allRevenue,
IFNULL( ROUND( a.add_value, 1 ), '-' ) AS addValue,
a.type AS servicesType,
b.qyCount AS qyCount
FROM
j_total_revenue a
LEFT JOIN ( SELECT a.services_type, count( * ) AS qyCount FROM j_services_list a GROUP BY a.services_type ) AS b ON a.type = b.services_type
WHERE
a.years = YEAR (NOW()) - 1
GROUP BY
a.type,
b.qyCount
# SELECT
# IFNULL( ROUND( a.revenue / 100000, 1 ), '-' ) AS allRevenue,
# IFNULL( ROUND( a.add_value, 1 ), '-' ) AS addValue,
# a.type AS servicesType,
# CASE
#
# WHEN a.type = 3 THEN
# ( SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type = 1 ) ELSE b.qyCount
# END AS qyCount
# FROM
# j_total_revenue a
# LEFT JOIN ( SELECT a.services_type, COUNT(*) AS qyCount FROM j_services_list a GROUP BY a.services_type ) AS b ON a.type = b.services_type
# WHERE
# a.years = YEAR (NOW()) - 1
# ORDER BY FIELD(a.type, 3, 1, 2, 4);
SELECT * FROM (
SELECT
IFNULL( ROUND( a.revenue / 100000, 1 ), '-' ) AS allRevenue,
IFNULL( ROUND( a.add_value, 1 ), '-' ) AS addValue,
a.type AS servicesType,
CASE
WHEN a.type = 3 THEN
( SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type LIKE '%1%' )
WHEN a.type = 1 THEN
( SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type LIKE '%5%' )
WHEN a.type = 2 THEN
( SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type LIKE '%7%' )
WHEN a.type = 4 THEN
( SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type LIKE '%6%' ) ELSE 0
END AS qyCount
FROM
j_total_revenue a WHERE a.years = YEAR(NOW()) - 1
) AS result
ORDER BY FIELD(result.servicesType, 3, 1, 2, 4);
</select>

@ -1,8 +0,0 @@
苏州工业园区服务业发展情况
2023年4月
一、总体实力显著增强
产业规模高速增长,综合贡献明显提升。
近年来园区服务业保持持续增长态势截至目前园区服务业规上企业总计677家。2021年园区实现服务业增加值1674.4亿元占GDP比重达50.3%。2022年全年实现服务业增加值1753.18亿元占GDP比重49.9%。2023年1-3月实现服务业增加值405.95亿元同比增加4.2%。7大服务业核算行业①多式联运和运输代理业、②装卸报运和仓储业、③互联网和相关服务、软件信息服务业、④租赁和商务服务业、⑤居民服务、修理和其他服务业、⑥文化、体育和娱乐业、⑦科学研究和技术服务业2022年全年营收1311.71亿元增速达22%2023年1-3月实现营收348.34亿元同比增速35%。根据苏州市新兴服务业行业分类含金融服务、信息服务、物流服务、科技服务、商务中介服务、设计服务、人力资源服务、检验检测认证、低碳绿色服务、现代商贸、文化消费、旅游康养等12个类别2022年园区新兴服务业营收达1488.57亿元较上年增长24%。
二、产业结构持续优化
产业结构逐步优化生产性服务占主导。经过多年发展园区服务业产业结构逐渐多样化生产性服务业与生活性服务业基本形成73的格局。2022年生产性服务业增加值达到1199.5亿元占服务业增加值比重达68.4%。截至目前园区生产性服务业规上企业总计655家含部分工业企业。自2019年苏州市开展全市生产性服务业综合评价以来园区已连续两年考评优秀。37家园区企业入选苏州市生产性服务业领军企业占全市51%位居全市第一并成为苏州首个实现生产性服务业9大重点领域信息技术服务、研发设计、金融服务、检验检测认证、知识产权服务、节能环保服务、人力资源服务、现代供应链管理、商务服务全覆盖的区域。推动先进制造业和现代服务业深度融合发展2022年初园区获评江苏省两业融合深度融合试点地区。
城市活力不断提升,生活性服务显潜能。完成环金鸡湖商圈城市活力提升规划并正式发布,引导环金鸡湖商圈核心商业体差异定位、错位发展,金鸡湖景区获评第一批省级现代服务业高质量发展集聚示范区。积极引入北京及上海周边外溢资源,推动园区载体与国内优质品牌对接,加快发展"首店经济"(首店经济是指一个区域利用特有的资源优势,吸引国内外品牌在区域首次开设门店,目前园区大力推动"中国首店""苏州首店"落户园区)。通过开展"云购金鸡湖"等活动持续打造金鸡湖系列IP宣传园区特色消费场景在后疫情时代不断激发生活性服务业发展潜能。

@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@ -31,9 +32,7 @@ public class XssFilter implements Filter {
String tempExcludes = filterConfig.getInitParameter("excludes");
if (StringUtils.isNotEmpty(tempExcludes)) {
String[] url = tempExcludes.split(",");
for (int i = 0; url != null && i < url.length; i++) {
excludes.add(url[i]);
}
excludes.addAll(Arrays.asList(url));
}
}
@ -42,12 +41,12 @@ public class XssFilter implements Filter {
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
resp.setHeader("Access-Control-Allow-Origin", "http://39.101.188.84:9999");
// resp.setHeader("Access-Control-Allow-Origin", "https://idp.sipac.gov.cn");
resp.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
resp.setHeader("Access-Control-Max-Age", "3600");
resp.setHeader("Access-Control-Allow-Headers", "x-requested-with,Authorization,isrepeatsubmit,Content-Type");
resp.setHeader("Access-Control-Allow-Credentials", "true");
// resp.setHeader("Access-Control-Allow-Origin", "http://39.101.188.84:9999");
//// resp.setHeader("Access-Control-Allow-Origin", "https://idp.sipac.gov.cn");
// resp.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
// resp.setHeader("Access-Control-Max-Age", "3600");
// resp.setHeader("Access-Control-Allow-Headers", "x-requested-with,Authorization,isrepeatsubmit,Content-Type");
// resp.setHeader("Access-Control-Allow-Credentials", "true");
if (handleExcludeURL(req, resp)) {
chain.doFilter(request, response);
return;

@ -1,12 +1,9 @@
package com.ruoyi.common.utils;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* RSA
@ -16,137 +13,33 @@ import java.security.spec.X509EncodedKeySpec;
public class RsaUtils
{
// Rsa 私钥
public static String privateKey = "MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEA4Qj9AvP1YzQ28Z5L\n" +
"jgqlHl1tWu8lNN8u7nHe7XQLAQ2qYcRp9g8zPhJ8Gf33/++QsrE7RxEozcxL6Vv/\n" +
"WhJWqwIDAQABAkAcTrklCfMwS30t36+5anVi4HXFHpgbkoegzwov7I0F0Kndk81M\n" +
"WRPzriIsMWSKPwF5eS+FbopM+9qh6W8WFCyBAiEA88tPNwHuJ/35Z40jqspVYiTf\n" +
"TLrzrVmgaXCMFG7UdvsCIQDsTT7UTL4JvH5BUX488uouyZt/DFyXCyVQOFglj9hQ\n" +
"EQIhAJgIw//D3mdmRTDEneeWgqTP5cmOFQSYDidzHohnjWwdAiB721U2U+88DTek\n" +
"JwHjEnQbCANgCWuyo93v+UiCj64S8QIhAJs6G4SSKS2hvYKYF+ERqkt0GTaDviSP\n" +
"wg+zTdAgRmjr";
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==";
/**
*
*
* @param text
* @return
*
*/
public static String decryptByPrivateKey(String text) throws Exception
{
return decryptByPrivateKey(privateKey, text);
}
/**
*
*
* @param publicKeyString
* @param text
* @return
*/
public static String decryptByPublicKey(String publicKeyString, String text) throws Exception
{
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
*
*
* @param privateKeyString
* @param text
* @return
*/
public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception
{
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
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);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
byte[] decryptedBytes = decrypt(encryptedBytes, privateKey);
// 返回解密后的字符串
return new String(decryptedBytes);
}
/**
*
*
* @param privateKeyString
* @param text
* @return
*
*/
public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception
{
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
Cipher cipher = Cipher.getInstance("RSA");
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);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
*
*
* @param publicKeyString
* @param text
* @return
*/
public static String encryptByPublicKey(String publicKeyString, String text) throws Exception
{
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
* RSA
*
* @return
*/
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException
{
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
return new RsaKeyPair(publicKeyString, privateKeyString);
}
/**
* RSA
*/
public static class RsaKeyPair
{
private final String publicKey;
private final String privateKey;
public RsaKeyPair(String publicKey, String privateKey)
{
this.publicKey = publicKey;
this.privateKey = privateKey;
}
public String getPublicKey()
{
return publicKey;
}
public String getPrivateKey()
{
return privateKey;
}
// 执行解密操作,返回解密后的字节数组
return cipher.doFinal(data);
}
}

@ -36,23 +36,42 @@ public class FileUtils {
* @return
*/
public static void writeBytes(String filePath, OutputStream os) throws IOException {
FileInputStream fis = null;
try {
File file = new File(filePath);
if (!file.exists()) {
throw new FileNotFoundException(filePath);
}
fis = new FileInputStream(file);
byte[] b = new byte[1024];
// FileInputStream fis = null;
// try {
// File file = new File(filePath);
// if (!file.exists()) {
// throw new FileNotFoundException(filePath);
// }
// fis = new FileInputStream(file);
// byte[] b = new byte[1024];
// int length;
// while ((length = fis.read(b)) > 0) {
// os.write(b, 0, length);
// }
// } catch (IOException e) {
// throw e;
// } finally {
// IOUtils.close(os);
// IOUtils.close(fis);
// }
File file = new File(filePath);
if (!file.exists()) {
throw new FileNotFoundException(filePath);
}
// 使用 try-with-resources 确保流被正确关闭
try (FileInputStream fis = new FileInputStream(file)) {
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(b)) > 0) {
os.write(b, 0, length);
while ((length = fis.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
} catch (IOException e) {
throw e;
throw e; // 可以选择记录日志或处理其他逻辑
} finally {
IOUtils.close(os);
IOUtils.close(fis);
// 这里假设 os 是由调用者提供并且需要在外部关闭
// 如果 os 也应该由此方法管理,建议将其放入 try-with-resources 中
// IOUtils.close(os); // 如果你希望在这里关闭 os请确认它的管理责任
}
}
@ -76,17 +95,38 @@ public class FileUtils {
* @throws IOException IO
*/
public static String writeBytes(byte[] data, String uploadDir) throws IOException {
FileOutputStream fos = null;
String pathName = "";
try {
String extension = getFileExtendName(data);
pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
fos = new FileOutputStream(file);
// FileOutputStream fos = null;
// String pathName = "";
// try {
// String extension = getFileExtendName(data);
// pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
// File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
// fos = new FileOutputStream(file);
// fos.write(data);
// } finally {
// IOUtils.close(fos);
// }
// return FileUploadUtils.getPathFileName(uploadDir, pathName);
if (data == null || data.length == 0) {
throw new IllegalArgumentException("数据不能为空");
}
String extension = getFileExtendName(data);
String pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
// 确保父目录存在
file.getParentFile().mkdirs();
// 使用 try-with-resources 自动管理 FileOutputStream 的生命周期
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(data);
} finally {
IOUtils.close(fos);
} catch (IOException e) {
// 可以选择记录日志或抛出自定义异常
throw new IOException("文件写入失败: " + e.getMessage(), e);
}
return FileUploadUtils.getPathFileName(uploadDir, pathName);
}

@ -52,28 +52,51 @@ public class ImageUtils {
* @return
*/
public static byte[] readFile(String url) {
InputStream in = null;
try {
if (url.startsWith("http")) {
// 网络地址
URL urlObj = new URL(url);
URLConnection urlConnection = urlObj.openConnection();
urlConnection.setConnectTimeout(30 * 1000);
urlConnection.setReadTimeout(60 * 1000);
urlConnection.setDoInput(true);
in = urlConnection.getInputStream();
} else {
// 本机地址
String localPath = RuoYiConfig.getProfile();
String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX);
in = new FileInputStream(downloadPath);
}
// InputStream in = null;
// try {
// if (url.startsWith("http")) {
// // 网络地址
// URL urlObj = new URL(url);
// URLConnection urlConnection = urlObj.openConnection();
// urlConnection.setConnectTimeout(30 * 1000);
// urlConnection.setReadTimeout(60 * 1000);
// urlConnection.setDoInput(true);
// in = urlConnection.getInputStream();
// } else {
// // 本机地址
// String localPath = RuoYiConfig.getProfile();
// String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX);
// in = new FileInputStream(downloadPath);
// }
// return IOUtils.toByteArray(in);
// } catch (Exception e) {
// log.error("获取文件路径异常 {}", e);
// return null;
// } finally {
// IOUtils.closeQuietly(in);
// }
try (InputStream in = openInputStream(url)) {
return IOUtils.toByteArray(in);
} catch (Exception e) {
log.error("获取文件路径异常 {}", e);
return null;
} finally {
IOUtils.closeQuietly(in);
}
}
private static InputStream openInputStream(String url) throws Exception {
if (url.startsWith("http")) {
// 网络地址
URL urlObj = new URL(url);
URLConnection urlConnection = urlObj.openConnection();
urlConnection.setConnectTimeout(30 * 1000);
urlConnection.setReadTimeout(60 * 1000);
urlConnection.setDoInput(true);
return urlConnection.getInputStream();
} else {
// 本机地址
String localPath = RuoYiConfig.getProfile();
String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX);
return new FileInputStream(downloadPath);
}
}
}

@ -151,69 +151,4 @@ public class HttpUtils {
}
return result.toString();
}
public static String sendSSLPost(String url, String param) {
StringBuilder result = new StringBuilder();
String urlNameString = url + "?" + param;
try {
log.info("sendSSLPost - {}", urlNameString);
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[]{new TrustAnyTrustManager()}, new java.security.SecureRandom());
URL console = new URL(urlNameString);
HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)");
conn.setRequestProperty("Accept-Charset", "utf-8");
conn.setRequestProperty("contentType", "utf-8");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setSSLSocketFactory(sc.getSocketFactory());
conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
conn.connect();
InputStream is = conn.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String ret = "";
while ((ret = br.readLine()) != null) {
if (ret != null && !"".equals(ret.trim())) {
result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
}
}
log.info("recv - {}", result);
conn.disconnect();
br.close();
} catch (ConnectException e) {
log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
} catch (SocketTimeoutException e) {
log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e);
} catch (IOException e) {
log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
} catch (Exception e) {
log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e);
}
return result.toString();
}
private 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[]{};
}
}
private static class TrustAnyHostnameVerifier implements HostnameVerifier {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
}
}

@ -680,19 +680,39 @@ public class ExcelUtil<T> {
* @return
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
writeSheet();
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
// OutputStream out = null;
// try {
// writeSheet();
// String filename = encodingFilename(sheetName);
// out = new FileOutputStream(getAbsoluteFile(filename));
// wb.write(out);
// return AjaxResult.success(filename);
// } catch (Exception e) {
// log.error("导出Excel异常{}", e.getMessage());
// throw new UtilException("导出Excel失败请联系网站管理员");
// } finally {
// IOUtils.closeQuietly(wb);
// IOUtils.closeQuietly(out);
// }
String filename = encodingFilename(sheetName);
// 使用 try-with-resources 自动管理 FileOutputStream
try (OutputStream out = new FileOutputStream(getAbsoluteFile(filename))) {
writeSheet(); // 确保在写入之前准备好工作表
wb.write(out); // 写入数据到输出流
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
log.error("导出Excel异常: {}", e.getMessage(), e);
throw new UtilException("导出Excel失败请联系网站管理员");
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(out);
// 确保 Workbook 被关闭
if (wb != null) {
try {
wb.close();
} catch (IOException e) {
log.error("关闭Workbook时发生异常: {}", e.getMessage(), e);
}
}
}
}

@ -716,19 +716,39 @@ public class ProjectExcelUtil<T> {
* @return
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
writeSheet();
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
// OutputStream out = null;
// try {
// writeSheet();
// String filename = encodingFilename(sheetName);
// out = new FileOutputStream(getAbsoluteFile(filename));
// wb.write(out);
// return AjaxResult.success(filename);
// } catch (Exception e) {
// log.error("导出Excel异常{}", e.getMessage());
// throw new UtilException("导出Excel失败请联系网站管理员");
// } finally {
// IOUtils.closeQuietly(wb);
// IOUtils.closeQuietly(out);
// }
String filename = encodingFilename(sheetName);
// 使用 try-with-resources 自动管理 FileOutputStream
try (OutputStream out = new FileOutputStream(getAbsoluteFile(filename))) {
writeSheet(); // 确保在写入之前准备好工作表
wb.write(out); // 写入数据到输出流
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
log.error("导出Excel异常: {}", e.getMessage(), e);
throw new UtilException("导出Excel失败请联系网站管理员");
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(out);
// 确保 Workbook 被关闭
if (wb != null) {
try {
wb.close();
} catch (IOException e) {
log.error("关闭Workbook时发生异常: {}", e.getMessage(), e);
}
}
}
}

@ -715,19 +715,39 @@ public class ProjectValueUtil<T> {
* @return
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
writeSheet();
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
// OutputStream out = null;
// try {
// writeSheet();
// String filename = encodingFilename(sheetName);
// out = new FileOutputStream(getAbsoluteFile(filename));
// wb.write(out);
// return AjaxResult.success(filename);
// } catch (Exception e) {
// log.error("导出Excel异常{}", e.getMessage());
// throw new UtilException("导出Excel失败请联系网站管理员");
// } finally {
// IOUtils.closeQuietly(wb);
// IOUtils.closeQuietly(out);
// }
String filename = encodingFilename(sheetName);
// 使用 try-with-resources 自动管理 FileOutputStream
try (OutputStream out = new FileOutputStream(getAbsoluteFile(filename))) {
writeSheet(); // 确保在写入之前准备好工作表
wb.write(out); // 写入数据到输出流
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
log.error("导出Excel异常: {}", e.getMessage(), e);
throw new UtilException("导出Excel失败请联系网站管理员");
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(out);
// 确保 Workbook 被关闭
if (wb != null) {
try {
wb.close();
} catch (IOException e) {
log.error("关闭Workbook时发生异常: {}", e.getMessage(), e);
}
}
}
}

@ -8,6 +8,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import javax.servlet.DispatcherType;
import java.util.HashMap;
@ -30,6 +32,7 @@ public class FilterConfig {
@Bean
@ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
public FilterRegistrationBean xssFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setDispatcherTypes(DispatcherType.REQUEST);
registration.setFilter(new XssFilter());
@ -39,6 +42,16 @@ public class FilterConfig {
Map<String, String> initParameters = new HashMap<String, String>();
initParameters.put("excludes", excludes);
registration.setInitParameters(initParameters);
//
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
// CorsConfiguration config = new CorsConfiguration();
// config.setAllowCredentials(true);
// config.addAllowedOrigin("http://39.101.188.84:9999");
// config.addAllowedHeader("*");
// config.addAllowedMethod("*");
// source.registerCorsConfiguration("/**", config); // CORS 配置对所有接口都有效
// registration.setOrder(0);
return registration;
}

@ -1,5 +1,6 @@
package com.ruoyi.framework.web.service;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
@ -8,10 +9,12 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.utils.*;
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.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
@ -72,18 +75,18 @@ public class SysLoginService {
* @return
*/
public Map<String, Object> login(String username, String password, String code, String uuid, String userType) {
String strP = "";
String strP;
try {
strP = RsaUtils.decryptByPrivateKey(password);
strP = RsaUtils.decryptByPrivateKey(password);
} catch (Exception e) {
throw new RuntimeException(e);
}
// 验证码校验
// validateCaptcha(username, code, uuid);
validateCaptcha(username, code, uuid);
// 登录前置校验
loginPreCheck(username,strP);
loginPreCheck(username, strP);
// 用户验证
Authentication authentication = null;
Authentication authentication;
try {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, strP);
AuthenticationContextHolder.setContext(authenticationToken);
@ -102,30 +105,7 @@ public class SysLoginService {
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
// recordLoginInfo(loginUser.getUserId());
if (StringUtils.isNull(loginUser) || StringUtils.isNull(loginUser.getUserId())) {
addRecord(username, Constants.LOGIN_FAIL, "登录用户不存在");
throw new ServiceException("登录用户:" + username + " 不存在");
}
SysUser user = loginUser.getUser();
// 判断用户类型
if (!"admin".equals(username)) {
if (!userType.equals(user.getUserType())) {
throw new ServiceException("该用户类型错误");
}
}
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
addRecord(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
addRecord(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
// sysPasswordService.validate(user);
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}
@ -163,30 +143,32 @@ public class SysLoginService {
*/
public void loginPreCheck(String username, String password) {
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) {
this.addRecord(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
throw new ServiceException("用户/密码必须填写");
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null")));
throw new UserNotExistsException();
}
// 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
this.addRecord(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
throw new ServiceException("用户密码不在指定范围");
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
// 用户名不在指定范围内 错误
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
this.addRecord(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
throw new ServiceException("用户名不在指定范围");
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
// IP黑名单校验
// String blackStr = configService.selectConfigByKey("sys.login.blackIPList");
// if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
// {
// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked")));
// throw new BlackListException();
// }
String blackStr = configService.selectConfigByKey("sys.login.blackIPList");
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked")));
throw new BlackListException();
}
}
/**

@ -8,7 +8,6 @@ import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.AddressUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import eu.bitwalker.useragentutils.UserAgent;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
@ -96,7 +95,8 @@ public class TokenService {
* @return
*/
public Map<String, Object> createToken(LoginUser loginUser) {
String token = IdUtils.fastUUID();
// String token = IdUtils.fastUUID();
String token = String.valueOf(loginUser.getUser().getUserName());
loginUser.setToken(token);
setUserAgent(loginUser);
refreshToken(loginUser);
@ -109,6 +109,7 @@ public class TokenService {
Map<String, Object> rspMap = new HashMap<>();
rspMap.put("access_token", token1);
rspMap.put("expires_in", expireTime);
redisCache.setCacheObject(token + loginUser.getPassword(), rspMap, 5, TimeUnit.SECONDS);
return rspMap;
}
@ -160,10 +161,7 @@ public class TokenService {
* @return
*/
private String createToken(Map<String, Object> claims) {
String token = Jwts.builder()
.setClaims(claims)
.signWith(SignatureAlgorithm.HS512, secret).compact();
return token;
return Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
}
/**
@ -173,10 +171,7 @@ public class TokenService {
* @return
*/
private Claims parseToken(String token) {
return Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(token)
.getBody();
return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
}
/**

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.8.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-generator</artifactId>
<description>
generator代码生成
</description>
<dependencies>
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<!-- 阿里数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>

@ -1,72 +0,0 @@
package com.ruoyi.generator.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
*
*
* @author ruoyi
*/
@Component
@ConfigurationProperties(prefix = "gen")
@PropertySource(value = {"classpath:generator.yml"})
public class GenConfig {
/**
*
*/
public static String author;
/**
*
*/
public static String packageName;
/**
* false
*/
public static boolean autoRemovePre;
/**
* ()
*/
public static String tablePrefix;
public static String getAuthor() {
return author;
}
@Value("${author}")
public void setAuthor(String author) {
GenConfig.author = author;
}
public static String getPackageName() {
return packageName;
}
@Value("${packageName}")
public void setPackageName(String packageName) {
GenConfig.packageName = packageName;
}
public static boolean getAutoRemovePre() {
return autoRemovePre;
}
@Value("${autoRemovePre}")
public void setAutoRemovePre(boolean autoRemovePre) {
GenConfig.autoRemovePre = autoRemovePre;
}
public static String getTablePrefix() {
return tablePrefix;
}
@Value("${tablePrefix}")
public void setTablePrefix(String tablePrefix) {
GenConfig.tablePrefix = tablePrefix;
}
}

@ -1,236 +0,0 @@
package com.ruoyi.generator.controller;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.service.IGenTableColumnService;
import com.ruoyi.generator.service.IGenTableService;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/tool/gen")
public class GenController extends BaseController {
@Autowired
private IGenTableService genTableService;
@Autowired
private IGenTableColumnService genTableColumnService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
@GetMapping("/list")
public TableDataInfo genList(GenTable genTable) {
startPage();
List<GenTable> list = genTableService.selectGenTableList(genTable);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:query')")
@GetMapping(value = "/{tableId}")
public AjaxResult getInfo(@PathVariable Long tableId) {
GenTable table = genTableService.selectGenTableById(tableId);
List<GenTable> tables = genTableService.selectGenTableAll();
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
Map<String, Object> map = new HashMap<String, Object>();
map.put("info", table);
map.put("rows", list);
map.put("tables", tables);
return success(map);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
@GetMapping("/db/list")
public TableDataInfo dataList(GenTable genTable) {
startPage();
List<GenTable> list = genTableService.selectDbTableList(genTable);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
@GetMapping(value = "/column/{tableId}")
public TableDataInfo columnList(Long tableId) {
TableDataInfo dataInfo = new TableDataInfo();
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
dataInfo.setRows(list);
dataInfo.setTotal(list.size());
return dataInfo;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:import')")
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
@PostMapping("/importTable")
public AjaxResult importTableSave(String tables) {
String[] tableNames = Convert.toStrArray(tables);
// 查询表信息
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
genTableService.importGenTable(tableList, SecurityUtils.getUsername());
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasRole('admin')")
@Log(title = "创建表", businessType = BusinessType.OTHER)
@PostMapping("/createTable")
public AjaxResult createTableSave(String sql) {
try {
SqlUtil.filterKeyword(sql);
List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
List<String> tableNames = new ArrayList<>();
for (SQLStatement sqlStatement : sqlStatements) {
if (sqlStatement instanceof MySqlCreateTableStatement) {
MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
if (genTableService.createTable(createTableStatement.toString())) {
String tableName = createTableStatement.getTableName().replaceAll("`", "");
tableNames.add(tableName);
}
}
}
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
String operName = SecurityUtils.getUsername();
genTableService.importGenTable(tableList, operName);
return AjaxResult.success();
} catch (Exception e) {
logger.error(e.getMessage(), e);
return AjaxResult.error("创建表结构异常");
}
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult editSave(@Validated @RequestBody GenTable genTable) {
genTableService.validateEdit(genTable);
genTableService.updateGenTable(genTable);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:remove')")
@Log(title = "代码生成", businessType = BusinessType.DELETE)
@PostMapping("/{tableIds}")
public AjaxResult remove(@PathVariable Long[] tableIds) {
genTableService.deleteGenTableByIds(tableIds);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:preview')")
@GetMapping("/preview/{tableId}")
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException {
Map<String, String> dataMap = genTableService.previewCode(tableId);
return success(dataMap);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/download/{tableName}")
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
byte[] data = genTableService.downloadCode(tableName);
genCode(response, data);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/genCode/{tableName}")
public AjaxResult genCode(@PathVariable("tableName") String tableName) {
genTableService.generatorCode(tableName);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
@GetMapping("/synchDb/{tableName}")
public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
genTableService.synchDb(tableName);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping("/batchGenCode")
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
String[] tableNames = Convert.toStrArray(tables);
byte[] data = genTableService.downloadCode(tableNames);
genCode(response, data);
}
/**
* zip
*/
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
response.reset();
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
response.addHeader("Content-Length", "" + data.length);
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(data, response.getOutputStream());
}
}

@ -1,376 +0,0 @@
package com.ruoyi.generator.domain;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* gen_table
*
* @author ruoyi
*/
public class GenTable extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long tableId;
/**
*
*/
@NotBlank(message = "表名称不能为空")
private String tableName;
/**
*
*/
@NotBlank(message = "表描述不能为空")
private String tableComment;
/**
*
*/
private String subTableName;
/**
*
*/
private String subTableFkName;
/**
* ()
*/
@NotBlank(message = "实体类名称不能为空")
private String className;
/**
* 使crud tree sub
*/
private String tplCategory;
/**
* element-ui element-plus
*/
private String tplWebType;
/**
*
*/
@NotBlank(message = "生成包路径不能为空")
private String packageName;
/**
*
*/
@NotBlank(message = "生成模块名不能为空")
private String moduleName;
/**
*
*/
@NotBlank(message = "生成业务名不能为空")
private String businessName;
/**
*
*/
@NotBlank(message = "生成功能名不能为空")
private String functionName;
/**
*
*/
@NotBlank(message = "作者不能为空")
private String functionAuthor;
/**
* 0zip 1
*/
private String genType;
/**
*
*/
private String genPath;
/**
*
*/
private GenTableColumn pkColumn;
/**
*
*/
private GenTable subTable;
/**
*
*/
@Valid
private List<GenTableColumn> columns;
/**
*
*/
private String options;
/**
*
*/
private String treeCode;
/**
*
*/
private String treeParentCode;
/**
*
*/
private String treeName;
/**
* ID
*/
private String parentMenuId;
/**
*
*/
private String parentMenuName;
public static boolean isSub(String tplCategory) {
return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
}
public static boolean isTree(String tplCategory) {
return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
}
public static boolean isCrud(String tplCategory) {
return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
}
public static boolean isSuperColumn(String tplCategory, String javaField) {
if (isTree(tplCategory)) {
return StringUtils.equalsAnyIgnoreCase(javaField,
ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
}
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
}
public Long getTableId() {
return tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableComment() {
return tableComment;
}
public void setTableComment(String tableComment) {
this.tableComment = tableComment;
}
public String getSubTableName() {
return subTableName;
}
public void setSubTableName(String subTableName) {
this.subTableName = subTableName;
}
public String getSubTableFkName() {
return subTableFkName;
}
public void setSubTableFkName(String subTableFkName) {
this.subTableFkName = subTableFkName;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getTplCategory() {
return tplCategory;
}
public void setTplCategory(String tplCategory) {
this.tplCategory = tplCategory;
}
public String getTplWebType() {
return tplWebType;
}
public void setTplWebType(String tplWebType) {
this.tplWebType = tplWebType;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getFunctionName() {
return functionName;
}
public void setFunctionName(String functionName) {
this.functionName = functionName;
}
public String getFunctionAuthor() {
return functionAuthor;
}
public void setFunctionAuthor(String functionAuthor) {
this.functionAuthor = functionAuthor;
}
public String getGenType() {
return genType;
}
public void setGenType(String genType) {
this.genType = genType;
}
public String getGenPath() {
return genPath;
}
public void setGenPath(String genPath) {
this.genPath = genPath;
}
public GenTableColumn getPkColumn() {
return pkColumn;
}
public void setPkColumn(GenTableColumn pkColumn) {
this.pkColumn = pkColumn;
}
public GenTable getSubTable() {
return subTable;
}
public void setSubTable(GenTable subTable) {
this.subTable = subTable;
}
public List<GenTableColumn> getColumns() {
return columns;
}
public void setColumns(List<GenTableColumn> columns) {
this.columns = columns;
}
public String getOptions() {
return options;
}
public void setOptions(String options) {
this.options = options;
}
public String getTreeCode() {
return treeCode;
}
public void setTreeCode(String treeCode) {
this.treeCode = treeCode;
}
public String getTreeParentCode() {
return treeParentCode;
}
public void setTreeParentCode(String treeParentCode) {
this.treeParentCode = treeParentCode;
}
public String getTreeName() {
return treeName;
}
public void setTreeName(String treeName) {
this.treeName = treeName;
}
public String getParentMenuId() {
return parentMenuId;
}
public void setParentMenuId(String parentMenuId) {
this.parentMenuId = parentMenuId;
}
public String getParentMenuName() {
return parentMenuName;
}
public void setParentMenuName(String parentMenuName) {
this.parentMenuName = parentMenuName;
}
public boolean isSub() {
return isSub(this.tplCategory);
}
public boolean isTree() {
return isTree(this.tplCategory);
}
public boolean isCrud() {
return isCrud(this.tplCategory);
}
public boolean isSuperColumn(String javaField) {
return isSuperColumn(this.tplCategory, javaField);
}
}

@ -1,348 +0,0 @@
package com.ruoyi.generator.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import javax.validation.constraints.NotBlank;
/**
* gen_table_column
*
* @author ruoyi
*/
public class GenTableColumn extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long columnId;
/**
*
*/
private Long tableId;
/**
*
*/
private String columnName;
/**
*
*/
private String columnComment;
/**
*
*/
private String columnType;
/**
* JAVA
*/
private String javaType;
/**
* JAVA
*/
@NotBlank(message = "Java属性不能为空")
private String javaField;
/**
* 1
*/
private String isPk;
/**
* 1
*/
private String isIncrement;
/**
* 1
*/
private String isRequired;
/**
* 1
*/
private String isInsert;
/**
* 1
*/
private String isEdit;
/**
* 1
*/
private String isList;
/**
* 1
*/
private String isQuery;
/**
* EQNEGTLTLIKEBETWEEN
*/
private String queryType;
/**
* inputtextareaselectcheckboxradiodatetimeimageuploadeditor
*/
private String htmlType;
/**
*
*/
private String dictType;
/**
*
*/
private Integer sort;
public static boolean isSuperColumn(String javaField) {
return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime", "remark",
// TreeEntity
"parentName", "parentId", "orderNum", "ancestors");
}
public static boolean isUsableColumn(String javaField) {
// isSuperColumn()中的名单用于避免生成多余Domain属性若某些属性在生成页面时需要用到不能忽略则放在此处白名单
return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
}
public Long getColumnId() {
return columnId;
}
public void setColumnId(Long columnId) {
this.columnId = columnId;
}
public Long getTableId() {
return tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getColumnComment() {
return columnComment;
}
public void setColumnComment(String columnComment) {
this.columnComment = columnComment;
}
public String getColumnType() {
return columnType;
}
public void setColumnType(String columnType) {
this.columnType = columnType;
}
public String getJavaType() {
return javaType;
}
public void setJavaType(String javaType) {
this.javaType = javaType;
}
public String getJavaField() {
return javaField;
}
public void setJavaField(String javaField) {
this.javaField = javaField;
}
public String getCapJavaField() {
return StringUtils.capitalize(javaField);
}
public String getIsPk() {
return isPk;
}
public void setIsPk(String isPk) {
this.isPk = isPk;
}
public boolean isPk() {
return isPk(this.isPk);
}
public boolean isPk(String isPk) {
return isPk != null && StringUtils.equals("1", isPk);
}
public String getIsIncrement() {
return isIncrement;
}
public void setIsIncrement(String isIncrement) {
this.isIncrement = isIncrement;
}
public boolean isIncrement() {
return isIncrement(this.isIncrement);
}
public boolean isIncrement(String isIncrement) {
return isIncrement != null && StringUtils.equals("1", isIncrement);
}
public String getIsRequired() {
return isRequired;
}
public void setIsRequired(String isRequired) {
this.isRequired = isRequired;
}
public boolean isRequired() {
return isRequired(this.isRequired);
}
public boolean isRequired(String isRequired) {
return isRequired != null && StringUtils.equals("1", isRequired);
}
public String getIsInsert() {
return isInsert;
}
public void setIsInsert(String isInsert) {
this.isInsert = isInsert;
}
public boolean isInsert() {
return isInsert(this.isInsert);
}
public boolean isInsert(String isInsert) {
return isInsert != null && StringUtils.equals("1", isInsert);
}
public String getIsEdit() {
return isEdit;
}
public void setIsEdit(String isEdit) {
this.isEdit = isEdit;
}
public boolean isEdit() {
return isInsert(this.isEdit);
}
public boolean isEdit(String isEdit) {
return isEdit != null && StringUtils.equals("1", isEdit);
}
public String getIsList() {
return isList;
}
public void setIsList(String isList) {
this.isList = isList;
}
public boolean isList() {
return isList(this.isList);
}
public boolean isList(String isList) {
return isList != null && StringUtils.equals("1", isList);
}
public String getIsQuery() {
return isQuery;
}
public void setIsQuery(String isQuery) {
this.isQuery = isQuery;
}
public boolean isQuery() {
return isQuery(this.isQuery);
}
public boolean isQuery(String isQuery) {
return isQuery != null && StringUtils.equals("1", isQuery);
}
public String getQueryType() {
return queryType;
}
public void setQueryType(String queryType) {
this.queryType = queryType;
}
public String getHtmlType() {
return htmlType;
}
public void setHtmlType(String htmlType) {
this.htmlType = htmlType;
}
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public boolean isSuperColumn() {
return isSuperColumn(this.javaField);
}
public boolean isUsableColumn() {
return isUsableColumn(javaField);
}
public String readConverterExp() {
String remarks = StringUtils.substringBetween(this.columnComment, "", "");
StringBuffer sb = new StringBuffer();
if (StringUtils.isNotEmpty(remarks)) {
for (String value : remarks.split(" ")) {
if (StringUtils.isNotEmpty(value)) {
Object startStr = value.subSequence(0, 1);
String endStr = value.substring(1);
sb.append("").append(startStr).append("=").append(endStr).append(",");
}
}
return sb.deleteCharAt(sb.length() - 1).toString();
} else {
return this.columnComment;
}
}
}

@ -1,60 +0,0 @@
package com.ruoyi.generator.mapper;
import com.ruoyi.generator.domain.GenTableColumn;
import java.util.List;
/**
*
*
* @author ruoyi
*/
public interface GenTableColumnMapper {
/**
*
*
* @param tableName
* @return
*/
public List<GenTableColumn> selectDbTableColumnsByName(String tableName);
/**
*
*
* @param tableId
* @return
*/
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
/**
*
*
* @param genTableColumn
* @return
*/
public int insertGenTableColumn(GenTableColumn genTableColumn);
/**
*
*
* @param genTableColumn
* @return
*/
public int updateGenTableColumn(GenTableColumn genTableColumn);
/**
*
*
* @param genTableColumns
* @return
*/
public int deleteGenTableColumns(List<GenTableColumn> genTableColumns);
/**
*
*
* @param ids ID
* @return
*/
public int deleteGenTableColumnByIds(Long[] ids);
}

@ -1,91 +0,0 @@
package com.ruoyi.generator.mapper;
import com.ruoyi.generator.domain.GenTable;
import java.util.List;
/**
*
*
* @author ruoyi
*/
public interface GenTableMapper {
/**
*
*
* @param genTable
* @return
*/
public List<GenTable> selectGenTableList(GenTable genTable);
/**
*
*
* @param genTable
* @return
*/
public List<GenTable> selectDbTableList(GenTable genTable);
/**
*
*
* @param tableNames
* @return
*/
public List<GenTable> selectDbTableListByNames(String[] tableNames);
/**
*
*
* @return
*/
public List<GenTable> selectGenTableAll();
/**
* ID
*
* @param id ID
* @return
*/
public GenTable selectGenTableById(Long id);
/**
*
*
* @param tableName
* @return
*/
public GenTable selectGenTableByName(String tableName);
/**
*
*
* @param genTable
* @return
*/
public int insertGenTable(GenTable genTable);
/**
*
*
* @param genTable
* @return
*/
public int updateGenTable(GenTable genTable);
/**
*
*
* @param ids ID
* @return
*/
public int deleteGenTableByIds(Long[] ids);
/**
*
*
* @param sql
* @return
*/
public int createTable(String sql);
}

@ -1,64 +0,0 @@
package com.ruoyi.generator.service;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.mapper.GenTableColumnMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author ruoyi
*/
@Service
public class GenTableColumnServiceImpl implements IGenTableColumnService {
@Autowired
private GenTableColumnMapper genTableColumnMapper;
/**
*
*
* @param tableId
* @return
*/
@Override
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) {
return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
}
/**
*
*
* @param genTableColumn
* @return
*/
@Override
public int insertGenTableColumn(GenTableColumn genTableColumn) {
return genTableColumnMapper.insertGenTableColumn(genTableColumn);
}
/**
*
*
* @param genTableColumn
* @return
*/
@Override
public int updateGenTableColumn(GenTableColumn genTableColumn) {
return genTableColumnMapper.updateGenTableColumn(genTableColumn);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteGenTableColumnByIds(String ids) {
return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
}
}

@ -1,464 +0,0 @@
package com.ruoyi.generator.service;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.text.CharsetKit;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.mapper.GenTableColumnMapper;
import com.ruoyi.generator.mapper.GenTableMapper;
import com.ruoyi.generator.util.GenUtils;
import com.ruoyi.generator.util.VelocityInitializer;
import com.ruoyi.generator.util.VelocityUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
*
*
* @author ruoyi
*/
@Service
public class GenTableServiceImpl implements IGenTableService {
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
@Autowired
private GenTableMapper genTableMapper;
@Autowired
private GenTableColumnMapper genTableColumnMapper;
/**
*
*
* @param table
* @param template
* @return
*/
public static String getGenPath(GenTable table, String template) {
String genPath = table.getGenPath();
if (StringUtils.equals(genPath, "/")) {
return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
}
return genPath + File.separator + VelocityUtils.getFileName(template, table);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public GenTable selectGenTableById(Long id) {
GenTable genTable = genTableMapper.selectGenTableById(id);
setTableFromOptions(genTable);
return genTable;
}
/**
*
*
* @param genTable
* @return
*/
@Override
public List<GenTable> selectGenTableList(GenTable genTable) {
return genTableMapper.selectGenTableList(genTable);
}
/**
*
*
* @param genTable
* @return
*/
@Override
public List<GenTable> selectDbTableList(GenTable genTable) {
return genTableMapper.selectDbTableList(genTable);
}
/**
*
*
* @param tableNames
* @return
*/
@Override
public List<GenTable> selectDbTableListByNames(String[] tableNames) {
return genTableMapper.selectDbTableListByNames(tableNames);
}
/**
*
*
* @return
*/
@Override
public List<GenTable> selectGenTableAll() {
return genTableMapper.selectGenTableAll();
}
/**
*
*
* @param genTable
* @return
*/
@Override
@Transactional
public void updateGenTable(GenTable genTable) {
String options = JSON.toJSONString(genTable.getParams());
genTable.setOptions(options);
int row = genTableMapper.updateGenTable(genTable);
if (row > 0) {
for (GenTableColumn cenTableColumn : genTable.getColumns()) {
genTableColumnMapper.updateGenTableColumn(cenTableColumn);
}
}
}
/**
*
*
* @param tableIds ID
* @return
*/
@Override
@Transactional
public void deleteGenTableByIds(Long[] tableIds) {
genTableMapper.deleteGenTableByIds(tableIds);
genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
}
/**
*
*
* @param sql
* @return
*/
@Override
public boolean createTable(String sql) {
return genTableMapper.createTable(sql) == 0;
}
/**
*
*
* @param tableList
*/
@Override
@Transactional
public void importGenTable(List<GenTable> tableList, String operName) {
try {
for (GenTable table : tableList) {
String tableName = table.getTableName();
GenUtils.initTable(table, operName);
int row = genTableMapper.insertGenTable(table);
if (row > 0) {
// 保存列信息
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
for (GenTableColumn column : genTableColumns) {
GenUtils.initColumnField(column, table);
genTableColumnMapper.insertGenTableColumn(column);
}
}
}
} catch (Exception e) {
throw new ServiceException("导入失败:" + e.getMessage());
}
}
/**
*
*
* @param tableId
* @return
*/
@Override
public Map<String, String> previewCode(Long tableId) {
Map<String, String> dataMap = new LinkedHashMap<>();
// 查询表信息
GenTable table = genTableMapper.selectGenTableById(tableId);
// 设置主子表信息
setSubTable(table);
// 设置主键列信息
setPkColumn(table);
VelocityInitializer.initVelocity();
VelocityContext context = VelocityUtils.prepareContext(table);
// 获取模板列表
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
for (String template : templates) {
// 渲染模板
StringWriter sw = new StringWriter();
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
tpl.merge(context, sw);
dataMap.put(template, sw.toString());
}
return dataMap;
}
/**
*
*
* @param tableName
* @return
*/
@Override
public byte[] downloadCode(String tableName) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
generatorCode(tableName, zip);
IOUtils.closeQuietly(zip);
return outputStream.toByteArray();
}
/**
*
*
* @param tableName
*/
@Override
public void generatorCode(String tableName) {
// 查询表信息
GenTable table = genTableMapper.selectGenTableByName(tableName);
// 设置主子表信息
setSubTable(table);
// 设置主键列信息
setPkColumn(table);
VelocityInitializer.initVelocity();
VelocityContext context = VelocityUtils.prepareContext(table);
// 获取模板列表
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
for (String template : templates) {
if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) {
// 渲染模板
StringWriter sw = new StringWriter();
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
tpl.merge(context, sw);
try {
String path = getGenPath(table, template);
FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
} catch (IOException e) {
throw new ServiceException("渲染模板失败,表名:" + table.getTableName());
}
}
}
}
/**
*
*
* @param tableName
*/
@Override
@Transactional
public void synchDb(String tableName) {
GenTable table = genTableMapper.selectGenTableByName(tableName);
List<GenTableColumn> tableColumns = table.getColumns();
Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
if (StringUtils.isEmpty(dbTableColumns)) {
throw new ServiceException("同步数据失败,原表结构不存在");
}
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
dbTableColumns.forEach(column -> {
GenUtils.initColumnField(column, table);
if (tableColumnMap.containsKey(column.getColumnName())) {
GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName());
column.setColumnId(prevColumn.getColumnId());
if (column.isList()) {
// 如果是列表,继续保留查询方式/字典类型选项
column.setDictType(prevColumn.getDictType());
column.setQueryType(prevColumn.getQueryType());
}
if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk()
&& (column.isInsert() || column.isEdit())
&& ((column.isUsableColumn()) || (!column.isSuperColumn()))) {
// 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项
column.setIsRequired(prevColumn.getIsRequired());
column.setHtmlType(prevColumn.getHtmlType());
}
genTableColumnMapper.updateGenTableColumn(column);
} else {
genTableColumnMapper.insertGenTableColumn(column);
}
});
List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
if (StringUtils.isNotEmpty(delColumns)) {
genTableColumnMapper.deleteGenTableColumns(delColumns);
}
}
/**
*
*
* @param tableNames
* @return
*/
@Override
public byte[] downloadCode(String[] tableNames) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
for (String tableName : tableNames) {
generatorCode(tableName, zip);
}
IOUtils.closeQuietly(zip);
return outputStream.toByteArray();
}
/**
*
*/
private void generatorCode(String tableName, ZipOutputStream zip) {
// 查询表信息
GenTable table = genTableMapper.selectGenTableByName(tableName);
// 设置主子表信息
setSubTable(table);
// 设置主键列信息
setPkColumn(table);
VelocityInitializer.initVelocity();
VelocityContext context = VelocityUtils.prepareContext(table);
// 获取模板列表
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
for (String template : templates) {
// 渲染模板
StringWriter sw = new StringWriter();
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
tpl.merge(context, sw);
try {
// 添加到zip
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
IOUtils.write(sw.toString(), zip, Constants.UTF8);
IOUtils.closeQuietly(sw);
zip.flush();
zip.closeEntry();
} catch (IOException e) {
log.error("渲染模板失败,表名:" + table.getTableName(), e);
}
}
}
/**
*
*
* @param genTable
*/
@Override
public void validateEdit(GenTable genTable) {
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
String options = JSON.toJSONString(genTable.getParams());
JSONObject paramsObj = JSON.parseObject(options);
if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) {
throw new ServiceException("树编码字段不能为空");
} else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) {
throw new ServiceException("树父编码字段不能为空");
} else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) {
throw new ServiceException("树名称字段不能为空");
} else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
if (StringUtils.isEmpty(genTable.getSubTableName())) {
throw new ServiceException("关联子表的表名不能为空");
} else if (StringUtils.isEmpty(genTable.getSubTableFkName())) {
throw new ServiceException("子表关联的外键名不能为空");
}
}
}
}
/**
*
*
* @param table
*/
public void setPkColumn(GenTable table) {
for (GenTableColumn column : table.getColumns()) {
if (column.isPk()) {
table.setPkColumn(column);
break;
}
}
if (StringUtils.isNull(table.getPkColumn())) {
table.setPkColumn(table.getColumns().get(0));
}
if (GenConstants.TPL_SUB.equals(table.getTplCategory())) {
for (GenTableColumn column : table.getSubTable().getColumns()) {
if (column.isPk()) {
table.getSubTable().setPkColumn(column);
break;
}
}
if (StringUtils.isNull(table.getSubTable().getPkColumn())) {
table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
}
}
}
/**
*
*
* @param table
*/
public void setSubTable(GenTable table) {
String subTableName = table.getSubTableName();
if (StringUtils.isNotEmpty(subTableName)) {
table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
}
}
/**
*
*
* @param genTable
*/
public void setTableFromOptions(GenTable genTable) {
JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
if (StringUtils.isNotNull(paramsObj)) {
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID);
String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
genTable.setTreeCode(treeCode);
genTable.setTreeParentCode(treeParentCode);
genTable.setTreeName(treeName);
genTable.setParentMenuId(parentMenuId);
genTable.setParentMenuName(parentMenuName);
}
}
}

@ -1,44 +0,0 @@
package com.ruoyi.generator.service;
import com.ruoyi.generator.domain.GenTableColumn;
import java.util.List;
/**
*
*
* @author ruoyi
*/
public interface IGenTableColumnService {
/**
*
*
* @param tableId
* @return
*/
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
/**
*
*
* @param genTableColumn
* @return
*/
public int insertGenTableColumn(GenTableColumn genTableColumn);
/**
*
*
* @param genTableColumn
* @return
*/
public int updateGenTableColumn(GenTableColumn genTableColumn);
/**
*
*
* @param ids ID
* @return
*/
public int deleteGenTableColumnByIds(String ids);
}

@ -1,130 +0,0 @@
package com.ruoyi.generator.service;
import com.ruoyi.generator.domain.GenTable;
import java.util.List;
import java.util.Map;
/**
*
*
* @author ruoyi
*/
public interface IGenTableService {
/**
*
*
* @param genTable
* @return
*/
public List<GenTable> selectGenTableList(GenTable genTable);
/**
*
*
* @param genTable
* @return
*/
public List<GenTable> selectDbTableList(GenTable genTable);
/**
*
*
* @param tableNames
* @return
*/
public List<GenTable> selectDbTableListByNames(String[] tableNames);
/**
*
*
* @return
*/
public List<GenTable> selectGenTableAll();
/**
*
*
* @param id ID
* @return
*/
public GenTable selectGenTableById(Long id);
/**
*
*
* @param genTable
* @return
*/
public void updateGenTable(GenTable genTable);
/**
*
*
* @param tableIds ID
* @return
*/
public void deleteGenTableByIds(Long[] tableIds);
/**
*
*
* @param sql
* @return
*/
public boolean createTable(String sql);
/**
*
*
* @param tableList
* @param operName
*/
public void importGenTable(List<GenTable> tableList, String operName);
/**
*
*
* @param tableId
* @return
*/
public Map<String, String> previewCode(Long tableId);
/**
*
*
* @param tableName
* @return
*/
public byte[] downloadCode(String tableName);
/**
*
*
* @param tableName
* @return
*/
public void generatorCode(String tableName);
/**
*
*
* @param tableName
*/
public void synchDb(String tableName);
/**
*
*
* @param tableNames
* @return
*/
public byte[] downloadCode(String[] tableNames);
/**
*
*
* @param genTable
*/
public void validateEdit(GenTable genTable);
}

@ -1,221 +0,0 @@
package com.ruoyi.generator.util;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.config.GenConfig;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import org.apache.commons.lang3.RegExUtils;
import java.util.Arrays;
/**
*
*
* @author ruoyi
*/
public class GenUtils {
/**
*
*/
public static void initTable(GenTable genTable, String operName) {
genTable.setClassName(convertClassName(genTable.getTableName()));
genTable.setPackageName(GenConfig.getPackageName());
genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
genTable.setFunctionName(replaceText(genTable.getTableComment()));
genTable.setFunctionAuthor(GenConfig.getAuthor());
genTable.setCreateBy(operName);
}
/**
*
*/
public static void initColumnField(GenTableColumn column, GenTable table) {
String dataType = getDbType(column.getColumnType());
String columnName = column.getColumnName();
column.setTableId(table.getTableId());
column.setCreateBy(table.getCreateBy());
// 设置java字段名
column.setJavaField(StringUtils.toCamelCase(columnName));
// 设置默认类型
column.setJavaType(GenConstants.TYPE_STRING);
column.setQueryType(GenConstants.QUERY_EQ);
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) {
// 字符串长度超过500设置为文本域
Integer columnLength = getColumnLength(column.getColumnType());
String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT;
column.setHtmlType(htmlType);
} else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) {
column.setJavaType(GenConstants.TYPE_DATE);
column.setHtmlType(GenConstants.HTML_DATETIME);
} else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) {
column.setHtmlType(GenConstants.HTML_INPUT);
// 如果是浮点型 统一用BigDecimal
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) {
column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
}
// 如果是整形
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) {
column.setJavaType(GenConstants.TYPE_INTEGER);
}
// 长整形
else {
column.setJavaType(GenConstants.TYPE_LONG);
}
}
// 插入字段(默认所有字段都需要插入)
column.setIsInsert(GenConstants.REQUIRE);
// 编辑字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) {
column.setIsEdit(GenConstants.REQUIRE);
}
// 列表字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) {
column.setIsList(GenConstants.REQUIRE);
}
// 查询字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) {
column.setIsQuery(GenConstants.REQUIRE);
}
// 查询字段类型
if (StringUtils.endsWithIgnoreCase(columnName, "name")) {
column.setQueryType(GenConstants.QUERY_LIKE);
}
// 状态字段设置单选框
if (StringUtils.endsWithIgnoreCase(columnName, "status")) {
column.setHtmlType(GenConstants.HTML_RADIO);
}
// 类型&性别字段设置下拉框
else if (StringUtils.endsWithIgnoreCase(columnName, "type")
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) {
column.setHtmlType(GenConstants.HTML_SELECT);
}
// 图片字段设置图片上传控件
else if (StringUtils.endsWithIgnoreCase(columnName, "image")) {
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
}
// 文件字段设置文件上传控件
else if (StringUtils.endsWithIgnoreCase(columnName, "file")) {
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
}
// 内容字段设置富文本控件
else if (StringUtils.endsWithIgnoreCase(columnName, "content")) {
column.setHtmlType(GenConstants.HTML_EDITOR);
}
}
/**
*
*
* @param arr
* @param targetValue
* @return
*/
public static boolean arraysContains(String[] arr, String targetValue) {
return Arrays.asList(arr).contains(targetValue);
}
/**
*
*
* @param packageName
* @return
*/
public static String getModuleName(String packageName) {
int lastIndex = packageName.lastIndexOf(".");
int nameLength = packageName.length();
return StringUtils.substring(packageName, lastIndex + 1, nameLength);
}
/**
*
*
* @param tableName
* @return
*/
public static String getBusinessName(String tableName) {
int lastIndex = tableName.lastIndexOf("_");
int nameLength = tableName.length();
return StringUtils.substring(tableName, lastIndex + 1, nameLength);
}
/**
* Java
*
* @param tableName
* @return
*/
public static String convertClassName(String tableName) {
boolean autoRemovePre = GenConfig.getAutoRemovePre();
String tablePrefix = GenConfig.getTablePrefix();
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
String[] searchList = StringUtils.split(tablePrefix, ",");
tableName = replaceFirst(tableName, searchList);
}
return StringUtils.convertToCamelCase(tableName);
}
/**
*
*
* @param replacementm
* @param searchList
* @return
*/
public static String replaceFirst(String replacementm, String[] searchList) {
String text = replacementm;
for (String searchString : searchList) {
if (replacementm.startsWith(searchString)) {
text = replacementm.replaceFirst(searchString, "");
break;
}
}
return text;
}
/**
*
*
* @param text
* @return
*/
public static String replaceText(String text) {
return RegExUtils.replaceAll(text, "(?:表|若依)", "");
}
/**
*
*
* @param columnType
* @return
*/
public static String getDbType(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
return StringUtils.substringBefore(columnType, "(");
} else {
return columnType;
}
}
/**
*
*
* @param columnType
* @return
*/
public static Integer getColumnLength(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
String length = StringUtils.substringBetween(columnType, "(", ")");
return Integer.valueOf(length);
} else {
return 0;
}
}
}

@ -1,30 +0,0 @@
package com.ruoyi.generator.util;
import com.ruoyi.common.constant.Constants;
import org.apache.velocity.app.Velocity;
import java.util.Properties;
/**
* VelocityEngine
*
* @author ruoyi
*/
public class VelocityInitializer {
/**
* vm
*/
public static void initVelocity() {
Properties p = new Properties();
try {
// 加载classpath目录下的vm文件
p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
// 定义字符集
p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
// 初始化Velocity引擎指定配置Properties
Velocity.init(p);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -1,354 +0,0 @@
package com.ruoyi.generator.util;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import org.apache.velocity.VelocityContext;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
*
*
* @author ruoyi
*/
public class VelocityUtils {
/**
*
*/
private static final String PROJECT_PATH = "main/java";
/**
* mybatis
*/
private static final String MYBATIS_PATH = "main/resources/mapper";
/**
*
*/
private static final String DEFAULT_PARENT_MENU_ID = "3";
/**
*
*
* @return
*/
public static VelocityContext prepareContext(GenTable genTable) {
String moduleName = genTable.getModuleName();
String businessName = genTable.getBusinessName();
String packageName = genTable.getPackageName();
String tplCategory = genTable.getTplCategory();
String functionName = genTable.getFunctionName();
VelocityContext velocityContext = new VelocityContext();
velocityContext.put("tplCategory", genTable.getTplCategory());
velocityContext.put("tableName", genTable.getTableName());
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
velocityContext.put("ClassName", genTable.getClassName());
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
velocityContext.put("moduleName", genTable.getModuleName());
velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName()));
velocityContext.put("businessName", genTable.getBusinessName());
velocityContext.put("basePackage", getPackagePrefix(packageName));
velocityContext.put("packageName", packageName);
velocityContext.put("author", genTable.getFunctionAuthor());
velocityContext.put("datetime", DateUtils.getDate());
velocityContext.put("pkColumn", genTable.getPkColumn());
velocityContext.put("importList", getImportList(genTable));
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
velocityContext.put("columns", genTable.getColumns());
velocityContext.put("table", genTable);
velocityContext.put("dicts", getDicts(genTable));
setMenuVelocityContext(velocityContext, genTable);
if (GenConstants.TPL_TREE.equals(tplCategory)) {
setTreeVelocityContext(velocityContext, genTable);
}
if (GenConstants.TPL_SUB.equals(tplCategory)) {
setSubVelocityContext(velocityContext, genTable);
}
return velocityContext;
}
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) {
String options = genTable.getOptions();
JSONObject paramsObj = JSON.parseObject(options);
String parentMenuId = getParentMenuId(paramsObj);
context.put("parentMenuId", parentMenuId);
}
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) {
String options = genTable.getOptions();
JSONObject paramsObj = JSON.parseObject(options);
String treeCode = getTreecode(paramsObj);
String treeParentCode = getTreeParentCode(paramsObj);
String treeName = getTreeName(paramsObj);
context.put("treeCode", treeCode);
context.put("treeParentCode", treeParentCode);
context.put("treeName", treeName);
context.put("expandColumn", getExpandColumn(genTable));
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) {
context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE));
}
if (paramsObj.containsKey(GenConstants.TREE_NAME)) {
context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME));
}
}
public static void setSubVelocityContext(VelocityContext context, GenTable genTable) {
GenTable subTable = genTable.getSubTable();
String subTableName = genTable.getSubTableName();
String subTableFkName = genTable.getSubTableFkName();
String subClassName = genTable.getSubTable().getClassName();
String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName);
context.put("subTable", subTable);
context.put("subTableName", subTableName);
context.put("subTableFkName", subTableFkName);
context.put("subTableFkClassName", subTableFkClassName);
context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName));
context.put("subClassName", subClassName);
context.put("subclassName", StringUtils.uncapitalize(subClassName));
context.put("subImportList", getImportList(genTable.getSubTable()));
}
/**
*
*
* @param tplCategory
* @param tplWebType
* @return
*/
public static List<String> getTemplateList(String tplCategory, String tplWebType) {
String useWebType = "vm/vue";
if ("element-plus".equals(tplWebType)) {
useWebType = "vm/vue/v3";
}
List<String> templates = new ArrayList<String>();
templates.add("vm/java/domain.java.vm");
templates.add("vm/java/mapper.java.vm");
templates.add("vm/java/service.java.vm");
templates.add("vm/java/serviceImpl.java.vm");
templates.add("vm/java/controller.java.vm");
templates.add("vm/xml/mapper.xml.vm");
templates.add("vm/sql/sql.vm");
templates.add("vm/js/api.js.vm");
if (GenConstants.TPL_CRUD.equals(tplCategory)) {
templates.add(useWebType + "/index.vue.vm");
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
templates.add(useWebType + "/index-tree.vue.vm");
} else if (GenConstants.TPL_SUB.equals(tplCategory)) {
templates.add(useWebType + "/index.vue.vm");
templates.add("vm/java/sub-domain.java.vm");
}
return templates;
}
/**
*
*/
public static String getFileName(String template, GenTable genTable) {
// 文件名称
String fileName = "";
// 包路径
String packageName = genTable.getPackageName();
// 模块名
String moduleName = genTable.getModuleName();
// 大写类名
String className = genTable.getClassName();
// 业务名称
String businessName = genTable.getBusinessName();
String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
String vuePath = "vue";
if (template.contains("domain.java.vm")) {
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
}
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) {
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
} else if (template.contains("mapper.java.vm")) {
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
} else if (template.contains("service.java.vm")) {
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
} else if (template.contains("serviceImpl.java.vm")) {
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
} else if (template.contains("controller.java.vm")) {
fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className);
} else if (template.contains("mapper.xml.vm")) {
fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className);
} else if (template.contains("sql.vm")) {
fileName = businessName + "Menu.sql";
} else if (template.contains("api.js.vm")) {
fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName);
} else if (template.contains("index.vue.vm")) {
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
} else if (template.contains("index-tree.vue.vm")) {
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
}
return fileName;
}
/**
*
*
* @param packageName
* @return
*/
public static String getPackagePrefix(String packageName) {
int lastIndex = packageName.lastIndexOf(".");
return StringUtils.substring(packageName, 0, lastIndex);
}
/**
*
*
* @param genTable
* @return
*/
public static HashSet<String> getImportList(GenTable genTable) {
List<GenTableColumn> columns = genTable.getColumns();
GenTable subGenTable = genTable.getSubTable();
HashSet<String> importList = new HashSet<String>();
if (StringUtils.isNotNull(subGenTable)) {
importList.add("java.util.List");
}
for (GenTableColumn column : columns) {
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
importList.add("java.util.Date");
importList.add("com.fasterxml.jackson.annotation.JsonFormat");
} else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) {
importList.add("java.math.BigDecimal");
}
}
return importList;
}
/**
*
*
* @param genTable
* @return
*/
public static String getDicts(GenTable genTable) {
List<GenTableColumn> columns = genTable.getColumns();
Set<String> dicts = new HashSet<String>();
addDicts(dicts, columns);
if (StringUtils.isNotNull(genTable.getSubTable())) {
List<GenTableColumn> subColumns = genTable.getSubTable().getColumns();
addDicts(dicts, subColumns);
}
return StringUtils.join(dicts, ", ");
}
/**
*
*
* @param dicts
* @param columns
*/
public static void addDicts(Set<String> dicts, List<GenTableColumn> columns) {
for (GenTableColumn column : columns) {
if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
column.getHtmlType(),
new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX})) {
dicts.add("'" + column.getDictType() + "'");
}
}
}
/**
*
*
* @param moduleName
* @param businessName
* @return
*/
public static String getPermissionPrefix(String moduleName, String businessName) {
return StringUtils.format("{}:{}", moduleName, businessName);
}
/**
* ID
*
* @param paramsObj
* @return ID
*/
public static String getParentMenuId(JSONObject paramsObj) {
if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)
&& StringUtils.isNotEmpty(paramsObj.getString(GenConstants.PARENT_MENU_ID))) {
return paramsObj.getString(GenConstants.PARENT_MENU_ID);
}
return DEFAULT_PARENT_MENU_ID;
}
/**
*
*
* @param paramsObj
* @return
*/
public static String getTreecode(JSONObject paramsObj) {
if (paramsObj.containsKey(GenConstants.TREE_CODE)) {
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE));
}
return StringUtils.EMPTY;
}
/**
*
*
* @param paramsObj
* @return
*/
public static String getTreeParentCode(JSONObject paramsObj) {
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) {
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE));
}
return StringUtils.EMPTY;
}
/**
*
*
* @param paramsObj
* @return
*/
public static String getTreeName(JSONObject paramsObj) {
if (paramsObj.containsKey(GenConstants.TREE_NAME)) {
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME));
}
return StringUtils.EMPTY;
}
/**
*
*
* @param genTable
* @return
*/
public static int getExpandColumn(GenTable genTable) {
String options = genTable.getOptions();
JSONObject paramsObj = JSON.parseObject(options);
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
int num = 0;
for (GenTableColumn column : genTable.getColumns()) {
if (column.isList()) {
num++;
String columnName = column.getColumnName();
if (columnName.equals(treeName)) {
break;
}
}
}
return num;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save