Commit 3ab3d937 by 宋祥

1.去除查询时的企业编码设置,

parent a6a95e25
...@@ -38,6 +38,44 @@ public class DaoUtils { ...@@ -38,6 +38,44 @@ public class DaoUtils {
} }
/** /**
* 查询
*
* @param sql
* @param obj
* @return
*/
public static List query(String sql, Object obj){
if (obj instanceof DaoEPBase) {
// 企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(obj, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入企业编码失败", e);
}
} else if (obj instanceof Map) {
// 创建人企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
((Map) obj).put("companyCode", companyCode);
} catch (Exception e) {
log.warn("写入企业编码失败", e);
}
}
return DaoBase.getInstance().query(sql, obj);
}
/**
* insert method. * insert method.
* *
* @param sql * @param sql
......
...@@ -14,6 +14,8 @@ public class HPConstant { ...@@ -14,6 +14,8 @@ public class HPConstant {
*/ */
public class SequenceId { public class SequenceId {
// 企业编码
public static final String COMPANY_CODE = "COMPANY_CODE";
//项目档案编号 //项目档案编号
public static final String PROJ_NUMBER = "PROJ_NUMBER"; public static final String PROJ_NUMBER = "PROJ_NUMBER";
// 盘点单号 // 盘点单号
......
...@@ -42,6 +42,12 @@ public class HPPZ009 extends DaoEPBase { ...@@ -42,6 +42,12 @@ public class HPPZ009 extends DaoEPBase {
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/ public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除:1.是,0.否*/ public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除:1.是,0.否*/
public static final String QUERY = "HPPZ009.query";
public static final String COUNT = "HPPZ009.count";
public static final String INSERT = "HPPZ009.insert";
public static final String UPDATE = "HPPZ009.update";
public static final String DELETE = "HPPZ009.delete";
private Long id = null; private Long id = null;
private String companyCode = " "; /* 企业编码*/ private String companyCode = " "; /* 企业编码*/
private String companyName = " "; /* 企业名称*/ private String companyName = " "; /* 企业名称*/
......
...@@ -2,9 +2,11 @@ package com.baosight.hpjx.hp.pz.service; ...@@ -2,9 +2,11 @@ package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.xs.tools.HPXSUserTools; import com.baosight.hpjx.hp.xs.tools.HPXSUserTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.RsaUtils; import com.baosight.hpjx.util.RsaUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -12,6 +14,7 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -12,6 +14,7 @@ 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 com.baosight.iplat4j.core.service.soa.XLocalManager; import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants; import com.baosight.xservices.xs.constants.LoginConstants;
...@@ -111,9 +114,12 @@ public class ServiceHPPZ009 extends ServiceBase { ...@@ -111,9 +114,12 @@ public class ServiceHPPZ009 extends ServiceBase {
*/ */
private void add(HPPZ009 fPz009) throws Exception { private void add(HPPZ009 fPz009) throws Exception {
// 生成企业编码 // 生成企业编码
fPz009.setCompanyCode(SequenceGenerator.getNextSequence("COMPANY_CODE")); fPz009.setCompanyCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.COMPANY_CODE));
fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0); fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert("HPPZ009.insert", fPz009); fPz009.setCreatedBy(UserSession.getLoginName());
fPz009.setCreatedName(UserSession.getLoginCName());
fPz009.setCreatedTime(DateUtils.shortDateTime());
dao.insert(HPPZ009.INSERT, fPz009);
// 默认新增企业管理员账号 // 默认新增企业管理员账号
this.initUser(fPz009); this.initUser(fPz009);
// 关联企业管理员角色 // 关联企业管理员角色
......
package com.baosight.iplat4j.core.data.ibatis.dao;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus;
import com.baosight.iplat4j.core.util.ExceptionUtil;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/24,9:00
*/
public class SqlMapDaoLogProxy extends SqlMapDao {
public static final String QUERY = "query";
public SqlMapDaoLogProxy() {
}
public List query(String name, Object parameters) {
try {
// 初始化参数
this.initParam(name, parameters);
List ret = super.query(name, parameters);
return ret;
} catch (RuntimeException var4) {
throw var4;
}
}
public List queryAll(String name, Object parameters) {
try {
// 初始化参数
this.initParam(name, parameters);
List ret = super.queryAll(name, parameters);
return ret;
} catch (RuntimeException var4) {
throw var4;
}
}
public List query(String name, Object parameters, int offset, int limit) {
try {
// 初始化参数
this.initParam(name, parameters);
List ret = super.query(name, parameters, offset, limit);
return ret;
} catch (RuntimeException var6) {
throw var6;
}
}
public List query(String name, Object parameters, PageStatus pageStatus) {
int limit = pageStatus.getPageSize();
int offset = pageStatus.getPageNumber() * pageStatus.getPageSize();
try {
List ret = super.query(name, parameters, offset, limit);
return ret;
} catch (RuntimeException var7) {
ExceptionUtil.getRootCauseMessage(var7);
throw var7;
}
}
public int count(String name, Object parameters) {
String var3 = this.autoCount ? "query" : "count";
try {
// 初始化参数
this.initParam(name, parameters);
int ret = super.count(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public void insert(String name, Object object) {
String var3 = "insert";
try {
super.insert(name, object);
} catch (RuntimeException var5) {
throw var5;
}
}
public int update(String name, Object object) {
String var3 = "update";
try {
int ret = super.update(name, object);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int delete(String name, Object parameters) {
String var3 = "delete";
try {
int ret = super.delete(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int insertBatch(String name, Collection parameters) {
String operation = "insert";
try {
this.getStatementName(operation, name);
int ret = super.insertBatch(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int updateBatch(String name, Collection parameters) {
String operation = "update";
try {
this.getStatementName(operation, name);
int ret = super.updateBatch(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int deleteBatch(String name, Collection parameters) {
String operation = "delete";
try {
this.getStatementName(operation, name);
int ret = super.deleteBatch(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
/**
* 初始化参数
*
* @param name
* @param parameters
*/
private void initParam(String name, Object parameters) {
// 查询登录用户信息时不设置企业编码,否则会形成死循环
if ("HPXSUser.query".equals(name)) {
return;
}
if(!(parameters instanceof Map)){
return;
}
if (parameters == null) {
parameters = new HashMap();
}
// 企业编码
((Map) parameters).put("companyCode", UserSessionUtils.getCompanyCode());
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
}
}
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="140" align="center" <EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid> </EF:EFGrid>
<p class="text-info"><span style='color: red;'>注:新增企业时会新增企业管理员账户,账号和密码与企业编码相同</span></p>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
<%--<script src="${iPlatStaticURL}/common/js/common.js"></script>--%>
<%--<script src="${iPlatStaticURL}/common/js/jsUtils.js"></script>--%>
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