Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangzhijiang
2022-03-02 09:04:48 +08:00
31 changed files with 849 additions and 44 deletions
@@ -17,12 +17,12 @@ public class DictModel implements Serializable{
public DictModel() { public DictModel() {
} }
public DictModel(String value, String text) { public DictModel(String value, String text) {
this.value = value; this.value = value;
this.text = text; this.text = text;
} }
/** /**
* 字典value * 字典value
*/ */
@@ -32,6 +32,11 @@ public class DictModel implements Serializable{
*/ */
private String text; private String text;
/**
* 字典文本
*/
private String textEn;
/** /**
* 特殊用途: JgEditableTable * 特殊用途: JgEditableTable
* @return * @return
@@ -51,6 +51,8 @@ public class SysDepartTreeModel implements Serializable{
private String orgCode; private String orgCode;
private String parentCode;
private String mobile; private String mobile;
private String fax; private String fax;
@@ -74,6 +76,13 @@ public class SysDepartTreeModel implements Serializable{
private List<SysDepartTreeModel> children = new ArrayList<>(); private List<SysDepartTreeModel> children = new ArrayList<>();
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public boolean getIsLeaf() { public boolean getIsLeaf() {
return isLeaf; return isLeaf;
@@ -312,6 +321,7 @@ public class SysDepartTreeModel implements Serializable{
Objects.equals(orgCategory, model.orgCategory) && Objects.equals(orgCategory, model.orgCategory) &&
Objects.equals(orgType, model.orgType) && Objects.equals(orgType, model.orgType) &&
Objects.equals(orgCode, model.orgCode) && Objects.equals(orgCode, model.orgCode) &&
Objects.equals(parentCode, model.parentCode) &&
Objects.equals(mobile, model.mobile) && Objects.equals(mobile, model.mobile) &&
Objects.equals(fax, model.fax) && Objects.equals(fax, model.fax) &&
Objects.equals(address, model.address) && Objects.equals(address, model.address) &&
@@ -332,9 +342,9 @@ public class SysDepartTreeModel implements Serializable{
public int hashCode() { public int hashCode() {
return Objects.hash(id, parentId, departName, departNameEn, departNameAbbr, return Objects.hash(id, parentId, departName, departNameEn, departNameAbbr,
departOrder, description, orgCategory, orgType, orgCode, mobile, fax, address, departOrder, description, orgCategory, orgType, orgCode, parentCode,
memo, status, delFlag, createBy, createTime, updateBy, updateTime, mobile, fax, address, memo, status, delFlag, createBy, createTime,
children); updateBy, updateTime, children);
} }
} }
+7 -1
View File
@@ -50,7 +50,13 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
</dependencies> <dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project> </project>
@@ -344,12 +344,17 @@ public class SysDictController {
Result<SysDict> result = new Result<SysDict>(); Result<SysDict> result = new Result<SysDict>();
try { try {
if(StringUtils.isEmpty(sysDict.getDictName())){ if(StringUtils.isEmpty(sysDict.getDictName())){
sysDict.setDictCode(sysDict.getDictName()); String pinYin = sysDictService.getAllPinyin(sysDict.getDictName());
}else { sysDict.setDictCode(pinYin);
sysDict.setCreateTime(new Date());
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
sysDictService.save(sysDict); }else {
Integer count = sysDictService.queryExitData(sysDict);
if (count > 0) {
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
} else {
sysDict.setCreateTime(new Date());
sysDictService.save(sysDict);
}
result.success("保存成功!"); result.success("保存成功!");
//添加成功后需要刷新缓存 //添加成功后需要刷新缓存
sysDictService.refreshCache(); sysDictService.refreshCache();
@@ -362,6 +367,7 @@ public class SysDictController {
return result; return result;
} }
/** /**
* @功能:编辑 * @功能:编辑
* @param sysDict * @param sysDict
@@ -377,7 +383,7 @@ public class SysDictController {
result.error500("未找到对应实体"); result.error500("未找到对应实体");
}else { }else {
if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(sysDict.getIsReadOnly()))) { if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(sysDict.getIsReadOnly()))) {
if (sysDict.getIsReadOnly() == 1) { if (FixedFieldEnum.FIXED_FIELD_ENUM.getValue().equals(sysDict.getIsReadOnly())) {
result.error500("固定字段,不可删除"); result.error500("固定字段,不可删除");
}else{ }else{
sysDict.setUpdateTime(new Date()); sysDict.setUpdateTime(new Date());
@@ -420,6 +426,37 @@ public class SysDictController {
} }
return result; return result;
} }
/**
* @功能:删除
* @param id
* @return
*/
@ApiOperation(value = "字典控制器-逻辑删除字典", notes = "字典控制器-逻辑删除字典")
@RequiresRoles({"admin"})
@DeleteMapping(value = "/logicDelete")
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDict> logicDelete(@RequestParam(name="id",required=true) String id) {
Result<SysDict> result = new Result<SysDict>();
try{
SysDict sysDict = sysDictService.queryById(id);
if (StringUtils.isNotBlank(String.valueOf(sysDict.getIsReadOnly()))) {
if (FixedFieldEnum.FIXED_FIELD_ENUM.getValue().equals(sysDict.getIsReadOnly())) {
result.error500("固定字段,不可删除");
} else {
sysDict.setDelFlag(CommonConstant.DEL_FLAG_1);
result.success("删除成功!");
//添加成功后需要刷新缓存
sysDictService.refreshCache();
}
}
}catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("删除失败");
}
return result;
}
/** /**
* @功能:批量删除 * @功能:批量删除
* @param ids * @param ids
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.constant.CacheConstant; import com.jero.common.constant.CacheConstant;
import com.jero.common.constant.CommonConstant;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.enums.FixedFieldEnum; import com.jero.modules.enums.FixedFieldEnum;
import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysDictItem;
@@ -73,6 +74,7 @@ public class SysDictItemController {
Result<SysDictItem> result = new Result<SysDictItem>(); Result<SysDictItem> result = new Result<SysDictItem>();
try { try {
sysDictItem.setCreateTime(new Date()); sysDictItem.setCreateTime(new Date());
sysDictItem.setDelFlag(CommonConstant.DEL_FLAG_0);
sysDictItemService.save(sysDictItem); sysDictItemService.save(sysDictItem);
result.success("保存成功!"); result.success("保存成功!");
} catch (Exception e) { } catch (Exception e) {
@@ -143,6 +145,34 @@ public class SysDictItemController {
return result; return result;
} }
/**
* @功能:逻辑删除字典数据
* @param id
* @return
*/
//@RequiresRoles({"admin"})
@RequiresPermissions("sys:dict:list")
@RequestMapping(value = "/logicDelete", method = RequestMethod.DELETE)
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
public Result<SysDictItem> logicDelete(@RequestParam(name="id",required=true) String id) {
Result<SysDictItem> result = new Result<SysDictItem>();
SysDictItem joinSystem = sysDictItemService.getById(id);
if (joinSystem == null) {
result.error500("未找到对应实体");
}else {
if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(joinSystem.getIsReadOnly()))) {
if (FixedFieldEnum.FIXED_FIELD_ENUM.getValue().equals(joinSystem.getIsReadOnly())) {
result.error500("固定字段,不可删除");
}
else {
joinSystem.setDelFlag(CommonConstant.DEL_FLAG_1);
result.success("删除成功!");
}
}
}
return result;
}
/** /**
* @功能:批量删除字典数据 * @功能:批量删除字典数据
* @param ids * @param ids
@@ -0,0 +1,60 @@
package com.jero.modules.system.entity;
import lombok.Data;
import java.util.Date;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 10:01 2022/3/1
*/
@Data
public class PPEmployee {
private String data_difference; //数据来源[WORKDAY,XPT,NIOCAPITAL]
private String employee_difference; // 员工来源[CN, EU_US,EU]
private String employee_id; // 员工编号(员工唯一标识)
private String worker_user_id; //WD帐号创建SSO账号 / AD账户
private String user_name; // WD同步到people的域帐号
private String foreign_employee_id; // 兼职公司对应的员工编号
private String name; // 全名
private String formatted_name; // 全名-拼音及中文
private String preferred_first_name; // 首选-名
private String preferred_last_name; // 首选-姓
private String first_name; //法定-名-拼音
private String middle_name; // 中间-名 - 英文
private String last_name; // 法定-姓-拼音
private String english_name; // 英文名称
private String name_in_local_script; // 法定-姓名-中文
private String first_name_in_local_script; // 名-中文
private String last_name_in_local_script; // 姓-中文
private String delete_flag; // 删除标记[1:存在;0:删除]
private String delete_time; // 删除时间
private String delay_flag; // 延期标记(0:延期,1:未延期,2:未操作)
private String delay_time; // 延期时间
private String employee_status; // 员工状态[Active,Terminated]
private String outsourcing_type; // 外包形式
private String worker_type; // 员工种类 EmployeeContingent Worker
private String hire_date; // 员工入职日期
private String original_hire_date; // 员工原始入职日期
private String rehire; // 重新雇用[1:是;0:否]
private String seniority_date; // 工龄开始日期
private String is_terminated; // 离职状态[1:是;0:否]
private String termination_date; // 离职日期
private String termination_last_day_of_work; // 最后工作日期
private String primary_termination_reason; // 主要离职原因
private String hire_reason; // 雇佣原因
private String user_type; // 用户类型
private String probation_end_date; // 试用期结束时间
private String option_user; // 最后操作人
private String data_provider; // 第三方数据提供商
private String extension_attribute1; // O365标签
private String working_hour; // 工作制
private String domain; // 账号所属域
private String ad_failed; // 创建ad失败原账号
private String have_employees; // 是否有下属员工
private String id; // id
private Date creation_time; // 创建时间
private Date update_time; // 修改时间
}
@@ -0,0 +1,33 @@
package com.jero.modules.system.entity;
import lombok.Data;
import java.util.Date;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 15:27 2022/3/1
*/
@Data
public class PPOrgPosEmployee {
private String worker_user_id; //域账号
private String biz_org_code; //组织编码
private String biz_org_path; //组织路径
private String biz_org_path_name; //组织路径名
private String biz_org_path_type; //组织路径类型
private String sub_biz_org_path; //子组织路径
private String sub_biz_org_path_name; //子组织路径名
private String sub_biz_org_path_type; //子组织路径类型
private String position_code; //岗位ID
private String position_name; //岗位名称
private String attribute_template; //岗位属性配置
private String position_custom_type; //岗位自定义类型
private String employee_id; //员工号
private String biz_org_x_position_id; //组织-岗位ID
private String attribute; //岗位属性
private String id;
private Date creation_time;
private Date update_time;
}
@@ -0,0 +1,29 @@
package com.jero.modules.system.entity;
import lombok.Data;
import java.util.List;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 16:05 2022/2/28
*/
@Data
public class PPOrganization {
private String id; //组织id
private String code; //组织编码
private String name; //组织名称
private String parent_code; //节点上级编码
private String parent_path; //节点所有上级编码,按/分割
private String full_path; //根节点到当前节点全路径
private String full_path_name; //根节点到当前节点名称全路径,按/分割
private String is_tree_leaf; //是否叶子节点
private String tree_level; //节点层级,根节点为0
private String type; //节点种类Enum, ("GEOGRAPHY", "BUSINESS")
private String full_path_type; //跟节点到节点路径上所有节点的类型,按/分割
private String app_id; //业务节点:业务系统的APP ID
private String api; //存储业务系统的API接口
private List<PPOrganization> children; //叶子节点
}
@@ -0,0 +1,25 @@
package com.jero.modules.system.entity;
import lombok.Data;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 14:13 2022/3/1
*/
@Data
public class PPOrganizationPosition {
private String id;
private String biz_org_code; //组织编码
private String biz_org_path; //组织全路径
private String biz_org_path_name; //组织全路径 - 名字
private String biz_org_path_type; //组织全路径 - 类型
private String sub_biz_org_path; //子组织全路径
private String sub_biz_org_path_name; //子组织全路径 - 名字
private String sub_biz_org_path_type; //子组织全路径 - 类型
private String biz_position_code; //岗位编码
private String biz_position_name; //岗位名字
private String attribute_template; //岗位属性配置
private String position_custom_type; //岗位自定义类型
}
@@ -0,0 +1,24 @@
package com.jero.modules.system.entity;
import lombok.Data;
import java.util.List;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 10:01 2022/3/1
*/
@Data
public class PPPosition {
private String id; //岗位编号
private String code; //岗位code
private String name; //岗位名称
private String parent_code; //父级岗位code
private String parent_name; //父级岗位名称
private String is_tree_leaf; //是否为叶子节点
private String attribute_template; //JSON字符串,属性配置
private String custom_type; //自定义类型
private List<PPPosition> children;
}
@@ -53,6 +53,8 @@ public class SysDepart implements Serializable {
/**机构编码*/ /**机构编码*/
@Excel(name="机构编码",width=15) @Excel(name="机构编码",width=15)
private String orgCode; private String orgCode;
/**父级机构编码*/
private String parentCode;
/**手机号*/ /**手机号*/
@Excel(name="手机号",width=15) @Excel(name="手机号",width=15)
private String mobile; private String mobile;
@@ -83,7 +85,6 @@ public class SysDepart implements Serializable {
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** /**
* 重写equals方法 * 重写equals方法
*/ */
@@ -109,10 +110,11 @@ public class SysDepart implements Serializable {
Objects.equals(orgCategory, depart.orgCategory) && Objects.equals(orgCategory, depart.orgCategory) &&
Objects.equals(orgType, depart.orgType) && Objects.equals(orgType, depart.orgType) &&
Objects.equals(orgCode, depart.orgCode) && Objects.equals(orgCode, depart.orgCode) &&
Objects.equals(mobile, depart.mobile) && Objects.equals(parentCode, depart.parentCode) &&
Objects.equals(fax, depart.fax) && Objects.equals(mobile, depart.mobile) &&
Objects.equals(address, depart.address) && Objects.equals(fax, depart.fax) &&
Objects.equals(memo, depart.memo) && Objects.equals(address, depart.address) &&
Objects.equals(memo, depart.memo) &&
Objects.equals(status, depart.status) && Objects.equals(status, depart.status) &&
Objects.equals(delFlag, depart.delFlag) && Objects.equals(delFlag, depart.delFlag) &&
Objects.equals(createBy, depart.createBy) && Objects.equals(createBy, depart.createBy) &&
@@ -129,7 +131,7 @@ public class SysDepart implements Serializable {
return Objects.hash(super.hashCode(), id, parentId, departName, return Objects.hash(super.hashCode(), id, parentId, departName,
departNameEn, departNameAbbr, departOrder, description,orgCategory, departNameEn, departNameAbbr, departOrder, description,orgCategory,
orgType, orgCode, mobile, fax, address, memo, status, orgType, orgCode, parentCode, mobile, fax, address, memo, status,
delFlag, createBy, createTime, updateBy, updateTime); delFlag, createBy, createTime, updateBy, updateTime);
} }
} }
@@ -71,5 +71,9 @@ public class SysDepartRole {
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private java.util.Date updateTime; private java.util.Date updateTime;
@ApiModelProperty(value = "角色id")
private java.lang.String roleId;
} }
@@ -41,6 +41,11 @@ public class SysDepartRoleUser {
@ApiModelProperty(value = "角色id") @ApiModelProperty(value = "角色id")
private java.lang.String droleId; private java.lang.String droleId;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
public SysDepartRoleUser() { public SysDepartRoleUser() {
} }
@@ -91,8 +91,9 @@ public class SysDict implements Serializable {
/** /**
* 是否为标签内容-数据字典(1是 0否) * 是否为标签内容-数据字典(1是 0否)
*/ */
@Excel(name = "是否为标签内容-数据字典(1是 0否)", width = 15, dictTable = "onl_cgform_field",dicText = "is_tag_dict", dicCode = "is_tag_dict") @Excel(name = "是否为标签内容-数据字典(1是 0否)", width = 15)/*, dicText = "is_tag_dict", dicCode = "is_tag_dict")
@Dict(dictTable = "onl_cgform_field", dicText = "is_tag_dict", dicCode = "is_tag_dict") @Dict(dictTable = "onl_cgform_field", dicText = "is_tag_dict", dicCode = "is_tag_dict")*/
@ApiModelProperty(value = "是否为标签内容-数据字典(1是 0否)")
private java.lang.Integer isTagDict; private java.lang.Integer isTagDict;
/** /**
@@ -3,6 +3,7 @@ package com.jero.modules.system.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -47,7 +48,7 @@ public class SysDictItem implements Serializable {
private String itemText; private String itemText;
/** /**
* 字典项值 * 字典项值-英文名
*/ */
@Excel(name = "字典项值", width = 30) @Excel(name = "字典项值", width = 30)
private String itemValue; private String itemValue;
@@ -82,7 +83,9 @@ public class SysDictItem implements Serializable {
private Date updateTime; private Date updateTime;
/**是否为标签内容-数据字典(1是 0否)*/ /**是否为标签内容-数据字典(1是 0否)*/
@Excel(name = "是否为标签内容", width = 15) @Excel(name = "是否为标签内容-数据字典(1是 0否)", width = 15)/*, dicText = "is_tag_dict", dicCode = "is_tag_dict")
@Dict(dictTable = "onl_cgform_field", dicText = "is_tag_dict", dicCode = "is_tag_dict")*/
@ApiModelProperty(value = "是否为标签内容-数据字典(1是 0否)")
private java.lang.Integer isTagDict; private java.lang.Integer isTagDict;
/**是否是只读(2字段固定,内部可配1固定字段 0非固定字段)*/ /**是否是只读(2字段固定,内部可配1固定字段 0非固定字段)*/
@@ -97,4 +100,15 @@ public class SysDictItem implements Serializable {
@Dict(dicCode = "attribute_type") @Dict(dicCode = "attribute_type")
private java.lang.String attributeType; private java.lang.String attributeType;
/**逻辑删除标识*/
@TableLogic
public Integer delFlag;
/**
* 字典英文名称
*/
@Excel(name = "字典英文名称", width = 15)
@ApiModelProperty(value = "字典英文名称")
private String enName;
} }
@@ -78,5 +78,15 @@ public class SysRole implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/**
* 父级岗位code
*/
private String parentCode;
/**
* 父级岗位code
*/
private Integer roleOrder;
} }
@@ -175,4 +175,6 @@ public class SysUser implements Serializable {
/**设备id uniapp推送用*/ /**设备id uniapp推送用*/
private String clientId; private String clientId;
private String thirdId;//用户域账号
} }
@@ -0,0 +1,27 @@
package com.jero.modules.system.service;
import com.jero.modules.system.entity.PPOrganization;
import java.io.IOException;
import java.net.MalformedURLException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 15:37 2022/2/28
*/
public interface ISyncDataService {
void syncDepartInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException;
int insertDepartFromTree(PPOrganization root, int i);
void syncRoleInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException;
void syncDepartRoleInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException;
void syncDepartRoleUserInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException;
String getResultDataOfGet(String uri, String queryString) throws IOException, NoSuchAlgorithmException, InvalidKeyException;
}
@@ -123,4 +123,11 @@ public interface ISysDepartService extends IService<SysDepart>{
* @param departId 部门id * @param departId 部门id
*/ */
List<SysDepartTreeModel> listSonDepartsByDepId(String departId); List<SysDepartTreeModel> listSonDepartsByDepId(String departId);
/**
* 根据编码查询
* @param departCode
* @return
*/
List<SysDepart> queryByDepartCode(String departCode);
} }
@@ -157,4 +157,7 @@ public interface ISysDictService extends IService<SysDict> {
* @return * @return
*/ */
Integer queryExitData(SysDict sysDict); Integer queryExitData(SysDict sysDict);
String getAllPinyin(String dictName);
} }
@@ -6,6 +6,8 @@ import com.jero.modules.system.entity.SysRole;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/** /**
* <p> * <p>
* 角色表 服务类 * 角色表 服务类
@@ -40,4 +42,11 @@ public interface ISysRoleService extends IService<SysRole> {
*/ */
public boolean deleteBatchRole(String[] roleids); public boolean deleteBatchRole(String[] roleids);
/**
* 根据编码查询
* @param roleCode
* @return
*/
List<SysRole> queryByRoleCode(String roleCode);
} }
@@ -233,4 +233,6 @@ public interface ISysUserService extends IService<SysUser> {
* @return * @return
*/ */
List<SysUser> queryByDepIds(List<String> departIds, String username); List<SysUser> queryByDepIds(List<String> departIds, String username);
List<SysUser> queryByWorkNo(String workNo);
} }
@@ -0,0 +1,301 @@
package com.jero.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.constant.CommonConstant;
import com.jero.common.system.util.JwtUtil;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.PasswordUtil;
import com.jero.common.util.oConvertUtils;
import com.jero.modules.system.entity.*;
import com.jero.modules.system.service.*;
import com.jero.modules.system.util.HmacSignUtil;
import com.jero.modules.system.util.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.PipedOutputStream;
import java.net.MalformedURLException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 15:39 2022/2/28
*/
@Slf4j
@Service
public class SyncDataServiceImpl implements ISyncDataService{
@Value("${people.appId}")
private String appId;
@Value("${people.host}")
private String host;
@Value("${people.secret}")
private String secret;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ISysDepartService sysDepartService;
@Autowired
private ISysRoleService sysRoleService;
@Autowired
private ISysDepartRoleService sysDepartRoleService;
@Autowired
private ISysDepartRoleUserService sysDepartRoleUserService;
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException {
}
/**
* 同步组织信息
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public void syncDepartInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
//查询所有组织列表,children为空
String path = "/people/v1/organization/list";
String queryStr = "app_id=100679&hash_type=sha256";
String resultData = getResultDataOfGet(path, queryStr);
//JSON转实体类
List<PPOrganization> organizationList = JSONArray.parseArray(resultData, PPOrganization.class);
log.info("需要同步的组织数据总数:" + organizationList.size());
for(PPOrganization ppo : organizationList){
//添加当前节点的组织数据
SysDepart sysDepart = new SysDepart();
sysDepart.setId(ppo.getId());
sysDepart.setDepartName(ppo.getName());
sysDepart.setOrgCategory(ppo.getType());
sysDepart.setOrgType(ppo.getTree_level());
sysDepart.setOrgCode(ppo.getCode());
if(StringUtils.isNotBlank(ppo.getParent_path())) {
String parentCode = ppo.getParent_path().substring(ppo.getParent_path().lastIndexOf("/")+1);
sysDepart.setParentCode(parentCode);
}else{
sysDepart.setParentCode(ppo.getParent_path());
}
sysDepart.setDepartOrder(Integer.valueOf(ppo.getId()));
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// sysDepart.setCreateBy(sysUser.getRealname());
sysDepart.setCreateBy("admin");
sysDepart.setCreateTime(new Date());
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
sysDepartService.save(sysDepart);
// int insertRowNum = insertDepartFromTree(ppo, 1);
// log.info(ppo.getName() + "添加成功条数:" + insertRowNum);
}
}
/**
* 先序遍历树,将数据插入数据库
* @param root
*/
public int insertDepartFromTree(PPOrganization root, int i) {
if(root == null)
return i;
//添加当前节点的组织数据
SysDepart sysDepart = new SysDepart();
sysDepart.setId(root.getId());
sysDepart.setDepartName(root.getName());
sysDepart.setOrgCategory(root.getType());
sysDepart.setOrgType(root.getTree_level());
sysDepart.setOrgCode(root.getCode());
String parentCode = root.getParent_path().substring(root.getParent_path().lastIndexOf("/"));
sysDepart.setParentCode(parentCode);
sysDepart.setDepartOrder(i);
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
sysDepart.setCreateBy(sysUser.getRealname());
sysDepart.setCreateTime(new Date());
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
sysDepartService.save(sysDepart);
for(PPOrganization child:root.getChildren())
{
insertDepartFromTree(child, ++i);
}
return i;
}
/**
* 同步岗位信息
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public void syncRoleInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
//同步所有角色
//查询所有角色列表,非树状,children为空
String path = "/people/v1/position/list";
String queryStr = "app_id=100679&hash_type=sha256";
String resultData = getResultDataOfGet(path, queryStr);
//JSON转实体类
List<PPPosition> positionList = JSONArray.parseArray(resultData, PPPosition.class);
List<String> positionCodeList = positionList.stream().map(PPPosition :: getCode).collect(Collectors.toList());
String positionDetailPath = "/people/v1/position/detail";
String positionDetailQueryStr = "app_id=100679&hash_type=sha256&code=";
log.info("需要同步的岗位数据总数:" + positionList.size());
for(String code : positionCodeList){
String queryStrDetail = positionDetailQueryStr + code;
String result = getResultDataOfGet(positionDetailPath, queryStrDetail);
PPPosition position = JSONObject.parseObject(result, PPPosition.class);
SysRole sysRole = new SysRole();
sysRole.setId(position.getId());
sysRole.setRoleName(position.getName());
sysRole.setRoleCode(position.getCode());
sysRole.setParentCode(position.getParent_code());
sysRole.setRoleOrder(Integer.valueOf(position.getId()));
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// sysRole.setCreateBy(sysUser.getRealname());
sysRole.setCreateBy("admin");
sysRole.setCreateTime(new Date());
sysRoleService.save(sysRole);
}
}
/**
* 同步组织岗位关系
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public void syncDepartRoleInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
String path = "/people/v1/organization-position/all";
String queryStr = "app_id=100679&hash_type=sha256";
String resultData = getResultDataOfGet(path, queryStr);
//JSON转实体类
List<PPOrganizationPosition> organizationPositionList = JSONArray.parseArray(resultData, PPOrganizationPosition.class);
log.info("需要同步的组织岗位关系数据总数:" + organizationPositionList.size());
for(PPOrganizationPosition op : organizationPositionList){
SysDepartRole sysDepartRole = new SysDepartRole();
List<SysDepart> sysDepartList = sysDepartService.queryByDepartCode(op.getBiz_org_code());
if(CollectionUtil.isNotEmpty(sysDepartList)){
sysDepartRole.setDepartId(sysDepartList.get(0).getId());
}
List<SysRole> sysRoleList = sysRoleService.queryByRoleCode(op.getBiz_position_code());
if(CollectionUtil.isNotEmpty(sysRoleList)){
sysDepartRole.setRoleId(sysRoleList.get(0).getId());
}
sysDepartRole.setId(op.getId());
sysDepartRoleService.save(sysDepartRole);
}
}
/**
* 同步人员信息及人员-组织岗位关系
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public void syncDepartRoleUserInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
//查询所有人员组织岗位
String path = "/people/v1/employee/organization-position/list";
String queryStr = "app_id=100679&hash_type=sha256";
String resultData = getResultDataOfGet(path, queryStr);
//JSON转实体类
List<PPOrgPosEmployee> orgPosEmployeeList = JSONArray.parseArray(resultData, PPOrgPosEmployee.class);
log.info("需要同步的组织岗位人员关系数据总数:" + orgPosEmployeeList.size());
String employeeDetailPath = "/people/v1/employee/detail";
String employeeDetailQueryStr = "app_id=100679&hash_type=sha256&employee_id=";
for(PPOrgPosEmployee ope : orgPosEmployeeList){
//查询人员详情
String queryStrDetail = employeeDetailQueryStr + ope.getEmployee_id();
String result = getResultDataOfGet(employeeDetailPath, queryStrDetail);
//JSON转实体类
PPEmployee employee = JSONObject.parseObject(result, PPEmployee.class);
//判断用户信息是否已添加,人员-组织岗位关系为多对多
List<SysUser> sysUserList = sysUserService.queryByWorkNo(ope.getEmployee_id());
if (CollectionUtil.isEmpty(sysUserList)) {
//添加用户信息
SysUser sysUser = new SysUser();
sysUser.setId(employee.getId());
sysUser.setUsername(employee.getUser_name());
sysUser.setRealname(employee.getName_in_local_script());
String username = employee.getUser_name();
String password = "nio.com123"; //设置默认密码
//用户默认密码处理
String salt = oConvertUtils.randomGen(8);
String passwordEncode = PasswordUtil.encrypt(username, password, salt);
sysUser.setPassword(passwordEncode);
sysUser.setSalt(salt);
sysUser.setOrgCode(ope.getBiz_org_code());
sysUser.setStatus("Active".equals(employee.getEmployee_status())? CommonConstant.USER_UNFREEZE : CommonConstant.USER_FREEZE);
sysUser.setDelFlag("1".equals(employee.getDelete_flag())? CommonConstant.DEL_FLAG_0 : CommonConstant.DEL_FLAG_1);
sysUser.setThirdId(employee.getWorker_user_id());
sysUser.setActivitiSync(CommonConstant.ACT_SYNC_1);
sysUser.setWorkNo(employee.getEmployee_id());
sysUser.setUpdateTime(employee.getUpdate_time());
sysUser.setCreateTime(new Date());
sysUser.setCreateBy("admin");
sysUser.setUpdateBy("admin");
sysUserService.save(sysUser);
}
//添加组织岗位-人员关系
SysDepartRoleUser sysDepartRoleUser = new SysDepartRoleUser();
sysDepartRoleUser.setId(ope.getId());
sysDepartRoleUser.setUserId(employee.getId());
sysDepartRoleUser.setDroleId(ope.getBiz_org_x_position_id());
sysDepartRoleUserService.save(sysDepartRoleUser);
}
}
/**
* 发送请求,获取同步数据
* @param uri
* @param queryString
* @return
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public String getResultDataOfGet(String uri, String queryString) throws IOException, NoSuchAlgorithmException, InvalidKeyException {
String appId = "100679";
// String appSecret = "CDf2D9404C6ac1B0f7c3e3845ae0282a";
String appSecret = "7C3F03170E3ea489df04Ce8DEC7Df4f7";
// 获取签名
String method ="GET";
String path = uri;
String queryStr = queryString;
Map<String, String> header = new HashMap<>();
String timestamp = HmacSignUtil.getSecondTimestamp(new Date());
queryStr += "&timestamp=" + timestamp;
String sign = HmacSignUtil.getSign(appSecret,method,path,queryStr,header);
// String url = "http://napoleon-fab-test.nioint.com";
String url = "http://napoleon.nioint.com";
url += path + "?";
url += queryStr;
url += "&sign=" + sign;
Map<String, String> headerMap = new HashMap<>();
String response = HttpRequestUtil.getResponseOfGET(url, headerMap);
JSONObject myJson = JSONObject.parseObject(response);
log.debug(myJson.toJSONString());
if(!myJson.get("result_code").toString().equals("success")) {
log.error("请求出现异常:" + myJson.get("result_code") + " " + myJson);
}
log.debug("打印输出本次同步信息返回结果:"+myJson.get("data").toString());
return myJson.get("data").toString();
}
}
@@ -527,4 +527,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
return realResult; return realResult;
} }
@Override
public List<SysDepart> queryByDepartCode(String departCode) {
LambdaQueryWrapper<SysDepart> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysDepart::getOrgCode, departCode);
return this.list(queryWrapper);
}
} }
@@ -1,9 +1,9 @@
package com.jero.modules.system.service.impl; package com.jero.modules.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.mapper.SysDictItemMapper; import com.jero.modules.system.mapper.SysDictItemMapper;
import com.jero.modules.system.service.ISysDictItemService; import com.jero.modules.system.service.ISysDictItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.constant.CacheConstant; import com.jero.common.constant.CacheConstant;
import com.jero.common.constant.CommonConstant; import com.jero.common.constant.CommonConstant;
import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.DictModel;
@@ -17,6 +16,13 @@ import com.jero.modules.system.mapper.SysDictItemMapper;
import com.jero.modules.system.mapper.SysDictMapper; import com.jero.modules.system.mapper.SysDictMapper;
import com.jero.modules.system.model.TreeSelectModel; import com.jero.modules.system.model.TreeSelectModel;
import com.jero.modules.system.service.ISysDictService; import com.jero.modules.system.service.ISysDictService;
import lombok.extern.slf4j.Slf4j;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
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.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
@@ -72,6 +78,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
List<DictModel> dictModelList = sysDictItemList.stream().filter(s -> d.getId().equals(s.getDictId())).map(item -> { List<DictModel> dictModelList = sysDictItemList.stream().filter(s -> d.getId().equals(s.getDictId())).map(item -> {
DictModel dictModel = new DictModel(); DictModel dictModel = new DictModel();
dictModel.setText(item.getItemText()); dictModel.setText(item.getItemText());
dictModel.setTextEn(item.getEnName());
dictModel.setValue(item.getItemValue()); dictModel.setValue(item.getItemValue());
return dictModel; return dictModel;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@@ -341,10 +348,66 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
@Override @Override
public Integer queryExitData(SysDict sysDict) { public Integer queryExitData(SysDict sysDict) {
LambdaQueryWrapper<SysDict> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDict> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(sysDict.getDictName())) {// && StringUtils.isNotBlank(onlCgformTag.getDbFieldName())) { if (StringUtils.isNotBlank(sysDict.getDictName())) {
queryWrapper.eq(SysDict::getDictName, sysDict.getDictName()).and(wq -> wq.eq(SysDict::getAttributeType, sysDict.getAttributeType())); queryWrapper.eq(SysDict::getDictName, sysDict.getDictName()).and(wq -> wq.eq(SysDict::getAttributeType, sysDict.getAttributeType()));
} }
Integer count = sysDictMapper.selectCount(queryWrapper); Integer count = sysDictMapper.selectCount(queryWrapper);
return count; return count;
} }
/**
* 将Code值设为字典名称的中文拼音
*/
public String getAllPinyin(String hanzi) {
//输出格式设置
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
/**
* 输出大小写设置
*
* LOWERCASE:输出小写
* UPPERCASE:输出大写
*/
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
/**
* 输出音标设置
*
* WITH_TONE_MARK:直接用音标符(必须设置WITH_U_UNICODE,否则会抛出异常)
* WITH_TONE_NUMBER1-4数字表示音标
* WITHOUT_TONE:没有音标
*/
format.setToneType(HanyuPinyinToneType.WITH_TONE_MARK);
/**
* 特殊音标ü设置
*
* WITH_V:用v表示ü
* WITH_U_AND_COLON:用"u:"表示ü
* WITH_U_UNICODE:直接用ü
*/
format.setVCharType(HanyuPinyinVCharType.WITH_U_UNICODE);
char[] hanYuArr = hanzi.trim().toCharArray();
StringBuilder pinYin = new StringBuilder();
try {
for (int i = 0, len = hanYuArr.length; i < len; i++) {
//匹配是否是汉字
if (Character.toString(hanYuArr[i]).matches("[\\u4E00-\\u9FA5]+")) {
//如果是多音字,返回多个拼音,这里只取第一个
String[] pys = PinyinHelper.toHanyuPinyinStringArray(hanYuArr[i], format);
pinYin.append(pys[0]).append(" ");
} else {
pinYin.append(hanYuArr[i]).append(" ");
}
}
} catch (BadHanyuPinyinOutputFormatCombination badHanyuPinyinOutputFormatCombination) {
badHanyuPinyinOutputFormatCombination.printStackTrace();
}
return pinYin.toString();
}
} }
@@ -1,7 +1,9 @@
package com.jero.modules.system.service.impl; package com.jero.modules.system.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.constant.CommonConstant; import com.jero.common.constant.CommonConstant;
@@ -90,4 +92,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
this.removeByIds(Arrays.asList(roleIds)); this.removeByIds(Arrays.asList(roleIds));
return true; return true;
} }
@Override
public List<SysRole> queryByRoleCode(String roleCode) {
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysRole::getRoleCode, roleCode);
return this.list(queryWrapper);
}
} }
@@ -439,4 +439,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return userMapper.queryByDepIds(departIds,username); return userMapper.queryByDepIds(departIds,username);
} }
@Override
public List<SysUser> queryByWorkNo(String workNo) {
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysUser::getWorkNo, workNo);
return this.list(queryWrapper);
}
} }
@@ -158,6 +158,7 @@ public class FindsDepartsChildrenUtil {
sysDepartTreeModel.setOrgCategory(sysDepart.getOrgCategory()); sysDepartTreeModel.setOrgCategory(sysDepart.getOrgCategory());
sysDepartTreeModel.setOrgType(sysDepart.getOrgType()); sysDepartTreeModel.setOrgType(sysDepart.getOrgType());
sysDepartTreeModel.setOrgCode(sysDepart.getOrgCode()); sysDepartTreeModel.setOrgCode(sysDepart.getOrgCode());
sysDepartTreeModel.setOrgCode(sysDepart.getParentCode());
sysDepartTreeModel.setMobile(sysDepart.getMobile()); sysDepartTreeModel.setMobile(sysDepart.getMobile());
sysDepartTreeModel.setFax(sysDepart.getFax()); sysDepartTreeModel.setFax(sysDepart.getFax());
sysDepartTreeModel.setAddress(sysDepart.getAddress()); sysDepartTreeModel.setAddress(sysDepart.getAddress());
+5
View File
@@ -107,6 +107,11 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
@@ -341,23 +341,68 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
*/ */
@Override @Override
public List<Map<String, Object>> getInfoById(String id, String cut) { public List<Map<String, Object>> getInfoById(String id, String cut) {
//处理被代替标准
//根据代替标准查询被代替标准集合
List<Map<String, Object>> replaceStandardList = bussDocumentLibraryEOMapper.getInfoListByReplaceStandard(id);
List<String> replaceStandardNameList = new ArrayList<>();
for (Map<String, Object> map : replaceStandardList) {
String serialNumber = (String) map.get("serial_number");
replaceStandardNameList.add(serialNumber);
}
//区域管理
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(new OnlCgformArea());
//字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1");
//通过id查询数据 //通过id查询数据
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BussDocumentLibraryEO::getId, id); queryWrapper.eq(BussDocumentLibraryEO::getId, id);
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper); List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
//查询所有
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMaps(null);
//原始对应标准,代替标准,被代替标准(原始数据存的是iD)
String correspondingStandardId = (String) dataList.get(0).get("corresponding_standard");//对应标准
String replaceStandardId = (String) dataList.get(0).get("replace_standard");//代替标准
//被代替标准
List<String> replacedStandardIdList = new ArrayList<>();//代替标准
//对应标准,代替标准,被代替标准对应的编码
List<String> correspondingStandardNameList = new ArrayList<>();//对应标准编码
List<String> replaceStandardNameList = new ArrayList<>();//代替标准编码
List<String> replacedStandardNameList = new ArrayList<>();//被代替标准编码
List<Map<String,Object>> listCorrespondingStandard = new ArrayList<>();
List<Map<String,Object>> listReplaceStandard = new ArrayList<>();
List<Map<String,Object>> listReplacedStandard = new ArrayList<>();
//处理被代替标准和对应标准
for (Map<String, Object> map : mapList) {
Map<String,Object> mapTemp = new HashMap<>();
//对应标准处理
if (StringUtils.isNotBlank(correspondingStandardId) && correspondingStandardId.contains((String) map.get("id"))) {
correspondingStandardNameList.add((String) map.get("serial_number"));
mapTemp.put("title",(String) map.get("serial_number"));
mapTemp.put("id",(String) map.get("id"));
if(ObjectUtils.isNotEmpty(mapTemp)){
listCorrespondingStandard.add(mapTemp);
}
}
//代替标准
if(StringUtils.isNotBlank(replaceStandardId) && replaceStandardId.contains((String) map.get("id"))){
replaceStandardNameList.add((String) map.get("serial_number"));
mapTemp.put("title",(String) map.get("serial_number"));
mapTemp.put("id",(String) map.get("id"));
if(ObjectUtils.isNotEmpty(mapTemp)){
listReplaceStandard.add(mapTemp);
}
}
//被代替标准
String replaceStandard = (String) map.get("replace_standard");
if (StringUtils.isNotBlank(replaceStandard) && replaceStandard.contains(id)) {
replacedStandardIdList.add((String) map.get("id"));
String serialNumber = (String) map.get("serial_number");
replacedStandardNameList.add(serialNumber);
mapTemp.put("title",(String) map.get("serial_number"));
mapTemp.put("id",(String) map.get("id"));
if(ObjectUtils.isNotEmpty(mapTemp)){
listReplacedStandard.add(mapTemp);
}
}
}
//区域管理
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(new OnlCgformArea());
//字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1");
//过滤出下拉选 //过滤出下拉选
List<OnlCgformField> onlCgformFieldList = fieldList.stream() List<OnlCgformField> onlCgformFieldList = fieldList.stream()
@@ -384,6 +429,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} }
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
for (OnlCgformArea onlCgformAreaTemp : areaList) { for (OnlCgformArea onlCgformAreaTemp : areaList) {
String areaName = "";
if (CutEnum.CN.getValue().equals(cut)) {
areaName = onlCgformAreaTemp.getShowArea();
} else {
areaName = onlCgformAreaTemp.getEnName();
}
Map<String, Object> mapTemp = new HashMap<>(); Map<String, Object> mapTemp = new HashMap<>();
List<Map<String, Object>> resultTemp = new ArrayList<>(); List<Map<String, Object>> resultTemp = new ArrayList<>();
List<OnlCgformField> fieldListTemp = fieldList.stream().filter(e -> onlCgformAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList()); List<OnlCgformField> fieldListTemp = fieldList.stream().filter(e -> onlCgformAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList());
@@ -412,14 +463,14 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
for (OSSFile fileInfo : fileInfos) { for (OSSFile fileInfo : fileInfos) {
Map<String, Object> mapNew = new HashMap<>(); Map<String, Object> mapNew = new HashMap<>();
mapNew.put("value", fileInfo); mapNew.put("value", fileInfo);
mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", onlCgformAreaTemp.getShowArea()); mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName);
resultTemp.add(mapNew); resultTemp.add(mapNew);
} }
} }
} else if (fileInfos.size() == 1) { } else if (fileInfos.size() == 1) {
//单个文件处理 //单个文件处理
map.put("value", fileInfos.get(0)); map.put("value", fileInfos.get(0));
mapPut(cut, map, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", onlCgformAreaTemp.getShowArea()); mapPut(cut, map, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName);
resultTemp.add(map); resultTemp.add(map);
} }
} }
@@ -428,21 +479,37 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (dataList.size() != 0) { if (dataList.size() != 0) {
dataList.get(0).entrySet().forEach(entry -> { dataList.get(0).entrySet().forEach(entry -> {
if (onlCgformField.getDbFieldName().equals(entry.getKey())) { if (onlCgformField.getDbFieldName().equals(entry.getKey())) {
if (onlCgformField.getDbFieldName().equals("replaced_standard")) { if (onlCgformField.getDbFieldName().equals("replace_standard")) {
//代替标准
map.put("value", StringUtils.join(replaceStandardNameList, ",")); map.put("value", StringUtils.join(replaceStandardNameList, ","));
} else { map.put("list",listReplaceStandard);
} else if(onlCgformField.getDbFieldName().equals("replaced_standard")){
//被代替标准
map.put("value", StringUtils.join(replacedStandardNameList, ","));
map.put("list",listReplacedStandard);
}else if(onlCgformField.getDbFieldName().equals("corresponding_standard")){
//对应标准
map.put("value", StringUtils.join(correspondingStandardNameList, ","));
map.put("list",listCorrespondingStandard);
}else {
map.put("value", entry.getValue()); map.put("value", entry.getValue());
} }
} }
}); });
} }
mapPut(cut, map, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", onlCgformAreaTemp.getShowArea()); mapPut(cut, map, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName);
} }
if (map.size() != 0) { if (map.size() != 0) {
resultTemp.add(map); resultTemp.add(map);
} }
} }
mapTemp.put(onlCgformAreaTemp.getShowArea(), resultTemp); if (CutEnum.CN.getValue().equals(cut)) {
areaName = onlCgformAreaTemp.getShowArea();
mapTemp.put(areaName, resultTemp);
} else {
areaName = onlCgformAreaTemp.getEnName();
mapTemp.put(areaName, resultTemp);
}
result.add(mapTemp); result.add(mapTemp);
} }
return result; return result;