jinpengyong
2023-10-10 f0837ee21f7650d4413830d4ee90da02bcdd6d36
Merge remote-tracking branch 'origin/wb' into qa

# Conflicts:
# screen-manage/src/main/java/com/moral/api/controller/ManageCoordinateController.java
# screen-manage/src/main/java/com/moral/api/service/impl/ManageCoordinateDetailServiceImpl.java
20 files modified
283 ■■■■■ changed files
screen-api/src/main/java/com/moral/api/config/mybatis/MybatisPlusConfig.java 18 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/exception/consumer/CruiserDataConsumer.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/exception/consumer/SecondDataConsumer.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/HistoryFiveMinutelyMapper.java 5 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/HistoryHourlyMapper.java 4 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/HistorySecondCruiserMapper.java 2 ●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java 32 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java 36 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java 39 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryHourlyServiceImpl.java 53 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/application-dev.yml 2 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/DeviceMapper.xml 4 ●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml 11 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml 36 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml 4 ●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/entity/SysDictType.java 1 ●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/kafka/consumer/DeviceConsumer.java 11 ●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/mapper/SysDictTypeMapper.java 2 ●●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/service/impl/SysDictTypeServiceImpl.java 5 ●●●● patch | view | raw | blame | history
screen-manage/src/main/resources/mapper/SysDictTypeMapper.xml 14 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/config/mybatis/MybatisPlusConfig.java
@@ -1,12 +1,16 @@
package com.moral.api.config.mybatis;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.parsers.DynamicTableNameParser;
import com.baomidou.mybatisplus.extension.parsers.ITableNameHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.handler.TableNameHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.moral.api.entity.HistoryFiveMinutely;
import com.moral.api.mapper.HistoryFiveMinutelyMapper;
import com.moral.api.service.HistorySecondUavService;
@@ -14,10 +18,13 @@
import com.moral.api.service.impl.OrganizationServiceImpl;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -25,7 +32,7 @@
/*@Configuration*/
public class MybatisPlusConfig {
    public static ThreadLocal<String> tableName = new ThreadLocal<>();
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
@@ -42,8 +49,15 @@
        dynamicTableNameInnerInterceptor.setTableNameHandlerMap(map);
        interceptor.addInnerInterceptor(dynamicTableNameInnerInterceptor);
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
    @Bean
    public ConfigurationCustomizer configurationCustomizer() {
        return configuration -> configuration.setUseDeprecatedExecutor(false);
    }
    public static ThreadLocal<String> tableName = new ThreadLocal<>();
}
screen-api/src/main/java/com/moral/api/exception/consumer/CruiserDataConsumer.java
@@ -34,7 +34,7 @@
//@Component
@Component
@Slf4j
public class CruiserDataConsumer  implements ConsumerSeekAware {
screen-api/src/main/java/com/moral/api/exception/consumer/SecondDataConsumer.java
@@ -38,7 +38,7 @@
//@Component
@Component
@Slf4j
public class SecondDataConsumer implements ConsumerSeekAware {
screen-api/src/main/java/com/moral/api/mapper/HistoryFiveMinutelyMapper.java
@@ -5,6 +5,7 @@
import com.moral.api.entity.HistoryFiveMinutely;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moral.api.entity.HistoryHourly;
import com.moral.api.pojo.dto.Wind.WindData;
/**
@@ -19,4 +20,8 @@
    List<WindData> getAreaWindData(Map<String, Object> params);
    List<HistoryFiveMinutely> listResult(Map<String, Object> params);
    List<HistoryFiveMinutely> listResultOne(Map<String, Object> params);
}
screen-api/src/main/java/com/moral/api/mapper/HistoryHourlyMapper.java
@@ -42,4 +42,8 @@
    void insertHistoryHourly(Map<String, Object> params);
    void updateHistoryHourly(Map<String, Object> params);
    List<HistoryHourly> listResult(Map<String, Object> params);
    List<HistoryHourly> listLikeResult(Map<String, Object> params);
}
screen-api/src/main/java/com/moral/api/mapper/HistorySecondCruiserMapper.java
@@ -26,7 +26,7 @@
    String  getDaily(Map<String,Object> params);
    List<Double> getDust(String start,String end,String mac);
    List<String> getDust(String start,String end,String mac);
    List<Map<String,Object>> getDusts(Map<String,Object> params);
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
@@ -229,10 +229,11 @@
            Date endDate = DateUtils.getDate(endTime,DateUtils.yyyy_MM_dd_HH_EN);
            List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH);
            for (String mac:macs) {
                QueryWrapper<HistoryHourly> wrapper = new QueryWrapper<>();
                wrapper.eq("mac", mac);
                wrapper.between("time", startDate, endDate);
                List<HistoryHourly> historyHourlies = multiTableQuery(wrapper, tableNames);
                Map<String, Object> mapParams = new HashMap<>();
                mapParams.put("startDate",startDate);
                mapParams.put("endDate",endDate);
                mapParams.put("mac",mac);
                List<HistoryHourly> historyHourlies = multiTableQuery(mapParams, tableNames);
                historyHourlies = historyHourlies.stream().distinct().collect(Collectors.toList());
                List<HistoryHourly> distinctHistoryHourlies = new ArrayList<>();
                Map<String, Object> disMap = new HashMap<>();
@@ -340,10 +341,11 @@
            Date endDate = DateUtils.getDate(endTime,DateUtils.yyyy_MM_dd_HH_mm_ss_EN);
            List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH);
            for (String mac:macs) {
                QueryWrapper<HistoryFiveMinutely> wrapper = new QueryWrapper<>();
                wrapper.eq("mac", mac);
                wrapper.between("time", startDate, endDate);
                List<HistoryFiveMinutely> HistoryFiveMinutelys = FiveMinuteTableQuery(wrapper, tableNames);
                Map<String, Object> mapParams = new HashMap<>();
                mapParams.put("startDate",startDate);
                mapParams.put("endDate",endDate);
                mapParams.put("mac",mac);
                List<HistoryFiveMinutely> HistoryFiveMinutelys = FiveMinuteTableQuery(mapParams, tableNames);
                HistoryFiveMinutelys = HistoryFiveMinutelys.stream().distinct().collect(Collectors.toList());
                List<HistoryFiveMinutely> distinctHistoryHourlies = new ArrayList<>();
                Map<String, Object> disMap = new HashMap<>();
@@ -539,25 +541,23 @@
     * @Author: 陈凯裕
     * @Date: 2021/9/23
     */
    private List<HistoryHourly> multiTableQuery(QueryWrapper<HistoryHourly> wrapper, List<String> tableNames) {
    private List<HistoryHourly> multiTableQuery(Map<String, Object> params, List<String> tableNames) {
        List<HistoryHourly> result = new ArrayList<>();
        for (String tableName : tableNames) {
            MybatisPlusConfig.tableName.set(tableName);
            List<HistoryHourly> datas = historyHourlyMapper.selectList(wrapper);
            params.put("table",tableName);
            List<HistoryHourly> datas = historyHourlyMapper.listResult(params);
            result.addAll(datas);
        }
        MybatisPlusConfig.tableName.remove();
        return result;
    }
    private List<HistoryFiveMinutely> FiveMinuteTableQuery(QueryWrapper<HistoryFiveMinutely> wrapper, List<String> tableNames) {
    private List<HistoryFiveMinutely> FiveMinuteTableQuery(Map<String, Object> params, List<String> tableNames) {
        List<HistoryFiveMinutely> result = new ArrayList<>();
        for (String tableName : tableNames) {
            MybatisPlusConfig.tableName.set(tableName);
            List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.selectList(wrapper);
            params.put("table",tableName);
            List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.listResult(params);
            result.addAll(datas);
        }
        MybatisPlusConfig.tableName.remove();
        return result;
    }
screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java
@@ -90,29 +90,25 @@
            for (TimeForm timeForm : tables) {
                String start = timeForm.getStart();
                String end = timeForm.getEnd();
                List<Double> dust = historySecondCruiserMapper.getDust(start, end, mac);
                List<String> dust = historySecondCruiserMapper.getDust(start, end, mac);
                ArrayList<Double> rsDouble = new ArrayList<>();
                for (Double aDouble : dust) {
                    double v =0.0;
                for (String s : dust) {
                    double aDouble = Double.parseDouble(s);
                    if (aDouble>=0 && aDouble<40 ){
                        v = aDouble + 170;
                        aDouble = aDouble + 170;
                    }else if (aDouble>=40 && aDouble<60){
                        aDouble = aDouble + 130;
                    }else if (aDouble>=60 && aDouble<100 ){
                        aDouble = aDouble + 110;
                    }else if (aDouble>=100 && aDouble<150){
                        aDouble = aDouble + 70;
                    }else if (aDouble>=150 && aDouble<180){
                        aDouble = aDouble + 30;
                    }else {
                        aDouble= aDouble+0;
                    }
                    if (aDouble>=40 && aDouble<60 ){
                        v = aDouble + 130;
                    }
                    if (aDouble>=60 && aDouble<100 ){
                        v = aDouble + 110;
                    }
                    if (aDouble>=100 && aDouble<150 ){
                        v = aDouble + 70;
                    }
                    if (aDouble>=150 && aDouble<180 ){
                        v = aDouble + 30;
                    }
                    if (aDouble>=180){
                        v= aDouble;
                    }
                    rsDouble.add(v);
                    rsDouble.add(aDouble);
                }
                list.addAll(rsDouble);
            }
screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java
@@ -141,14 +141,12 @@
        //如果没有数据从数据库查询
        if (sensorValues != null)
            return sensorValues;
        QueryWrapper<HistoryFiveMinutely> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mac", mac);
        queryWrapper.orderByDesc("time");
        queryWrapper.last("limit 0,1");
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("mac",mac);
        //获取当月的表名
        Date date = new Date();
        List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date, date, SeparateTableType.MONTH);
        List<HistoryFiveMinutely> datas = multiTableQuery(queryWrapper, tableNames);
        List<HistoryFiveMinutely> datas = multiTableQuery(mapParams, tableNames);
        if (ObjectUtils.isEmpty(datas))
            return null;
        HistoryFiveMinutely historyFiveMinutely = datas.get(0);
@@ -386,9 +384,9 @@
        int nx = (int) Math.floor((lo2 - lo1) / dx);
        int ny = (int) Math.floor((la1 - la2) / dy);
        List<Double> uList = new ArrayList<>();
        List<Double> vList = new ArrayList<>();
        int nums = Objects.nonNull(nx*ny)?nx*ny+100:100;
        List<Double> uList = new ArrayList<>(nums);
        List<Double> vList = new ArrayList<>(nums);
        int x;
        int y;
@@ -480,11 +478,12 @@
     * @Date: 2021/9/23
     */
    public List<HistoryFiveMinutely> getValueByMacAndTime(String mac, Date startDate, Date endDate) {
        QueryWrapper<HistoryFiveMinutely> wrapper = new QueryWrapper<>();
        wrapper.eq("mac", mac);
        wrapper.between("time", startDate, endDate);
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("startDate",startDate);
        mapParams.put("endDate",endDate);
        mapParams.put("mac",mac);
        List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH);
        List<HistoryFiveMinutely> datas = multiTableQuery(wrapper, tableNames);
        List<HistoryFiveMinutely> datas = multiTableQueryResult(mapParams, tableNames);
        return datas;
    }
@@ -496,14 +495,22 @@
     * @Author: 陈凯裕
     * @Date: 2021/9/23
     */
    private List<HistoryFiveMinutely> multiTableQuery(QueryWrapper<HistoryFiveMinutely> wrapper, List<String> tableNames) {
    private List<HistoryFiveMinutely> multiTableQuery(Map<String, Object> params, List<String> tableNames) {
        List<HistoryFiveMinutely> result = new ArrayList<>();
        for (String tableName : tableNames) {
            MybatisPlusConfig.tableName.set(tableName);
            List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.selectList(wrapper);
            params.put("table",tableName);
            List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.listResultOne(params);
            result.addAll(datas);
        }
        MybatisPlusConfig.tableName.remove();
        return result;
    }
    private List<HistoryFiveMinutely> multiTableQueryResult(Map<String, Object> params, List<String> tableNames) {
        List<HistoryFiveMinutely> result = new ArrayList<>();
        for (String tableName : tableNames) {
            params.put("table",tableName);
            List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.listResult(params);
            result.addAll(datas);
        }
        return result;
    }
}
screen-api/src/main/java/com/moral/api/service/impl/HistoryHourlyServiceImpl.java
@@ -746,43 +746,44 @@
     */
    @Override
    public List<HistoryHourly> getValueByMacAndTime(String mac, Date startDate, Date endDate) {
        QueryWrapper<HistoryHourly> wrapper = new QueryWrapper<>();
        wrapper.eq("mac", mac);
        wrapper.between("time", startDate, endDate);
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("startDate",startDate);
        mapParams.put("endDate",endDate);
        mapParams.put("mac",mac);
        List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH);
        List<HistoryHourly> datas = multiTableQuery(wrapper, tableNames);
        List<HistoryHourly> datas = multiTableQuery(mapParams, tableNames);
        return datas;
    }
    @Override
    public List<HistoryHourly> getValueByMacAndTime(List<String> mac, Date startDate, Date endDate) {
        QueryWrapper<HistoryHourly> wrapper = new QueryWrapper<>();
        wrapper.in("mac", mac);
        wrapper.between("time", startDate, endDate);
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("startDate",startDate);
        mapParams.put("endDate",endDate);
        mapParams.put("macs",mac);
        List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH);
        List<HistoryHourly> datas = multiTableQuery(wrapper, tableNames);
        List<HistoryHourly> datas = multiTableQuery(mapParams, tableNames);
        return datas;
    }
    @Override
    public List<HistoryHourly> getValueByMacs(List<String> macs, String time) {
        QueryWrapper<HistoryHourly> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("time", "value")
                .likeRight("time", time)
                .in("mac", macs);
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("time",time);
        mapParams.put("macs",macs);
        Date date = DateUtils.getDate(time, DateUtils.yyyy_MM_dd_EN);
        List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date, date, SeparateTableType.MONTH);
        return multiTableQuery(queryWrapper, tableNames);
        return multiTableQueryLike(mapParams, tableNames);
    }
    @Override
    public List<HistoryHourly> getHourlyDataByMacs(List<String> macs, String time) {
        QueryWrapper<HistoryHourly> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("mac","time", "value")
                .likeRight("time", time)
                .in("mac", macs);
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("time",time);
        mapParams.put("macs",macs);
        Date date = DateUtils.getDate(time, DateUtils.yyyy_MM_dd_EN);
        List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date, date, SeparateTableType.MONTH);
        return multiTableQuery(queryWrapper, tableNames);
        return multiTableQueryLike(mapParams, tableNames);
    }
    @Override
