| | |
| | | package cn.gistack.sm.sjztmd.service.impl; |
| | | |
| | | import cn.gistack.sm.sjztmd.dto.TbProjectDTO; |
| | | import cn.gistack.sm.sjztmd.entity.AttAdBase; |
| | | import cn.gistack.sm.sjztmd.entity.TbProject; |
| | | import cn.gistack.sm.sjztmd.entity.TbProjectSchedule; |
| | | import cn.gistack.sm.sjztmd.excel.TbProjectExcel; |
| | | import cn.gistack.sm.sjztmd.mapper.TbProjectMapper; |
| | | import cn.gistack.sm.sjztmd.service.IAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.ITbProjectScheduleService; |
| | | import cn.gistack.sm.sjztmd.service.ITbProjectService; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsTableProject; |
| | | import cn.gistack.sm.sjztmd.util.CalculateUtils; |
| | | import cn.gistack.sm.sjztmd.vo.TbProjectVO; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | public class TbProjectServiceImpl extends ServiceImpl<TbProjectMapper, TbProject> implements ITbProjectService { |
| | | |
| | | private final ITbProjectScheduleService tbProjectScheduleService; |
| | | private final IAttResBaseService attResBaseService; |
| | | |
| | | @Override |
| | | public Object getList(TbProjectVO tbProjectVO, IPage<TbProjectVO> page) { |
| | |
| | | public List<StatisticsTableProject> getStatisticsTable(StatisticsParams statisticsParams) { |
| | | return baseMapper.getStatisticsTable(statisticsParams); |
| | | } |
| | | |
| | | @Override |
| | | public void importUser(List<TbProjectExcel> data, Boolean isCovered) { |
| | | data.forEach(tbProjectExcel -> { |
| | | |
| | | String cityName = tbProjectExcel.getCityName(); |
| | | String countyName = tbProjectExcel.getCountyName(); |
| | | |
| | | AttAdBase attAdBase = attResBaseService.getYwxtResInfo(cityName,countyName); |
| | | |
| | | TbProject params = new TbProject(); |
| | | |
| | | params.setCityCode(attAdBase.getPAdCode()); |
| | | params.setCountyCode(attAdBase.getAdCode()); |
| | | params.setTbYear(tbProjectExcel.getTbYear()); |
| | | |
| | | |
| | | TbProject tbProject = baseMapper.getTbProjectInfo(params); |
| | | |
| | | if (tbProject != null){ |
| | | //有这条数据,更新 |
| | | |
| | | //更新中央资金 |
| | | BigDecimal oldCenterFund = new BigDecimal(tbProject.getCenterFund()); |
| | | BigDecimal newCenterFund = new BigDecimal(tbProjectExcel.getCenterFund()); |
| | | tbProject.setCenterFund(CalculateUtils.add(oldCenterFund,newCenterFund)); |
| | | |
| | | //更新地方资金 |
| | | BigDecimal oldLocalFund = new BigDecimal(tbProject.getCenterFund()); |
| | | BigDecimal newLocalFund = new BigDecimal(tbProjectExcel.getCenterFund()); |
| | | tbProject.setLocalFund(CalculateUtils.add(oldLocalFund,newLocalFund)); |
| | | |
| | | //更新修改人,修改时间 |
| | | tbProject.setUpdateUser(AuthUtil.getUserId().toString()); |
| | | tbProject.setUpdateTime(DateUtil.now()); |
| | | |
| | | updateById(tbProject); |
| | | }else { |
| | | //无数据,新增 |
| | | TbProject save = new TbProject(); |
| | | save.setUpdateUser(AuthUtil.getUserId().toString()); |
| | | save.setCreateUser(AuthUtil.getUserId().toString()); |
| | | save.setCreateTime(DateUtil.now()); |
| | | save.setUpdateTime(DateUtil.now()); |
| | | |
| | | save.setCityName(attAdBase.getPAdName()); |
| | | save.setCityCode(attAdBase.getPAdCode()); |
| | | |
| | | save.setCountyName(attAdBase.getAdName()); |
| | | save.setCountyCode(attAdBase.getAdCode()); |
| | | |
| | | save.setCenterFund(tbProjectExcel.getCenterFund()); |
| | | save.setLocalFund(tbProjectExcel.getLocalFund()); |
| | | |
| | | save.setTbYear(tbProjectExcel.getTbYear()); |
| | | |
| | | save(save); |
| | | } |
| | | }); |
| | | } |
| | | } |