Browse Source

物联网 修复BUG

mengkang 4 years ago
parent
commit
cd474e2faa

+ 16 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -3,6 +3,7 @@ package com.yihu.iot.controller.common;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -76,4 +77,19 @@ public class IotSystemDictController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = IotRequestMapping.System.findByDictName)
    @ApiOperation(value = "根据字典名称获取字典信息",notes = "根据字典名称获取字典信息")
    public MixEnvelop<IotSystemDictVO,IotSystemDictVO> findDict(@ApiParam(name = "dictName", value = "字典名称")
                                                                 @RequestParam(value = "dictName", required = false) String dictName){
        try {
            List<IotSystemDictVO> systemDictVOS = iotSystemDictService.findDict(dictName);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,systemDictVOS);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 0 - 43
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotSystemDictController.java

@ -1,43 +0,0 @@
package com.yihu.iot.controller.dict;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/18
 */
@RestController
@RequestMapping(IotRequestMapping.Common.dict)
@Api(tags = "字典管理相关操作", description = "字典管理相关操作")
public class IotSystemDictController {
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @GetMapping(value = IotRequestMapping.Dict.findDict)
    @ApiOperation(value = "根据字典名称获取字典信息",notes = "根据字典名称获取字典信息")
    public MixEnvelop<IotSystemDictVO,IotSystemDictVO> findDict( @ApiParam(name = "dictName", value = "字典名称")
                                                                           @RequestParam(value = "dictName", required = false) String dictName){
        try {
            IotSystemDictVO  systemDictVO = iotSystemDictService.findDict(dictName);
            return MixEnvelop.getSuccess(IotRequestMapping.DeviceSim.message_success_find,systemDictVO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 2 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -786,10 +786,11 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyByAccount() {
        IotCompanyDO companyDO = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        IotCompanyVO companyVO = convertToModelVO(companyDO);
        if (companyDO==null){
            return MixEnvelop.getSuccess("未入驻企业",-1);
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,companyDO.getStatus());
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,companyVO);
    }

+ 6 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -304,7 +304,12 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO>  findPlanTimeByOrderNo(String orderNo,Integer page,Integer size) {
        List<IotDeviceQualityInspectionPlanDO> listOrderNo = iotDeviceQualityInspectionPlanDao.findByOrderNo(orderNo);
//        List<IotDeviceQualityInspectionPlanDO> listOrderNo = iotDeviceQualityInspectionPlanDao.findByOrderNo(orderNo);
        StringBuffer sql = new StringBuffer("SELECT c.* FROM  iot_device_quality_inspection_plan c WHERE del=1");
        sql.append(" and c.order_no = ").append(orderNo);
        sql.append(sql).append("  ORDER BY c.plan_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> listOrderNo = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        List<IotDeviceQualityInspectionPlanVO> list = transforList(listOrderNo);
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,list,page,size,count);

+ 10 - 6
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -10,10 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @author yeshijie on 2018/1/16.
@ -103,7 +100,14 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
        return list;
    }
    public IotSystemDictVO findDict(String dictName) {
        return null;
    /**
     * 获取字典信息
     * @param dictName
     * @return
     */
    public  List<IotSystemDictVO> findDict(String dictName) {
        List<IotSystemDictDO> listDO = iotSystemDictDao.findByDictName(dictName);
        List<IotSystemDictVO> iotSystemDictVOS = convertToModels(listDO, new ArrayList<>(listDO.size()), IotSystemDictVO.class);
        return iotSystemDictVOS;
    }
}

+ 7 - 11
svr/svr-iot/src/main/java/com/yihu/iot/service/message/IotMessageService.java

@ -48,22 +48,18 @@ public class IotMessageService  extends BaseJpaService<IotMessageDO, IotMessageD
     */
    public MixEnvelop<IotMessageDO, IotMessageDO> findAll(Integer page, Integer size) throws ParseException {
        String sqlunRead="SELECT * FROM iot_message WHERE read_msg=0 ORDER BY create_time DESC;";
        String sqlRead="SELECT * FROM iot_message WHERE read_msg=1 ORDER BY create_time DESC;";
        StringBuffer sql= new StringBuffer("SELECT * FROM iot_message");
        List<IotMessageDO> unlist = jdbcTemplate.query(sqlunRead, new BeanPropertyRowMapper<>(IotMessageDO.class));
        List<IotMessageDO> list = jdbcTemplate.query(sqlRead, new BeanPropertyRowMapper<>(IotMessageDO.class));
        sql.append(sql).append("  ORDER BY read_msg, create_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        Map<String, List> listMap = new HashMap<>();
        listMap.put("unread",unlist);
        listMap.put("read",list);
        List<IotMessageDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(IotMessageDO.class));
        long size2 = unlist.size();
        long size1 = list.size();
        long count = list.size();
        long count =size1+size2;
        return MixEnvelop.getSuccessMapWithPage(IotRequestMapping.Company.message_success_find_functions,listMap, page, size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,list, page, size,count);
    }
    /**

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

@ -171,10 +171,10 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
        StringBuffer sql = new StringBuffer("select c.* FROM iot_company_app c WHERE c.del=1 ");
        if(StringUtils.isNotBlank(name)){
            sql.append("and c.`name` like '%").append(name).append("%' OR c.company_name  LIKE  '%").append(name).append("%'");
            sql.append("and ( c.`name` like '%").append(name).append("%' OR c.company_name  LIKE  '%").append(name).append("%')");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        sql.append(" order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyAppDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotCompanyAppDO.class));