@@ -848,14 +849,22 @@
     * @Author: 陈凯裕
     * @Date: 2021/9/23
     */
    private List<HistoryHourly> multiTableQuery(QueryWrapper<HistoryHourly> wrapper, List<String> tableNames) {
    private List<HistoryHourly> multiTableQuery(Map<String, Object> params, List<String> tableNames) {
        List<HistoryHourly> result = new ArrayList<>();
        for (String tableName : tableNames) {
            MybatisPlusConfig.tableName.set(tableName);
            List<HistoryHourly> datas = historyHourlyMapper.selectList(wrapper);
            params.put("table",tableName);
            List<HistoryHourly> datas = historyHourlyMapper.listResult(params);
            result.addAll(datas);
        }
        MybatisPlusConfig.tableName.remove();
        return result;
    }
    private List<HistoryHourly> multiTableQueryLike(Map<String, Object> params, List<String> tableNames) {
        List<HistoryHourly> result = new ArrayList<>();
        for (String tableName : tableNames) {
            params.put("table",tableName);
            List<HistoryHourly> datas = historyHourlyMapper.listLikeResult(params);
            result.addAll(datas);
        }
        return result;
    }
screen-api/src/main/resources/application-dev.yml
@@ -1,5 +1,7 @@
server:
  port: 8081
  servlet:
    context-path: /api
spring:
  profiles:
    active: dev
screen-api/src/main/resources/mapper/DeviceMapper.xml
@@ -39,8 +39,8 @@
            <foreach collection="macs" item="mac" index="index" open="(" close=")" separator=",">
                #{mac}
            </foreach>
        AND `time` <![CDATA[>=]]> #{start}
        AND `time` <![CDATA[<]]> #{end}
        AND DATE_FORMAT(`time`,'%Y-%m-%d %H') <![CDATA[>=]]> #{start}
        AND DATE_FORMAT(`time`,'%Y-%m-%d %H') <![CDATA[<]]> #{end}
        ORDER BY `time`
    </select>
    <select id="deviceList" resultType="java.util.Map">
screen-api/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
@@ -21,4 +21,15 @@
        AND h.time = (SELECT max(time) FROM history_five_minutely_${timeUnits})
    </select>
    <select id="listResult" resultType="com.moral.api.entity.HistoryFiveMinutely">
        SELECT mac,time,value FROM history_five_minutely${table}
        WHERE (mac = #{mac} AND time BETWEEN #{startDate} AND #{endDate})
        order by time desc
    </select>
    <select id="listResultOne" resultType="com.moral.api.entity.HistoryFiveMinutely">
        SELECT mac,time,value FROM history_five_minutely${table}
        WHERE (mac = #{mac})
        order by time desc
        limit 1
    </select>
</mapper>
screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml
@@ -86,4 +86,40 @@
        UPDATE history_hourly_${timeUnits} SET `value` = #{value}
        where mac =  #{mac} and time = #{time} and version = #{version}
    </insert>
    <select id="listResult" resultType="com.moral.api.entity.HistoryHourly">
        SELECT mac,time,value,version FROM history_hourly${table}
         WHERE 1 =1
         <if test="macs != null and macs.size!=0">
             and mac in
             <foreach collection="macs" item="id" index="index" open="(" close=")" separator=",">
                 #{id}
             </foreach>
         </if>
         <if test="mac != null and mac != ''">
            and mac = #{mac}
         </if>
         and time BETWEEN #{startDate} and #{endDate}
        order by time desc
    </select>
    <select id="listLikeResult" resultType="com.moral.api.entity.HistoryHourly">
        SELECT mac,time,value,version FROM history_hourly${table}
        WHERE 1 =1
        <if test="macs != null and macs.size!=0">
            and mac in
            <foreach collection="macs" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </if>
        <if test="mac != null and mac != ''">
            and mac = #{mac}
        </if>
        and time like concat(#{time},'%')
        order by time desc
    </select>
</mapper>
screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml
@@ -50,8 +50,8 @@
          AND `time` <![CDATA[<=]]> #{time2}
    </select>
    <select id="getDust" resultType="java.lang.Double">
        select JSON_EXTRACT(value,'$.dustld')
    <select id="getDust" resultType="java.lang.String">
        select value ->>'$.dustld'
        from `history_second_cruiser`
        WHERE mac = #{mac}
          AND `time` <![CDATA[>=]]> #{start}
screen-manage/src/main/java/com/moral/api/entity/SysDictType.java
@@ -46,6 +46,7 @@
    /*
    * 1:系统内置,无法更改 0:可以更改
    * */
    @TableField("`system`")
    private Integer system;
    /**
screen-manage/src/main/java/com/moral/api/kafka/consumer/DeviceConsumer.java
@@ -1,8 +1,10 @@
/*
package com.moral.api.kafka.consumer;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSON;
import com.moral.api.service.*;
import com.moral.constant.KafkaConstants;
import com.moral.constant.RedisConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,16 +14,9 @@
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.moral.constant.KafkaConstants;
import com.moral.constant.RedisConstants;
screen-manage/src/main/java/com/moral/api/mapper/SysDictTypeMapper.java
@@ -2,6 +2,7 @@
import com.moral.api.entity.SysDictType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
 * <p>
@@ -13,4 +14,5 @@
 */
public interface SysDictTypeMapper extends BaseMapper<SysDictType> {
    SysDictType listOne(@Param("name") String name);
}
screen-manage/src/main/java/com/moral/api/service/impl/SysDictTypeServiceImpl.java
@@ -124,10 +124,7 @@
        //获取要插入的实体
        SysDictType sysDictType = form.formConvertEntity();
        //判断name是否已经存在
        QueryWrapper<SysDictType> existNameWrapper = new QueryWrapper<>();
        existNameWrapper.eq("name",sysDictType.getName());
        existNameWrapper.eq("is_delete",Constants.NOT_DELETE);
        SysDictType existType = sysDictTypeMapper.selectOne(existNameWrapper);
        SysDictType existType = sysDictTypeMapper.listOne(sysDictType.getName());
        if(!ObjectUtils.isEmpty(existType)){
            dto.setCode(ResponseCodeEnum.DICTTYPE_EXIST.getCode());
            dto.setMsg(ResponseCodeEnum.DICTTYPE_EXIST.getMsg());
screen-manage/src/main/resources/mapper/SysDictTypeMapper.xml
@@ -12,4 +12,18 @@
                    <result column="is_delete" property="isDelete" />
        </resultMap>
    <select id="listOne" resultType="com.moral.api.entity.SysDictType">
        SELECT
            t.id,
            t.name,
            t.desc,
            t.system,
            t.create_time,
            t.update_time,
            t.is_delete
        FROM
            sys_dict_type t
        WHERE
            t.name =#{name}  AND is_delete = '0'
    </select>
</mapper>