机构加盟审核接口完善
This commit is contained in:
parent
097740ac9a
commit
5cefecbf42
|
@ -1,6 +1,7 @@
|
||||||
package com.nu.modules.orgapplyinfo.entity;
|
package com.nu.modules.orgapplyinfo.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
@ -104,8 +105,13 @@ public class OrgApplyInfoApiEntity implements Serializable {
|
||||||
private Double orgBuildingArea;
|
private Double orgBuildingArea;
|
||||||
/**机构省份 sys_category.id*/
|
/**机构省份 sys_category.id*/
|
||||||
private java.lang.String orgProvince;
|
private java.lang.String orgProvince;
|
||||||
|
private java.lang.String orgProvince_dictText;
|
||||||
/**机构城市 sys_category.id*/
|
/**机构城市 sys_category.id*/
|
||||||
private java.lang.String orgCity;
|
private java.lang.String orgCity;
|
||||||
|
private java.lang.String orgCity_dictText;
|
||||||
/**机构区域 sys_category.id*/
|
/**机构区域 sys_category.id*/
|
||||||
private java.lang.String orgDistrict;
|
private java.lang.String orgDistrict;
|
||||||
|
private java.lang.String orgDistrict_dictText;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,11 @@
|
||||||
<artifactId>nursing-unit-common</artifactId>
|
<artifactId>nursing-unit-common</artifactId>
|
||||||
<version>${nursingunit.version}</version>
|
<version>${nursingunit.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-base-core</artifactId>
|
||||||
|
<version>3.7.2</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,10 +4,8 @@ import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import org.jeecg.common.constant.ProvinceCityArea;
|
import org.jeecg.common.constant.ProvinceCityArea;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -197,4 +195,11 @@ public class OrgApplyInfo implements Serializable {
|
||||||
@Dict(dictTable = "sys_category",dicCode = "id",dicText = "name")
|
@Dict(dictTable = "sys_category",dicCode = "id",dicText = "name")
|
||||||
private java.lang.String orgDistrict;
|
private java.lang.String orgDistrict;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private java.lang.String orgProvince_dictText;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private java.lang.String orgCity_dictText;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private java.lang.String orgDistrict_dictText;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
package com.nu.modules.orgapplyinfo.service.impl;
|
package com.nu.modules.orgapplyinfo.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi;
|
import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi;
|
||||||
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
|
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
|
||||||
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity;
|
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity;
|
||||||
import com.nu.modules.orgapplyinfo.mapper.OrgApplyInfoMapper;
|
import com.nu.modules.orgapplyinfo.mapper.OrgApplyInfoMapper;
|
||||||
import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService;
|
import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import com.nu.utils.DictUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 机构加盟申请信息表
|
* @Description: 机构加盟申请信息表
|
||||||
|
@ -25,6 +24,9 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, OrgApplyInfo> implements IOrgApplyInfoService, IOrgApplyInfoApi {
|
public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, OrgApplyInfo> implements IOrgApplyInfoService, IOrgApplyInfoApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DictUtils dictUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrgApplyInfoApiEntity insert(OrgApplyInfoApiEntity orgApplyInfoApiEntity) {
|
public OrgApplyInfoApiEntity insert(OrgApplyInfoApiEntity orgApplyInfoApiEntity) {
|
||||||
OrgApplyInfo orgApplyInfo = new OrgApplyInfo();
|
OrgApplyInfo orgApplyInfo = new OrgApplyInfo();
|
||||||
|
@ -45,17 +47,18 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
|
||||||
public List<OrgApplyInfoApiEntity> queryAuditInfo(String tel) {
|
public List<OrgApplyInfoApiEntity> queryAuditInfo(String tel) {
|
||||||
QueryWrapper<OrgApplyInfo> qw = new QueryWrapper<>();
|
QueryWrapper<OrgApplyInfo> qw = new QueryWrapper<>();
|
||||||
qw.eq("tel", tel);
|
qw.eq("tel", tel);
|
||||||
// qw.in("status",new String[]{"1","3"});//审核状态为审核中、驳回的
|
|
||||||
qw.orderByDesc("create_time");
|
qw.orderByDesc("create_time");
|
||||||
List<OrgApplyInfo> list = baseMapper.selectList(qw);
|
List<OrgApplyInfo> list = baseMapper.selectList(qw);
|
||||||
List<OrgApplyInfoApiEntity> result = Lists.newArrayList();
|
|
||||||
result = list.stream()
|
for(OrgApplyInfo par:list){
|
||||||
.map(item -> {
|
par.setOrgProvince_dictText(dictUtils.translateDictValue("id","name","sys_category",par.getOrgProvince()));
|
||||||
OrgApplyInfoApiEntity entity = new OrgApplyInfoApiEntity();
|
par.setOrgCity_dictText(dictUtils.translateDictValue("id","name","sys_category",par.getOrgCity()));
|
||||||
BeanUtils.copyProperties(item, entity);
|
par.setOrgDistrict_dictText(dictUtils.translateDictValue("id","name","sys_category",par.getOrgDistrict()));
|
||||||
return entity;
|
}
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
String jsonStr = JSON.toJSONString(list);
|
||||||
|
List<OrgApplyInfoApiEntity> result = JSON.parseArray(jsonStr, OrgApplyInfoApiEntity.class);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/common")
|
@RequestMapping("/api/common")
|
||||||
public class CommonApi {
|
public class NuCommonApi {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysBaseAPI sysBaseAPI;
|
private ISysBaseAPI sysBaseAPI;
|
||||||
|
@ -25,4 +25,9 @@ public class CommonApi {
|
||||||
public Result<Object> queryAreaDict(@RequestParam("id") String id) {
|
public Result<Object> queryAreaDict(@RequestParam("id") String id) {
|
||||||
return Result.ok(sysBaseAPI.queryCategoryByPid(id));
|
return Result.ok(sysBaseAPI.queryCategoryByPid(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/queryAreaNameById")
|
||||||
|
public Result<Object> queryAreaNameById(@RequestParam("id") String id) {
|
||||||
|
return Result.ok(sysBaseAPI.queryAreaNameById(id));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -142,6 +142,8 @@ public interface CommonAPI {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys, String dataSource);
|
List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys, String dataSource);
|
||||||
|
|
||||||
|
Object queryAreaNameById(String id);
|
||||||
//update-end---author:chenrui ---date:20231221 for:[issues/#5643]解决分布式下表字典跨库无法查询问题------------
|
//update-end---author:chenrui ---date:20231221 for:[issues/#5643]解决分布式下表字典跨库无法查询问题------------
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,175 @@
|
||||||
|
package com.nu.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.jeecg.common.api.CommonAPI;
|
||||||
|
import org.jeecg.common.aspect.DictAspect;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典翻译辅助工具类
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class DictUtils {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(DictAspect.class);
|
||||||
|
|
||||||
|
private CommonAPI commonAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setCommonAPI(CommonAPI commonAPI) {
|
||||||
|
this.commonAPI = commonAPI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译字典,支持@Dict的翻译,翻译出的字段放在有@Dict字段的名字 + "_dictText"
|
||||||
|
* @param o 传入的是单个entity对象
|
||||||
|
* @return 返回的是json对象
|
||||||
|
*/
|
||||||
|
public JSONObject translateDict(Object o){
|
||||||
|
Field[] fields = ReflectUtil.getFields(o.getClass());
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
String json = "{}";
|
||||||
|
try {
|
||||||
|
json = mapper.writeValueAsString(o);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.error("json解析失败" + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
JSONObject item = JSONObject.parseObject(json);
|
||||||
|
for (Field field:fields){
|
||||||
|
if (field.getAnnotation(Dict.class) != null) {
|
||||||
|
String key = String.valueOf(item.get(field.getName()));
|
||||||
|
String textValue = getDictTxt(field,key);
|
||||||
|
item.put(field.getName() + "_dictText", textValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译字典,支持@Dict的翻译,翻译出的字段放在有@Dict字段的名字 + "_dictText"<br/>
|
||||||
|
* 在clazz与o不是一种对象时使用<br/>
|
||||||
|
* 如果需要保持一致请使用{@link org.jeecg.modules.tools.DictUtils#translateDictSelf}
|
||||||
|
* @param o 传入的是单个entity对象
|
||||||
|
* @param clazz 返回对象的类型
|
||||||
|
* @return 传入的clazz类型的新对象
|
||||||
|
* @throws IllegalAccessException
|
||||||
|
*/
|
||||||
|
public <T> T translateDict(Object o,Class<T> clazz) throws IllegalAccessException {
|
||||||
|
Field[] fields = ReflectUtil.getFields(clazz);
|
||||||
|
T rObject = ReflectUtil.newInstance(clazz);
|
||||||
|
//将所有内容转入新对象里
|
||||||
|
BeanUtil.copyProperties(o,rObject);
|
||||||
|
return translateDictSelf(rObject,clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译字典,支持@Dict的翻译,翻译出的字段放在有@Dict字段的名字 + "_dictText"<br/>
|
||||||
|
* 此方法返回自己,保证是同一个对象,以方便list使用<br/>
|
||||||
|
* 如果需要保持一致请使用{@link org.jeecg.modules.tools.DictUtils#translateDict}
|
||||||
|
* @param o 传入的是单个entity对象,也是返回的对象
|
||||||
|
* @param clazz 返回对象的类型
|
||||||
|
* @return 返回的是变量o这个对象
|
||||||
|
* @throws IllegalAccessException
|
||||||
|
*/
|
||||||
|
public <T> T translateDictSelf(T o,Class<T> clazz) throws IllegalAccessException {
|
||||||
|
Field[] fields = ReflectUtil.getFields(clazz);
|
||||||
|
for (Field field:fields){
|
||||||
|
if (field.getAnnotation(Dict.class) != null) {
|
||||||
|
boolean accessible = field.isAccessible();
|
||||||
|
field.setAccessible(true);
|
||||||
|
String key = String.valueOf(field.get(o));
|
||||||
|
field.setAccessible(accessible);
|
||||||
|
String textValue = getDictTxt(field,key);
|
||||||
|
Field newField = ReflectUtil.getField(clazz,field.getName() + "_dictText");
|
||||||
|
//为空则赋值失败
|
||||||
|
if(newField != null){
|
||||||
|
boolean accessibleNew = newField.isAccessible();
|
||||||
|
newField.setAccessible(true);
|
||||||
|
newField.set(o,textValue);
|
||||||
|
newField.setAccessible(accessibleNew);
|
||||||
|
}else{
|
||||||
|
log.error("字段【{}{}】不存在!值为:{} ",field.getName(),"_dictText",textValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取根据属性和真实的值获取字典值
|
||||||
|
* @param field 反射出来的类属性
|
||||||
|
* @param key 查询的值
|
||||||
|
* @return 字典文本
|
||||||
|
*/
|
||||||
|
private String getDictTxt(Field field,String key){
|
||||||
|
boolean accessible = field.isAccessible();
|
||||||
|
field.setAccessible(true);
|
||||||
|
String code = field.getAnnotation(Dict.class).dicCode();
|
||||||
|
String text = field.getAnnotation(Dict.class).dicText();
|
||||||
|
String table = field.getAnnotation(Dict.class).dictTable();
|
||||||
|
String textValue = translateDictValue(code, text, table, key);
|
||||||
|
log.debug(" 字典Val : " + textValue);
|
||||||
|
log.debug(" __翻译字典字段__ " + field.getName() + "_dictText" + ": " + textValue);
|
||||||
|
field.setAccessible(accessible);
|
||||||
|
return textValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译字典
|
||||||
|
* @param code 字典code字段
|
||||||
|
* @param key 字典查询的值
|
||||||
|
* @return 字典文本
|
||||||
|
*/
|
||||||
|
public String translateDictValue(String code, String key) {
|
||||||
|
return translateDictValue(code,"","",key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻译字典
|
||||||
|
* @param code 字典code字段
|
||||||
|
* @param text 字典文字字段
|
||||||
|
* @param table 字典表名
|
||||||
|
* @param key 字典查询的值
|
||||||
|
* @return 字典文本
|
||||||
|
*/
|
||||||
|
public String translateDictValue(String code, String text, String table, String key) {
|
||||||
|
if (oConvertUtils.isEmpty(key)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
StringBuilder textValue = new StringBuilder();
|
||||||
|
String[] keys = key.split(",");
|
||||||
|
for(int i = 0; i < keys.length; ++i) {
|
||||||
|
String k = keys[i];
|
||||||
|
String tmpValue;
|
||||||
|
log.debug(" 字典 key : " + k);
|
||||||
|
if (k.trim().length() != 0) {
|
||||||
|
if (!StringUtils.isEmpty(table)) {
|
||||||
|
log.debug("--DictUtils------dicTable=" + table + " ,dicText= " + text + " ,dicCode=" + code);
|
||||||
|
tmpValue = this.commonAPI.translateDictFromTable(table, text, code, k.trim());
|
||||||
|
} else {
|
||||||
|
tmpValue = this.commonAPI.translateDict(code, k.trim());
|
||||||
|
}
|
||||||
|
if (tmpValue != null) {
|
||||||
|
if (!"".equals(textValue.toString())) {
|
||||||
|
textValue.append(",");
|
||||||
|
}
|
||||||
|
textValue.append(tmpValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return textValue.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -714,10 +714,17 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不要改排序 排序固定用first_letter asc
|
||||||
|
* @param pid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysCategoryModel> queryCategoryByPid(String pid) {
|
public List<SysCategoryModel> queryCategoryByPid(String pid) {
|
||||||
QueryWrapper<SysCategory> qw = new QueryWrapper<>();
|
QueryWrapper<SysCategory> qw = new QueryWrapper<>();
|
||||||
qw.eq("pid",pid);
|
qw.eq("pid",pid);
|
||||||
|
//专门解决获取行政区排序问题的
|
||||||
|
qw.orderByAsc("first_letter");
|
||||||
List<SysCategory> list = categoryMapper.selectList(qw);
|
List<SysCategory> list = categoryMapper.selectList(qw);
|
||||||
return BeanUtil.copyToList(list, SysCategoryModel.class);
|
return BeanUtil.copyToList(list, SysCategoryModel.class);
|
||||||
}
|
}
|
||||||
|
@ -1914,4 +1921,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAreaNameById(String id) {
|
||||||
|
QueryWrapper<SysCategory> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("id",id);
|
||||||
|
return categoryMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,11 +249,11 @@ jeecg:
|
||||||
app: http://localhost:8051
|
app: http://localhost:8051
|
||||||
path:
|
path:
|
||||||
#服务指令上传目录
|
#服务指令上传目录
|
||||||
directivepath: /opt/upFiles/directive
|
directivepath: /cache/nu//opt/upFiles/directive
|
||||||
#文件上传根目录 设置
|
#文件上传根目录 设置
|
||||||
upload: /opt/upFiles
|
upload: /cache/nu//opt/upFiles
|
||||||
#webapp文件路径
|
#webapp文件路径
|
||||||
webapp: /opt/webapp
|
webapp: /cache/nu//opt/webapp
|
||||||
shiro:
|
shiro:
|
||||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
|
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
|
||||||
#阿里云oss存储和大鱼短信秘钥配置
|
#阿里云oss存储和大鱼短信秘钥配置
|
||||||
|
|
Loading…
Reference in New Issue