Shi Kejing 4 years ago
parent
commit
5f9d66b3b4

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java

@ -19,6 +19,8 @@ public class AesEncryptUtils {
    //参数分别代表 算法名称/加密模式/数据填充方式
    private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding";
    //AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
    /**
     * 加密
     * @param content 加密的字符串

+ 5 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotM.java

@ -1,8 +1,10 @@
package com.yihu.iot.service.analyzer;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@ -74,6 +76,7 @@ public class WlyyIotM extends UuidIdentityEntity implements Serializable {
        this.deviceModel = deviceModel;
    }
    @Convert(converter = StringFStringEncryptConverter.class)
    public String getIdCardNo() {
        return idCardNo;
    }
@ -82,6 +85,7 @@ public class WlyyIotM extends UuidIdentityEntity implements Serializable {
        this.idCardNo = idCardNo;
    }
    @Convert(converter = StringFStringEncryptConverter.class)
    public String getUserName() {
        return userName;
    }
@ -114,6 +118,7 @@ public class WlyyIotM extends UuidIdentityEntity implements Serializable {
        this.doctorId = doctorId;
    }
    @Convert(converter = StringFStringEncryptConverter.class)
    public String getDoctorName() {
        return doctorName;
    }

+ 19 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -9,6 +9,7 @@ import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.*;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
@ -158,6 +159,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        list.forEach(one->{
            IotCompanyVO companyVO = convertToModelVO(one);
            companyVO.setContactsIdcard(AesEncryptUtils.decrypt(companyVO.getContactsIdcard()));
            companyVO.setContactsMobile(AesEncryptUtils.decrypt(companyVO.getContactsMobile()));
            companyVO.setContactsName(AesEncryptUtils.decrypt(companyVO.getContactsName()));
            companyVO.setOfficePhone(AesEncryptUtils.decrypt(companyVO.getOfficePhone()));
            companyVO.setCreateUserName(AesEncryptUtils.decrypt(companyVO.getCreateUserName()));
            companyVO.setUpdateUserName(AesEncryptUtils.decrypt(companyVO.getUpdateUserName()));
            listVO.add(companyVO);
        });
@ -275,10 +282,22 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        if(StringUtils.isBlank(type)){
            //得到list数据
            list.forEach(one->{
                one.setContactsIdcard(AesEncryptUtils.decrypt(one.getContactsIdcard()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setOfficePhone(AesEncryptUtils.decrypt(one.getOfficePhone()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
                findAppType(one);
            });
        }else {
            list.forEach(one->{
                one.setContactsIdcard(AesEncryptUtils.decrypt(one.getContactsIdcard()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setOfficePhone(AesEncryptUtils.decrypt(one.getOfficePhone()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
                findType(one);
            });
        }

+ 9 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java

@ -13,6 +13,7 @@ import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceInventoryLogDO;
import com.yihu.jw.entity.iot.device.IotDeviceOrderDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.IotDeviceInventoryLogVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -236,9 +237,17 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotDeviceInventoryLogVO> inventoryLogVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotDeviceInventoryLogVO.class));
            for (int i=0;i<inventoryLogVOList.size();i++){
                inventoryLogVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(inventoryLogVOList.get(i).getCreateUserName()));
                inventoryLogVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(inventoryLogVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, inventoryLogVOList, page, pageSize, count);
        } else {
            List<IotDeviceInventoryLogVO> inventoryLogVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotDeviceInventoryLogVO.class));
            for (int i=0;i<inventoryLogVOList.size();i++){
                inventoryLogVOList.get(i).setCreateUserName(inventoryLogVOList.get(i).getCreateUserName());
                inventoryLogVOList.get(i).setUpdateUserName(inventoryLogVOList.get(i).getUpdateUserName());
            }
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, inventoryLogVOList);
        }
    }

+ 42 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.iot.company.IotCompanyTypeDO;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceOrderDO;
import com.yihu.jw.entity.iot.device.IotOrderPurchaseDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;
@ -265,6 +266,16 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceOrderDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceOrderDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setPurchaserName(AesEncryptUtils.decrypt(list.get(i).getPurchaserName()));
            list.get(i).setPurchaserPhone(AesEncryptUtils.decrypt(list.get(i).getPurchaserPhone()));
            list.get(i).setSupplierName(AesEncryptUtils.decrypt(list.get(i).getSupplierName()));
            list.get(i).setSupplierLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getSupplierLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
@ -338,6 +349,16 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceOrderDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceOrderDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setPurchaserName(AesEncryptUtils.decrypt(list.get(i).getPurchaserName()));
            list.get(i).setPurchaserPhone(AesEncryptUtils.decrypt(list.get(i).getPurchaserPhone()));
            list.get(i).setSupplierLeader(AesEncryptUtils.decrypt(list.get(i).getSupplierLeader()));
            list.get(i).setSupplierLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getSupplierLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
@ -372,6 +393,13 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotOrderPurchaseDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotOrderPurchaseDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
        }
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
@ -463,6 +491,11 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotOrderPurchaseDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotOrderPurchaseDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
        }
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
@ -504,6 +537,15 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        List<IotDeviceOrderDO> listDO = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceOrderDO.class));
        for (int i=0;i<listDO.size();i++){
            listDO.get(i).setPurchaserName(AesEncryptUtils.decrypt(listDO.get(i).getPurchaserName()));
            listDO.get(i).setPurchaserPhone(AesEncryptUtils.decrypt(listDO.get(i).getPurchaserPhone()));
            listDO.get(i).setSupplierName(AesEncryptUtils.decrypt(listDO.get(i).getSupplierName()));
            listDO.get(i).setSupplierLeaderPhone(AesEncryptUtils.decrypt(listDO.get(i).getSupplierLeaderPhone()));
            listDO.get(i).setCreateUserName(AesEncryptUtils.decrypt(listDO.get(i).getCreateUserName()));
            listDO.get(i).setUpdateUserName(AesEncryptUtils.decrypt(listDO.get(i).getUpdateUserName()));
        }
        //DO转VO
        List<IotDeviceOrderVO> iotDeviceOrderVOList = new ArrayList<>();
        convertToModelVOs(listDO,iotDeviceOrderVOList);

+ 15 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -11,6 +11,7 @@ import com.yihu.iot.service.useragent.UserAgent;
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.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -266,6 +267,14 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql1.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
            list.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getQualityLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        long count = list.size();
        //DO转VO
@ -324,6 +333,12 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        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));
        for (int i=0;i<listOrderNo.size();i++){
            listOrderNo.get(i).setQualityLeader(AesEncryptUtils.decrypt(listOrderNo.get(i).getQualityLeader()));
            listOrderNo.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(listOrderNo.get(i).getQualityLeaderPhone()));
            listOrderNo.get(i).setCreateUserName(AesEncryptUtils.decrypt(listOrderNo.get(i).getCreateUserName()));
            listOrderNo.get(i).setUpdateUserName(AesEncryptUtils.decrypt(listOrderNo.get(i).getUpdateUserName()));
        }
        List<IotDeviceQualityInspectionPlanVO> list = transforList(listOrderNo);
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,list,page,size,count);

+ 14 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -12,6 +12,7 @@ import com.yihu.iot.util.excel.AExcelReader;
import com.yihu.iot.util.excel.reader.IotDeviceImportVOReader;
import com.yihu.jw.entity.iot.device.*;
import com.yihu.jw.entity.iot.product.IotProductDataTransmissionDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
@ -39,6 +40,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.sun.tools.corba.se.idl.constExpr.Expression.one;
/**
 * @author yeshijie on 2017/12/8.
 */
@ -295,6 +298,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
            }else {
                one.setIsBinding(2);
            }
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        translateDictForList(iotDeviceVOList);
@ -364,6 +369,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        iotDeviceVOList.forEach(one->{
            one.setIsBinding(isBinding);
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        translateDictForList(iotDeviceVOList);
@ -386,9 +393,13 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        sql += " GROUP BY c.`name`";
        List<IotDeviceDO> list = jdbcTempalte.query(sql,new BeanPropertyRowMapper(IotDeviceDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        //DO转VO
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        translateDictForList(iotDeviceVOList);
        long count = list.size();
@ -433,6 +444,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        }
        List<IotDeviceDO> list = jdbcTempalte.query(sql,new BeanPropertyRowMapper(IotDeviceDO.class));
        if(list.size()>0){
            list.get(0).setCreateUserName(AesEncryptUtils.decrypt(list.get(0).getCreateUserName()));
            list.get(0).setUpdateUserName(AesEncryptUtils.decrypt(list.get(0).getUpdateUserName()));
            return list.get(0);
        }
        return null;

+ 12 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -11,6 +11,7 @@ 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.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -146,7 +147,7 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
            sqlCount.append(" and (c.device_sn like '%").append(sn).append("%')");
        }
        //数据权限过滤
//        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql.append(" and c.hospital in (").append(orgUserService.getUserOrg(orgList)).append(")");
@ -162,10 +163,10 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
        mapList.forEach(one->{
            IotDeviceSimDO iotDeviceSimDO = JSONObject.parseObject(JSONObject.toJSONString(one), IotDeviceSimDO.class);
            if (one.get("patient_name")!=null){
                iotDeviceSimDO.setContactsName(one.get("patient_name").toString());
                iotDeviceSimDO.setContactsName(AesEncryptUtils.decrypt(one.get("patient_name").toString()));
            }
            if (one.get("mobile")!=null){
                iotDeviceSimDO.setContactsMobile(one.get("mobile").toString());
                iotDeviceSimDO.setContactsMobile(AesEncryptUtils.decrypt(one.get("mobile").toString()));
            }
            if (one.get("sn")!=null){
                iotDeviceSimDO.setDeviceSn(one.get("sn").toString());
@ -173,6 +174,8 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
            if (one.get("name")!=null){
                iotDeviceSimDO.setDeviceName(one.get("name").toString());
            }
//            iotDeviceSimDO.setCreateUserName(AesEncryptUtils.decrypt(one.get("create_user_name").toString()));
//            iotDeviceSimDO.setCreateUserName(AesEncryptUtils.decrypt(one.get("update_user_name").toString()));
            //更新表中数据
            iotDeviceSimDao.save(iotDeviceSimDO);
            list.add(iotDeviceSimDO);
@ -200,7 +203,12 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        list.forEach(one-> {
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                });
        //获取总数
        long count = list.size();

+ 5 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceTransfersService.java

@ -5,6 +5,7 @@ import com.yihu.iot.dao.device.IotDeviceTransfersDao;
import com.yihu.iot.service.common.OrgUserService;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.device.IotDeviceTransfersDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
@ -65,6 +66,10 @@ public class IotDeviceTransfersService extends BaseJpaService<IotDeviceTransfers
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotDeviceTransfersDO> deviceTransfersDOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotDeviceTransfersDO.class));
            deviceTransfersDOList.forEach(one-> {
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceTransfersDOList, page, pageSize, count);
        } else {
            List<IotDeviceTransfersDO> deviceTransfersDOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotDeviceTransfersDO.class));

+ 65 - 8
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.patient.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -42,6 +43,7 @@ import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.management.ObjectName;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -265,7 +267,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            JSONObject location = JSONObject.parseObject(map.get("location").toString());
            GeoPoint geoPoint = new GeoPoint(Double.parseDouble(location.get("lat").toString()),Double.parseDouble(location.get("lon").toString()));
            locationDataVO.setId(map.get("id").toString());
            locationDataVO.setIdCard(map.get("idCard").toString());
            locationDataVO.setIdCard(AesEncryptUtils.decrypt(map.get("idCard").toString()));
            locationDataVO.setCategoryCode(map.get("categoryCode").toString());
            locationDataVO.setDeviceSn(map.get("deviceSn").toString());
            locationDataVO.setLocation(geoPoint);
@ -327,7 +329,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                List<Map<String,Object>> nameList = new ArrayList<>();
                List<Map<String,Object>> deviceList = new ArrayList<>();
                if (StringUtils.isNotEmpty(idCard)){
                    sql = sql +" and t.idcard = '"+idCard+"'";
                    sql = sql +" and t.idcard = '"+AesEncryptUtils.decrypt(idCard)+"'";
                    nameList = jdbcTempalte.queryForList(sql);
                }if (StringUtils.isNoneBlank(snCoed)){
                    sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
@ -336,8 +338,9 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                if(nameList.size()>0){
                    String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
                    String name = null==nameList.get(0).get("name")?"": ConcealUtil.nameOrAddrConceal(nameList.get(0).get("name").toString());
                    locationDataVO.setIdCard(AesEncryptUtils.decrypt(idCard));
                    locationDataVO.setCode(code);
                    locationDataVO.setName(name);
                    locationDataVO.setName(AesEncryptUtils.decrypt(name));
                }
                if (deviceList.size()>0){
                    String equipmentName = null==deviceList.get(0).get("device_name")?"":deviceList.get(0).get("device_name").toString();
@ -467,6 +470,15 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return list;
    }
@ -509,10 +521,29 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        if (page != null && pageSize != null) {
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            list.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
        }
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
    }
@ -560,6 +591,13 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
@ -577,7 +615,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
        }
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patient_name like '%" + patientName + "%' ";
            sql += "and AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a') like '%" + patientName + "%' ";
            //AES_DECRYPT(from_base64(t.name),'jkzl2021ZJXL*#%a')
        }
        if(StringUtils.isNotBlank(deviceName)){
            sql += "and d.device_name like '%" + deviceName + "%' ";
@ -589,19 +628,37 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            sql += "and d.hospital_name like '%" + hospitalName + "%' ";
        }
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql += " and d.hospital in ("+orgUserService.getUserOrg(orgList)+") ";
        }
