Przeglądaj źródła

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

ysj 5 lat temu
rodzic
commit
f4330a4e20

+ 5 - 5
svr/svr-iot-job/pom.xml

@ -67,11 +67,11 @@
            <version>2.4</version>
            <version>2.4</version>
        </dependency>
        </dependency>
        <!--<dependency>
            <groupId>com.yihu.iot</groupId>
            <artifactId>svr-iot</artifactId>
            <version>2.0.0</version>
        </dependency>-->
        <!--<dependency>-->
            <!--<groupId>com.yihu.iot</groupId>-->
            <!--<artifactId>svr-iot</artifactId>-->
            <!--<version>2.0.0</version>-->
        <!--</dependency>-->
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
            <artifactId>common-entity</artifactId>

+ 56 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/dao/IotDeviceDao.java

@ -0,0 +1,56 @@
package com.yihu.jw.repository.dao;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
 * @author yeshijie on 2017/12/1.
 */
public interface IotDeviceDao extends PagingAndSortingRepository<IotDeviceDO, String>, JpaSpecificationExecutor<IotDeviceDO> {
    @Query("from IotDeviceDO w where w.id =?1 and w.del=1")
    IotDeviceDO findById(String id);
    @Query("select count(*) from IotDeviceDO w where w.deviceSn =?1 and w.del=1")
    int countByDeviceSn(String deviceSn);
    @Query("select count(*) from IotDeviceDO w where w.purchaseId =?1 and w.del=1")
    int countByPurchaseId(String purchaseId);
    @Modifying
    @Query("update IotDeviceDO w set w.nextQualityTime=?1 where w.purchaseId =?2 and w.del=1")
    int updateQualityTime(Date nextQualityTime, String purchaseId);
    @Query("select count(*) from IotDeviceDO w where w.orderId =?1 and w.del=1")
    int countByOrderId(String orderId);
    @Query("from IotDeviceDO w where w.deviceSn =?1 and w.del=1")
    IotDeviceDO findByDeviceSn(String deviceSn);
    @Query("from IotDeviceDO w where w.simNo =?1 and w.del=1")
    IotDeviceDO findBySimNo(String simNo);
    @Query("from IotDeviceDO w where w.purchaseId =?1 and w.del=1")
    List<IotDeviceDO> findListByPurchaseId(String purchaseId);
    @Query("from IotDeviceDO w where w.orderId =?1 and w.del=1")
    List<IotDeviceDO> findListByOrderId(String orderId);
    List<IotDeviceDO> findListByInventoryLogId(String id);
    @Modifying
    @Query("update IotDeviceDO w set w.isGrant = ?2 where w.id = ?1 ")
    void updateIsGrantById(String deviceId, Integer isGrant);
    @Modifying
    @Query("update IotDeviceDO w set w.del = ?2 where w.id = ?1 ")
    void updateDelById(String id, int del);
}

+ 40 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/dao/IotDeviceQualityInspectionPlanDao.java

@ -0,0 +1,40 @@
package com.yihu.jw.repository.dao;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2017/12/1.
 */
public interface IotDeviceQualityInspectionPlanDao extends PagingAndSortingRepository<IotDeviceQualityInspectionPlanDO,String>,
        JpaSpecificationExecutor<IotDeviceQualityInspectionPlanDO> {
    @Query("from IotDeviceQualityInspectionPlanDO w where w.id =?1")
    IotDeviceQualityInspectionPlanDO findById(String id);
    @Query("from IotDeviceQualityInspectionPlanDO w where w.purchaseId =?1 and w.status=?2 and w.del=1 ORDER BY w.planTime desc ")
    List<IotDeviceQualityInspectionPlanDO> findListByPurchaseId(String purchaseId, String status);
    @Query("from IotDeviceQualityInspectionPlanDO w where w.deviceId =?1")
    IotDeviceQualityInspectionPlanDO findByDeviceId(String deviceId);
    @Query(value = "SELECT a.* from iot_device_quality_inspection_plan a WHERE a.purchase_id = ?1 and a.del=1 ORDER BY a.status asc,a.plan_time desc limit 1",nativeQuery = true)
    IotDeviceQualityInspectionPlanDO findLastByPurchaseId(String purchaseId);
    @Query(value = "SELECT a.* from iot_device_quality_inspection_plan a WHERE a.purchase_id = ?1 and a.status=?2 and a.del=1 ORDER BY a.plan_time desc limit 1",nativeQuery = true)
    IotDeviceQualityInspectionPlanDO findLastByPurchaseId(String purchaseId, String status);
    @Query(value = "SELECT a.* from iot_device_quality_inspection_plan a WHERE a.purchase_id = ?1 and a.status=?2 and a.del=1 ORDER BY a.plan_time asc limit 1",nativeQuery = true)
    IotDeviceQualityInspectionPlanDO findFirstByPurchaseId(String purchaseId, String status);
    @Query("from IotDeviceQualityInspectionPlanDO c where c.del=1 and c.orderNo=?1")
    List<IotDeviceQualityInspectionPlanDO> findByOrderNo(String orderNo);
    @Query("from IotDeviceQualityInspectionPlanDO c where c.del=1")
    List<IotDeviceQualityInspectionPlanDO> findAllByDel();
}

