From 6c78a409bbfbdc3d961c218635ade65894ae989a Mon Sep 17 00:00:00 2001 From: liuguijing <123456> Date: Sat, 30 Mar 2024 11:03:07 +0800 Subject: [PATCH] =?UTF-8?q?I2=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=92=8C=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shxy/i2/Tool/AsyncMethod.java | 6 - .../i2/serviceimpl/XydlI2ServiceImpl.java | 179 +++++++++++------- .../resources/mappers/Upload_StaticsDao.xml | 178 +---------------- 3 files changed, 109 insertions(+), 254 deletions(-) diff --git a/src/main/java/com/shxy/i2/Tool/AsyncMethod.java b/src/main/java/com/shxy/i2/Tool/AsyncMethod.java index 89d274b..6544d65 100644 --- a/src/main/java/com/shxy/i2/Tool/AsyncMethod.java +++ b/src/main/java/com/shxy/i2/Tool/AsyncMethod.java @@ -1,11 +1,7 @@ package com.shxy.i2.Tool; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.XML; -import com.shxy.i2.constant.CommonStatus; -import com.shxy.i2.constant.Constant; import com.shxy.i2.dao.*; import lombok.extern.slf4j.Slf4j; import org.apache.cxf.endpoint.Client; @@ -13,9 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.math.BigInteger; -import java.util.ArrayList; import java.util.Date; -import java.util.List; @Slf4j @Component diff --git a/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java b/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java index ebae4d7..665ffc0 100644 --- a/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java +++ b/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java @@ -1481,105 +1481,142 @@ public class XydlI2ServiceImpl implements XydlI2Service { } String today = DateUtil.today(); -// String today = "2024-02-01"; ListModel.Beans yspbeans = new ListModel.Beans(); yspbeans.setName("油色谱"); Data_Ysp data_ysp1 = data_yspDao.selectMaxId(); Data_Ysp data_ysp2 = data_yspDao.selectNowId(DateUtil.parseDate(today)); - BigInteger yspmaxid = data_ysp1.getMaxid(); - BigInteger yspuploadnum = map.get(Constant.YSPID); - BigInteger ysptodaymaxid = data_ysp2.getMaxid(); - BigInteger ysptodayminid = data_ysp2.getMinid(); - BigDecimal ysptodaymul = NumberUtil.sub(ysptodaymaxid, ysptodayminid); - BigDecimal ysptodayupload = NumberUtil.sub(yspuploadnum, ysptodayminid); - yspbeans.setHistory(yspmaxid); - yspbeans.setUploadnum(yspuploadnum); - yspbeans.setNownum(BigInteger.valueOf(ysptodaymul.longValue())); - yspbeans.setNowuploadnum(BigInteger.valueOf(ysptodayupload.longValue())); - listModel.getList().add(yspbeans); + if (data_ysp1 != null) { + BigInteger yspmaxid = data_ysp1.getMaxid(); + BigInteger yspuploadnum = map.get(Constant.YSPID); + BigDecimal ysptodaymul = new BigDecimal(0); + BigDecimal ysptodayupload = new BigDecimal(0); + if (data_ysp2 != null) { + BigInteger ysptodaymaxid = data_ysp2.getMaxid(); + BigInteger ysptodayminid = data_ysp2.getMinid(); + ysptodaymul = NumberUtil.sub(ysptodaymaxid, ysptodayminid); + ysptodayupload = NumberUtil.sub(yspuploadnum, ysptodayminid); + } + yspbeans.setHistory(yspmaxid); + yspbeans.setUploadnum(yspuploadnum); + yspbeans.setNownum(BigInteger.valueOf(ysptodaymul.longValue())); + yspbeans.setNowuploadnum(BigInteger.valueOf(ysptodayupload.longValue())); + listModel.getList().add(yspbeans); + } ListModel.Beans txbeans = new ListModel.Beans(); txbeans.setName("铁芯夹件"); Data_Tx data_tx1 = data_txDao.selectMaxId(); Data_Tx data_tx2 = data_txDao.selectNowId(DateUtil.parseDate(today)); - BigInteger txmaxid = data_tx1.getMaxid(); - BigInteger txuploadnum = map.get(Constant.TXID); - BigInteger txtodaymaxid = data_tx2.getMaxid(); - BigInteger txtodayminid = data_tx2.getMinid(); - BigDecimal txtodaymul = NumberUtil.sub(txtodaymaxid, txtodayminid); - BigDecimal txtodayupload = NumberUtil.sub(txuploadnum, txtodayminid); - txbeans.setHistory(txmaxid); - txbeans.setUploadnum(txuploadnum); - txbeans.setNownum(BigInteger.valueOf(txtodaymul.longValue())); - txbeans.setNowuploadnum(BigInteger.valueOf(txtodayupload.longValue())); - listModel.getList().add(txbeans); + if (data_tx1 != null) { + BigInteger txmaxid = data_tx1.getMaxid(); + BigInteger txuploadnum = map.get(Constant.TXID); + BigDecimal txtodaymul = new BigDecimal(0); + BigDecimal txtodayupload = new BigDecimal(0); + if (data_tx2 != null) { + BigInteger txtodaymaxid = data_tx2.getMaxid(); + BigInteger txtodayminid = data_tx2.getMinid(); + txtodaymul = NumberUtil.sub(txtodaymaxid, txtodayminid); + txtodayupload = NumberUtil.sub(txuploadnum, txtodayminid); + } + txbeans.setHistory(txmaxid); + txbeans.setUploadnum(txuploadnum); + txbeans.setNownum(BigInteger.valueOf(txtodaymul.longValue())); + txbeans.setNowuploadnum(BigInteger.valueOf(txtodayupload.longValue())); + listModel.getList().add(txbeans); + } + ListModel.Beans dlqbeans = new ListModel.Beans(); dlqbeans.setName("断路器局放"); Data_Dlq_Jbfd data_dlq_jbfd1 = data_dlq_jbfdDao.selectMaxId(); Data_Dlq_Jbfd data_dlq_jbfd2 = data_dlq_jbfdDao.selectNowId(DateUtil.parseDate(today)); - BigInteger dlqmaxid = data_dlq_jbfd1.getMaxid(); - BigInteger dlquploadnum = map.get(Constant.DLQJBFDID); - BigInteger dlqtodaymaxid = data_dlq_jbfd2.getMaxid(); - BigInteger dlqtodayminid = data_dlq_jbfd2.getMinid(); - BigDecimal dlqtodaymul = NumberUtil.sub(dlqtodaymaxid, dlqtodayminid); - BigDecimal dlqtodayupload = NumberUtil.sub(dlquploadnum, dlqtodayminid); - dlqbeans.setHistory(dlqmaxid); - dlqbeans.setUploadnum(dlquploadnum); - dlqbeans.setNownum(BigInteger.valueOf(dlqtodaymul.longValue())); - dlqbeans.setNowuploadnum(BigInteger.valueOf(dlqtodayupload.longValue())); - listModel.getList().add(dlqbeans); + if (data_dlq_jbfd1 != null) { + BigInteger dlqmaxid = data_dlq_jbfd1.getMaxid(); + BigInteger dlquploadnum = map.get(Constant.DLQJBFDID); + BigDecimal dlqtodaymul = new BigDecimal(0); + BigDecimal dlqtodayupload = new BigDecimal(0); + if (data_dlq_jbfd2 != null) { + BigInteger dlqtodaymaxid = data_dlq_jbfd2.getMaxid(); + BigInteger dlqtodayminid = data_dlq_jbfd2.getMinid(); + dlqtodaymul = NumberUtil.sub(dlqtodaymaxid, dlqtodayminid); + dlqtodayupload = NumberUtil.sub(dlquploadnum, dlqtodayminid); + } + dlqbeans.setHistory(dlqmaxid); + dlqbeans.setUploadnum(dlquploadnum); + dlqbeans.setNownum(BigInteger.valueOf(dlqtodaymul.longValue())); + dlqbeans.setNowuploadnum(BigInteger.valueOf(dlqtodayupload.longValue())); + listModel.getList().add(dlqbeans); + } ListModel.Beans sf6beans = new ListModel.Beans(); sf6beans.setName("SF6气体压力"); Data_SF6_Qtyl data_sf6_qtyl1 = data_sf6_qtylDao.selectMaxId(); Data_SF6_Qtyl data_sf6_qtyl2 = data_sf6_qtylDao.selectNowId(DateUtil.parseDate(today)); - BigInteger sf6maxid = data_sf6_qtyl1.getMaxid(); - BigInteger sf6uploadnum = map.get(Constant.SF6QTYLID); - BigInteger sf6todaymaxid = data_sf6_qtyl2.getMaxid(); - BigInteger sf6todayminid = data_sf6_qtyl2.getMinid(); - BigDecimal sf6todaymul = NumberUtil.sub(sf6todaymaxid, sf6todayminid); - BigDecimal sf6todayupload = NumberUtil.sub(sf6uploadnum, sf6todayminid); - sf6beans.setHistory(sf6maxid); - sf6beans.setUploadnum(sf6uploadnum); - sf6beans.setNownum(BigInteger.valueOf(sf6todaymul.longValue())); - sf6beans.setNowuploadnum(BigInteger.valueOf(sf6todayupload.longValue())); - listModel.getList().add(sf6beans); + if (data_sf6_qtyl1 != null) { + BigInteger sf6maxid = data_sf6_qtyl1.getMaxid(); + BigInteger sf6uploadnum = map.get(Constant.SF6QTYLID); + BigDecimal sf6todaymul = new BigDecimal(0); + BigDecimal sf6todayupload = new BigDecimal(0); + if (data_sf6_qtyl2 != null) { + BigInteger sf6todaymaxid = data_sf6_qtyl2.getMaxid(); + BigInteger sf6todayminid = data_sf6_qtyl2.getMinid(); + sf6todaymul = NumberUtil.sub(sf6todaymaxid, sf6todayminid); + sf6todayupload = NumberUtil.sub(sf6uploadnum, sf6todayminid); + } + sf6beans.setHistory(sf6maxid); + sf6beans.setUploadnum(sf6uploadnum); + sf6beans.setNownum(BigInteger.valueOf(sf6todaymul.longValue())); + sf6beans.setNowuploadnum(BigInteger.valueOf(sf6todayupload.longValue())); + listModel.getList().add(sf6beans); + } - ListModel.Beans jsybeans = new ListModel.Beans(); - jsybeans.setName("避雷器"); Data_Jsyhw_Jyjc data_jsyhw_jyjc1 = data_jsyhw_jyjcDao.selectMaxId(); Data_Jsyhw_Jyjc data_jsyhw_jyjc2 = data_jsyhw_jyjcDao.selectNowId(DateUtil.parseDate(today)); - BigInteger jsymaxid = data_jsyhw_jyjc1.getMaxid(); - BigInteger jsyuploadnum = map.get(Constant.JSYHWJYJCID); - BigInteger jsytodaymaxid = data_jsyhw_jyjc2.getMaxid(); - BigInteger jsytodayminid = data_jsyhw_jyjc2.getMinid(); - BigDecimal jsytodaymul = NumberUtil.sub(jsytodaymaxid, jsytodayminid); - BigDecimal jsytodayupload = NumberUtil.sub(jsyuploadnum, jsytodayminid); - jsybeans.setHistory(jsymaxid); - jsybeans.setUploadnum(jsyuploadnum); - jsybeans.setNownum(BigInteger.valueOf(jsytodaymul.longValue())); - jsybeans.setNowuploadnum(BigInteger.valueOf(jsytodayupload.longValue())); - listModel.getList().add(jsybeans); + if (data_jsyhw_jyjc1 != null) { + ListModel.Beans jsybeans = new ListModel.Beans(); + jsybeans.setName("避雷器"); + BigInteger jsymaxid = data_jsyhw_jyjc1.getMaxid(); + BigInteger jsyuploadnum = map.get(Constant.JSYHWJYJCID); + BigDecimal jsytodaymul = new BigDecimal(0); + BigDecimal jsytodayupload = new BigDecimal(0); + if (data_jsyhw_jyjc2 != null) { + BigInteger jsytodaymaxid = data_jsyhw_jyjc2.getMaxid(); + BigInteger jsytodayminid = data_jsyhw_jyjc2.getMinid(); + jsytodaymul = NumberUtil.sub(jsytodaymaxid, jsytodayminid); + jsytodayupload = NumberUtil.sub(jsyuploadnum, jsytodayminid); + } + jsybeans.setHistory(jsymaxid); + jsybeans.setUploadnum(jsyuploadnum); + jsybeans.setNownum(BigInteger.valueOf(jsytodaymul.longValue())); + jsybeans.setNowuploadnum(BigInteger.valueOf(jsytodayupload.longValue())); + listModel.getList().add(jsybeans); + } + - ListModel.Beans yxbeans = new ListModel.Beans(); - yxbeans.setName("遥信"); Data_YxlDto data_yxlDto1 = data_yxDao.selectMaxId(); Data_YxlDto data_yxlDto2 = data_yxDao.selectNowId(DateUtil.parseDate(today)); - BigInteger yxmaxid = data_yxlDto1.getMaxid(); - BigInteger yxuploadnum = map.get(Constant.YXID); - BigInteger yxtodaymaxid = data_yxlDto2.getMaxid(); - BigInteger yxtodayminid = data_yxlDto2.getMinid(); - BigDecimal yxtodaymul = NumberUtil.sub(yxtodaymaxid, yxtodayminid); - BigDecimal yxtodayupload = NumberUtil.sub(yxuploadnum, yxtodayminid); - yxbeans.setHistory(yxmaxid); - yxbeans.setUploadnum(yxuploadnum); - yxbeans.setNownum(BigInteger.valueOf(yxtodaymul.longValue())); - yxbeans.setNowuploadnum(BigInteger.valueOf(yxtodayupload.longValue())); - listModel.getList().add(yxbeans); + if (data_yxlDto1 != null) { + ListModel.Beans yxbeans = new ListModel.Beans(); + yxbeans.setName("遥信"); + BigInteger yxmaxid = data_yxlDto1.getMaxid(); + BigInteger yxuploadnum = map.get(Constant.YXID); + BigDecimal yxtodaymul = new BigDecimal(0); + BigDecimal yxtodayupload = new BigDecimal(0); + if (data_yxlDto2 != null) { + BigInteger yxtodaymaxid = data_yxlDto2.getMaxid(); + BigInteger yxtodayminid = data_yxlDto2.getMinid(); + yxtodaymul = NumberUtil.sub(yxtodaymaxid, yxtodayminid); + yxtodayupload = NumberUtil.sub(yxuploadnum, yxtodayminid); + } + yxbeans.setHistory(yxmaxid); + yxbeans.setUploadnum(yxuploadnum); + yxbeans.setNownum(BigInteger.valueOf(yxtodaymul.longValue())); + yxbeans.setNowuploadnum(BigInteger.valueOf(yxtodayupload.longValue())); + listModel.getList().add(yxbeans); + } ServiceBody serviceBody = new ServiceBody(); serviceBody.setCode(ServiceStatus.SUCCESS); diff --git a/src/main/resources/mappers/Upload_StaticsDao.xml b/src/main/resources/mappers/Upload_StaticsDao.xml index 44b2a64..6179f68 100644 --- a/src/main/resources/mappers/Upload_StaticsDao.xml +++ b/src/main/resources/mappers/Upload_StaticsDao.xml @@ -208,181 +208,5 @@ update_time = #{updateTime,jdbcType=TIMESTAMP} where check_type = #{checkType,jdbcType=VARCHAR} - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - check_type, value, update_time - - - - - delete from upload_statics - where check_type = #{checkType,jdbcType=VARCHAR} - - - delete from upload_statics - - - - - - insert into upload_statics (check_type, value, update_time - ) - values (#{checkType,jdbcType=VARCHAR}, #{value,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP} - ) - - - insert into upload_statics - - - check_type, - - - value, - - - update_time, - - - - - #{checkType,jdbcType=VARCHAR}, - - - #{value,jdbcType=BIGINT}, - - - #{updateTime,jdbcType=TIMESTAMP}, - - - - - - update upload_statics - - - check_type = #{record.checkType,jdbcType=VARCHAR}, - - - value = #{record.value,jdbcType=BIGINT}, - - - update_time = #{record.updateTime,jdbcType=TIMESTAMP}, - - - - - - - - update upload_statics - set check_type = #{record.checkType,jdbcType=VARCHAR}, - value = #{record.value,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=TIMESTAMP} - - - - - - update upload_statics - - - value = #{value,jdbcType=BIGINT}, - - - update_time = #{updateTime,jdbcType=TIMESTAMP}, - - - where check_type = #{checkType,jdbcType=VARCHAR} - - - update upload_statics - set value = #{value,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=TIMESTAMP} - where check_type = #{checkType,jdbcType=VARCHAR} - + \ No newline at end of file