//        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
//        if(!orgList.contains(userAgent.commonHospital)){
//            sql += " and d.hospital in ("+orgUserService.getUserOrg(orgList)+") ";
//        }
        sql += "order by d.update_time desc ";
        //判断是否需要分页
        if (page != null && pageSize != null) {
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }

+ 22 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java

@ -3,6 +3,7 @@ package com.yihu.iot.service.device;
import com.yihu.iot.service.common.OrgUserService;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.DeviceHealthIndexVO;
import com.yihu.jw.restmodel.iot.device.WlyyDeviceVO;
import com.yihu.jw.restmodel.iot.device.WlyyHealthStandardVO;
@ -67,7 +68,7 @@ public class WlyyDeviceService {
            sql +=" and device_name like '%"+deviceName+"%' ";
        }
        if(!StringUtils.isEmpty(linkman)){
            sql +=" and linkmam like '%"+linkman+"%' ";
            sql +=" and AES_DECRYPT(from_base64(linkmam),'jkzl2021ZJXL*#%a') like '%"+linkman+"%' ";//AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
        }
        //数据权限过滤
@ -80,12 +81,28 @@ public class WlyyDeviceService {
        Long count = Long.valueOf(jdbcTemplate.queryForList(sql).size());
        sql += "limit " + (page - 1) * pageSize + "," + pageSize;
        List<WlyyDeviceVO> deviceVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WlyyDeviceVO.class));
        deviceVOList.forEach(one->{
            one.setLinkman(AesEncryptUtils.decrypt(one.getLinkman()));
            one.setTel(AesEncryptUtils.decrypt(one.getTel()));
            one.setRepresentative(AesEncryptUtils.decrypt(one.getRepresentative()));
            one.setApplicantName(AesEncryptUtils.decrypt(one.getApplicantName()));
            one.setApplicantTel(AesEncryptUtils.decrypt(one.getApplicantTel()));
            one.setApplicantIdentity(AesEncryptUtils.decrypt(one.getApplicantIdentity()));
        });
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
    }
    public MixEnvelop<WlyyDeviceVO,WlyyDeviceVO> findById(Long id){
        String sql = "select * from device.wlyy_devices where id = "+id;
        List<WlyyDeviceVO> deviceVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WlyyDeviceVO.class));
        deviceVOList.forEach(one->{
            one.setLinkman(AesEncryptUtils.decrypt(one.getLinkman()));
            one.setTel(AesEncryptUtils.decrypt(one.getTel()));
            one.setRepresentative(AesEncryptUtils.decrypt(one.getRepresentative()));
            one.setApplicantName(AesEncryptUtils.decrypt(one.getApplicantName()));
            one.setApplicantTel(AesEncryptUtils.decrypt(one.getApplicantTel()));
            one.setApplicantIdentity(AesEncryptUtils.decrypt(one.getApplicantIdentity()));
        });
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,deviceVOList.get(0));
    }
@ -107,14 +124,14 @@ public class WlyyDeviceService {
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            filter.append(" AND i.name LIKE '%"+userName+"%' ");
            filter.append(" AND AES_DECRYPT(from_base64(i.name),'jkzl2021ZJXL*#%a') LIKE '%"+userName+"%' ");
        }
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append(" and i.device_sn='"+deviceSn+"' ");
        }
        if(!StringUtils.isEmpty(idcard)){
            filter.append(" and i.idcard='"+idcard+"' ");
            filter.append(" and AES_DECRYPT(from_base64(i.idcard),'jkzl2021ZJXL*#%a')='"+idcard+"' ");
        }
        //体征数据创建时间
        if(!StringUtils.isEmpty(date)){
@ -172,14 +189,14 @@ public class WlyyDeviceService {
                bean.setCzrq(info.get("czrq")!=null?(Date)info.get("czrq"):null);
                bean.setDel(info.get("del")!=null?info.get("del")+"":null);
                bean.setDeviceSn(info.get("device_sn")!=null?info.get("device_sn")+"":null);
                bean.setIdcard(info.get("idcard")!=null?info.get("idcard")+"":null);
                bean.setIdcard(AesEncryptUtils.decrypt(info.get("idcard").toString())!=null?AesEncryptUtils.decrypt(info.get("idcard").toString())+"":null);
                bean.setIntervene(info.get("intervene")!=null?info.get("intervene")+"":null);
                bean.setRecordDate(info.get("record_date")!=null?(Date)info.get("record_date"):null);
                bean.setSortDate(info.get("sort_date")!=null?(Date)info.get("sort_date"):null);
                bean.setStatus(info.get("status")!=null?(Integer)info.get("status"):null);
                bean.setType(info.get("type")!=null?(Integer)info.get("type"):0);
                bean.setUser(info.get("user")!=null?info.get("user")+"":null);
                bean.setUserName(info.get("userName")!=null?info.get("userName")+"":null);
                bean.setUserName(AesEncryptUtils.decrypt(info.get("userName").toString())!=null?AesEncryptUtils.decrypt(info.get("userName").toString())+"":null);
                bean.setValue1(info.get("value1")!=null?info.get("value1")+"":null);
                bean.setValue2(info.get("value2")!=null?info.get("value2")+"":null);
                bean.setValue3(info.get("value3")!=null?info.get("value3")+"":null);