Browse Source

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

humingfen 5 years ago
parent
commit
eb02d37704
21 changed files with 1196 additions and 29 deletions
  1. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  2. 103 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotCompanyAppInterfaceDO.java
  3. 150 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDO.java
  4. 85 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDetailDO.java
  5. 28 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  6. 42 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotAppInterfacesVO.java
  7. 44 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotInterfaceAuditVO.java
  8. 4 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java
  9. 3 6
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  10. 147 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java
  11. 92 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  12. 56 3
      svr/svr-iot/src/main/java/com/yihu/iot/controller/workType/IotWorkTypeController.java
  13. 23 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotCompanyAppInterfaceDao.java
  14. 21 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDao.java
  15. 17 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDetailDao.java
  16. 5 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/workType/IotWorkTypeDao.java
  17. 3 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java
  18. 9 8
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  19. 75 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java
  20. 215 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java
  21. 72 5
      svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -900,7 +900,7 @@ public class XzzxEntranceService{
    /**
     * 查询患者就诊卡
     * @param patient 身份证号
     * @param patient 居民code
     * @return
     */
    public JSONArray selectPateintCard(String patient) throws Exception {
@ -922,6 +922,7 @@ public class XzzxEntranceService{
            if (array!=null&&array.size()!=0){
                JSONObject object1 = array.getJSONObject(0);
                if (patientMappingDO==null){
                    patientMappingDO = new PatientMappingDO();
                    patientMappingDO.setIdcard(patientDO.getIdcard());
                    patientMappingDO.setPatientName(patientDO.getName());
                    patientMappingDO.setPatient(patientDO.getId());

+ 103 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotCompanyAppInterfaceDO.java

@ -0,0 +1,103 @@
package com.yihu.jw.entity.iot.platform;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/30
 */
@Entity
@Table(name = "iot_company_app_interface")
public class IotCompanyAppInterfaceDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name="company_id")
    private String companyId;//公司ID
    @Column(name="company_name")
    private String companyName;//公司名称
    @Column(name="app_id")
    private String appId;//应用ID
    @Column(name="app_name")
    private String  appName;//应用名称
    @Column(name = "share_interface_id")
    private String shareInterfaceId;//共享接口字典ID
    @Column(name = "validity_start_date")
    private Date validityStartDate;//接口有效期开始时间
    @Column(name = "validity_end_date")
    private Date validityEndDate;//接口有效期结束时间
    @Column(name = "del")
    private String del;//取消申请 1:取消  0:不取消'
    public IotCompanyAppInterfaceDO() {
    }
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppName() {
        return appName;
    }
    public void setAppName(String appName) {
        this.appName = appName;
    }
    public String getShareInterfaceId() {
        return shareInterfaceId;
    }
    public void setShareInterfaceId(String shareInterfaceId) {
        this.shareInterfaceId = shareInterfaceId;
    }
    public Date getValidityStartDate() {
        return validityStartDate;
    }
    public void setValidityStartDate(Date validityStartDate) {
        this.validityStartDate = validityStartDate;
    }
    public Date getValidityEndDate() {
        return validityEndDate;
    }
    public void setValidityEndDate(Date validityEndDate) {
        this.validityEndDate = validityEndDate;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 150 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDO.java

@ -0,0 +1,150 @@
package com.yihu.jw.entity.iot.platform;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@Entity
@Table(name = "iot_interface_audit")
public class IotInterfaceAuditDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name="company_id")
    private String companyId;//公司ID
    @Column(name="company_name")
    private String companyName;//公司名称
    @Column(name="app_id")
    private String appId;//应用ID
    @Column(name="app_name")
    private String  appName;//应用名称
    @Column(name="name")
    private String name;//审核人姓名
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="time")
    private Date time;//申请时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="audit_time")
    private Date auditTime;//审核时间
    @Column(name="status")
    private String status;//审核转态:  2:待审核  1:通过审核  0:拒绝审核
    @Column(name="remark")
    private String remark;//备注
    @Column(name="refuse_explain")
    private String refuseExplain;//拒绝说明
    @Transient
    private String contactsName;//联系人姓名
    @Transient
    private String contactsMobile;//联系人手机号码
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppName() {
        return appName;
    }
    public void setAppName(String appName) {
        this.appName = appName;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }
    public Date getAuditTime() {
        return auditTime;
    }
    public void setAuditTime(Date auditTime) {
        this.auditTime = auditTime;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getRefuseExplain() {
        return refuseExplain;
    }
    public void setRefuseExplain(String refuseExplain) {
        this.refuseExplain = refuseExplain;
    }
    @Transient
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    @Transient
    public String getContactsMobile() {
        return contactsMobile;
    }
    public void setContactsMobile(String contactsMobile) {
        this.contactsMobile = contactsMobile;
    }
}

+ 85 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDetailDO.java

@ -0,0 +1,85 @@
package com.yihu.jw.entity.iot.platform;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@Entity
@Table(name = "iot_interface_audit_detail")
public class IotInterfaceAuditDetailDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "interface_id")
    private String interfaceId;//接口审核ID
    @Column(name = "share_interface_id")
    private String shareInterfaceId;//共享接口字典ID
    @Column(name = "method_name")
    private String methodName;//方法名
    @Column(name = "interface_name")
    private String interfaceName;//接口名称
    @Column(name = "type_name")
    private String typeName;//业务类型名称
    @Column(name = "explanation")
    private String explanation;//说明
    public String getInterfaceId() {
        return interfaceId;
    }
    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }
    public String getShareInterfaceId() {
        return shareInterfaceId;
    }
    public void setShareInterfaceId(String shareInterfaceId) {
        this.shareInterfaceId = shareInterfaceId;
    }
    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    public String getInterfaceName() {
        return interfaceName;
    }
    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public String getExplanation() {
        return explanation;
    }
    public void setExplanation(String explanation) {
        this.explanation = explanation;
    }
}

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