+ 24 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/dao/IotDeviceSimDao.java

@ -0,0 +1,24 @@
package com.yihu.jw.repository.dao;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
public interface IotDeviceSimDao extends PagingAndSortingRepository<IotDeviceSimDO,String>, JpaSpecificationExecutor<IotDeviceSimDO> {
    IotDeviceSimDO  findBySim(String sim);
    @Query("from IotDeviceSimDO c WHERE c.remainingBalance < 0 AND c.del=0")
    List<IotDeviceSimDO> findArrearsSim();
    @Query("from IotDeviceSimDO c WHERE c.status <>-1  and c.del=0 ")
    List<IotDeviceSimDO> findAllByDel();
}

+ 54 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/dao/IotPatientDeviceDao.java

@ -0,0 +1,54 @@
package com.yihu.jw.repository.dao;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotPatientDeviceDao extends PagingAndSortingRepository<IotPatientDeviceDO, String>,
        JpaSpecificationExecutor<IotPatientDeviceDO> {
    @Query("from IotPatientDeviceDO a where a.patient = ?1 and a.del=1 ")
    List<IotPatientDeviceDO> findByPatient(String patient);
    @Query("from IotPatientDeviceDO a where a.deviceSn = ?1 and a.del=1 ")
    List<IotPatientDeviceDO> findByDeviceSn(String deviceSn);
    @Query("from IotPatientDeviceDO a where a.deviceId = ?1 and a.del=1 ")
    List<IotPatientDeviceDO> findByDeviceId(String deviceId);
    @Query("from IotPatientDeviceDO a where a.patient = ?1 and a.deviceSn=?2 and a.del=1")
    List<IotPatientDeviceDO> findByPatientAndDeviceSn(String patient, String deviceSn);
    @Query("from IotPatientDeviceDO a where a.patient=?1 and a.del=1 ")
    List<IotPatientDeviceDO> findByPatient(String patient, Pageable pageRequest);
    @Query("from IotPatientDeviceDO a where a.categoryCode = ?2 and a.deviceSn=?1 and a.del=1 ")
    List<IotPatientDeviceDO> findByDeviceSnAndCategoryCode(String deviceSn, String categoryCode);
    @Query("from IotPatientDeviceDO a where a.patient = ?1 and a.deviceSn=?2 and a.del=1 ")
    IotPatientDeviceDO findByDeviceSnAndCategoryCodeAndUserType(String deviceSn, String categoryCode, String userType);
    @Query("from IotPatientDeviceDO a where a.userType = ?2 and a.deviceSn=?1 and a.del=1 ")
    IotPatientDeviceDO findByDeviceSnAndUserType(String deviceSn, String userType);
    //更换患者绑定的血糖仪
    @Modifying
    @Query("update IotPatientDeviceDO t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5 where t.patient = ?1 and t.deviceSn = ?2 and t.del=1 ")
    int updatePatientDevice(String patient, String deviceSN, String newDeviceSN, String userType, String sim);
    @Query("from IotPatientDeviceDO a where a.sim = ?1 and  a.del=1 ")
    IotPatientDeviceDO findBySim(String sim);
    @Modifying
    @Query("update IotPatientDeviceDO t set t.del = ?2 where t.id = ?1")
    void updateDelById(String id, int del);
}

+ 26 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/dao/IotSystemDictDao.java

