I2新增查询功能和代码优化

master
liuguijing 1 year ago
parent 32dbd5ba6c
commit 6c78a409bb

@ -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

@ -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));
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();
BigDecimal ysptodaymul = NumberUtil.sub(ysptodaymaxid, ysptodayminid);
BigDecimal ysptodayupload = NumberUtil.sub(yspuploadnum, ysptodayminid);
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));
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();
BigDecimal txtodaymul = NumberUtil.sub(txtodaymaxid, txtodayminid);
BigDecimal txtodayupload = NumberUtil.sub(txuploadnum, txtodayminid);
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));
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();
BigDecimal dlqtodaymul = NumberUtil.sub(dlqtodaymaxid, dlqtodayminid);
BigDecimal dlqtodayupload = NumberUtil.sub(dlquploadnum, dlqtodayminid);
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));
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();
BigDecimal sf6todaymul = NumberUtil.sub(sf6todaymaxid, sf6todayminid);
BigDecimal sf6todayupload = NumberUtil.sub(sf6uploadnum, sf6todayminid);
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));
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();
BigDecimal jsytodaymul = NumberUtil.sub(jsytodaymaxid, jsytodayminid);
BigDecimal jsytodayupload = NumberUtil.sub(jsyuploadnum, jsytodayminid);
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));
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();
BigDecimal yxtodaymul = NumberUtil.sub(yxtodaymaxid, yxtodayminid);
BigDecimal yxtodayupload = NumberUtil.sub(yxuploadnum, yxtodayminid);
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<ListModel> serviceBody = new ServiceBody<ListModel>();
serviceBody.setCode(ServiceStatus.SUCCESS);

@ -208,181 +208,5 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where check_type = #{checkType,jdbcType=VARCHAR}
</update>
<resultMap id="BaseResultMap" type="com.shxy.i2.entity.Upload_Statics">
<id column="check_type" jdbcType="VARCHAR" property="checkType" />
<result column="value" jdbcType="BIGINT" property="value" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
check_type, value, update_time
</sql>
<select id="selectByExample" parameterType="com.shxy.i2.entity.Upload_StaticsExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from upload_statics
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from upload_statics
where check_type = #{checkType,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from upload_statics
where check_type = #{checkType,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.shxy.i2.entity.Upload_StaticsExample">
delete from upload_statics
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.shxy.i2.entity.Upload_Statics">
insert into upload_statics (check_type, value, update_time
)
values (#{checkType,jdbcType=VARCHAR}, #{value,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.shxy.i2.entity.Upload_Statics">
insert into upload_statics
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkType != null">
check_type,
</if>
<if test="value != null">
value,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkType != null">
#{checkType,jdbcType=VARCHAR},
</if>
<if test="value != null">
#{value,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.shxy.i2.entity.Upload_StaticsExample" resultType="java.lang.Long">
select count(*) from upload_statics
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update upload_statics
<set>
<if test="record.checkType != null">
check_type = #{record.checkType,jdbcType=VARCHAR},
</if>
<if test="record.value != null">
value = #{record.value,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update upload_statics
set check_type = #{record.checkType,jdbcType=VARCHAR},
value = #{record.value,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.i2.entity.Upload_Statics">
update upload_statics
<set>
<if test="value != null">
value = #{value,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where check_type = #{checkType,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.i2.entity.Upload_Statics">
update upload_statics
set value = #{value,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where check_type = #{checkType,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save