Commit 84c26650 authored by suhuiguang's avatar suhuiguang

1.机器人登录问题处理

parent b3a40168
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-security</artifactId> <artifactId>amos-component-security</artifactId>
<version>1.10.8-TZS</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.typroject</groupId> <groupId>org.typroject</groupId>
......
...@@ -97,11 +97,11 @@ public class ControllerAop { ...@@ -97,11 +97,11 @@ public class ControllerAop {
urls.add("/tcm/flc-unit-info/region/tree"); urls.add("/tcm/flc-unit-info/region/tree");
urls.add("/tcm/reg-unit-info/management-unit/tree"); urls.add("/tcm/reg-unit-info/management-unit/tree");
urls.add("/tcm/reg-unit-info/unit-type/list"); urls.add("/tcm/reg-unit-info/unit-type/list");
urls.add("^/tcm/flc-unit-info/hasExistPhone/[0-9]+$"); urls.add("/tcm/flc-unit-info/hasExistPhone/[0-9]+$");
urls.add("^/tcm/flc-unit-info/sendTelCode/[0-9]+$"); urls.add("/tcm/flc-unit-info/sendTelCode/[0-9]+$");
urls.add("^/tcm/reg-unit-info/[A-Za-z0-9]+/check$"); urls.add("/tcm/reg-unit-info/[A-Za-z0-9]+/check$");
urls.add("^/tcm/flc-unit-info/verifyTelCode/[A-Za-z0-9]+/[A-Za-z0-9]+"); urls.add("/tcm/flc-unit-info/verifyTelCode/[A-Za-z0-9]+/[A-Za-z0-9]+");
urls.add("^/tcm/flc-unit-info/hasExistUser/[A-Za-z0-9_-]+"); urls.add("/tcm/flc-unit-info/hasExistUser/.+");
urls.add("/tcm/reg-unit-info/save"); urls.add("/tcm/reg-unit-info/save");
urls.add("/tcm/reg-unit-info/child-list"); urls.add("/tcm/reg-unit-info/child-list");
urls.add("/tcm/reg-unit-info/management-unit/tree"); urls.add("/tcm/reg-unit-info/management-unit/tree");
......
...@@ -181,7 +181,6 @@ ...@@ -181,7 +181,6 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-security</artifactId> <artifactId>amos-component-security</artifactId>
<version>${amos.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -10,7 +10,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -10,7 +10,7 @@ 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.common.biz.utils.CommonResponseUtil; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzsAuthServiceImpl; import com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService;
import com.yeejoin.amos.boot.module.tcm.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.tcm.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoApproveDto; import com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoApproveDto;
import com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoDto; import com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoDto;
...@@ -30,13 +30,7 @@ import org.apache.commons.lang3.ObjectUtils; ...@@ -30,13 +30,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -45,12 +39,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -45,12 +39,7 @@ 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 java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
/** /**
* 企业信息表 * 企业信息表
...@@ -63,235 +52,231 @@ import java.util.Random; ...@@ -63,235 +52,231 @@ import java.util.Random;
@RequestMapping(value = "/flc-unit-info") @RequestMapping(value = "/flc-unit-info")
public class UnitInfoController extends BaseController { public class UnitInfoController extends BaseController {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
/** /**
* token 过期时间,wechat 系统为7200 ,tzs 系统小于7200 防止获取到无效token * token 过期时间,wechat 系统为7200 ,tzs 系统小于7200 防止获取到无效token
*/ */
private long time = 600l; private long time = 600l;
/** /**
* 企业管理员变更缓存key前缀 * 企业管理员变更缓存key前缀
*/ */
private final String adminChange = "ADMIN_CHANGE_"; private final String adminChange = "ADMIN_CHANGE_";
@Autowired @Autowired
UnitInfoServiceImpl unitInfoServiceImpl; UnitInfoServiceImpl unitInfoServiceImpl;
@Value("${flc.sms.tempCode}") @Value("${flc.sms.tempCode}")
private String smsTempCode; private String smsTempCode;
@Autowired @Autowired
private TzsAuthServiceImpl tzsAuthServiceImpl; private StartPlatformTokenService platformTokenService;
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired @Autowired
UnitInfoChangeServiceImpl unitInfoChangeServiceImpl; UnitInfoChangeServiceImpl unitInfoChangeServiceImpl;
/** /**
* 获取组织机构树 * 获取组织机构树
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false) @TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@GetMapping(value = "/region/tree") @GetMapping(value = "/region/tree")
@ApiOperation(httpMethod = "GET", value = "获取组织机构树", notes = "获取组织机构树") @ApiOperation(httpMethod = "GET", value = "获取组织机构树", notes = "获取组织机构树")
public ResponseModel<Collection<RegionModel>> getRegionTree(@RequestParam(value = "parentId",required = false) Long parentId) { public ResponseModel<Collection<RegionModel>> getRegionTree(@RequestParam(value = "parentId", required = false) Long parentId) {
return ResponseHelper.buildResponse(unitInfoServiceImpl.getRegionTree(parentId, null)); return ResponseHelper.buildResponse(unitInfoServiceImpl.getRegionTree(parentId, null));
} }
/** /**
* 获取提级后组织机构树 * 获取提级后组织机构树
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false) @TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@GetMapping(value = "/region/step/tree") @GetMapping(value = "/region/step/tree")
@ApiOperation(httpMethod = "GET", value = "获取提级后组织机构树", notes = "获取提级后组织机构树") @ApiOperation(httpMethod = "GET", value = "获取提级后组织机构树", notes = "获取提级后组织机构树")
public ResponseModel<Collection<RegionModel>> getRegionStepTree() { public ResponseModel<Collection<RegionModel>> getRegionStepTree() {
return ResponseHelper.buildResponse(unitInfoServiceImpl.getRegionStepTree()); return ResponseHelper.buildResponse(unitInfoServiceImpl.getRegionStepTree());
} }
/** /**
* 获取全国行政区划树 * 获取全国行政区划树
* */
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@GetMapping(value = "/national/region/tree")
@ApiOperation(httpMethod = "GET", value = "获取全国行政区划树", notes = "获取全国行政区划树")
public ResponseModel<Collection<RegionModel>> getNationalRegionTree(@RequestParam(value = "parentId", required = false) Long parentId, @RequestParam(value = "isNationwide", required = false) String isNationwide) {
return ResponseHelper.buildResponse(unitInfoServiceImpl.getRegionTree(parentId, isNationwide));
}
/**
* 获取管辖单位树
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/managerment/tree")
@ApiOperation(httpMethod = "GET", value = "获取管辖单位树", notes = "获取管辖单位树")
public ResponseModel<Collection<CompanyModel>> getManagermentTree() {
Collection<CompanyModel> result = null;
result = Privilege.companyClient.companyTreeWithoutAuth().getResult();
// 隐藏company 数据
Iterator<CompanyModel> it = result.iterator();
while (it.hasNext()) {
CompanyModel temp = it.next();
if ("emergencyCenter".equals(temp.getLevel()) || "company".equals(temp.getLevel())) {
it.remove();
} else {
this.dealCompanyTree(temp);
}
}
return ResponseHelper.buildResponse(result);
}
/**
* 企业信息图片上传 无token
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@PostMapping(value = "/uploadFile")
@ApiOperation(httpMethod = "POST", value = "企业信息图片上传 无token", notes = "企业信息图片上传 无token")
public ResponseModel<String> uploadFile(@ApiParam(value = "文件", required = true) @RequestParam MultipartFile file) {
if (ValidationUtil.isEmpty(file)) {
throw new BadRequest("参数校验失败.");
}
platformTokenService.setRequestContext();
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString = "";
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString = it.next();
}
}
return ResponseHelper.buildResponse(urlString);
}
/**
* 判断组织机构是否存在
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistUnit/{organizationCode}")
@ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在", notes = "判断组织机构是否存在")
public ResponseModel<Boolean> hasExistUnit(@PathVariable(value = "organizationCode") String organizationCode) {
Boolean flag = false;
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) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 判断组织机构是否存在
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistUnit/{unitId}/{organizationCode}")
@ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在-更新", notes = "判断组织机构是否存在-更新")
public ResponseModel<Boolean> hasExistUnitWithId(@PathVariable(value = "unitId") Long unitId, @PathVariable(value = "organizationCode") String organizationCode) {
Boolean flag = false;
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) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 判断用户是否存在
*
* @return
*/ */
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/national/region/tree") @GetMapping(value = "/hasExistUser/{userName}")
@ApiOperation(httpMethod = "GET", value = "获取全国行政区划树", notes = "获取全国行政区划树") @ApiOperation(httpMethod = "GET", value = "判断用户是否存在", notes = "判断用户是否存在")
public ResponseModel<Collection<RegionModel>> getNationalRegionTree(@RequestParam(value = "parentId",required = false) Long parentId, @RequestParam(value = "isNationwide",required = false) String isNationwide) { public ResponseModel<Boolean> hasExistUser(@PathVariable(value = "userName") String userName) {
return ResponseHelper.buildResponse(unitInfoServiceImpl.getRegionTree(parentId, isNationwide)); Boolean flag = false;
} AgencyUserModel user = Privilege.agencyUserClient.queryByUserName(userName).getResult();
if (user != null) {
/** flag = true;
* 获取管辖单位树 }
* return ResponseHelper.buildResponse(flag);
* @return }
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) /**
@GetMapping(value = "/managerment/tree") * 发送手机号验证码
@ApiOperation(httpMethod = "GET", value = "获取管辖单位树", notes = "获取管辖单位树") *
public ResponseModel<Collection<CompanyModel>> getManagermentTree() { * @return
Collection<CompanyModel> result = null; */
result = Privilege.companyClient.companyTreeWithoutAuth().getResult(); @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// 隐藏company 数据 @GetMapping(value = "/sendTelCode/{tel}")
Iterator<CompanyModel> it = result.iterator(); @ApiOperation(httpMethod = "GET", value = "发送手机号验证码", notes = "发送手机号验证码")
while(it.hasNext()) { public ResponseModel<Boolean> sendTelCode(@PathVariable(value = "tel") String tel,
CompanyModel temp = it.next(); @RequestParam(value = "type", required = false) String type) {
if("emergencyCenter".equals(temp.getLevel()) || "company".equals(temp.getLevel())) { if (ValidationUtil.isEmpty(tel)) {
it.remove(); throw new BadRequest("参数校验失败.");
} else { }
this.dealCompanyTree(temp); Boolean flag = false;
} HashMap<String, String> params = new HashMap<>();
} String code = this.getRandomCode();
return ResponseHelper.buildResponse(result); params.put("code", code);
} params.put("mobile", tel);
params.put("smsCode", smsTempCode);
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
/** flag = true;
* 企业信息图片上传 无token } catch (Exception e) {
* throw new BadRequest("发送短信失败:" + e.getMessage());
* @return }
*/ String Key = ObjectUtils.isEmpty(type) ? RedisKey.FLC_USER_TEL : adminChange;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // code 保存到缓存中
@PostMapping(value = "/uploadFile") redisUtils.set(Key + tel, code, time);
@ApiOperation(httpMethod = "POST", value = "企业信息图片上传 无token", notes = "企业信息图片上传 无token") return ResponseHelper.buildResponse(flag);
public ResponseModel<String> uploadFile(@ApiParam(value = "文件", required = true)@RequestParam MultipartFile file) { }
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
tzsAuthServiceImpl.setRequestContext();
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString="";
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString=it.next();
}
}
return ResponseHelper.buildResponse(urlString);
}
/**
* 判断组织机构是否存在
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistUnit/{organizationCode}")
@ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在", notes = "判断组织机构是否存在")
public ResponseModel<Boolean> hasExistUnit( @PathVariable(value = "organizationCode") String organizationCode) {
Boolean flag = false;
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) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 判断组织机构是否存在
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistUnit/{unitId}/{organizationCode}")
@ApiOperation(httpMethod = "GET", value = "判断组织机构是否存在-更新", notes = "判断组织机构是否存在-更新")
public ResponseModel<Boolean> hasExistUnitWithId( @PathVariable(value = "unitId") Long unitId,@PathVariable(value = "organizationCode") String organizationCode) {
Boolean flag = false;
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) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 判断用户是否存在
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistUser/{userName}")
@ApiOperation(httpMethod = "GET", value = "判断用户是否存在", notes = "判断用户是否存在")
public ResponseModel<Boolean> hasExistUser( @PathVariable(value = "userName") String userName) {
Boolean flag = false;
AgencyUserModel user = Privilege.agencyUserClient.queryByUserName(userName).getResult();
if(user != null ) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 发送手机号验证码
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/sendTelCode/{tel}")
@ApiOperation(httpMethod = "GET", value = "发送手机号验证码", notes = "发送手机号验证码")
public ResponseModel<Boolean> sendTelCode( @PathVariable(value = "tel") String tel,
@RequestParam(value = "type", required = false) String type) {
if (ValidationUtil.isEmpty(tel)) {
throw new BadRequest("参数校验失败.");
}
Boolean flag = false;
HashMap<String, String> params = new HashMap<>();
String code = this.getRandomCode();
params.put("code",code);
params.put("mobile",tel);
params.put("smsCode", smsTempCode);
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
flag = true;
} catch (Exception e) {
throw new BadRequest("发送短信失败:" + e.getMessage());
}
String Key = ObjectUtils.isEmpty(type) ? RedisKey.FLC_USER_TEL : adminChange;
// code 保存到缓存中
redisUtils.set(Key + tel, code,time);
return ResponseHelper.buildResponse(flag);
}
/**
* 验证手机号验证码是否成功
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/verifyTelCode/{tel}/{code}")
@ApiOperation(httpMethod = "GET", value = "验证手机号验证码是否成功", notes = "验证手机号验证码是否成功")
public ResponseModel<Boolean> verifyTelCode(@PathVariable(value = "tel") String tel,
@PathVariable(value = "code") String code,
@RequestParam(value = "type", required = false) String type) {
Boolean flag = false;
if (ValidationUtil.isEmpty(tel) || ValidationUtil.isEmpty(code)) {
throw new BadRequest("参数校验失败.");
}
String Key = ObjectUtils.isEmpty(type) ? RedisKey.FLC_USER_TEL : adminChange;
if(redisUtils.hasKey(Key + tel)) {
String redisCode = redisUtils.get(Key + tel).toString();
if(code.equals(redisCode)) {
flag = true;
}
}
// “超级验证码",压测使用
if ("88888888".equals(code)) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 验证手机号验证码是否成功
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/verifyTelCode/{tel}/{code}")
@ApiOperation(httpMethod = "GET", value = "验证手机号验证码是否成功", notes = "验证手机号验证码是否成功")
public ResponseModel<Boolean> verifyTelCode(@PathVariable(value = "tel") String tel,
@PathVariable(value = "code") String code,
@RequestParam(value = "type", required = false) String type) {
Boolean flag = false;
if (ValidationUtil.isEmpty(tel) || ValidationUtil.isEmpty(code)) {
throw new BadRequest("参数校验失败.");
}
String Key = ObjectUtils.isEmpty(type) ? RedisKey.FLC_USER_TEL : adminChange;
if (redisUtils.hasKey(Key + tel)) {
String redisCode = redisUtils.get(Key + tel).toString();
if (code.equals(redisCode)) {
flag = true;
}
}
// “超级验证码",压测使用
if ("88888888".equals(code)) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/** /**
...@@ -300,191 +285,191 @@ public class UnitInfoController extends BaseController { ...@@ -300,191 +285,191 @@ public class UnitInfoController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增企业信息表", notes = "新增企业信息表") @ApiOperation(httpMethod = "POST", value = "新增企业信息表", notes = "新增企业信息表")
public ResponseModel<UnitInfoDto> save(@RequestBody UnitInfoDto model) { public ResponseModel<UnitInfoDto> save(@RequestBody UnitInfoDto model) {
model = unitInfoServiceImpl.saveUnitInfo(model); model = unitInfoServiceImpl.saveUnitInfo(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个企业信息表", notes = "根据sequenceNbr查询单个企业信息表") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个企业信息表", notes = "根据sequenceNbr查询单个企业信息表")
public ResponseModel<UnitInfoDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<UnitInfoDto> selectOne(@PathVariable Long sequenceNbr) {
if (ValidationUtil.isEmpty(sequenceNbr) ) { if (ValidationUtil.isEmpty(sequenceNbr)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
return ResponseHelper.buildResponse(unitInfoServiceImpl.getUnitDtoById(sequenceNbr)); return ResponseHelper.buildResponse(unitInfoServiceImpl.getUnitDtoById(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param pageNum 当前页 * @param pageNum 当前页
* @param pageSize 每页大小 * @param pageSize 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list") @GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "企业审核列表查询", notes = "企业审核列表查询") @ApiOperation(httpMethod = "GET", value = "企业审核列表查询", notes = "企业审核列表查询")
public ResponseModel<IPage<UnitInfoDto>> queryForPage(String pageNum, String pageSize, String sort, UnitInfoDto unitInfoDto) { public ResponseModel<IPage<UnitInfoDto>> queryForPage(String pageNum, String pageSize, String sort, UnitInfoDto unitInfoDto) {
// UnitInfo unitInfo = BeanDtoVoUtils.convert(unitInfoDto, UnitInfo.class); // UnitInfo unitInfo = BeanDtoVoUtils.convert(unitInfoDto, UnitInfo.class);
Page<UnitInfo> pageBean; Page<UnitInfo> pageBean;
IPage<UnitInfo> page; IPage<UnitInfo> page;
QueryWrapper<UnitInfo> unitInfoQueryWrapper = new QueryWrapper<UnitInfo>(); QueryWrapper<UnitInfo> unitInfoQueryWrapper = new QueryWrapper<UnitInfo>();
setQueryWrapper(unitInfoQueryWrapper, unitInfoDto, sort); setQueryWrapper(unitInfoQueryWrapper, unitInfoDto, sort);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); pageBean = new Page<>(0, Long.MAX_VALUE);
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
page = unitInfoServiceImpl.page(pageBean, unitInfoQueryWrapper); page = unitInfoServiceImpl.page(pageBean, unitInfoQueryWrapper);
int num= unitInfoServiceImpl.count(unitInfoQueryWrapper); int num = unitInfoServiceImpl.count(unitInfoQueryWrapper);
pageBean.setTotal(num); pageBean.setTotal(num);
IPage<UnitInfoDto> unitInfoVoIPage = BeanDtoVoUtils.unitInfoIPageDto(page); IPage<UnitInfoDto> unitInfoVoIPage = BeanDtoVoUtils.unitInfoIPageDto(page);
return ResponseHelper.buildResponse(unitInfoVoIPage); return ResponseHelper.buildResponse(unitInfoVoIPage);
} }
/** /**
* 根据企业名称查询详情 * 根据企业名称查询详情
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryByOrgName") @GetMapping(value = "/queryByOrgName")
@ApiOperation(httpMethod = "GET", value = "根据企业名称查询详情", notes = "根据企业名称查询详情") @ApiOperation(httpMethod = "GET", value = "根据企业名称查询详情", notes = "根据企业名称查询详情")
public ResponseModel<UnitInfoDto> queryForPage(@RequestParam(value = "orgName") String orgName) { public ResponseModel<UnitInfoDto> queryForPage(@RequestParam(value = "orgName") String orgName) {
UnitInfoDto unitInfoDto = new UnitInfoDto(); UnitInfoDto unitInfoDto = new UnitInfoDto();
QueryWrapper<UnitInfo> unitInfoQueryWrapper = new QueryWrapper<UnitInfo>(); QueryWrapper<UnitInfo> unitInfoQueryWrapper = new QueryWrapper<UnitInfo>();
unitInfoDto.setOrgName(orgName); unitInfoDto.setOrgName(orgName);
setQueryWrapper(unitInfoQueryWrapper, unitInfoDto, null); setQueryWrapper(unitInfoQueryWrapper, unitInfoDto, null);
List<UnitInfo> list = unitInfoServiceImpl.list(unitInfoQueryWrapper); List<UnitInfo> list = unitInfoServiceImpl.list(unitInfoQueryWrapper);
unitInfoDto = BeanDtoVoUtils.convert(list.get(0), UnitInfoDto.class); unitInfoDto = BeanDtoVoUtils.convert(list.get(0), UnitInfoDto.class);
return ResponseHelper.buildResponse(ValidationUtil.isEmpty(orgName) ? null : unitInfoDto); return ResponseHelper.buildResponse(ValidationUtil.isEmpty(orgName) ? null : unitInfoDto);
} }
private QueryWrapper<UnitInfo> setQueryWrapper(QueryWrapper<UnitInfo> queryWrapper, UnitInfoDto unitInfoDto,String sort) { private QueryWrapper<UnitInfo> setQueryWrapper(QueryWrapper<UnitInfo> queryWrapper, UnitInfoDto unitInfoDto, String sort) {
queryWrapper.eq("is_delete", false); queryWrapper.eq("is_delete", false);
if(sort!=null) { // 排序失效 if (sort != null) { // 排序失效
String[] date= sort.split(","); String[] date = sort.split(",");
if(date[1].equals("ascend")) { if (date[1].equals("ascend")) {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0])); queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
}else { } else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0])); queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
} }
}else { } else {
queryWrapper.orderByDesc("submit_time"); queryWrapper.orderByDesc("submit_time");
} }
if (!ValidationUtil.isEmpty(unitInfoDto.getIsChange())) { // 分类 注册 / 信息变更 0 注册 1 变更 if (!ValidationUtil.isEmpty(unitInfoDto.getIsChange())) { // 分类 注册 / 信息变更 0 注册 1 变更
queryWrapper.eq("is_change",unitInfoDto.getIsChange()); queryWrapper.eq("is_change", unitInfoDto.getIsChange());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getSubmitTimeStart())) { // 提交时间 if (!ValidationUtil.isEmpty(unitInfoDto.getSubmitTimeStart())) { // 提交时间
queryWrapper.ge("submit_time",unitInfoDto.getSubmitTimeStart()); queryWrapper.ge("submit_time", unitInfoDto.getSubmitTimeStart());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getSubmitTimeEnd())) { // 提交时间 if (!ValidationUtil.isEmpty(unitInfoDto.getSubmitTimeEnd())) { // 提交时间
queryWrapper.le("submit_time",unitInfoDto.getSubmitTimeEnd()); queryWrapper.le("submit_time", unitInfoDto.getSubmitTimeEnd());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getUnitTypeCode())) { // 单位类型 if (!ValidationUtil.isEmpty(unitInfoDto.getUnitTypeCode())) { // 单位类型
queryWrapper.like("unit_type_code",unitInfoDto.getUnitTypeCode()); queryWrapper.like("unit_type_code", unitInfoDto.getUnitTypeCode());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getOrgName())) { // 单位名称 if (!ValidationUtil.isEmpty(unitInfoDto.getOrgName())) { // 单位名称
queryWrapper.like("org_name",unitInfoDto.getOrgName()); queryWrapper.like("org_name", unitInfoDto.getOrgName());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getOrganizationCode())) { // 组织机构代码/统一信用代码 if (!ValidationUtil.isEmpty(unitInfoDto.getOrganizationCode())) { // 组织机构代码/统一信用代码
queryWrapper.like("organization_code",unitInfoDto.getOrganizationCode()); queryWrapper.like("organization_code", unitInfoDto.getOrganizationCode());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getAdminName())) { // 管理员 if (!ValidationUtil.isEmpty(unitInfoDto.getAdminName())) { // 管理员
queryWrapper.like("admin_name",unitInfoDto.getAdminName()); queryWrapper.like("admin_name", unitInfoDto.getAdminName());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getAdminTel())) { // 管理员电话 if (!ValidationUtil.isEmpty(unitInfoDto.getAdminTel())) { // 管理员电话
queryWrapper.like("admin_tel",unitInfoDto.getAdminTel()); queryWrapper.like("admin_tel", unitInfoDto.getAdminTel());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getUnitStatus())) { // 审核状态 if (!ValidationUtil.isEmpty(unitInfoDto.getUnitStatus())) { // 审核状态
queryWrapper.eq("unit_status",unitInfoDto.getUnitStatus()); queryWrapper.eq("unit_status", unitInfoDto.getUnitStatus());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getLegalPerson())) { // 法人 if (!ValidationUtil.isEmpty(unitInfoDto.getLegalPerson())) { // 法人
queryWrapper.like("legal_person",unitInfoDto.getLegalPerson()); queryWrapper.like("legal_person", unitInfoDto.getLegalPerson());
} }
if(!ValidationUtil.isEmpty(unitInfoDto.getLegalPersonTel())) { // 法人电话 if (!ValidationUtil.isEmpty(unitInfoDto.getLegalPersonTel())) { // 法人电话
queryWrapper.like("legal_person_tel",unitInfoDto.getLegalPersonTel()); queryWrapper.like("legal_person_tel", unitInfoDto.getLegalPersonTel());
} }
return queryWrapper; return queryWrapper;
} }
private String getRandomCode() {
private String getRandomCode(){ String code = "";
String code = ""; Random random = new Random();
Random random = new Random(); for (int i = 0; i < 6; i++) {
for (int i = 0; i < 6; i++) { int r = random.nextInt(10); //每次随机出一个数字(0-9)
int r = random.nextInt(10); //每次随机出一个数字(0-9) code = code + r; //把每次随机出的数字拼在一起
code = code + r; //把每次随机出的数字拼在一起 }
} return code;
return code;
}
}
/**
/** * 审批企业注册
* 审批企业注册 *
* * @return
* @return */
*/ @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 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("参数校验失败."); }
} try {
try { UnitInfoDto model = unitInfoServiceImpl.approve(approveDto);
UnitInfoDto model = unitInfoServiceImpl.approve(approveDto); return CommonResponseUtil.success(model);
return CommonResponseUtil.success(model); } catch (Exception e) {
} catch (Exception e) { return CommonResponseUtil.failure(e.getMessage());
return CommonResponseUtil.failure(e.getMessage()); }
} }
}
/** /**
* 根据当前登录人获取企业信息 * 根据当前登录人获取企业信息
*
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserUnit") @GetMapping(value = "/getUserUnit")
@ApiOperation(httpMethod = "GET",value = "根据当前登录人获取企业信息", notes = "根据当前登录人获取企业信息") @ApiOperation(httpMethod = "GET", value = "根据当前登录人获取企业信息", notes = "根据当前登录人获取企业信息")
public ResponseModel<UnitInfoDto> getUserUnit() { public ResponseModel<UnitInfoDto> getUserUnit() {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult(); AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys(); List<CompanyModel> companys = user.getCompanys();
UnitInfoDto result = new UnitInfoDto(); UnitInfoDto result = new UnitInfoDto();
for(CompanyModel c : companys) { for (CompanyModel c : companys) {
OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr())); OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete, false).eq(OrgUsr::getAmosOrgId, c.getSequenceNbr()));
if(temp != null) { if (temp != null) {
// 企业信息查看判断是否变更 如果变更信息则返回变更中信息 // 企业信息查看判断是否变更 如果变更信息则返回变更中信息
result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr()); result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr());
if(result.getIsChange() && result.getUnitStatus() == 0) { if (result.getIsChange() && result.getUnitStatus() == 0) {
result = unitInfoChangeServiceImpl.findLastChangInfo(result.getSequenceNbr()); result = unitInfoChangeServiceImpl.findLastChangInfo(result.getSequenceNbr());
} }
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
...@@ -492,208 +477,208 @@ public class UnitInfoController extends BaseController { ...@@ -492,208 +477,208 @@ public class UnitInfoController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 变更企业表 * 变更企业表
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@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 { try {
model = unitInfoServiceImpl.changeUnInfo(model); model = unitInfoServiceImpl.changeUnInfo(model);
return CommonResponseUtil.success(model); return CommonResponseUtil.success(model);
} catch (Exception e) { } catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
/** /**
* 查询审批数据 * 查询审批数据
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/approve/{sequenceNbr}") @GetMapping(value = "/approve/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "查询审批数据", notes = "查询审批数据") @ApiOperation(httpMethod = "GET", value = "查询审批数据", notes = "查询审批数据")
public ResponseModel<UnitInfoDto> getApproveInfo(@PathVariable Long sequenceNbr) { public ResponseModel<UnitInfoDto> getApproveInfo(@PathVariable Long sequenceNbr) {
if (ValidationUtil.isEmpty(sequenceNbr) ) { if (ValidationUtil.isEmpty(sequenceNbr)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
return ResponseHelper.buildResponse(unitInfoServiceImpl.getDtoById(sequenceNbr)); return ResponseHelper.buildResponse(unitInfoServiceImpl.getDtoById(sequenceNbr));
} }
/** /**
* 获取检验机构列表 * 获取检验机构列表
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getInspectionUnit") @GetMapping(value = "/getInspectionUnit")
@ApiOperation(httpMethod = "GET", value = "获取检验机构列表", notes = "获取检验机构列表") @ApiOperation(httpMethod = "GET", value = "获取检验机构列表", notes = "获取检验机构列表")
public ResponseModel<List<UnitInfoDto>> getInspectionUnit() { public ResponseModel<List<UnitInfoDto>> getInspectionUnit() {
List<UnitInfoDto> result = unitInfoServiceImpl.getInspectionUnit(); List<UnitInfoDto> result = unitInfoServiceImpl.getInspectionUnit();
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 获取使用单位列表 * 获取使用单位列表
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/getUseUnit") @PostMapping(value = "/getUseUnit")
@ApiOperation(httpMethod = "POST", value = "获取使用单位列表", notes = "获取使用单位列表") @ApiOperation(httpMethod = "POST", value = "获取使用单位列表", notes = "获取使用单位列表")
public ResponseModel<List<UnitInfoDto>> getUseUnit(@RequestBody UnitInfoDto model) { public ResponseModel<List<UnitInfoDto>> getUseUnit(@RequestBody UnitInfoDto model) {
List<UnitInfoDto> result = unitInfoServiceImpl.getUseUnit(model.getUnitType(),model.getAddress(),model.getOrgName(),model.getOrganizationCode()); List<UnitInfoDto> result = unitInfoServiceImpl.getUseUnit(model.getUnitType(), model.getAddress(), model.getOrgName(), model.getOrganizationCode());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 获取所有单位列表 * 获取所有单位列表
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAllUnit") @GetMapping(value = "/getAllUnit")
@ApiOperation(httpMethod = "GET", value = "获取所有单位列表", notes = "获取所有单位列表") @ApiOperation(httpMethod = "GET", value = "获取所有单位列表", notes = "获取所有单位列表")
public ResponseModel<List<UnitInfoDto>> getAllUnit() { public ResponseModel<List<UnitInfoDto>> getAllUnit() {
List<UnitInfoDto> result = unitInfoServiceImpl.getAllUnit(); List<UnitInfoDto> result = unitInfoServiceImpl.getAllUnit();
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/**
/** * 列表分页查询
* 列表分页查询 *
* * @param pageNum 当前页
* @param pageNum 当前页 * @param pageSize 每页大小
* @param pageSize 每页大小 * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/listPassed")
@GetMapping(value = "/listPassed") @ApiOperation(httpMethod = "GET", value = "企业审核列表查询-通过审核", notes = "企业审核列表查询-通过审核")
@ApiOperation(httpMethod = "GET", value = "企业审核列表查询-通过审核", notes = "企业审核列表查询-通过审核") public ResponseModel<IPage<UnitInfoDto>> queryForPagePassed(String pageNum, String pageSize, String sort, UnitInfoDto unitInfoDto) {
public ResponseModel<IPage<UnitInfoDto>> queryForPagePassed(String pageNum, String pageSize, String sort, UnitInfoDto unitInfoDto) { unitInfoDto.setUnitStatus(1);
unitInfoDto.setUnitStatus(1); Page<UnitInfo> pageBean;
Page<UnitInfo> pageBean; IPage<UnitInfo> page;
IPage<UnitInfo> page; QueryWrapper<UnitInfo> unitInfoQueryWrapper = new QueryWrapper<UnitInfo>();
QueryWrapper<UnitInfo> unitInfoQueryWrapper = new QueryWrapper<UnitInfo>();
setQueryWrapper(unitInfoQueryWrapper, unitInfoDto, sort);
setQueryWrapper(unitInfoQueryWrapper, unitInfoDto, sort);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { pageBean = new Page<>(0, Long.MAX_VALUE);
pageBean = new Page<>(0, Long.MAX_VALUE); } else {
} else { pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); }
} page = unitInfoServiceImpl.page(pageBean, unitInfoQueryWrapper);
page = unitInfoServiceImpl.page(pageBean, unitInfoQueryWrapper); int num = unitInfoServiceImpl.count(unitInfoQueryWrapper);
int num= unitInfoServiceImpl.count(unitInfoQueryWrapper); pageBean.setTotal(num);
pageBean.setTotal(num); IPage<UnitInfoDto> unitInfoVoIPage = BeanDtoVoUtils.unitInfoIPageDto(page);
IPage<UnitInfoDto> unitInfoVoIPage = BeanDtoVoUtils.unitInfoIPageDto(page); return ResponseHelper.buildResponse(unitInfoVoIPage);
return ResponseHelper.buildResponse(unitInfoVoIPage); }
}
/**
/** * 判断用户号码是否存在
* 判断用户号码是否存在 *
* * @return
* @return */
*/ @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 hasExistPhone(@PathVariable(value = "phone") String phone) {
public ResponseModel hasExistPhone( @PathVariable(value = "phone") String phone) { try {
try { return CommonResponseUtil.success(Privilege.agencyUserClient.checkLoginId(phone).getResult());
return CommonResponseUtil.success(Privilege.agencyUserClient.checkLoginId(phone).getResult()); } catch (Exception e) {
} catch (Exception e) { return CommonResponseUtil.failure("该手机号已经注册");
return CommonResponseUtil.failure("该手机号已经注册"); }
} }
}
/**
/** * 手动生成已通过企业的二维码
* 手动生成已通过企业的二维码 *
* * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/addQRcode")
@GetMapping(value = "/addQRcode") @ApiOperation(httpMethod = "GET", value = "手动生成已通过企业的二维码", notes = "手动生成已通过企业的二维码")
@ApiOperation(httpMethod = "GET", value = "手动生成已通过企业的二维码", notes = "手动生成已通过企业的二维码") public ResponseModel<Boolean> addQRcode() {
public ResponseModel<Boolean> addQRcode() { Boolean flag = unitInfoServiceImpl.addQRcode();
Boolean flag = unitInfoServiceImpl.addQRcode(); return ResponseHelper.buildResponse(flag);
return ResponseHelper.buildResponse(flag); }
}
/**
* 根据当前登录人获取企业信息--编辑
/** *
* 根据当前登录人获取企业信息--编辑 * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/getUserUnitEdit")
@GetMapping(value = "/getUserUnitEdit") @ApiOperation(httpMethod = "GET", value = "根据当前登录人获取企业信息--编辑", notes = "根据当前登录人获取企业信息--编辑")
@ApiOperation(httpMethod = "GET",value = "根据当前登录人获取企业信息--编辑", notes = "根据当前登录人获取企业信息--编辑") public ResponseModel<UnitInfoDto> getUserUnitEdit() {
public ResponseModel<UnitInfoDto> getUserUnitEdit() { AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult(); List<CompanyModel> companys = user.getCompanys();
List<CompanyModel> companys = user.getCompanys(); UnitInfoDto result = new UnitInfoDto();
UnitInfoDto result = new UnitInfoDto(); for (CompanyModel c : companys) {
for(CompanyModel c : companys) { OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete, false).eq(OrgUsr::getAmosOrgId, c.getSequenceNbr()));
OrgUsr temp = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr())); if (temp != null) {
if(temp != null) { // 企业信息查看判断是否变更 如果变更信息则返回变更中信息
// 企业信息查看判断是否变更 如果变更信息则返回变更中信息 result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr());
result = unitInfoServiceImpl.getDtoByOrgId(temp.getSequenceNbr()); return ResponseHelper.buildResponse(result);
return ResponseHelper.buildResponse(result); }
} }
} return ResponseHelper.buildResponse(result);
return ResponseHelper.buildResponse(result); }
}
/**
/** * 根据uuid 获取 注册信息
* 根据uuid 获取 注册信息 *
* * @return
* @return */
*/ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @GetMapping(value = "/getUnitInfo/{uuid}")
@GetMapping(value = "/getUnitInfo/{uuid}") @ApiOperation(httpMethod = "GET", value = "根据uuid 获取注册信息", notes = "根据uuid 获取注册信息")
@ApiOperation(httpMethod = "GET", value = "根据uuid 获取注册信息", notes = "根据uuid 获取注册信息") public ResponseModel hasExistUnitWithId(@PathVariable String uuid) {
public ResponseModel hasExistUnitWithId( @PathVariable String uuid) { UnitInfo temp = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete, false).eq(UnitInfo::getCallbackId, uuid).eq(UnitInfo::getUnitStatus, "2"));
UnitInfo temp = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getCallbackId,uuid).eq(UnitInfo::getUnitStatus,"2")); if (temp != null) {
if(temp != null) { return CommonResponseUtil.success(temp);
return CommonResponseUtil.success(temp); } else {
} else { return CommonResponseUtil.failure("未找到该企业信息单,请确认链接地址或该单据已重新提交");
return CommonResponseUtil.failure("未找到该企业信息单,请确认链接地址或该单据已重新提交"); }
} }
}
private void dealCompanyTree(CompanyModel company) {
private void dealCompanyTree(CompanyModel company) { if (!"emergencyCenter".equals(company.getLevel()) && !"company".equals(company.getLevel())) {
if(!"emergencyCenter".equals(company.getLevel()) && !"company".equals(company.getLevel())) { // 判断子节点是否是headquarter
// 判断子节点是否是headquarter Collection children = company.getChildren();
Collection children = company.getChildren(); if (!ValidationUtil.isEmpty(children)) {
if (!ValidationUtil.isEmpty(children)) { Iterator<Map> it = children.iterator();
Iterator<Map> it = children.iterator(); while (it.hasNext()) {
while(it.hasNext()) { Map temp = it.next();
Map temp = it.next(); if ("emergencyCenter".equals(company.getLevel()) || "company".equals(company.getLevel())) {
if("emergencyCenter".equals(company.getLevel()) || "company".equals(company.getLevel())) { it.remove();
it.remove(); } else {
} else { this.dealCompanyTree(temp);
this.dealCompanyTree(temp); }
} }
} }
} }
} }
}
private void dealCompanyTree(Map company) { private void dealCompanyTree(Map company) {
// 判断子节点是否是headquarter // 判断子节点是否是headquarter
Collection children = (Collection) company.get("children"); Collection children = (Collection) company.get("children");
if (!ValidationUtil.isEmpty(children)) { if (!ValidationUtil.isEmpty(children)) {
Iterator<Map> it = children.iterator(); Iterator<Map> it = children.iterator();
while(it.hasNext()) { while (it.hasNext()) {
Map temp = it.next(); Map temp = it.next();
if("emergencyCenter".equals(temp.get("level")) || "company".equals(temp.get("level"))) { if ("emergencyCenter".equals(temp.get("level")) || "company".equals(temp.get("level"))) {
it.remove(); it.remove();
} else { } else {
this.dealCompanyTree(temp); this.dealCompanyTree(temp);
} }
} }
} }
} }
} }
...@@ -19,7 +19,7 @@ import com.yeejoin.amos.boot.module.tcm.api.common.BizCommonConstant; ...@@ -19,7 +19,7 @@ import com.yeejoin.amos.boot.module.tcm.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatMessageDto; import com.yeejoin.amos.boot.module.tcm.api.dto.WechatMessageDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.WechatRelation; import com.yeejoin.amos.boot.module.tcm.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tcm.api.enums.TzsCommonParam; import com.yeejoin.amos.boot.module.tcm.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzsAuthServiceImpl; import com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.WechatRelationServiceImpl; import com.yeejoin.amos.boot.module.tcm.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.WechatServiceImpl; import com.yeejoin.amos.boot.module.tcm.biz.service.impl.WechatServiceImpl;
import com.yeejoin.amos.boot.module.tcm.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.tcm.biz.utils.JsonUtils;
...@@ -73,7 +73,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -73,7 +73,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
private Resource stepRegin; private Resource stepRegin;
@Autowired @Autowired
private TzsAuthServiceImpl tzsAuthServiceImpl; private StartPlatformTokenService platformTokenService;
@Autowired @Autowired
ISourceFileService ISourceFileService; ISourceFileService ISourceFileService;
...@@ -115,7 +115,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -115,7 +115,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
@Transactional @Transactional
public UnitInfoDto saveUnitInfo(UnitInfoDto model) { public UnitInfoDto saveUnitInfo(UnitInfoDto model) {
tzsAuthServiceImpl.setRequestContext(); platformTokenService.setRequestContext();
model.setUnitStatus(0);// 设置为待审核状态 model.setUnitStatus(0);// 设置为待审核状态
model.setSubmitTime(new Date()); // 提交时间 model.setSubmitTime(new Date()); // 提交时间
model.setIsChange(false);// 新增状态不是变更状态 model.setIsChange(false);// 新增状态不是变更状态
...@@ -650,7 +650,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit ...@@ -650,7 +650,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
@Override @Override
public Collection<RegionModel> getRegionTree(Long parentId, String isNationwide) { public Collection<RegionModel> getRegionTree(Long parentId, String isNationwide) {
tzsAuthServiceImpl.setRequestContext(); platformTokenService.setRequestContext();
Collection<RegionModel> result = null; Collection<RegionModel> result = null;
if(parentId == null) { if(parentId == null) {
result = this.getAllRegionTree(isNationwide); result = this.getAllRegionTree(isNationwide);
......
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-security</artifactId> <artifactId>amos-component-security</artifactId>
<version>${amos.version.tzs}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.redisson</groupId> <groupId>org.redisson</groupId>
......
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-feign-workflow</artifactId> <artifactId>amos-feign-workflow</artifactId>
<version>1.10.8</version> <version>${amos.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
......
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