Commit c5b79747 authored by chenzhao's avatar chenzhao

检查项接口

parent edd6eb46
......@@ -234,6 +234,26 @@ public class Point extends BasicEntity {
private String ue4Rotation;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
private String bizOrgCode;
private String bizOrgName;
/**
* 物理区域id(数据来源于装备wl_area)
*/
......
......@@ -78,8 +78,13 @@ public class InputItemController extends AbstractBaseController {
public CommonResponse queryItemByPageNew(
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) InputItemPageParam criterias,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
Page<InputItemVo> page = inputItemService.queryInputItemByPageNew(criterias);
ReginParams reginParams = getSelectedOrgInfo();
ResponseModel<Object> companyByBizOrgCodeList = jcsFeignClient.getCompanyByBizOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
//登录人可看到单位级别下的所有检查项
//查询向上查询所属单位的bizOrgCode
String bizOrgCode = ((Map<String, Object>) companyByBizOrgCodeList.getResult()).get("bizOrgCode").toString();
criterias.setBizOrgCode(bizOrgCode);
Page<InputItemVo> page = inputItemService.queryInputItemByPageNew(criterias);
return CommonResponseUtil.success(page);
}
......@@ -397,9 +402,7 @@ public class InputItemController extends AbstractBaseController {
@ApiOperation(value = "新增检查项", notes = "新增检查项")
@RequestMapping(value = "/addItemNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse addNewItemNew(@ApiParam(value = "检查项信息") @RequestBody InputItemParam param) {
if (ObjectUtils.isEmpty(param.getId())) {
return updateItem(param);
}
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
......@@ -410,6 +413,8 @@ public class InputItemController extends AbstractBaseController {
String loginOrgCode = getOrgCode(reginParams);
BeanUtils.copyProperties(param, inputItem);
inputItem.setDataJson(param.getDataJson() != null ?JSONObject.toJSONString(param.getDataJson()) : null);
inputItem.setPictureJson(param.getPictureJson() != null ?JSONObject.toJSONString(param.getPictureJson()) :null);
///LoginUserParam loginParam = getLoginUserParam();
ResponseModel<Object> companyByBizOrgCodeList = jcsFeignClient.getCompanyByBizOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
String bizOrgCode = ((Map<String, Object>) companyByBizOrgCodeList.getResult()).get("bizOrgCode").toString();
......@@ -417,36 +422,38 @@ public class InputItemController extends AbstractBaseController {
inputItem.setBizOrgName(reginParams.getPersonIdentity().getCompanyName()== null? null :reginParams.getPersonIdentity().getCompanyName());
inputItem.setOrgCode(loginOrgCode);
inputItem.setCreateBy(user.getUserId());
inputItemService.addNewInputItem(inputItem);
if (!ObjectUtils.isEmpty(param.getId())) {
inputItem.setId(param.getId());
inputItemService.updateInputItem(inputItem);
}else {
inputItemService.addNewInputItem(inputItem);
}
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure("检查项新增失败: " + e.getMessage());
}
}
/*******新增接口************/
/**
* 分页查询检查项
* 查询巡检项详情
*
* @param queryRequests
* @param pageable
* @param itemID
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分页查询检查项", notes = "分页查询检查项")
@RequestMapping(value = "/queryItemByPageNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryItemByPageNew(
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
//LoginUserParam user = CurUserCompanyCache.getInstance().getCurCompany(getUserId(), getToken());
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("orgCode", loginOrgCode);
InputItemPageParam criterias = InputItemParamUtil.fillInputItemPageParam(queryRequests, pageable, paramMap);
Page<InputItemVo> page = inputItemService.queryInputItemByPage(criterias);
return CommonResponseUtil.success(page);
@ApiOperation(value = "检查项ID新", notes = "检查项详情新")
@RequestMapping(value = "/queryItemNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryItemDetailNew(@ApiParam(value = "巡检项ID") @RequestParam(required = true) Long itemID) {
InputItem bo = inputItemService.queryInputItemDetail(itemID);
InputItemParam inputItemVo = new InputItemParam();
BeanUtils.copyProperties(bo,inputItemVo);
inputItemVo.setDataJson(bo.getDataJson() != null?JSONObject.parse(bo.getDataJson()):null);
inputItemVo.setPictureJson(bo.getPictureJson()!=null?JSONObject.parse(bo.getPictureJson()):null);
return CommonResponseUtil.success(inputItemVo);
}
/*******新增接口************/
}
......@@ -7,7 +7,7 @@ public class InputItemParam {
private long id;
private long catalogId;
private String dataJson;
private Object dataJson;
private String defaultValue;
private String inputJson;
private String isMultiline;
......@@ -17,7 +17,7 @@ public class InputItemParam {
private String name;
private int orderNo;
private String orgCode;
private String pictureJson;
private Object pictureJson;
private String remark;
private String level;
private String itemNo;
......@@ -124,10 +124,10 @@ public class InputItemParam {
public void setCatalogId(long catalogId) {
this.catalogId = catalogId;
}
public String getDataJson() {
public Object getDataJson() {
return dataJson;
}
public void setDataJson(String dataJson) {
public void setDataJson(Object dataJson) {
this.dataJson = dataJson;
}
public String getDefaultValue() {
......@@ -184,10 +184,10 @@ public class InputItemParam {
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getPictureJson() {
public Object getPictureJson() {
return pictureJson;
}
public void setPictureJson(String pictureJson) {
public void setPictureJson(Object pictureJson) {
this.pictureJson = pictureJson;
}
public String getRemark() {
......
......@@ -245,6 +245,9 @@
<if test="catalogIds !=null">
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if>
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
</if>
<choose>
<when test="level == '-0' ">and a.level is null</when>
<when test="level!=null and level != '-0'">and a.level = #{level}</when>
......@@ -277,6 +280,9 @@
<if test="catalogIds !=null">
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if>
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
</if>
<choose>
<when test="level == '-0' ">and a.level is null</when>
<when test="level!=null and level != '-0'">and a.level = #{level}</when>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment