Merge remote-tracking branch 'origin/develop_master' into develop_master

This commit is contained in:
yuezhihang
2021-12-10 13:51:31 +08:00
8 changed files with 164 additions and 40 deletions
@@ -74,6 +74,10 @@ public class WebMvcConfig implements WebMvcConfigurer {
//企业标准导出
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/exportSarBussionessStand");
//预警导出
addInterceptor.excludePathPatterns("/api/sys/EarlyWarning/exportWarning");
//OCR回调存储文件
addInterceptor.excludePathPatterns("/api/ocr/OCRRestful/OcrHandleResult");
@@ -94,7 +98,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
// 添加自定义拦截器,并拦截对应 url
addInterceptor.addPathPatterns("/**");
// // 添加自定义拦截器,并拦截对应 url
// addInterceptor.addPathPatterns("/**");
}
}
@@ -131,9 +131,11 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
@GetMapping("/exprotWarning")
@GetMapping("/exportWarning")
@ApiOperation("导出预警")
public void exportStandardsInfoExcel(WarningExcelVO excelVO, HttpServletResponse response) throws Exception {
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
try {
response.setContentType("application/vnd.ms-excel");
@@ -145,11 +147,12 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
String fileName = URLEncoder.encode(excelVO.getExportName(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
// 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), SarStandIssueControlProduct.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
EasyExcel.write(response.getOutputStream(), StandWarningEO.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(exportExcel);
} catch (Exception e) {
System.out.println(e);
@@ -11,6 +11,9 @@ import java.util.List;
public interface EarlyWarningEODao extends BaseMapper<EarlyWarningEO> {
IPage<StandWarningEO> selectWarningPage(IPage<StandWarningEO> page, @Param("waringEO") StandWarningEO warningEO,@Param("idList") List<String> ids);
IPage<StandWarningEO> selectWarningPage(IPage<StandWarningEO> page, @Param("waringEO") StandWarningEO warningEO);
List<StandWarningEO> exportWarning(@Param("idList") List<String> ids);
}
@@ -37,6 +37,11 @@ public class EarlyWarningEO extends BaseEntity {
@TableField("STAND_ID")
private String standId;
@ExcelIgnore
@ApiModelProperty("分解单条款id")
@TableField("ITEM_ID")
private String itemId;
@ExcelIgnore
@ApiModelProperty("标准类别")
@TableField(exist = false)
@@ -14,6 +14,9 @@ public class WarningDate {
@TableField("law_id")
private String lawId;
@TableField("itemId")
private String itemId;
@TableField("SSRQ")
private String SSRQ;
@@ -112,7 +112,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
@Override
public IPage<StandWarningEO> getStandWarning(StandWarningEO queryPage) {
IPage<StandWarningEO> iPage = new Page<>(queryPage.getPage(),queryPage.getPageSize());
return earlyWarningEODao.selectWarningPage(iPage,queryPage,null);
return earlyWarningEODao.selectWarningPage(iPage,queryPage);
}
/**
@@ -121,8 +121,10 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
*/
@Override
public List<StandWarningEO> getExportExcel(WarningExcelVO excelVO){
IPage<StandWarningEO> standWarningEOIPage = earlyWarningEODao.selectWarningPage(null, null, excelVO.getIds());
return standWarningEOIPage.getRecords();
List<StandWarningEO> standWarningEOList = earlyWarningEODao.exportWarning( excelVO.getIds());
// IPage<StandWarningEO> standWarningEOIPage = earlyWarningEODao.selectWarningPage(null, null, null);
return standWarningEOList;
}
@@ -38,16 +38,7 @@
<sql id="stand_where">
<if test="idList != null and idList.size() > 0">
warning.ID
IN
<foreach collection="idList" item="id" open="and (" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
<if test="waringEO.standCode != null and waringEO.standCode != ''">
AND trim(replace(CONCAT(
@@ -83,6 +74,92 @@
)
</if>
</sql>
<select id="exportWarning" resultType="com.adc.da.slrs.sarStandWarning.entity.StandWarningEO">
SELECT WARNING_RESULT.* FROM
(
SELECT
<include refid="stand_column"/>
,
attr.CLLX AS
APPLY_TYPE ,
attr
.ZRGCS AS DUTY_ENGINEER ,
NULL AS ITEMS_ID ,
NULL AS ITEMS_NUM , NULL AS ITEMS_NAME ,
NULL AS POLICY_ID ,
NULL AS POLICY_NAME ,
MARK ,
POWER,
attr.XCXSSRQ AS XCXSSRQ ,
attr.ZCCSSRQ AS ZCCSSRQ
FROM sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo on sarInfo.id=warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr on attr.STAND_ID=warning.STAND_ID
<where>
POWER = '1'
AND (MARK = 'stand')
<if test="idList != null and idList.size() > 0">
AND
warning.ID
IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
</where>
UNION ALL
SELECT
<include refid="stand_column"/> ,
items.APPLY_ARCTIC AS APPLY_TYPE ,
items.DUTY_ENGINEER AS DUTY_ENGINEER ,
items.ID AS ITEMS_ID ,
items.ITEMS_NUM ,
items.ITEMS_NAME ,
NULL AS POLICY_ID ,
NULL AS POLICY_NAME ,
MARK ,
POWER,
items.XCXSSRQ AS XCXSSRQ ,
items.ZCCSSRQ AS ZCCSSRQ
FROM
sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo ON sarInfo.id = warning.STAND_ID
LEFT JOIN sar_stand_items AS items ON items.STAND_ID = warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr ON attr.STAND_ID = warning.STAND_ID
<where>
POWER = '1'
AND (MARK = 'item')
<if test="idList != null and idList.size() > 0">
AND
warning.ID
IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
</where>
)
WARNING_RESULT
LEFT JOIN
(
SELECT law_id,MIN(SSRQ) SSRQ_MIN FROM warning_date
GROUP BY warning_date.law_id
) warning_date
ON warning_date.law_id = WARNING_RESULT.STAND_ID
ORDER BY warning_date.SSRQ_MIN
</select>
<select id="selectWarningPage" resultMap="resultMap">
SELECT WARNING_RESULT.* FROM
@@ -51,15 +51,23 @@
<select id="getWarningId" resultType="com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO">
SELECT
law_id as STAND_ID,
'-1' AS itemsId,
'stand' AS mark,
'1' as power
law_id AS standId,
item_id AS itemId,
CASE
WHEN item_id = '-1' THEN
'stand'
WHEN
item_id IS NULL THEN
'stand'
ELSE
'item'
END AS mark,
'1' as power
FROM
warning_date AS warning
WHERE
DATE_FORMAT(warning.SSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
UNION
<!-- UNION
SELECT
STAND_ID,
ID AS itemsId,
@@ -70,7 +78,7 @@
WHERE
DATE_FORMAT(item.XCXSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
OR
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d') -->
</select>
@@ -79,25 +87,44 @@
SELECT lawId,timeName,DATE_FORMAT(SSRQ,'%Y-%m-%d') as SSRQ FROM
(
select attr.STAND_ID as lawId,'SSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
select attr.STAND_ID as lawId,'-1' as itemId,'SSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
UNION ALL
UNION ALL
select attr.STAND_ID as lawId,'XCXSSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.XCXSSRQ) - length(replace(attr.SSRQ,',',''))+1)
UNION ALL
select attr.STAND_ID as lawId,'ZCCSSRQ' as timeName,
substring_index(substring_index(attr.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
select attr.STAND_ID as lawId,'-1' as itemId,'XCXSSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.XCXSSRQ) - length(replace(attr.XCXSSRQ,',',''))+1)
UNION ALL
select attr.STAND_ID as lawId,'-1' as itemId,'ZCCSSRQ' as timeName,
substring_index(substring_index(attr.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.SSRQ) - length(replace(attr.ZCCSSRQ,',',''))+1)
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
substring_index(substring_index(item.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_items item
join mysql.help_topic b
on b.help_topic_id &gt; (length(item.ZCCSSRQ) - length(replace(item.ZCCSSRQ,',',''))+1)
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
substring_index(substring_index(item.XCXSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_items item
join mysql.help_topic b
on b.help_topic_id &gt; (length(item.XCXSSRQ) - length(replace(item.XCXSSRQ,',',''))+1)
) as T
WHERE