修复:1.sql报错问题 2.显示问题 3.新增字段

dev
masong 2 years ago
parent 4f6467cf94
commit 3db16ac134
  1. 50
      cjy-project/src/main/java/com/cjy/estate/domain/MeteorologicalMonitoring.java
  2. 133
      cjy-project/src/main/java/com/cjy/reservation/service/impl/ReservationSourceServiceImpl.java
  3. 72
      cjy-project/src/main/resources/mapper/estate/MeteorologicalMonitoringMapper.xml
  4. 2
      cjy-project/src/main/resources/mapper/estate/TouristSourceMapper.xml
  5. 2
      ruoyi-ui/src/views/system/management/estate/meteorological-monitoring/index.vue

@ -105,8 +105,10 @@ public class MeteorologicalMonitoring extends BaseEntity
* 空气质量
*/
private String airQuality;
/**
* 体感温度
*/
private Double sensibleTemperature;
/** 数据来源 */
@Excel(name = "数据来源")
private String dataSource;
@ -115,6 +117,18 @@ public class MeteorologicalMonitoring extends BaseEntity
/** 数据状态 数据状态新增0修改1删除2 */
private String delFlag;
/**
* 省份名称
*/
private String provinceName;
/**
* 市名称
*/
private String cityName;
/**
* 县名称
*/
private String countyName;
public void setId(Long id)
{
this.id = id;
@ -331,6 +345,38 @@ public class MeteorologicalMonitoring extends BaseEntity
this.airQuality = airQuality;
}
public Double getSensibleTemperature() {
return sensibleTemperature;
}
public void setSensibleTemperature(Double sensibleTemperature) {
this.sensibleTemperature = sensibleTemperature;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -1,77 +1,79 @@
package com.cjy.reservation.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import com.cjy.marketingdata.domain.Region;
import com.cjy.marketingdata.service.IRegionService;
import com.cjy.reservation.domain.ReservationSource;
import com.cjy.reservation.domain.vo.ReservationSourceVO;
import com.cjy.reservation.domain.vo.ResultVO;
import com.cjy.reservation.mapper.ReservationSourceMapper;
import com.cjy.reservation.service.IReservationSourceService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cjy.reservation.mapper.ReservationSourceMapper;
import com.cjy.reservation.domain.ReservationSource;
import com.cjy.reservation.service.IReservationSourceService;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Random;
/**
* 分时预约客源 Service业务层处理
*
*
* @author ms
* @date 2023-03-21
*/
@Service
public class ReservationSourceServiceImpl implements IReservationSourceService
{
public class ReservationSourceServiceImpl implements IReservationSourceService {
@Autowired
private ReservationSourceMapper reservationSourceMapper;
@Autowired
private IRegionService regionService;
/**
* 查询分时预约客源
*
* 查询分时预约客源
*
* @param id 分时预约客源 主键
* @return 分时预约客源
* @return 分时预约客源
*/
@Override
public ReservationSource selectReservationSourceById(Long id)
{
public ReservationSource selectReservationSourceById(Long id) {
return reservationSourceMapper.selectReservationSourceById(id);
}
/**
* 查询分时预约客源 列表
*
* @param reservationSource 分时预约客源
* @return 分时预约客源
*
* @param reservationSource 分时预约客源
* @return 分时预约客源
*/
@Override
public List<ReservationSource> selectReservationSourceList(ReservationSource reservationSource)
{
public List<ReservationSource> selectReservationSourceList(ReservationSource reservationSource) {
return reservationSourceMapper.selectReservationSourceList(reservationSource);
}
@Override
public List<ReservationSourceVO> selectReservationSourceVOList(ReservationSource reservationSource) {
return reservationSourceMapper.selectReservationSourceVOList(reservationSource);
return reservationSourceMapper.selectReservationSourceVOList(reservationSource);
}
/**
* 新增分时预约客源
*
* @param reservationSource 分时预约客源
* 新增分时预约客源
*
* @param reservationSource 分时预约客源
* @return 结果
*/
@Override
public AjaxResult insertReservationSource(ReservationSource reservationSource)
{
public AjaxResult insertReservationSource(ReservationSource reservationSource) {
ReservationSource selectSource = new ReservationSource();
selectSource.setProvinceSource(reservationSource.getProvinceSource());
selectSource.setCitySource(reservationSource.getCitySource());
selectSource.setResourceCode(reservationSource.getResourceCode());
List<ReservationSource> list =reservationSourceMapper.selectReservationSourceList(selectSource);
if(!list.isEmpty()){
return AjaxResult.error("数据已存在,请勿重复添加");
}else{
List<ReservationSource> list = reservationSourceMapper.selectReservationSourceList(selectSource);
if (!list.isEmpty()) {
return AjaxResult.error("数据已存在,请勿重复添加");
} else {
reservationSourceMapper.insertReservationSource(reservationSource);
return AjaxResult.success();
}
@ -79,78 +81,101 @@ public class ReservationSourceServiceImpl implements IReservationSourceService
}
/**
* 修改分时预约客源
*
* @param reservationSource 分时预约客源
* 修改分时预约客源
*
* @param reservationSource 分时预约客源
* @return 结果
*/
@Override
public int updateReservationSource(ReservationSource reservationSource)
{
public int updateReservationSource(ReservationSource reservationSource) {
reservationSource.setUpdateTime(DateUtils.getNowDate());
return reservationSourceMapper.updateReservationSource(reservationSource);
}
/**
* 批量删除分时预约客源
*
* 批量删除分时预约客源
*
* @param ids 需要删除的分时预约客源 主键
* @return 结果
*/
@Override
public int deleteReservationSourceByIds(Long[] ids)
{
public int deleteReservationSourceByIds(Long[] ids) {
return reservationSourceMapper.deleteReservationSourceByIds(ids);
}
/**
* 删除分时预约客源 信息
*
*
* @param id 分时预约客源 主键
* @return 结果
*/
@Override
public int deleteReservationSourceById(Long id)
{
public int deleteReservationSourceById(Long id) {
return reservationSourceMapper.deleteReservationSourceById(id);
}
/**
* 批量假删除分时预约客源
* 批量假删除分时预约客源
*
* @param ids 需要删除的分时预约客源 主键集合
* @return 结果
*/
@Override
public int updateDelFlagByIds(Long[] ids){
public int updateDelFlagByIds(Long[] ids) {
return reservationSourceMapper.updateDelFlagByIds(ids);
}
@Override
public List<ResultVO> selectProvinceTop10(Long organCode) {
List<ResultVO> list = reservationSourceMapper.selectProvinceTop10(organCode);
if (list.size() < 10) {
Random rand = new Random();
Region regions = new Region();
regions.setRegionLevel(1);
List<Region> regionList = regionService.selectRegionList(regions);
int total = list.size();
for (int i = 0; i < (10 - total); i++) {
//获取随机数省份
Region region = regionList.get(rand.nextInt(regionList.size()));
boolean result = list.stream().filter(m -> m.getName().equals(region.getRegionName())).findAny().isPresent();
if (!result) {
ResultVO resultVO = new ResultVO();
resultVO.setPercentage("0.0");
resultVO.setName(region.getRegionName());
resultVO.setRatio("0.0");
resultVO.setNum(0);
list.add(resultVO);
}else{
total= total -1;
}
}
}
Integer total = list.stream().mapToInt(ResultVO::getNum).sum();
list.forEach(x ->{
Integer num =x.getNum();
if(total>0){
BigDecimal ratio = new BigDecimal(num).divide(new BigDecimal(total),2, RoundingMode.DOWN).multiply( new BigDecimal("100"));
list.forEach(x -> {
Integer num = x.getNum();
if (total > 0) {
BigDecimal ratio = new BigDecimal(num).divide(new BigDecimal(total), 2, RoundingMode.DOWN).multiply(new BigDecimal("100"));
x.setPercentage(ratio.toString());
}else{
} else {
x.setPercentage("0.0");
}
});
return list;
}
@Override
public List<ResultVO> selectCityTop10(Long organCode) {
List<ResultVO> list = reservationSourceMapper.selectCityTop10(organCode);
Integer total = list.stream().mapToInt(ResultVO::getNum).sum();
list.forEach(x ->{
Integer num =x.getNum();
if(total>0){
BigDecimal ratio = new BigDecimal(num).multiply(new BigDecimal("100").divide(new BigDecimal(total),2, RoundingMode.DOWN));
list.forEach(x -> {
Integer num = x.getNum();
if (total > 0) {
BigDecimal ratio = new BigDecimal(num).multiply(new BigDecimal("100").divide(new BigDecimal(total), 2, RoundingMode.DOWN));
x.setPercentage(ratio.toString());
}else{
} else {
x.setPercentage("0.0");
}
});

@ -34,6 +34,10 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="airQuality" column="air_quality"/>
<result property="sensibleTemperature" column="sensible_temperature"/>
<result property="provinceName" column="provinceName"/>
<result property="cityName" column="cityName"/>
<result property="countyName" column="countyName"/>
</resultMap>
<sql id="selectMeteorologicalMonitoringVo">
@ -65,25 +69,61 @@
create_time,
update_by,
update_time,
air_quality
air_quality,
sensible_temperature
from ps_meteorological_monitoring
</sql>
<select id="selectMeteorologicalMonitoringList" parameterType="MeteorologicalMonitoringDTO"
resultMap="MeteorologicalMonitoringResult">
<include refid="selectMeteorologicalMonitoringVo"/>
select
ifnull((select t2.region_name from region t2 where t2.region_id =t1.province_code),'') as provinceName,
ifnull((select t2.region_name from region t2 where t2.region_id =t1.city_code),'') as cityName,
ifnull((select t2.region_name from region t2 where t2.region_id =t1.county_code),'') as countyName,
t1.id,
t1.organ_code,
t1.statistical_time,
t1.province_code,
t1.city_code,
t1.county_code,
t1.weather,
t1.maximum_temperature,
t1.minimum_temperature,
t1.humidity,
t1.airPressure,
t1.comfort,
t1.air_pollution_index,
t1.wind_power,
t1.wind_direction,
t1.inhalable_particles,
t1.fine_particles,
t1.sulfur_dioxide,
t1.nitrogen_dioxide,
t1.carbonic_oxide,
t1.ozone,
t1.data_source,
t1.remark,
t1.del_flag,
t1.create_by,
t1.create_time,
t1.update_by,
t1.update_time,
t1.air_quality,
t1.sensible_temperature
from ps_meteorological_monitoring t1
<where>
and organ_code =#{organCode}
<if test="provinceCode != null and provinceCode != ''">and province_code = #{provinceCode}</if>
<if test="cityCode != null and cityCode != ''">and city_code = #{cityCode}</if>
<if test="countyCode != null and countyCode != ''">and county_code = #{countyCode}</if>
<if test="weather != null and weather != ''">and weather = #{weather}</if>
<if test="comfort != null and comfort != ''">and comfort = #{comfort}</if>
<if test="dataSource != null and dataSource != ''">and data_source = #{dataSource}</if>
and statistical_time between #{startTime} and #{endTime}
and del_flag !='2'
and t1.organ_code =#{organCode}
<if test="provinceCode != null and provinceCode != ''">and t1.province_code = #{provinceCode}</if>
<if test="cityCode != null and cityCode != ''">and t1.city_code = #{cityCode}</if>
<if test="countyCode != null and countyCode != ''">and t1.county_code = #{countyCode}</if>
<if test="weather != null and weather != ''">and t1.weather = #{weather}</if>
<if test="comfort != null and comfort != ''">and t1.comfort = #{comfort}</if>
<if test="dataSource != null and dataSource != ''">and t1.data_source = #{dataSource}</if>
and t1.statistical_time between #{startTime} and #{endTime}
and t1.del_flag !='2'
</where>
order by statistical_time desc
order by t1.statistical_time desc
</select>
<select id="selectMeteorologicalMonitoringById" parameterType="Long" resultMap="MeteorologicalMonitoringResult">
@ -123,6 +163,7 @@
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="airQuality !=null"> air_quality,</if>
<if test="sensibleTemperature !=null">sensible_temperature,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="organCode != null">#{organCode},</if>
@ -153,6 +194,7 @@
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="airQuality !=null">#{airQuality},</if>
<if test="sensibleTemperature !=null">#{sensibleTemperature},</if>
</trim>
</insert>
<insert id="batchInsertMeteorologicalMonitoring" parameterType="MeteorologicalMonitoring" useGeneratedKeys="true"
@ -161,7 +203,7 @@
(organ_code,statistical_time,province_code,city_code,county_code,weather,maximum_temperature,minimum_temperature,humidity,
airPressure,
comfort,air_pollution_index,wind_power,wind_direction,inhalable_particles,fine_particles,sulfur_dioxide,nitrogen_dioxide,
carbonic_oxide,ozone,data_source,remark,del_flag,create_by,create_time,update_by,update_time,air_quality)
carbonic_oxide,ozone,data_source,remark,del_flag,create_by,create_time,update_by,update_time,air_quality,sensible_temperature)
values
<foreach collection="list" index="index" item="item" separator=",">
(
@ -192,7 +234,8 @@
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.airQuality}
#{item.airQuality},
#{item.sensibleTemperature}
)
</foreach>
@ -230,6 +273,7 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="airQuality !=null">air_quality = #{airQuality},</if>
<if test="sensibleTemperature !=null">sensible_temperature = #{sensibleTemperature},</if>
</trim>
where id = #{id}
</update>

@ -97,7 +97,7 @@
<if test="resourceId != null ">and t1.resource_id = #{resourceId}</if>
<if test="dimension != null and dimension != ''">and t1.dimension = #{dimension}</if>
<if test="dataSources != null and dataSources != ''">and t1.data_sources = #{dataSources}</if>
<if test="provinceSource != null and provinceSource != ''">t1.and province_source = #{provinceSource}</if>
<if test="provinceSource != null and provinceSource != ''">and t1.province_source = #{provinceSource}</if>
<if test="citySource != null and citySource != ''">and t1.city_source = #{citySource}</if>
and t1.del_flag !='2' and t2.del_flag !='2'
</where>

@ -144,7 +144,7 @@
</el-table-column>
<el-table-column align="center" label="区域" prop="provinceCode">
<template slot-scope="scope">
<soan>{{ scope.row.provinceCode || '/' }}</soan>
<soan>{{ scope.row.provinceName +''+scope.row.cityName+''+scope.row.countyName }}</soan>
</template>
</el-table-column>
<el-table-column align="center" label="天气" prop="weather">

Loading…
Cancel
Save