@ -0,0 +1,26 @@
package com.yihu.jw.repository.dao;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotSystemDictDao extends PagingAndSortingRepository<IotSystemDictDO,String>,
        JpaSpecificationExecutor<IotSystemDictDO> {
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.parentCode,sort")
    List<IotSystemDictDO> findByDictName(String dictName);
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.code desc ")
    List<IotSystemDictDO> getAllByDictNameAndOrderByCodeDesc(String dictName);
    IotSystemDictDO findByDictNameAndCodeAndDel(String dictName, String code, Integer del);
    @Query("from IotSystemDictDO w where w.parentCode in (?1) and w.del = 1 ")
    List<IotSystemDictDO> findByParentCode(String parentCode);
}

+ 60 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/service/IotDeviceQualityInspectionPlanService.java

@ -0,0 +1,60 @@
package com.yihu.jw.repository.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.device.IotOrderPurchaseDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.repository.dao.IotDeviceDao;
import com.yihu.jw.repository.dao.IotDeviceQualityInspectionPlanDao;
import com.yihu.jw.repository.dao.IotSystemDictDao;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author yeshijie on 2017/12/8.
 */
@Service
@Transactional
public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDeviceQualityInspectionPlanDO, IotDeviceQualityInspectionPlanDao> {
    @Autowired
    private IotDeviceQualityInspectionPlanDao iotDeviceQualityInspectionPlanDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    /**
     * 查询所有需要提醒的质检信息
     * @param time
     * @return
     */
    public List<IotDeviceQualityInspectionPlanDO>  findListAll(String time){
        StringBuffer sql = new StringBuffer("SELECT c.* FROM  iot_device_quality_inspection_plan c WHERE del=1");
        List<Object> args = new ArrayList<>();
        if (StringUtils.isNotBlank(time)){
            sql.append("  and DATEDIFF(c.plan_time,CURRENT_TIMESTAMP)=?");
            args.add(time);
        }
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        return list;
    }
}

+ 212 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/service/IotDeviceSimService.java