@ -25,6 +25,7 @@ public class IotRequestMapping {
        public static final String platform = api_iot_common + "/platform";
        public static final String workType = api_iot_common + "/workType";
        public static final String hospital = api_iot_common + "/hospital";
        public static final String interfaceAudit = api_iot_common + "/interfaceAudit";
        public static final String message_success_update = "update success";
@ -318,13 +319,39 @@ public class IotRequestMapping {
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String delete ="delete";
        public static final String dataConsumption ="dataConsumption";
        public static final String findCompanyById ="findCompanyById";
        public static final String editCompanyById ="editCompanyById";
        public static final String delCompanyById ="delCompanyById";
        public static final String allotInterface ="allotInterface";
        public static final String findAppInterface ="findAppInterface";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";
        public static final String message_success_find = "find success";
        public static final String message_success_delete = "delete success";
    }
    /**
     * 接口申请与审核信息模块
     */
    public static class  InterfaceAudit{
        public static final String addInterfaceApplyFor ="addInterfaceApplyFor";
        public static final String findInterfaceApplyFor ="findInterfaceApplyFor";
        public static final String findAllApplyFor ="findAllApplyFor";
        public static final String auditPass ="auditPass";
        public static final String auditNoPass ="auditNoPass";
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String message_success_apply_for = "apply for success";
        public static final String message_success_find = "find  success";
        public static final String message_success_audit = "audit  success";
    }
    /**
     * 业务类型信息模块常量
     */
@ -333,6 +360,7 @@ public class IotRequestMapping {
        public static final  String editType="editType";
        public static final  String deleteType="deleteType";
        public static final  String findType="findType";
        public static final  String findAll="findAll";
        public static final String message_success_add = "workType add success";
        public static final String message_success_edit = "workType edit success";

+ 42 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotAppInterfacesVO.java

@ -0,0 +1,42 @@
package com.yihu.jw.restmodel.iot.platform;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import java.io.Serializable;
/**
 * @author 应用接口集合信息
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "应用接口集合信息", description = "应用接口集合信息")
public class IotAppInterfacesVO  extends BaseVO implements Serializable {
    @ApiModelProperty("应用名称")
    private String appName;
    @ApiModelProperty("共享接口信息")
    private IotShareInterfaceDO iotShareInterfaceDO;
    public String getAppName() {
        return appName;
    }
    public void setAppName(String appName) {
        this.appName = appName;
    }
    public IotShareInterfaceDO getIotShareInterfaceDO() {
        return iotShareInterfaceDO;
    }
    public void setIotShareInterfaceDO(IotShareInterfaceDO iotShareInterfaceDO) {
        this.iotShareInterfaceDO = iotShareInterfaceDO;
    }
}

+ 44 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotInterfaceAuditVO.java

@ -0,0 +1,44 @@
package com.yihu.jw.restmodel.iot.platform;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDetailDO;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "应用接口申请信息", description = "应用接口申请信息")
public class IotInterfaceAuditVO extends BaseVO implements Serializable {
    @ApiModelProperty("接口审核信息")
    private IotInterfaceAuditDO iotInterfaceAuditDO;
    @ApiModelProperty("共享接口信息")
    private List<IotInterfaceAuditDetailDO> iotInterfaceAuditDetailDOList;
    public IotInterfaceAuditDO getIotInterfaceAuditDO() {
        return iotInterfaceAuditDO;
    }
    public void setIotInterfaceAuditDO(IotInterfaceAuditDO iotInterfaceAuditDO) {
        this.iotInterfaceAuditDO = iotInterfaceAuditDO;
    }
    public List<IotInterfaceAuditDetailDO> getIotInterfaceAuditDetailDOList() {
        return iotInterfaceAuditDetailDOList;
    }
    public void setIotInterfaceAuditDetailDOList(List<IotInterfaceAuditDetailDO> iotInterfaceAuditDetailDOList) {
        this.iotInterfaceAuditDetailDOList = iotInterfaceAuditDetailDOList;
    }
}

+ 4 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -31,9 +31,9 @@ public class XzyyController extends EnvelopRestEndpoint {
     */
    @GetMapping(value = "/findPatientCard")
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "idCard", value = "身份证号", required = false)
                                      @RequestParam(value = "idCard",required = false)String idCard)throws Exception{
        return success(xzzxEntranceService.selectPateintCard(idCard));
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民code", required = false)
                                      @RequestParam(value = "patient",required = false)String patient)throws Exception{
        return success(xzzxEntranceService.selectPateintCard(patient));
    }
