Commit 3ad0d208 authored by chenzhao's avatar chenzhao

增加新增检查项新接口

parent 8ff0ae47
......@@ -394,4 +394,20 @@ public class OrgPersonController extends BaseController {
public ResponseModel<String> deleteFirefighterPeopleById(@PathVariable Long id) {
return ResponseHelper.buildResponse(iOrgUsrService.deleteFirefighterPeopleById(id));
}
/**
*
* **/
/**
* 根据bizOrgCode查询
* @param bizOrgCode
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getByBizOrgCode/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据bizOrgCode查询", notes = "根据bizOrgCode查询")
public ResponseModel<List<OrgUsr>> personListByBizOrgCode(@RequestParam Map<String, Object> requestBody) {
return ResponseHelper.buildResponse(iOrgUsrService.personListByBizOrgCode( requestBody.containsKey("bizOrgCode") ? requestBody.get("bizOrgCode").toString() : null));
}
}
......@@ -2525,16 +2525,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr orgUsr = baseMapper.selectOne(wrapper);
OrgUsrDto orgUsrDto = new OrgUsrDto();
if (!orgUsr.getBizOrgType().equals(COMPANY_VALUE)) {
for (int i = 0; i < 10; i++) {
OrgUsr result = baseMapper.selectById(orgUsr.getParentId());
if (result.getBizOrgType().equals(COMPANY_VALUE)) {
BeanUtils.copyProperties(result, orgUsrDto);
break;
//查询当前登录人所属单位/部门
orgUsr = orgUsrMapper.selectById(orgUsr.getParentId());
//判断登陆人是否已经是顶级节点单位
if (orgUsr.getParentId() != null ){
orgUsr =iOrgUsrService.selectParentOrgUsr(orgUsr);
}
}
} else {
BeanUtils.copyProperties(orgUsr, orgUsrDto);
}
return orgUsrDto;
}
......@@ -3188,4 +3187,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return flag;
}
public List<OrgUsr> personListByBizOrgCode(String bizOrgCode){
QueryWrapper<OrgUsr> wrapper = new QueryWrapper<>();
wrapper.eq("is_delete",false);
wrapper.likeRight("biz_org_code",bizOrgCode);
wrapper.eq("biz_org_type","PERSON");
return baseMapper.selectList(wrapper);
}
}
\ No newline at end of file
......@@ -3,7 +3,10 @@ package com.yeejoin.amos.patrol.business.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -42,6 +45,7 @@ import com.yeejoin.amos.patrol.dao.entity.InputItem;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* 检查项
......@@ -60,6 +64,8 @@ public class InputItemController extends AbstractBaseController {
IInputItemService inputItemService;
@Autowired
IInputItemDao inputItemDao;
@Autowired
JcsFeignClient jcsFeignClient;
/**
* 新增巡检项
......@@ -94,6 +100,7 @@ public class InputItemController extends AbstractBaseController {
}
}
/**
* 查询巡检项详情
*
......@@ -139,7 +146,7 @@ public class InputItemController extends AbstractBaseController {
/**
* 批量删除检查项
*
* @param itemID
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -180,7 +187,7 @@ public class InputItemController extends AbstractBaseController {
/**
* 检查项另存为
*
* @param itemID
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -357,4 +364,68 @@ public class InputItemController extends AbstractBaseController {
public CommonResponse getCheckClassify() {
return CommonResponseUtil.success(inputItemService.getCheckClassify(getToken(), getProduct(), getAppKey(), DictTypeEnum.CHECK_CLASSIFY.getCode()));
}
/*******新增接口************/
/**
* 新增巡检项
*
* @param param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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过期");
}
try {
InputItem inputItem = new InputItem();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
BeanUtils.copyProperties(param, inputItem);
///LoginUserParam loginParam = getLoginUserParam();
ResponseModel<Object> companyByBizOrgCodeList = jcsFeignClient.getCompanyByBizOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
String bizOrgCode = ((Map<String, Object>) companyByBizOrgCodeList.getResult()).get("bizOrgCode").toString();
inputItem.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode() == null? null :reginParams.getPersonIdentity().getBizOrgCode() );
inputItem.setBizOrgName(reginParams.getPersonIdentity().getCompanyName()== null? null :reginParams.getPersonIdentity().getCompanyName());
inputItem.setOrgCode(loginOrgCode);
inputItem.setCreateBy(user.getUserId());
inputItemService.addNewInputItem(inputItem);
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure("检查项新增失败: " + e.getMessage());
}
}
/**
* 分页查询检查项
*
* @param queryRequests
* @param pageable
* @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);
}
}
......@@ -44,6 +44,7 @@ public interface JcsFeignClient {
@GetMapping(value = "/org-usr/find/getByOrgCode")
ResponseModel<Object> getByOrgCode(@RequestParam String bizOrgCode);
@GetMapping(value = "/org-usr//company/bizOrgCode/list")
ResponseModel<Object> getCompanyByBizOrgCodeList(@RequestParam String bizOrgCode);
}
package com.yeejoin.amos.patrol.business.param;
import javax.persistence.Column;
public class InputItemParam {
private long id;
......@@ -24,6 +26,62 @@ public class InputItemParam {
private String checkMethod;
private String unit;
/**
* 新加字段
*
* */
//单位code
private String bizOrgCode;
//单位名称
private String bizOrgName;
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;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getFacilitiesType() {
return facilitiesType;
}
public void setFacilitiesType(String facilitiesType) {
this.facilitiesType = facilitiesType;
}
public String getKeyPartsType() {
return keyPartsType;
}
public void setKeyPartsType(String keyPartsType) {
this.keyPartsType = keyPartsType;
}
//消防装备类型
private String equipmentType;
//消防设施类型、
private String facilitiesType;
// 重点类型
private String keyPartsType;
public String getUnit() {
return unit;
}
......
......@@ -94,6 +94,32 @@ public class InputItemVo {
*/
private String riskDesc;
/**
* 新加字段
*
* */
//单位code
private String bizOrgCode;
//单位名称
private String bizOrgName;
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;
}
public String getItemNo() {
return itemNo;
}
......
......@@ -54,6 +54,8 @@
<result property="level" column="level" />
<result property="itemNo" column="item_no" />
<result property="riskDesc" column="risk_desc" />
<result property="bizOrgName" column="biz_org_name" />
<result property="bizOrgCode" column="biz_org_code" />
</resultMap>
<!--统计 -->
<select id="countInputItemInfoData" resultType="long">
......@@ -90,7 +92,8 @@
b.name as catalog_name,
a.remark,
a.level,
a.risk_desc
a.risk_desc,
a.biz_org_name
from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0'
......
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