Commit 7979d6cc authored by tianyiming's avatar tianyiming

气瓶总览页面bug修改

parent 6f20e3f1
...@@ -41,4 +41,6 @@ public interface CylinderUnitMapper extends BaseMapper<CylinderUnit> { ...@@ -41,4 +41,6 @@ public interface CylinderUnitMapper extends BaseMapper<CylinderUnit> {
* @return * @return
*/ */
Integer getLicenseOutOfDate(String creditCode); Integer getLicenseOutOfDate(String creditCode);
Integer getThisMonthUnitTotalByRegionCode(String regionCode);
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="queryIntegirtyByAppId" resultType="java.lang.Double"> <select id="queryIntegirtyByAppId" resultType="java.lang.Double">
SELECT AVG(integrity) AS score_avg FROM tz_cylinder_filling_check t where t.app_id = #{appId} AND SELECT AVG(integrity) AS score_avg FROM tz_cylinder_filling_check t where t.app_id = #{appId} AND
DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(t.sync_date); DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date_format(t.sync_date,'%Y-%M-%d');
</select> </select>
<select id="getFillingCountByMonth" resultType="java.lang.Integer"> <select id="getFillingCountByMonth" resultType="java.lang.Integer">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="queryIntegirtyByAppId" resultType="java.lang.Double"> <select id="queryIntegirtyByAppId" resultType="java.lang.Double">
SELECT AVG(integrity) AS score_avg FROM tz_cylinder_filling t where t.app_id = #{appId} AND SELECT AVG(integrity) AS score_avg FROM tz_cylinder_filling t where t.app_id = #{appId} AND
DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(t.sync_date); DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date_format(T.sync_date,'yyyy-mm-dd');
</select> </select>
<select id="getFillingCountByMonth" resultType="java.lang.Integer"> <select id="getFillingCountByMonth" resultType="java.lang.Integer">
......
...@@ -25,18 +25,33 @@ ...@@ -25,18 +25,33 @@
</sql> </sql>
<select id="getMonthInfoTotal" resultType="java.lang.Integer"> <select id="getMonthInfoTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , select
date_format( sync_date, '%Y%m' ) ) =0 AND app_id in (<include refid="selectAPPIdByRegionCode"/>) IFNULL(count(sequence_nbr), 0)
from
tz_cylinder_info
where
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW(), 'yyyy-mm' )
AND app_id in (<include refid="selectAPPIdByRegionCode"/>)
</select> </select>
<select id="getLastMonthInfoTotal" resultType="java.lang.Integer"> <select id="getLastMonthInfoTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , select
date_format( sync_date, '%Y%m' ) ) =1 AND app_id in (<include refid="selectAPPIdByRegionCode"/>) IFNULL(count(sequence_nbr), 0)
from
tz_cylinder_info
where
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW() - INTERVAL '1 month', 'yyyy-mm' )
AND app_id in (<include refid="selectAPPIdByRegionCode"/>)
</select> </select>
<select id="getMonthBeforeLastInfoTotal" resultType="java.lang.Integer"> <select id="getMonthBeforeLastInfoTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , select
date_format( sync_date, '%Y%m' ) ) =2 AND app_id in (<include refid="selectAPPIdByRegionCode"/>) IFNULL(count(sequence_nbr), 0)
from
tz_cylinder_info
where
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW() - INTERVAL '2 month', 'yyyy-mm' )
AND app_id in (<include refid="selectAPPIdByRegionCode"/>)
</select> </select>
<select id="getInfoTotalByRegionCode" resultType="java.lang.Integer"> <select id="getInfoTotalByRegionCode" resultType="java.lang.Integer">
...@@ -52,15 +67,33 @@ ...@@ -52,15 +67,33 @@
</select> </select>
<select id="getMonthInfoTotalUnit" resultType="java.lang.Integer"> <select id="getMonthInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =0 AND app_id = #{appId} select
IFNULL(count(sequence_nbr), 0)
from
tz_cylinder_info
where
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW() , 'yyyy-mm' )
AND app_id = #{appId}
</select> </select>
<select id="getLastMonthInfoTotalUnit" resultType="java.lang.Integer"> <select id="getLastMonthInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =1 AND app_id = #{appId} select
IFNULL(count(sequence_nbr), 0)
from
tz_cylinder_info
where
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW() - INTERVAL '1 month', 'yyyy-mm' )
AND app_id = #{appId}
</select> </select>
<select id="getMonthBeforeLastInfoTotalUnit" resultType="java.lang.Integer"> <select id="getMonthBeforeLastInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =2 AND app_id = #{appId} select
IFNULL(count(sequence_nbr), 0)
from
tz_cylinder_info
where
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW() - INTERVAL '2 month', 'yyyy-mm' )
AND app_id = #{appId}
</select> </select>
<select id="countOverDateNumber" resultType="java.lang.Integer"> <select id="countOverDateNumber" resultType="java.lang.Integer">
SELECT SELECT
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderUnitMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderUnitMapper">
<select id="getLastMonthUnitTotal" resultType="java.lang.Integer"> <select id="getLastMonthUnitTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_unit where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =1 AND region_code like CONCAT('%',#{regionCode},'%') select IFNULL(count(sequence_nbr), 0) from tz_cylinder_unit where date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW( ) - INTERVAL '1 month', 'yyyy-mm' ) AND region_code like CONCAT('%',#{regionCode},'%')
</select> </select>
<select id="getMonthBeforeLastUnitTotal" resultType="java.lang.Integer"> <select id="getMonthBeforeLastUnitTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_unit where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =2 AND region_code like CONCAT('%',#{regionCode},'%') select IFNULL(count(sequence_nbr), 0) from tz_cylinder_unit where date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW( ) - INTERVAL '2 month', 'yyyy-mm' ) AND region_code like CONCAT('%',#{regionCode},'%')
</select> </select>
<select id="getUnitTotalByRegionCode" resultType="java.lang.Integer"> <select id="getUnitTotalByRegionCode" resultType="java.lang.Integer">
...@@ -27,4 +27,8 @@ ...@@ -27,4 +27,8 @@
<select id="getLicenseOutOfDate" resultType="java.lang.Integer"> <select id="getLicenseOutOfDate" resultType="java.lang.Integer">
select count(1) from view_unit_outofdate v where v.credit_code = #{creditCode} select count(1) from view_unit_outofdate v where v.credit_code = #{creditCode}
</select> </select>
<select id="getThisMonthUnitTotalByRegionCode" resultType="java.lang.Integer">
select count(sequence_nbr) from tz_cylinder_unit where date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW( ) ,'yyyy-mm') and region_code like CONCAT('%',#{regionCode},'%')
</select>
</mapper> </mapper>
...@@ -343,9 +343,10 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -343,9 +343,10 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
countByRegion(regionModel -> { countByRegion(regionModel -> {
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode);
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
double changeNum = cylinderUnitTotal - lastUnitTotal; double changeNum = thisMonthUnitTotal - lastUnitTotal;
double percent = 0d; double percent = 0d;
if (monthUnitLastInfo != 0) { if (monthUnitLastInfo != 0) {
percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo; percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo;
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto; import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence; import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitIcDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitIcDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitIc; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitIc;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderUnitMapper; import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderUnitMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderUnitService; import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderUnitService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDto;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -73,6 +71,11 @@ public class CylinderUnitServiceImpl extends BaseService<CylinderUnitDto, Cylind ...@@ -73,6 +71,11 @@ public class CylinderUnitServiceImpl extends BaseService<CylinderUnitDto, Cylind
return baseMapper.getMonthBeforeLastUnitTotal(regionCode); return baseMapper.getMonthBeforeLastUnitTotal(regionCode);
} }
public Integer getThisMonthUnitTotalByRegionCode(String regionCode) {
return baseMapper.getThisMonthUnitTotalByRegionCode(regionCode);
}
public Integer getUnitTotalByRegionCode(String regionCode) { public Integer getUnitTotalByRegionCode(String regionCode) {
return baseMapper.getUnitTotalByRegionCode(regionCode); return baseMapper.getUnitTotalByRegionCode(regionCode);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment