Commit be74b706 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hp-smart into dev-ly

 Conflicts:
	src/main/webapp/HP/SC/HPSC001.jsp
	src/main/webapp/HP/SC/HPSC011.jsp
parents 62e91eca d746a1da
...@@ -15,6 +15,12 @@ package com.baosight.hpjx.common; ...@@ -15,6 +15,12 @@ package com.baosight.hpjx.common;
*/ */
public enum DdynamicEnum { public enum DdynamicEnum {
//------------------------------------配置管理----------------------------------- //------------------------------------配置管理-----------------------------------
/**
* 模块:企业管理
* 用途:企业下拉框
*/
COMPANY_BLOCK_ID("company_block_id", "companyCode", "companyName", "HPPZ009.query"),
/** /**
* 模块:供应商档案 * 模块:供应商档案
* 用途:供应商档案下拉框 * 用途:供应商档案下拉框
......
package com.baosight.hpjx.core.constant; package com.baosight.hpjx.core.constant;
import com.baosight.hpjx.util.StringUtils;
/** /**
* @author:songx * @author:songx
* @date:2024/3/1,17:36 * @date:2024/3/1,17:36
...@@ -9,6 +7,18 @@ import com.baosight.hpjx.util.StringUtils; ...@@ -9,6 +7,18 @@ import com.baosight.hpjx.util.StringUtils;
public class CodesetConstant { public class CodesetConstant {
/** /**
* 动态表
*
* @author:songx
* @date:2024/3/1,17:36
*/
public static class HgPz {
// 动态表
public static final String DYNAMIC_TABLE = "app.pz.dynamicTable";
}
/**
* 组织机构 * 组织机构
* *
* @author:songx * @author:songx
......
...@@ -98,6 +98,8 @@ public class CommonConstant { ...@@ -98,6 +98,8 @@ public class CommonConstant {
public static final String ADMIN = "ADMIN"; public static final String ADMIN = "ADMIN";
public static final String ENAME = "ename"; public static final String ENAME = "ename";
// 动态列
public static final String DYNAMIC_COLUMN = "dynamicColumn";
} }
/** /**
......
...@@ -44,19 +44,29 @@ public class DaoUtils { ...@@ -44,19 +44,29 @@ public class DaoUtils {
* @param obj * @param obj
*/ */
public static void insert(String sql, Object obj) throws PlatException { public static void insert(String sql, Object obj) throws PlatException {
insert(sql, obj, true);
}
/**
* insert method.
*
* @param sql
* @param obj
*/
public static void insert(String sql, Object obj, boolean setAuth) throws PlatException {
if (obj instanceof DaoEPBase) { if (obj instanceof DaoEPBase) {
setCreator((DaoEPBase) obj); setCreator((DaoEPBase) obj, setAuth);
} else if (obj instanceof Map) { } else if (obj instanceof Map) {
setCreator((Map) obj); setCreator((Map) obj, setAuth);
} else if (obj instanceof List) { } else if (obj instanceof List) {
for (Object o : ((List) obj)) { for (Object o : ((List) obj)) {
insert(sql, o); insert(sql, o, setAuth);
} }
return; return;
} }
DaoBase.getInstance().insert(sql, obj); DaoBase.getInstance().insert(sql, obj);
} }
/** /**
* insertBatch method. * insertBatch method.
* *
...@@ -64,6 +74,17 @@ public class DaoUtils { ...@@ -64,6 +74,17 @@ public class DaoUtils {
* @param rows * @param rows
*/ */
public static void batchInsert(String sql, List rows) { public static void batchInsert(String sql, List rows) {
batchInsert(sql, rows, true);
}
/**
* insertBatch method.
*
* @param sql
* @param rows
* @param setAuth 设置权限
*/
public static void batchInsert(String sql, List rows, boolean setAuth) {
// 创建人部门 // 创建人部门
String depCode = ""; String depCode = "";
if (!"admin".equals(UserSessionUtils.getLoginName())) { if (!"admin".equals(UserSessionUtils.getLoginName())) {
...@@ -79,11 +100,11 @@ public class DaoUtils { ...@@ -79,11 +100,11 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人部门编码失败", e); log.warn("写入创建人部门编码失败", e);
} }
setCreator(daoEPBase); setCreator(daoEPBase, setAuth);
} else if (row instanceof Map) { } else if (row instanceof Map) {
Map map = (Map) row; Map map = (Map) row;
map.put("depCode", depCode); map.put("depCode", depCode);
setCreator(map); setCreator(map, setAuth);
} }
} }
Map paramMap = new HashMap(); Map paramMap = new HashMap();
...@@ -110,8 +131,9 @@ public class DaoUtils { ...@@ -110,8 +131,9 @@ public class DaoUtils {
* 创建人工号 创建人姓名 创建人岗号 创建时刻 * 创建人工号 创建人姓名 创建人岗号 创建时刻
* *
* @param bean * @param bean
* @param setAuth 设置权限
*/ */
private static void setCreator(DaoEPBase bean) { private static void setCreator(DaoEPBase bean, boolean setAuth) {
// 创建人ID // 创建人ID
String userId; String userId;
try { try {
...@@ -139,26 +161,6 @@ public class DaoUtils { ...@@ -139,26 +161,6 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
String depCode = "";
if (!"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
try {
BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
// 创建时刻 // 创建时刻
try { try {
String dateTime = DateUtils.shortDateTime(); String dateTime = DateUtils.shortDateTime();
...@@ -167,14 +169,37 @@ public class DaoUtils { ...@@ -167,14 +169,37 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.error("写入创建时刻失败:{}", e.getMessage(), e); log.error("写入创建时刻失败:{}", e.getMessage(), e);
} }
if (setAuth) {
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
String depCode = "";
if (!"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
try {
BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
}
} }
/** /**
* 创建人工号 创建人姓名 创建时刻. * 创建人工号 创建人姓名 创建时刻.
* *
* @param map * @param map
* @param setAuth 设置权限
*/ */
public static void setCreator(Map map) { public static void setCreator(Map map, boolean setAuth) {
// 创建人工号 // 创建人工号
String userId = MapUtils.getString(map, "createdBy"); String userId = MapUtils.getString(map, "createdBy");
try { try {
...@@ -198,26 +223,6 @@ public class DaoUtils { ...@@ -198,26 +223,6 @@ public class DaoUtils {
} }
map.put("createdName", userName); map.put("createdName", userName);
map.put("updatedName", userName); map.put("updatedName", userName);
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
map.put("companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
String depCode = "";
if (!"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
try {
map.put("depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建时刻 // 创建时刻
try { try {
String dateTime = DateUtils.shortDateTime(); String dateTime = DateUtils.shortDateTime();
...@@ -226,6 +231,28 @@ public class DaoUtils { ...@@ -226,6 +231,28 @@ public class DaoUtils {
} catch (PlatException e) { } catch (PlatException e) {
log.warn("写入创建时刻失败", e); log.warn("写入创建时刻失败", e);
} }
if(setAuth) {
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
map.put("companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
String depCode = "";
if (!"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
try {
map.put("depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
}
} }
/** /**
......
package com.baosight.hpjx.core.enums; package com.baosight.hpjx.core.enums;
import com.baosight.hpjx.hp.pz.domain.HPPZ031;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC006; import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC102; import com.baosight.hpjx.hp.sc.domain.HPSC102;
...@@ -13,7 +14,8 @@ public enum DocRouteEnum { ...@@ -13,7 +14,8 @@ public enum DocRouteEnum {
HPSC002("route_001", "", 1, "HPSC002", "importData", HPSC002.class), HPSC002("route_001", "", 1, "HPSC002", "importData", HPSC002.class),
HPSC006("route_002", "", 1, "HPSC006", "importData", HPSC006.class), HPSC006("route_002", "", 1, "HPSC006", "importData", HPSC006.class),
HPSC102("route_003", "",1,"HPSC102", "importData", HPSC102.class) HPSC102("route_003", "",1,"HPSC102", "importData", HPSC102.class),
HPPZ031("HPPZ031", "/file/template/hppz031.xls", 1, "HPPZ031", "importData", HPPZ031.class),
; ;
/** /**
......
...@@ -164,6 +164,20 @@ public class HPConstant { ...@@ -164,6 +164,20 @@ public class HPConstant {
} }
/** /**
* 启用状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class EnablingStatus {
// 停用
public static final Integer TY = 0;
// 启用
public static final Integer QY = 1;
}
/**
* 处理状态 * 处理状态
* *
* @author:songx * @author:songx
......
package com.baosight.hpjx.hp.pz.constant;
/**
* @author:songx
* @date:2024/9/3,14:43
*/
public class HpPzSqlConst {
/**
*
* @author songx
* @date 2024/11/6,14:21
*/
public class HpPz030 {
// 模块名称
public static final String MODULE = "HPPZ030.";
// 修改排产系数
public static final String UPDATE_SORT = MODULE + "updateSort";
// 删除字段
public static final String DELETE_BY_FIELD = MODULE + "deleteByField";
}
/**
*
* @author songx
* @date 2024/11/6,14:21
*/
public class HpPz031 {
// 模块名称
public static final String MODULE = "HPPZ031.";
// 修改排产系数
public static final String UPDATE_SORT = MODULE + "updateSort";
}
}
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.Map;
/**
* Project: <br>
* Title:HGPZ020A.java <br>
* Description: <br>
*
* @author songx
* @date 2024-11-06 17:33:06
*/
public class HPPZ030A extends HPPZ030 {
private static final long serialVersionUID = 1L;
public static final String FIELD_VIEW_SQL = "viewSql"; /* 视图SQL */
public static final String FIELD_ALIAS_NAME = "aliasName"; /* 别名 */
public static final String COL_VIEW_SQL = "VIEW_SQL"; /* 视图SQL */
public static final String COL_ALIAS_NAME = "ALIAS_NAME"; /* 别名 */
public static final String QUERY = "HPPZ030A.query";
public static final String COUNT = "HPPZ030A.count";
public String viewSql = " "; /* 视图SQL */
public String aliasName = " "; /* 别名 */
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_VIEW_SQL);
eiColumn.setDescName("视图SQL");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ALIAS_NAME);
eiColumn.setDescName("别名");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPPZ030A() {
super.initMetaData();
initMetaData();
}
/**
* get the viewSql - 视图SQL.
* @return the viewSql
*/
public String getViewSql() {
return this.viewSql;
}
/**
* set the viewSql - 视图SQL.
*
* @param viewSql - 视图SQL
*/
public void setViewSql(String viewSql) {
this.viewSql = viewSql;
}
/**
* get the aliasName - 别名.
* @return the aliasName
*/
public String getAliasName() {
return this.aliasName;
}
/**
* set the aliasName - 别名.
*
* @param aliasName - 别名
*/
public void setAliasName(String aliasName) {
this.aliasName = aliasName;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setViewSql(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_VIEW_SQL)), viewSql));
setAliasName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ALIAS_NAME)), aliasName));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_VIEW_SQL, StringUtils.toString(viewSql, eiMetadata.getMeta(FIELD_VIEW_SQL)));
map.put(FIELD_ALIAS_NAME, StringUtils.toString(aliasName, eiMetadata.getMeta(FIELD_ALIAS_NAME)));
return map;
}
}
\ No newline at end of file
package com.baosight.hpjx.hp.pz.enums;
/**
* 动态表
*
* @author songx
* @date 2024/3/1,17:29
*/
public enum DynamicTableEnum {
HPSC001("HPSC001", "销售管理"),
HPSC011("HPSC011", "项目档案"),
;
/**
* 编码
*/
private String code;
/**
* 名称
*/
private String name;
DynamicTableEnum(String code, String name) {
this.code = code;
this.name = name;
}
/**
* code 是否存在
*
* @param code
* @return
*/
public static boolean contains(String code) {
for (DynamicTableEnum value : values()) {
if (value.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 根据名称查询
*
* @param name
* @return
*/
public static DynamicTableEnum getByName(String name) {
for (DynamicTableEnum value : values()) {
if (value.getName().equals(name)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.constant.HpPzSqlConst;
import com.baosight.hpjx.hp.pz.domain.HPPZ030;
import com.baosight.hpjx.hp.pz.domain.HPPZ030A;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 表字段配置
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHPPZ030 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BLOCK_ID), null, true);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ030().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPPZ030A.QUERY, new HPPZ030A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<HPPZ030> fPz030s = MapUtils.toDaoEPBases(inInfo, HPPZ030.class);
for (HPPZ030 fPz030 : fPz030s) {
DaoUtils.update(HPPZ030.DELETE, fPz030);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + fPz030s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 修改排序
*
* @param inInfo
* @return
*/
public EiInfo updateSort(EiInfo inInfo) {
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap : resultMaps) {
DaoUtils.update(HpPzSqlConst.HpPz030.UPDATE_SORT, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ030;
import com.baosight.hpjx.hp.pz.domain.HPPZ031;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 选择字段
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPPZ030A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BLOCK_ID), null, true);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ031().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPPZ031.QUERY, new HPPZ031());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
public EiInfo confirm(EiInfo inInfo) {
try {
// 租户信息
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HPPZ030.FIELD_COMPANY_CODE);
AssertUtils.isEmpty(companyCode, "请选择企业");
HPPZ009 dbPz009 = HPPZTools.HpPz009.getByCode(companyCode);
AssertUtils.isNull(dbPz009, "租户信息不存在");
List<HPPZ030> fPz030s = MapUtils.toDaoEPBases(inInfo, HPPZ030.class);
for (HPPZ030 fPz030 : fPz030s) {
fPz030.setCompanyCode(companyCode);
fPz030.setCompanyName(dbPz009.getCompanyName());
DaoUtils.insert(HPPZ030.INSERT, fPz030, false);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + fPz030s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.core.constant.CodesetConstant;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.CodeValueTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.constant.HpPzSqlConst;
import com.baosight.hpjx.hp.pz.domain.HPPZ031;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* 表字段配置
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHPPZ031 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ031().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPPZ031.QUERY, new HPPZ031());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap : resultMaps) {
DaoUtils.update(HPPZ031.DELETE, resultMap);
// 同步删除已配置的信息
DaoUtils.update(HpPzSqlConst.HpPz030.DELETE_BY_FIELD, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据导入
*
* @param inInfo
* @return
*/
public EiInfo importData(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
List<HPPZ031> fPz021s = (List<HPPZ031>) inInfo.get("dataList");
// 数据校验
this.checkImportData(fPz021s);
// 插入新的数据
this.saveImportData(fPz021s);
outInfo.setMsg("导入成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(outInfo, e, "数据导入失败");
}
return outInfo;
}
/**
* 检查导入的数据
*
* @param fPz021s
*/
private void checkImportData(List<HPPZ031> fPz021s) {
// 表名称小代码
List<Map> dynamicTables = CodeValueTools.getCodeValues(CodesetConstant.HgPz.DYNAMIC_TABLE);
for (HPPZ031 fPz021 : fPz021s) {
AssertUtils.isEmpty(fPz021.getTableCode(), String.format("序号[%s]表英文名不能为空", fPz021.getId()));
for (Map dynamicTableMap : dynamicTables) {
String value = MapUtils.getString(dynamicTableMap, "value");
if (value.equals(fPz021.getTableCode())) {
fPz021.setTableName(MapUtils.getString(dynamicTableMap, "label"));
}
}
AssertUtils.isEmpty(fPz021.getTableName(), String.format("序号[%s]表名称非法", fPz021.getId()));
AssertUtils.isEmpty(fPz021.getFieldCode(), String.format("序号[%s]字段英文名不能为空", fPz021.getId()));
AssertUtils.isEmpty(fPz021.getFieldName(), String.format("序号[%s]字段中文名不能为空", fPz021.getId()));
}
}
/**
* 数据写入
*
* @param fPz021s
*/
private void saveImportData(List<HPPZ031> fPz021s) {
for (HPPZ031 fPz021 : fPz021s) {
fPz021.setStatus(HPConstant.EnablingStatus.QY);
fPz021.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ031.INSERT, fPz021, false);
}
}
/**
* 修改排序
*
* @param inInfo
* @return
*/
public EiInfo updateSort(EiInfo inInfo) {
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap : resultMaps) {
DaoUtils.update(HpPzSqlConst.HpPz031.UPDATE_SORT, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ031;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPPZ031A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
HPPZ031 fPz031 = MapUtils.toDaoEPBase(inInfo, HPPZ031.class);
if (fPz031.getId() == null || fPz031.getId() == 0) {
this.add(fPz031);
} else {
this.modify(fPz031);
}
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fPz031
*/
private void add(HPPZ031 fPz031) {
fPz031.setStatus(HPConstant.EnablingStatus.QY);
fPz031.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ031.INSERT, fPz031);
}
/**
* 修改数据
*
* @param fPz031
*/
private void modify(HPPZ031 fPz031) {
DaoUtils.update(HPPZ031.UPDATE, fPz031);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
Long id = MapUtils.getLong(queryRow, HPPZ031.FIELD_ID);
if (id == null) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HPPZTools.HpPz031.get(id));
resultBlock.addBlockMeta(new HPPZ031().eiMetadata);
inInfo.setBlock(resultBlock);
}
}
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<isNotEmpty prepend=" " property="dataAuthCondition">
$dataAuthCondition$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ030">
<sql id="column">
ID as "id", <!-- -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
COMPANY_NAME as "companyName", <!-- 企业名称 -->
TABLE_CODE as "tableCode", <!-- 表英文名 -->
TABLE_NAME as "tableName", <!-- 表中文名 -->
FIELD_CODE as "fieldCode", <!-- 字段英文名 -->
FIELD_NAME as "fieldName", <!-- 字段中文名 -->
SORT_NUM as "sortNum" <!-- 排序 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableCode">
TABLE_CODE = #tableCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableName">
TABLE_NAME LIKE CONCAT('%', #tableName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldCode">
FIELD_CODE LIKE CONCAT('%', #fieldCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldName">
FIELD_NAME LIKE CONCAT('%', #fieldName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ030">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ030 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ030 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ030 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
COMPANY_CODE, <!-- 企业编码 -->
COMPANY_NAME, <!-- 企业名称 -->
TABLE_CODE, <!-- 表英文名 -->
TABLE_NAME, <!-- 表中文名 -->
FIELD_CODE, <!-- 字段英文名 -->
FIELD_NAME, <!-- 字段中文名 -->
SORT_NUM <!-- 排序 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #companyCode#, #companyName#, #tableCode#, #tableName#, #fieldCode#, #fieldName#, #sortNum#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPPZ030 WHERE ID = #id#
</delete>
<!-- 根据字段删除 -->
<delete id="deleteByField">
DELETE FROM ${hpjxSchema}.T_HPPZ030 WHERE TABLE_CODE = #tableCode# AND FIELD_CODE = #fieldCode#
</delete>
<!-- 修改排序 -->
<update id="updateSort">
UPDATE ${hpjxSchema}.T_HPPZ030
SET
SORT_NUM = #sortNum#, <!-- 排序 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ030A">
<sql id="column">
<include refid="columnA"/>,
<include refid="columnB"/>
</sql>
<sql id="columnA">
A.ID as "id", <!-- -->
A.CREATED_BY as "createdBy", <!-- 记录创建者 -->
A.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
A.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
A.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
A.COMPANY_NAME as "companyName", <!-- 企业名称 -->
A.TABLE_CODE as "tableCode", <!-- 表英文名 -->
A.TABLE_NAME as "tableName", <!-- 表中文名 -->
A.FIELD_CODE as "fieldCode", <!-- 字段英文名 -->
A.FIELD_NAME as "fieldName", <!-- 字段中文名 -->
A.SORT_NUM as "sortNum" <!-- 排序 -->
</sql>
<sql id="columnB">
B.VIEW_SQL as "viewSql", <!-- 视图SQL -->
B.ALIAS_NAME as "aliasName" <!-- 别名 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableCode">
A.TABLE_CODE = #tableCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableName">
A.TABLE_NAME LIKE CONCAT('%', #tableName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldCode">
A.FIELD_CODE LIKE CONCAT('%', #fieldCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldName">
A.FIELD_NAME LIKE CONCAT('%', #fieldName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ030A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ030 A, ${hpjxSchema}.T_HPPZ031 B
WHERE A.TABLE_CODE = B.TABLE_CODE
AND A.FIELD_CODE = B.FIELD_CODE
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPPZ030 A, ${hpjxSchema}.T_HPPZ031 B
WHERE A.TABLE_CODE = B.TABLE_CODE
AND A.FIELD_CODE = B.FIELD_CODE
<include refid="condition"/>
</select>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ031">
<sql id="column">
ID as "id", <!-- -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
STATUS as "status", <!-- 0-未启用,1-已启用 -->
TABLE_CODE as "tableCode", <!-- 表英文名 -->
TABLE_NAME as "tableName", <!-- 表中文名 -->
FIELD_CODE as "fieldCode", <!-- 字段英文名 -->
FIELD_NAME as "fieldName", <!-- 字段中文名 -->
VIEW_SQL as "viewSql", <!-- 视图SQL -->
ALIAS_NAME as "aliasName", <!-- 别名 -->
SORT_NUM as "sortNum", <!-- 排序 -->
IS_DEFAULT as "isDefault" <!-- 是否默认,1-是,0-否 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableCode">
TABLE_CODE = #tableCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableName">
TABLE_NAME LIKE CONCAT('%', #tableName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldCode">
FIELD_CODE LIKE CONCAT('%', #fieldCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldName">
FIELD_NAME LIKE CONCAT('%', #fieldName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isDefault">
IS_DEFAULT = #isDefault#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<!-- 过滤已经添加的字段 -->
<isNotEmpty prepend=" AND " property="companyCode">
NOT EXISTS (SELECT * FROM ${hpjxSchema}.T_HPPZ030 A WHERE A.TABLE_CODE = T.TABLE_CODE
AND A.FIELD_CODE = T.FIELD_CODE AND A.COMPANY_CODE = #companyCode#
)
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ031">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ031 T WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ031 T WHERE 1=1
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ031 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
STATUS, <!-- 0-未启用,1-已启用 -->
TABLE_CODE, <!-- 表英文名 -->
TABLE_NAME, <!-- 表中文名 -->
FIELD_CODE, <!-- 字段英文名 -->
FIELD_NAME, <!-- 字段中文名 -->
VIEW_SQL, <!-- 视图SQL -->
ALIAS_NAME, <!-- 别名 -->
SORT_NUM, <!-- 排序 -->
IS_DEFAULT <!-- 是否默认,1-是,0-否 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #status#, #tableCode#, #tableName#, #fieldCode#, #fieldName#, #viewSql#, #aliasName#, #sortNum#, #isDefault#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPPZ031 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ031
SET
TABLE_CODE = #tableCode#, <!-- 表英文名 -->
TABLE_NAME = #tableName#, <!-- 表中文名 -->
FIELD_CODE = #fieldCode#, <!-- 字段英文名 -->
FIELD_NAME = #fieldName#, <!-- 字段中文名 -->
VIEW_SQL = #viewSql#, <!-- 视图 -->
SORT_NUM = #sortNum#, <!-- 排序 -->
IS_DEFAULT = #isDefault#, <!-- 是否默认 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 修改排序 -->
<update id="updateSort">
UPDATE ${hpjxSchema}.T_HPPZ031
SET
SORT_NUM = #sortNum#, <!-- 排序 -->
IS_DEFAULT = #isDefault#, <!-- 是否默认 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
...@@ -931,4 +931,88 @@ public class HPPZTools { ...@@ -931,4 +931,88 @@ public class HPPZTools {
return results; return results;
} }
} }
/**
* HPPZ030 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HpPz030 {
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HPPZ030> listByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HPPZ030.FIELD_COMPANY_CODE, UserSessionUtils.getCompanyCode());
queryMap.put(HPPZ030.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " SORT_NUM ASC");
return DaoBase.getInstance().query(HPPZ030.QUERY, queryMap);
}
}
/**
* HPPZ030A 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HpPz030A {
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HPPZ030A> listByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HPPZ030A.FIELD_COMPANY_CODE, UserSessionUtils.getCompanyCode());
queryMap.put(HPPZ030A.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " A.SORT_NUM ASC");
return DaoBase.getInstance().query(HPPZ030A.QUERY, queryMap);
}
}
/**
* HPPZ031 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HpPz031 {
/**
* 查询
*
* @param id
* @return
*/
public static HPPZ031 get(Long id) {
AssertUtils.isNull(id, "节点ID不能为空");
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HPPZ031.FIELD_ID, id);
List<HPPZ031> results = DaoBase.getInstance().query(HPPZ031.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HPPZ031> listDefaultByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HPPZ031.FIELD_IS_DEFAULT, CommonConstant.YesNo.YES_1);
queryMap.put(HPPZ031.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " SORT_NUM ASC");
return DaoBase.getInstance().query(HPPZ031.QUERY, queryMap);
}
}
} }
package com.baosight.hpjx.hp.pz.utils;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ030A;
import com.baosight.hpjx.hp.pz.domain.HPPZ031;
import com.baosight.hpjx.hp.pz.enums.DynamicTableEnum;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author songx
* @date 2024/11/6,15:48
*/
public class HPPZUtils {
/**
* HPPZ030 定义
*
* @author songx
* @date 2024/11/6,15:48
*/
public static class HpPz030 {
/**
* 设置动态列
*
* @param inInfo
* @param dynamicTableEnum
* @return
*/
public static void buildDynamicColumn(EiInfo inInfo, DynamicTableEnum dynamicTableEnum) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
buildDynamicColumn(queryMap, dynamicTableEnum);
}
/**
* 设置动态列
*
* @param queryMap
* @param dynamicTableEnum
* @return
*/
public static void buildDynamicColumn(Map queryMap, DynamicTableEnum dynamicTableEnum) {
queryMap.put(CommonConstant.Field.DYNAMIC_COLUMN, buildDynamicColumn(dynamicTableEnum));
}
/**
* 设置动态列
*
* @param dynamicTableEnum 动态表
*/
public static String buildDynamicColumn(DynamicTableEnum dynamicTableEnum) {
// 查询企业配置的字段,如果未配置使用默认字段
List<HPPZ030A> dbPz030as = HPPZTools.HpPz030A.listByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz030as)) {
return dbPz030as.stream().map(item -> {
if (StringUtils.isBlank(item.getViewSql())) {
return item.getFieldCode() + " as \"" + item.getAliasName() + "\"";
} else {
return item.getViewSql() + " as \"" + item.getAliasName() + "\"";
}
}).collect(Collectors.joining(", "));
}
List<HPPZ031> dbPz031s = HPPZTools.HpPz031.listDefaultByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz031s)) {
return dbPz031s.stream().map(item -> {
if (StringUtils.isEmpty(item.getViewSql())) {
return item.getFieldCode() + " as \"" + item.getAliasName() + "\"";
} else {
return item.getViewSql() + " as \"" + item.getAliasName() + "\"";
}
}).collect(Collectors.joining(", "));
}
return null;
}
/**
* 设置动态列
*
* @param dynamicTableEnum 动态表
*/
public static List<String> listDynamicColumnAlias(DynamicTableEnum dynamicTableEnum) {
// 查询企业配置的字段,如果未配置使用默认字段
List<HPPZ030A> dbPz030as = HPPZTools.HpPz030A.listByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz030as)) {
return dbPz030as.stream().map(HPPZ030A::getAliasName).collect(Collectors.toList());
}
List<HPPZ031> dbPz031s = HPPZTools.HpPz031.listDefaultByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz031s)) {
return dbPz031s.stream().map(HPPZ031::getAliasName).collect(Collectors.toList());
}
return new ArrayList<>();
}
/**
* 填充EiMetadata
*
* @param inInfo
* @param clazz
*/
public static void buildEiMetaData(EiInfo inInfo, Class clazz) throws Exception {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 动态列
String dynamicColumn = MapUtils.getString(queryMap, CommonConstant.Field.DYNAMIC_COLUMN);
if (StringUtils.isBlank(dynamicColumn)) {
return;
}
EiBlock resultBlock = inInfo.getBlock(EiConstant.resultBlock);
// 先清除已设置的Meta信息
resultBlock.getBlockMeta().getMetas().clear();
// 取实体类的Meta列信息
Map<String, EiColumn> originMetas = ((DaoEPBase) clazz.newInstance()).eiMetadata.getMetas();
for (String itemColumn : dynamicColumn.split(",")) {
// 使用别名获取meta信息,例如PROJ_NAME as "projName"
String aliasName = itemColumn.split("as")[1].replace("\"", "").trim();
EiColumn eiColumn = originMetas.get(aliasName);
if (eiColumn != null) {
resultBlock.addMeta(eiColumn);
}
}
// 按动态列重新组装数据
List<Map<String, Object>> newResultMaps = new ArrayList<>();
Set<String> metaKeySet = resultBlock.getBlockMeta().getMetas().keySet();
for (Map resultMap : (List<Map>) resultBlock.getRows()) {
LinkedHashMap newResultMap = new LinkedHashMap();
for (String metaKey : metaKeySet) {
if (resultMap.containsKey(metaKey)) {
newResultMap.put(metaKey, resultMap.get(metaKey));
}
}
newResultMaps.add(newResultMap);
}
resultBlock.setRows(newResultMaps);
}
}
}
...@@ -131,6 +131,8 @@ public class DocExcelUtils { ...@@ -131,6 +131,8 @@ public class DocExcelUtils {
f.set(obj, Double.parseDouble(cellValue)); f.set(obj, Double.parseDouble(cellValue));
} else if (f.getType() == BigDecimal.class) { } else if (f.getType() == BigDecimal.class) {
f.set(obj, new BigDecimal(cellValue)); f.set(obj, new BigDecimal(cellValue));
} else if (f.getType() == Long.class) {
f.set(obj, new Long(cellValue));
} else { } else {
f.set(obj, cellValue); f.set(obj, cellValue);
} }
......
...@@ -7,7 +7,6 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ010; ...@@ -7,7 +7,6 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.domain.Org; import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext; import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus; import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus;
...@@ -187,7 +186,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -187,7 +186,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
*/ */
private void setCompanyCode(String name, Object parameters) { private void setCompanyCode(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环 // 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser", "HPPZ009.query"}; String[] serviceFilter = {"HPXSUser", "HPPZ009.query", "HPPZ030", "HPPZ030A", "HPPZ031"};
if (StringUtils.startsWithAny(name, serviceFilter)) { if (StringUtils.startsWithAny(name, serviceFilter)) {
return; return;
} }
...@@ -202,7 +201,8 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -202,7 +201,8 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
*/ */
private void setDataAuth(String name, Object parameters) { private void setDataAuth(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环 // 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser", "HPXSOrg", "HPPZ009.query", "HPPZ010.query"}; String[] serviceFilter = {"HPXSUser", "HPXSOrg", "HPPZ009.query", "HPPZ010.query", "HPPZ030", "HPPZ030A",
"HPPZ031"};
if (StringUtils.startsWithAny(name, serviceFilter)) { if (StringUtils.startsWithAny(name, serviceFilter)) {
return; return;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<Appenders> <Appenders>
<!--*********************控制台日志***********************--> <!--*********************控制台日志***********************-->
<Console name="Console" target="SYSTEM_OUT" follow="true"> <Console name="Console" target="SYSTEM_OUT" follow="true">
<PatternLayout charset="GBK" pattern="${LOG_PATTERN}"/> <PatternLayout charset="UTF-8" pattern="${LOG_PATTERN}"/>
</Console> </Console>
<TextArea name="platLogAppender"> <TextArea name="platLogAppender">
<PatternLayout pattern="%m%n"/> <PatternLayout pattern="%m%n"/>
......
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
<!-- 用户服务 --> <!-- 用户服务 -->
<sqlMap resource="com/baosight/hpjx/hp/xs/sql/HPXS007A.xml"/> <sqlMap resource="com/baosight/hpjx/hp/xs/sql/HPXS007A.xml"/>
<!-- 配置管理 -->
<sqlMap resource="com/baosight/hpjx/hp/pz/sql/HPPZ030.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/pz/sql/HPPZ030A.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/pz/sql/HPPZ031.xml"/>
<!-- 产品服务 --> <!-- 产品服务 -->
<sqlMap resource="com/baosight/hpjx/hp/fw/sql/HPFW001.xml"/> <sqlMap resource="com/baosight/hpjx/hp/fw/sql/HPFW001.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/fw/sql/HPFW002.xml"/> <sqlMap resource="com/baosight/hpjx/hp/fw/sql/HPFW002.xml"/>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100]
},
columns: []
}
// 查询
$("#QUERY").on("click", query);
// 选择
$("#SELECT").on("click", select);
// 删除
$("#REMOVE").on("click", remove);
// 修改排序
$("#UPDATE_SORT").on("click", updateSort);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
};
/**
* 选择
*/
let select = function () {
JSColorbox.open({
href: "HPPZ030A",
title: "<div style='text-align: center;'>字段定义查询</div>",
width: "95%",
height: "95%",
callbackName: selectCallback
});
}
/**
* 选择回调
*/
let selectCallback = function () {
// 刷新页面
query();
}
/**
* 删除
*/
function remove() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ030", "remove", true);
}
})
}
/**
* 修改排序
*/
function updateSort() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.submitGridsData("result", "HPPZ030", "updateSort", true);
}
\ No newline at end of file
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="页面字段配置">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect ename="companyCode" cname="企业" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="company_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true" sort="single">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="租户编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyName" cname="租户名称" enable="false" width="120" align="center" sort="false"/>
<EF:EFColumn ename="tableCode" cname="页面英文名" enable="false" width="120" align="left"
alias="a.tableCode"/>
<EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left" sort="false"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="180" align="left"
alias="a.fieldCode"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left" sort="false"/>
<EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" width="100" align="center" required="true" alias="a.sortNum"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center" sort="false"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']" alias="a.createdTime"/>
<EF:EFColumn ename="updatedName" cname="修改人" enable="false" align="center" sort="false"/>
<EF:EFColumn ename="updatedTime" cname="修改时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']" alias="a.updatedTime"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFSelect = {
"inqu_status-0-companyCode": {
change: function (e) { //获取勾选值
query();
}
}
}
IPLATUI.EFGrid = {
"result": {
exportGrid: false,
columns: []
}
}
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择
*/
let confirm = function () {
let companyCode = $("#inqu_status-0-companyCode").val();
if (CommonUtils.isBlank(companyCode)) {
message("请选择租户");
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
JSUtils.submitGridsData("result", "HPPZ030A", "confirm",
true, function (res) {
message(res.msg);
if (res.status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="字段定义查询">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<div class="row">
<EF:EFSelect ename="companyCode" cname="企业" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true">
<EF:EFOptions blockId="company_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" height="60vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="tableCode" cname="页面英文名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="sortNum" cname="排序" enable="false" width="80" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20, pageSizes: [20, 50, 70, 100]
}, columns: [{
field: "operator", template: function (item) {
let template = '';
if (!CommonUtils.isBlank(item.id)) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="modify(' + item.id + ')">修改</a>';
}
return template
}
}]
}
// 查询
$("#QUERY").on("click", query);
// 新增
$("#ADD").on("click", add);
// 删除
$("#REMOVE").on("click", remove);
// 导入
$("#IMPORT").on("click", importData);
// 修改排序
$("#UPDATE_SORT").on("click", updateSort);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
};
/**
* 新增
*/
let add = function () {
addOrUpdate("");
}
/**
* 修改
*/
let modify = function (id) {
let params = "inqu_status-0-id=" + id;
addOrUpdate(params);
}
/**
* 新增
*/
let addOrUpdate = function (params) {
JSColorbox.open({
href: "HPPZ031A?" + params,
title: "<div style='text-align: center;'>" + (isBlank(params) ? "新增页面字段" : "修改页面字段")
+ "</div>",
width: "60%",
height: "70%",
callbackName: addOrUpdateCallback
});
}
/**
* 新增成功后回调
*/
let addOrUpdateCallback = function (res) {
// 刷新列表
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 删除
*/
function remove() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ031", "remove", true);
}
})
}
/**
* 导入
*/
let importData = function () {
CommonUtils.importData("HPPZ031", "页面字段导入", importDataCallback);
}
/**
* 导入回调
*/
let importDataCallback = function () {
query();
}
/**
* 修改排序
*/
function updateSort() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.submitGridsData("result", "HPPZ031", "updateSort", true);
}
\ No newline at end of file
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="页面字段定义">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true" sort="single">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"
sort="false"/>
<EF:EFColumn ename="tableCode" cname="页面英文名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left" sort="false"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left" sort="false"/>
<EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" width="80" align="center" required="true"/>
<EF:EFComboColumn ename="isDefault" cname="是否默认" width="100" align="center" copy="true" required="true"
sort="false">
<EF:EFCodeOption codeName="hpjx.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center" sort="false"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedName" cname="修改人" enable="false" align="center" sort="false"/>
<EF:EFColumn ename="updatedTime" cname="修改时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFSelect = {
"result-0-tableCode": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = dataItem['textField'];
if (!CommonUtils.isBlank(valueField)) {
textField = textField.indexOf("-") > -1 ? textField.split("-")[1] : textField;
$("#result-0-tableName").val(textField);
} else {
$("#result-0-tableName").val("");
}
}
}
}
IPLATUI.EFGrid = {
"result": {
pageable: false,
exportGrid: false,
toolbarConfig: {
hidden: false,
},
columns: []
}
};
// 确认
$('#SAVE').on('click', save);
// 键盘按键
downKeyUp();
})
/**
* 页面加载完
*/
$(window).load(function () {
// 修改时禁用输入框
modifyEnableInput();
});
/**
* 禁用输入框
*/
let modifyEnableInput = function () {
let id = $("#result-0-id").val();
if (!CommonUtils.isBlank(id)) {
$("#result-0-tableCode").data("kendoDropDownList").readonly(true);
$("#result-0-fieldCode").attr("readonly", true);
}
}
/**
* 保存
*/
let save = function () {
let tableCode = $("#result-0-tableCode").val();
if (isBlank(tableCode)) {
message("表名称不能为空");
return;
}
let fieldCode = $("#result-0-fieldCode").val();
if (isBlank(fieldCode)) {
message("字段英文名不能为空");
return;
}
let fieldName = $("#result-0-fieldName").val();
if (isBlank(fieldName)) {
message("字段中文名不能为空");
return;
}
let aliasName = $("#result-0-aliasName").val();
if (isBlank(aliasName)) {
message("字段别名不能为空");
return;
}
JSUtils.submitGridsData("", "HPPZ031A", "save", false,
function (res) {
if (res.status > -1) {
parent.JSColorbox.setValueCallback(res);
} else {
message(res.msg);
}
}
);
}
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="页面字段详情">
<EF:EFRegion id="result" title="数据区域">
<EF:EFInput cname="ID" blockId="result" ename="id" row="0" type="hidden"/>
<div class="row">
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="result" row="0" colWidth="6" ratio="2:10"
filter="contains" required="true" optionLabel="请选择" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="tableName" cname="页面中文名" blockId="result" row="0" type="hidden"/>
</div>
<div class="row">
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true"/>
</div>
<div class="row">
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true"/>
</div>
<div class="row">
<EF:EFInput ename="aliasName" cname="别名" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true"/>
</div>
<div class="row">
<EF:EFInput ename="sortNum" cname="排序" blockId="result" row="0" colWidth="6" ratio="2:10"/>
</div>
<div class="row">
<EF:EFSelect ename="isDefault" cname="是否默认" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFSelect>
</div>
<br/>
</EF:EFRegion>
</EF:EFPage>
<%@ page import="com.baosight.hpjx.core.security.UserSessionUtils" %> <%@ page import="com.baosight.hpjx.hp.pz.utils.HPPZUtils" %>
<%@ page import="com.baosight.hpjx.hp.pz.enums.DynamicTableEnum" %>
<%@ page import="java.util.List" %>
<%@ page import="org.apache.commons.collections.CollectionUtils" %>
<!DOCTYPE html> <!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script> <%
var ctx = "${ctx}"; // 查询动态显示列的别名
</script> List<String> dynamicColumnAlias = HPPZUtils.HpPz030.listDynamicColumnAlias(DynamicTableEnum.HPSC011);
<head> // 以#隔开字段别名
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%> request.setAttribute("dynamicColumnAlias", CollectionUtils.isEmpty(dynamicColumnAlias) ? "" :
</head> "#" + String.join("#", dynamicColumnAlias) + "#");
<EF:EFPage title="项目档案">
<EF:EFRegion id="inqu" title="查询条件"><%-- type="query" efRegionShowClear="true" efRegionSave="true"--%>
<div class="row"> <%-- blockId="inqu_status" row="0" --%> %>
<EF:EFPage title="项目档案">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-projCode" cname="项目编码" colWidth="3"/> <EF:EFInput ename="inqu_status-0-projCode" cname="项目编码" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-projName" cname="项目名称" colWidth="3"/> <EF:EFInput ename="inqu_status-0-projName" cname="项目名称" colWidth="3"/>
<EF:EFSelect ename="inqu_status-0-projType" cname="项目类型" colWidth="3" filter="contains" <EF:EFSelect ename="inqu_status-0-projType" cname="项目类型" colWidth="3" filter="contains"
...@@ -39,37 +43,44 @@ ...@@ -39,37 +43,44 @@
</EF:EFSelect> </EF:EFSelect>
<EF:EFDatePicker ename="inqu_status-0-deliveryDate" cname="交货日期" role="date" enable="false" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/> <EF:EFDatePicker ename="inqu_status-0-deliveryDate" cname="交货日期" role="date" enable="false" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div> </div>
<%-- <EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>--%>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" sort="all"> <EF:EFGrid blockId="result" autoDraw="no" isFloat="true" sort="all">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center" sort="false"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center" sort="false"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projCode#')? false: true}"/>
<EF:EFComboColumn ename="projType" cname="项目类型" width="100" align="center" required="true" <EF:EFComboColumn ename="projType" cname="项目类型" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#"> columnTemplate="#=textField#" itemTemplate="#=textField#"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projType#')? false: true}">
<EF:EFCodeOption codeName="hpjx.hpsc.projType"/> <EF:EFCodeOption codeName="hpjx.hpsc.projType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn enable="false" ename="projName" cname="项目名称"/> <EF:EFColumn enable="false" ename="projName" cname="项目名称"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projName#')? false: true}"/>
<EF:EFComboColumn ename="princ1" cname="项目负责人" width="120" align="center" required="true" <EF:EFComboColumn ename="princ1" cname="项目负责人" width="120" align="center" required="true"
blockName="user_block_id" textField="textField" valueField="valueField" blockName="user_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains"> filter="contains"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#princ1#')? false: true}">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="princ2" cname="客户负责人" width="120" align="center" required="true" <EF:EFComboColumn ename="princ2" cname="客户负责人" width="120" align="center" required="true"
blockName="customer_record_block_id" textField="textField" valueField="valueField" blockName="customer_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains"> filter="contains"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#princ2#')? false: true}">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="deliveryDate" cname="交货日期" width="100" align="center" <EF:EFColumn ename="deliveryDate" cname="交货日期" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"
<EF:EFComboColumn ename="materialStatus" cname="物料提交状态" enable="false" width="100" align="center"> hidden="${fn:contains(requestScope.dynamicColumnAlias, '#deliveryDate#')? false: true}"/>
<EF:EFComboColumn ename="materialStatus" cname="物料提交状态" enable="false" width="100" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#materialStatus#')? false: true}">
<EF:EFOption label="未提交" value="0"/> <EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="部分提交" value="1"/> <EF:EFOption label="部分提交" value="1"/>
<EF:EFOption label="全部提交" value="2"/> <EF:EFOption label="全部提交" value="2"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" enable="false"/> <EF:EFColumn ename="remark" cname="备注" enable="false"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#remark#')? false: true}"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
...@@ -561,10 +561,40 @@ function loadChange(grid,e,field) { ...@@ -561,10 +561,40 @@ function loadChange(grid,e,field) {
}); });
} }
/**
* 判断是否为null
*
* @param value
* @returns {boolean}
*/
function isBlank(value) {
return value == null || value === 'null' || $.trim(value) === '' || value === 'undefined'
|| value === 'unknown';
}
/**
* 导入
*
* @param id 路由ID
* @param title 标题
* @param callback 回调函数
*/
let importData = function (id, title, callback) {
JSColorbox.open({
href: "HPDM91?inqu_status-0-id=" + id,
title: "<div style='text-align: center;'>" + title + "</div>",
width: "600px",
height: "250px",
callbackName: callback
});
}
// export 到全局作用域 window对象 // export 到全局作用域 window对象
$.extend(window, { $.extend(window, {
CommonUtils: { CommonUtils: {
uploadFile: uploadFile, uploadFile: uploadFile,
isBlank: isBlank,
importData: importData
} }
}); });
})(window.jQuery); })(window.jQuery);
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