@ -0,0 +1,212 @@
package com.yihu.jw.repository.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.repository.dao.IotDeviceDao;
import com.yihu.jw.repository.dao.IotDeviceSimDao;
import com.yihu.jw.repository.dao.IotPatientDeviceDao;
import com.yihu.jw.repository.dao.IotSystemDictDao;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
@Service
@Transactional
public class IotDeviceSimService extends BaseJpaService<IotDeviceSimDO, IotDeviceSimDao> {
    @Autowired
    private IotPatientDeviceDao iotPatientDeviceDao;
    @Autowired
    private IotDeviceSimDao iotDeviceSimDao;
    @Autowired
    private IotDeviceDao iotDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    private final static String jobUrl = "http://localhost:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
    /**
     * 增加SIM卡管理
     * @param advancePayment
     * @param payment
     * @param remainingBalance
     * @param status
     */
    public void editSIM(String id,String advancePayment,String payment,String remainingBalance,Integer status ) {
        IotDeviceSimDO simDO = iotDeviceSimDao.findOne(id);
        simDO.setAdvancePayment(Float.parseFloat(advancePayment));
        simDO.setPayment(Float.parseFloat(payment));
        simDO.setRemainingBalance(Float.parseFloat(remainingBalance));
        simDO.setStatus(status);
        iotDeviceSimDao.save(simDO);
    }
    /**
     *新增SIM卡
     * @param json
     */
    public MixEnvelop<IotOrderVO, IotOrderVO> addSIM(String json) {
        IotDeviceSimDO sim = JSONObject.parseObject(json, IotDeviceSimDO.class);
        IotDeviceSimDO deviceSimDaoBySim = iotDeviceSimDao.findBySim(sim.getSim());
        if(deviceSimDaoBySim!=null){
            return MixEnvelop.getError("SIM已存在");
        }
        IotPatientDeviceDO patientSim = iotPatientDeviceDao.findBySim(sim.getSim());
        if (patientSim!=null){
            sim.setDeviceName(patientSim.getDeviceName());
            sim.setDeviceSn(patientSim.getDeviceSn());
            sim.setContactsName(patientSim.getPatientName());
            sim.setContactsMobile(patientSim.getMobile());
        } else {
            IotDeviceDO deviceSim = iotDeviceDao.findBySimNo(sim.getSim());
            if (deviceSim!=null){
                sim.setDeviceName(deviceSim.getName());
                sim.setDeviceSn(deviceSim.getDeviceSn());
            }
        }
        sim.setRemainingBalance(sim.getAdvancePayment()-sim.getPayment());
        sim.setStatus(1);
        sim.setDel("0");
        iotDeviceSimDao.save(sim);
        return MixEnvelop.getSuccess(IotRequestMapping.DeviceSim.message_success_add);
    }
    /**
     * 条件分页查找
     * @param page
     * @param size
     * @param status
     * @param sim
     * @param sn
     * @return
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE 1=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_sim c  WHERE 1=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append("and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(sim)){
            sql.append(" and (c.sim like '%").append(sim).append("%')");
            sqlCount.append(" and (c.sim like '%").append(sim).append("%')");
        }
        if(StringUtils.isNotBlank(sn)){
            sql.append(" and (c.device_sn like '%").append(sn).append("%')");
            sqlCount.append(" and (c.device_sn like '%").append(sn).append("%')");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.DeviceSim.message_success_find,list, page, size,count);
    }
    /**
     * 分页查找所有应用SIM卡信息
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> findAllSim(Integer page, Integer size) {
        StringBuffer sql= new StringBuffer("SELECT DISTINCT * FROM iot_device_sim ");
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.DeviceSim.message_success_find,list,page, size,count);
    }
    /**
     *SIM余额提醒
     * @param time
     * @param money
     * @param status
     */
    public void remind(String time, String money, String status) {
        IotSystemDictDO sim = iotSystemDictDao.findByDictName("SIM_BALANCE_REMIND").get(0);
        sim.setCode(money);
        sim.setStatus(Integer.parseInt(status));
        sim.setTime(time);
        iotSystemDictDao.save(sim);
        //触发JOB工程
        httpClientUtil.get(jobUrl,"UTF-8");
    }
    /**
     * 获取所有需要余额提醒的SIM卡
     * @param time
     * @param code
     * @return
     */
    public List<IotDeviceSimDO> findAllRemindSim(String time, String code) {
        StringBuffer sql = new StringBuffer("SELECT a.* FROM iot_device_sim a WHERE 1=1");
        List<Object> args = new ArrayList<>();
        if (StringUtils.isNotBlank(time)){
            sql.append("  AND DAY(CURRENT_TIMESTAMP)=?");
            args.add(time);
        }
        if(StringUtils.isNotBlank(code)){
            sql.append(" and a.remaining_balance <=? ");
            args.add(code);
        }
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        return list;
    }
}

+ 74 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/service/IotSystemDictService.java

@ -0,0 +1,74 @@
package com.yihu.jw.repository.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.repository.dao.IotSystemDictDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.stereotype.Service;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.*;
/**
 * @author yeshijie on 2018/1/16.
 */
