Commit 3a408c03 by 宋祥

1.企业管理

parent 750bcb2f
......@@ -68,11 +68,11 @@ public class OperationLogAspect {
OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class);
if (opLog != null) {
try {
String companyCode;
String accountCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
accountCode = UserSessionUtils.getAccountCode();
} catch (Exception e) {
companyCode = "";
accountCode = "";
}
String userId = UserSession.getLoginName();
String loginName = UserSession.getLoginCName();
......@@ -80,7 +80,7 @@ public class OperationLogAspect {
String operType = opLog.operType();
String operDesc = opLog.operDesc();
boolean saveContet = opLog.saveContent();
String sql = "INSERT INTO ${metaSchema}.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
String sql = "INSERT INTO HGGP.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
" VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection()
......@@ -96,7 +96,7 @@ public class OperationLogAspect {
} else {
ps.setString(4, "");
}
ps.setString(5, companyCode);
ps.setString(5, accountCode);
ps.setString(6, userId);
ps.setString(7, loginName);
ps.setString(8, DateUtils.shortDateTime());
......
......@@ -105,10 +105,10 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
String accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "companyCode", companyCode);
BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
......@@ -159,10 +159,10 @@ public class DaoUtils {
map.put("createdName", userName);
map.put("updatedName", "");
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
String accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
map.put("companyCode", companyCode);
map.put("accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
......
......@@ -8,6 +8,7 @@ public enum OrgTypeEnum {
FACTORY("factory", "厂区"),
DEPT("dept", "部门"),
COMPANY("dept", "公司"),
PROD_GROUP("prodGroup", "生产组"),
CUT_GROUP("cutGroup", "下料组"),
SYN_GROUP("synGroup", "综合组"),
......
......@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentMap;
*/
public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap();
private static ConcurrentMap ACCOUNT_MAP = new ConcurrentHashMap();
/**
* 获取用户信息
......@@ -52,22 +52,22 @@ public class UserSessionUtils extends UserSession {
}
/**
* 获取登录用户的公司编码
* 获取登录用户的企业编码
*
* @return
*/
public static String getCompanyCode() {
public static String getAccountCode() {
String loginName = getLoginName();
if (loginName == null) {
return null;
}
String companyCode = MapUtils.getString(companyMap, loginName);
if (companyCode == null) {
String accountCode = MapUtils.getString(ACCOUNT_MAP, loginName);
if (accountCode == null) {
User user = getUser();
companyCode = user == null || user.getCompanyCode() == null ? "" : user.getCompanyCode();
companyMap.put(loginName, companyCode);
accountCode = user == null || user.getAccountCode() == null ? "" : user.getAccountCode();
ACCOUNT_MAP.put(loginName, accountCode);
}
return companyCode;
return accountCode;
}
/**
......
package com.baosight.hggp.hg.pz.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:Hgpz009.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-07 9:05:59 create
*/
public class Hgpz009 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 帐套编码*/
public static final String FIELD_ACCOUNT_NAME = "accountName"; /* 帐套名称*/
public static final String FIELD_VALID_FLAG = "validFlag"; /* 是否启用:1.启用,0.停用*/
public static final String FIELD_LOGIN_PREFIX = "loginPrefix"; /* 登录前缀*/
public static final String FIELD_DOC_ID_PC = "docIdPc"; /* pc文档标识*/
public static final String FIELD_DOC_ID_APP = "docIdApp"; /* app文档标识*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除:1.是,0.否*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 帐套编码*/
public static final String COL_ACCOUNT_NAME = "ACCOUNT_NAME"; /* 帐套名称*/
public static final String COL_VALID_FLAG = "VALID_FLAG"; /* 是否启用:1.启用,0.停用*/
public static final String COL_LOGIN_PREFIX = "LOGIN_PREFIX"; /* 登录前缀*/
public static final String COL_DOC_ID_PC = "DOC_ID_PC"; /* pc文档标识*/
public static final String COL_DOC_ID_APP = "DOC_ID_APP"; /* app文档标识*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除:1.是,0.否*/
public static final String QUERY = "HGPZ009.query";
public static final String COUNT = "HGPZ009.count";
public static final String INSERT = "HGPZ009.insert";
public static final String UPDATE = "HGPZ009.update";
public static final String DELETE = "HGPZ009.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 帐套编码*/
private String accountName = " "; /* 帐套名称*/
private Integer validFlag; /* 是否启用:1.启用,0.停用*/
private String loginPrefix = " "; /* 登录前缀*/
private String docIdPc = " "; /* pc文档标识*/
private String docIdApp = " "; /* app文档标识*/
private String remark = " "; /* 备注*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag = 0; /* 是否删除:1.是,0.否*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("帐套编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_NAME);
eiColumn.setDescName("帐套名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_VALID_FLAG);
eiColumn.setDescName("是否启用:1.启用,0.停用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LOGIN_PREFIX);
eiColumn.setDescName("登录前缀");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_ID_PC);
eiColumn.setDescName("pc文档标识");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_ID_APP);
eiColumn.setDescName("app文档标识");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("更新人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除:1.是,0.否");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public Hgpz009() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 帐套编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 帐套编码.
*
* @param accountCode - 帐套编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the accountName - 帐套名称.
* @return the accountName
*/
public String getAccountName() {
return this.accountName;
}
/**
* set the accountName - 帐套名称.
*
* @param accountName - 帐套名称
*/
public void setAccountName(String accountName) {
this.accountName = accountName;
}
/**
* get the validFlag - 是否启用:1.启用,0.停用.
* @return the validFlag
*/
public Integer getValidFlag() {
return this.validFlag;
}
/**
* set the validFlag - 是否启用:1.启用,0.停用.
*
* @param validFlag - 是否启用:1.启用,0.停用
*/
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
/**
* get the loginPrefix - 登录前缀.
* @return the loginPrefix
*/
public String getLoginPrefix() {
return this.loginPrefix;
}
/**
* set the loginPrefix - 登录前缀.
*
* @param loginPrefix - 登录前缀
*/
public void setLoginPrefix(String loginPrefix) {
this.loginPrefix = loginPrefix;
}
/**
* get the docIdPc - pc文档标识.
* @return the docIdPc
*/
public String getDocIdPc() {
return this.docIdPc;
}
/**
* set the docIdPc - pc文档标识.
*
* @param docIdPc - pc文档标识
*/
public void setDocIdPc(String docIdPc) {
this.docIdPc = docIdPc;
}
/**
* get the docIdApp - app文档标识.
* @return the docIdApp
*/
public String getDocIdApp() {
return this.docIdApp;
}
/**
* set the docIdApp - app文档标识.
*
* @param docIdApp - app文档标识
*/
public void setDocIdApp(String docIdApp) {
this.docIdApp = docIdApp;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
* @param updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 更新人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 更新人名称.
*
* @param updatedName - 更新人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
* @param updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除:1.是,0.否.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除:1.是,0.否.
*
* @param deleteFlag - 是否删除:1.是,0.否
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setAccountName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_NAME)), accountName));
setValidFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_VALID_FLAG)), validFlag));
setLoginPrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOGIN_PREFIX)), loginPrefix));
setDocIdPc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_PC)), docIdPc));
setDocIdApp(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_APP)), docIdApp));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_ACCOUNT_NAME, StringUtils.toString(accountName, eiMetadata.getMeta(FIELD_ACCOUNT_NAME)));
map.put(FIELD_VALID_FLAG, StringUtils.toString(validFlag, eiMetadata.getMeta(FIELD_VALID_FLAG)));
map.put(FIELD_LOGIN_PREFIX, StringUtils.toString(loginPrefix, eiMetadata.getMeta(FIELD_LOGIN_PREFIX)));
map.put(FIELD_DOC_ID_PC, StringUtils.toString(docIdPc, eiMetadata.getMeta(FIELD_DOC_ID_PC)));
map.put(FIELD_DOC_ID_APP, StringUtils.toString(docIdApp, eiMetadata.getMeta(FIELD_DOC_ID_APP)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
return map;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
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.Hgpz009;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
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.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 企业管理
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHGPZ009 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new Hgpz009().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, Hgpz009.QUERY, new Hgpz009());
String projectEnv = ProjectInfo.getProjectEnv();
inInfo.setCell(EiConstant.resultBlock, ACConstants.ROW_CODE_0, "projectEnv", projectEnv);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理", operType = "插入", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
Hgpz009 fPz009 = new Hgpz009();
fPz009.fromMap(resultRows.get(i));
if (fPz009.getId() == null || fPz009.getId() == 0) {
this.add(fPz009);
} else {
this.modify(fPz009);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
Hgpz009 fPz009 = new Hgpz009();
fPz009.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fPz009.getAccountName(), "企业名称不能为空");
AssertUtils.isEmpty(fPz009.getLoginPrefix(), "登录前缀不能为空");
AssertUtils.isNull(fPz009.getValidFlag(), "是否启用不能为空");
}
}
/**
* 新增企业信息
*
* @param fPz009
* @throws Exception
*/
private void add(Hgpz009 fPz009) throws Exception {
// 生成企业编码
fPz009.setAccountCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.COMPANY_CODE));
fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0);
fPz009.setCreatedBy(UserSession.getLoginName());
fPz009.setCreatedName(UserSession.getLoginCName());
fPz009.setCreatedTime(DateUtils.shortDateTime());
// 此处不能使用DaoUtils方法insert
dao.insert(Hgpz009.INSERT, fPz009);
// 默认新增企业管理员账号
String userId = fPz009.getLoginPrefix() + "0000";
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(),
null, null);
// 关联企业管理员角色
this.insertGroupMember(fPz009, userId);
}
/**
* 修改数据
*
* @param fPz009
*/
private void modify(Hgpz009 fPz009) {
DaoUtils.update(Hgpz009.UPDATE, fPz009);
}
/**
* 新增操作.
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "配置管理", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
Hgpz009 fPz009 = new Hgpz009();
fPz009.fromMap(resultRows.get(i));
this.add(fPz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 用户关联角色
*
* @param hgpz009
* @param userId
*/
private void insertGroupMember(Hgpz009 hgpz009, String userId) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("memberId", userId);
inInfoRowMap.put("memberName", hgpz009.getAccountName());
// TODO 该用户组固定不能修改,代码中其他地方有写死的地方
inInfoRowMap.put("parentId", "companyManage");
inInfoRowMap.put("parentName", "企业管理员");
inInfoRowMap.put("memberType", "USER");
EiInfo inInfo = new EiInfo();
inInfo.addBlock(EiConstant.resultBlock).addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS03");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理", operType = "修改", operDesc = "修改操作")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
for (int i = 0; i < resultRows.size(); i++) {
Hgpz009 hppz009 = new Hgpz009();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update(Hgpz009.UPDATE, hppz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理", operType = "删除", operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
Hgpz009 fPz009 = new Hgpz009();
fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HGXSTools.XsUser.countByCompany(fPz009.getAccountCode());
if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", fPz009.getAccountName()));
}
DaoUtils.update(Hgpz009.DELETE, fPz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
<?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="HGPZ009">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
ACCOUNT_NAME as "accountName", <!-- 企业名称 -->
VALID_FLAG as "validFlag", <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX as "loginPrefix", <!-- 登录前缀 -->
DOC_ID_PC as "docIdPc",
DOC_ID_APP as "docIdApp",
REMARK as "remark", <!-- 备注 -->
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" <!-- 是否删除:1.是,0.否 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" " property="dataAuthCondition">
$dataAuthCondition$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="validFlag">
VALID_FLAG = #validFlag#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="accountName">
ACCOUNT_NAME LIKE CONCAT('%', #accountName#, '%')
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询品种大类配置 -->
<select id="query" resultClass="com.baosight.hggp.hg.pz.domain.Hgpz009">
SELECT
<include refid="column"/>
FROM ${metaSchema}.HGPZ009
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<!-- 查询记录数 -->
<select id="count" resultClass="int">
SELECT COUNT(1)
FROM ${metaSchema}.HGPZ009
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${metaSchema}.HGPZ009 (
ACCOUNT_CODE, <!-- 企业编码 -->
ACCOUNT_NAME, <!-- 企业名称 -->
VALID_FLAG, <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX, <!-- 登录前缀 -->
DOC_ID_PC,
DOC_ID_APP,
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#accountCode#, #accountName#, #validFlag#, #loginPrefix#, #docIdPc#,
#docIdApp#, #remark#, #createdBy#, #createdName#, #createdTime#
)
</insert>
<!-- 修改 -->
<update id="update">
UPDATE ${metaSchema}.HGPZ009
SET
ACCOUNT_NAME = #accountName#,
DOC_ID_PC = #docIdPc#,
DOC_ID_APP = #docIdApp#,
VALID_FLAG = #validFlag#,
REMARK = #remark#,
<include refid="updateRevise"/>
WHERE ACCOUNT_CODE = #accountCode#
</update>
<!-- 删除 -->
<update id="delete">
UPDATE ${metaSchema}.HGPZ009
SET
DELETE_FLAG = 1,
<include refid="updateRevise"/>
WHERE ACCOUNT_CODE = #accountCode#
</update>
</sqlMap>
......@@ -14,7 +14,7 @@ public class User implements Serializable {
public static final String FIELD_GENDER = "gender"; /* 性别*/
public static final String FIELD_MOBILE = "mobile"; /* 手机号*/
public static final String FIELD_EMAIL = "email"; /* 邮箱*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业代码*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 帐套代码*/
/**
* 用户ID
......@@ -49,7 +49,7 @@ public class User implements Serializable {
/**
* 企业代码
*/
private String companyCode;
private String accountCode;
public String getUserId() {
return userId;
......@@ -91,12 +91,12 @@ public class User implements Serializable {
this.email = email;
}
public String getCompanyCode() {
return companyCode;
public String getAccountCode() {
return accountCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
public String getGender() {
......
......@@ -67,7 +67,7 @@ public class ServiceHGXSUser extends ServiceBase {
public EiInfo queryComboBox(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
queryMap.put("companyCode", UserSessionUtils.getAccountCode());
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.USER_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, queryMap);
......@@ -91,7 +91,7 @@ public class ServiceHGXSUser extends ServiceBase {
}
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID);
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
queryMap.put("companyCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, list, queryMap, false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败");
......
......@@ -15,21 +15,21 @@
<isNotEmpty prepend=" AND " property="userIds">
USER_ID IN <iterate close=")" open="(" conjunction="," property="userIds">#userIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
COMPANY_CODE as "companyCode" <!-- 企业编码 -->
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="condition"/>
......@@ -47,13 +47,13 @@
</select>
<!-- 查询用户企业 -->
<select id="queryCompanyComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
<select id="queryAccountComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
B.COMPANY_NAME as "companyName" <!-- 企业名称 -->
FROM ${platSchema}.XS_USER A, ${metaSchema}.T_HPPZ009 B
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
B.ACCOUNT_NAME as "accountName" <!-- 企业名称 -->
FROM ${platSchema}.XS_USER A, ${metaSchema}.HGPZ009 B
WHERE 1=1
AND A.COMPANY_CODE = B.COMPANY_CODE
AND A.ACCOUNT_CODE = B.ACCOUNT_CODE
AND A.LOGIN_NAME = #loginName#
</select>
......@@ -68,8 +68,8 @@
<!-- id查询 -->
<select id="queryParentId" resultClass="java.util.LinkedHashMap">
SELECT
MEMBER_ID as "memberId", <!-- 成员id -->
PARENT_ID as "parentId" <!-- 父节点id -->
MEMBER_ID as "memberId", <!-- 成员id -->
PARENT_ID as "parentId" <!-- 父节点id -->
FROM ${platSchema}.XS_USER_GROUP_MEMBER
WHERE 1=1
AND MEMBER_ID = #memberId#
......
......@@ -234,12 +234,12 @@ public class HGXSTools {
* @return
*/
public static Map<String, List<Org>> queryAllFactoryMap() {
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
String accountCode = UserSessionUtils.getAccountCode();
if (StringUtils.isBlank(accountCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
queryMap.put("accountCode", accountCode);
List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.QUERY_ALL, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
......
......@@ -43,7 +43,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非管理员仅查询所属企业用户 added by songx at 2024-01-15
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
return outInfo;
......@@ -143,7 +143,7 @@ public class ServiceXS3001 extends ServiceEPBase {
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS3001.queryGroupOutOfUser", new XS02());
EiBlock eiBlock = new EiBlock("result3");
......@@ -172,7 +172,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.queryUserParentGroups", new XS02());
EiBlock eiBlock = new EiBlock("result1");
......@@ -201,7 +201,7 @@ public class ServiceXS3001 extends ServiceEPBase {
inInfo.set("inqu_status-0-userName", authCopyUserName);
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo resultInfo = super.query(inInfo, "XS03.queryForMemberUsers", new XS01());
EiBlock resultBBlock = new EiBlock("result4");
......@@ -293,7 +293,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
EiBlock eiBlock = new EiBlock("result8");
......@@ -360,7 +360,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
EiBlock eiBlock = new EiBlock("result9");
......
......@@ -199,7 +199,7 @@ public class ServiceXS3201 extends ServiceEPBase {
}
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS3002.queryUserOutOfUserGroup", new XS01());
EiBlock eiBlock = new EiBlock("result6");
......
......@@ -25,7 +25,7 @@
PWD_REVISOR,
ARCHIVE_FLAG,
USER_GROUP_ENAME,
COMPANY_CODE
ACCOUNT_CODE
) VALUES (
#userId#,
#loginName#,
......@@ -48,7 +48,7 @@
#pwdRevisor#,
#archiveFlag#,
#userGroupEname#,
#companyCode#
#accountCode#
)
</insert>
<select id="query" resultClass="java.util.HashMap">
......@@ -73,7 +73,7 @@
t1.pwd_revisor as "pwdRevisor",
t1.archive_flag as "archiveFlag",
t1.USER_GROUP_ENAME as "userGroupEname",
t1.COMPANY_CODE as "companyCode",
t1.ACCOUNT_CODE as "accountCode",
t2.group_cname as "userGroupCname"
FROM ${platSchema}.XS_USER t1
left join ${platSchema}.XS_USER_GROUP t2 on t2.group_ename=t1.USER_GROUP_ENAME
......@@ -99,8 +99,8 @@
<isNotEmpty prepend=" AND " property="isLocked">
t1.is_locked = #isLocked#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
t1.company_code = #companyCode#
<isNotEmpty prepend=" AND " property="accountCode">
t1.account_code = #accountCode#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -254,8 +254,8 @@
SELECT DISTINCT PARENT_ID from ${platSchema}.XS_USER_GROUP_MEMBER
where MEMBER_TYPE = 'USER' and MEMBER_ID = #userIdForParentGroups#
)
<isNotEmpty prepend="AND" property="companyCode">
COMPANY_CODE = #companyCode#
<isNotEmpty prepend="AND" property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</select>
......@@ -266,8 +266,8 @@
SELECT DISTINCT PARENT_ID from ${platSchema}.XS_USER_GROUP_MEMBER
where MEMBER_TYPE = 'USER' and MEMBER_ID = #userIdForParentGroups#
)
<isNotEmpty prepend="AND" property="companyCode">
COMPANY_CODE = #companyCode#
<isNotEmpty prepend="AND" property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</select>
......@@ -332,7 +332,7 @@
JOB_ID,
JOB_NAME,
EHR_ORG_ID,
COMPANY_CODE
ACCOUNT_CODE
) VALUES (
#userId#,
#loginName#,
......@@ -358,7 +358,7 @@
#jobId#,
#jobName#,
#ehrOrgId#,
#companyCode#
#accountCode#
)
</insert>
......
$(function () {
$.extend(true, IPLATUI.Config, {
// EFGrid: {
// height: $(document).height() - $("#inqu").height() - $("#ef_form_head").height() - 100,
// }
});
IPLATUI.EFGrid.result = {
copyToAdd: false,
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "docIdPc",
title: "PC端log",
template: function (item) {
let docId = item.docIdPc;
let template = '';
if (docId != null && docId.trim().length > 0) {
let src = downloadHref(docId);
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;background-color: #e7e7e7" '
+ 'href="' + src + '" target="_blank"><img src="' + src
+ '" style="width:200px;height:50px;background-image: none;" alt="PC端log"/></a>';
}
return template;
}
}, {
field: "docIdApp",
title: "APP端log",
template: function (item) {
let docId = item.docIdApp;
let template = '';
if (docId != null && docId.trim().length > 0) {
let src = downloadHref(docId);
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;background-color: #e7e7e7" '
+ 'href="' + src + '" target="_blank"><img src="' + src
+ '" style="width:200px;height:50px;background-image: none;" alt="APP端log"/></a>';
}
return template;
}
}],
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onAdd: function (e) {
e.preventDefault();
$("#type").val("insert")
$("#accountName").val("");
$("#loginPrefix").val("");
$("#loginPrefix").removeAttr("readonly");
$("#validFlag").val(1);
$("#PCfileDocId").val("");
$("#APPfileDocId").val("");
$("#remark").val("");
$("#id").val("");
$("#accountCode").val("");
$("#insertGroup_wnd_title").text("新增企业管理");
clealImgLabel($("#app-img"));
clealImgLabel($("#pc-img"));
addCompany($("#insertGroup"));
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
updateCompany();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
/**
*
* @param e
* e.sender kendoGridresultGrid
* e.model kendo.data.Model
* e.row
* e.tr tr, jquery
*/
onRowClick: function (e) {
/*WindowUtil({
"title": "",
"content": "<div class='kendo-del-message'>" + e.row + "</div>"
})*/
}
}
// 查询
$("#QUERY").on("click", query);
// 保存
//$("#BTN_SAVE").on("click", save);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
IPLATUI.EFUpload = {
docIdApp: {
showFileList:false,
validation: {
allowedExtensions: [".jpg",".png",".gif"], //
maxFileSize: 900000,
minFileSize: 300
},
// 不支持格式提示信息
localization: {
invalidFileExtension: "文件格式不支持, 上传失败"
},
loadComplete: function(e) {
var uploader = e.sender.uploader;
uploader.clearAllFiles();
// 清空所有历史上传文件
},
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#APPfileDocId").val(docId);
addImgLabel($("#app-img"),docId);
//$("#app-img").attr("src",downloadHref(docId));
NotificationUtil("附件上传成功");
},
},
docIdPc: {
showFileList:false,
validation: {
allowedExtensions: [".jpg",".png",".gif"], //
maxFileSize: 900000,
minFileSize: 300
},
// 不支持格式提示信息
localization: {
invalidFileExtension: "文件格式不支持, 上传失败"
},
loadComplete: function(e) {
var uploader = e.sender.uploader;
uploader.clearAllFiles();
// 清空所有历史上传文件
},
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#PCfileDocId").val(docId);
addImgLabel($("#pc-img"),docId);
/*$("#pc-img").attr("src",downloadHref(docId));*/
NotificationUtil("附件上传成功");
},
}
};
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
};
let save = function (){
var btnNode = $(this);
btnNode.attr("disabled", true);
var ei = new EiInfo();
let type = $("#type").val();
if (type === "update") {
ei.set("result-0-accountCode", $("#accountCode").val());
}
ei.set("result-0-accountName", $("#accountName").val());
ei.set("result-0-loginPrefix", $("#loginPrefix").val());
ei.set("result-0-validFlag", $("#validFlag").val());
ei.set("result-0-docIdPc", $("#PCfileDocId").val());
ei.set("result-0-docIdApp", $("#APPfileDocId").val());
ei.set("result-0-remark", $("#remark").val());
ei.set("result-0-id", $("#id").val());
// 调用请求 onSuccess 成功回掉函数
EiCommunicator.send("HGPZ009", "save", ei, {
onSuccess: function (ei) {
btnNode.attr("disabled", false);
$("#insertGroup").data("kendoWindow").close();
// 清除上传队列
resultGrid.dataSource.page(1);
// onFail 表示失败回掉函数
}, onFail: function (ei) {
// 发生异常
btnNode.attr("disabled", false);
NotificationUtil(ei);
}
});
};
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ009", "delete", true);
}
});
}
/**
* 点击添加
*
* @param id
*/
function addCompany(id) {
$(".k-upload-status-total").remove();
id.data("kendoWindow").open().center();
}
function updateCompany() {
//获取grid选中数据
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let app = $("#app-img"),
pc = $("#pc-img");
$("#type").val("update");
$("#accountCode").val(rows[0]["accountCode"]);
$("#accountName").val(rows[0]["accountName"]);
$("#loginPrefix").val(rows[0]["loginPrefix"]);
$("#loginPrefix").attr("readonly","true");
$("#validFlag").val(rows[0]["validFlag"]);
$("#PCfileDocId").val(rows[0]["docIdPc"]);
$("#APPfileDocId").val(rows[0]["docIdApp"]);
$("#remark").val(rows[0]["remark"]);
$("#id").val(rows[0]["id"]);
addImgLabel(app,rows[0]["docIdApp"]);
addImgLabel(pc,rows[0]["docIdPc"]);
$("#insertGroup_wnd_title").text("修改企业管理");
addCompany($("#insertGroup"));
}
$("#update").click(function () {
var btnNode = $(this);
btnNode.attr("disabled", true);
// 创建 EiInfo
var ei = new EiInfo();
ei.setByNodeObject(document.body);
// 获取 数据
// 调用请求 onSuccess 成功回掉函数
EiCommunicator.send("HGPZ009", "update", ei, {
onSuccess: function (ei) {
btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
// onFail 表示失败回掉函数
}, onFail: function (ei) {
// 发生异常
btnNode.attr("disabled", false);
NotificationUtil(ei);
}
});
});
/**
* 附件上传回调
*
* @param e
*/
function addCompanyCallback(e) {
resultGrid.dataSource.page(1);
}
function addImgLabel (id,docId) {
clealImgLabel(id);
if (isBlank(docId)){
return;
}
let src = downloadHref(docId)
let img=`<img src="${src}" style='width:200px;height:55px;background-image: none;'/>`;
id.html(img);
}
function clealImgLabel(id) {
id.html("");
}
<!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:EFInput cname="企业编码:" ename="accountCode" blockId="inqu_status" row="0"/>
<EF:EFInput cname="企业名称:" ename="accountName" blockId="inqu_status" row="0"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="single" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn cname="企业编码" ename="accountCode" enable="false" width="120" height="50" align="center"/>
<EF:EFColumn cname="企业名称" ename="accountName" width="140" align="center" required="true"/>
<EF:EFColumn cname="登录前缀" ename="loginPrefix" width="80" align="center" readonly="true"/>
<EF:EFColumn cname="PC端log" ename="docIdPc" align="center" width="200" readonly="true" enable="false"/>
<EF:EFColumn cname="APP端log" ename="docIdApp" align="center" width="200" readonly="true"
enable="false"/>
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="90" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn>
<EF:EFColumn cname="备注" ename="remark" width="150" editType="textarea"/>
<EF:EFColumn cname="创建人" ename="createdName" enable="false" align="center"/>
<EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
<EF:EFColumn cname="修改人" ename="updatedName" enable="false" align="center"/>
<EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
<br/>
<span style='color: red;font-size: 13px;'>说明:新增企业时会同步新增企业管理员账户,账号和密码与企业编码相同</span>
</EF:EFRegion>
</EF:EFPage>
<EF:EFWindow id="insertGroup" title="企业管理" top="100px" left="280px" width="40%" height="70%">
<form>
<div class="row">
<label for="accountName" class="col-sm-2 col-form-label col-form-label-sm">企业名称</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="accountName" placeholder="企业名称" aria-label="企业名称"
required="required">
</div>
</div>
<div class="form-group row">
<label for="loginPrefix" class="col-sm-2 col-form-label col-form-label-sm">登录前缀</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="loginPrefix" placeholder="登录前缀" aria-label="登录前缀">
</div>
</div>
<div class="form-group row">
<label for="validFlag" class="col-sm-2 col-form-label col-form-label-sm">是否启用</label>
<div class="col-sm-6">
<select class="form-control" id="validFlag">
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="form-group row">
<label for="docIdPc" class="col-sm-2 col-form-label">PC端log</label>
<div class="col-sm-6">
<EF:EFUpload ename="docIdPc" cname="PC上传" docTag="hk_filePc" path="A"/>
<div class="side-header" id="pc-img" style="background-color: whitesmoke">
<img src="${ctx}/hpjx-logo.png" style="width:200px;height:55px;background-image: none;" alt="pc端log"/>
</div>
</div>
<input type="hidden" id="PCfileDocId" value="">
</div>
<div class="form-group row">
<label for="docIdApp" class="col-sm-2 col-form-label">APP端log</label>
<div class="col-sm-6">
<EF:EFUpload ename="docIdApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<div class="side-header" id="app-img" style="background-color: whitesmoke">
<img src="${ctx}/hpjx-logo.png" style="width:200px;height:55px;background-image: none;" alt="app端log"/>
</div>
</div>
<input type="hidden" id="APPfileDocId" value="">
</div>
<div class="form-group row">
<label for="remark" class="col-sm-2 col-form-label col-form-label-sm">备注</label>
<div class="col-sm-6">
<textarea id="remark" class="form-control" placeholder="备注" aria-label="备注"></textarea>
</div>
</div>
<input type="hidden" id="type" value="insert">
<input type="hidden" id="id" value="">
<input type="hidden" id="accountCode" value="">
<div class="form-group col-md-6 col-sm-6 col-sm-offset-9">
<button type="button" onclick="save()" class="btn btn-primary">确认</button>
</div>
</form>
</EF:EFWindow>
<EF:EFWindow id="updateGroup" top="100px" left="280px" width="58%" height="80%">
<EF:EFRegion id="updateResult">
<EF:EFInput ename="accountName" colWidth="6" cname="企业名称"/>
<EF:EFInput ename="loginPrefix" colWidth="6" cname="登录前缀"/>
<EF:EFSelect ename="validFlag" cname="是否启动"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#"
required="true" defaultValue="China"> <%--enable="false":不可下拉--%>
<EF:EFOptions blockId="made_country_block_id" textField="country_ch_name" valueField="country"/>
</EF:EFSelect>
<EF:EFUpload ename="uploadFilePc" cname="PC上传" docTag="hk_filePc" path="A"/>
<EF:EFUpload ename="uploadFileApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<EF:EFInput ename="remark" colWidth="6" cname="备注"/>
<EF:EFInput ename="PCfileDocId" cname="" hidden="true"/>
<EF:EFInput ename="APPfileDocId" cname="" hidden="true"/>
<EF:EFButton ename="update" cname="确认" layout="1" class="k-button"/>
</EF:EFRegion>
</EF:EFWindow>
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