Commit 804f7b2d by hzc

增加筛选运行日期的条件(异步运算日志

parent a50d2545
......@@ -74,9 +74,9 @@ public class DriveIndCalResultCtrl {
@ApiOperation(value = "根据对标单元id分页获取日志详情", notes = "根据对标单元id分页获取日志详情")
@PostMapping(value = "/findPageByCompareId")
public Map<String,Object> findPageByCompareId(@RequestParam String compareId,
public Map<String,Object> findPageByCompareId(@RequestParam String compareId,@RequestParam(value = "date",required = false) Integer date,
@RequestParam(defaultValue = "0") int page,@RequestParam(defaultValue = "10") int rows){
return compUnitCalLogService.findPageByCompareId(compareId, page, rows);
return compUnitCalLogService.findPageByCompareId(compareId,date, page, rows);
}
@ApiOperation(value = "根据对标单元id和年份获取对标指标结果", notes = "根据对标单元id和年份获取对标指标结果")
......
......@@ -168,13 +168,16 @@ public class ShortboardUnitCtrl {
@ApiOperation(value = "分页获取短板单元日志", notes = "分页获取短板单元日志")
@PostMapping(value = "/findComparedLogPage")
public Page<ShortComparedLog> findComparedLogPage(@ApiParam("短板运算单元id") @RequestParam(value = "shortUnitId") Integer shortUnitId,
@ApiParam("运算的时间date") @RequestParam(value = "date",required = false) Integer date,
@ApiParam("页码,从1开始") @RequestParam("pageNo") int page,
@ApiParam("每页条数") @RequestParam("pageSize") int pageSize){
PageRequest request = PageRequest.of(page-1,pageSize);
Map<String,Object> params = new HashMap<>();
params.put("page",request.getOffset());
params.put("pageSize",pageSize);
params.put("date",date);
params.put("shortUnitId",shortUnitId);
long count =shortComparedLogService.selectComparedLogCountByParams(params);
List<ShortComparedLog> shortComparedLogs = new ArrayList<>();
if(count>0){
......
......@@ -36,12 +36,6 @@ public class ShortComparedLog implements Serializable {
@Column(name = "short_unit_id" )
private Integer shortUnitId;
/**
* 短板单元name
*/
@ApiModelProperty("短板单元name")
@Column(name = "short_unit_name" )
private String shortUnitName;
/**
* 日记信息
......@@ -72,6 +66,13 @@ public class ShortComparedLog implements Serializable {
private String creatUser;
/**
* 创造者
*/
@ApiModelProperty("创造者")
@Column(name = "date" )
private Integer date;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
......
......@@ -14,5 +14,5 @@ import tk.mybatis.mapper.common.BaseMapper;
public interface CompareUnitCalLogMapper extends BaseMapper<CompareUnitCalLog>{
public List<CompareUnitCalLog> findByCompareId(Map<String,Object> param);
public int countByCompareId(@Param("compareId") String compareId);
public int countByCompareId(Map<String,Object> param);
}
......@@ -33,14 +33,16 @@ public class CompareUnitCalLogService {
}
//分页根据对标单元id获取对应运行日志
public Map<String,Object> findPageByCompareId(String compareId,int page,int rows){
public Map<String,Object> findPageByCompareId(String compareId,Integer date,int page,int rows){
Map<String,Object> paramMap = new HashMap<>();
Map<String,Object> resultMap = new HashMap<>();
paramMap.put("compareId", compareId);
paramMap.put("date",date);
//计算总数
int count = compareUnitCalLogMapper.countByCompareId(compareId);
int count = compareUnitCalLogMapper.countByCompareId(paramMap);
//计算start
int start = page*rows;
paramMap.put("compareId", compareId);
paramMap.put("start", start);
paramMap.put("end", rows);
List<CompareUnitCalLog> datas = compareUnitCalLogMapper.findByCompareId(paramMap);
......
......@@ -103,6 +103,7 @@ public class ShortboardUnitService {
shortComparedLog.setCreatTime(new Date());
shortComparedLog.setShortUnitId(shortBoardWarnData.getId());
shortComparedLog.setStatus(2);
shortComparedLog.setDate(shortBoardWarnData.getDate());
shortComparedLogMapper.insert(shortComparedLog);
LogManager.logInfo(Constants.LOG_INDICATOR_SHORTBOARD_UNIT_API,"短板运算id={},开始运算StartTime={}",shortBoardWarnData.getId(),new Date());
......
......@@ -3,15 +3,21 @@
<mapper namespace="com.keymobile.indicators.model.mapper.indmapper.CompareUnitCalLogMapper">
<select id="findByCompareId" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog" >
select *
from compare_unit_cal_log
where compare_id=#{compareId}
from compare_unit_cal_log as cucl
where cucl.compare_id=#{compareId}
<if test="date !=null">
and cucl.date = #{date}
</if>
order by create_time desc
limit #{start},#{end}
</select>
<select id="countByCompareId" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(1)
from compare_unit_cal_log
where compare_id=#{compareId}
from compare_unit_cal_log as cucl
where cucl.compare_id=#{compareId}
<if test="date !=null">
and cucl.date = #{date}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -4,54 +4,28 @@
<select id="findComparedLogPageByParams" resultType="com.keymobile.indicators.model.entity.shortboard.ShortComparedLog">
select *
from short_compared_log
from short_compared_log as scl
<include refid="findWhereSql"></include>
order by creat_time desc
order by scl.creat_time desc
limit #{page}, #{pageSize}
</select>
<select id="selectComparedLogCountByParams" resultType="long">
select count(id)
from short_compared_log
from short_compared_log as scl
<include refid="findWhereSql"></include>
</select>
<sql id="findWhereSql">
where 1= 1
<if test="shortUnitId != null">
and short_unit_id = #{shortUnitId}
and scl.short_unit_id = #{shortUnitId}
</if>
<if test="date != null">
and scl.date = #{date}
</if>
</sql>
<update id="deleteByIds">
update affiche_info
set
state = 0,updater=#{updater}
where id in (
<foreach collection="ids" item="item" separator=",">
#{item}
</foreach>
)
</update>
<insert id="insertAfficheInfoToAllUser">
insert into affiche_user
(affche_id,user_id)
values
<foreach collection="userIds" item="user" separator=",">
(
#{affcheId}, #{user}
)
</foreach>
</insert>
<delete id="deleteAfficheUserByAffcheIds">
delete FROM affiche_user
where affche_id in (
<foreach collection="affcheIds" item="item" separator=",">
#{item}
</foreach>
)
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment