Explorar el Código

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

humingfen hace 4 años
padre
commit
7ccce1e432

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java

@ -25,6 +25,8 @@ public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements S
    private String companyName;//公司名称
    @Column(name = "address_ip")
    private String addressIp;//访问IP地址
    @Column(name = "status")
    private String status;//转态: 1:生效  0:为生效
    @Column(name = "del")
    private String del;//是否删除 0:删除  1:不删除
@ -66,4 +68,12 @@ public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements S
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -395,6 +395,7 @@ public class IotRequestMapping {
        public static final String delAppInterface ="delAppInterface";
        public static final String interfaceDoc ="interfaceDoc";
        public static final String addApp ="addApp";
        public static final String findCompanyShareInterface ="findCompanyShareInterface";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java

@ -66,6 +66,8 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    private String accountType;
    @ApiModelProperty("应用")
    private List<IotCompanyAppVO> appList;
    @ApiModelProperty("审核不通过信息说明")
    private String auditMessage;
    public String getStatus() {
        return status;
@ -250,4 +252,12 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    public void setAppList(List<IotCompanyAppVO> appList) {
        this.appList = appList;
    }
    public String getAuditMessage() {
        return auditMessage;
    }
    public void setAuditMessage(String auditMessage) {
        this.auditMessage = auditMessage;
    }
}

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java

@ -153,6 +153,12 @@ public class IotInterfaceAuditController extends EnvelopRestEndpoint {
                                                                                    @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotInterfaceAuditService.queryCompanyAppPage(page,size);
        } catch (Exception e) {
            e.printStackTrace();

+ 26 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -157,6 +157,30 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Platform.findCompanyShareInterface)
    @ApiOperation(value = "查询企业下的共享接口",notes = "查询企业下的共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findCompanyShareInterface(
                                                                                  @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 {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotShareInterfaceService.findCompanyShareInterface(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Platform.findAllLog)
@ -376,4 +400,6 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
}

+ 7 - 3
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java

@ -22,10 +22,14 @@ public interface IotCompanyAppDao extends PagingAndSortingRepository<IotCompanyA
        @Query("from IotCompanyAppDO w where w.id =?1 and w.del=1")
        IotCompanyAppDO findById(String appId);
        @Query("from IotCompanyAppDO w where w.companyId =?1 and w.del=0")
        List<IotCompanyAppDO> findByCompanyIdAndDel(String companyId);
        @Query("from IotCompanyAppDO w where w.companyId =?1 and w.status=0 and w.del=1")
        List<IotCompanyAppDO> findByCompanyIdAndStatus(String companyId);
        @Query("from IotCompanyAppDO w where w.del=0")
        @Query("from IotCompanyAppDO w where w.del=1")
        List<IotCompanyAppDO> findAllByDel();
        @Query("from IotCompanyAppDO w where w.name=?1 and w.del=1")
        IotCompanyAppDO findByName(String name);
        }

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java

@ -36,4 +36,10 @@ public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO,
    @Query("from IotCompanyDO w where w.ehrUserId =?1 and w.del=1")
    IotCompanyDO findByEhrUserId(String uid);
    @Query("from IotCompanyDO w where w.businessLicense =?1 and w.accountType=?2 and w.del=1 and (w.status=1 or w.status=0 )")
    IotCompanyDO findByBusinessLicenseAndAccountType(String businessLicense,String accountType);
    @Query("from IotCompanyDO w where w.name =?1 and w.accountType=?2 and w.id<>?3 and w.del=1")
    IotCompanyDO findByNameAndAccountTypeAndId(String name,String accountType,String id);
}

