Commit 8f91165c authored by liwei's avatar liwei

修改了日常报销的分页问题

parent 877a7ab6
...@@ -13,7 +13,12 @@ import org.springframework.web.bind.annotation.*; ...@@ -13,7 +13,12 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/**
* 差旅Controller
*
* @author ruoyi
* @date 2025-02-28
*/
@RestController @RestController
@RequestMapping("/FyglTravelOnBusiness") @RequestMapping("/FyglTravelOnBusiness")
public class FyglTravelOnBusinessController extends BaseController { public class FyglTravelOnBusinessController extends BaseController {
...@@ -27,7 +32,7 @@ public class FyglTravelOnBusinessController extends BaseController { ...@@ -27,7 +32,7 @@ public class FyglTravelOnBusinessController extends BaseController {
startPage(); startPage();
return getDataTable(travelOnBusinessService.getFyglTravelOnBusinessList(fyglProjectCostDTO)); return getDataTable(travelOnBusinessService.getFyglTravelOnBusinessList(fyglProjectCostDTO));
} }
/** /**
* 获取差旅报销详细信息 * 获取差旅报销详细信息
*/ */
...@@ -36,7 +41,7 @@ public class FyglTravelOnBusinessController extends BaseController { ...@@ -36,7 +41,7 @@ public class FyglTravelOnBusinessController extends BaseController {
{ {
return success(travelOnBusinessService.selectFyglTravelOnBusinessListById(id)); return success(travelOnBusinessService.selectFyglTravelOnBusinessListById(id));
} }
//导出列表 //导出列表
@PostMapping("/getList/export") @PostMapping("/getList/export")
public void export(HttpServletResponse response, Long [] ids) public void export(HttpServletResponse response, Long [] ids)
...@@ -45,21 +50,21 @@ public class FyglTravelOnBusinessController extends BaseController { ...@@ -45,21 +50,21 @@ public class FyglTravelOnBusinessController extends BaseController {
ExcelUtil<FyglTravelOnBusinessDTO> util = new ExcelUtil<FyglTravelOnBusinessDTO>(FyglTravelOnBusinessDTO.class); ExcelUtil<FyglTravelOnBusinessDTO> util = new ExcelUtil<FyglTravelOnBusinessDTO>(FyglTravelOnBusinessDTO.class);
util.exportExcel(response, travelOnBusinessByIds, "差旅报销数据"); util.exportExcel(response, travelOnBusinessByIds, "差旅报销数据");
} }
//新增差旅报销 //新增差旅报销
@PostMapping("/getList/insert") @PostMapping("/getList/insert")
public AjaxResult insertFyglTravelOnBusiness(@RequestBody FyglTravelOnBusinessDTO fyglTravelOnBusinessDTO) public AjaxResult insertFyglTravelOnBusiness(@RequestBody FyglTravelOnBusinessDTO fyglTravelOnBusinessDTO)
{ {
return AjaxResult.success(travelOnBusinessService.insertFyglTravelOnBusiness(fyglTravelOnBusinessDTO)); return AjaxResult.success(travelOnBusinessService.insertFyglTravelOnBusiness(fyglTravelOnBusinessDTO));
} }
//修改差旅报销 //修改差旅报销
@PutMapping("/getList/update") @PutMapping("/getList/update")
public AjaxResult updateFyglTravelOnBusiness(@RequestBody FyglTravelOnBusinessDTO fyglTravelOnBusinessDTO) public AjaxResult updateFyglTravelOnBusiness(@RequestBody FyglTravelOnBusinessDTO fyglTravelOnBusinessDTO)
{ {
return AjaxResult.success(travelOnBusinessService.updateFyglTravelOnBusiness(fyglTravelOnBusinessDTO)); return AjaxResult.success(travelOnBusinessService.updateFyglTravelOnBusiness(fyglTravelOnBusinessDTO));
} }
//删除差旅报销 //删除差旅报销
@DeleteMapping("/getList/{id}") @DeleteMapping("/getList/{id}")
public AjaxResult deleteFyglTravelOnBusinessById(@PathVariable Long id) public AjaxResult deleteFyglTravelOnBusinessById(@PathVariable Long id)
......
...@@ -26,6 +26,13 @@ public class FyglDailyReimbursementDTO { ...@@ -26,6 +26,13 @@ public class FyglDailyReimbursementDTO {
//总数量 //总数量
private Integer totalMoney; private Integer totalMoney;
//项目的每个月的报销数组 //项目的每个月的报销数组
private List<FyglDailyReimbursementTableItemDTO> tableItemList; private List<FyglDailyReimbursementTableItemDTO> tableItemList;
// 页码
private Integer pageNum;
// 每页条数
private Integer pageSize;
// 总条数
private Integer total;
} }
...@@ -4,6 +4,9 @@ import com.ruoyi.common.core.domain.BaseEntity; ...@@ -4,6 +4,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Map;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
public class FyglDailyReimbursementVo extends BaseEntity { public class FyglDailyReimbursementVo extends BaseEntity {
...@@ -52,6 +55,6 @@ public class FyglDailyReimbursementVo extends BaseEntity { ...@@ -52,6 +55,6 @@ public class FyglDailyReimbursementVo extends BaseEntity {
//审批状态0保存1未通过2审批中3已通过 //审批状态0保存1未通过2审批中3已通过
private Integer reimbursmentApproveStatus; private Integer reimbursmentApproveStatus;
// 分页参数
private String projectPageParams;
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
...@@ -15,15 +20,16 @@ import org.springframework.stereotype.Service; ...@@ -15,15 +20,16 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 日常报销Service业务层处理 * 日常报销Service业务层处理
* *
* @author ruoyi * @author ruoyi
* @date 2025-02-28 * @date 2025-02-28
*/ */
@Service @Service
public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursementService public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursementService
{ {
@Autowired @Autowired
private FyglDailyReimbursementMapper fyglDailyReimbursementMapper; private FyglDailyReimbursementMapper fyglDailyReimbursementMapper;
...@@ -36,7 +42,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -36,7 +42,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
/** /**
* 查询日常报销 * 查询日常报销
* *
* @param id 日常报销主键 * @param id 日常报销主键
* @return 日常报销 * @return 日常报销
*/ */
...@@ -87,7 +93,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -87,7 +93,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
/** /**
* 新增日常报销 * 新增日常报销
* *
* @param fyglDailyReimbursement 日常报销 * @param fyglDailyReimbursement 日常报销
* @return 结果 * @return 结果
*/ */
...@@ -128,7 +134,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -128,7 +134,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
/** /**
* 修改日常报销 * 修改日常报销
* *
* @param fyglDailyReimbursement 日常报销 * @param fyglDailyReimbursement 日常报销
* @return 结果 * @return 结果
*/ */
...@@ -157,7 +163,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -157,7 +163,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
/** /**
* 批量删除日常报销 * 批量删除日常报销
* *
* @param ids 需要删除的日常报销主键 * @param ids 需要删除的日常报销主键
* @return 结果 * @return 结果
*/ */
...@@ -169,7 +175,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -169,7 +175,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
/** /**
* 删除日常报销信息 * 删除日常报销信息
* *
* @param id 日常报销主键 * @param id 日常报销主键
* @return 结果 * @return 结果
*/ */
...@@ -187,12 +193,38 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -187,12 +193,38 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
//获取每个人关联的项目 //获取每个人关联的项目
fyglDailyReimbursementVO.setCurrentUserId(SecurityUtils.getUserId()); fyglDailyReimbursementVO.setCurrentUserId(SecurityUtils.getUserId());
List<FyglDailyReimbursementDTO> projectListByUserId = fyglDailyReimbursementMapper.getProjectListByUserId(fyglDailyReimbursementVO); List<FyglDailyReimbursementDTO> projectListByUserId = fyglDailyReimbursementMapper.getProjectListByUserId(fyglDailyReimbursementVO);
// 将projectPageParams转成map集合
for(FyglDailyReimbursementDTO item:projectListByUserId){ String projectPageParams = fyglDailyReimbursementVO.getProjectPageParams();
fyglDailyReimbursementVO.setCardItemProjectId(item.getProjectId()); if (projectPageParams != null){
List<FyglDailyReimbursementTableItemDTO> itemList = fyglDailyReimbursementMapper.getItemList(fyglDailyReimbursementVO); Map<String, Object> projectPageMap = JSON.parseObject(projectPageParams);
item.setTableItemList(itemList); for(FyglDailyReimbursementDTO item:projectListByUserId){
Object obj = projectPageMap.get(item.getProjectId());
// 将obj转成map
Map<String, Integer> map = (Map<String, Integer>) obj;
Integer pageNum = map.get("pageNum");
Integer pageSize = map.get("pageSize");
PageHelper.startPage(pageNum,pageSize);
fyglDailyReimbursementVO.setCardItemProjectId(item.getProjectId());
List<FyglDailyReimbursementTableItemDTO> itemList = fyglDailyReimbursementMapper.getItemList(fyglDailyReimbursementVO);
PageInfo<FyglDailyReimbursementTableItemDTO> tbUserPageInfo = new PageInfo<>(itemList);
item.setTableItemList(tbUserPageInfo.getList());
item.setPageNum(pageNum);
item.setPageSize(pageSize);
item.setTotal(Math.toIntExact(tbUserPageInfo.getTotal()));
}
} else {
// 初始化执行 默认每页3条数据
PageHelper.startPage(1,3);
for(FyglDailyReimbursementDTO item:projectListByUserId){
// 将obj转成map
fyglDailyReimbursementVO.setCardItemProjectId(item.getProjectId());
List<FyglDailyReimbursementTableItemDTO> itemList = fyglDailyReimbursementMapper.getItemList(fyglDailyReimbursementVO);
PageInfo<FyglDailyReimbursementTableItemDTO> tbUserPageInfo = new PageInfo<>(itemList);
item.setTableItemList(tbUserPageInfo.getList());
item.setPageNum(1);
item.setPageSize(3);
item.setTotal(Math.toIntExact(tbUserPageInfo.getTotal()));
}
} }
System.out.println("参数 = " + fyglDailyReimbursementVO); System.out.println("参数 = " + fyglDailyReimbursementVO);
return projectListByUserId; return projectListByUserId;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mapper.FyglDailyReimbursementMapper"> <mapper namespace="com.ruoyi.mapper.FyglDailyReimbursementMapper">
<resultMap type="com.ruoyi.domain.FyglDailyReimbursement" id="FyglDailyReimbursementResult"> <resultMap type="com.ruoyi.domain.FyglDailyReimbursement" id="FyglDailyReimbursementResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
...@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
GROUP BY fd.id GROUP BY fd.id
</select> </select>
<select id="selectFyglDailyReimbursementById" parameterType="Long" resultMap="FyglDailyReimbursementDetailDTOResult"> <select id="selectFyglDailyReimbursementById" parameterType="Long" resultMap="FyglDailyReimbursementDetailDTOResult">
SELECT SELECT
r1.id, r1.id,
...@@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY GROUP BY
r.id, r.id,
r.registration_time, r.registration_time,
r.`status`; r.`status`
</select> </select>
<select id="selectFyglDailyReimbursementItemListById" <select id="selectFyglDailyReimbursementItemListById"
resultMap="FyglDailyReimbursementDetailItemResult"> resultMap="FyglDailyReimbursementDetailItemResult">
...@@ -283,4 +283,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -283,4 +283,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="delDataByRid"> <delete id="delDataByRid">
delete from fygl_daily_reimbursement_relevancy r where r.rid = #{rid} delete from fygl_daily_reimbursement_relevancy r where r.rid = #{rid}
</delete> </delete>
</mapper> </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