Commit bb091811 by liuyang

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

 Conflicts:
	src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
parents 169509b2 2a40d612
package com.baosight.hggp.hg.cg.domain;
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.math.BigDecimal;
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>
......@@ -17,7 +16,7 @@ import java.util.Map;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-09 15:41:54 create
* @history 2024-05-10 15:20:01 create
*/
public class HGCG002 extends DaoEPBase {
......@@ -49,6 +48,7 @@ public class HGCG002 extends DaoEPBase {
public static final String FIELD_LENGTH = "length"; /* 长度*/
public static final String FIELD_PUR_QTY = "purQty"; /* 采购数量*/
public static final String FIELD_PUR_WEIGHT = "purWeight"; /* 采购重量*/
public static final String FIELD_RECEIVE_QTY = "receiveQty"; /* 收货数量*/
public static final String FIELD_STATUS = "status"; /* 状态:0-未审批,1-审核通过,2-审核未通过*/
public static final String FIELD_AUDIT_TIME = "auditTime"; /* 审核时间*/
public static final String FIELD_AUDIT_USER_ID = "auditUserId"; /* 审核人ID*/
......@@ -81,6 +81,7 @@ public class HGCG002 extends DaoEPBase {
public static final String COL_LENGTH = "LENGTH"; /* 长度*/
public static final String COL_PUR_QTY = "PUR_QTY"; /* 采购数量*/
public static final String COL_PUR_WEIGHT = "PUR_WEIGHT"; /* 采购重量*/
public static final String COL_RECEIVE_QTY = "RECEIVE_QTY"; /* 收货数量*/
public static final String COL_STATUS = "STATUS"; /* 状态:0-未审批,1-审核通过,2-审核未通过*/
public static final String COL_AUDIT_TIME = "AUDIT_TIME"; /* 审核时间*/
public static final String COL_AUDIT_USER_ID = "AUDIT_USER_ID"; /* 审核人ID*/
......@@ -102,7 +103,7 @@ public class HGCG002 extends DaoEPBase {
private String updatedBy = " "; /* 记录修改者*/
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private Integer deleteFlag = 0; /* 0-未删除,1-已删除*/
private Integer deleteFlag; /* 0-未删除,1-已删除*/
private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/
private String contractDate = " "; /* 合同日期*/
......@@ -119,7 +120,8 @@ public class HGCG002 extends DaoEPBase {
private BigDecimal length = new BigDecimal(0.000); /* 长度*/
private BigDecimal purQty = new BigDecimal(0.000); /* 采购数量*/
private BigDecimal purWeight = new BigDecimal(0.000); /* 采购重量*/
private Integer status = 0; /* 状态:0-未审批,1-审核通过,2-审核未通过*/
private BigDecimal receiveQty = new BigDecimal(0.000); /* 收货数量*/
private Integer status; /* 状态:0-未审批,1-审核通过,2-审核未通过*/
private String auditTime = " "; /* 审核时间*/
private String auditUserId = " "; /* 审核人ID*/
private String auditUserName = " "; /* 审核人名称*/
......@@ -245,6 +247,13 @@ public class HGCG002 extends DaoEPBase {
eiColumn.setDescName("采购重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("收货数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STATUS);
eiColumn.setDescName("状态:0-未审批,1-审核通过,2-审核未通过");
eiMetadata.addMeta(eiColumn);
......@@ -692,6 +701,22 @@ public class HGCG002 extends DaoEPBase {
this.purWeight = purWeight;
}
/**
* get the receiveQty - 收货数量.
* @return the receiveQty
*/
public BigDecimal getReceiveQty() {
return this.receiveQty;
}
/**
* set the receiveQty - 收货数量.
*
* @param receiveQty - 收货数量
*/
public void setReceiveQty(BigDecimal receiveQty) {
this.receiveQty = receiveQty;
}
/**
* get the status - 状态:0-未审批,1-审核通过,2-审核未通过.
* @return the status
*/
......@@ -805,6 +830,7 @@ public class HGCG002 extends DaoEPBase {
setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_LENGTH)), length));
setPurQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PUR_QTY)), purQty));
setPurWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PUR_WEIGHT)), purWeight));
setReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_RECEIVE_QTY)), receiveQty));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setAuditTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_TIME)), auditTime));
setAuditUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_USER_ID)), auditUserId));
......@@ -845,6 +871,7 @@ public class HGCG002 extends DaoEPBase {
map.put(FIELD_LENGTH, StringUtils.toString(length, eiMetadata.getMeta(FIELD_LENGTH)));
map.put(FIELD_PUR_QTY, StringUtils.toString(purQty, eiMetadata.getMeta(FIELD_PUR_QTY)));
map.put(FIELD_PUR_WEIGHT, StringUtils.toString(purWeight, eiMetadata.getMeta(FIELD_PUR_WEIGHT)));
map.put(FIELD_RECEIVE_QTY, StringUtils.toString(receiveQty, eiMetadata.getMeta(FIELD_RECEIVE_QTY)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_AUDIT_TIME, StringUtils.toString(auditTime, eiMetadata.getMeta(FIELD_AUDIT_TIME)));
map.put(FIELD_AUDIT_USER_ID, StringUtils.toString(auditUserId, eiMetadata.getMeta(FIELD_AUDIT_USER_ID)));
......
package com.baosight.hggp.hg.cg.domain;
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.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:Hgcg002.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-09 15:41:54 create
*/
public class HGCG002A extends HGCG002 {
public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/
public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/
private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/
private BigDecimal bcMaxReceiveQty = new BigDecimal(0.000); /* 本次最大收货数量*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_BC_RECEIVE_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("本次收货数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BC_MAX_RECEIVE_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("本次最大收货数量");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGCG002A() {
super.initMetaData();
initMetaData();
}
public BigDecimal getBcReceiveQty() {
return bcReceiveQty;
}
public void setBcReceiveQty(BigDecimal bcReceiveQty) {
this.bcReceiveQty = bcReceiveQty;
}
public BigDecimal getBcMaxReceiveQty() {
return bcMaxReceiveQty;
}
public void setBcMaxReceiveQty(BigDecimal bcMaxReceiveQty) {
this.bcMaxReceiveQty = bcMaxReceiveQty;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty));
setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_BC_RECEIVE_QTY, StringUtils.toString(bcReceiveQty, eiMetadata.getMeta(FIELD_BC_RECEIVE_QTY)));
map.put(FIELD_BC_MAX_RECEIVE_QTY, StringUtils.toString(bcMaxReceiveQty, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_QTY)));
return map;
}
}
......@@ -106,7 +106,7 @@ public class ServiceHGCG001 extends ServiceBase {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, dbCg001.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
AssertUtils.isGe(BigDecimal.ZERO, fCg001.getPurQty(), String.format("计划[%s]采购数量必须大于0", planNo));
AssertUtils.isGe(BigDecimal.ZERO, fCg001.getPurWeight(), String.format("计划[%s]采购重量必须大于0", planNo));
......@@ -142,9 +142,9 @@ public class ServiceHGCG001 extends ServiceBase {
this.removeData(fCg001s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!");
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -160,7 +160,7 @@ public class ServiceHGCG001 extends ServiceBase {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, dbCg001.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
}
}
......@@ -195,9 +195,9 @@ public class ServiceHGCG001 extends ServiceBase {
this.submitData(fCg001s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据提交成功!");
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据审核成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
LogUtils.setDetailMsg(inInfo, e, "审核失败");
}
return inInfo;
}
......@@ -213,7 +213,7 @@ public class ServiceHGCG001 extends ServiceBase {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, dbCg001.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
AssertUtils.isGe(BigDecimal.ZERO, dbCg001.getPurQty(), String.format("计划[%s]采购数量必须大于0", planNo));
AssertUtils.isGe(BigDecimal.ZERO, dbCg001.getPurWeight(), String.format("计划[%s]采购重量必须大于0", planNo));
......@@ -228,7 +228,7 @@ public class ServiceHGCG001 extends ServiceBase {
*/
private void submitData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) {
fCg001.setStatus(HGConstant.planStatus.S_1);
fCg001.setStatus(HGConstant.CgPlanStatus.S_1);
fCg001.setAuditTime(DateUtils.shortDateTime());
fCg001.setAuditUserId(UserSessionUtils.getLoginName());
fCg001.setAuditUserName(UserSessionUtils.getLoginCName());
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -43,6 +44,7 @@ public class ServiceHGCG002 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -80,9 +82,9 @@ public class ServiceHGCG002 extends ServiceBase {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002> dbCg002Map = this.lockGetData(fCg002s);
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetDataEp(fCg002s);
// 数据校验
this.checkSaveData(fCg002s, dbCg002Map);
this.checkSaveData(fCg002s, dbCg002AMap);
// 保存数据
this.saveData(fCg002s);
inInfo = this.query(inInfo);
......@@ -98,14 +100,14 @@ public class ServiceHGCG002 extends ServiceBase {
* 数据校验
*
* @param fCg002s
* @param dbCg002Map
* @param dbCg002AMap
*/
private void checkSaveData(List<HGCG002> fCg002s, Map<String, HGCG002> dbCg002Map) {
private void checkSaveData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002Map.get(contractNo);
HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, fCg002.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
}
}
......@@ -132,16 +134,16 @@ public class ServiceHGCG002 extends ServiceBase {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002> dbCg002Map = this.lockGetData(fCg002s);
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetDataEp(fCg002s);
// 数据校验
this.checkRemoveData(fCg002s, dbCg002Map);
this.checkRemoveData(fCg002s, dbCg002AMap);
// 保存数据
this.removeData(fCg002s);
this.removeData(fCg002s, dbCg002AMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据保存成功!");
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -150,14 +152,14 @@ public class ServiceHGCG002 extends ServiceBase {
* 数据校验
*
* @param fCg002s
* @param dbCg002Map
* @param dbCg002AMap
*/
private void checkRemoveData(List<HGCG002> fCg002s, Map<String, HGCG002> dbCg002Map) {
private void checkRemoveData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002Map.get(contractNo);
HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.contractStatus.S_0, fCg002.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgContractStatus.S_0, dbCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
}
}
......@@ -166,11 +168,16 @@ public class ServiceHGCG002 extends ServiceBase {
* 数据保存
*
* @param fCg002s
* @param dbCg002AMap
*/
private void removeData(List<HGCG002> fCg002s) {
private void removeData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG002 fCg002 : fCg002s) {
fCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002.DELETE, fCg002);
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
dbCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002.DELETE, dbCg002);
// 更新计划状态
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgPlanStatus.S_1);
}
}
......@@ -185,16 +192,16 @@ public class ServiceHGCG002 extends ServiceBase {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002> dbCg002Map = this.lockGetData(fCg002s);
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetDataEp(fCg002s);
// 数据校验
this.checkSubmitData(fCg002s, dbCg002Map);
this.checkSubmitData(fCg002s, dbCg002AMap);
// 提交数据
this.submitData(fCg002s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据提交成功!");
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据审核成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
LogUtils.setDetailMsg(inInfo, e, "审核失败");
}
return inInfo;
}
......@@ -203,14 +210,14 @@ public class ServiceHGCG002 extends ServiceBase {
* 数据校验
*
* @param fCg002s
* @param dbCg002Map
* @param dbCg002AMap
*/
private void checkSubmitData(List<HGCG002> fCg002s, Map<String, HGCG002> dbCg002Map) {
private void checkSubmitData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002Map.get(contractNo);
HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.contractStatus.S_0, dbCg002.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgContractStatus.S_0, dbCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
}
}
......@@ -223,7 +230,7 @@ public class ServiceHGCG002 extends ServiceBase {
*/
private void submitData(List<HGCG002> fCg002s) {
for (HGCG002 fCg002 : fCg002s) {
fCg002.setStatus(HGConstant.contractStatus.S_1);
fCg002.setStatus(HGConstant.CgContractStatus.S_1);
fCg002.setAuditTime(DateUtils.shortDateTime());
fCg002.setAuditUserId(UserSessionUtils.getLoginName());
fCg002.setAuditUserName(UserSessionUtils.getLoginCName());
......@@ -232,18 +239,4 @@ public class ServiceHGCG002 extends ServiceBase {
}
}
/**
* 锁并且获取数据
*
* @param fCg002s
* @return
*/
private Map<String, HGCG002> lockGetData(List<HGCG002> fCg002s) {
// 合同号
List<String> contractNos = ObjectUtils.listEpKey(fCg002s, HGCG002.FIELD_CONTRACT_NO);
// 锁
HGCGTools.HgCg002.lock(contractNos);
// db数据
return HGCGTools.HgCg002.map(contractNos);
}
}
......@@ -12,6 +12,7 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
......@@ -20,6 +21,7 @@ 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.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.List;
......@@ -42,6 +44,7 @@ public class ServiceHGCG002A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -62,7 +65,7 @@ public class ServiceHGCG002A extends ServiceBase {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
// 仅审核通过
queryRow.put(HGCG001.FIELD_STATUS, HGConstant.planStatus.S_1);
queryRow.put(HGCG001.FIELD_STATUS, HGConstant.CgPlanStatus.S_1);
inInfo = super.query(inInfo, HGCG001.QUERY, new HGCG001());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -84,7 +87,7 @@ public class ServiceHGCG002A extends ServiceBase {
// db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s);
// 数据校验
this.checkSaveData(fCg001s, dbCg001Map);
this.checkConfirmData(fCg001s, dbCg001Map);
// 保存数据
this.confirmData(resultRows, dbCg001Map);
inInfo = this.query(inInfo);
......@@ -102,12 +105,12 @@ public class ServiceHGCG002A extends ServiceBase {
* @param fCg001s
* @param dbCg001Map
*/
private void checkSaveData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) {
private void checkConfirmData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) {
for (HGCG001 fCg001 : fCg001s) {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_1, dbCg001.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_1, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"审核通过\",不允许操作", planNo));
}
}
......@@ -121,16 +124,17 @@ public class ServiceHGCG002A extends ServiceBase {
private void confirmData(List<Map> resultRows, Map<String, HGCG001> dbCg001Map) {
for (Map resultRow : resultRows) {
String planNo = MapUtils.getString(resultRow, HGCG001.FIELD_PLAN_NO);
String supCode = MapUtils.getString(resultRow, HGCG002.FIELD_SUP_CODE);
String supName = MapUtils.getString(resultRow, HGCG002.FIELD_SUP_NAME);
String purUserName = MapUtils.getString(resultRow, HGCG002.FIELD_PUR_USER_NAME);
HGCG002 newCg002 = BeanUtils.copy(dbCg001Map.get(planNo), HGCG002.class);
newCg002.setSupCode(supCode);
newCg002.setSupName(supName);
newCg002.setPurUserName(purUserName);
newCg002.setStatus(HGConstant.contractStatus.S_0);
newCg002.setContractDate(DateUtils.shortDate());
newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO));
newCg002.setSupCode(MapUtils.getString(resultRow, HGCG002.FIELD_SUP_CODE));
newCg002.setSupName(MapUtils.getString(resultRow, HGCG002.FIELD_SUP_NAME));
newCg002.setPurUserName(MapUtils.getString(resultRow, HGCG002.FIELD_PUR_USER_NAME));
newCg002.setStatus(HGConstant.CgContractStatus.S_0);
newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG002.INSERT, newCg002);
// 更新计划状态
HGCGTools.HgCg001.updateStatus(planNo, HGConstant.CgPlanStatus.S_3);
}
}
......
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
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.hggp.util.ObjectUtils;
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.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG003 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购收货", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg003.setCondition(queryRow);
inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// 采购收货DB数据
Map<String, HGCG003> dbCg003Map = HgCgUtils.HgCg003.lockGetDataEp(fCg003s);
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// 数据校验
this.checkSaveData(fCg003s, dbCg003Map);
// 保存数据
this.saveData(fCg003s, dbCg003Map, dbCg002AMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg003s
* @param dbCg003Map
*/
private void checkSaveData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) {
// 查询合同信息
List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO);
Map<String, HGCG002A> dbCg002AMap = HGCGTools.HgCg002.map(contractNos);
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
AssertUtils.isGt(BigDecimal.ZERO, fCg003.getReceiveQty(),
String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003.getReceiveQty()));
// 校验合同数量
BigDecimal diffQty = fCg003.getReceiveQty().subtract(dbCg003.getReceiveQty());
if (diffQty.compareTo(BigDecimal.ZERO) == 1) {
HGCG002A dbCg002A = dbCg002AMap.get(dbCg003.getContractNo());
AssertUtils.isGt(diffQty, dbCg002A.getBcMaxReceiveQty(),
String.format("收货单【%s】的累计\"收货数量(%s)\"不能大于合同的\"采购数量(%s)\"", receiveNo,
fCg003.getReceiveQty(), dbCg002A.getPurQty()));
}
}
}
/**
* 数据保存
*
* @param fCg003s
* @param dbCg003Map
* @param dbCg002AMap
*/
private void saveData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
String contractNo = fCg003.getContractNo();
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, fCg003);
// 计算差异数量,更新合同状态
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
BigDecimal diffQty = fCg003.getReceiveQty().subtract(dbCg003.getReceiveQty());
HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), diffQty);
}
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// 采购收货DB数据
Map<String, HGCG003> dbCg003Map = HgCgUtils.HgCg003.lockGetDataEp(fCg003s);
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// 数据校验
this.checkRemoveData(fCg003s, dbCg003Map);
// 保存数据
this.removeData(fCg003s, dbCg003Map, dbCg002AMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg003s
* @param dbCg003Map
*/
private void checkRemoveData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) {
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
}
}
/**
* 数据保存
*
* @param fCg003s
* @param dbCg003Map
* @param dbCg002AMap
*/
private void removeData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
String contractNo = fCg003.getContractNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
dbCg003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003.DELETE, dbCg003);
// 更新合同状态
HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), dbCg003.getReceiveQty().negate());
}
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// db数据
Map<String, HGCG003> dbCg003Map = HgCgUtils.HgCg003.lockGetDataEp(fCg003s);
// 数据校验
this.checkConfirmData(fCg003s, dbCg003Map);
// 提交数据
this.confirmData(fCg003s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据审核成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "审核失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg003s
* @param dbCg003Map
*/
private void checkConfirmData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) {
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
}
}
/**
* 确认数据
*
* @param fCg003s
*/
private void confirmData(List<HGCG003> fCg003s) {
for (HGCG003 fCg003 : fCg003s) {
fCg003.setStatus(HGConstant.CgReceiveStatus.S_1);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_STATUS, fCg003);
}
}
}
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG003A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
// 仅审核通过和收货中
queryRow.put("statuses", new Integer[]{HGConstant.CgContractStatus.S_1, HGConstant.CgContractStatus.S_3});
inInfo = super.query(inInfo, HGCG002.QUERY, new HGCG002A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGCG002A> fCg002As = MapUtils.toDaoEPBase(inInfo, HGCG002A.class);
// db数据
Map<String, HGCG002A> dbCg002AMap = this.lockGetData(fCg002As);
// 数据校验
this.checkConfirmData(fCg002As, dbCg002AMap);
// 保存数据
this.confirmData(fCg002As, dbCg002AMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002As.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg002As
* @param dbCg002AMap
*/
private void checkConfirmData(List<HGCG002A> fCg002As, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG002A fCg002A : fCg002As) {
String contractNo = fCg002A.getContractNo();
HGCG002A dbCg002A = dbCg002AMap.get(contractNo);
AssertUtils.isNull(dbCg002A, String.format("合同[%s]不存在", contractNo));
AssertUtils.isTrue(!(HGConstant.CgContractStatus.S_1.equals(dbCg002A.getStatus())
|| HGConstant.CgContractStatus.S_3.equals(dbCg002A.getStatus())),
String.format("合同[%s]状态不是\"审核通过\"或\"收货中\",不允许操作", contractNo));
AssertUtils.isGt(fCg002A.getBcReceiveQty(), dbCg002A.getBcMaxReceiveQty(),
String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", contractNo,
fCg002A.getBcReceiveQty(), dbCg002A.getBcMaxReceiveQty()));
}
}
/**
* 数据保存
*
* @param fCg002As
* @param dbCg002AMap
*/
private void confirmData(List<HGCG002A> fCg002As, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG002A fCg002A : fCg002As) {
String contractNo = fCg002A.getContractNo();
HGCG002A dbCg002A = dbCg002AMap.get(contractNo);
HGCG003 newCg003 = BeanUtils.copy(dbCg002AMap.get(contractNo), HGCG003.class);
newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
newCg003.setReceiveQty(fCg002A.getBcReceiveQty());
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG003.INSERT, newCg003);
// 更新合同状态
HGCGTools.HgCg002.updateReceive(dbCg002A, fCg002A.getBcReceiveQty());
}
}
/**
* 锁并且获取数据
*
* @param fCg002As
* @return
*/
private Map<String, HGCG002A> lockGetData(List<HGCG002A> fCg002As) {
// 合同号
List<String> contractNos = ObjectUtils.listEpKey(fCg002As, HGCG002.FIELD_CONTRACT_NO);
// 锁
HGCGTools.HgCg002.lock(contractNos);
// db数据
return HGCGTools.HgCg002.map(contractNos);
}
}
......@@ -223,4 +223,13 @@
WHERE PLAN_NO = #planNo#
</update>
<!-- 修改状态 -->
<update id="updateStatus">
UPDATE ${hggpSchema}.HGCG001
SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
<include refid="updateRevise"/>
WHERE PLAN_NO = #planNo#
</update>
</sqlMap>
......@@ -29,6 +29,7 @@
LENGTH as "length", <!-- 长度 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME as "auditTime", <!-- 审核时间 -->
AUDIT_USER_ID as "auditUserId", <!-- 审核人ID -->
......@@ -36,6 +37,10 @@
AUDIT_REASON as "auditReason" <!-- 审核原因 -->
</sql>
<sql id="qtyColumn">
(PUR_QTY - RECEIVE_QTY) as "bcMaxReceiveQty"
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="idCondition"/>
......@@ -165,9 +170,10 @@
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002">
<select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002A">
SELECT
<include refid="column"/>
<include refid="column"/>,
<include refid="qtyColumn"/>
FROM ${hggpSchema}.HGCG002 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
......@@ -223,6 +229,18 @@
<include refid="idCondition"/>
</update>
<!-- 修改采购信息 -->
<update id="updatePur">
UPDATE ${hggpSchema}.HGCG002
SET
SUP_CODE = #supCode#, <!-- 供应商编码 -->
SUP_NAME = #supName#, <!-- 供应商名称 -->
PUR_USER_ID = #purUserId#, <!-- 采购员 -->
PUR_USER_NAME = #purUserName#, <!-- 采购员名称 -->
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
<!-- 修改审核信息 -->
<update id="updateAudit">
UPDATE ${hggpSchema}.HGCG002
......@@ -236,4 +254,23 @@
WHERE CONTRACT_NO = #contractNo#
</update>
<!-- 修改状态 -->
<update id="updateStatus">
UPDATE ${hggpSchema}.HGCG002
SET
STATUS = #status#,
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
<!-- 修改收货 -->
<update id="updateReceive">
UPDATE ${hggpSchema}.HGCG002
SET
STATUS = #status#,
RECEIVE_QTY = #receiveQty#,
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
</sqlMap>
<?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="HGCG003">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
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-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
RECEIVE_DATE as "receiveDate", <!-- 收货日期 -->
RECEIVE_NO as "receiveNo", <!-- 收货单号 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
CONTRACT_NO as "contractNo", <!-- 合同号 -->
SUP_CODE as "supCode", <!-- 供应商编码 -->
SUP_NAME as "supName", <!-- 供应商名称 -->
PUR_USER_ID as "purUserId", <!-- 采购员 -->
PUR_USER_NAME as "purUserName", <!-- 采购员名称 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
LENGTH as "length", <!-- 长度 -->
RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
DELIVER_QTY as "deliverQty", <!-- 退货数量 -->
DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
STATUS as "status" <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDate">
RECEIVE_DATE = #receiveDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
PLAN_NO = #planNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNo">
CONTRACT_NO = #contractNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
SUP_CODE = #supCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
SUP_NAME = #supName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserId">
PUR_USER_ID = #purUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserName">
PUR_USER_NAME = #purUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveQty">
RECEIVE_QTY = #receiveQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deliverQty">
DELIVER_QTY = #deliverQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositQty">
DEPOSIT_QTY = #depositQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveWeight">
RECEIVE_WEIGHT = #receiveWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="receiveNo">
RECEIVE_NO = #receiveNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNos">
RECEIVE_NO IN <iterate open="(" close=")" conjunction="," property="receiveNos">#receiveNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
</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">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG003">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGCG003 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGCG003 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGCG003 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
RECEIVE_DATE, <!-- 收货日期 -->
RECEIVE_NO, <!-- 收货单号 -->
PLAN_NO, <!-- 计划单号 -->
CONTRACT_NO, <!-- 合同号 -->
SUP_CODE, <!-- 供应商编码 -->
SUP_NAME, <!-- 供应商名称 -->
PUR_USER_ID, <!-- 采购员 -->
PUR_USER_NAME, <!-- 采购员名称 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
LENGTH, <!-- 长度 -->
RECEIVE_QTY, <!-- 收货数量 -->
RECEIVE_WEIGHT, <!-- 收货重量 -->
STATUS <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#,
#planNo#, #contractNo#, #supCode#, #supName#, #purUserId#, #purUserName#,
#inventCode#, #inventName#, #spec#, #material#, #length#,
#receiveQty#, #receiveWeight#, #status#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGCG003
SET
DELETE_FLAG = #deleteFlag#,
<include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo#
</delete>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGCG003
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改状态 -->
<update id="updateStatus">
UPDATE ${hggpSchema}.HGCG003
SET
STATUS = #status#,
<include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo#
</update>
<!-- 修改数量 -->
<update id="updateQty">
UPDATE ${hggpSchema}.HGCG003
SET
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
<include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo#
</update>
</sqlMap>
package com.baosight.hggp.hg.cg.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -65,6 +70,21 @@ public class HGCGTools {
return results.stream().collect(Collectors.toMap(HGCG001::getPlanNo, item -> item));
}
/**
* 修改状态
*
* @param planNo
* @param status
*/
public static void updateStatus(String planNo, Integer status) {
AssertUtils.isEmpty(planNo, "计划号不能为空!");
AssertUtils.isNull(status, "状态不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("planNo", planNo);
paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_STATUS, paramMap);
}
}
/**
......@@ -91,13 +111,47 @@ public class HGCGTools {
}
/**
* 修改状态
*
* @param contractNo
* @param status
*/
public static void updateStatus(String contractNo, Integer status) {
AssertUtils.isEmpty(contractNo, "合同号不能为空!");
AssertUtils.isNull(status, "状态不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("contractNo", contractNo);
paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_STATUS, paramMap);
}
/**
* 修改状态
*
* @param dbCg002
* @param receiveQty
*/
public static void updateReceive(HGCG002 dbCg002, BigDecimal receiveQty) {
AssertUtils.isNull(dbCg002, "合同号不能为空!");
AssertUtils.isNull(receiveQty, "收货数量不能为空!");
BigDecimal diffQty = dbCg002.getPurQty().subtract(receiveQty.add(dbCg002.getReceiveQty()));
Integer status = diffQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_4
: HGConstant.CgContractStatus.S_3;
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_CONTRACT_NO, dbCg002.getContractNo());
paramMap.put(HGCG002.FIELD_STATUS, status);
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, receiveQty.add(dbCg002.getReceiveQty()));
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap);
}
/**
* 查询
*
* @param contractNos
* @return
*/
public static List<HGCG002> list(List<String> contractNos) {
AssertUtils.isEmpty(contractNos, "计划号不能为空");
public static List<HGCG002A> list(List<String> contractNos) {
AssertUtils.isEmpty(contractNos, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("contractNos", contractNos);
return DaoBase.getInstance().query(HGCG002.QUERY, paramMap);
......@@ -109,9 +163,58 @@ public class HGCGTools {
* @param contractNos
* @return
*/
public static Map<String, HGCG002> map(List<String> contractNos) {
List<HGCG002> results = list(contractNos);
return results.stream().collect(Collectors.toMap(HGCG002::getContractNo, item -> item));
public static Map<String, HGCG002A> map(List<String> contractNos) {
List<HGCG002A> results = list(contractNos);
return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item));
}
}
/**
* HGCG003 工具类
*
* @author:songx
* @date:2024/5/9,14:33
*/
public static class HgCg003 {
/**
* 锁
*
* @param receiveNos
* @return
*/
public static void lock(List<String> receiveNos) {
if (CollectionUtils.isEmpty(receiveNos)) {
return;
}
Map paramMap = new HashMap();
paramMap.put("receiveNos", receiveNos);
DaoBase.getInstance().update(HGSqlConstant.HgCg003.LOCK, paramMap);
}
/**
* 查询
*
* @param receiveNos
* @return
*/
public static List<HGCG003> list(List<String> receiveNos) {
AssertUtils.isEmpty(receiveNos, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("receiveNos", receiveNos);
return DaoBase.getInstance().query(HGCG003.QUERY, paramMap);
}
/**
* 查询
*
* @param receiveNos
* @return
*/
public static Map<String, HGCG003> map(List<String> receiveNos) {
List<HGCG003> results = list(receiveNos);
return results.stream().collect(Collectors.toMap(HGCG003::getReceiveNo, item -> item));
}
}
......
......@@ -2,10 +2,15 @@ package com.baosight.hggp.hg.cg.utils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import java.util.List;
import java.util.Map;
/**
......@@ -79,6 +84,77 @@ public class HgCgUtils {
}
}
/**
* 锁并且获取数据
*
* @param fCg002s
* @return
*/
public static Map<String, HGCG002A> lockGetDataEp(List<HGCG002> fCg002s) {
return lockGetData(ObjectUtils.listEpKey(fCg002s, HGCG002.FIELD_CONTRACT_NO));
}
/**
* 锁并且获取数据
*
* @param contractNos
* @return
*/
public static Map<String, HGCG002A> lockGetData(List<String> contractNos) {
// 锁
HGCGTools.HgCg002.lock(contractNos);
// db数据
return HGCGTools.HgCg002.map(contractNos);
}
}
/**
* HGCG003 工具类
*
* @author:songx
* @date:2024/5/9,16:58
*/
public static class HgCg003 {
/**
* 设置查询条件
*
* @param queryRow 集合
* @return
*/
public static void setCondition(Map queryRow) {
HgCgUtils.setCondition(queryRow);
// 收货日期
String receiveDate = MapUtils.getString(queryRow, HGCG003.FIELD_RECEIVE_DATE);
if (StringUtils.isNotBlank(receiveDate)) {
queryRow.put(HGCG003.FIELD_RECEIVE_DATE, DateUtils.formatShort(receiveDate));
}
}
/**
* 锁并且获取数据
*
* @param fCg003s
* @return
*/
public static Map<String, HGCG003> lockGetDataEp(List<HGCG003> fCg003s) {
return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO));
}
/**
* 锁并且获取数据
*
* @param receiveNos
* @return
*/
public static Map<String, HGCG003> lockGetData(List<String> receiveNos) {
// 锁
HGCGTools.HgCg003.lock(receiveNos);
// db数据
return HGCGTools.HgCg003.map(receiveNos);
}
}
}
......@@ -89,15 +89,21 @@ public class HGConstant {
public static final String PLAN_NO = "PLAN_NO";
//申请单号
public static final String APPLY_CODE = "APPLY_CODE";
// 采购计划号
public static final String CG_PLAN_NO = "CG_PLAN_NO";
// 采购合同号
public static final String CG_CONTRACT_NO = "CG_CONTRACT_NO";
// 采购收货号
public static final String CG_RECEIVE_NO = "CG_RECEIVE_NO";
}
/**
* 计划状态
* 采购计划状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class planStatus {
public static class CgPlanStatus {
// 待审核
public static final Integer S_0 = 0;
......@@ -105,15 +111,17 @@ public class HGConstant {
public static final Integer S_1 = 1;
// 审核拒绝
public static final Integer S_2 = 2;
// 生成合同
public static final Integer S_3 = 3;
}
/**
* 合同状态
* 采购合同状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class contractStatus {
public static class CgContractStatus {
// 待审核
public static final Integer S_0 = 0;
......@@ -121,6 +129,30 @@ public class HGConstant {
public static final Integer S_1 = 1;
// 审核拒绝
public static final Integer S_2 = 2;
// 收货中
public static final Integer S_3 = 3;
// 收货完成
public static final Integer S_4 = 4;
}
/**
* 收货状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class CgReceiveStatus {
// 待确认
public static final Integer S_0 = 0;
// 已收货
public static final Integer S_1 = 1;
// 质检中
public static final Integer S_2 = 2;
// 质检完成
public static final Integer S_3 = 3;
// 已入库
public static final Integer S_4 = 4;
}
/**
......
......@@ -22,6 +22,8 @@ public class HGSqlConstant {
public static final String UPDATE_PUR = MODULE_NAME + "updatePur";
// 修改审核信息
public static final String UPDATE_AUDIT = MODULE_NAME + "updateAudit";
// 修改状态
public static final String UPDATE_STATUS = MODULE_NAME + "updateStatus";
}
/**
......@@ -40,6 +42,28 @@ public class HGSqlConstant {
public static final String UPDATE_PUR = MODULE_NAME + "updatePur";
// 修改审核信息
public static final String UPDATE_AUDIT = MODULE_NAME + "updateAudit";
// 修改状态
public static final String UPDATE_STATUS = MODULE_NAME + "updateStatus";
// 修改收货数量
public static final String UPDATE_RECEIVE = MODULE_NAME + "updateReceive";
}
/**
* HGCG003 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgCg003 {
// 模块名称
private static final String MODULE_NAME = "HGCG003.";
// 锁
public static final String LOCK = MODULE_NAME + "lock";
// 修改状态
public static final String UPDATE_STATUS = MODULE_NAME + "updateStatus";
// 修改数量
public static final String UPDATE_QTY = MODULE_NAME + "updateQty";
}
/**
......
package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.domain.HGCW001;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils;
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 yukang
* @date 2024年05月06日 18:22
*/
public class ServiceHGCW001 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCW001.QUERY, new HGCW001());
} 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();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(i));
HGCW001.setAccountPeriod(DateUtils.formatShort(HGCW001.getAccountPeriod()));
if (HGCW001.getId() == null || HGCW001.getId() == 0) {
this.add(HGCW001);
} else {
this.modify(HGCW001);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param HGCW001
* @return
*/
public void add(HGCW001 HGCW001) {
DaoUtils.insert("HGCW001.insert", HGCW001);
}
/**
* 修改操作
*
* @param HGCW001
* @return
*/
public void modify(HGCW001 HGCW001) {
DaoUtils.update("HGCW001.update", HGCW001);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(i));
DaoUtils.insert("HGCW001.insert", HGCW001);
}
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 update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(i));
HGCW001.setAccountPeriod(DateUtils.formatShort(HGCW001.getAccountPeriod()));
DaoUtils.update("HGCW001.update", HGCW001);
}
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++) {
DaoUtils.update("HGCW001.delete", resultRows.get(i));
}
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 switchRow(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(0));
Integer accountPeriodStatus = HGCW001.getAccountPeriodStatus();
if (accountPeriodStatus == 1) {
//开账 - 做关账
HGCW001.setAccountPeriodStatus(0);
DaoUtils.update("HGCW001.updateSwitchRow", HGCW001);
} else if (accountPeriodStatus == 0) {
//先找是否已经有开账的记录
int switchRowNum = dao.count("HGCW001.getSwitchRowNum", HGCW001);
if (switchRowNum > 0) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!已经有一个会计期为开账状态!");
return inInfo;
}
HGCW001.setAccountPeriodStatus(1);
DaoUtils.update("HGCW001.updateSwitchRow", HGCW001);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据操作成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils;
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 yukang
* @date 2024年05月06日 18:22
*/
public class ServiceHGCW002 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW002().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCW002.QUERY, new HGCW002());
} 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();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(i));
if (HGCW002.getId() == null || HGCW002.getId() == 0) {
this.add(HGCW002);
} else {
this.modify(HGCW002);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param HGCW002
* @return
*/
public void add(HGCW002 HGCW002) {
DaoUtils.insert("HGCW002.insert", HGCW002);
}
/**
* 修改操作
*
* @param HGCW002
* @return
*/
public void modify(HGCW002 HGCW002) {
DaoUtils.update("HGCW002.update", HGCW002);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(i));
DaoUtils.insert("HGCW002.insert", HGCW002);
}
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 update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(i));
DaoUtils.update("HGCW002.update", HGCW002);
}
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++) {
DaoUtils.update("HGCW002.delete", resultRows.get(i));
}
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.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-06 18:13:44
Version : 1.0
schema : hggp
tableName : HGCW001
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
ACCOUNT_YEAR VARCHAR,
ACCOUNT_PERIOD VARCHAR,
ACCOUNT_PERIOD_STATUS TINYINT,
ACCOUNT_PERIOD_DATE_START VARCHAR,
ACCOUNT_PERIOD_DATE_END VARCHAR,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
DEP_CODE VARCHAR
-->
<sqlMap namespace="HGCW001">
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</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="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountYear">
ACCOUNT_YEAR = #accountYear#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriod">
ACCOUNT_PERIOD = #accountPeriod#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodStatus">
ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
ACCOUNT_PERIOD_DATE_START = #accountPeriodDateStart#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
ACCOUNT_PERIOD_DATE_END = #accountPeriodDateEnd#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cw.domain.HGCW001">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
ACCOUNT_YEAR as "accountYear", <!-- 会计年度 -->
ACCOUNT_PERIOD as "accountPeriod", <!-- 会计期 -->
ACCOUNT_PERIOD_STATUS as "accountPeriodStatus", <!-- 会计期状态0:关账1:开账 -->
ACCOUNT_PERIOD_DATE_START as "accountPeriodDateStart", <!-- 账期开始日期 -->
ACCOUNT_PERIOD_DATE_END as "accountPeriodDateEnd", <!-- 账期结束日期 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DEP_CODE as "depCode" <!-- 部门编码 -->
FROM ${hggpSchema}.HGCW001 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGCW001 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountYear">
ACCOUNT_YEAR = #accountYear#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriod">
ACCOUNT_PERIOD = #accountPeriod#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodStatus">
ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
ACCOUNT_PERIOD_DATE_START = #accountPeriodDateStart#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
ACCOUNT_PERIOD_DATE_END = #accountPeriodDateEnd#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGCW001 (ID,
ACCOUNT_CODE, <!-- 企业编码 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
ACCOUNT_YEAR, <!-- 会计年度 -->
ACCOUNT_PERIOD, <!-- 会计期 -->
ACCOUNT_PERIOD_STATUS, <!-- 会计期状态0:关账1:开账 -->
ACCOUNT_PERIOD_DATE_START, <!-- 账期开始日期 -->
ACCOUNT_PERIOD_DATE_END, <!-- 账期结束日期 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DEP_CODE <!-- 部门编码 -->
)
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #accountYear#, #accountPeriod#, #accountPeriodStatus#, #accountPeriodDateStart#, #accountPeriodDateEnd#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGCW001 WHERE
ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGCW001
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
ACCOUNT_YEAR = #accountYear#, <!-- 会计年度 -->
ACCOUNT_PERIOD = #accountPeriod#, <!-- 会计期 -->
ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#, <!-- 会计期状态0:关账1:开账 -->
ACCOUNT_PERIOD_DATE_START = #accountPeriodDateStart#, <!-- 账期开始日期 -->
ACCOUNT_PERIOD_DATE_END = #accountPeriodDateEnd#, <!-- 账期结束日期 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
WHERE
ID = #id#
</update>
<select id="getSwitchRowNum" resultClass="com.baosight.hggp.hg.cw.domain.HGCW001">
SELECT * FROM ${hggpSchema}.HGCW001 WHERE ACCOUNT_PERIOD_STATUS = 1
</select>
<update id="updateSwitchRow">
UPDATE ${hggpSchema}.HGCW001
SET
ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#, <!-- 会计期状态0:关账1:开账 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
package com.baosight.hggp.hg.ds.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:SysOperationLog.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-04 15:58:48 create
*/
public class HGDS001 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* 主键id*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
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_OPER_MODUL = "operModul"; /* 操作模块*/
public static final String FIELD_OPER_TYPE = "operType"; /* 操作类型*/
public static final String FIELD_OPER_DESC = "operDesc"; /* 操作说明*/
public static final String FIELD_OPER_CONTENT = "operContent"; /* 操作内容*/
public static final String COL_ID = "ID"; /* 主键id*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码*/
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_OPER_MODUL = "OPER_MODUL"; /* 操作模块*/
public static final String COL_OPER_TYPE = "OPER_TYPE"; /* 操作类型*/
public static final String COL_OPER_DESC = "OPER_DESC"; /* 操作说明*/
public static final String COL_OPER_CONTENT = "OPER_CONTENT"; /* 操作内容*/
public static final String QUERY = "sys_operation_log.query";
public static final String COUNT = "sys_operation_log.count";
public static final String INSERT = "sys_operation_log.insert";
public static final String UPDATE = "sys_operation_log.update";
public static final String DELETE = "sys_operation_log.delete";
private Long id = new Long(0); /* 主键id*/
private String accountCode = " "; /* 企业编码*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String operModul = " "; /* 操作模块*/
private String operType = " "; /* 操作类型*/
private String operDesc = " "; /* 操作说明*/
private String operContent = " "; /* 操作内容*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("主键id");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
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_OPER_MODUL);
eiColumn.setDescName("操作模块");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OPER_TYPE);
eiColumn.setDescName("操作类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OPER_DESC);
eiColumn.setDescName("操作说明");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OPER_CONTENT);
eiColumn.setDescName("操作内容");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGDS001() {
initMetaData();
}
/**
* get the id - 主键id.
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id - 主键id.
*
* @param id - 主键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 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 operModul - 操作模块.
* @return the operModul
*/
public String getOperModul() {
return this.operModul;
}
/**
* set the operModul - 操作模块.
*
* @param operModul - 操作模块
*/
public void setOperModul(String operModul) {
this.operModul = operModul;
}
/**
* get the operType - 操作类型.
* @return the operType
*/
public String getOperType() {
return this.operType;
}
/**
* set the operType - 操作类型.
*
* @param operType - 操作类型
*/
public void setOperType(String operType) {
this.operType = operType;
}
/**
* get the operDesc - 操作说明.
* @return the operDesc
*/
public String getOperDesc() {
return this.operDesc;
}
/**
* set the operDesc - 操作说明.
*
* @param operDesc - 操作说明
*/
public void setOperDesc(String operDesc) {
this.operDesc = operDesc;
}
/**
* get the operContent - 操作内容.
* @return the operContent
*/
public String getOperContent() {
return this.operContent;
}
/**
* set the operContent - 操作内容.
*
* @param operContent - 操作内容
*/
public void setOperContent(String operContent) {
this.operContent = operContent;
}
/**
* 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));
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));
setOperModul(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OPER_MODUL)), operModul));
setOperType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OPER_TYPE)), operType));
setOperDesc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OPER_DESC)), operDesc));
setOperContent(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OPER_CONTENT)), operContent));
}
/**
* 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_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_OPER_MODUL, StringUtils.toString(operModul, eiMetadata.getMeta(FIELD_OPER_MODUL)));
map.put(FIELD_OPER_TYPE, StringUtils.toString(operType, eiMetadata.getMeta(FIELD_OPER_TYPE)));
map.put(FIELD_OPER_DESC, StringUtils.toString(operDesc, eiMetadata.getMeta(FIELD_OPER_DESC)));
map.put(FIELD_OPER_CONTENT, StringUtils.toString(operContent, eiMetadata.getMeta(FIELD_OPER_CONTENT)));
return map;
}
}
package com.baosight.hggp.hg.ds.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.util.ErrorCodeUtils;
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.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap;
/**
* Title: 历史数据清理 <br>
* @author LiuYang
* @version 1.0 2024/3/4
*/
public class ServiceHGDS001 extends ServiceEPBase {
@Override
@OperationLogAnnotation(operModul = "系统操作日志", operType = "页面初始化", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
return super.initLoad(inInfo);
}
@OperationLogAnnotation(operModul = "系统操作日志", operType = "删除", operDesc = "删除6个月之前的历史数据")
public EiInfo deleteHistory(EiInfo inInfo) {
try {
this.dao.delete("HGDS001.deleteHistory",new HashMap<>());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(0), I18nMessages.getText("label.delete", "删除")});
}catch (PlatException e){
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,0,e);
logError("删除失败", e.getMessage());
}
return inInfo;
}
}
package com.baosight.hggp.hg.ds.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.ds.domain.HGDS002;
import com.baosight.hggp.hg.pz.domain.HGPZ002A;
import com.baosight.hggp.util.LogUtils;
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.HashMap;
import java.util.Map;
/**
* Title:文件备份 <br>
* @author LiuYang
* @version 1.0 2024/3/5
*/
public class ServiceHGDS002 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
return super.initLoad(inInfo);
}
@Override
public EiInfo query(EiInfo inInfo) {
return super.query(inInfo);
}
@Override
@OperationLogAnnotation(operModul = "文件备份", operType = "删除", operDesc = "删除文件备份数据")
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo);
}
@Override
@OperationLogAnnotation(operModul = "文件备份", operType = "修改", operDesc = "修改文件备份数据")
public EiInfo update(EiInfo inInfo) {
return super.update(inInfo);
}
@Override
@OperationLogAnnotation(operModul = "文件备份", operType = "新增", operDesc = "新增文件备份数据")
public EiInfo insert(EiInfo inInfo) {
try {
EiBlock block = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < block.getRowCount(); i++) {
Map<String, Object> map = new HashMap<String, Object>(1);
map.put(HGPZ002A.FIELD_DOC_ID, block.getCellStr(i, HGDS002.FIELD_DOC_ID));
//List<Map<String, Object>> list = this.dao.query("EUDM02.query", map);
HGDS002 hpds002 = new HGDS002();
hpds002.fromMap(block.getRow(i));
/*if (list.size() > 0) {
hpds002.setChgName(list.get(0).get("chgName").toString());
hpds002.setDirId(list.get(0).get("dirId").toString());
}*/
DaoUtils.insert(HGDS002.INSERT, hpds002);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + block.getRowCount() + "]条数据新增成功!");
}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="HGDS001">
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operModul">
OPER_MODUL = #operModul#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operType">
OPER_TYPE = #operType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operDesc">
OPER_DESC = #operDesc#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operContent">
OPER_CONTENT = #operContent#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.ds.domain.HGDS001">
SELECT
ID as "id", <!-- 主键id -->
ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
OPER_MODUL as "operModul", <!-- 操作模块 -->
OPER_TYPE as "operType", <!-- 操作类型 -->
OPER_DESC as "operDesc", <!-- 操作说明 -->
OPER_CONTENT as "operContent" <!-- 操作内容 -->
FROM ${hggpSchema}.SYS_OPERATION_LOG WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.SYS_OPERATION_LOG WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operModul">
OPER_MODUL = #operModul#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operType">
OPER_TYPE = #operType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operDesc">
OPER_DESC = #operDesc#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operContent">
OPER_CONTENT = #operContent#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.SYS_OPERATION_LOG (ID, <!-- 主键id -->
ACCOUNT_CODE, <!-- 帐套编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
OPER_MODUL, <!-- 操作模块 -->
OPER_TYPE, <!-- 操作类型 -->
OPER_DESC, <!-- 操作说明 -->
OPER_CONTENT <!-- 操作内容 -->
)
VALUES (#id#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #operModul#, #operType#, #operDesc#, #operContent#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.SYS_OPERATION_LOG WHERE
ID = #id#
</delete>
<!--删除6个月以前的历史数据-->
<delete id="deleteHistory">
delete from ${hggpSchema}.SYS_OPERATION_LOG where left(CREATED_TIME,8) &lt;= DATE_FORMAT(DATE_SUB(CURDATE(), interval 6 month), '%Y%m%d')
</delete>
<update id="update">
UPDATE ${hggpSchema}.SYS_OPERATION_LOG
SET
ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
OPER_MODUL = #operModul#, <!-- 操作模块 -->
OPER_TYPE = #operType#, <!-- 操作类型 -->
OPER_DESC = #operDesc#, <!-- 操作说明 -->
OPER_CONTENT = #operContent# <!-- 操作内容 -->
WHERE
ID = #id#
</update>
</sqlMap>
<?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"> <!-- table information
Generate time : 2024-03-06 16:14:16
Version : 1.0
schema : hpjx
tableName : TEUDM_TEMP
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
REAL_PATH VARCHAR
-->
<sqlMap namespace="HGDS002">
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docIds">
DOC_ID in $docIds$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="chgName">
CHG_NAME = #chgName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docSize">
DOC_SIZE = #docSize#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docTag">
DOC_TAG = #docTag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="archiveFlag">
ARCHIVE_FLAG = #archiveFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="realPath">
REAL_PATH = #realPath#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.ds.domain.HGDS002">
SELECT
ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
DOC_ID as "docId", <!-- 文件标识 -->
DIR_ID as "dirId", <!-- 目录标识 -->
DOC_NAME as "docName", <!-- 文件名 -->
CHG_NAME as "chgName", <!-- 物理文件名 -->
DOC_SIZE as "docSize", <!-- 文件大小 -->
DOC_TAG as "docTag", <!-- 文件标签 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
ARCHIVE_FLAG as "archiveFlag", <!-- 同步标记 -->
REAL_PATH as "realPath", <!-- 物理路径 -->
BIZ_TYPE as "bizType",
MAT_ID as "matId"
FROM ${hggpSchema}.TEUDM_TEMP WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ACCOUNT_CODE asc,
DOC_ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.TEUDM_TEMP WHERE 1=1
<include refid="authCondition"/>
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="chgName">
CHG_NAME = #chgName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docSize">
DOC_SIZE = #docSize#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docTag">
DOC_TAG = #docTag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="archiveFlag">
ARCHIVE_FLAG = #archiveFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="realPath">
REAL_PATH = #realPath#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.TEUDM_TEMP (
ACCOUNT_CODE, <!-- 企业编码 -->
DOC_ID, <!-- 文件标识 -->
DIR_ID, <!-- 目录标识 -->
DOC_NAME, <!-- 文件名 -->
CHG_NAME, <!-- 物理文件名 -->
DOC_SIZE, <!-- 文件大小 -->
DOC_TAG, <!-- 文件标签 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
ARCHIVE_FLAG, <!-- 同步标记 -->
REAL_PATH, <!-- 物理路径 -->
BIZ_TYPE,
MAT_ID,
DEP_CODE
)
VALUES (#accountCode#, #docId#, #dirId#, #docName#, #chgName#, #docSize#, #docTag#, #createdBy#, #createdName#,
#createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #archiveFlag#, #realPath#, #bizType#, #matId#, #depCode#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.TEUDM_TEMP WHERE
ACCOUNT_CODE = #accountCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docIds">
DOC_ID in $docIds$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</delete>
<update id="update">
UPDATE ${hggpSchema}.TEUDM_TEMP
SET
DIR_ID = #dirId#, <!-- 目录标识 -->
DOC_NAME = #docName#, <!-- 文件名 -->
CHG_NAME = #chgName#, <!-- 物理文件名 -->
DOC_SIZE = #docSize#, <!-- 文件大小 -->
DOC_TAG = #docTag#, <!-- 文件标签 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
ARCHIVE_FLAG = #archiveFlag#, <!-- 同步标记 -->
REAL_PATH = #realPath#, <!-- 物理路径 -->
BIZ_TYPE = #bizType#,
MAT_ID = #matId#,
DEP_CODE = #depCode#
WHERE
ACCOUNT_CODE = #accountCode# AND
DOC_ID = #docId#
<include refid="condition" />
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</update>
</sqlMap>
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.ds.domain.HGDS002;
import com.baosight.hggp.hg.pz.domain.HGPZ002A;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.LogUtils;
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.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/25,15:25
*/
public class ServiceHGPZ002A extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "物料清单-附件清单A-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// 查询物料ID所对应的项目名称和部件名称
/* Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String bizType = inInfo.getString("inqu_status-0-bizType");
List<HPSC002> dbSc002s = new ArrayList<HPSC002>();
List<HPSC006> HPSC006 = new ArrayList<HPSC006>();
if (bizType.equals("WL")) {
dbSc002s = dao.query("HPSC002.query", queryMap);
} else if (bizType.equals("XL")) {
HPSC006 = dao.query("HPSC006.query", queryMap);
}
if (CollectionUtils.isNotEmpty(dbSc002s) || CollectionUtils.isNotEmpty(HPSC006)) {
inInfo.set("inqu_status-0-bizType", queryMap.get("bizType"));
inInfo.set("inqu_status-0-matId", queryMap.get("matId"));
}*/
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ002A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "物料清单-附件清单A-查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (CommonConstant.projectEnv.RUN.equalsIgnoreCase(projectEnv)) {
inInfo = super.query(inInfo, "HGPZ002A.queryRun", new HGPZ002A());
} else {
inInfo = super.query(inInfo, "HGPZ002A.queryDev", new HGPZ002A());
}
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "新增",operDesc = "物料清单-附件清单A-新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGPZ002A fSc002A = new HGPZ002A();
fSc002A.fromMap(resultRows.get(i));
DaoUtils.insert(HGPZ002A.INSERT, fSc002A);
}
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 = "物料清单-附件清单A-删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGPZ002A fSc002A = new HGPZ002A();
fSc002A.fromMap(resultRows.get(i));
DaoUtils.update(HGPZ002A.DELETE, fSc002A);
if (!fSc002A.getDocId().isEmpty()) {
this.delectDoc(fSc002A.getDocId());
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 删除文件
* @param docId 文件ID
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "删除",operDesc = "删除附件文件")
public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HGDS002> list = this.dao.query(HGDS002.QUERY,map);
if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HGPZ002A.FIELD_DOC_ID,list.get(0).getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
this.dao.delete(HGDS002.DELETE,map);
}
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
*
*/
public class ServiceHGPZ099 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "上传",operDesc = "附件上传")
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
......@@ -48,7 +48,7 @@
CUST_CODE = #custCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custName">
CUST_NAME = #custName#
CUST_NAME LIKE CONCAT('%', #custName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custClass">
CUST_CLASS = #custClass#
......@@ -72,7 +72,7 @@
HEAD_NAME = #headName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="phoneName">
PHONE_NAME = #phoneName#
PHONE_NAME LIKE CONCAT('%', #phoneName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="address">
ADDRESS = #address#
......
<?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="HGPZ002A">
<sql id="column">
A.ID as "id",
A.ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.BIZ_TYPE as "bizType", <!-- 物料ID -->
A.MAT_ID as "matId", <!-- 物料ID -->
A.DOC_ID as "docId", <!-- 文件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" <!-- 修改时间 -->
</sql>
<sql id="columnDev">
<include refid="column"/>,
B.DOC_NAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="columnRun">
<include refid="column"/>,
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
A.BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
A.MAT_ID = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
A.DOC_ID = #docId#
</isNotEmpty>
</sql>
<!-- 开发环境 -->
<sql id="conditionDev">
AND A.DOC_ID = B.DOC_ID
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="docName">
B.DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
</sql>
<!-- 正式环境 -->
<sql id="conditionRun">
AND A.DOC_ID = B.RES_ID
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="docName">
B.RES_CNAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
A.CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
A.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="queryDev" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ002A">
SELECT
<include refid="columnDev"/>
FROM ${hggpSchema}.HGPZ002A A, ${platSchema}.TEUDM02 B
WHERE 1=1
<include refid="conditionDev"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="countDev" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ002A A, ${platSchema}.TEUDM02 B
WHERE 1=1
<include refid="conditionDev"/>
<include refid="customCondition"/>
</select>
<select id="queryRun" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ002A">
SELECT
<include refid="columnRun"/>
FROM ${hggpSchema}.HGPZ002A A, ${platSchema}.TEUDM05 B
WHERE 1=1
<include refid="conditionRun"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="countRun" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ002A A, ${platSchema}.TEUDM05 B
WHERE 1=1
<include refid="conditionRun"/>
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ002A (
ACCOUNT_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
BIZ_TYPE,
MAT_ID, <!-- 物料ID -->
DOC_ID, <!-- 文件ID -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#accountCode#, #depCode#, #bizType#, #matId#, #docId#, #createdBy#,
#createdName#, #createdTime#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGPZ002A WHERE ID = #id#
</delete>
</sqlMap>
......@@ -51,7 +51,7 @@
SUP_CODE = #supCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
SUP_NAME = #supName#
SUP_NAME LIKE CONCAT('%', #supName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="headName">
HEAD_NAME = #headName#
......@@ -284,8 +284,6 @@
<update id="update">
UPDATE ${hggpSchema}.HGPZ003
SET
ACCOUNT_CODE = #accountCode#, <!-- 帐套编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
SUP_TYPE = #supType#, <!-- 供应商类型 1 材料供应商 ,2 劳务供应商,3加工供应商 -->
SUP_CLASS = #supClass#, <!-- 供应商分类 1 钢材 ,2 网架及配件,3油漆 -->
SUP_CODE = #supCode#, <!-- 供应商编码 -->
......@@ -298,15 +296,7 @@
ACCOUNT_NUM = #accountNum#, <!-- 银行账号 -->
ASS_LEVEL = #assLevel#, <!-- 评定等级 -->
SCORE = #score#, <!-- 综合得分 -->
FILE_PATH = #filePath#, <!-- 资质详情 -->
STATUS = #status#, <!-- 状态 0禁用 1启用 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
STATUS = #status# <!-- 状态 0禁用 1启用 -->
WHERE
ID = #id#
</update>
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.*;
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.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
DaoUtils.update(HGSC001.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
HGSCTools.THGSC001A.deleteByProIds(ids);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
public EiInfo save(EiInfo inInfo){
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
HGSC001 hgsc001 = new HGSC001();
hgsc001.fromMap(resultMap);
this.checkSaveData(hgsc001);
if(Objects.nonNull(hgsc001.getId())&&hgsc001.getId()!=0){
DaoUtils.update(HGSC001.UPDATE, hgsc001);
}else {
DaoUtils.insert(HGSC001.INSERT, hgsc001);
}
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 处理项目负责人
List<HGSC001A> hgsc001AList = HGSCTools.THGSC001A.convertToObj(detailRows);
HGSCTools.THGSC001A.checkProjMgData(hgsc001AList);
HGSCTools.THGSC001A.save(hgsc001AList,hgsc001.getId());
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param hgsc001
*/
private void checkSaveData(HGSC001 hgsc001) {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgsc001.getCompanyCode(), "请选择公司!");
AssertUtils.isEmpty(hgsc001.getDepCode(), "请选择部门!");
AssertUtils.isEmpty(hgsc001.getSubcontractCode(), "请选择分包方!");
AssertUtils.isEmpty(hgsc001.getGenralContractCode(), "请选择总包方!");
AssertUtils.isEmpty(hgsc001.getProjCode(), "请填写项目编号!");
AssertUtils.isEmpty(hgsc001.getProjName(), "请填写项目名称!");
AssertUtils.isEmpty(hgsc001.getContractName(), "请填写合同名称!");
AssertUtils.isEmpty(hgsc001.getProjType(), "请选择项目性质!");
AssertUtils.isEmpty(hgsc001.getPermissStartDate(), "请选择准许开工日期!");
AssertUtils.isEmpty(hgsc001.getStartDate(), "请选择开工日期!");
AssertUtils.isEmpty(hgsc001.getEndDate(), "请选择完工日期!");
AssertUtils.isNull(hgsc001.getProjStatus(), "请选择项目状态!");
AssertUtils.isEmpty(hgsc001.getContractWorkTxt(), "请填写合同工作量!");
}
/**
* 部门下拉框
* @param inInfo
* @return
*/
public EiInfo depByCompanyComboBox(EiInfo inInfo){
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC001.FIELD_company_code);
EiInfoUtils.addBlock(inInfo,"depByCompany", UserSessionUtils.getDepByCompany(companyCode), Dept.class);
CommonMethod.comboBoxDefaultValue(inInfo,"depByCompany","depCode","depName");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
/**
* 客户档案下拉框
* @param inInfo
* @return
*/
public EiInfo genralContractComboBox(EiInfo inInfo){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC001.FIELD_subcontract_code);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
// map.put("companyCode", companyCode);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
CommonMethod.comboBoxDefaultValue(inInfo,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID.getBlockId());
return inInfo;
}
/**
* 用户下拉框
* @param inInfo
* @return
*/
public EiInfo userByCompanyComboBox(EiInfo inInfo) throws InstantiationException, IllegalAccessException {
String companyCode = inInfo.getCellStr(EiConstant.queryBlock,EiConstant.STATUS_DEFAULT,HGSC001.FIELD_company_code);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(companyCode), User.class);
CommonMethod.comboBoxDefaultValue(inInfo,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID.getBlockId(),"loginName","userName");
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001A.QUERY, new HGSC001A());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001C extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
HGSC001 hgsc001 = new HGSC001();
hgsc001.setProjCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROJ_NUMBER));
EiInfoUtils.addBlock(inInfo,EiConstant.resultBlock,new ArrayList(){{add(hgsc001);}},HGSC001.class);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HGSC001A().eiMetadata);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
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.ed.util.SequenceGenerator;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001D extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo,HGSC001.QUERY,new HGSC001());
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
List<HGSC001A> hgsc001AList = HGSCTools.THGSC001A.getByProjId(
Long.valueOf(String.valueOf(resultMap.get(HGSC001.FIELD_id))));
EiInfoUtils.addBlock(inInfo,CommonConstant.Field.DETAIL, hgsc001AList, HGSC001A.class);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"depByCompany", UserSessionUtils.getDepByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), Dept.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), User.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC001U extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo,HGSC001.QUERY,new HGSC001());
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
List<HGSC001A> hgsc001AList = HGSCTools.THGSC001A.getByProjId(
Long.valueOf(String.valueOf(resultMap.get(HGSC001.FIELD_id))));
EiInfoUtils.addBlock(inInfo,CommonConstant.Field.DETAIL, hgsc001AList, HGSC001A.class);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"depByCompany", UserSessionUtils.getDepByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), Dept.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany((String) resultMap.get(HGSC001.FIELD_company_code)), User.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-09 14:45:44
Version : 1.0
schema : hggp
tableName : HGSC001A
id BIGINT NOT NULL primarykey,
proj_id BIGINT NOT NULL,
user_code VARCHAR,
user_name VARCHAR,
user_phone VARCHAR,
user_dep_code VARCHAR,
user_dep_name VARCHAR,
dep_code VARCHAR,
dep_name VARCHAR,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<sqlMap namespace="HGSC001A">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projId">
proj_id = #projId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCode">
user_code = #userCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name = #userName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userPhone">
user_phone = #userPhone#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepCode">
user_dep_code = #userDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepName">
user_dep_name = #userDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC001A">
SELECT
id as "id",
proj_id as "projId", <!-- 项目ID -->
user_code as "userCode", <!-- 用户编码 -->
user_name as "userName", <!-- 用户名称 -->
user_phone as "userPhone", <!-- 用户手机号 -->
user_dep_code as "userDepCode", <!-- 部门编码 -->
user_dep_name as "userDepName", <!-- 部门名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC001A WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC001A WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projId">
proj_id = #projId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCode">
user_code = #userCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name = #userName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userPhone">
user_phone = #userPhone#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepCode">
user_dep_code = #userDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userDepName">
user_dep_name = #userDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC001A (id,
proj_id, <!-- 项目ID -->
user_code, <!-- 用户编码 -->
user_name, <!-- 用户名称 -->
user_phone, <!-- 用户手机号 -->
user_dep_code, <!-- 部门编码 -->
user_dep_name, <!-- 部门名称 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
account_code, <!-- 帐套 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
)
VALUES (#id#, #projId#, #userCode#, #userName#, #userPhone#, #userDepCode#, #userDepName#, #depCode#, #depName#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSC001A WHERE
id = #id#
</delete>
<delete id="deleteByProjId">
DELETE FROM ${hggpSchema}.HGSC001A WHERE
proj_id = #projId#
</delete>
<delete id="deleteByProjIds">
DELETE FROM ${hggpSchema}.HGSC001A WHERE
proj_id IN <iterate close=")" open="(" conjunction="," property="projIds">#projIds[]#</iterate>
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC001A
SET
proj_id = #projId#, <!-- 项目ID -->
user_code = #userCode#, <!-- 用户编码 -->
user_name = #userName#, <!-- 用户名称 -->
user_phone = #userPhone#, <!-- 用户手机号 -->
user_dep_code = #userDepCode#, <!-- 部门编码 -->
user_dep_name = #userDepName#, <!-- 部门名称 -->
dep_code = #depCode#, <!-- 部门编码 -->
dep_name = #depName#, <!-- 部门名称 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id = #id#
</update>
</sqlMap>
package com.baosight.hggp.hg.sc.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.ListUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
/**
* @Author wwl
* @Date 2024/5/7 16:17
*/
public class HGSCTools {
public static class THGSC001A{
/**
* 通过项目ID查询项目负责人*
* @param projId
* @return
*/
public static List<HGSC001A> getByProjId(Long projId){
AssertUtils.isNull(projId, "项目ID不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC001A.FIELD_proj_id, projId);
List<HGSC001A> results = DaoBase.getInstance().query(HGSC001A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGSC001A> convertToObj(List<Map> resultRows){
List<HGSC001A> objList= new ArrayList<>();
for (Map resultRow : resultRows) {
HGSC001A hgsc001A = new HGSC001A();
hgsc001A.fromMap(resultRow);
objList.add(hgsc001A);
}
return objList;
}
/**
* 校验保存的数据
*
* @param objList
*/
public static void checkProjMgData(List<HGSC001A> objList) {
AssertUtils.isEmpty(objList, "项目负责人不能为空!");
AssertUtils.isTrue(ListUtils.allSameProperty(objList,HGSC001A::getUserCode), "项目负责人重复!");
}
public static List<HGSC001A> save(List<HGSC001A> hgsc001AList, Long projId){
if(CollectionUtils.isNotEmpty(hgsc001AList)&&Objects.nonNull(projId)) {
//删除历史数据
DaoUtils.update(HGSC001A.DELETE_BY_PROJID, projId);
hgsc001AList.forEach(obj -> {
obj.setProjId(projId);
DaoUtils.insert(HGSC001A.INSERT,obj);
});
}
return hgsc001AList;
}
public static void deleteByProIds(List<Long> projIds){
if(CollectionUtils.isNotEmpty(projIds)) {
//删除历史数据
DaoUtils.update(HGSC001A.DELETE_BY_PROJIDS, new HashMap<String,Object>(){{put("proIds",projIds);}});
}
}
}
}
......@@ -150,6 +150,32 @@ public class AssertUtils {
}
/**
* A等于B
*
* @param a
* @param b
* @param message
*/
public static void isEqual(BigDecimal a, BigDecimal b, String message) {
if (a.compareTo(b) == 0) {
throw new PlatException(message);
}
}
/**
* A不等于B
*
* @param a
* @param b
* @param message
*/
public static void isNotEqual(BigDecimal a, BigDecimal b, String message) {
if (a.compareTo(b) != 0) {
throw new PlatException(message);
}
}
/**
* A大于B
*
* @param a
......
......@@ -268,4 +268,20 @@ public class CommonMethod {
}
return eiMetadata;
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId) {
comboBoxDefaultValue(inInfo,blockId,HGConstants.VALUE_FIELD,HGConstants.TEXT_FIELD);
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId, String valueFieldName, String textFieldName) {
List rows = inInfo.getBlock(blockId).getRows();
List newRows = new ArrayList(){{
add(new HashMap<String,Object>(){{
put(valueFieldName,"");
put(textFieldName,"-- 请选择 --");
}});
}};
newRows.addAll(rows);
inInfo.getBlock(blockId).setRows(newRows);
}
}
package com.baosight.hggp.util;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
/**
* @Author wwl
* @Date 2024/5/10 10:11
*/
public class ListUtils {
public static <T> boolean allSameProperty(List<T> list, Function<T, ?> propertyExtractor) {
if (list == null || list.isEmpty()) {
return true;
}
Object firstValue = propertyExtractor.apply(list.get(0));
return list.stream().allMatch(item -> Objects.equals(firstValue, propertyExtractor.apply(item)));
}
}
......@@ -7,12 +7,7 @@ $(function () {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [{
field: "length",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}],
columns: [],
loadComplete: function (grid) {
// 提交
$(document.body).on("click", "#SUBMIT", submit);
......@@ -64,18 +59,18 @@ let save = function () {
return;
}
for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['purQty'])) {
message("勾选的第" + (i + 1) + "行采购数量必须是大于0的数字");
if (isBlank(rows[i]['supCode'])) {
message("勾选的第" + (i + 1) + "行供应商名称不能为空");
return;
}
if (!isPositiveNumber(rows[i]['purWeight'])) {
message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字");
if (isBlank(rows[i]['purUserName'])) {
message("勾选的第" + (i + 1) + "行采购员不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "save", true);
JSUtils.submitGridsData("result", "HGCG002", "save", true);
}
});
}
......@@ -91,7 +86,7 @@ let remove = function () {
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "remove", true);
JSUtils.submitGridsData("result", "HGCG002", "remove", true);
}
});
}
......@@ -107,7 +102,7 @@ let submit = function () {
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "submit", true);
JSUtils.submitGridsData("result", "HGCG002", "submit", true);
}
});
}
......@@ -120,7 +115,7 @@ let selectPlan = function () {
href: "HGCG002A?methodName=initLoad",
title: "<div style='text-align: center;'>计划查询</div>",
width: "80%",
height: "70%",
height: "80%",
callbackName: selectPlanCallback
});
}
......
......@@ -8,13 +8,13 @@
<EF:EFPage title="采购合同">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="计划日期" blockId="inqu_status" ename="contractDate" row="0" colWidth="3"
<EF:EFDatePicker cname="合同日期" blockId="inqu_status" ename="contractDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="合同号" blockId="inqu_status" ename="contractNo" row="0" colWidth="3"/>
<EF:EFInput cname="计划单号" blockId="inqu_status" ename="planNo" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus"/>
</EF:EFSelect>
</div>
<div class="row">
......@@ -24,7 +24,7 @@
</EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
......@@ -53,11 +53,11 @@
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue=""
filter="contains" required="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
......@@ -67,6 +67,7 @@
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: []
columns: [],
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
supCodeChange(e);
});
}
}
}
......@@ -41,6 +46,14 @@ let confirm = function () {
return;
}
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['supCode'])) {
message("勾选的第" + (i + 1) + "行供应商名称不能为空");
return;
}
if (isBlank(rows[i]['purUserName'])) {
message("勾选的第" + (i + 1) + "行采购员不能为空");
return;
}
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购合同\"吗? ", {
ok: function () {
......@@ -56,3 +69,22 @@ let confirm = function () {
});
}
/**
* 供应商变更
*/
let supCodeChange = function (e) {
if (e.field != "supCode") {
return;
}
let item = e.items[0];
let supRecordRows = __eiInfo.blocks.sup_record_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < supRecordRows.length; i++) {
if (supRecordRows[i][1] === item.supCode) {
let supName = supRecordRows[i][0];
resultGrid.setCellValue(item, 'supName', supName == null ? "" : supName);
return;
}
}
}
}
......@@ -40,6 +40,12 @@
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue=""
filter="contains" required="true">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" maxLength="100" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center"
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [],
loadComplete: function (grid) {
// 确认
$("#CONFIRM").on("click", confirm);
},
onSave: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
remove();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 选择合同
$("#SELECT_CONTRACT").on("click", selectContract);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['receiveQty'])) {
message("勾选的第" + (i + 1) + "行收货数量必须大于0");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003", "save", true);
}
});
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003", "remove", true);
}
});
}
/**
* 确认
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"确认\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003", "confirm", true);
}
});
}
/**
* 选择
*/
let selectContract = function () {
JSColorbox.open({
href: "HGCG003A?methodName=initLoad",
title: "<div style='text-align: center;'>合同查询</div>",
width: "80%",
height: "80%",
callbackName: selectContractCallback
});
}
/**
* 选择回调
*/
let selectContractCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
<!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:EFDatePicker cname="收货日期" blockId="inqu_status" ename="receiveDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="收货单号" blockId="inqu_status" ename="receiveNo" row="0" colWidth="3"/>
<EF:EFInput cname="合同号" blockId="inqu_status" ename="contractNo" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [],
loadComplete: function (grid) {
}
}
}
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 勾选事件
resultCheckClick();
// 初始化查询
query();
});
/**
* 勾选事件
*/
let resultCheckClick = function (){
resultGrid.element.on("click", "input.check-one,input.check-all", function (e) {
let action = $(this).prop("checked");
if (action != true) {
return;
}
let checkRows = resultGrid.getCheckedRows();
let checkRowIndexs = resultGrid.getCheckedRowsIndex();
for (let rowNo = 0; rowNo < checkRowIndexs.length; rowNo++) {
let index = checkRowIndexs[rowNo];
let bcReceiveQty = checkRows[rowNo]["bcReceiveQty"];
let bcMaxReceiveQty = checkRows[rowNo]["bcMaxReceiveQty"];
if (isBlank(bcReceiveQty) || bcReceiveQty == 0) {
resultGrid.setCellValue(index, "bcReceiveQty", bcMaxReceiveQty);
}
}
});
}
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let bcReceiveQty = rows[i]['bcReceiveQty'];
let bcMaxReceiveQty = rows[i]['bcMaxReceiveQty'];
if (!isPositiveNumber(bcReceiveQty)) {
message("勾选的第" + (i + 1) + "行本次收货数量必须大于0");
return;
}
if (parseFloat(bcReceiveQty) > parseFloat(bcMaxReceiveQty)) {
message("勾选的第" + (i + 1) + "行本次收货数量不能大于本次最大收货数量");
return;
}
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购收货\"吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003A", "confirm",
true, function (e) {
var status = e.getStatus();
if (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:EFDatePicker cname="合同日期" blockId="inqu_status" ename="contractDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="合同号" blockId="inqu_status" ename="contractNo" row="0" colWidth="3"/>
<EF:EFInput cname="计划单号" blockId="inqu_status" ename="planNo" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('1', '3')"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="bcReceiveQty" cname="本次</br>收货数量" width="100" align="right" format="{0:N3}"
required="true"/>
<EF:EFColumn ename="bcMaxReceiveQty" cname="本次最大</br>收货数量" enable="false" width="100" align="right"
format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left" defaultValue=""
filter="contains">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function() {
// 查询
$("#QUERY").on("click", function () {
query();
});
$("#SWITCH").on("click", function () {
switchRow();
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
],
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
saveFunc();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
}
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
});
$(window).load(function () {
// 查
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
function saveFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let companyCode= item.get("companyCode");
let accountYear= item.get("accountYear");
let accountPeriod= item.get("accountPeriod");
let accountPeriodDateStart= item.get("accountPeriodStatus");
let accountPeriodDateEnd= item.get("accountPeriodStatus");
if(isBlank(companyCode)){
message("选中的第"+(index+1)+"行\"公司名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(accountYear)){
message("选中的第"+(index+1)+"行\"会计年度\",不能为空!");
flag = false;
return false;
}
if(isBlank(accountPeriod)){
message("选中的第"+(index+1)+"行\"会计期\",不能为空!");
flag = false;
return false;
}
if(isBlank(accountPeriodDateStart)){
message("选中的第"+(index+1)+"行\"账期开始日期\",不能为空!");
flag = false;
return false;
}
if(isBlank(accountPeriodDateEnd)){
message("选中的第"+(index+1)+"行\"账期结束日期\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW001", "save", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//JSUtils.submitGridsData("result", "HPSC001", "save", true);
}
});
}
}
/**
* 删除
*/
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let accountPeriodStatus= item.get("accountPeriodStatus");
if(accountPeriodStatus === "1"){
message("选中的第"+(index+1)+"行记录为开账状态,不能删除!");
flag = false;
return false;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCW001", "delete", true);
}
});
}
}
function switchRow() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"开账/关账\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW001", "switchRow", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//JSUtils.submitGridsData("result", "HPSC001", "save", true);
}
});
}
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