Browse Source

初版

master
sunyuchao 3 years ago
parent
commit
7eaae3423b
  1. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java
  2. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java
  3. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java
  4. 54
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/HistoryScoreDetailExcel.java
  5. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java
  6. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml
  8. 45
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml

18
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java

@ -3,7 +3,6 @@ package com.epmet.dto.indexcollect.result;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -14,8 +13,11 @@ public class HistoryScoreDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Add extends CustomerClientShowGroup {}
public interface Edit extends CustomerClientShowGroup {}
public interface Add extends CustomerClientShowGroup {
}
public interface Edit extends CustomerClientShowGroup {
}
/**
* id
@ -54,6 +56,16 @@ public class HistoryScoreDetailResultDTO implements Serializable {
@Data
public static class Detail implements Serializable {
/**
* id
*/
private String id;
/**
* screen_py_history_score.id
*/
private String historyScoreId;
/**
* 街道组织Id
*/

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java

@ -1,10 +1,23 @@
package com.epmet.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.poi.excel.handler.CustomerTitleHandler;
import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO;
@ -12,14 +25,23 @@ import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.excel.HistoryScoreDetailExcel;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.io.PrintWriter;
import java.util.Date;
import java.util.List;
/**
* 平阴历史得分主表
*
@ -32,6 +54,8 @@ public class ScreenPyHistoryScoreController {
@Autowired
private ScreenPyHistoryScoreService screenPyHistoryScoreService;
@Autowired
private ScreenPyHistoryScoreDetailService screenPyHistoryScoreDetailService;
@RequestMapping("list")
@ -76,25 +100,32 @@ public class ScreenPyHistoryScoreController {
return new Result<HistoryScoreDetailResultDTO>().ok(screenPyHistoryScoreService.detail(formDTO));
}
/*@PostMapping("export")
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO, HttpServletResponse response) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setIsPage(false);
ExcelWriter excelWriter = null;
formDTO.setPageNo(NumConstant.ONE);
formDTO.setPageSize(NumConstant.TEN_THOUSAND);
formDTO.setPageSize(NumConstant.FIVE_HUNDRED);
try {
String fileName = "迁入管理" + DateUtils.format(new Date()) + ".xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcMoveInRecordExcel.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build();
PageData<IcMoveInListResultDTO> data = null;
List<IcMoveInRecordExcel> list = null;
String fileName = "历史得分" + DateUtils.format(new Date()) + ".xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), HistoryScoreDetailExcel.class).build();
//String title= "11月-12月";
PageData<HistoryScoreDetailResultDTO> data = null;
List<HistoryScoreDetailExcel> list = null;
do {
data = screenPyHistoryScoreService.list(formDTO);
list = ConvertUtils.sourceToTarget(data.getList(), IcMoveInRecordExcel.class);
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
data = screenPyHistoryScoreDetailService.selectScoreDetailList(formDTO);
for (HistoryScoreDetailResultDTO d : data.getList()){
list = ConvertUtils.sourceToTarget(d.getDetailList(), HistoryScoreDetailExcel.class);
//一跳一条记录一个sheet页
WriteSheet writeSheet = EasyExcel.writerSheet(d.getTitle()).registerWriteHandler(new FreezeAndFilter()).build();
//WriteSheet writeSheet = EasyExcel.writerSheet(d.getTitle()).registerWriteHandler(new CustomerTitleHandler(title)).build();
excelWriter.write(list, writeSheet);
}
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize());
} catch (EpmetException e) {
response.reset();
@ -111,7 +142,7 @@ public class ScreenPyHistoryScoreController {
excelWriter.finish();
}
}
}*/
}
@RequestMapping("computescore")
public Result<HistoryScoreComputeResultDTO> computeScore(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreComputeFormDTO formDTO) {

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java

@ -17,10 +17,14 @@ package com.epmet.dao.evaluationindex.indexcoll; /**
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 平阴历史得分明细表
*
@ -31,4 +35,6 @@ public interface ScreenPyHistoryScoreDetailDao extends BaseDao<ScreenPyHistorySc
void delByHistoryScoreId(@Param("historyScoreId") String historyScoreId, @Param("userId") String userId);
List<HistoryScoreDetailResultDTO> selectScoreDetailList(HistoryScoreListFormDTO formDTO);
}

54
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/HistoryScoreDetailExcel.java

@ -0,0 +1,54 @@
package com.epmet.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 政法能力历史得分-导出
*
* @author generator generator@elink-cn.com
*/
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44)
@Data
public class HistoryScoreDetailExcel implements Serializable {
private static final long serialVersionUID = -12110233388005838L;
@ExcelProperty(value = "下级单位")
@ColumnWidth(15)
private String agencyName;
@ExcelProperty(value = "网格活跃度")
@ColumnWidth(15)
private BigDecimal wghyd;
@ExcelProperty(value = "事件赋值得分")
@ColumnWidth(20)
private BigDecimal sjff;
@ExcelProperty(value = "雪亮工程")
@ColumnWidth(15)
private BigDecimal xlgc;
@ExcelProperty(value = "日核周调")
@ColumnWidth(15)
private BigDecimal rhzt;
@ExcelProperty(value = "亮点工作")
@ColumnWidth(15)
private BigDecimal ldgz;
@ExcelProperty(value = "其他工作")
@ColumnWidth(15)
private BigDecimal qtgz;
@ExcelProperty(value = "能力得分")
@ColumnWidth(15)
private BigDecimal nldf;
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java

@ -1,5 +1,11 @@
package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import java.util.List;
/**
* 平阴历史得分明细表
*
@ -7,4 +13,6 @@ package com.epmet.service.evaluationindex.indexcoll;
*/
public interface ScreenPyHistoryScoreDetailService {
PageData<HistoryScoreDetailResultDTO> selectScoreDetailList(HistoryScoreListFormDTO formDTO);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java

@ -2,14 +2,22 @@ package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 平阴历史得分明细表
*
@ -17,11 +25,16 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX_READ)
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPyHistoryScoreDetailServiceImpl extends BaseServiceImpl<ScreenPyHistoryScoreDetailDao, ScreenPyHistoryScoreDetailEntity> implements ScreenPyHistoryScoreDetailService {
@Autowired
private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao;
@Override
public PageData<HistoryScoreDetailResultDTO> selectScoreDetailList(HistoryScoreListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<HistoryScoreDetailResultDTO> list = baseDao.selectScoreDetailList(formDTO);
PageInfo<HistoryScoreDetailResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml

@ -21,10 +21,10 @@
AND a.title LIKE concat('%', #{title}, '%')
</if>
<if test="startTime != null and startTime.trim() != ''">
AND a.start_time >= #{startTime}
AND DATE_FORMAT(a.start_time,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime != null and endTime.trim() != ''">
<![CDATA[AND a.end_time <= #{endTime}]]>
<![CDATA[AND DATE_FORMAT(a.end_time,'%Y-%m-%d') <= #{endTime}]]>
</if>
ORDER BY a.start_time DESC
</select>

45
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml

@ -15,4 +15,49 @@
AND del_flag = '0'
</update>
<resultMap id="selectCommunitySelfOrganizationListMap" type="com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO">
<result property="id" column="id"/>
<result property="title" column="title"/>
<collection property="detailList" ofType="com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO$Detail"
column="id" select="selectPerson"></collection>
</resultMap>
<select id="selectScoreDetailList" resultMap="selectCommunitySelfOrganizationListMap" parameterType="com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO">
SELECT
id AS id,
title AS title
FROM screen_py_history_score
WHERE
del_flag = 0
<if test="title != null and title != ''">
AND title LIKE concat('%', #{title}, '%')
</if>
<if test="startTime != null and startTime.trim() != ''">
AND DATE_FORMAT(start_time,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime != null and endTime.trim() != ''">
<![CDATA[AND DATE_FORMAT(end_time,'%Y-%m-%d') <= #{endTime}]]>
</if>
ORDER BY start_time DESC
</select>
<select id="selectPerson" resultType="com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO$Detail">
SELECT
id,
history_score_id,
agency_id,
agency_name,
wghyd,
sjff,
xlgc,
rhzt,
ldgz,
qtgz,
nldf
FROM
screen_py_history_score_detail
WHERE
del_flag = '0'
AND history_score_id = #{id}
ORDER BY nldf DESC
</select>
</mapper>

Loading…
Cancel
Save