Commit 31190318 authored by chenzhao's avatar chenzhao

增加 根据公司的unitCode获取检测检验人员联系电话

parent 840bf9fe
......@@ -18,6 +18,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author system_generator
......@@ -46,14 +47,32 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/getUserPhonesByPersonCode")
@ApiOperation(httpMethod = "GET", value = "根据公司的unitCode获取检测检验人员列表", notes = "根据公司的unitCode获取检测检验人员列表")
@ApiOperation(httpMethod = "GET", value = "根据公司的unitCode获取检测检验人员联系电话", notes = "根据公司的unitCode获取检测检验人员联系电话")
public ResponseModel<Map<String,Object>> getUserPhonesByPersonCode(@RequestParam String unitCode) {
List<TzsUserInfo> userPhones = commonserviceImpl.getUserPhonesByPersonCode(unitCode);
if (CollectionUtils.isEmpty(userPhones)){
return null;
}
List<String> phones = userPhones.stream().map(TzsUserInfo::getPhone).collect(Collectors.toList());
String phone = String.join(",", phones);
Map<String,Object> map = new HashMap<>();
map.put("phone",phone);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/getInnerPersonCodeByPersonCode")
@ApiOperation(httpMethod = "GET", value = "根据公司的unitCode获取检测检验人员内部编号", notes = "根据公司的unitCode获取检测检验人员内部编号")
public ResponseModel<Map<String,Object>> getInnerPersonCodeByPersonCode(@RequestParam String unitCode) {
List<TzsUserInfo> userPhones = commonserviceImpl.getUserPhonesByPersonCode(unitCode);
if (CollectionUtils.isEmpty(userPhones)){
return null;
}
List<String> phones = userPhones.stream().map(TzsUserInfo::getInnerPersonCode).collect(Collectors.toList());
String innerPersonCode = String.join(",", phones);
Map<String,Object> map = new HashMap<>();
map.put("phone",userPhones.get(0).getPhone() == null?"":userPhones.get(0).getPhone());
map.put("innerPersonCode",innerPersonCode);
return ResponseHelper.buildResponse(map);
}
......
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -50,8 +51,10 @@ public class CommonserviceImpl {
}
public List<TzsUserInfo> getUserPhonesByPersonCode(String personCode) {
List<String> ids = StrUtil.split(personCode, ",");
QueryWrapper userInfoQueryWrapper = new QueryWrapper<>();
userInfoQueryWrapper.eq("sequence_nbr", personCode);
userInfoQueryWrapper.in("sequence_nbr", ids);
List<TzsUserInfo> userInfos = userInfoMapper.selectList(userInfoQueryWrapper);
return userInfos;
}
......
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