初验调整

This commit is contained in:
pengjie 2025-02-25 18:56:33 +08:00
parent d48aa923bf
commit da26688e89
7 changed files with 52 additions and 8 deletions

View File

@ -66,9 +66,6 @@ public class JzInvestController {
@Autowired
private IProjectService projectService;
@Autowired
private ICompanyService companyService;
/**
* 分页列表查询
*
@ -84,7 +81,7 @@ public class JzInvestController {
public Result<IPage<JzInvest>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<JzInvest> queryWrapper = QueryGenerator.initPageQueryWrapper(JzInvest.class, map);
Page<JzInvest> page = PageUtil.getPage(map);
IPage<JzInvest> pageList = jzInvestService.page(page, queryWrapper);
IPage<JzInvest> pageList = jzInvestService.pageList(page, queryWrapper);
return Result.success(pageList);
}
@ -239,7 +236,7 @@ public class JzInvestController {
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<JzInvest> pageList = jzInvestService.list(queryWrapper);
List<JzInvest> pageList = jzInvestService.pageList(new Page(-1, -1), queryWrapper).getRecords();
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "项目投资列表");
mv.addObject(NormalExcelConstants.CLASS, JzInvest.class);

View File

@ -71,13 +71,13 @@ public class JzInvest implements Serializable {
*/
@Excel(name = "", width = 15)
@ApiModelProperty(value = "")
private String year;
private Integer year;
/**
*
*/
@Excel(name = "", width = 15)
@ApiModelProperty(value = "")
private String month;
private Integer month;
/**
* 实际完成投资
*/

View File

@ -2,10 +2,15 @@ package com.zhgd.xmgl.modules.jz.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.jz.entity.JzInvest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.checkerframework.checker.signedness.qual.Constant;
/**
* @Description: 项目投资
@ -16,4 +21,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper
public interface JzInvestMapper extends BaseMapper<JzInvest> {
IPage<JzInvest> pageList(Page page, @Param(Constants.WRAPPER) Wrapper<JzInvest> wrapper);
}

View File

@ -2,4 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.jz.mapper.JzInvestMapper">
<select id="pageList" resultType="com.zhgd.xmgl.modules.jz.entity.JzInvest">
SELECT j.id,j.project_sn, p.project_name, e.construction_unit build_unit, j.plan_amount, e.investment_price total_amount,
j.`year`, j.`month`,j.amount, e.real_period_start_time start_time, e.engineering_end_time plan_complete
FROM jz_invest j
LEFT JOIN project p ON j.project_sn = p.project_sn
LEFT JOIN project_extend e on p.project_sn = e.project_sn
</select>
</mapper>

View File

@ -1,5 +1,8 @@
package com.zhgd.xmgl.modules.jz.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.jz.entity.JzInvest;
import com.baomidou.mybatisplus.extension.service.IService;
@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IJzInvestService extends IService<JzInvest> {
IPage<JzInvest> pageList(Page page, Wrapper<JzInvest> wrapper);
}

View File

@ -1,5 +1,9 @@
package com.zhgd.xmgl.modules.jz.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.util.DateUtil;
import com.zhgd.xmgl.modules.jz.entity.JzInvest;
import com.zhgd.xmgl.modules.jz.mapper.JzInvestMapper;
import com.zhgd.xmgl.modules.jz.service.IJzInvestService;
@ -7,6 +11,10 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description: 项目投资
* @author pengj
@ -16,4 +24,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class JzInvestServiceImpl extends ServiceImpl<JzInvestMapper, JzInvest> implements IJzInvestService {
@Override
public IPage<JzInvest> pageList(Page page, Wrapper<JzInvest> wrapper) {
IPage<JzInvest> jzInvestIPage = baseMapper.pageList(page, wrapper);
List<JzInvest> allList = baseMapper.pageList(new Page(-1, -1), null).getRecords();
for (JzInvest record : jzInvestIPage.getRecords()) {
List<JzInvest> yearAmount = allList.stream().filter(a -> a.getProjectSn().equals(record.getProjectSn()) &&
a.getYear().equals(record.getYear())
&& a.getMonth() <= record.getMonth()).collect(Collectors.toList());
record.setYearAmount(yearAmount.size() > 0 ? yearAmount.stream().map(a -> new BigDecimal(a.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toString() : "0");
Integer year = record.getYear() - 1;
List<JzInvest> lastYearAmount = allList.stream().filter(a -> a.getProjectSn().equals(record.getProjectSn()) &&
a.getYear().equals(year)
&& a.getMonth() <= record.getMonth()).collect(Collectors.toList());
record.setLastYearAmount(lastYearAmount.size() > 0 ? yearAmount.stream().map(a -> new BigDecimal(a.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toString() : "0");
List<JzInvest> totalYearAmount = allList.stream().filter(a -> a.getProjectSn().equals(record.getProjectSn())).collect(Collectors.toList());
record.setTotalYearAmount(totalYearAmount.size() > 0 ? totalYearAmount.stream().map(a -> new BigDecimal(a.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toString() : "0");
}
return jzInvestIPage;
}
}

View File

@ -126,7 +126,10 @@
<include refid="com.zhgd.xmgl.modules.project.mapper.ProjectEnterpriseMapper.dicMap">
</include>
) t1 on t1.data = b.cbs_project_type
WHERE b.project_sn = #{param.projectSn}
WHERE 1 = 1
<if test="param.projectSn != null and param.projectSn != ''">
and b.project_sn = #{param.projectSn}
</if>
<if test="param.cbsProjectType != null and param.cbsProjectType != ''">
and b.cbs_project_type = #{param.cbsProjectType}
</if>