@Service
public class IotSystemDictService extends BaseJpaService<IotSystemDictDO, IotSystemDictDao> {
    /**
     * 查询字典
     * @param dictName
     * @return
     */
    public Map<String,String> findByDictName(String dictName){
        String sql = "SELECT code,value from iot_system_dict WHERE dict_name = ? and del = 1 ORDER BY sort";
        Map<String,String> map = new HashMap<>();
        List<JSONObject> list = queryJson(sql,new Object[]{dictName});
        list.forEach(json->{
            map.put(json.get("code").toString(),json.getString("value"));
        });
        return map;
    }
    /**
     * jdbc查询返回json
     * @param sql
     * @param args
     * @return
     * @throws DataAccessException
     */
    public List<JSONObject> queryJson(String sql, Object[] args) throws DataAccessException {
        return jdbcTemplate.query(sql, args, new ResultSetExtractor<List<JSONObject>>() {
            @Override
            public List<JSONObject> extractData(ResultSet resultSet) throws SQLException, DataAccessException {
                ResultSetMetaData rsd = resultSet.getMetaData();
                int clength = rsd.getColumnCount();
                List<JSONObject> li = new ArrayList<JSONObject>();
                String columnName;
                try {
                    while (resultSet.next()) {
                        JSONObject jo = new JSONObject();
                        for (int i = 0; i < clength; i++) {
                            columnName = rsd.getColumnLabel(i + 1);
                            jo.put(columnName, resultSet.getObject(i + 1));
                        }
                        li.add(jo);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return li;
            }
        });
    }
}

+ 5 - 4
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/DeviceQualityPlanService.java

@ -1,11 +1,12 @@
package com.yihu.jw.service.device;
package com.yihu.jw.service.device;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.device.IotDeviceQualityInspectionPlanService;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.repository.dao.IotSystemDictDao;
import com.yihu.jw.repository.message.IotMessageDao;
import com.yihu.jw.repository.message.IotMessageDao;
import com.yihu.jw.repository.service.IotDeviceQualityInspectionPlanService;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -29,10 +30,10 @@ public class DeviceQualityPlanService {
    private IotMessageDao iotMessageDao;
    private IotMessageDao iotMessageDao;
    @Autowired
    @Autowired
    private  IotDeviceQualityInspectionPlanService iotDeviceQualityInspectionPlanService;
    private IotDeviceQualityInspectionPlanService iotDeviceQualityInspectionPlanService;
    @Autowired
    @Autowired
    private  IotSystemDictDao iotSystemDictDao;
    private IotSystemDictDao iotSystemDictDao;
    public  void autoPush() {
    public  void autoPush() {

+ 5 - 4
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/SimBalanceService.java

@ -1,12 +1,13 @@
package com.yihu.jw.service.device;
package com.yihu.jw.service.device;
import com.yihu.iot.dao.device.IotDeviceSimDao;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.iot.service.device.IotDeviceSimService;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.repository.dao.IotDeviceSimDao;
import com.yihu.jw.repository.dao.IotSystemDictDao;
import com.yihu.jw.repository.message.IotMessageDao;
import com.yihu.jw.repository.service.IotDeviceSimService;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;

+ 2 - 1
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/SimSetMealService.java

@ -1,7 +1,8 @@
package com.yihu.jw.service.device;
package com.yihu.jw.service.device;
import com.yihu.iot.dao.device.IotDeviceSimDao;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.repository.dao.IotDeviceSimDao;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;

+ 5 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java

@ -147,10 +147,13 @@ public class IotInterfaceAuditController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.InterfaceAudit.QueryCompanyApp)
    @GetMapping(value = IotRequestMapping.InterfaceAudit.QueryCompanyApp)
    @ApiOperation(value = "分页查询企业下应用接口申请",notes = "分页查询企业下应用接口申请")
    @ApiOperation(value = "分页查询企业下应用接口申请",notes = "分页查询企业下应用接口申请")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> QueryCompanyApp(){
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> QueryCompanyApp( @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                    @RequestParam(value = "page", required = false) Integer page,
                                                                                @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                    @RequestParam(value = "size", required = false) Integer size){
        try {
        try {
            return iotInterfaceAuditService.QueryCompanyApp();
            return iotInterfaceAuditService.QueryCompanyApp(page,size);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
            return MixEnvelop.getError(e.getMessage());

+ 9 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java

@ -65,7 +65,10 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
     */
     */
    public void addInterfaceApplyFor(String json, String ids) {
    public void addInterfaceApplyFor(String json, String ids) {
        IotInterfaceAuditDO iotInterfaceAuditDO = JSONObject.parseObject(json, IotInterfaceAuditDO.class);
        IotInterfaceAuditDO iotInterfaceAuditDO = JSONObject.parseObject(json, IotInterfaceAuditDO.class);
        iotInterfaceAuditDO.setTime(DateUtil.getNowDate());
        iotInterfaceAuditDO.setTime(DateUtil.getNowDate());
        iotInterfaceAuditDO.setStatus("2");
        iotInterfaceAuditDao.save(iotInterfaceAuditDO);
        iotInterfaceAuditDao.save(iotInterfaceAuditDO);
        List<String> list = JSONObject.parseObject(ids, List.class);
        List<String> list = JSONObject.parseObject(ids, List.class);
@ -225,15 +228,19 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
     * 分页查询企业下应用接口申请列表
     * 分页查询企业下应用接口申请列表
     * @return
     * @return
     */
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> QueryCompanyApp() {
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> QueryCompanyApp(Integer page, Integer size) {
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUNAME());
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUNAME());
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        sql.append("WHERE company_name = '").append(account.getName()).append("'");
        sql.append("WHERE company_name = '").append(account.getName()).append("'");
        sql.append(" order by time desc  limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,list);
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
    }
}
}