+ 69 - 58
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -462,16 +462,27 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                //1、判断企业名称是否已经注册
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
//                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
//                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
//                    //判断营业执照号是否被注册
//                    if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
//                            (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
//                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
//                    }
//                    if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
//                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
//                    }
//                }
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountTypeAndId(iotCompany.getName(), iotCompany.getAccountType(), iotCompany.getId());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
@ -500,20 +511,16 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            //平台
            if (iotCompany.getAccountType().equalsIgnoreCase("0")) {
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
                IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountTypeAndId(iotCompany.getName(), iotCompany.getAccountType(), iotCompany.getId());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
                List<IotCompanyAppDO> apps = iotCompanyAppDao.findAllByDel();
@ -521,11 +528,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                for (IotCompanyAppDO appDO : apps) {
                    if(companyAppDO.getName().equalsIgnoreCase(appDO.getName())&&(!appDO.getId().equalsIgnoreCase(companyAppDO.getId()))){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                        return MixEnvelop.getError("该应用名称已被注册,请使用其他企业");
                    }
                    if (appDO.getId().equalsIgnoreCase(companyAppDO.getId())) {
                        appDO.setDel("0");
                        appDO.setStatus("0");
                        appDO.setCompanyName(iotCompany.getName());
                        appDO.setCompanyId(iotCompany.getId());
                        appDO.setName(companyAppDO.getName());
@ -542,27 +550,23 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        IotCompanyDO companyDO = null;
        //id为空,新增企业
        if (StringUtils.isEmpty(iotCompany.getId())) {
            companyDO= iotCompanyDao.save(iotCompany);
            //厂商
            if (companyDO.getAccountType().equalsIgnoreCase("1")) {
            if (iotCompany.getAccountType().equalsIgnoreCase("1")) {
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                //1、判断企业名称是否已经注册
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType());
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (companyDO.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(companyDO.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), iotCompany.getAccountType());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
                List<IotCompanyTypeDO> list = companyDO.getTypeList();
                String id = companyDO.getId();
                List<IotCompanyTypeDO> list = iotCompany.getTypeList();
                iotCompany= iotCompanyDao.save(iotCompany);
                String id = iotCompany.getId();
                //新增类型
                List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
                list.forEach(one->{
@ -578,37 +582,43 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            }
            //平台
            if (companyDO.getAccountType().equalsIgnoreCase("0")) {
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType());
            if (iotCompany.getAccountType().equalsIgnoreCase("0")) {
                IotCompanyAppDO companyAppDO = companyDO.getAppList().get(0);
                IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (companyDO.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(companyDO.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), iotCompany.getAccountType());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
                List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel();
                for (IotCompanyAppDO one : appDOList) {
                    if (one.getName().equalsIgnoreCase(companyAppDO.getName())){
                        return MixEnvelop.getError("该应用已注册,请使用其他应用");
                    }
//                List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel();
//                for (IotCompanyAppDO one : appDOList) {
//                    if (one.getName().equalsIgnoreCase(companyAppDO.getName())){
//                        return MixEnvelop.getError("该应用已注册,请使用其他应用");
//                    }
//                }
                IotCompanyAppDO appDaoByName = iotCompanyAppDao.findByName(companyAppDO.getName());
                if (appDaoByName!=null){
                    return MixEnvelop.getError("该应用已注册,请使用其他应用");
                }
                //保存应用
                companyDO= iotCompanyDao.save(iotCompany);
                IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
                iotCompanyAppDO.setSaasId(getCode());
                iotCompanyAppDO.setCompanyId(companyDO.getId());
                iotCompanyAppDO.setCompanyName(companyDO.getName());
                iotCompanyAppDO.setName(companyAppDO.getName());
                iotCompanyAppDO.setAddressIp(companyAppDO.getAddressIp());
                iotCompanyAppDO.setDel("0");
                iotCompanyAppDO.setDel("1");
                //新增应用 先设置应用无效  审核通过后更改为有效
                iotCompanyAppDO.setStatus("0");
                iotCompanyAppDao.save(iotCompanyAppDO);
            }
        }
@ -658,6 +668,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        appDO.setCompanyName(iotCompany.getName());
        appDO.setDel("1");
        appDO.setSaasId(getCode());
        appDO.setStatus("1");
        iotCompanyAppDao.save(appDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create);
    }
@ -954,9 +965,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        //审核通过 设置平台应用为有效
        if (companyDO.getAccountType().equalsIgnoreCase("0")){
            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndDel(id);
            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndStatus(id);
            appDOList.forEach(one->{
                one.setDel("1");
                one.setStatus("1");
                iotCompanyAppDao.save(one);
            });
        }

+ 8 - 6
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -124,14 +124,16 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
    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 del=0 ");
        StringBuffer sql = new StringBuffer("SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim" +
                " LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        StringBuffer sqlCount = new StringBuffer("SELECT  COUNT(c.id) count  FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim " +
                "LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        StringBuffer sql = new StringBuffer("SELECT c.* FROM " +
                " (SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no) c" +
                " WHERE  c.del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT  COUNT(c.id) count FROM " +
                " (SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no) c" +
                " WHERE  c.del=0 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=").append(status);
            sqlCount.append("and c.status='").append(status).append("' ");
            sqlCount.append(" and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(sim)){
@ -142,7 +144,7 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
            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);
        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>> mapList = jdbcTemplate.queryForList(sql.toString());

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

@ -233,7 +233,7 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        sql.append("WHERE company_name = '").append(account.getName()).append("'");
        sql.append("WHERE company_id = '").append(account.getId()).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));

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

@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.platform.IotShareInterfaceDao;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -46,6 +48,8 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @Autowired
    private UserAgent userAgent;
    /**
     * 增加接口
     * @param jsonData
@ -196,4 +200,25 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
    }
    /**
     * 查询企业下的共享接口
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotShareInterfaceDO, IotShareInterfaceDO> findCompanyShareInterface(Integer page, Integer size) {
        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_company_app_interface ");
        sql.append("WHERE company_id = '").append(account.getId()).append("'");
        sql.append(" order by update_time desc  limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
}

+ 1 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

@ -143,4 +143,5 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,list, page, size,count);
    }
}