Explorar o código

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

# Conflicts:
#	svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
mengkang %!s(int64=4) %!d(string=hai) anos
pai
achega
0c594a9562

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

@ -390,6 +390,7 @@ public class IotRequestMapping {
        public static final String findAppInterface ="findAppInterface";
        public static final String delAppInterface ="delAppInterface";
        public static final String interfaceDoc ="interfaceDoc";
        public static final String addApp ="addApp";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";
@ -411,7 +412,7 @@ public class IotRequestMapping {
        public static final String auditPass ="auditPass";
        public static final String auditNoPass ="auditNoPass";
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String QueryCompanyApp ="QueryCompanyApp";
        public static final String queryCompanyAppPage ="queryCompanyAppPage";
        public static final String message_success_apply_for = "apply for success";
        public static final String message_success_find = "find  success";

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

@ -84,6 +84,8 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    private Double retailPrice;
    @ApiModelProperty("设备类型标识")
    private String categoryCode;
    @ApiModelProperty("设备类型标识")
    private String categoryName;
    @ApiModelProperty("库存上限提醒值")
    private Double inventoryUpper;
    @ApiModelProperty("库存下限提醒值")
@ -360,4 +362,12 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    public void setInventoryFloor(String inventoryFloor) {
        this.inventoryFloor = inventoryFloor;
    }
    public String getCategoryName() {
        return categoryName;
    }
    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
}

+ 1 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -119,6 +119,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Company.auditCompanyPass)
    @ApiOperation(value = "通过审核",notes = "通过审核")
    public MixEnvelop<IotCompanyVO,IotCompanyVO> auditCompanyPass(@ApiParam(name = "id",value = "id") @RequestParam(value = "id",required = true)String id){

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

@ -145,15 +145,15 @@ public class IotInterfaceAuditController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.InterfaceAudit.QueryCompanyApp)
    @GetMapping(value = IotRequestMapping.InterfaceAudit.queryCompanyAppPage)
    @ApiOperation(value = "分页查询企业下应用接口申请",notes = "分页查询企业下应用接口申请")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> QueryCompanyApp( @ApiParam(name = "page", value = "第几页", defaultValue = "")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> queryCompanyAppPage( @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 {
            return iotInterfaceAuditService.QueryCompanyApp(page,size);
            return iotInterfaceAuditService.queryCompanyAppPage(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

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

@ -19,6 +19,8 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
/**
 * @author HZY
@ -363,4 +365,22 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @PostMapping(value = IotRequestMapping.Platform.addApp)
    @ApiOperation(value = "新增平台应用", notes = "新增平台应用")
    public MixEnvelop addApp( @ApiParam(name = "jsonData", value = "jsonData", defaultValue = "")
                                    @RequestParam(value = "jsonData") String jsonData){
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            return iotCompanyService.addPlatformApp(iotCompany);
        } catch (IOException e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -29,4 +29,7 @@ public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO,
    @Query("from IotCompanyDO w where w.account =?1 and w.del=1")
    IotCompanyDO findByAccount(String account);
    @Query("from IotCompanyDO w where w.name =?1 and w.accountType=?2 and w.del=1")
    IotCompanyDO findByNameAndAccountType(String name,String accountType);
}

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

@ -285,6 +285,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> create(IotCompanyDO iotCompany) {
        //判断账户是否重复
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUID());
        if (account==null){
            return MixEnvelop.getSuccess("账户已注册",-1);
        }
        List<IotCompanyTypeDO> list = iotCompany.getTypeList();
        if("1".equalsIgnoreCase(iotCompany.getAccountType())){
            //产商注册
@ -387,6 +395,40 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,convertToModelVO(iotCompany));
    }
    /**
     * 新增平台应用
     * @param iotCompany
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> addPlatformApp(IotCompanyDO iotCompany) {
        IotCompanyDO platform = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), "0");
        if (platform!=null){
            return MixEnvelop.getError("企业已经注册");
        }
        iotCompany.setStatus("1");//默认审核通过
        iotCompany.setSaasId(getCode());
        iotCompany.setDel(1);
        iotCompany.setAccount(iotCompany.getContactsMobile());
        iotCompany.setEhrUserId(getCode());
        iotCompany.setAccountType("0");
        iotCompanyDao.save(iotCompany);
        //保存应用
        IotCompanyAppDO appDO = iotCompany.getAppList().get(0);
        appDO.setCompanyId(iotCompany.getId());
        appDO.setCompanyName(iotCompany.getName());
        appDO.setDel("1");
        appDO.setSaasId(getCode());
        iotCompanyAppDao.save(appDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create);
    }
    /**
     * 按id查找
     * @param id
@ -743,7 +785,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyByAccount() {
        IotCompanyDO companyDO = iotCompanyDao.findByAccount(userAgent.getUNAME());
        IotCompanyDO companyDO = iotCompanyDao.findByAccount(userAgent.getUID());
        if (companyDO==null){
            return MixEnvelop.getSuccess("未入驻企业",-1);
        }
@ -757,7 +799,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     */
    public MixEnvelop<IotCompanyAppVO, IotCompanyAppVO> findCompanyApp() {
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUNAME());
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUID());
        List<IotCompanyAppDO> appDOS = iotCompanyAppDao.findByCompanyId(account.getId());
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,appDOS);

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

@ -228,9 +228,9 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
     * 分页查询企业下应用接口申请列表
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> QueryCompanyApp(Integer page, Integer size) {
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> queryCompanyAppPage(Integer page, Integer size) {
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUNAME());
        IotCompanyDO account = iotCompanyDao.findByAccount(userAgent.getUID());
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        sql.append("WHERE company_name = '").append(account.getName()).append("'");

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-iot
    name:  svr-iot-shw
  cloud:
    config:
      failFast: true