Commit 89273d12 by liuyang

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

parents 7e086e16 acf4015d
......@@ -67,6 +67,7 @@ public class HGCG002B extends DaoEPBase {
public static final String FIELD_BC_MAX_RECEIVE_WEIGHT = "bcMaxReceiveWeight"; /* 本次最大收货重量*/
public static final String FIELD_CONTRACT_DATE = "contractDate"; /* 合同日期*/
public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/
public static final String FIELD_CONTRACT_LINE_NO = "contractLineNo"; /* 合同行号*/
public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/
public static final String FIELD_SUP_CODE = "supCode"; /* 供应商编码*/
public static final String FIELD_SUP_NAME = "supName"; /* 供应商名称*/
......@@ -161,6 +162,7 @@ public class HGCG002B extends DaoEPBase {
private BigDecimal bcMaxReceiveWeight = new BigDecimal(0.000); /* 本次最大收货重量*/
private String contractDate = " "; /* 合同日期*/
private String contractNo = " "; /* 合同号*/
private String contractLineNo = " "; /* 合同行号*/
private String planNo = " "; /* 计划单号*/
private String supCode = " "; /* 供应商编码*/
private String supName = " "; /* 供应商名称*/
......@@ -387,6 +389,10 @@ public class HGCG002B extends DaoEPBase {
eiColumn.setDescName("合同号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CONTRACT_LINE_NO);
eiColumn.setDescName("合同行号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_NO);
eiColumn.setDescName("计划单号");
eiMetadata.addMeta(eiColumn);
......@@ -1088,6 +1094,14 @@ public class HGCG002B extends DaoEPBase {
this.calculationMethod = calculationMethod;
}
public String getContractLineNo() {
return contractLineNo;
}
public void setContractLineNo(String contractLineNo) {
this.contractLineNo = contractLineNo;
}
/**
* get the value from Map.
*
......@@ -1140,6 +1154,7 @@ public class HGCG002B extends DaoEPBase {
setBcMaxReceiveWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_WEIGHT)), bcMaxReceiveWeight));
setContractDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_DATE)), contractDate));
setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo));
setContractLineNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_LINE_NO)), contractLineNo));
setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo));
setSupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_CODE)), supCode));
setSupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_NAME)), supName));
......@@ -1199,6 +1214,7 @@ public class HGCG002B extends DaoEPBase {
map.put(FIELD_BC_MAX_RECEIVE_WEIGHT, StringUtils.toString(bcMaxReceiveWeight, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_WEIGHT)));
map.put(FIELD_CONTRACT_DATE, StringUtils.toString(contractDate, eiMetadata.getMeta(FIELD_CONTRACT_DATE)));
map.put(FIELD_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO)));
map.put(FIELD_CONTRACT_LINE_NO, StringUtils.toString(contractLineNo, eiMetadata.getMeta(FIELD_CONTRACT_LINE_NO)));
map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO)));
map.put(FIELD_SUP_CODE, StringUtils.toString(supCode, eiMetadata.getMeta(FIELD_SUP_CODE)));
map.put(FIELD_SUP_NAME, StringUtils.toString(supName, eiMetadata.getMeta(FIELD_SUP_NAME)));
......
......@@ -170,6 +170,9 @@ public class ServiceHGCG002A extends ServiceBase {
*/
private void insertDetails(HGCG001A fCg001A, HGCG002 newCg002) {
HGCG002B cg002B = BeanUtils.copy(fCg001A, HGCG002B.class);
cg002B.setContractNo(newCg002.getContractNo());
cg002B.setContractLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_LINE_NO,
new String[]{newCg002.getContractNo()}));
cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg002B.setPrimaryId(newCg002.getId());
cg002B.setPlanDetailId(fCg001A.getId());
......
......@@ -145,9 +145,7 @@ public class ServiceHGCG003 extends ServiceBase {
* @param dbCg003Map
*/
private void checkEditData(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);
......@@ -156,14 +154,6 @@ public class ServiceHGCG003 extends ServiceBase {
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()));
}
}
}
......@@ -202,12 +192,12 @@ public class ServiceHGCG003 extends ServiceBase {
// 采购收货DB数据
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s);
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
Map<String, HGCG002A> dbCg002Map = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// 数据校验
this.checkRemoveData(fCg003s, dbCg003Map);
// 保存数据
this.removeData(fCg003s, dbCg003Map, dbCg002AMap);
this.removeData(fCg003s, dbCg003Map, dbCg002Map);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据删除成功!");
......
......@@ -185,18 +185,18 @@ public class ServiceHGCG003A extends ServiceBase {
*
* @param fCg002Bs
* @param dbCg002BMap
* @param cg002
* @param dbCg002
*/
private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) {
private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 dbCg002) {
// 写入主信息
HGCG003 newCg003 = insertMain(fCg002Bs, cg002);
HGCG003 newCg003 = insertMain(fCg002Bs, dbCg002);
// 写入明细数据
for (HGCG002B fCg002B : fCg002Bs) {
insertDetails(fCg002B, dbCg002BMap, newCg003);
}
// 修改合同信息
List<HGCG002> cg002s = new LinkedList<>();
cg002s.add(cg002);
cg002s.add(dbCg002);
HGCGTools.HgCg002.updateContractPrimary(cg002s);
}
......
......@@ -40,7 +40,9 @@
PROJ_NAME as "projName", <!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
PLAN_DETAIL_ID as "planDetailId", <!-- 计划明细id -->
STATUS as "status"
STATUS as "status",
CONTRACT_NO as "contractNo",
CONTRACT_LINE_NO as "contractLineNo"
</sql>
<sql id="condition">
......@@ -200,15 +202,12 @@
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGCG002A (ID,
INSERT INTO ${hggpSchema}.HGCG002A (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
......@@ -236,9 +235,16 @@
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
CALCULATION_METHOD,
PLAN_DETAIL_ID
PLAN_DETAIL_ID,
CONTRACT_NO,
CONTRACT_LINE_NO
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#,
#material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#,
#receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#,
#primaryId#,#projCode#,#projName#,#calculationMethod#, #planDetailId#, #contractNo#, #contractLineNo#
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#, #receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #primaryId#,#projCode#,#projName#,#calculationMethod#, #planDetailId#)
</insert>
<delete id="delete">
......
......@@ -140,6 +140,9 @@
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNo">
RECEIVE_NO = #receiveNo#
</isNotEmpty>
......
......@@ -316,13 +316,13 @@ public class HGCGTools {
/**
* 查询
*
* @param contractNos
* @param ids
* @return
*/
public static List<HGCG002A> list(List<String> contractNos) {
AssertUtils.isEmpty(contractNos, "合同号不能为空");
public static List<HGCG002> listByIds(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("contractNos", contractNos);
paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGCG002.QUERY, paramMap);
}
......@@ -332,10 +332,21 @@ public class HGCGTools {
* @param ids
* @return
*/
public static List<HGCG002> listByIds(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同号不能为空");
public static Map<Long, HGCG002> mapByIds(List<Long> ids) {
List<HGCG002> results = listByIds(ids);
return results.stream().collect(Collectors.toMap(HGCG002::getId, item -> item));
}
/**
* 查询
*
* @param contractNos
* @return
*/
public static List<HGCG002A> list(List<String> contractNos) {
AssertUtils.isEmpty(contractNos, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
paramMap.put("contractNos", contractNos);
return DaoBase.getInstance().query(HGCG002.QUERY, paramMap);
}
......@@ -347,7 +358,7 @@ public class HGCGTools {
*/
public static Map<String, HGCG002A> map(List<String> contractNos) {
List<HGCG002A> results = list(contractNos);
return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item));
return results.stream().collect(Collectors.toMap(HGCG002::getContractNo, item -> item));
}
/**
......@@ -431,38 +442,6 @@ public class HGCGTools {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002);
}
public static void updateChecks(List<HGZL001> fZl001s) {
//获取收货明细数据
List<Long> receiveDetailIds = fZl001s.stream().map(HGZL001::getReceiveDetailId).collect(Collectors.toList());
List<HGCG003B> hgcg003BList = HGCGTools.HgCg003B.list(receiveDetailIds);
//获取合同明细
List<Long> contractDetailIds = hgcg003BList.stream().map(HGCG003B::getContractDetailId).collect(Collectors.toList());
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.list(contractDetailIds);
//合同主表信息
List<Long> contractIds = hgcg002BList.stream().map(o->o.getPrimaryId()).collect(Collectors.toList());
List<HGCG002> queryHgcg002List = HGCGTools.HgCg002.listByIds(contractIds);
fZl001s.forEach(hgzl001 ->{
//关联获取到收货明细
HGCG003B hgcg003B = hgcg003BList.stream().filter(o -> o.getId().compareTo(hgzl001.getReceiveDetailId()) == 0).findAny().orElse(null);
if(Objects.nonNull(hgcg003B)){
//关联获取到合同明细
HGCG002B hgcg002B = hgcg002BList.stream().filter(o->o.getId().compareTo(hgcg003B.getContractDetailId()) == 0).findAny().orElse(null);
if(Objects.nonNull(hgcg002B)){
BigDecimal unqualifyQty = hgzl001.getUnqualifyQty();
Integer status = unqualifyQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
hgcg002B.setStatus(status);
HGCGTools.HgCg002B.updateCheck(hgcg002B,unqualifyQty.negate());
//修改主表信息
HGCG002 hgcg002 = queryHgcg002List.stream().filter(o->o.getId().compareTo(hgcg002B.getPrimaryId()) == 0).findAny().orElse(null);
hgcg002.setStatus(status);
HGCGTools.HgCg002.updateCheck(hgcg002,unqualifyQty.negate());
}
}
});
}
/**
* 修改状态
*
......@@ -611,24 +590,6 @@ public class HGCGTools {
/**
* 修改状态
*
* @param dbCg002B
* @param receiveQty
*/
public static void updateCheck(HGCG002B dbCg002B, BigDecimal receiveQty) {
AssertUtils.isNull(dbCg002B, "合同明细不能为空!");
AssertUtils.isNull(receiveQty, "收货数量不能为空!");
BigDecimal newReceiveQty = receiveQty.add(dbCg002B.getReceiveQty());
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight()));
paramMap.put(HGCG002.FIELD_STATUS, dbCg002B.getStatus());
DaoUtils.update(HGSqlConstant.HgCg002B.UPDATE_CHECK, paramMap);
}
/**
* 修改状态
*
* @param primaryId
* @param status
*/
......@@ -664,6 +625,7 @@ public class HGCGTools {
AssertUtils.isEmpty(results, String.format("采购收货单[%s]不存在", id));
return results.get(0);
}
/**
* 锁
*
......@@ -682,6 +644,19 @@ public class HGCGTools {
/**
* 查询
*
* @param ids
* @return
*/
public static List<HGCG003> listById(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGCG003.QUERY, paramMap);
}
/**
* 查询
*
* @param receiveNos
* @return
*/
......@@ -760,50 +735,6 @@ public class HGCGTools {
*
* @param zl001s
*/
public static void updateChecks(List<HGZL001> zl001s) {
zl001s.forEach(zl001->{
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003B.FIELD_ID, zl001.getReceiveDetailId());
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_4);
paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, zl001.getUnqualifyQty());
paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, zl001.getQualifyQty());
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap);
//采购入库
HGKCTools.HgKc001.putInStorageData(zl001.getReceiveDetailId());
});
//获取质检通过的收货单信息
List<String> receiveNos = zl001s.stream().map(o->o.getReceiveNo()).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(receiveNos)){
//主表信息
List<HGCG003> hgcg003List = HGCGTools.HgCg003.list(receiveNos);
//子表信息
List<HGCG003B> hgcg003BList = HGCGTools.HgCg003B.listByPrimaryIds(hgcg003List.stream().map(o->o.getId()).collect(Collectors.toList()));
hgcg003List.forEach(cg003->{
List<HGCG003B> hgcg003BFilterList = hgcg003BList.stream().filter(o->o.getPrimaryId().compareTo(cg003.getId()) == 0
&& o.getStatus().intValue() == HGConstant.CgReceiveStatus.S_3).collect(Collectors.toList());
//如果不存在质检中的收货明细了,则主表为质检完成
if(CollectionUtils.isEmpty(hgcg003BFilterList)){
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003.FIELD_RECEIVE_NO, cg003.getReceiveNo());
paramDetailMap.put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_4);
BigDecimal depositQtySum = hgcg003BList.stream().map(HGCG003B::getDepositQty).reduce(BigDecimal.ZERO,BigDecimal::add);
paramDetailMap.put(HGCG003.FIELD_DEPOSIT_QTY, depositQtySum);
BigDecimal deliverQtySum = hgcg003BList.stream().map(HGCG003B::getDeliverQty).reduce(BigDecimal.ZERO,BigDecimal::add);
paramDetailMap.put(HGCG003.FIELD_DELIVER_QTY, deliverQtySum);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_CONFIRM, paramDetailMap);
}
});
}
}
/**
* 修改状态
*
* @param zl001s
*/
public static void deleteChecks(List<HGZL001> zl001s) {
zl001s.forEach(zl001->{
Map<String, Object> paramDetailMap = new HashMap<>();
......@@ -892,6 +823,35 @@ public class HGCGTools {
}
/**
* 查询
*
* @param primaryIds
* @return
*/
public static Map<Long, List<HGCG003B>> mapByPrimaryIds(List<Long> primaryIds) {
List<HGCG003B> results = listByPrimaryIds(primaryIds);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.groupingBy(HGCG003B::getPrimaryId));
}
/**
* 锁
*
* @param id
* @return
*/
public static void lock(Long id) {
if (id == null) {
return;
}
Map paramMap = new HashMap();
paramMap.put("id", id);
DaoBase.getInstance().update(HGSqlConstant.HgCg003B.LOCK, paramMap);
}
/**
* 锁
*
* @param ids
......@@ -945,7 +905,6 @@ public class HGCGTools {
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_STATUS, paramMap);
}
}
}
......@@ -182,6 +182,19 @@ public class HGCGUtils {
/**
* 锁并且获取数据
*
* @param id
* @return
*/
public static HGCG003B lockGetData(Long id) {
// 锁
HGCGTools.HgCg003B.lock(id);
// db数据
return HGCGTools.HgCg003B.get(id);
}
/**
* 锁并且获取数据
*
* @param fCg003Bs
* @return
*/
......
......@@ -101,6 +101,8 @@ public class HGConstant {
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_CONTRACT_LINE_NO = "CG_CONTRACT_LINE_NO";
// 采购收货号
public static final String CG_RECEIVE_NO = "CG_RECEIVE_NO";
// 采购入库号
......
......@@ -8,6 +8,7 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
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;
......@@ -107,16 +108,11 @@ public class HGKCTools {
/**
* 生产入库(入库质检单)
* @param receiveId
*
* @param dbCg003B
*/
public static void putInStorageData(Long receiveId) {
List<Long> receiveIDsList = new LinkedList<>();
receiveIDsList.add(receiveId);
// db数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetData(receiveIDsList);
HGCG003B dbCg003B = dbCg003BMap.get(receiveId);
HGKC001 newKc001 = new HGKC001();
BeanUtils.copyProperties(dbCg003B, newKc001,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
public static void putInStorageData(HGCG003B dbCg003B) {
HGKC001 newKc001 = BeanUtils.copy(dbCg003B, HGKC001.class);
newKc001.setDepositDate(DateUtils.shortDate());
newKc001.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_DEPOSIT_NO));
newKc001.setDepositQty(dbCg003B.getDepositQty());
......
......@@ -95,6 +95,7 @@ public class ServiceHGWD002A extends ServiceEPBase {
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
queryMap.put("userId", UserSessionUtils.getLoginName());
queryMap.put(HGWD001.FIELD_STATUS, HgWdConstant.FileStatus.S_1);
List<HGWD002> dbWd002s = dao.query(HGWD002.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd002s)) {
return results;
......
......@@ -107,7 +107,7 @@ public class ServiceHGWD003B extends ServiceEPBase {
// 已存在的授权用户信息
List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(fileId);
List<String> userIds = CollectionUtils.isEmpty(dbWd003s) ? new ArrayList<>()
: dbWd003Map.get(fileId).stream().map(HGWD003::getUserId).collect(Collectors.toList());
: dbWd003s.stream().map(HGWD003::getUserId).collect(Collectors.toList());
// 过滤出未授权的用户,并重新赋值FILE_ID
List<HGWD003> filterWd003s = dbMainWd003s.stream()
.filter(dbMainWd003 -> !userIds.contains(dbMainWd003.getUserId()))
......
......@@ -6,7 +6,13 @@ import com.baosight.hggp.core.constant.CommonConstant;
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.HGCG002B;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
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.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.xs.domain.Company;
......@@ -21,10 +27,15 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author ZJH
......@@ -194,10 +205,14 @@ public class ServiceHGZL001 extends ServiceBase {
try {
List<HGZL001> fZl001s = MapUtils.toDaoEPBases(inInfo, HGZL001.class);
Map<String, HGZL001> dbZl001Map = HGZLUtils.HgZl001.lockGetDataEp(fZl001s);
// 获取收货明细数据
List<Long> receiveDetailIds = fZl001s.stream().map(HGZL001::getReceiveDetailId)
.collect(Collectors.toList());
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetData(receiveDetailIds);
// 数据校验
this.checkProcessData(fZl001s, dbZl001Map);
this.checkProcessData(fZl001s, dbZl001Map, dbCg003BMap);
// 保存数据
this.saveProcessData(fZl001s, dbZl001Map);
this.saveProcessData(fZl001s, dbZl001Map, dbCg003BMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fZl001s.size() + "]条数据处理成功!");
......@@ -212,17 +227,23 @@ public class ServiceHGZL001 extends ServiceBase {
*
* @param fZl001s
* @param dbZl001Map
* @param dbCg003BMap
*/
private void checkProcessData(List<HGZL001> fZl001s, Map<String, HGZL001> dbZl001Map) {
private void checkProcessData(List<HGZL001> fZl001s, Map<String, HGZL001> dbZl001Map,
Map<Long, HGCG003B> dbCg003BMap) {
for (HGZL001 fZl001 : fZl001s) {
String checkNo = fZl001.getCheckNo();
HGZL001 dbZl003 = dbZl001Map.get(checkNo);
AssertUtils.isNotEquals(CommonConstant.YesNo.NO_0, dbZl003.getStatus(),
String.format("质检单[%s]状态不是\"未处理\",不允许操作", checkNo));
AssertUtils.isTrue(fZl001.getQualifyQty().compareTo(BigDecimal.ZERO) < 0 ,String.format("质检单[%s]的合格数量不能为负数", checkNo));
AssertUtils.isTrue(fZl001.getUnqualifyQty().compareTo(BigDecimal.ZERO) < 0 ,String.format("质检单[%s]的不合格数量不能为负数", checkNo));
AssertUtils.isTrue(fZl001.getQualifyQty().compareTo(BigDecimal.ZERO) < 0,
String.format("质检单[%s]的合格数量不能为负数", checkNo));
AssertUtils.isTrue(fZl001.getUnqualifyQty().compareTo(BigDecimal.ZERO) < 0,
String.format("质检单[%s]的不合格数量不能为负数", checkNo));
AssertUtils.isNotEquals(fZl001.getQualifyQty().add(fZl001.getUnqualifyQty()), dbZl003.getReceiveQty(),
String.format("质检单[%s]的合格数量加不合格数量必须等于收货数量", checkNo));
AssertUtils.isNull(dbCg003BMap.get(fZl001.getReceiveDetailId()),
String.format("质检单[%s]的关联的收货信息不存在", checkNo));
}
}
......@@ -231,25 +252,114 @@ public class ServiceHGZL001 extends ServiceBase {
*
* @param fZl001s
* @param dbZl001Map
* @param dbCg003BMap
*/
private void saveProcessData(List<HGZL001> fZl001s, Map<String, HGZL001> dbZl001Map) {
private void saveProcessData(List<HGZL001> fZl001s, Map<String, HGZL001> dbZl001Map,
Map<Long, HGCG003B> dbCg003BMap) {
for (HGZL001 fZl001 : fZl001s) {
// 更新质检单状态
String checkNo = fZl001.getCheckNo();
HGZL001 dbZl001 = dbZl001Map.get(checkNo);
dbZl001.setQualifyQty(fZl001.getQualifyQty());
dbZl001.setUnqualifyQty(fZl001.getUnqualifyQty());
dbZl001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSqlConstant.HgZl001.PROCESS, dbZl001);
// // 更新收货单状态
// HGCGTools.HgCg003.updateCheck(dbZl001);
//生成采购入库单
//HGKCTools.HgKc001.putInStorageData(dbZl001.getReceiveDetailId());
// 更新收货单明细
this.updateReceiveDetail(fZl001, dbCg003BMap);
}
// 更新收货单状态
HGCGTools.HgCg003.updateChecks(fZl001s);
// 更新收货单主表信息
this.updateReceiveMain(fZl001s);
// 质检修改合同状态
HGCGTools.HgCg002.updateChecks(fZl001s);
this.updateContract(fZl001s, dbCg003BMap);
}
/**
* 更新收货单明细
*
* @param fZl001
* @param dbCg003BMap
*/
private void updateReceiveDetail(HGZL001 fZl001, Map<Long, HGCG003B> dbCg003BMap) {
Long receiveDetailId = fZl001.getReceiveDetailId();
// 更新采购收货明细的入库数量
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003B.FIELD_ID, receiveDetailId);
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_4);
paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, fZl001.getUnqualifyQty());
paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, fZl001.getQualifyQty());
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap);
// 生成采购入库单
HGKCTools.HgKc001.putInStorageData(dbCg003BMap.get(receiveDetailId));
}
/**
* 更新收货单状态
*
* @param fZl001s
*/
public void updateReceiveMain(List<HGZL001> fZl001s) {
// 收货单号去重
List<String> receiveNos = fZl001s.stream().map(item -> item.getReceiveNo()).distinct()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(receiveNos)) {
return;
}
// 收货单主表信息
List<HGCG003> dbCg003s = HGCGTools.HgCg003.list(receiveNos);
// 收货单子表信息
List<Long> primaryIds = dbCg003s.stream().map(item -> item.getId()).collect(Collectors.toList());
Map<Long, List<HGCG003B>> dbCg003BMap = HGCGTools.HgCg003B.mapByPrimaryIds(primaryIds);
for (HGCG003 dbCg003 : dbCg003s) {
List<HGCG003B> dbCg003Bs = dbCg003BMap == null ? null : dbCg003BMap.get(dbCg003.getId());
AssertUtils.isEmpty(dbCg003Bs, String.format("采购收货单【%s】无明细数据,请检查", dbCg003.getReceiveNo()));
// 过滤出质检中的收货单
boolean bool = dbCg003Bs.stream().anyMatch(dbCg003B
-> HGConstant.CgReceiveStatus.S_3.equals(dbCg003B.getStatus()));
// 如果不存在质检中的收货明细了,则主表为质检完成
if (!bool) {
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003.FIELD_RECEIVE_NO, dbCg003.getReceiveNo());
paramDetailMap.put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_4);
BigDecimal depositQtySum = dbCg003Bs.stream().map(HGCG003B::getDepositQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
paramDetailMap.put(HGCG003.FIELD_DEPOSIT_QTY, depositQtySum);
BigDecimal deliverQtySum = dbCg003Bs.stream().map(HGCG003B::getDeliverQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
paramDetailMap.put(HGCG003.FIELD_DELIVER_QTY, deliverQtySum);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_CONFIRM, paramDetailMap);
}
}
}
/**
* 修改合同状态
*
* @param fZl001s
* @param dbCg003BMap
*/
public void updateContract(List<HGZL001> fZl001s, Map<Long, HGCG003B> dbCg003BMap) {
// 获取收货明细数据
List<HGCG003B> dbCg003Bs = dbCg003BMap.values().stream().collect(Collectors.toList());
// 获取合同明细
List<Long> contractDetailIds = dbCg003Bs.stream().map(HGCG003B::getContractDetailId).distinct()
.collect(Collectors.toList());
Map<Long, HGCG002B> dbCg002BMap = HGCGTools.HgCg002B.map(contractDetailIds);
// 合同主表信息
List<Long> contractIds = dbCg002BMap.values().stream().map(item -> item.getPrimaryId())
.collect(Collectors.toList());
Map<Long, HGCG002> dbCg002Map = HGCGTools.HgCg002.mapByIds(contractIds);
for (HGZL001 fZl001 : fZl001s) {
// 关联获取到收货明细
HGCG003B dbCg003B = dbCg003BMap.get(fZl001.getReceiveDetailId());
BigDecimal unqualifyQty = fZl001.getUnqualifyQty().negate();
BigDecimal unqualifyWeight = unqualifyQty.multiply(dbCg003B.getReceiveUnitWeight());
// 关联获取到合同明细
HGCG002B dbCg002B = dbCg002BMap.get(dbCg003B.getContractDetailId());
HGCGTools.HgCg002B.updateReceive(dbCg002B, unqualifyQty, unqualifyWeight);
// 修改主表信息
HGCG002 dbCg002 = dbCg002Map.get(dbCg002B.getPrimaryId());
HGCGTools.HgCg002.updateReceive(dbCg002, unqualifyQty, unqualifyWeight);
}
}
}
package com.baosight.xservices.xs.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.core.security.UserSessionUtils;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
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.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.xservices.xs.domain.XS02;
import com.baosight.xservices.xs.tools.XsTools;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 复制角色权限
*
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceXS3201B extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 非超级管理只能看到所属企业的信息 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
queryMap.put("accountCode", UserSessionUtils.getAccountCode());
}
// 排除自身
queryMap.put("excludeEnames", new String[]{MapUtils.getString(queryMap, "mainGroupEname")});
inInfo = super.query(inInfo, "XS02.query", new XS02());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo confirm(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取Group_ID信息
String mainGroupEname = MapUtils.getString(queryMap, "mainGroupEname");
Map resultMap = XsTools.Xs02.getGroup(mainGroupEname);
AssertUtils.isEmpty(resultMap, String.format("【%s】角色不存在", mainGroupEname));
// 获取Group_ID授权信息
List<Map> dbMainAuths = XsTools.Xs07.listBySubject(MapUtils.getString(resultMap, "groupId"));
AssertUtils.isEmpty(dbMainAuths, String.format("【%s】角色还未进行授权,请授权后再进行复制", mainGroupEname));
// 复制授权信息
List<Map> fGroupMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
this.copyAuthUser(fGroupMaps, dbMainAuths);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("复制角色权限成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "复制角色权限失败");
}
return inInfo;
}
/**
* 复制授权用户
*
* @param fGroupMaps
* @param dbMainAuths
*/
private void copyAuthUser(List<Map> fGroupMaps, List<Map> dbMainAuths) {
List<String> groupIds = ObjectUtils.listKey(fGroupMaps, "groupId");
// 已授权信息
Map<String, List<Map>> dbAuthMap = XsTools.Xs07.mapBySubject(groupIds);
for (String groupId : groupIds) {
// 已存在的授权用户信息
List<Map> dbAuths = dbAuthMap == null ? null : dbAuthMap.get(groupId);
List<String> objectIds = CollectionUtils.isEmpty(dbAuths) ? new ArrayList<>()
: dbAuths.stream().map(item -> item.get("objectId").toString()).collect(Collectors.toList());
// 过滤出未授权的用户,并重新赋值FILE_ID
List<Map> filterAuths = dbMainAuths.stream()
.filter(dbMainAuth -> !objectIds.contains(dbMainAuth.get("objectId")))
.map(dbMainAuth -> {
dbMainAuth.put("subjectId", groupId);
dbMainAuth.put("recCreator", UserSessionUtils.getLoginName());
dbMainAuth.put("recCreateTime", DateUtils.shortDateTime());
dbMainAuth.put("sortIndex", 0);
return dbMainAuth;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(filterAuths)) {
DaoUtils.insertBatch("XS07.insert", filterAuths);
}
}
}
}
......@@ -104,22 +104,26 @@
t1.id = #groupId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupEname">
t1.group_ename like ('%$groupEname$%')
t1.group_ename like '%$groupEname$%'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCname">
t1.group_cname like ('%$groupCname$%')
t1.group_cname like '%$groupCname$%'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupType">
t1.group_type = #groupType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="manageGroupEname">
t1.manage_group_ename like ('%$manageGroupEname$%')
t1.manage_group_ename like '%$manageGroupEname$%'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
t1.account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="excludeEnames">
t1.group_ename not in <iterate close=")" open="(" conjunction="," property="excludeEnames">#excludeEnames[]#</iterate>
</isNotEmpty>
ORDER BY t1.SORT_INDEX,t1.ID
</select>
<select id="queryByManageGroupEname" resultClass="java.util.HashMap">
SELECT
t1.id as "groupId",
......@@ -273,6 +277,22 @@
</isNotEmpty>
</select>
<select id="getGroup" resultClass="java.util.HashMap">
SELECT
id as "groupId",
group_ename as "gEname",
group_cname as "gCname"
FROM ${platSchema}.XS_USER_GROUP
where 1=1
<isNotEmpty prepend=" AND " property="groupEname">
group_ename = #groupEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCname">
group_cname like '%$groupCname$%'
</isNotEmpty>
ORDER BY SORT_INDEX, ID
</select>
<select id="queryGroup" resultClass="java.util.HashMap">
SELECT
id as "groupId",
......
......@@ -36,6 +36,9 @@
<isNotEmpty prepend=" AND " property="subjectId">
subject_id = #subjectId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectIds">
subject_id in <iterate close=")" open="(" conjunction="," property="subjectIds">#subjectIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="objectId">
object_id = #objectId#
</isNotEmpty>
......@@ -846,4 +849,24 @@
SELECT $valueColumn$ as "subjectId" FROM ${platSchema}.$table$ WHERE $conditionColumn$ = #subjectEname#
</select>
<select id="get" resultClass="java.util.HashMap">
SELECT
SUBJECT_ID AS "subjectId",
SUBJECT_TYPE AS "subjectType",
OBJECT_ID AS "objectId",
OBJECT_TYPE AS "objectType",
OPERATION_TYPE AS "operationType"
FROM ${platSchema}.XS_AUTHORIZATION
WHERE 1=1
<isNotEmpty prepend=" AND " property="subjectId">
subject_id = #subjectId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectIds">
subject_id in <iterate close=")" open="(" conjunction="," property="subjectIds">#subjectIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="objectId">
object_id = #objectId#
</isNotEmpty>
</select>
</sqlMap>
package com.baosight.xservices.xs.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/9/12,16:18
*/
public class XsTools {
/**
* 用户角色
*
* @author:songx
* @date:2024/9/12,16:19
*/
public static class Xs02 {
/**
* @param groupEname
* @return
*/
public static Map getGroup(String groupEname) {
AssertUtils.isEmpty(groupEname, "角色英文名不能为空");
Map queryMap = new HashMap();
queryMap.put("groupEname", groupEname);
List<Map> results = DaoBase.getInstance().query("XS02.getGroup", queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
/**
* @author:songx
* @date:2024/9/12,16:28
*/
public static class Xs07 {
/**
* @param subjectId
* @return
*/
public static List<Map> listBySubject(String subjectId) {
AssertUtils.isEmpty(subjectId, "subjectId不能为空");
Map queryMap = new HashMap();
queryMap.put("subjectId", subjectId);
return DaoBase.getInstance().query("XS07.get", queryMap);
}
/**
* @param subjectIds
* @return
*/
public static List<Map> listBySubject(List<String> subjectIds) {
AssertUtils.isEmpty(subjectIds, "subjectId不能为空");
Map queryMap = new HashMap();
queryMap.put("subjectIds", subjectIds);
return DaoBase.getInstance().query("XS07.get", queryMap);
}
/**
* @param subjectIds
* @return
*/
public static Map<String, List<Map>> mapBySubject(List<String> subjectIds) {
List<Map> results = listBySubject(subjectIds);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.groupingBy(item -> item.get("subjectId").toString()));
}
}
}
......@@ -88,7 +88,6 @@
sumType="page"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="120" align="right"
format="{0:C3}" sumType="page"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
......
......@@ -68,6 +68,7 @@
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" 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']"/>
......
......@@ -29,11 +29,12 @@
<EF:EFOption label="已处理" value="1"></EF:EFOption>
<EF:EFOption label="未处理" value="0"></EF:EFOption>
</EF:EFSelect>
<EF:EFInput cname="收货单号" ename="receiveNo" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" height="68vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="problemPhoto" cname="问题照片" locked="true" enable="false" width="100" align="center"
required="true"/>
......
......@@ -165,6 +165,8 @@ $(function () {
// result4Grid.dataSource.page(1);
result5Grid.dataSource.page(1);
})
// 打开复制权限页面
$("#COPY_3").on("click", copyAuth);
},
onSave: (e) => {
if (resultGrid?.getCheckedRows()?.length === 1 && resultGrid?.getCheckedRows()[0].id !== lastUserGroupId) {
......@@ -402,6 +404,38 @@ const authImpl = (grid, operation = "ACCESS", objectType = "RESOURCE_GROUP") =>
$("#authWindow").data("kendoWindow").close();
}
/**
* 复制角色权限
*/
const copyAuth = function () {
let checkRows = resultGrid.getCheckedRows();
if (checkRows.length < 1) {
IPLAT.alert("请在角色列表中勾选一行数据");
return;
}
let groupCname = checkRows[0].groupCname;
let params = {
"inqu_status-0-mainGroupEname": checkRows[0].groupEname
}
JSColorbox.open({
href: "XS3201B",
title: "<div style='text-align: center;'>正在复制:【" + groupCname + "】的菜单权限...</div>",
width: "70%",
height: "80%",
params: params,
callbackName: copyAuthCallback
});
}
/**
* 复制授权回调
*
* @param res
*/
const copyAuthCallback = function (res) {
}
let resultGridHeight;
window.onload = () => {
const tab_Strip = $("#resourceTab").data("kendoTabStrip");
......
......@@ -41,7 +41,7 @@
<%-- </EF:EFRegion>--%>
<%-- <EF:EFRegion id="userGroupTable" title="用户组信息" style="overflow-y:auto">--%>
<div style="margin-bottom: 0px">
<EF:EFGrid blockId="result" autoDraw="no" serviceName="XS02" personal="true" checkMode="single">
<EF:EFGrid blockId="result" autoDraw="no" serviceName="XS02" personal="true" checkMode="row,single">
<EF:EFColumn ename="groupId" cname="用户群组ID" readonly="false" hidden="true"
primaryKey="true"/>
<EF:EFColumn ename="groupEname" cname="角色英文名" style="text-align:left;" readonly="true"
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 100, 150],
},
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 确认
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"复制\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "XS3201B", "confirm",
false, function (res) {
message(res.msg);
if (res.status !== -1) {
parent.JSColorbox.setValueCallback(res);
}
}
);
}
});
}
<!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="查询条件">
<EF:EFInput ename="mainGroupEname" cname="主角色英文名" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="groupEname" cname="角色英文名" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput ename="groupCname" cname="角色中文名" blockId="inqu_status" row="0" colWidth="4"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh">
<EF:EFColumn ename="groupId" cname="用户群组ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="groupEname" cname="角色英文名" enable="false" width="120" align="left"/>
<EF:EFColumn ename="groupCname" cname="角色中文名" enable="false" width="120" align="left"/>
<EF:EFColumn ename="recCreateTime" cname="创建时间" enable="false" width="150" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"
dateFormat="yyyy-MM-dd HH:mm:ss" displayType="datetime"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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