@ -87,7 +87,7 @@ public class XzyyController extends EnvelopRestEndpoint {
                                         @ApiParam(name = "conNo", value = "就诊次数", required = false)
                                         @RequestParam(value = "conNo",required = false)String conNo)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.findOutpatientInfo(patient,conNo));
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectOutpatientInfo(patient,conNo));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }

+ 3 - 6
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -109,8 +109,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            iotCompanyService.create(iotCompany);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create);
            return iotCompanyService.create(iotCompany);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -218,8 +217,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompany(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id) {
        try {
            iotCompanyService.delCompany(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
            return  iotCompanyService.delCompany(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -328,8 +326,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> delCompanyCert(@ApiParam(name = "id", value = "id", defaultValue = "")
                                                           @RequestParam(value = "id", required = true)String id) {
        try {
            iotCompanyCertificateService.delCompanyCert(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete);
            return iotCompanyCertificateService.delCompanyCert(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

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

@ -0,0 +1,147 @@
package com.yihu.iot.controller.platform;
import com.yihu.iot.service.platform.IotInterfaceAuditService;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceAuditVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.*;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 * public class IotInterfaceController extends EnvelopRestEndpoint {
 */
@RestController
@RequestMapping(IotRequestMapping.Common.interfaceAudit)
@Api(tags = "平台应用接口", description = "审核与申请管理相关操作")
public class IotInterfaceAuditController extends EnvelopRestEndpoint {
    @Autowired
    private IotInterfaceAuditService iotInterfaceAuditService;
    @PostMapping(value = IotRequestMapping.InterfaceAudit.addInterfaceApplyFor)
    @ApiOperation(value = "新增应用接口权限申请",notes = "新增应用接口权限申请")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> addInterfaceApplyFor(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json,
                                                                                 @ApiParam(name = "ids",value = "共享接口IDS") @RequestBody List<String> ids){
        try {
            iotInterfaceAuditService.addInterfaceApplyFor(json,ids);
            return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_apply_for);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.findInterfaceApplyFor)
    @ApiOperation(value = "查看应用接口申请信息",notes = "查看应用接口申请信息")
    public MixEnvelop<IotInterfaceAuditVO,IotInterfaceAuditVO> findInterfaceApplyFor(@ApiParam(name = "id",value = "ID") @RequestParam(value = "id",required = true)String id){
        try {
            IotInterfaceAuditVO iotInterfaceAuditVO  = iotInterfaceAuditService.findInterfaceApplyFor(id);
            return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_find,iotInterfaceAuditVO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.findAllApplyFor)
    @ApiOperation(value = "分页查询所有应用接口申请信息",notes = "分页查询所有应用接口申请信息")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> findAllApplyFor(@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 iotInterfaceAuditService.findAllApplyFor(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.conditionQueryPage)
    @ApiOperation(value = "条件分页查询应用接口申请信息",notes = "条件分页查询应用接口申请信息")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> conditionQueryPage(@ApiParam(name = "name", value = "厂商名称或联系人名称", defaultValue = "")
                                                                                      @RequestParam(value = "name", required = false) String companyName,
                                                                                  @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 iotInterfaceAuditService.conditionQueryPage(companyName,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.auditPass)
    @ApiOperation(value = "应用接口审核通过",notes = "应用接口审核通过")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> auditPass(@ApiParam(name = "id",value = "ID") @RequestParam(value = "id",required = true)String id){
        try {
            return iotInterfaceAuditService.auditPass(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.auditNoPass)
    @ApiOperation(value = "应用接口审核不通过",notes = "应用接口审核不通过")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> auditNoPass(@ApiParam(name = "id",value = "ID") @RequestParam(value = "id",required = true)String id,
                                                                           @ApiParam(name = "msg",value = "拒绝说明") @RequestParam(value = "msg",required = true)String msg){
        try {
            return iotInterfaceAuditService.auditNoPass(id,msg);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -1,8 +1,15 @@
package com.yihu.iot.controller.platform;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.service.company.IotCompanyService;
import com.yihu.iot.service.platform.IotCompanyAppInterfaceService;
import com.yihu.iot.service.platform.IotInterfaceLogService;
import com.yihu.iot.service.platform.IotShareInterfaceService;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.iot.platform.IotAppInterfacesVO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -13,6 +20,9 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
@ -30,6 +40,12 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    private IotInterfaceLogService iotInterfaceLogService;
    @Autowired
    private IotCompanyAppInterfaceService iotCompanyAppInterfaceService;
    @Autowired
    private IotCompanyService iotCompanyService;
    @PostMapping(value = IotRequestMapping.Platform.addInterface)
    @ApiOperation(value = "新增共享接口",notes = "新增共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> addInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
@ -187,6 +203,82 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Platform.findCompanyById)
    @ApiOperation(value = "查看平台信息",notes = "查看平台信息")
    public MixEnvelop<IotCompanyVO,IotCompanyVO> findCompanyById(@ApiParam(name = "id", value = "公司ID", defaultValue = "")
                                                          @RequestParam(value = "id", required = false) String id){
        try {
            IotCompanyDO iotCompanyDO = iotCompanyService.findById(id);
            IotCompanyVO vo = iotCompanyService.convertToModelVO(iotCompanyDO);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, vo);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.editCompanyById)
    @ApiOperation(value = "编辑平台信息", notes = "编辑平台信息")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                                             @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            iotCompanyService.updCompany(iotCompany,"0");
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_edit);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Platform.delCompanyById)
    @ApiOperation(value = "删除平台信息", notes = "删除平台信息")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompanyById(@ApiParam(name = "id", value = "公司ID", defaultValue = "")
                                                                     @RequestParam(value = "id", required = false) String id) {
        try {
            iotCompanyService.delCompany(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.allotInterface)
    @ApiOperation(value = "分配接口", notes = "分配接口")
    public MixEnvelop<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDO> allotInterface(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                                             @RequestParam(value = "jsonData", required = true)String jsonData,
                                                                             @ApiParam(name = "ids", value = "IDS", defaultValue = "")
                                                             @RequestBody List<String> ids) {
        try {
            iotCompanyAppInterfaceService.allotInterface(jsonData,ids);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_add);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.findAppInterface)
    @ApiOperation(value = "查看应用接口", notes = "查看应用接口")
    public MixEnvelop<IotAppInterfacesVO, IotAppInterfacesVO> findAppInterface(@ApiParam(name = "appId", value = "应用id", defaultValue = "")
                                                                                         @RequestParam(value = "appId") String appId) {
        try {
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotCompanyAppInterfaceService.findAppInterface(appId));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 56 - 3
svr/svr-iot/src/main/java/com/yihu/iot/controller/workType/IotWorkTypeController.java

@ -1,7 +1,9 @@
package com.yihu.iot.controller.workType;
import com.yihu.iot.service.workType.IotWorkTypeService;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.entity.iot.workType.IotWorkTypeDO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -61,8 +63,8 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
                                                              @RequestParam(value = "id",required = true)String id){
        try {
            iotWorkTypeService.deleteType(id);
            return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_delete);
            return  iotWorkTypeService.deleteType(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -77,7 +79,56 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
                                                            @RequestParam(value = "id",required = true)String id){
        try {
            return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_find, iotWorkTypeService.findType(id));
            return  iotWorkTypeService.findType(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.WorkType.findAll)
    @ApiOperation(value = "分页查询所有",notes = "分页查询所有")
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findAllLog(@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 iotWorkTypeService.findAll(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.conditionQueryPage)
    @ApiOperation(value = "条件查询分页",notes = "条件查询分页")
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> conditionQueryPage(@ApiParam(name = "type", value = "业务类型", defaultValue = "")
                                                                                  @RequestParam(value = "type", required = false) String type,
                                                                                  @ApiParam(name = "explanation", value = "说明", defaultValue = "")
                                                                                  @RequestParam(value = "explanation", required = false) String explanation,
                                                                                  @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 iotWorkTypeService.conditionQueryPage(page,size,type,explanation);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -85,4 +136,6 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
    }
}

+ 23 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotCompanyAppInterfaceDao.java

@ -0,0 +1,23 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
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/4/30
 */
public interface IotCompanyAppInterfaceDao extends PagingAndSortingRepository<IotCompanyAppInterfaceDO,String>, JpaSpecificationExecutor<IotCompanyAppInterfaceDO> {
    @Query("from IotCompanyAppInterfaceDO w where w.appId=?1 and w.del=0")
    List<IotCompanyAppInterfaceDO> findByAppId(String appId);
}

+ 21 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDao.java

@ -0,0 +1,21 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
public interface IotInterfaceAuditDao extends PagingAndSortingRepository<IotInterfaceAuditDO,String>, JpaSpecificationExecutor<IotInterfaceAuditDO> {
   List<IotInterfaceAuditDO>   findByAppId(String  appId);
}

+ 17 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDetailDao.java

@ -0,0 +1,17 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDetailDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
public interface IotInterfaceAuditDetailDao extends PagingAndSortingRepository<IotInterfaceAuditDetailDO,String>, JpaSpecificationExecutor<IotInterfaceAuditDetailDO> {
    List<IotInterfaceAuditDetailDO> findByInterfaceId(String interfaceId);
}

+ 5 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/workType/IotWorkTypeDao.java

@ -7,6 +7,8 @@ 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
@ -16,4 +18,7 @@ public interface IotWorkTypeDao extends PagingAndSortingRepository<IotWorkTypeDO
    @Query("from IotWorkTypeDO w where w.id=?1 and w.del=0")
    IotWorkTypeDO findById(String id);
    @Query("from IotWorkTypeDO w where w.name=?1 and w.del=0")
    List<IotWorkTypeDO> findByName(String name);
}

+ 3 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java

@ -110,13 +110,14 @@ public class IotCompanyCertificateService extends BaseJpaService<IotCompanyCerti
     * 删除
     * @param id
     */
    public void delCompanyCert(String id){
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> delCompanyCert(String id){
        IotCompanyCertificateDO companyCert = iotCompanyCertificateDao.findById(id);
        if(companyCert==null){
            throw new RuntimeException("证书已删除,请勿重复操作");
            return MixEnvelop.getError("证书已删除,请勿重复操作");
        }
        companyCert.setDel(0);
        iotCompanyCertificateDao.save(companyCert);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
    }
    public List<IotCompanyCertificateVO> convertToModels(List<IotCompanyCertificateDO> iotCompanyCertificateDOList,List<IotCompanyCertificateVO> voList){

+ 9 - 8
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -276,7 +276,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @param iotCompany
     * @return
     */
    public IotCompanyDO create(IotCompanyDO iotCompany) {
    public MixEnvelop<IotCompanyVO, IotCompanyVO> create(IotCompanyDO iotCompany) {
        List<IotCompanyTypeDO> list = iotCompany.getTypeList();
        if("1".equalsIgnoreCase(iotCompany.getAccountType())){
            //产商注册
@ -285,7 +285,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                //判断营业执照号是否被注册
                if(iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense())&&iotCompanyDO.getStatus().equalsIgnoreCase("1")){
                    throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                    //该公司重新申请注册,则删除原先注册信息
@ -294,7 +294,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                        iotCompanyAppDao.delete(apps);
                        iotCompanyDao.delete(iotCompanyDO);
                    }else {
                        throw new RuntimeException("该企业已经注册,请使用注册账号登录");
                        return MixEnvelop.getError("该企业已经注册,请使用注册账号登录");
                    }
                }
            }
@ -323,7 +323,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                //判断营业执照号是否被注册
                if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) && iotCompanyDO.getStatus().equalsIgnoreCase("1")) {
                    throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
            }
@ -352,7 +352,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                            appDO.setCompanyId(companyTemp.getId());
                        }
                    }
                    throw new RuntimeException("该应用已经注册,请使用注册账号登录");
                    return MixEnvelop.getError("该应用已经注册,请使用注册账号登录");
                }
            }
            //平台接入
@ -373,7 +373,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        }
        return iotCompany;
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,iotCompany);
    }
    /**
@ -457,13 +457,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * 删除
     * @param id
     */
    public void delCompany(String id){
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompany(String id){
        IotCompanyDO company = iotCompanyDao.findById(id);
        if (company==null){
           throw new RuntimeException("该企业已删除,请勿重复操作");
        return   MixEnvelop.getError("该企业已删除,请勿重复操作");
        }
        company.setDel(0);
        iotCompanyDao.save(company);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
    }
    /**

+ 75 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java

@ -0,0 +1,75 @@
package com.yihu.iot.service.platform;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.platform.IotCompanyAppInterfaceDao;
import com.yihu.iot.dao.platform.IotShareInterfaceDao;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.platform.IotAppInterfacesVO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/30
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class IotCompanyAppInterfaceService extends BaseJpaService<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDao> {
    @Autowired
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    @Autowired
    private IotShareInterfaceDao iotShareInterfaceDao;
    /**
     * 分配接口
     * @param jsonData
     */
    public void allotInterface(String jsonData, List<String> ids) {
        ids.forEach(one->{
            IotCompanyAppInterfaceDO iotCompanyAppInterfaceDO = JSONObject.parseObject(jsonData, IotCompanyAppInterfaceDO.class);
            iotCompanyAppInterfaceDO.setShareInterfaceId(one);
            iotCompanyAppInterfaceDO.setDel("0");
            iotCompanyAppInterfaceDao.save(iotCompanyAppInterfaceDO);
        });
    }
    /**
     * 查看应用接口
     * @param appId
     * @return
     */
    public List<IotAppInterfacesVO> findAppInterface(String appId) {
        List<IotCompanyAppInterfaceDO> appInterfaceDOS = iotCompanyAppInterfaceDao.findByAppId(appId);
        List<IotAppInterfacesVO> list = new ArrayList<>();
        appInterfaceDOS.forEach(one->{
            IotAppInterfacesVO appInterfacesVO = new IotAppInterfacesVO();
            String shareInterfaceId = one.getShareInterfaceId();
            IotShareInterfaceDO shareInterfaceDO = iotShareInterfaceDao.findOne(shareInterfaceId);
            appInterfacesVO.setAppName(one.getAppName());
            appInterfacesVO.setIotShareInterfaceDO(shareInterfaceDO);
            list.add(appInterfacesVO);
        });
        return list;
    }
}

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

@ -0,0 +1,215 @@
package com.yihu.iot.service.platform;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.platform.*;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.*;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceAuditVO;
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 io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@Service
@Transactional
public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditDO, IotInterfaceAuditDao>  {
    @Autowired
    private IotInterfaceAuditDao  iotInterfaceAuditDao;
    @Autowired
    private IotInterfaceAuditDetailDao  iotInterfaceAuditDetailDao;
    @Autowired
    private IotShareInterfaceDao iotShareInterfaceDao;
    @Autowired
    private IotCompanyDao iotCompanyDao;
    @Autowired
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 应用接口申请
     * @param json
     */
    public void addInterfaceApplyFor(String json, List<String> ids) {
        IotInterfaceAuditDO iotInterfaceAuditDO = JSONObject.parseObject(json, IotInterfaceAuditDO.class);
        iotInterfaceAuditDO.setTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(iotInterfaceAuditDO);
        ids.forEach(one->{
            IotInterfaceAuditDetailDO iotInterfaceAuditDetailDO = new IotInterfaceAuditDetailDO();
            iotInterfaceAuditDetailDO.setInterfaceId(iotInterfaceAuditDO.getId());
            iotInterfaceAuditDetailDO.setShareInterfaceId(one);
            //获取共享接口信息,并存储到审核临时表中
            IotShareInterfaceDO shareInterfaceDO = iotShareInterfaceDao.findById(one);
            iotInterfaceAuditDetailDO.setInterfaceName(shareInterfaceDO.getInterfaceName());
            iotInterfaceAuditDetailDO.setMethodName(shareInterfaceDO.getMethodName());
            iotInterfaceAuditDetailDO.setExplanation(shareInterfaceDO.getExplanation());
            iotInterfaceAuditDetailDO.setTypeName(shareInterfaceDO.getTypeName());
            iotInterfaceAuditDetailDao.save(iotInterfaceAuditDetailDO);
        });
    }
    /**
     * 查看应用申请接口信息
     * @param id
     * @return
     */
    public IotInterfaceAuditVO findInterfaceApplyFor(String id) {
        IotInterfaceAuditVO iotInterfaceAuditVO = new IotInterfaceAuditVO();
        IotInterfaceAuditDO auditDO = iotInterfaceAuditDao.findOne(id);
        //获取联系人姓名与电话
        IotCompanyDO company = iotCompanyDao.findOne(auditDO.getCompanyId());
        auditDO.setContactsName(company.getContactsName());
        auditDO.setContactsMobile(company.getContactsMobile());
        List<IotInterfaceAuditDetailDO> list = iotInterfaceAuditDetailDao.findByInterfaceId(id);
        iotInterfaceAuditVO.setIotInterfaceAuditDO(auditDO);
        iotInterfaceAuditVO.setIotInterfaceAuditDetailDOList(list);
        return iotInterfaceAuditVO;
    }
    /**
     * 分页查找所有应用申请信息
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> findAllApplyFor(Integer page, Integer size) {
        String sql="SELECT DISTINCT * FROM iot_interface_audit ORDER BY time DESC;";
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        list.forEach(one->{
            IotCompanyDO company = iotCompanyDao.findOne(one.getCompanyId());
            one.setContactsName(company.getContactsName());
            one.setContactsMobile(company.getContactsMobile());
        });
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
    /**
     * 接口审核通过
     * @param id
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> auditPass(String id) {
        IotInterfaceAuditDO auditDO = iotInterfaceAuditDao.findOne(id);
        if (auditDO==null)
        {
            return MixEnvelop.getError("审核操作失败,无该应用");
        }
        //删除之前的所有应用接口 已审核通过的为最新接口
        List<IotCompanyAppInterfaceDO> appInterfaceDOList = iotCompanyAppInterfaceDao.findByAppId(auditDO.getAppId());
        appInterfaceDOList.forEach(one->{
            iotCompanyAppInterfaceDao.delete(one.getId());
        });
        //获取共享接口数组并分配接口给应用
        List<IotInterfaceAuditDetailDO> ids = iotInterfaceAuditDetailDao.findByInterfaceId(auditDO.getId());
        ids.forEach(one->{
            IotCompanyAppInterfaceDO appInterfaceDO = new IotCompanyAppInterfaceDO();
            appInterfaceDO.setShareInterfaceId(one.getShareInterfaceId());
            appInterfaceDO.setAppId(auditDO.getAppId());
            appInterfaceDO.setAppName(auditDO.getAppName());
            appInterfaceDO.setCompanyId(auditDO.getCompanyId());
            appInterfaceDO.setCompanyName(auditDO.getCompanyName());
            appInterfaceDO.setDel("0");
            iotCompanyAppInterfaceDao.save(appInterfaceDO);
        });
        auditDO.setStatus("1");
        auditDO.setAuditTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(auditDO);
        return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_audit);
    }
    /**
     * 接口审核不通过
     * @param id
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> auditNoPass(String id,String msg) {
        IotInterfaceAuditDO auditDO = iotInterfaceAuditDao.findOne(id);
        if (auditDO==null)
        {
            return MixEnvelop.getError("审核操作失败,无该应用");
        }
        auditDO.setStatus("0");
        auditDO.setRefuseExplain(msg);
        auditDO.setAuditTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(auditDO);
        return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_audit);
    }
    /**
     * 分页查询接口申请信息
     * @param companyName
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> conditionQueryPage(String companyName, Integer page, Integer size) throws ParseException {
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        if (StringUtils.isNotBlank(companyName)){
            sql.append("WHERE company_name like'%").append(companyName).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.forEach(one->{
            IotCompanyDO company = iotCompanyDao.findOne(one.getCompanyId());
            one.setContactsName(company.getContactsName());
            one.setContactsMobile(company.getContactsMobile());
        });
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
}

+ 72 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

@ -2,12 +2,26 @@ package com.yihu.iot.service.workType;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.workType.IotWorkTypeDao;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.entity.iot.workType.IotWorkTypeDO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
@ -50,24 +64,77 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
     * 根据ID删除业务类型
     * @param id
     */
    public void deleteType(String id) {
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> deleteType(String id) {
        IotWorkTypeDO type = iotWorkTypeDao.findOne(id);
        if(type.getDel().equalsIgnoreCase("1")){
            throw new RuntimeException("改类型已删除,请勿重复操作");
            return MixEnvelop.getError("该企业已删除,请勿重复删除");
        }
        type.setDel("1");
        iotWorkTypeDao.save(type);
        return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_delete);
    }
    /**
     * 根据ID查找业务类型
     * @param id
     */
    public IotWorkTypeDO findType(String id) {
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findType(String id) {
        IotWorkTypeDO type = iotWorkTypeDao.findById(id);
        if(type==null){
            throw  new RuntimeException("无该类型");
           return MixEnvelop.getError("无该企业");
        }
        return type;
        return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_find,type);
    }
    /**
     * 分页查询日志信息
     * @param page
     * @param size
     * @return
     * @throws ParseException
     */
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findAll(Integer page, Integer size) throws ParseException {
        String sql = "select * from iot_work_type w where w.del=0;";
        List<IotWorkTypeDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotWorkTypeDO.class));
        long count =list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.WorkType.message_success_find,list,page, size,count);
    }
    /**
     * 条件分页查询所有
     * @param page
     * @param size
     * @param type
     * @param explanation
     * @return
     */
    public MixEnvelop<IotWorkTypeDO, IotWorkTypeDO> conditionQueryPage(Integer page, Integer size, String type, String explanation){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_work_type c  WHERE c.del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_work_type c  WHERE c.del=0 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(type)){
            sql.append(" and c.name like ? ");
            sqlCount.append(" and c.name like '%").append(type).append("%' ");
            args.add("%" + type + "%");
        }
        if(StringUtils.isNotBlank(explanation)){
            sql.append(" and c.explanation like '%").append(explanation).append("%'");
            sqlCount.append(" and c.explanation like '%").append(explanation).append("%'");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotWorkTypeDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotWorkTypeDO.class));
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,list, page, size,count);
    }
}