| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collector; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @ClassName SkxsQkTjServiceImpl |
| | |
| | | * @param skxsQkTj |
| | | */ |
| | | @Override |
| | | public void saveOrUpdateData(SkxsQkTjVO skxsQkTj) { |
| | | public String saveOrUpdateData(SkxsQkTjVO skxsQkTj) { |
| | | // 参数拼接 |
| | | StringBuilder builder = new StringBuilder("?"); |
| | | builder.append("pageNo=1").append("&pageSize=1000"); |
| | |
| | | // 加入集合 |
| | | list.add(qkTj); |
| | | } |
| | | //手动去重(需要服务去重) |
| | | List<SkxsQkTj> distinceList = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(p -> p.getResCode()))), ArrayList::new)); |
| | | // 批量插入 |
| | | saveBatch(list); |
| | | saveBatch(distinceList); |
| | | |
| | | |
| | | return "中台数据数量:"+jsonArray.size()+",数据库插入数量:"+distinceList.size(); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | skxs.setLastYearWs(jsonArray.getJSONObject(i).getDouble("last_year_cap")); |
| | | skxs.setHisWs(jsonArray.getJSONObject(i).getDouble("avg_cap")); |
| | | skxs.setUpMonthWs(jsonArray.getJSONObject(i).getDouble("last_month_cap")); |
| | | skxs.setTotalWsDif(jsonArray.getJSONObject(i).getString("diff_his")); |
| | | skxs.setTotalWsDif(jsonArray.getJSONObject(i).getDouble("diff_his")); |
| | | } |
| | | |
| | | /** |