| | |
| | | package cn.gistack.sm.sjztods.service.impl; |
| | | |
| | | import cn.gistack.sm.sjztods.entity.SkxsQkTj; |
| | | import cn.gistack.sm.sjztods.excel.SkxsQkTjExcel; |
| | | import cn.gistack.sm.sjztods.mapper.SkxsQkTjMapper; |
| | | import cn.gistack.sm.sjztods.service.ISkxsQkTjService; |
| | | import cn.gistack.sm.sjztods.vo.SkxsQkTjVO; |
| | | import cn.gistack.system.user.entity.User; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @ClassName SkxsQkTjServiceImpl |
| | |
| | | public Object getStatisticList(SkxsQkTjVO skxsQkTj) { |
| | | return baseMapper.getStatisticList(skxsQkTj); |
| | | } |
| | | |
| | | /** |
| | | * 导入统计上报数据 |
| | | * @param data |
| | | */ |
| | | @Override |
| | | public void importSkxsQkTjData(List<SkxsQkTjExcel> data) { |
| | | if (data.size()>0){ |
| | | // 遍历 |
| | | data.forEach(skxsQkTjExcel -> { |
| | | SkxsQkTj skxsQkTj = Objects.requireNonNull(BeanUtil.copy(skxsQkTjExcel, SkxsQkTj.class)); |
| | | // 查询库中是否包含当前日期,当前行政区的数据,如果有,则更新,没有则新增 |
| | | QueryWrapper<SkxsQkTj> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("\"statistic_time\"",skxsQkTj.getStatisticTime()) |
| | | .eq("\"res_code\"",skxsQkTj.getResCode()); |
| | | SkxsQkTj qkTj = baseMapper.selectOne(wrapper); |
| | | // 设置更新人员,更新时间,来源信息 |
| | | skxsQkTj.setUpdateTime(new Date()); |
| | | skxsQkTj.setUpdateUser(AuthUtil.getUserId()); |
| | | skxsQkTj.setSysResource("sb"); |
| | | if (null!= qkTj){ |
| | | skxsQkTj.setGuid(qkTj.getGuid()); |
| | | // 更新并返回 |
| | | updateById(skxsQkTj); |
| | | return; |
| | | } |
| | | // 设置创建人员,时间信息 |
| | | skxsQkTj.setCreateUser(AuthUtil.getUserId()); |
| | | skxsQkTj.setCreateTime(new Date()); |
| | | // 保存并返回 |
| | | save(skxsQkTj); |
| | | return; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询导出数据 |
| | | * @param skxsQkTj |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SkxsQkTjExcel> exportSkxsQkTjList(SkxsQkTjVO skxsQkTj) { |
| | | return baseMapper.exportSkxsQkTjList(skxsQkTj); |
| | | } |
| | | } |
| | | |