Browse Source

20220119

master
Ling Ang 4 years ago
parent
commit
fcd6b66523
  1. 9
      ptos_open/src/main/java/com/ccsens/ptos_open/api/BusinessController.java
  2. 8
      ptos_open/src/main/java/com/ccsens/ptos_open/bean/dto/BusinessDto.java
  3. 26
      ptos_open/src/main/java/com/ccsens/ptos_open/service/BusinessService.java
  4. 9
      ptos_open/src/main/java/com/ccsens/ptos_open/service/IBusinessService.java
  5. 2
      ptos_open/src/main/resources/mapper_dao/BusinessDao.xml

9
ptos_open/src/main/java/com/ccsens/ptos_open/api/BusinessController.java

@ -81,4 +81,13 @@ public class BusinessController {
log.info("修改业务下的插件配置信息成功"); log.info("修改业务下的插件配置信息成功");
return JsonResponse.newInstance().ok(); return JsonResponse.newInstance().ok();
} }
@MustLogin
@ApiOperation(value = "通过id查询业务信息", notes = "")
@RequestMapping(value = "/queryIdBusiness", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<BusinessVo.BusinessInfo> queryIdBusiness(@ApiParam @Validated @RequestBody QueryDto<BusinessDto.QueryIdBusiness> params) throws Exception{
log.info("通过id查询业务信息:{}",params);
BusinessVo.BusinessInfo businessInfos = businessService. queryIdBusiness(params.getParam(),params.getUserId());
log.info("返回业务信息");
return JsonResponse.newInstance().ok(businessInfos);
}
} }

8
ptos_open/src/main/java/com/ccsens/ptos_open/bean/dto/BusinessDto.java

@ -76,4 +76,12 @@ public class BusinessDto {
@ApiModelProperty("是否开启debug模式 0不开启 1开启") @ApiModelProperty("是否开启debug模式 0不开启 1开启")
private Byte debug; private Byte debug;
} }
@Data
@ApiModel("通过id查询业务信息")
public static class QueryIdBusiness {
@ApiModelProperty("业务信息对应的id")
private Long businessId;
}
} }

26
ptos_open/src/main/java/com/ccsens/ptos_open/service/BusinessService.java

@ -7,9 +7,7 @@ import com.ccsens.ptos_open.bean.dto.BusinessDto;
import com.ccsens.ptos_open.bean.po.OpenBusiness; import com.ccsens.ptos_open.bean.po.OpenBusiness;
import com.ccsens.ptos_open.bean.po.OpenBusinessPlugin; import com.ccsens.ptos_open.bean.po.OpenBusinessPlugin;
import com.ccsens.ptos_open.bean.po.OpenBusinessPluginExample; import com.ccsens.ptos_open.bean.po.OpenBusinessPluginExample;
import com.ccsens.ptos_open.bean.po.OpenPluginWithBLOBs;
import com.ccsens.ptos_open.bean.vo.BusinessVo; import com.ccsens.ptos_open.bean.vo.BusinessVo;
import com.ccsens.ptos_open.bean.vo.PluginVo;
import com.ccsens.ptos_open.persist.dao.BusinessDao; import com.ccsens.ptos_open.persist.dao.BusinessDao;
import com.ccsens.ptos_open.persist.dao.PluginDao; import com.ccsens.ptos_open.persist.dao.PluginDao;
import com.ccsens.ptos_open.persist.mapper.OpenBusinessPluginMapper; import com.ccsens.ptos_open.persist.mapper.OpenBusinessPluginMapper;
@ -18,7 +16,6 @@ import com.ccsens.ptos_open.util.OpenCodeError;
import com.ccsens.util.exception.BaseException; import com.ccsens.util.exception.BaseException;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -126,4 +123,27 @@ public class BusinessService implements IBusinessService {
businessPlugin.setDebug(param.getDebug()); businessPlugin.setDebug(param.getDebug());
businessPluginMapper.updateByPrimaryKeySelective(businessPlugin); businessPluginMapper.updateByPrimaryKeySelective(businessPlugin);
} }
@Override
public BusinessVo.BusinessInfo queryIdBusiness(BusinessDto.QueryIdBusiness param, Long userId) {
//检查该id业务是否存在
Boolean b = businessDao.verifyById(param.getBusinessId());
if (b == null || !b) {
throw new BaseException(OpenCodeError.NOT_BUSINESS);
}
//查询业务信息
OpenBusiness openBusiness = businessDao.selectByPrimaryKey(param.getBusinessId());
BusinessVo.BusinessInfo businessInfo = new BusinessVo.BusinessInfo();
businessInfo.setId(openBusiness.getId());
businessInfo.setName(openBusiness.getName());
businessInfo.setSecret(openBusiness.getSecret());
businessInfo.setPub(openBusiness.getPub());
businessInfo.setCreateTime(openBusiness.getCreatedAt().getTime());
businessInfo.setUpdateTime(openBusiness.getUpdatedAt().getTime());
businessInfo.setDescription(openBusiness.getDescription());
businessInfo.setStartUsing(openBusiness.getStartUsing());
businessInfo.setAppId(openBusiness.getAppId());
return businessInfo;
}
} }

9
ptos_open/src/main/java/com/ccsens/ptos_open/service/IBusinessService.java

@ -2,7 +2,6 @@ package com.ccsens.ptos_open.service;
import com.ccsens.ptos_open.bean.dto.BusinessDto; import com.ccsens.ptos_open.bean.dto.BusinessDto;
import com.ccsens.ptos_open.bean.vo.BusinessVo; import com.ccsens.ptos_open.bean.vo.BusinessVo;
import com.ccsens.ptos_open.bean.vo.PluginVo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
/** /**
@ -46,4 +45,12 @@ public interface IBusinessService {
* @param userId userId * @param userId userId
*/ */
void updateConfig(BusinessDto.UpdateConfig param, Long userId); void updateConfig(BusinessDto.UpdateConfig param, Long userId);
/**
* 通过id查找业务信息
* @param param 配置信息
* @param userId userId
*/
BusinessVo.BusinessInfo queryIdBusiness(BusinessDto.QueryIdBusiness param, Long userId);
} }

2
ptos_open/src/main/resources/mapper_dao/BusinessDao.xml

@ -20,7 +20,7 @@
FROM FROM
`t_open_business` `t_open_business`
WHERE WHERE
creator_id = 2 creator_id = #{userId}
and rec_status = 0 and rec_status = 0
<if test="pub != null"> <if test="pub != null">
and pub = 0 and pub = 0

Loading…
Cancel
Save