wushunjie
杜函宇 7 months ago
parent bf9920ed04
commit 6ebcb18c74

@ -227,8 +227,10 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
//如果前端部分企业名录集合为空
if (null != enterpriseDirectoryList && enterpriseDirectoryList.size() > 0) {
enterpriseDirectoryList.forEach(x -> {
getDeclarationRecordsList(bmsTemplateRecordAddDto, drlist, x.getCreditCode(), tp.getTemplateJson());
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);
} else {

@ -5,16 +5,20 @@ import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.poi.word.Word07Writer;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.jjh.ent.entity.JDevelopmentReport;
import com.ruoyi.jjh.ent.entity.response.JTemplateMetricsResponse;
import com.ruoyi.jjh.ent.service.JDevelopmentReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
@ -22,17 +26,14 @@ 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.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 java.awt.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
/**
* j_template_metrics
@ -46,95 +47,104 @@ import java.nio.file.Paths;
public class JDevelopmentReportController extends BaseController {
@Value("${ruoyi.profile}")
private String fileAddress;
@Autowired
private JDevelopmentReportService jDevelopmentReportService;
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
@ApiOperation(value = "获取当前用户的模板", response = JDevelopmentReport.class)
@PostMapping("/getId")
public AjaxResult getId() {
Long userId = null;
try {
userId = SecurityUtils.getUserId();
} catch (Exception ignored) {
throw new ServiceException("获取当前用户失败!");
}
List<JDevelopmentReport> list = jDevelopmentReportService.lambdaQuery().eq(JDevelopmentReport::getCreateId, userId).list();
if(!list.isEmpty()){
return success(list.get(0));
}else {
return success();
}
}
/**
*
*/
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
@ApiOperation(value = "新增服务业发展报告", response = JDevelopmentReport.class)
@ApiOperation(value = "新增或者修改服务业发展报告", response = JDevelopmentReport.class)
@PostMapping
public AjaxResult add(@RequestBody JDevelopmentReport jDevelopmentReport) {
Long userId = null;
try {
userId = SecurityUtils.getUserId();
} catch (Exception ignored) {
throw new ServiceException("获取当前用户失败!");
}
List<JDevelopmentReport> list = jDevelopmentReportService.lambdaQuery().eq(JDevelopmentReport::getCreateId, userId).list();
if(!list.isEmpty()){
return toAjax(jDevelopmentReportService.updateById(jDevelopmentReport));
}else {
return toAjax(jDevelopmentReportService.save(jDevelopmentReport));
}
}
/**
*
*/
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
@ApiOperation(value = "模板指标自定义选择", response = JTemplateMetricsResponse.class)
@GetMapping("/templateMetrics")
public AjaxResult getTemplateMetrics(String year) {
@GetMapping("/templateMetrics/{year}")
public AjaxResult getTemplateMetrics(@PathVariable("year") String year) {
return success(jDevelopmentReportService.getTemplateMetrics(year));
}
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
@ApiOperation(value = "下载发展模板")
@GetMapping("/downloadLocal")
public ResponseEntity<Resource> downloadLocal() {
String filePath = System.getProperty("user.dir") + "/ruoyi-admin/src/main/resources/template/发展报告模板.docx";
// 创建文件资源
Path path = Paths.get(filePath);
FileSystemResource resource = new FileSystemResource(path.toFile());
@PostMapping("/downloadTemplate")
public ResponseEntity<Resource> downloadTemplate(@RequestBody JDevelopmentReport s) {
// 创建父文件目录
String fatherFile = fileAddress + "/" + "moban.docx";
// 创建文件
File touch = FileUtil.touch(fatherFile);
// 创建 Word07Writer 实例
Word07Writer writer = new Word07Writer();
try {
// 添加段落(标题)
writer.addText(ParagraphAlignment.CENTER,new Font("宋体", Font.PLAIN, 18), s.getTitle());
// 添加副标题
writer.addText(ParagraphAlignment.CENTER,new Font("宋体", Font.PLAIN, 14), s.getSubheading());
// 使用 Jsoup 解析页面内容
Document doc = Jsoup.parse(s.getContent(), "UTF-8");
// 获取页面内容中的段落
Elements paragraphs = doc.select("p");
for (Element paragraph : paragraphs) {
writer.addText(new Font("仿宋", Font.PLAIN, 12), paragraph.text());
}
// 写出到文件
writer.flush(touch);
// 设置响应头
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + "moban");
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=moban.docx");
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE);
// 返回 ResponseEntity
// 封装为 ResponseEntity
FileSystemResource resource = new FileSystemResource(touch);
return ResponseEntity.ok()
.headers(headers)
.body(resource);
} catch (Exception e) {
// 处理异常情况,例如日志记录或者其他错误处理
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
} finally {
// 关闭资源
writer.close();
}
}
// @ApiOperation(value = "下载发展模板")
// @PostMapping("/downloadTemplate")
// public ResponseEntity<Resource> downloadTemplate(@RequestBody JDevelopmentReport s) {
// // 定义文件路径
// ClassPathResource filePath = new ClassPathResource("/template/moban.docx");
// File touch = filePath.getFile();
// // 创建 Word07Writer 实例
// Word07Writer writer = new Word07Writer();
//
// try {
// // 添加段落(标题)
// writer.addText(new Font("宋体", Font.PLAIN, 22), s.getTitle());
//
// // 添加副标题
// writer.addText(new Font("宋体", Font.PLAIN, 18), s.getSubheading());
//
// // 使用 Jsoup 解析页面内容
// Document doc = Jsoup.parse(s.getContent(), "UTF-8");
//
// // 获取页面内容中的段落
// Elements paragraphs = doc.select("p");
// for (Element paragraph : paragraphs) {
// writer.addText(new Font("仿宋", Font.PLAIN, 16), paragraph.text());
// }
//
// // 写出到文件
// writer.flush(touch);
//
// // 设置响应头
// HttpHeaders headers = new HttpHeaders();
// headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"发展报告模板1.docx\"");
// headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE);
//
// // 封装为 ResponseEntity
// FileSystemResource resource = new FileSystemResource(touch);
// return ResponseEntity.ok()
// .headers(headers)
// .body(resource);
// } catch (Exception e) {
// // 处理异常情况,例如日志记录或者其他错误处理
// e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
// } finally {
// // 关闭资源
// writer.close();
// // 删除临时文件
// FileUtil.del((Path) filePath);
// }
// }
}

@ -7,9 +7,11 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.job.TaskException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.jjh.declaration.regular.TimeChange;
import com.ruoyi.jjh.ent.entity.HomeRequestSmart;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.entity.JSmartReminders;
import com.ruoyi.jjh.ent.entity.request.JAddJobSmart;
import com.ruoyi.jjh.ent.entity.request.JRemindChiefAllRequest;
import com.ruoyi.jjh.ent.entity.request.JSmartRemindersDq;
import com.ruoyi.jjh.ent.entity.request.JSmartRemindersNDq;
import com.ruoyi.jjh.ent.mapper.JSmartRemindersMapper;
@ -86,7 +88,7 @@ public class JSmartRemindersController extends BaseController {
@PreAuthorize("@ss.hasAnyRoles('ent')")
@ApiOperation(value = "企业端首页智能提醒查询所有数据", response = JSmartDeclaration.class)
@GetMapping("/enterpriseAll")
public AjaxResult enterpriseAll() {
public AjaxResult enterpriseAll(Page<HomeRequestSmart> page) {
// 获取当前登录用户是否是企业端
boolean admin = false;
String str = null;
@ -98,7 +100,7 @@ public class JSmartRemindersController extends BaseController {
if (admin) {
str = null;
}
return success(jSmartDeclarationService.selectEnterpriseAllList(str));
return success(jSmartDeclarationService.selectEnterpriseAllList(page,str));
}
@ -108,21 +110,20 @@ public class JSmartRemindersController extends BaseController {
* @return
*/
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
@ApiOperation(value = "政务端首页智能提醒查询所有数据", response = JSmartDeclaration.class)
@ApiOperation(value = "政务端首页智能提醒查询数据", response = JSmartDeclaration.class)
@GetMapping("/chiefAll")
public AjaxResult chiefAll(Long projectId) {
public AjaxResult chiefAll(Page<HomeRequestSmart> page, JRemindChiefAllRequest req) {
// 获取当前登录用户是否是政务端
boolean admin = false;
Long userId = null;
try {
admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
userId = SecurityUtils.getUserId();
req.setUserId(SecurityUtils.getUserId());
} catch (Exception ignored) {
}
if (admin) {
userId = null;
req.setUserId(null);
}
return success(jSmartDeclarationService.chiefAll(userId, projectId));
return success(jSmartDeclarationService.chiefAll(page,req));
}
/**

@ -1,8 +1,6 @@
package com.ruoyi.jjh.ent.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.jjh.common.entity.BaseInfoEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -48,4 +46,20 @@ public class JDevelopmentReport extends BaseInfoEntity {
@NotBlank
@ApiModelProperty("内容")
private String content;
/**
* ID
*/
@ApiModelProperty("创建ID")
@TableField(fill = FieldFill.INSERT)
private Long createId;
/**
* ID
*/
@ApiModelProperty("更新者ID")
@TableField(fill = FieldFill.UPDATE)
private Long updateId;
}

@ -0,0 +1,31 @@
package com.ruoyi.jjh.ent.entity.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author du
* @since 2024/8/2 10:36
*/
@Data
public class JRemindChiefAllRequest {
/**
*
*/
@ApiModelProperty("智能提醒内容")
private String content;
/**
* id
*/
@ApiModelProperty("项目id")
private Long projectId;
/**
* id
*/
@ApiModelProperty("用户id")
private Long userId;
}

@ -30,5 +30,5 @@ public class JTemplateMetricsResponse {
*
*/
@ApiModelProperty("数值")
private Integer count;
private String count;
}

@ -1,8 +1,10 @@
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.ent.entity.HomeRequestSmart;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.entity.request.JRemindChiefAllRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -20,13 +22,13 @@ public interface JSmartDeclarationMapper extends BaseMapper<JSmartDeclaration> {
*
* @return
*/
List<HomeRequestSmart> selectEnterpriseAllList(@Param("userName") String userName);
Page<HomeRequestSmart> selectEnterpriseAllList(Page<HomeRequestSmart> page,@Param("userName") String userName);
/**
*
*
* @return
*/
List<HomeRequestSmart> chiefAll(@Param("userId") Long userId, @Param("projectId") Long projectId);
Page<HomeRequestSmart> chiefAll(Page<HomeRequestSmart> page,@Param("req") JRemindChiefAllRequest req);
}

@ -1,8 +1,10 @@
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.ent.entity.HomeRequestSmart;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.entity.request.JRemindChiefAllRequest;
import java.util.List;
@ -20,7 +22,7 @@ public interface JSmartDeclarationService extends IService<JSmartDeclaration> {
*
* @return
*/
List<HomeRequestSmart> selectEnterpriseAllList(String userName);
Page<HomeRequestSmart> selectEnterpriseAllList(Page<HomeRequestSmart> page,String userName);
/**
@ -28,6 +30,6 @@ public interface JSmartDeclarationService extends IService<JSmartDeclaration> {
*
* @return
*/
List<HomeRequestSmart> chiefAll(Long userId, Long projectId);
Page<HomeRequestSmart> chiefAll(Page<HomeRequestSmart> page, JRemindChiefAllRequest req);
}

@ -1,8 +1,10 @@
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.ent.entity.HomeRequestSmart;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
import com.ruoyi.jjh.ent.entity.request.JRemindChiefAllRequest;
import com.ruoyi.jjh.ent.mapper.JSmartDeclarationMapper;
import com.ruoyi.jjh.ent.service.JSmartDeclarationService;
import org.springframework.stereotype.Service;
@ -24,8 +26,8 @@ public class JSmartDeclarationServiceImpl extends ServiceImpl<JSmartDeclarationM
* @return
*/
@Override
public List<HomeRequestSmart> selectEnterpriseAllList(String userName) {
return baseMapper.selectEnterpriseAllList(userName);
public Page<HomeRequestSmart> selectEnterpriseAllList(Page<HomeRequestSmart> page,String userName) {
return baseMapper.selectEnterpriseAllList(page,userName);
}
/**
@ -34,8 +36,8 @@ public class JSmartDeclarationServiceImpl extends ServiceImpl<JSmartDeclarationM
* @return
*/
@Override
public List<HomeRequestSmart> chiefAll(Long userId, Long projectId) {
return baseMapper.chiefAll(userId, projectId);
public Page<HomeRequestSmart> chiefAll(Page<HomeRequestSmart> page, JRemindChiefAllRequest req) {
return baseMapper.chiefAll(page, req);
}
}

@ -63,7 +63,7 @@ spring:
multi-statement-allow: true
#自己客户端地址
returnUrl: http://39.101.188.84:9999/demo/JinJiHu
#returnUrl: http://192.168.0.110:80
#returnUrl: http://192.168.0.113:80
#定时任务更新企业信息和联系人的开启
isTiming: false

@ -34,7 +34,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: internet
# 文件上传
servlet:
multipart:

@ -5,50 +5,53 @@
<mapper namespace="com.ruoyi.jjh.ent.mapper.JDevelopmentReportMapper">
<select id="getTemplateMetrics" resultType="com.ruoyi.jjh.ent.entity.response.JTemplateMetricsResponse">
SELECT
'服务业企业总数' as dataName,
null as years,
count(*) as count
from bms_enterprise_basic_info
UNION
'服务业企业总数' AS dataName,
'-' AS years,
count(*) AS count
FROM
bms_enterprise_basic_info UNION
SELECT
'规上企业总数' as dataName,
null as years,
sum(type = 1) as count
from bms_enterprise_basic_info
UNION
'规上企业总数' AS dataName,
'-' AS years,
sum( type = 1 ) AS count
FROM
bms_enterprise_basic_info UNION
SELECT
'荣誉总数' as dataName,
project_year as years,
count(*) as count
from j_project
<where>
<if test="years!= null and years != '' ">
'荣誉总数' AS dataName,
#{year} AS years,
count(*) AS count
FROM
j_project
WHERE
project_year = #{year}
</if>
</where>
UNION
SELECT
CASE services_type
WHEN '1' THEN '生产性服务业企业数'
WHEN '2' THEN '生活性服务业企业数'
WHEN '3' THEN '新兴服务业企业数'
ELSE '限上批零住餐企业数'
END as dataName,
years as years,
count(*) as count
from j_services_list
<where>
<if test="years!= null and years != '' ">
years = #{year}
</if>
</where>
GROUP BY
CASE
services_type
UNION
SELECT
WHEN '1' THEN
'生产性服务业企业数'
WHEN '2' THEN
'生活性服务业企业数'
WHEN '3' THEN
'新兴服务业企业数' ELSE '限上批零住餐企业数'
END AS dataName,
#{year} AS years,
IF
(
sum(
IF
( #{year} = years, 1, '-' )) = 0,
'-',
sum(
IF
( #{year} = years, 1, '-' ))) AS count
FROM
j_services_list
GROUP BY
services_type UNION SELECT
a.dict_label AS dataName,
IF(#{year} is null,null,rs.project_year) AS years,
IFNULL( rs.count, 0 ) AS count
#{year} AS years,
IFNULL( rs.count, '-' ) AS count
FROM
sys_dict_data a
LEFT JOIN (
@ -59,20 +62,20 @@
project_big_type = 1
OR project_big_type = 9,
COUNT( DISTINCT credit_code ),
COUNT(*)) AS count,
project_year
COUNT(*)) AS count
FROM
j_project
<where>
<if test="years!= null and years != '' ">
project_year = #{year}
</if>
</where>
WHERE
project_big_type IN ( '1', '4' )
AND project_year = #{year}
GROUP BY
project_big_type
) AS rs ON a.dict_value = rs.project_big_type
WHERE
a.dict_type = 'project_categories'
AND a.dict_value != 11
AND a.dict_value IN (
'1',
'4'
)
</select>
</mapper>

@ -28,7 +28,7 @@
</if>
and a.alert_time &lt; NOW()
</where>
order by a.alert_time desc;
order by a.alert_time desc
</select>
<select id="chiefAll" resultType="com.ruoyi.jjh.ent.entity.HomeRequestSmart">
SELECT
@ -50,14 +50,14 @@
LEFT JOIN j_smart_reminders AS c ON a.smart_reminders_id = c.id
<where>
c.alert_recipients = 2
<if test="projectId != null and projectId != '' ">
and a.project_id = #{projectId}
<if test="req.projectId != null and req.projectId != '' ">
and a.project_id = #{req.projectId}
</if>
<if test="userId != null and userId != '' ">
and a.zw_id = #{userId}
<if test="req.userId != null and req.userId != '' ">
and a.zw_id = #{req.userId}
</if>
and a.alert_time &lt; NOW()
</where>
order by a.alert_time desc;
order by a.alert_time desc
</select>
</mapper>

Loading…
Cancel
Save