Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/dxf
This commit is contained in:
commit
4a0ddd8adc
|
|
@ -586,6 +586,8 @@ create table JCL_ORG_CARDBUTTON (
|
|||
url varchar(255) null,
|
||||
roles varchar(2000) null,
|
||||
sys_default int not null,
|
||||
show_order int null,
|
||||
open int null,
|
||||
creator int null,
|
||||
delete_type int null,
|
||||
create_time date null,
|
||||
|
|
|
|||
|
|
@ -504,4 +504,38 @@ create table JCL_ORG_DETACH (
|
|||
);
|
||||
|
||||
|
||||
CREATE TABLE JCL_ORG_CARDACCESS (
|
||||
ID NUMBER NOT NULL,
|
||||
TYPE_ID NUMBER NOT NULL,
|
||||
TYPE_NAME NVARCHAR2(50) NOT NULL,
|
||||
STATUS NUMBER NULL,
|
||||
ALL_PEOPLE NUMBER NULL,
|
||||
SUPERIOR NUMBER NULL,
|
||||
ALL_SUPERIOR NUMBER NULL,
|
||||
CUSTOM NVARCHAR2(2000) NULL ,
|
||||
DELETE_TYPE NUMBER NULL,
|
||||
CREATOR NUMBER NULL,
|
||||
CREATE_TIME DATE NULL,
|
||||
UPDATE_TIME DATE NULL,
|
||||
CONSTRAINT JCL_ORG_CARDACCESS_PK PRIMARY KEY (ID)
|
||||
)
|
||||
|
||||
CREATE TABLE JCL_ORG_CARDBUTTON (
|
||||
ID NUMBER NOT NULL,
|
||||
NAME NVARCHAR2(255) NOT NULL,
|
||||
STATUS NUMBER NULL,
|
||||
URL NVARCHAR2(255) NULL,
|
||||
ROLES NVARCHAR2(2000) NULL,
|
||||
SYS_DEFAULT NUMBER NOT NULL,
|
||||
SHOW_ORDER NUMBER NULL,
|
||||
OPEN NUMBER NULL,
|
||||
CREATOR NUMBER NULL,
|
||||
DELETE_TYPE NUMBER NULL,
|
||||
CREATE_TIME DATE NULL,
|
||||
UPDATE_TIME DATE NULL,
|
||||
CONSTRAINT JCL_ORG_CARDBUTTON_PK PRIMARY KEY (ID)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -564,6 +564,8 @@ CREATE TABLE JCL_ORG_CARDBUTTON (
|
|||
url varchar(255) NULL,
|
||||
roles varchar(2000) NULL,
|
||||
sys_default int NOT NULL,
|
||||
show_order int null,
|
||||
open int null,
|
||||
creator int NULL,
|
||||
delete_type int NULL,
|
||||
create_time date NULL,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.enums;
|
||||
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.util.saveimport.PostInfoImportUtil;
|
||||
import com.engine.organization.util.saveimport.StaffInfoImportUtil;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -27,6 +28,20 @@ public enum OrgImportEnum implements OrgImportAdapter {
|
|||
public List<Map<String, Object>> orgForm(User user) {
|
||||
return StaffInfoImportUtil.importForm(user);
|
||||
}
|
||||
},
|
||||
POSTINFO("postInfo"){
|
||||
@Override
|
||||
public Map<String, Object> orgImport(Map<String, Object> params, User user) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
String excelFile = (String) params.get("excelfile");
|
||||
resultMap.put("pId", PostInfoImportUtil.saveImport("add", excelFile, user));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> orgForm(User user) {
|
||||
return PostInfoImportUtil.importForm(user);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ public interface PostMapper {
|
|||
*/
|
||||
PostPO getPostByID(@Param("id") long id);
|
||||
|
||||
PostPO getPostByName(@Param("postName") String postName);
|
||||
|
||||
List<PostPO> listByName(@Param("postName") String postName);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -53,6 +53,13 @@
|
|||
from jcl_org_post
|
||||
where delete_type = '0'
|
||||
</select>
|
||||
|
||||
<select id="getPostByName" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_post t where post_name = #{postName} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listByName" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
|
|||
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
|
||||
anchorList.add(Anchor.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).build());
|
||||
}
|
||||
resultMap.put("button", getButtonList(ecResourceId));
|
||||
resultMap.put("buttons", getButtonList(ecResourceId));
|
||||
resultMap.put("user", userInfo);
|
||||
resultMap.put("statistical", statistical);
|
||||
resultMap.put("formItems", formItemList);
|
||||
|
|
@ -289,7 +289,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
|
|||
|
||||
|
||||
for (CardButtonPO cardButton : cardButtonPOS) {
|
||||
List<String> accessRoleIds = new ArrayList<>(Arrays.asList(cardButton.getRoles().split(",")));
|
||||
List<String> accessRoleIds = new ArrayList<>(Arrays.asList(Util.null2String(cardButton.getRoles()).split(",")));
|
||||
roleIds.retainAll(accessRoleIds);
|
||||
if (isAdmin || (isMySelf && "0".equals(cardButton.getSysDefault())) || CollectionUtils.isNotEmpty(roleIds)) {
|
||||
buttonList.add(CardButtonPO.builder().name(cardButton.getName()).url(cardButton.getUrl()).sysDefault(cardButton.getSysDefault()).build());
|
||||
|
|
|
|||
|
|
@ -1,9 +1,26 @@
|
|||
package com.engine.organization.util.saveimport;
|
||||
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.entity.postion.po.PostInfoPO;
|
||||
import com.engine.organization.entity.postion.po.PostPO;
|
||||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.mapper.post.PostInfoMapper;
|
||||
import com.engine.organization.mapper.post.PostMapper;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:ml
|
||||
|
|
@ -15,14 +32,155 @@ public class PostInfoImportUtil {
|
|||
|
||||
static {
|
||||
importFieldsMap = new HashMap<>();
|
||||
importFieldsMap.put("编号", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_no").fieldNameDesc("编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("名称", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_name").fieldNameDesc("名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("编号", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_no").fieldNameDesc("编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("名称", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_name").fieldNameDesc("名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("权限", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_authority").fieldNameDesc("权限").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("责任", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_duty").fieldNameDesc("责任").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("资格", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_qualification").fieldNameDesc("资格").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("职务分类", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_id").fieldNameDesc("职务分类").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("职务分类", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_name").fieldNameDesc("职务分类").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
importFieldsMap.put("描述说明", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("description").fieldNameDesc("说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||
|
||||
}
|
||||
public static Long saveImport(String operateType, String excelFile, User user) {
|
||||
Long importHistoryId = OrgImportUtil.saveImportLog("staff_info", operateType, user);
|
||||
JclImportHistoryDetailPO historyDetailPO;
|
||||
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(Util.getIntValue(excelFile));
|
||||
XSSFWorkbook workbook;
|
||||
try {
|
||||
workbook = new XSSFWorkbook(manager.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 当前sheet
|
||||
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
|
||||
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
|
||||
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||
Date currDate = new Date();
|
||||
// 遍历每一行数据
|
||||
nextRow:
|
||||
for (int i = 0; i <= lastRow; i++) {
|
||||
historyDetailPO = new JclImportHistoryDetailPO();
|
||||
historyDetailPO.setPid(importHistoryId);
|
||||
XSSFRow row = sheetAt.getRow(i);
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
PostInfoPO postInfoPO = null;
|
||||
PostInfoPO postInfoPoNew = new PostInfoPO();
|
||||
PostPO postPO = null;
|
||||
PostPO postPoNew = new PostPO();
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
||||
XSSFCell cell = row.getCell((short) cellIndex);
|
||||
String cellValue = OrgImportUtil.getCellValue(cell).trim();
|
||||
if (i == 0) {
|
||||
// 首行 初始化字段信息
|
||||
ExtendInfoPO extendInfoPO = importFieldsMap.get(cellValue);
|
||||
extendInfoPOS.add(extendInfoPO);
|
||||
} else {
|
||||
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
||||
// 数据校验
|
||||
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
|
||||
Object reallyValue;
|
||||
try {
|
||||
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "转换失败");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue))) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
map.put(infoPO.getFieldName(), reallyValue);
|
||||
// 职务信息编号是否重复
|
||||
if ("post_info_no".equals(infoPO.getFieldName())){
|
||||
List<PostInfoPO> postInfoPOS = MapperProxyFactory.getProxy(PostInfoMapper.class).listByNo(Util.null2String(reallyValue));
|
||||
if(postInfoPOS.size()>0){
|
||||
historyDetailPO.setRelatedName("");
|
||||
historyDetailPO.setOperateDetail("编号:" + reallyValue + ",编号不允许重复");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 校验、数据交互
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
//处理职务分类:判断是否存在,不存在则新增
|
||||
String postName = (String)map.get("post_name");
|
||||
postPO = MapperProxyFactory.getProxy(PostMapper.class).getPostByName(postName);
|
||||
if(postPO==null){
|
||||
postPoNew.setPostName(postName);
|
||||
postPoNew.setCreator((long) user.getUID());
|
||||
postPoNew.setDeleteType(0);
|
||||
postPoNew.setCreateTime(currDate);
|
||||
postPoNew.setUpdateTime(currDate);
|
||||
MapperProxyFactory.getProxy(PostMapper.class).insertIgnoreNull(postPoNew);
|
||||
}
|
||||
postPO = MapperProxyFactory.getProxy(PostMapper.class).getPostByName(postName);
|
||||
postInfoPoNew.setPostInfoNo((String)map.get("post_info_no"));
|
||||
postInfoPoNew.setPostInfoName((String) map.get("post_info_name"));
|
||||
postInfoPoNew.setPostId(postPO.getId());
|
||||
postInfoPoNew.setDescription((String)map.get("description"));
|
||||
postInfoPoNew.setPostInfoAuthority((String)map.get("post_info_authority"));
|
||||
postInfoPoNew.setPostInfoDuty((String)map.get("post_info_duty"));
|
||||
postInfoPoNew.setPostInfoQualification((String) map.get("post_info_qualification"));
|
||||
postInfoPoNew.setForbiddenTag(0);
|
||||
postInfoPoNew.setCreator((long) user.getUID());
|
||||
postInfoPoNew.setCreateTime(currDate);
|
||||
postInfoPoNew.setUpdateTime(currDate);
|
||||
MapperProxyFactory.getProxy(PostInfoMapper.class).insertIgnoreNull(postInfoPoNew);
|
||||
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> importForm(User user) {
|
||||
// 返回导入数据
|
||||
List<Map<String, Object>> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(34275);
|
||||
lsPromptLabel.add(125452);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", "/hrm/import/template/postinfo.xls");
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
return lsGroup;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue