Commit 6020ff04 by 宋祥

Merge branch 'dev' of http://129.211.46.84:8800/platform/hg-smart into master-dc

parents deec1494 4c75deef
...@@ -2,6 +2,7 @@ package com.baosight.hggp.common; ...@@ -2,6 +2,7 @@ package com.baosight.hggp.common;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.enums.ValidFlagEnum;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -22,6 +23,15 @@ import java.util.Map; ...@@ -22,6 +23,15 @@ import java.util.Map;
public enum DdynamicEnum { public enum DdynamicEnum {
//------------------------------------配置管理----------------------------------- //------------------------------------配置管理-----------------------------------
/** /**
* 模块:租户管理
* 用途:租户下拉框
*/
ACCOUNT_BLOCK_ID("account_block_id", "accountCode", "accountName", "HGPZ009.query",
new HashMap<String, Object>() {{
put("exValidFlag", ValidFlagEnum.VIRTUALLY.getCode());
}}),
/**
* 模块:项目性质 * 模块:项目性质
* 用途:项目性质下拉框 * 用途:项目性质下拉框
* 编写:wwl * 编写:wwl
......
...@@ -57,13 +57,16 @@ public class DocController extends WebDispatchController { ...@@ -57,13 +57,16 @@ public class DocController extends WebDispatchController {
} }
Map<String, Object> params = this.convertParam(paramMaps); Map<String, Object> params = this.convertParam(paramMaps);
String id = request.getParameter("id"); String id = request.getParameter("id");
DocRouteEnum docRouteEnum = DocRouteEnum.getById(id); DocRouteEnum docRouteEnum = null;
if (MapUtils.getString(params, "fileName").contains("HGSC004A")) { String fileName = MapUtils.getString(params, "fileName");
if (fileName != null && fileName.contains("HGSC004A")) {
docRouteEnum = DocRouteEnum.getById("route_001"); docRouteEnum = DocRouteEnum.getById("route_001");
} else if (params.get("fileName").toString().contains("HGSC009A")) { } else if (fileName != null && fileName.contains("HGSC009A")) {
docRouteEnum = DocRouteEnum.getById("route_002"); docRouteEnum = DocRouteEnum.getById("route_002");
} else if (params.get("fileName").toString().contains("HGPZ005")) { } else if (fileName != null && fileName.contains("HGPZ005")) {
docRouteEnum = DocRouteEnum.getById("route_003"); docRouteEnum = DocRouteEnum.getById("route_003");
} else {
docRouteEnum = DocRouteEnum.getById(id);
} }
if (docRouteEnum == null) { if (docRouteEnum == null) {
outInfo.setMsg("导入标识ID不存在"); outInfo.setMsg("导入标识ID不存在");
......
...@@ -7,6 +7,18 @@ package com.baosight.hggp.core.constant; ...@@ -7,6 +7,18 @@ package com.baosight.hggp.core.constant;
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
......
...@@ -71,6 +71,21 @@ public class CommonConstant { ...@@ -71,6 +71,21 @@ public class CommonConstant {
} }
/** /**
* 权限过滤
*
* @author:songx
* @date:2024/1/20,15:04
*/
public static class AuthFilter {
// 企业权限
public static final String[] ACCOUNT = {"HGXSUser", "HGPZ009", "HGPZ020", "HGPZ020A", "HGPZ021"};
// 数据权限
public static final String[] DATA = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009", "HGPZ020", "HGPZ021",
"HGPZ010.query"};
}
/**
* 设备计划状态 * 设备计划状态
* *
* @author:songx * @author:songx
...@@ -115,6 +130,8 @@ public class CommonConstant { ...@@ -115,6 +130,8 @@ public class CommonConstant {
// Main // Main
public static final String MAIN = "main"; public static final String MAIN = "main";
public static final String ENAME = "ename"; public static final String ENAME = "ename";
// 动态列
public static final String DYNAMIC_COLUMN = "dynamicColumn";
} }
/** /**
......
...@@ -3,7 +3,6 @@ package com.baosight.hggp.core.dao; ...@@ -3,7 +3,6 @@ package com.baosight.hggp.core.dao;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -44,15 +43,26 @@ public class DaoUtils { ...@@ -44,15 +43,26 @@ public class DaoUtils {
* *
* @param sql * @param sql
* @param obj * @param obj
* @throws PlatException
*/ */
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;
} }
...@@ -66,6 +76,17 @@ public class DaoUtils { ...@@ -66,6 +76,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 (StringUtils.isBlank(depCode) && !"admin".equals(UserSessionUtils.getLoginName())) { if (StringUtils.isBlank(depCode) && !"admin".equals(UserSessionUtils.getLoginName())) {
...@@ -81,11 +102,11 @@ public class DaoUtils { ...@@ -81,11 +102,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();
...@@ -132,11 +153,22 @@ public class DaoUtils { ...@@ -132,11 +153,22 @@ public class DaoUtils {
* @param parameters * @param parameters
*/ */
public static int insertBatch(String sql, Collection parameters) { public static int insertBatch(String sql, Collection parameters) {
parameters.forEach(obj->{ return insertBatch(sql, parameters, true);
}
/**
* insertBatch method.
*
* @param sql
* @param parameters
* @param setAuth
*/
public static int insertBatch(String sql, Collection parameters, boolean setAuth) {
parameters.forEach(obj -> {
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);
} }
}); });
return DaoBase.getInstance().insertBatch(sql, parameters); return DaoBase.getInstance().insertBatch(sql, parameters);
...@@ -146,8 +178,9 @@ public class DaoUtils { ...@@ -146,8 +178,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 {
...@@ -178,7 +211,22 @@ public class DaoUtils { ...@@ -178,7 +211,22 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
// 创建时刻
try {
String dateTime = DateUtils.shortDateTime();
BeanUtils.setProperty(bean, "createdTime", dateTime);
BeanUtils.setProperty(bean, "updatedTime", dateTime);
} catch (Exception e) {
log.error("写入创建时刻失败:{}", e.getMessage(), e);
}
// 内码(UUID)
try {
BeanUtils.setProperty(bean, "internalCode", StringUtils.uuid());
} catch (Exception e) {
log.warn("error", e);
}
// 创建人企业编码 // 创建人企业编码
if (setAuth) {
String accountCode = UserSessionUtils.getAccountCode(); String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) { if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
...@@ -200,19 +248,6 @@ public class DaoUtils { ...@@ -200,19 +248,6 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人部门编码失败", e); log.warn("写入创建人部门编码失败", e);
} }
// 创建时刻
try {
String dateTime = DateUtils.shortDateTime();
BeanUtils.setProperty(bean, "createdTime", dateTime);
BeanUtils.setProperty(bean, "updatedTime", dateTime);
} catch (Exception e) {
log.error("写入创建时刻失败:{}", e.getMessage(), e);
}
// 内码(UUID)
try {
BeanUtils.setProperty(bean, "internalCode", StringUtils.uuid());
} catch (Exception e) {
log.warn("error", e);
} }
} }
...@@ -220,8 +255,9 @@ public class DaoUtils { ...@@ -220,8 +255,9 @@ public class DaoUtils {
* 创建人工号 创建人姓名 创建时刻. * 创建人工号 创建人姓名 创建时刻.
* *
* @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 {
...@@ -245,6 +281,20 @@ public class DaoUtils { ...@@ -245,6 +281,20 @@ public class DaoUtils {
} }
map.put("createdName", userName); map.put("createdName", userName);
map.put("updatedName", ""); map.put("updatedName", "");
// 创建时刻
try {
map.put("createdTime", DateUtils.shortDateTime());
map.put("updatedTime", "");
} catch (PlatException e) {
log.warn("写入创建时刻失败", e);
}
// 内码(UUID)
try {
map.put("internalCode", StringUtils.uuid());
} catch (PlatException e) {
log.warn("error", e);
}
if (setAuth) {
// 创建人企业编码 // 创建人企业编码
String accountCode = UserSessionUtils.getAccountCode(); String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) { if (!"admin".equals(userId)) {
...@@ -266,18 +316,6 @@ public class DaoUtils { ...@@ -266,18 +316,6 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人企业编码失败", e); log.warn("写入创建人企业编码失败", e);
} }
// 创建时刻
try {
map.put("createdTime", DateUtils.shortDateTime());
map.put("updatedTime", "");
} catch (PlatException e) {
log.warn("写入创建时刻失败", e);
}
// 内码(UUID)
try {
map.put("internalCode", StringUtils.uuid());
} catch (PlatException e) {
log.warn("error", e);
} }
} }
......
...@@ -2,6 +2,7 @@ package com.baosight.hggp.core.enums; ...@@ -2,6 +2,7 @@ package com.baosight.hggp.core.enums;
import com.baosight.hggp.hg.cw.domain.HGCW003; import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.sc.domain.HGSC004A; import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC009A; import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sj.domain.HGSJ003; import com.baosight.hggp.hg.sj.domain.HGSJ003;
...@@ -17,6 +18,7 @@ public enum DocRouteEnum { ...@@ -17,6 +18,7 @@ public enum DocRouteEnum {
HGPZ005("route_003", "", 1, "HGPZ005", "importData", HGPZ005.class), HGPZ005("route_003", "", 1, "HGPZ005", "importData", HGPZ005.class),
HGCW003("route_004", "", 1, "HGCW003", "importData", HGCW003.class), HGCW003("route_004", "", 1, "HGCW003", "importData", HGCW003.class),
HGSJ003("route_005", "", 1, "HGSJ003", "importData", HGSJ003.class), HGSJ003("route_005", "", 1, "HGSJ003", "importData", HGSJ003.class),
HGPZ021("HGPZ021", "/file/template/hgpz021.xls", 1, "HGPZ021", "importData", HGPZ021.class),
; ;
......
...@@ -527,6 +527,7 @@ public class HGConstant { ...@@ -527,6 +527,7 @@ public class HGConstant {
// 已提交 // 已提交
public static final Integer S1 = 1; public static final Integer S1 = 1;
} }
// 报工状态 // 报工状态
public static class BGStatus { public static class BGStatus {
......
...@@ -18,4 +18,32 @@ public class HgPzSqlConstant { ...@@ -18,4 +18,32 @@ public class HgPzSqlConstant {
public static final String UPDATE_COMPOSING_COEFF = MODULE + "updateComposingCoeff"; public static final String UPDATE_COMPOSING_COEFF = MODULE + "updateComposingCoeff";
} }
/**
*
* @author songx
* @date 2024/11/6,14:21
*/
public class HgPz020 {
// 模块名称
public static final String MODULE = "HGPZ020.";
// 修改排产系数
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 HgPz021 {
// 模块名称
public static final String MODULE = "HGPZ021.";
// 修改排产系数
public static final String UPDATE_SORT = MODULE + "updateSort";
}
} }
package com.baosight.hggp.hg.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 HGPZ020A extends HGPZ020 {
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 = "HGPZ020A.query";
public static final String COUNT = "HGPZ020A.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 HGPZ020A() {
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.hggp.hg.pz.enums;
/**
* 动态表
*
* @author songx
* @date 2024/3/1,17:29
*/
public enum DynamicTableEnum {
HGCW002("HGCW002", "合同管理"),
HGSC001("HGSC001", "项目立项"),
;
/**
* 编码
*/
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;
}
}
...@@ -13,8 +13,6 @@ import com.baosight.hggp.util.AssertUtils; ...@@ -13,8 +13,6 @@ import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
......
...@@ -7,13 +7,11 @@ import com.baosight.hggp.core.security.UserSessionUtils; ...@@ -7,13 +7,11 @@ import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ015; import com.baosight.hggp.hg.pz.domain.HGPZ015;
import com.baosight.hggp.hg.pz.domain.HGPZ015A; import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC004; import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A; import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
......
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.constant.HgPzSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ020A;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.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 ServiceHGPZ020 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ACCOUNT_BLOCK_ID), null, true);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ020().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, HGPZ020A.QUERY, new HGPZ020A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<HGPZ020> fPz020s = MapUtils.toDaoEPBases(inInfo, HGPZ020.class);
for (HGPZ020 fPz020 : fPz020s) {
DaoUtils.update(HGPZ020.DELETE, fPz020);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + fPz020s.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(HgPzSqlConstant.HgPz020.UPDATE_SORT, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.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 ServiceHGPZ020A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ACCOUNT_BLOCK_ID), null, true);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ021().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, HGPZ021.QUERY, new HGPZ021());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
public EiInfo confirm(EiInfo inInfo) {
try {
// 租户信息
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(queryMap, HGPZ020.FIELD_ACCOUNT_CODE);
AssertUtils.isEmpty(accountCode, "请选择租户");
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
AssertUtils.isNull(dbPz009, "租户信息不存在");
List<HGPZ020> fPz020s = MapUtils.toDaoEPBases(inInfo, HGPZ020.class);
for (HGPZ020 fPz020 : fPz020s) {
fPz020.setAccountCode(accountCode);
fPz020.setAccountName(dbPz009.getAccountName());
DaoUtils.insert(HGPZ020.INSERT, fPz020, false);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + fPz020s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.core.constant.CodesetConstant;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.tools.CodeValueTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.constant.HgPzSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.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 ServiceHGPZ021 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ021().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, HGPZ021.QUERY, new HGPZ021());
} 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(HGPZ021.DELETE, resultMap);
// 同步删除已配置的信息
DaoUtils.update(HgPzSqlConstant.HgPz020.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<HGPZ021> fPz021s = (List<HGPZ021>) 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<HGPZ021> fPz021s) {
// 表名称小代码
List<Map> dynamicTables = CodeValueTools.getCodeValues(CodesetConstant.HgPz.DYNAMIC_TABLE);
for (HGPZ021 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<HGPZ021> fPz021s) {
for (HGPZ021 fPz021 : fPz021s) {
fPz021.setStatus(HGConstant.EnablingStatus.QY);
fPz021.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGPZ021.INSERT, fPz021);
}
}
/**
* 修改排序
*
* @param inInfo
* @return
*/
public EiInfo updateSort(EiInfo inInfo) {
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap : resultMaps) {
DaoUtils.update(HgPzSqlConstant.HgPz021.UPDATE_SORT, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.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 ServiceHGPZ021A 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 {
HGPZ021 fPz021 = MapUtils.toDaoEPBase(inInfo, HGPZ021.class);
if (fPz021.getId() == null || fPz021.getId() == 0) {
this.add(fPz021);
} else {
this.modify(fPz021);
}
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fPz021
*/
private void add(HGPZ021 fPz021) {
fPz021.setStatus(HGConstant.EnablingStatus.QY);
fPz021.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGPZ021.INSERT, fPz021);
}
/**
* 修改数据
*
* @param fPz021
*/
private void modify(HGPZ021 fPz021) {
DaoUtils.update(HGPZ021.UPDATE, fPz021);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
Long id = MapUtils.getLong(queryRow, HGPZ021.FIELD_ID);
if (id == null) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HGPZTools.HgPz021.get(id));
resultBlock.addBlockMeta(new HGPZ021().eiMetadata);
inInfo.setBlock(resultBlock);
}
}
<?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="HGPZ020">
<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", <!-- 记录修改时间 -->
ACCOUNT_CODE as "accountCode", <!-- 租户编码 -->
ACCOUNT_NAME as "accountName", <!-- 租户名称 -->
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="accountCode">
ACCOUNT_CODE = #accountCode#
</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.hggp.hg.pz.domain.HGPZ020">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ020 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ020 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ020 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
ACCOUNT_CODE, <!-- 租户编码 -->
ACCOUNT_NAME, <!-- 租户名称 -->
TABLE_CODE, <!-- 表英文名 -->
TABLE_NAME, <!-- 表中文名 -->
FIELD_CODE, <!-- 字段英文名 -->
FIELD_NAME, <!-- 字段中文名 -->
SORT_NUM <!-- 排序 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #accountCode#, #accountName#, #tableCode#, #tableName#, #fieldCode#, #fieldName#, #sortNum#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGPZ020 WHERE ID = #id#
</delete>
<!-- 根据字段删除 -->
<delete id="deleteByField">
DELETE FROM ${hggpSchema}.HGPZ020 WHERE TABLE_CODE = #tableCode# AND FIELD_CODE = #fieldCode#
</delete>
<!-- 修改排序 -->
<update id="updateSort">
UPDATE ${hggpSchema}.HGPZ020
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="HGPZ020A">
<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.ACCOUNT_CODE as "accountCode", <!-- 租户编码 -->
A.ACCOUNT_NAME as "accountName", <!-- 租户名称 -->
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="accountCode">
A.ACCOUNT_CODE = #accountCode#
</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.hggp.hg.pz.domain.HGPZ020A">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ020 A, ${hggpSchema}.HGPZ021 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 ${hggpSchema}.HGPZ020 A, ${hggpSchema}.HGPZ021 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="HGPZ021">
<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="accountCode">
NOT EXISTS (SELECT * FROM ${hggpSchema}.HGPZ020 A WHERE A.TABLE_CODE = T.TABLE_CODE
AND A.FIELD_CODE = T.FIELD_CODE AND A.ACCOUNT_CODE = #accountCode#
)
</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.hggp.hg.pz.domain.HGPZ021">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ021 T WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ021 T WHERE 1=1
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ021 (
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 ${hggpSchema}.HGPZ021 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGPZ021
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 ${hggpSchema}.HGPZ021
SET
SORT_NUM = #sortNum#, <!-- 排序 -->
IS_DEFAULT = #isDefault#, <!-- 是否默认 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
package com.baosight.hggp.hg.pz.tools; package com.baosight.hggp.hg.pz.tools;
import com.baosight.hggp.common.InventTypeEnum; import com.baosight.hggp.common.InventTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.ValidFlagEnum; import com.baosight.hggp.core.enums.ValidFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.*;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.pz.domain.HGPZ002; import com.baosight.hggp.hg.pz.domain.HGPZ002;
import com.baosight.hggp.hg.pz.domain.HGPZ003; import com.baosight.hggp.hg.pz.domain.HGPZ003;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.domain.HGPZ006;
import com.baosight.hggp.hg.pz.domain.HGPZ007; import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.domain.HGPZ016;
import com.baosight.hggp.hg.pz.domain.HGPZ017;
import com.baosight.hggp.hg.pz.domain.HGPZ018;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ020A;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.util.HashMap;
import java.util.*; import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -997,5 +1012,87 @@ public class HGPZTools { ...@@ -997,5 +1012,87 @@ public class HGPZTools {
} }
} }
/**
* HGPZ020 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HgPz020 {
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HGPZ020> listByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ020.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
queryMap.put(HGPZ020.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " SORT_NUM ASC");
return DaoBase.getInstance().query(HGPZ020.QUERY, queryMap);
}
}
/**
* HGPZ020A 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HgPz020A {
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HGPZ020A> listByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ020A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
queryMap.put(HGPZ020A.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " A.SORT_NUM ASC");
return DaoBase.getInstance().query(HGPZ020A.QUERY, queryMap);
}
}
/**
* HGPZ021 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HgPz021 {
/**
* 查询
*
* @param id
* @return
*/
public static HGPZ021 get(Long id) {
AssertUtils.isNull(id, "节点ID不能为空");
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ021.FIELD_ID, id);
List<HGPZ021> results = DaoBase.getInstance().query(HGPZ021.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HGPZ021> listDefaultByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ021.FIELD_IS_DEFAULT, CommonConstant.YesNo.YES_1);
queryMap.put(HGPZ021.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " SORT_NUM ASC");
return DaoBase.getInstance().query(HGPZ021.QUERY, queryMap);
}
}
} }
package com.baosight.hggp.hg.pz.utils;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ020A;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.enums.DynamicTableEnum;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.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 HGPZUtils {
/**
* HGPZ020 定义
*
* @author songx
* @date 2024/11/6,15:48
*/
public static class HgPz020 {
/**
* 设置动态列
*
* @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<HGPZ020A> dbPz020as = HGPZTools.HgPz020A.listByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz020as)) {
return dbPz020as.stream().map(item -> {
if (StringUtils.isEmpty(item.getViewSql())) {
return item.getFieldCode() + " as \"" + item.getAliasName() + "\"";
} else {
return item.getViewSql() + " as \"" + item.getAliasName() + "\"";
}
}).collect(Collectors.joining(", "));
}
List<HGPZ021> dbPz021s = HGPZTools.HgPz021.listDefaultByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz021s)) {
return dbPz021s.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;
}
/**
* 填充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);
}
}
}
package com.baosight.hggp.hg.sc.domain; package com.baosight.hggp.hg.sc.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/** /**
* Project: <br> * Project: <br>
......
...@@ -6,9 +6,9 @@ import com.baosight.hggp.core.constant.CommonConstant; ...@@ -6,9 +6,9 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.hg.pz.domain.HGPZ001; import com.baosight.hggp.hg.pz.domain.HGPZ001;
import com.baosight.hggp.hg.pz.domain.HGPZ002; import com.baosight.hggp.hg.pz.enums.DynamicTableEnum;
import com.baosight.hggp.hg.pz.utils.HGPZUtils;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant; import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A; import com.baosight.hggp.hg.sc.domain.HGSC001A;
...@@ -18,18 +18,28 @@ import com.baosight.hggp.hg.xs.domain.Dept; ...@@ -18,18 +18,28 @@ import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.hg.xs.utils.HGXSUtils; import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ExcelUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @Author wwl * @Author wwl
* @Date 2024/5/6 19:48 * @Date 2024/5/6 19:48
...@@ -39,7 +49,7 @@ public class ServiceHGSC001 extends ServiceBase { ...@@ -39,7 +49,7 @@ public class ServiceHGSC001 extends ServiceBase {
@OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "初始化页面") @OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC001().eiMetadata); // inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC001().eiMetadata);
Map map = new HashMap(); Map map = new HashMap();
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode()); map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
...@@ -49,15 +59,21 @@ public class ServiceHGSC001 extends ServiceBase { ...@@ -49,15 +59,21 @@ public class ServiceHGSC001 extends ServiceBase {
return inInfo; return inInfo;
} }
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "查询") @OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
// 设置动态列
HGPZUtils.HgPz020.buildDynamicColumn(inInfo, DynamicTableEnum.HGSC001);
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001()); inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap(); // 根据结果集填充eiMetadata
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode()); HGPZUtils.HgPz020.buildEiMetaData(inInfo, HGSC001.class);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false); } catch (Exception e) {
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
return inInfo; return inInfo;
...@@ -263,7 +279,7 @@ public class ServiceHGSC001 extends ServiceBase { ...@@ -263,7 +279,7 @@ public class ServiceHGSC001 extends ServiceBase {
@OperationLogAnnotation(operModul = "项目立项", operType = "导出", operDesc = "导出记录") @OperationLogAnnotation(operModul = "项目立项", operType = "导出", operDesc = "导出记录")
public EiInfo export(EiInfo inEiInfo) { public EiInfo export(EiInfo inEiInfo) {
Map params = HGXSUtils.setAuthParam("HGSC001."+ACConstants.SQL_EXPORT, EiInfoUtils.getFirstRow(inEiInfo)); Map params = HGXSUtils.setAuthParam("HGSC001."+ ACConstants.SQL_EXPORT, EiInfoUtils.getFirstRow(inEiInfo));
final List<String> list = new ArrayList<>( final List<String> list = new ArrayList<>(
Arrays.asList( "companyName","projCode","projName","subcontract_name","genral_contract_name","branchUnit", Arrays.asList( "companyName","projCode","projName","subcontract_name","genral_contract_name","branchUnit",
"projType","permissStartDate","startDate","endDate","projStatus","approvalStatus" "projType","permissStartDate","startDate","endDate","projStatus","approvalStatus"
......
...@@ -218,6 +218,17 @@ ...@@ -218,6 +218,17 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
</sql>
<select id="get" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001"> <select id="get" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT SELECT
<include refid="column"/> <include refid="column"/>
...@@ -227,17 +238,11 @@ ...@@ -227,17 +238,11 @@
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001"> <select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT SELECT
<include refid="column"/> <isEmpty property="dynamicColumn"><include refid="column"/></isEmpty>
<isNotEmpty property="dynamicColumn">$dynamicColumn$</isNotEmpty>
FROM ${hggpSchema}.HGSC001 WHERE 1=1 FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition"/> <include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <include refid="orderBy"/>
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
......
...@@ -30,11 +30,7 @@ import com.baosight.xservices.xs.util.LoginUserDetails; ...@@ -30,11 +30,7 @@ import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -282,12 +278,14 @@ public class ServiceHGWD001D extends TreeService { ...@@ -282,12 +278,14 @@ public class ServiceHGWD001D extends TreeService {
if (CollectionUtils.isEmpty(dbSc001s)) { if (CollectionUtils.isEmpty(dbSc001s)) {
return results; return results;
} }
List<String> projCodes = dbSc001s.stream().map(HGSC001::getProjCode).distinct().collect(Collectors.toList()); //List<String> projCodes = dbSc001s.stream().map(HGSC001::getProjCode).distinct().collect(Collectors.toList());
List<HGWD003> hgwd003s = HGWDTools.HgWd003.list(projCodes); //List<HGWD003> hgwd003s = HGWDTools.HgWd003.list(projCodes);
for (HGSC001 dbSc001 : dbSc001s) { for (HGSC001 dbSc001 : dbSc001s) {
String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")"; String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")";
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P); Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P);
Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
int count = getChildCount(dbSc001.getProjCode());
//Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
leafMap.put("projCode", dbSc001.getProjCode()); leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName()); leafMap.put("projName", dbSc001.getProjName());
...@@ -330,21 +328,11 @@ public class ServiceHGWD001D extends TreeService { ...@@ -330,21 +328,11 @@ public class ServiceHGWD001D extends TreeService {
boolean isManager = HgWdUtils.HgWd009.isManager(); boolean isManager = HgWdUtils.HgWd009.isManager();
List<String> fileIds = dbWd001s.stream().map(HGWD001::getFileId).distinct().collect(Collectors.toList()); List<String> fileIds = dbWd001s.stream().map(HGWD001::getFileId).distinct().collect(Collectors.toList());
// 查询目录授权人数 // 查询目录授权人数
Map<String, List<HGWD003>> dbWd003Map = HGWDTools.HgWd003.map(fileIds); List<HGWD003> dbWd003s = HGWDTools.HgWd003.list(fileIds);
Map<String, List<HGWD099>> fWd099s = HGWDTools.HgWd099.map(fileIds);
for (HGWD001 dbWd001 : dbWd001s) { for (HGWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C); Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C);
// 已授权人员信息
List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(dbWd001.getFileId()); int count = getChildCount(dbWd001.getFileId());
int dbWd099s = fWd099s.get(dbWd001.getFileId()) == null ? 0 : fWd099s.get(dbWd001.getFileId()).size();
int count = 0;
if (dbWd003s!=null && dbWd003s.size() > 0 && dbWd099s > 0){
count = 3;
}else if (dbWd003s!=null && dbWd003s.size() > 0){
count = 2;
}else if (dbWd099s > 0){
count = 1;
}
leafMap.put("projCode", dbWd001.getProjCode()); leafMap.put("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName()); leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode()); leafMap.put("ename", dbWd001.getProjCode());
...@@ -407,4 +395,27 @@ public class ServiceHGWD001D extends TreeService { ...@@ -407,4 +395,27 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("leafType", leafType); leafMap.put("leafType", leafType);
return leafMap; return leafMap;
} }
/**
* 获取子级节点数量
* @param fileId 目录ID
* @return 节点数量
*/
public int getChildCount(String fileId){
List<Map> hgwd001List = HGWDTools.HgWd001.queryFileChild(fileId); //查询子级目录
List<String> childIds = Optional.ofNullable(hgwd001List).orElse(new ArrayList<>()).stream().map(o -> o.get("fileId").toString()).collect(Collectors.toList());
// 已授权人员信息
List<HGWD003> dbWd003List = HGWDTools.HgWd003.list(childIds);
List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD",childIds);
int dbWd099s = fWd099s == null ? 0 : fWd099s.size();
int count = 0;
if (dbWd003List!=null && dbWd003List.size() > 0 && dbWd099s > 0){
count = 3;
}else if (dbWd003List!=null && dbWd003List.size() > 0){
count = 2;
}else if (dbWd099s > 0){
count = 1;
}
return count;
}
} }
...@@ -65,7 +65,10 @@ public class ServiceHGWD099 extends ServiceEPBase { ...@@ -65,7 +65,10 @@ public class ServiceHGWD099 extends ServiceEPBase {
Map queryRow =EiInfoUtils.getFirstRow(inInfo); Map queryRow =EiInfoUtils.getFirstRow(inInfo);
if (ObjectUtils.isNotBlank(queryRow.get(HGWD001.FIELD_PARENT_ID))){ if (ObjectUtils.isNotBlank(queryRow.get(HGWD001.FIELD_PARENT_ID))){
List<Map> childList = HGWDTools.HgWd001.queryFileChild(queryRow.get(HGWD001.FIELD_PARENT_ID).toString()); List<Map> childList = HGWDTools.HgWd001.queryFileChild(queryRow.get(HGWD001.FIELD_PARENT_ID).toString());
List<String> childFileIdList = Optional.ofNullable(childList).orElse(new ArrayList<>()).stream().map(map -> map.get(HGWD001.FIELD_FILE_ID).toString()).collect(Collectors.toList()); if(childList == null){
return inInfo;
}
List<String> childFileIdList = Optional.of(childList).orElse(new ArrayList<>()).stream().map(map -> map.get(HGWD001.FIELD_FILE_ID).toString()).collect(Collectors.toList());
queryRow.put("bizIds",childFileIdList); queryRow.put("bizIds",childFileIdList);
queryRow.remove(HGWD099.FIELD_BIZ_ID); queryRow.remove(HGWD099.FIELD_BIZ_ID);
inInfo.getBlock(EiConstant.queryBlock).getRow(ACConstants.ROW_CODE_0).remove(HGWD001.FIELD_PARENT_ID); inInfo.getBlock(EiConstant.queryBlock).getRow(ACConstants.ROW_CODE_0).remove(HGWD001.FIELD_PARENT_ID);
......
...@@ -294,7 +294,9 @@ public class HGWDTools { ...@@ -294,7 +294,9 @@ public class HGWDTools {
* @return * @return
*/ */
public static List<HGWD003> list(List<String> fileIds) { public static List<HGWD003> list(List<String> fileIds) {
AssertUtils.isEmpty(fileIds, "文件ID不能为空"); if (CollectionUtils.isEmpty(fileIds)){
return null;
}
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("fileIds", fileIds); queryMap.put("fileIds", fileIds);
return DaoBase.getInstance().query(HGWD003.QUERY, queryMap); return DaoBase.getInstance().query(HGWD003.QUERY, queryMap);
...@@ -447,12 +449,12 @@ public class HGWDTools { ...@@ -447,12 +449,12 @@ public class HGWDTools {
} }
public static List<HGWD099> queryByBiz(String bizType, List<String> bizIds) { public static List<HGWD099> queryByBiz(String bizType, List<String> bizIds) {
AssertUtils.isNull(bizType, "业务类型不能为空!"); if (CollectionUtils.isEmpty(bizIds)){
AssertUtils.isNull(bizIds, "业务ID不能为空!"); return null;
}
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY, List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String, Object>() {{ new HashMap<String, Object>() {{
put("bizType", bizType); put("bizType", bizType==null?"WD":bizType);
put("bizIds", bizIds); put("bizIds", bizIds);
}} }}
); );
......
...@@ -2,7 +2,6 @@ package com.baosight.hggp.util; ...@@ -2,7 +2,6 @@ package com.baosight.hggp.util;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.HGConstants; import com.baosight.hggp.common.HGConstants;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao; import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
...@@ -16,7 +15,13 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession; ...@@ -16,7 +15,13 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.*; import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -70,7 +75,7 @@ public class CommonMethod { ...@@ -70,7 +75,7 @@ public class CommonMethod {
if (selectParams == null) { if (selectParams == null) {
selectParams = new HashMap<>(); selectParams = new HashMap<>();
} }
selectParams.put("accountCode", UserSessionUtils.getAccountCode()); // selectParams.put("accountCode", UserSessionUtils.getAccountCode());
/* 遍历每个数据源 */ /* 遍历每个数据源 */
for (DdynamicEnum tableParam : tableParams) { for (DdynamicEnum tableParam : tableParams) {
/* 编辑块名称 */ /* 编辑块名称 */
......
...@@ -124,10 +124,12 @@ public class DocExcelUtils { ...@@ -124,10 +124,12 @@ public class DocExcelUtils {
f.set(obj, Integer.parseInt(cellValue)); f.set(obj, Integer.parseInt(cellValue));
} else if (f.getType() == Double.class || f.getType() == double.class) { } else if (f.getType() == Double.class || f.getType() == double.class) {
f.set(obj, Double.parseDouble(cellValue)); f.set(obj, Double.parseDouble(cellValue));
} else if (f.getType() == Long.class || f.getType() == long.class) {
f.set(obj, Long.parseLong(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 { } else {
f.set(obj, cellValue.trim().toUpperCase(Locale.ROOT)); f.set(obj, cellValue.trim());
} }
} catch (Exception e) { } catch (Exception e) {
String msg = String.format("读取数据值失败,名称[%s],数值[%s],%s", f.getName(), cellValue, e.getMessage()); String msg = String.format("读取数据值失败,名称[%s],数值[%s],%s", f.getName(), cellValue, e.getMessage());
......
...@@ -192,8 +192,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -192,8 +192,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
*/ */
private void setAccountCode(String name, Map parameters) { private void setAccountCode(String name, Map parameters) {
// 需要过滤部分sql name,否则会形成死循环 // 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HGXSUser", "HGPZ009"}; if (StringUtils.startsWithAny(name, CommonConstant.AuthFilter.ACCOUNT)) {
if (StringUtils.startsWithAny(name, serviceFilter)) {
return; return;
} }
// 本来是BUG,避免业务代码改动依然保持原逻辑ADMIN时依然置空 // 本来是BUG,避免业务代码改动依然保持原逻辑ADMIN时依然置空
...@@ -221,8 +220,8 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -221,8 +220,8 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
} }
// 需要过滤部分sql name,否则会形成死循环;admin账户不需要校验 // 需要过滤部分sql name,否则会形成死循环;admin账户不需要校验
String loginName = UserSessionUtils.getLoginName(); String loginName = UserSessionUtils.getLoginName();
String[] serviceFilter = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009", "HGPZ010.query"}; if (StringUtils.startsWithAny(name, CommonConstant.AuthFilter.DATA)
if (StringUtils.startsWithAny(name, serviceFilter) || "admin".equalsIgnoreCase(loginName)) { || "admin".equalsIgnoreCase(loginName)) {
return; return;
} }
// 是否启用数据权限 // 是否启用数据权限
......
...@@ -120,6 +120,8 @@ ...@@ -120,6 +120,8 @@
<!--配置--> <!--配置-->
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005.xml"/> <sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/> <sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ020.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ021.xml"/>
<!--销售--> <!--销售-->
<sqlMap resource="com/baosight/hggp/hg/yx/sql/HGYX001.xml"/> <sqlMap resource="com/baosight/hggp/hg/yx/sql/HGYX001.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: "HGPZ020A",
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", "HGPZ020", "remove", true);
}
})
}
/**
* 修改排序
*/
function updateSort() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.submitGridsData("result", "HGPZ020", "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="accountCode" cname="租户" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="account_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="result" 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="accountCode" cname="租户编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="accountName" 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="viewSql" cname="视图语句" enable="false" width="200" 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-accountCode": {
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 accountCode = $("#inqu_status-0-accountCode").val();
if (CommonUtils.isBlank(accountCode)) {
message("请选择租户");
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
JSUtils.submitGridsData("result", "HGPZ020A", "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="accountCode" cname="租户" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true">
<EF:EFOptions blockId="account_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="result" 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="viewSql" cname="视图语句" enable="false" width="200" 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: "HGPZ021A?" + 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", "HGPZ021", "remove", true);
}
})
}
/**
* 导入
*/
let importData = function () {
CommonUtils.importData("HGPZ021", "表字段导入", importDataCallback);
}
/**
* 导入回调
*/
let importDataCallback = function () {
query();
}
/**
* 修改排序
*/
function updateSort() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.submitGridsData("result", "HGPZ021", "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="result" 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="viewSql" cname="视图SQL" enable="false" width="200" 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="hggp.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("", "HGPZ021A", "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="viewSql" cname="视图语句" blockId="result" row="0" colWidth="6" ratio="2:10"/>
</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>
...@@ -14,19 +14,18 @@ $(function () { ...@@ -14,19 +14,18 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [10, 20, 50, 70, 100],
}, },
columns: [ columns: [{
{
field: "projType", field: "projType",
template: function (item) { template: function (item) {
let template = ""; let template = "";
if(item.projType&&projTypeList&&projTypeList.length>0){ if (item.projType && projTypeList && projTypeList.length > 0) {
var projTypes = item.projType.split(","); var projTypes = item.projType.split(",");
for(let i=0;i<projTypes.length;i++){ for (let i = 0; i < projTypes.length; i++) {
for(let j=0;j<projTypeList.length;j++){ for (let j = 0; j < projTypeList.length; j++) {
if(projTypes[i] === projTypeList[j]['valueField']){ if (projTypes[i] === projTypeList[j]['valueField']) {
if(template === ""){ if (template === "") {
template = projTypeList[j]['textField'] template = projTypeList[j]['textField']
}else{ } else {
template += projTypeList[j]['textField'] template += projTypeList[j]['textField']
} }
} }
...@@ -35,11 +34,12 @@ $(function () { ...@@ -35,11 +34,12 @@ $(function () {
} }
return template; return template;
} }
}, }, {
{
field: "operator", field: "operator",
title: "操作",
template: function (item) { template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="showInfo(' + item.id + ')" >立项详情</a>'; 'onclick="showInfo(' + item.id + ')" >立项详情</a>';
return template; return template;
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
<script> <script>
var ctx = "${ctx}"; var ctx = "${ctx}";
</script> </script>
<head>
</head>
<EF:EFPage title="项目立项"> <EF:EFPage title="项目立项">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
...@@ -50,25 +48,25 @@ ...@@ -50,25 +48,25 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false" sort="all"> <EF:EFGrid blockId="result" autoDraw="mixed" isFloat="true" copyToAdd="false" sort="single">
<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="companyName" cname="公司名称" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="subcontractName" cname="分包方" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="subcontractName" cname="分包方" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="genralContractName" cname="总包方" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="genralContractName" cname="总包方" enable="false" width="120" align="center"/>--%>
<EF:EFComboColumn ename="branchUnit" cname="分支单位" enable="false" <EF:EFComboColumn ename="branchUnit" cname="分支单位" enable="false" width="130" align="left"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="100" required="true" maxLength="16" readonly="false" required="true"
align="center" filter="contains" sort="true"> filter="contains" sort="true">
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="projType" cname="项目性质" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="projType" cname="项目性质" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="permissStartDate" cname="准许开工日期" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="permissStartDate" cname="准许开工日期" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="startDate" cname="开工日期" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="startDate" cname="开工日期" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="endDate" cname="完工日期" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="endDate" cname="完工日期" enable="false" width="120" align="center"/>--%>
<EF:EFComboColumn ename="projStatus" cname="项目状态" width="80" align="center" required="true" <EF:EFComboColumn ename="projStatus" cname="项目状态" width="80" align="center" required="true"
readonly="true"> readonly="true">
<EF:EFCodeOption codeName="hggp.projStatus"/> <EF:EFCodeOption codeName="hggp.projStatus"/>
......
...@@ -143,11 +143,17 @@ let save = function (btnNode) { ...@@ -143,11 +143,17 @@ let save = function (btnNode) {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let projCode= item.get("projCode"); let projCode= item.get("projCode");
let fileName= item.get("fileName");
if(isBlank(projCode)){ if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!"); message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(fileName)){
message("选中的第"+(index+1)+"行\"目录名称\",不能为空!");
flag = false;
return false;
}
}); });
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
......
...@@ -122,11 +122,17 @@ let save = function (btnNode) { ...@@ -122,11 +122,17 @@ let save = function (btnNode) {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let projCode= item.get("projName"); let projCode= item.get("projName");
let fileName= item.get("fileName");
if(isBlank(projCode)){ if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!"); message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(fileName)){
message("选中的第"+(index+1)+"行\"目录名称\",不能为空!");
flag = false;
return false;
}
}); });
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
......
...@@ -773,6 +773,23 @@ function loadChange(grid,e,field) { ...@@ -773,6 +773,23 @@ function loadChange(grid,e,field) {
} }
} }
/**
* 导入
*
* @param id 路由ID
* @param title 标题
* @param callback 回调函数
*/
let importData = function (id, title, callback) {
JSColorbox.open({
href: "HGDM91?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: {
...@@ -781,7 +798,8 @@ function loadChange(grid,e,field) { ...@@ -781,7 +798,8 @@ function loadChange(grid,e,field) {
previewFile: previewFile, previewFile: previewFile,
isBlank: isBlank, isBlank: isBlank,
hideButton: hideButton, hideButton: hideButton,
showButton: showButton showButton: showButton,
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