Commit 8ea12711 authored by kongfm's avatar kongfm

修复特种设备相关BUG

parent 219b997b
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller; package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService; import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentInformServiceImpl;
import feign.Response; import feign.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentInformServiceImpl;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/** /**
* 设备告知单 * 设备告知单
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller; package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -10,9 +9,10 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -10,9 +9,10 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
...@@ -157,7 +157,8 @@ public class UnitInfoController extends BaseController { ...@@ -157,7 +157,8 @@ public class UnitInfoController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在", notes = "判断组织机构是否存在") @ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在", notes = "判断组织机构是否存在")
public ResponseModel<Boolean> hasExistUnit( @PathVariable(value = "organizationCode") String organizationCode) { public ResponseModel<Boolean> hasExistUnit( @PathVariable(value = "organizationCode") String organizationCode) {
Boolean flag = false; Boolean flag = false;
UnitInfo temp = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrganizationCode,organizationCode)); UnitInfo temp = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrganizationCode,organizationCode).eq(UnitInfo::getUnitStatus,"1").
or().eq(UnitInfo::getIsChange,true).eq(UnitInfo::getOrganizationCode,organizationCode));
if(temp != null) { if(temp != null) {
flag = true; flag = true;
} }
...@@ -174,7 +175,7 @@ public class UnitInfoController extends BaseController { ...@@ -174,7 +175,7 @@ public class UnitInfoController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在-更新", notes = "判断组织机构是否存在-更新") @ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在-更新", notes = "判断组织机构是否存在-更新")
public ResponseModel<Boolean> hasExistUnitWithId( @PathVariable(value = "unitId") Long unitId,@PathVariable(value = "organizationCode") String organizationCode) { public ResponseModel<Boolean> hasExistUnitWithId( @PathVariable(value = "unitId") Long unitId,@PathVariable(value = "organizationCode") String organizationCode) {
Boolean flag = false; Boolean flag = false;
UnitInfo temp = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrganizationCode,organizationCode).ne(UnitInfo::getSequenceNbr,unitId)); UnitInfo temp = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrganizationCode,organizationCode).ne(UnitInfo::getSequenceNbr,unitId).eq(UnitInfo::getUnitStatus,"1").or().eq(UnitInfo::getIsChange,true));
if(temp != null) { if(temp != null) {
flag = true; flag = true;
} }
...@@ -386,7 +387,6 @@ public class UnitInfoController extends BaseController { ...@@ -386,7 +387,6 @@ public class UnitInfoController extends BaseController {
} }
/** /**
* 审批企业注册 * 审批企业注册
* *
...@@ -395,12 +395,16 @@ public class UnitInfoController extends BaseController { ...@@ -395,12 +395,16 @@ public class UnitInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/approve") @PostMapping(value = "/approve")
@ApiOperation(httpMethod = "POST", value = "审批企业注册", notes = "审批企业注册") @ApiOperation(httpMethod = "POST", value = "审批企业注册", notes = "审批企业注册")
public ResponseModel<UnitInfoDto> approve(@RequestBody UnitInfoApproveDto approveDto) { public ResponseModel approve(@RequestBody UnitInfoApproveDto approveDto) {
if (ValidationUtil.isEmpty(approveDto.getUnitId()) || ValidationUtil.isEmpty(approveDto.getApproveStatus())) { if (ValidationUtil.isEmpty(approveDto.getUnitId()) || ValidationUtil.isEmpty(approveDto.getApproveStatus())) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
UnitInfoDto model = unitInfoServiceImpl.approve(approveDto); try {
return ResponseHelper.buildResponse(model); UnitInfoDto model = unitInfoServiceImpl.approve(approveDto);
return CommonResponseUtil.success(model);
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
} }
...@@ -431,10 +435,6 @@ public class UnitInfoController extends BaseController { ...@@ -431,10 +435,6 @@ public class UnitInfoController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 变更企业表 * 变更企业表
* *
...@@ -444,9 +444,12 @@ public class UnitInfoController extends BaseController { ...@@ -444,9 +444,12 @@ public class UnitInfoController extends BaseController {
@PostMapping(value = "/change") @PostMapping(value = "/change")
@ApiOperation(httpMethod = "POST", value = "变更企业表", notes = "变更企业表") @ApiOperation(httpMethod = "POST", value = "变更企业表", notes = "变更企业表")
public ResponseModel<UnitInfoDto> change(@RequestBody UnitInfoDto model) { public ResponseModel<UnitInfoDto> change(@RequestBody UnitInfoDto model) {
try {
model = unitInfoServiceImpl.changeUnInfo(model); model = unitInfoServiceImpl.changeUnInfo(model);
return ResponseHelper.buildResponse(model); return CommonResponseUtil.success(model);
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
} }
/** /**
...@@ -532,7 +535,6 @@ public class UnitInfoController extends BaseController { ...@@ -532,7 +535,6 @@ public class UnitInfoController extends BaseController {
return ResponseHelper.buildResponse(unitInfoVoIPage); return ResponseHelper.buildResponse(unitInfoVoIPage);
} }
/** /**
* 判断用户号码是否存在 * 判断用户号码是否存在
* *
...@@ -541,9 +543,12 @@ public class UnitInfoController extends BaseController { ...@@ -541,9 +543,12 @@ public class UnitInfoController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistPhone/{phone}") @GetMapping(value = "/hasExistPhone/{phone}")
@ApiOperation(httpMethod = "GET", value = "判断用户号码是否存在", notes = "判断用户号码是否存在") @ApiOperation(httpMethod = "GET", value = "判断用户号码是否存在", notes = "判断用户号码是否存在")
public ResponseModel<Boolean> hasExistPhone( @PathVariable(value = "phone") String phone) { public ResponseModel hasExistPhone( @PathVariable(value = "phone") String phone) {
Boolean flag = Privilege.agencyUserClient.checkLoginId(phone).getResult(); try {
return ResponseHelper.buildResponse(flag); return CommonResponseUtil.success(Privilege.agencyUserClient.checkLoginId(phone).getResult());
} catch (Exception e) {
return CommonResponseUtil.failure("该手机号已经注册");
}
} }
...@@ -562,4 +567,27 @@ public class UnitInfoController extends BaseController { ...@@ -562,4 +567,27 @@ public class UnitInfoController extends BaseController {
/**
* 根据当前登录人获取企业信息--编辑
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserUnitEdit")
@ApiOperation(httpMethod = "GET",value = "根据当前登录人获取企业信息--编辑", notes = "根据当前登录人获取企业信息--编辑")
public ResponseModel<UnitInfoDto> getUserUnitEdit() {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
UnitInfoDto result = new UnitInfoDto();
for(CompanyModel c : companys) {
OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
if(temp != null) {
// 企业信息查看判断是否变更 如果变更信息则返回变更中信息
result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr());
return ResponseHelper.buildResponse(result);
}
}
return ResponseHelper.buildResponse(result);
}
} }
...@@ -142,6 +142,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -142,6 +142,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
} }
Integer approveStatus = approveDto.getApproveStatus(); // 0通过 1驳回 Integer approveStatus = approveDto.getApproveStatus(); // 0通过 1驳回
Boolean changeFlag = false; Boolean changeFlag = false;
UnitInfo temp = this.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrganizationCode,sourceUnit.getOrganizationCode()).eq(UnitInfo::getUnitStatus,"1").ne(UnitInfo::getSequenceNbr,sourceUnit.getSequenceNbr()).
or().eq(UnitInfo::getIsChange,true).eq(UnitInfo::getOrganizationCode,sourceUnit.getOrganizationCode()).ne(UnitInfo::getSequenceNbr,approveDto.getSequenceNbr()));
if(temp != null) {
throw new BadRequest("单位组织编码已存在请确认");
}
if(changeUnit != null) { if(changeUnit != null) {
changeFlag = true; changeFlag = true;
approveDto.setUnitId(changeUnit.getSequenceNbr()); approveDto.setUnitId(changeUnit.getSequenceNbr());
......
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