Commit 88d5cc85 by liuyang

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

parents 3c166634 c6ecd1f4
...@@ -12,7 +12,9 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -12,7 +12,9 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -57,7 +59,38 @@ public class DaoUtils { ...@@ -57,7 +59,38 @@ public class DaoUtils {
} }
DaoBase.getInstance().insert(sql, obj); DaoBase.getInstance().insert(sql, obj);
} }
/**
* insertBatch method.
*
* @param sql
* @param rows
*/
public static void batchInsert(String sql, List rows) {
// 创建人部门
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
String depCode = orgIds.get(0);
for (Object row : rows) {
if (row instanceof DaoEPBase) {
DaoEPBase daoEPBase = (DaoEPBase) row;
try {
BeanUtils.setProperty(daoEPBase, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
setCreator(daoEPBase);
} else if (row instanceof Map) {
Map map = (Map) row;
map.put("depCode", depCode);
setCreator(map);
}
}
Map paramMap = new HashMap();
paramMap.put("rows", rows);
DaoBase.getInstance().insert(sql, paramMap);
}
/** /**
* update method. * update method.
* *
...@@ -106,7 +139,7 @@ public class DaoUtils { ...@@ -106,7 +139,7 @@ public class DaoUtils {
}); });
return DaoBase.getInstance().insertBatch(sql, parameters); return DaoBase.getInstance().insertBatch(sql, parameters);
} }
/** /**
* 创建人工号 创建人姓名 创建人岗号 创建时刻 * 创建人工号 创建人姓名 创建人岗号 创建时刻
* *
......
...@@ -108,17 +108,6 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -108,17 +108,6 @@ public class ServiceHGCG003 extends ServiceBase {
DaoUtils.update(HGCG003.UPDATE, hgcg003); DaoUtils.update(HGCG003.UPDATE, hgcg003);
} }
} }
// 合同过来的数据不让修改
// // 采购收货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.checkEditData(fCg003s, dbCg003Map);
// // 修改数据
// this.editData(fCg003s, dbCg003Map, dbCg002AMap);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!");
...@@ -127,35 +116,21 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -127,35 +116,21 @@ public class ServiceHGCG003 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 保存数据
*
* @param hgcg003
*/
private void saveData(HGCG003 hgcg003) { private void saveData(HGCG003 hgcg003) {
// 新增数据 // 新增数据
hgcg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO)); hgcg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
hgcg003.setStatus(HGConstant.CgReceiveStatus.S_0); hgcg003.setStatus(HGConstant.CgReceiveStatus.S_2);
hgcg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); hgcg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003.setSource(HGConstant.CgSource.SDLR); hgcg003.setSource(HGConstant.CgSource.SDLR);
hgcg003.setReceiveDate(DateUtils.formatShort(hgcg003.getReceiveDate())); hgcg003.setReceiveDate(DateUtils.formatShort(hgcg003.getReceiveDate()));
DaoUtils.insert(HGCG003.INSERT, hgcg003); DaoUtils.insert(HGCG003.INSERT, hgcg003);
} }
/**
* 数据校验
*
* @param fCg003s
* @param dbCg003Map
*/
private void checkEditData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) {
List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO);
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()));
}
}
/** /**
* 数据修改,修改合同数据 * 数据修改,修改合同数据
...@@ -218,8 +193,8 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -218,8 +193,8 @@ public class ServiceHGCG003 extends ServiceBase {
String receiveNo = fCg003.getReceiveNo(); String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo); HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
} }
} }
......
...@@ -227,7 +227,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -227,7 +227,7 @@ public class ServiceHGCG003A extends ServiceBase {
.reduce(BigDecimal.ZERO, BigDecimal::add)); .reduce(BigDecimal.ZERO, BigDecimal::add));
// 计算总税额 // 计算总税额
newCg003.setTaxAmount(fCg002Bs.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); newCg003.setTaxAmount(fCg002Bs.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0); newCg003.setStatus(HGConstant.CgReceiveStatus.S_2);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg003.setSource(HGConstant.CgSource.DEFAULT); newCg003.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG003.INSERT, newCg003); DaoUtils.insert(HGCG003.INSERT, newCg003);
...@@ -258,7 +258,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -258,7 +258,7 @@ public class ServiceHGCG003A extends ServiceBase {
cg003B.setContractDetailId(fCg002B.getId()); cg003B.setContractDetailId(fCg002B.getId());
cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount()); cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount());
cg003B.setCalculationMethod(fCg002B.getCalculationMethod()); cg003B.setCalculationMethod(fCg002B.getCalculationMethod());
cg003B.setStatus(HGConstant.CgReceiveStatus.S_0); cg003B.setStatus(HGConstant.CgReceiveStatus.S_2);
cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG003B.INSERT, cg003B); DaoUtils.insert(HGCG003B.INSERT, cg003B);
// 更新合同状态 // 更新合同状态
......
...@@ -143,8 +143,8 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -143,8 +143,8 @@ public class ServiceHGCG003B extends ServiceBase {
String receiveNo = fCg003B.getReceiveNo(); String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003Map.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003Map.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, cg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
AssertUtils.isGt(BigDecimal.ZERO, fCg003B.getReceiveQty(), AssertUtils.isGt(BigDecimal.ZERO, fCg003B.getReceiveQty(),
String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003B.getReceiveQty())); String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003B.getReceiveQty()));
// 校验合同数量 // 校验合同数量
...@@ -198,7 +198,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -198,7 +198,7 @@ public class ServiceHGCG003B extends ServiceBase {
private void addData(HGCG003B hgcg003B, HGCG003 cg003) { private void addData(HGCG003B hgcg003B, HGCG003 cg003) {
hgcg003B.setPrimaryId(cg003.getId()); hgcg003B.setPrimaryId(cg003.getId());
hgcg003B.setReceiveNo(cg003.getReceiveNo()); hgcg003B.setReceiveNo(cg003.getReceiveNo());
hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_0); hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_2);
hgcg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); hgcg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003B.setReceiveDate(DateUtils.formatShort(cg003.getReceiveDate())); hgcg003B.setReceiveDate(DateUtils.formatShort(cg003.getReceiveDate()));
hgcg003B.setCompanyCode(cg003.getCompanyCode()); hgcg003B.setCompanyCode(cg003.getCompanyCode());
...@@ -277,8 +277,8 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -277,8 +277,8 @@ public class ServiceHGCG003B extends ServiceBase {
String receiveNo = fCg003B.getReceiveNo(); String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, cg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
} }
} }
......
...@@ -189,6 +189,9 @@ ...@@ -189,6 +189,9 @@
<isNotEmpty prepend=" AND " property="primaryIds"> <isNotEmpty prepend=" AND " property="primaryIds">
PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate> PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNos">
RECEIVE_NO IN <iterate open="(" close=")" conjunction="," property="receiveNos">#receiveNos[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="updateRevise"> <sql id="updateRevise">
...@@ -480,12 +483,12 @@ ...@@ -480,12 +483,12 @@
<isNotEmpty prepend=" AND " property="purUserName"> <isNotEmpty prepend=" AND " property="purUserName">
b.PUR_USER_NAME = #purUserName# b.PUR_USER_NAME = #purUserName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
b.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source"> <isNotEmpty prepend=" AND " property="source">
b.SOURCE = #source# b.SOURCE = #source#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
a.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="cancelAmount"> <isNotEmpty prepend=" AND " property="cancelAmount">
a.CANCEL_AMOUNT = #cancelAmount# a.CANCEL_AMOUNT = #cancelAmount#
</isNotEmpty> </isNotEmpty>
......
...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.utils; ...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.utils;
import com.baosight.hggp.hg.cg.domain.*; import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.utils.HGUtils; import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
...@@ -87,7 +88,33 @@ public class HGCGUtils { ...@@ -87,7 +88,33 @@ public class HGCGUtils {
// db数据 // db数据
return HGCGTools.HgCg002.map(contractNos); return HGCGTools.HgCg002.map(contractNos);
} }
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public static Map<Long, HGCG002A> lockGetDataById(List<Long> ids) {
// 锁
HGCGTools.HgCg002.lockById(ids);
// db数据
return HGCGTools.HgCg002.mapByIds(ids);
}
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public static List<HGCG002A> lockGetDatasById(List<Long> ids) {
// 锁
HGCGTools.HgCg002.lockById(ids);
// db数据
return HGCGTools.HgCg002.listByIds(ids);
}
} }
/** /**
...@@ -155,7 +182,7 @@ public class HGCGUtils { ...@@ -155,7 +182,7 @@ public class HGCGUtils {
public static Map<String, HGCG003> lockGetDataEp(List<? extends HGCG003> fCg003s) { public static Map<String, HGCG003> lockGetDataEp(List<? extends HGCG003> fCg003s) {
return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO)); return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -168,7 +195,32 @@ public class HGCGUtils { ...@@ -168,7 +195,32 @@ public class HGCGUtils {
// db数据 // db数据
return HGCGTools.HgCg003.map(receiveNos); return HGCGTools.HgCg003.map(receiveNos);
} }
/**
* 根据明细状态计算主状态
*
* @param statuses
* @return
*/
public static Integer calcStatus(List<Integer> statuses) {
Integer status;
// 明细只有一种状态时,主状态与明细一致;明细状态存在多种时,取最低的状态
if (statuses.size() != 1) {
if (statuses.contains(HGConstant.CgReceiveStatus.S_2)) {
status = HGConstant.CgReceiveStatus.S_2;
} else if (statuses.contains(HGConstant.CgReceiveStatus.S_3)) {
status = HGConstant.CgReceiveStatus.S_3;
} else if (statuses.contains(HGConstant.CgReceiveStatus.S_4)) {
status = HGConstant.CgReceiveStatus.S_4;
} else {
status = HGConstant.CgReceiveStatus.S_5;
}
} else {
status = statuses.get(0);
}
return status;
}
} }
/** /**
......
...@@ -136,7 +136,10 @@ public class HGConstant { ...@@ -136,7 +136,10 @@ public class HGConstant {
public static final String WD_FILE_ID = "WD_FILE_ID"; public static final String WD_FILE_ID = "WD_FILE_ID";
// 回访单号 // 回访单号
public static final String FOL_NO = "FOL_NO"; public static final String FOL_NO = "FOL_NO";
// 维修单号
public static final String REP_ORDER_NO = "REP_ORDER_NO";
} }
/** /**
...@@ -191,8 +194,6 @@ public class HGConstant { ...@@ -191,8 +194,6 @@ public class HGConstant {
*/ */
public static class CgReceiveStatus { public static class CgReceiveStatus {
// 待确认
public static final Integer S_0 = 0;
// 已收货 // 已收货
public static final Integer S_2 = 2; public static final Integer S_2 = 2;
// 质检中 // 质检中
......
...@@ -22,7 +22,9 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -22,7 +22,9 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages; import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.google.common.collect.Lists;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -189,11 +191,14 @@ public class ServiceHGKC001 extends ServiceBase { ...@@ -189,11 +191,14 @@ public class ServiceHGKC001 extends ServiceBase {
HGKC001 dbKc001 = dbKc001Map.get(depositNo); HGKC001 dbKc001 = dbKc001Map.get(depositNo);
dbKc001.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); dbKc001.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGKC001.DELETE, dbKc001); DaoUtils.update(HGKC001.DELETE, dbKc001);
// 扣减库存 // 已提交状态需要扣减库存
HGKCUtils.HgKc010.updateInv(dbKc001.getCompanyCode(), dbKc001.getWhCode(), dbKc001.getInventCode(), if (HGConstant.ProductStatus.YTJ.equals(dbKc001.getSubmitStatus())) {
dbKc001.getDepositQty().negate(), dbKc001.getDepositWeight().negate()); HGKCUtils.HgKc010.updateInv(dbKc001.getCompanyCode(), dbKc001.getWhCode(), dbKc001.getInventCode(),
dbKc001.getDepositQty().negate(), dbKc001.getDepositWeight().negate());
}
// 更新收货单状态 // 更新收货单状态
HGCGTools.HgCg003.updateStatus(dbKc001.getReceiveNo(), HGConstant.CgReceiveStatus.S_2); HGCGTools.HgCg003B.updateDeposit(dbKc001.getReceiveDetailId(), BigDecimal.ZERO, BigDecimal.ZERO);
HGCGTools.HgCg003.updateReceiveMain(Lists.newArrayList(dbKc001.getReceiveNo()));
} }
} }
......
...@@ -21,6 +21,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ007; ...@@ -21,6 +21,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC008; import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.zl.domain.HGZL001;
import com.baosight.hggp.hg.zl.domain.HGZL002; import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004; import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
...@@ -105,19 +106,23 @@ public class HGKCTools { ...@@ -105,19 +106,23 @@ public class HGKCTools {
List<HGKC001> results = list(depositNos); List<HGKC001> results = list(depositNos);
return results.stream().collect(Collectors.toMap(HGKC001::getDepositNo, item -> item)); return results.stream().collect(Collectors.toMap(HGKC001::getDepositNo, item -> item));
} }
/** /**
* 生产入库(入库质检单) * 生产入库(入库质检单)
* *
* @param dbCg003B * @param dbCg003B
*/ */
public static void putInStorageData(HGCG003B dbCg003B) { public static void putInStorageData(HGZL001 fZl001, HGCG003B dbCg003B) {
// 无合格数量时,不入库
if (fZl001.getQualifyQty().compareTo(BigDecimal.ZERO) < 1) {
return;
}
HGKC001 newKc001 = BeanUtils.copy(dbCg003B, HGKC001.class); HGKC001 newKc001 = BeanUtils.copy(dbCg003B, HGKC001.class);
newKc001.setDepositDate(DateUtils.shortDate()); newKc001.setDepositDate(DateUtils.shortDate());
newKc001.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_DEPOSIT_NO)); newKc001.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_DEPOSIT_NO));
newKc001.setDepositQty(dbCg003B.getDepositQty()); newKc001.setDepositQty(fZl001.getQualifyQty());
newKc001.setDepositUnitWeight(dbCg003B.getReceiveUnitWeight()); newKc001.setDepositUnitWeight(dbCg003B.getReceiveUnitWeight());
newKc001.setDepositWeight(dbCg003B.getDepositQty().multiply(dbCg003B.getReceiveUnitWeight())); newKc001.setDepositWeight(fZl001.getQualifyQty().multiply(dbCg003B.getReceiveUnitWeight()));
newKc001.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newKc001.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newKc001.setSubmitStatus(HGConstant.ProductStatus.WTJ); newKc001.setSubmitStatus(HGConstant.ProductStatus.WTJ);
newKc001.setStorageType(HGConstant.StorageType.RK); newKc001.setStorageType(HGConstant.StorageType.RK);
......
...@@ -283,7 +283,7 @@ public class HGKCUtils { ...@@ -283,7 +283,7 @@ public class HGKCUtils {
* @param weight * @param weight
*/ */
public static void updateInv(String companyCode, String whCode, String inventCode, BigDecimal qty, public static void updateInv(String companyCode, String whCode, String inventCode, BigDecimal qty,
BigDecimal unitWeight, BigDecimal weight) { BigDecimal unitWeight, BigDecimal weight) {
HGKC010 newKc010 = buildBean(companyCode, whCode, inventCode, qty, unitWeight, weight); HGKC010 newKc010 = buildBean(companyCode, whCode, inventCode, qty, unitWeight, weight);
// 参数校验 // 参数校验
checkUpdateInv(companyCode, whCode, inventCode, qty, weight); checkUpdateInv(companyCode, whCode, inventCode, qty, weight);
......
...@@ -159,44 +159,40 @@ public class ServiceHGSC003 extends ServiceBase { ...@@ -159,44 +159,40 @@ public class ServiceHGSC003 extends ServiceBase {
DaoUtils.update(HGSC003.UPDATE_BLUEPRINT_STATUS, hgsc003); DaoUtils.update(HGSC003.UPDATE_BLUEPRINT_STATUS, hgsc003);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) { } catch (PlatException e) {
e.printStackTrace(); e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e); ErrorCodeUtils.handleUpdateException(inInfo, i, e);
logError("修改失败", e.getMessage()); logError("修改失败", e.getMessage());
return inInfo; return inInfo;
} }
return inInfo; return inInfo;
} }
/** /**
* 项目档案下拉框 * 项目档案下拉框
* @param inInfo *
* @return * @param inInfo
*/ * @return
public EiInfo projComboBox(EiInfo inInfo){ */
Map queryMap = EiInfoUtils.getFirstRow(inInfo); public EiInfo projComboBox(EiInfo inInfo) {
String companyCode = MapUtils.getString(queryMap, HGSC001.FIELD_company_code); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String approvalStatus = MapUtils.getString(queryMap, HGSC001.FIELD_approval_status); queryMap.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
Map map = new HashMap(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID), queryMap, false);
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode()); return inInfo;
map.put(HGSC001.FIELD_company_code, companyCode); }
map.put(HGSC001.FIELD_approval_status, approvalStatus);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID), map,false); /**
return inInfo; * 蓝图查询下拉框
*
} * @param inInfo
* @return
/** */
* 蓝图查询下拉框 public EiInfo blueprintComboBox(EiInfo inInfo) {
* @param inInfo Map queryMap = EiInfoUtils.getFirstRow(inInfo);
* @return String companyCode = MapUtils.getString(queryMap, HGSC003.FIELD_company_code);
*/ String blueprintStatus = MapUtils.getString(queryMap, HGSC003.FIELD_blueprint_status);
public EiInfo blueprintComboBox(EiInfo inInfo){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC003.FIELD_company_code);
String blueprintStatus = MapUtils.getString(queryMap, HGSC003.FIELD_blueprint_status);
String projCode = MapUtils.getString(queryMap, HGSC003.FIELD_proj_code); String projCode = MapUtils.getString(queryMap, HGSC003.FIELD_proj_code);
Map map = new HashMap(); Map map = new HashMap();
map.put(HGSC003.FIELD_account_code, UserSessionUtils.getAccountCode()); map.put(HGSC003.FIELD_account_code, UserSessionUtils.getAccountCode());
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
proj_code = #projCode# proj_code = #projCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projName"> <isNotEmpty prepend=" AND " property="projName">
proj_name like ('%$projName$%') proj_name like '%$projName$%'
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projType"> <isNotEmpty prepend=" AND " property="projType">
proj_type = #projType# proj_type = #projType#
......
...@@ -1329,7 +1329,7 @@ public class HGSCTools { ...@@ -1329,7 +1329,7 @@ public class HGSCTools {
} }
} }
} }
return workHour.get().divide(baseWorkHour, 0, ROUND_DOWN); return workHour.get();
} }
/** /**
......
...@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.xs.constant; ...@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.xs.constant;
public class HgXsConstant { public class HgXsConstant {
/** /**
* 状态 * 回访状态
* *
* @author:songx * @author:songx
* @date:2024/5/7,16:36 * @date:2024/5/7,16:36
...@@ -20,4 +20,17 @@ public class HgXsConstant { ...@@ -20,4 +20,17 @@ public class HgXsConstant {
public static final Integer S1 = 1; public static final Integer S1 = 1;
} }
/**
* 维修状态
*
* @author:songx
* @date:2024/5/7,16:36
*/
public static class RepStatus {
// 待维修
public static final Integer S0 = 0;
// 已维修
public static final Integer S1 = 1;
}
} }
...@@ -29,6 +29,20 @@ public class HgXsSqlConstant { ...@@ -29,6 +29,20 @@ public class HgXsSqlConstant {
} }
/** /**
* 售后维修
*
* @author:songx
* @date:2024/5/7,16:36
*/
public static class HgXs006 {
// 审核
public static final String CHECK = "HGXS006.check";
// 锁
public static final String LOCK = "HGXS006.lock";
}
/**
* 客户回访 * 客户回访
* *
* @author:songx * @author:songx
......
package com.baosight.hggp.hg.xs.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.xs.constant.HgXsConstant;
import com.baosight.hggp.hg.xs.constant.HgXsSqlConstant;
import com.baosight.hggp.hg.xs.domain.HGXS006;
import com.baosight.hggp.hg.xs.domain.HGXS007;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.AssertUtils;
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.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 售后维修
*
* @author:songx
* @date:2024/8/27,9:05
*/
public class ServiceHGXS006 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGXS006().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "客户回访", operType = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGXS006.FIELD_REP_DATE, DateUtils.formatShort(queryMap.get(HGXS006.FIELD_REP_DATE)));
inInfo = super.query(inInfo, HGXS006.QUERY, new HGXS006());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGXS006> fXs006s = MapUtils.toDaoEPBases(inInfo, HGXS006.class);
Map<Long, HGXS006> dbXs006s = HGXSUtils.HgXs006.lockAndGet(fXs006s);
for (HGXS006 fXs006 : fXs006s) {
Long id = fXs006.getId();
HGXS006 dbXs006 = dbXs006s.get(id);
this.checkData(dbXs006);
DaoUtils.update(HGXS006.DELETE, fXs006);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fXs006s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 审核
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "审核")
public EiInfo check(EiInfo inInfo) {
try {
List<HGXS006> fXs006s = MapUtils.toDaoEPBases(inInfo, HGXS006.class);
Map<Long, HGXS006> dbXs006s = HGXSUtils.HgXs006.lockAndGet(fXs006s);
for (HGXS006 fXs006 : fXs006s) {
Long id = fXs006.getId();
HGXS006 dbXs006 = dbXs006s.get(id);
this.checkData(dbXs006);
fXs006.setRepStatus(HgXsConstant.RepStatus.S1);
DaoUtils.update(HgXsSqlConstant.HgXs006.CHECK, fXs006);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fXs006s.size() + "]条数据审核成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "审核失败");
}
return inInfo;
}
/**
* 检查状态
*
* @param inInfo
* @return
*/
public EiInfo checkStatus(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
Long id = MapUtils.getLong(queryMap, HGXS006.FIELD_ID);
HGXS006 dbXs006 = HGXSUtils.HgXs006.lockAndGet(id);
this.checkData(dbXs006);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param dbXs006
*/
private void checkData(HGXS006 dbXs006) {
AssertUtils.isNotEquals(dbXs006.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("回访单【%s】不是\"未删除\"状态,不允许操作", dbXs006.getId()));
AssertUtils.isNotEquals(dbXs006.getRepStatus(), HgXsConstant.RepStatus.S0,
String.format("回访单【%s】不是\"待维修\"状态,不允许操作", dbXs006.getId()));
}
}
package com.baosight.hggp.hg.xs.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
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.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.xs.constant.HgXsConstant;
import com.baosight.hggp.hg.xs.domain.HGXS006;
import com.baosight.hggp.hg.xs.domain.HGXS007;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.AssertUtils;
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.StringUtils;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHGXS0061 extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID));
this.setProjectInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户回访", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
HGXS006 fXs006 = MapUtils.toDaoEPBase(inInfo, HGXS006.class);
fXs006.setRepDate(DateUtils.formatShort(fXs006.getRepDate()));
if (StringUtils.isBlank(fXs006.getRepOrderNo())) {
this.add(fXs006);
} else {
this.modify(fXs006);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fXs006
*/
private void add(HGXS006 fXs006) {
fXs006.setRepOrderNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.REP_ORDER_NO));
fXs006.setRepStatus(HgXsConstant.RepStatus.S0);
fXs006.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGXS006.INSERT, fXs006);
}
/**
* 修改数据
*
* @param fXs006
*/
private void modify(HGXS006 fXs006) {
HGXS006 dbXs006 = HGXSUtils.HgXs006.lockAndGet(fXs006);
this.checkData(dbXs006);
DaoUtils.update(HGXS006.UPDATE, fXs006);
}
/**
* 设置项目信息
*
* @param inInfo
*/
public void setProjectInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
Long id = MapUtils.getLong(queryRow, HGXS006.FIELD_ID);
if (id == null) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HGXSTools.HgXs006.get(id));
resultBlock.addBlockMeta(new HGXS006().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 数据校验
*
* @param dbXs006
*/
private void checkData(HGXS006 dbXs006) {
AssertUtils.isNotEquals(dbXs006.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("维修单【%s】不是\"未删除\"状态,不允许操作", dbXs006.getId()));
AssertUtils.isNotEquals(dbXs006.getRepStatus(), HgXsConstant.FolStatus.S0,
String.format("维修单【%s】不是\"待维修\"状态,不允许操作", dbXs006.getId()));
}
}
<?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="HGXS006">
<sql id="column">
ID as "id", <!-- 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", <!-- 公司名称 -->
REP_ORDER_NO as "repOrderNo", <!-- 维修单号 -->
REP_DATE as "repDate", <!-- 维修日期 -->
REP_CUSTOM_ID as "repCustomId", <!-- 客户人员ID -->
REP_CUSTOM_NAME as "repCustomName", <!-- 客户人员姓名 -->
REP_USER_ID as "repUserId", <!-- 维修人员 -->
REP_USER_NAME as "repUserName", <!-- 维修人员姓名 -->
REP_STATUS as "repStatus" <!-- 维修状态 0-待维修 1-已维修 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="HGXSDataAuth.authCondition"/>
<include refid="idCondition"/>
<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="repOrderNo">
REP_ORDER_NO = #repOrderNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repDate">
REP_DATE = #repDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repCustomId">
REP_CUSTOM_ID = #repCustomId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repCustomName">
REP_CUSTOM_NAME LIKE CONCAT('%', #repCustomName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repUserId">
REP_USER_ID = #repUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repUserName">
REP_USER_NAME LIKE CONCAT('%', #repUserName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repStatus">
REP_STATUS = #repStatus#
</isNotEmpty>
</sql>
<sql id="idCondition">
<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="repOrderNo">
REP_ORDER_NO = #repOrderNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="repOrderNos">
REP_ORDER_NO IN <iterate open="(" close=")" conjunction="," property="repOrderNos">#repOrderNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.HGXS006">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGXS006
WHERE 1=1
<include refid="condition" />
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGXS006 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGXS006 (
ACCOUNT_CODE, <!-- 账套 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
REP_ORDER_NO, <!-- 维修单号 -->
REP_DATE, <!-- 维修日期 -->
REP_CUSTOM_ID, <!-- 客户人员ID -->
REP_CUSTOM_NAME, <!-- 客户人员姓名 -->
REP_USER_ID, <!-- 维修人员 -->
REP_USER_NAME, <!-- 维修人员姓名 -->
REP_STATUS <!-- 维修状态 0-待维修 1-已维修 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #repOrderNo#, #repDate#, #repCustomId#,
#repCustomName#, #repUserId#, #repUserName#, #repStatus#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGXS006
SET DELETE_FLAG = 1,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGXS006
SET
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
REP_DATE = #repDate#, <!-- 维修日期 -->
REP_CUSTOM_ID = #repCustomId#, <!-- 客户人员ID -->
REP_CUSTOM_NAME = #repCustomName#, <!-- 客户人员姓名 -->
REP_USER_ID = #repUserId#, <!-- 维修人员 -->
REP_USER_NAME = #repUserName#, <!-- 维修人员姓名 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGXS006
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 审核 -->
<update id="check">
UPDATE ${hggpSchema}.HGXS006
SET
REP_STATUS = #repStatus#, <!-- 状态 0-待维修 1-已维修 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUserName">
USER_NAME LIKE CONCAT('%', #accountCode#, '%')
</isNotEmpty>
</sql> </sql>
<!-- 查询用户信息 --> <!-- 查询用户信息 -->
......
...@@ -5,6 +5,7 @@ import com.baosight.hggp.core.enums.OrgTypeEnum; ...@@ -5,6 +5,7 @@ import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.xs.constant.HgXsSqlConstant; import com.baosight.hggp.hg.xs.constant.HgXsSqlConstant;
import com.baosight.hggp.hg.xs.domain.HGXS006;
import com.baosight.hggp.hg.xs.domain.HGXS007; import com.baosight.hggp.hg.xs.domain.HGXS007;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
...@@ -36,6 +37,84 @@ import java.util.stream.Collectors; ...@@ -36,6 +37,84 @@ import java.util.stream.Collectors;
public class HGXSTools { public class HGXSTools {
/** /**
* 售后维修
*
* @author:songx
* @date:2024/9/13,10:40
*/
public static class HgXs006 {
/**
* 锁.
*
* @param id ID
*/
public static void lock(Long id) {
AssertUtils.isNull(id, "ID不能为空!");
Map<String, Object> map = new HashMap<>();
map.put(HGXS006.FIELD_ID, id);
DaoBase.getInstance().update(HgXsSqlConstant.HgXs006.LOCK, map);
}
/**
* 锁.
*
* @param ids ID
*/
public static void lock(List<Long> ids) {
AssertUtils.isEmpty(ids, "ID不能为空!");
Map<String, Object> map = new HashMap<>();
map.put("ids", ids);
DaoBase.getInstance().update(HgXsSqlConstant.HgXs006.LOCK, map);
}
/**
* 查询
*
* @param id ID
* @return
*/
public static HGXS006 get(Long id) {
if (id == null) {
return null;
}
Map<String, Object> paramMap = new HashMap();
paramMap.put(HGXS006.FIELD_ID, id);
List<HGXS006> results = DaoBase.getInstance().query(HGXS006.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param ids ID
* @return
*/
public static List<HGXS006> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGXS006.QUERY, paramMap);
}
/**
* 查询
*
* @param ids ID
* @return
*/
public static Map<Long, HGXS006> map(List<Long> ids) {
List<HGXS006> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HGXS006::getId, item -> item));
}
}
/**
* 客户回访 * 客户回访
* *
* @author:songx * @author:songx
...@@ -106,6 +185,9 @@ public class HGXSTools { ...@@ -106,6 +185,9 @@ public class HGXSTools {
*/ */
public static Map<Long, HGXS007> map(List<Long> ids) { public static Map<Long, HGXS007> map(List<Long> ids) {
List<HGXS007> results = list(ids); List<HGXS007> results = list(ids);
if(CollectionUtils.isEmpty(results)){
return null;
}
return results.stream().collect(Collectors.toMap(HGXS007::getId, item -> item)); return results.stream().collect(Collectors.toMap(HGXS007::getId, item -> item));
} }
} }
......
package com.baosight.hggp.hg.xs.utils; package com.baosight.hggp.hg.xs.utils;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.xs.domain.HGXS006;
import com.baosight.hggp.hg.xs.domain.HGXS007; import com.baosight.hggp.hg.xs.domain.HGXS007;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
...@@ -140,6 +141,52 @@ public class HGXSUtils { ...@@ -140,6 +141,52 @@ public class HGXSUtils {
} }
/** /**
* 售后维修
*
* @author:songx
* @date:2024/9/13,10:39
*/
public static class HgXs006 {
/**
* 锁并获取数据
*
* @param id
* @return
*/
public static HGXS006 lockAndGet(Long id) {
// 锁
HGXSTools.HgXs006.lock(id);
// 查询数据
return HGXSTools.HgXs006.get(id);
}
/**
* 锁并获取数据
*
* @param fXs006
* @return
*/
public static HGXS006 lockAndGet(HGXS006 fXs006) {
return lockAndGet(fXs006.getId());
}
/**
* 锁并获取数据
*
* @param fXs006s
* @return
*/
public static Map<Long, HGXS006> lockAndGet(List<HGXS006> fXs006s) {
List<Long> ids = ObjectUtils.listEpKey(fXs006s, HGXS007.FIELD_ID);
// 锁
HGXSTools.HgXs006.lock(ids);
// 查询数据
return HGXSTools.HgXs006.map(ids);
}
}
/**
* 客户回访 * 客户回访
* *
* @author:songx * @author:songx
......
...@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002; import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG002B; import com.baosight.hggp.hg.cg.domain.HGCG002B;
import com.baosight.hggp.hg.cg.domain.HGCG003; import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B; import com.baosight.hggp.hg.cg.domain.HGCG003B;
...@@ -23,6 +24,7 @@ import com.baosight.hggp.util.CommonMethod; ...@@ -23,6 +24,7 @@ import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; 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.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
...@@ -206,13 +208,18 @@ public class ServiceHGZL001 extends ServiceBase { ...@@ -206,13 +208,18 @@ public class ServiceHGZL001 extends ServiceBase {
List<HGZL001> fZl001s = MapUtils.toDaoEPBases(inInfo, HGZL001.class); List<HGZL001> fZl001s = MapUtils.toDaoEPBases(inInfo, HGZL001.class);
Map<String, HGZL001> dbZl001Map = HGZLUtils.HgZl001.lockGetDataEp(fZl001s); Map<String, HGZL001> dbZl001Map = HGZLUtils.HgZl001.lockGetDataEp(fZl001s);
// 获取收货明细数据 // 获取收货明细数据
List<Long> receiveDetailIds = fZl001s.stream().map(HGZL001::getReceiveDetailId) List<Long> receiveDetailIds = ObjectUtils.listEpKey(fZl001s, "receiveDetailId");
.collect(Collectors.toList());
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetData(receiveDetailIds); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetData(receiveDetailIds);
// 合同明细数据
List<Long> contractDetailIds = ObjectUtils.listEpKey(dbCg003BMap.values(), "contractDetailId");
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(contractDetailIds);
// 合同主信息
List<Long> primaryIds = ObjectUtils.listEpKey(dbCg002BMap.values(), "primaryId");
List<HGCG002A> dbCg002As = HGCGUtils.HgCg002.lockGetDatasById(primaryIds);
// 数据校验 // 数据校验
this.checkProcessData(fZl001s, dbZl001Map, dbCg003BMap); this.checkProcessData(fZl001s, dbZl001Map, dbCg003BMap);
// 保存数据 // 保存数据
this.saveProcessData(fZl001s, dbZl001Map, dbCg003BMap); this.saveProcessData(fZl001s, dbZl001Map, dbCg003BMap, dbCg002BMap, dbCg002As);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fZl001s.size() + "]条数据处理成功!"); inInfo.setMsg("操作成功!本次对[" + fZl001s.size() + "]条数据处理成功!");
...@@ -253,9 +260,11 @@ public class ServiceHGZL001 extends ServiceBase { ...@@ -253,9 +260,11 @@ public class ServiceHGZL001 extends ServiceBase {
* @param fZl001s * @param fZl001s
* @param dbZl001Map * @param dbZl001Map
* @param dbCg003BMap * @param dbCg003BMap
* @param dbCg002BMap
* @param dbCg002As
*/ */
private void saveProcessData(List<HGZL001> fZl001s, Map<String, HGZL001> dbZl001Map, private void saveProcessData(List<HGZL001> fZl001s, Map<String, HGZL001> dbZl001Map,
Map<Long, HGCG003B> dbCg003BMap) { Map<Long, HGCG003B> dbCg003BMap, Map<Long, HGCG002B> dbCg002BMap, List<HGCG002A> dbCg002As) {
for (HGZL001 fZl001 : fZl001s) { for (HGZL001 fZl001 : fZl001s) {
// 更新质检单状态 // 更新质检单状态
String checkNo = fZl001.getCheckNo(); String checkNo = fZl001.getCheckNo();
...@@ -264,13 +273,14 @@ public class ServiceHGZL001 extends ServiceBase { ...@@ -264,13 +273,14 @@ public class ServiceHGZL001 extends ServiceBase {
dbZl001.setUnqualifyQty(fZl001.getUnqualifyQty()); dbZl001.setUnqualifyQty(fZl001.getUnqualifyQty());
dbZl001.setStatus(CommonConstant.YesNo.YES_1); dbZl001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSqlConstant.HgZl001.PROCESS, dbZl001); DaoUtils.update(HGSqlConstant.HgZl001.PROCESS, dbZl001);
// 更新收货明细 // 更新收货明细
this.updateReceiveDetail(fZl001, dbCg003BMap); this.updateReceiveDetail(fZl001, dbCg003BMap, dbCg002BMap);
} }
// 更新收货单主表信息 // 更新收货单主表信息,收货单号去重
this.updateReceiveMain(fZl001s); List<String> receiveNos = ObjectUtils.listEpKey(fZl001s, "receiveNo");
// 质检修改合同状态 HGCGTools.HgCg003.updateReceiveMain(receiveNos);
this.updateContract(fZl001s, dbCg003BMap); // 质检修改主合同状态
HGCGTools.HgCg002.updateReceiveMain(dbCg002As);
} }
/** /**
...@@ -278,88 +288,20 @@ public class ServiceHGZL001 extends ServiceBase { ...@@ -278,88 +288,20 @@ public class ServiceHGZL001 extends ServiceBase {
* *
* @param fZl001 * @param fZl001
* @param dbCg003BMap * @param dbCg003BMap
* @param dbCg002BMap
*/ */
private void updateReceiveDetail(HGZL001 fZl001, Map<Long, HGCG003B> dbCg003BMap) { private void updateReceiveDetail(HGZL001 fZl001, Map<Long, HGCG003B> dbCg003BMap, Map<Long, HGCG002B> dbCg002BMap) {
Long receiveDetailId = fZl001.getReceiveDetailId(); Long receiveDetailId = fZl001.getReceiveDetailId();
HGCG003B dbCg003B = dbCg003BMap.get(receiveDetailId);
// 更新采购收货明细的入库数量 // 更新采购收货明细的入库数量
Map<String, Object> paramDetailMap = new HashMap<>(); HGCGTools.HgCg003B.updateDeposit(receiveDetailId, fZl001.getQualifyQty(), fZl001.getUnqualifyQty());
paramDetailMap.put(HGCG003B.FIELD_ID, receiveDetailId); // 更新合同明细的收货数量
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_4); HGCG002B dbCg002B = dbCg002BMap.get(dbCg003B.getContractDetailId());
paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, fZl001.getUnqualifyQty()); BigDecimal unqualifyQty = fZl001.getUnqualifyQty().negate();
paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, fZl001.getQualifyQty()); BigDecimal unqualifyWeight = unqualifyQty.multiply(dbCg003B.getReceiveUnitWeight());
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap); HGCGTools.HgCg002B.updateReceive(dbCg002B, unqualifyQty, unqualifyWeight);
// 生成采购入库单 // 生成采购入库单
HGKCTools.HgKc001.putInStorageData(dbCg003BMap.get(receiveDetailId)); HGKCTools.HgKc001.putInStorageData(fZl001, dbCg003B);
}
/**
* 更新收货单状态
*
* @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);
}
} }
} }
...@@ -71,7 +71,7 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -71,7 +71,7 @@ public class ServiceHGZL001B extends ServiceEPBase {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGCG003.FIELD_SOURCE, HGConstant.CgSource.DEFAULT); queryMap.put(HGCG003.FIELD_SOURCE, HGConstant.CgSource.DEFAULT);
queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0); queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
inInfo = super.query(inInfo, HgCgSqlConst.HgCg003A.QUERY_BY_QUALITY_TESTING, new HGCG003B1()); inInfo = super.query(inInfo, HgCgSqlConst.HgCg003A.QUERY_BY_QUALITY_TESTING, new HGCG003B1());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -90,11 +90,8 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -90,11 +90,8 @@ public class ServiceHGZL001B extends ServiceEPBase {
try { try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// Map<Long, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
// 数据校验 // 数据校验
this.checkConfirmData(fCg003Bs, dbCg003BMap,cg003); this.checkConfirmData(fCg003Bs, dbCg003BMap);
// 生成巡检单 // 生成巡检单
this.saveConfirmData(fCg003Bs, dbCg003BMap); this.saveConfirmData(fCg003Bs, dbCg003BMap);
} catch (Exception e) { } catch (Exception e) {
...@@ -102,20 +99,19 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -102,20 +99,19 @@ public class ServiceHGZL001B extends ServiceEPBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 校验数据 * 校验数据
* *
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003BMap * @param dbCg003BMap
*/ */
private void checkConfirmData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap,HGCG003 cg003) { private void checkConfirmData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap) {
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(), for (HGCG003B fCg003B : fCg003Bs) {
String.format("采购收货单[%s]状态不是\"待确认\",不允许操作", cg003.getReceiveNo())); HGCG003B dbSc003B = dbCg003BMap.get(fCg003B.getId());
// for (HGCG003B fCg003B : fCg003Bs) { AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, dbSc003B.getStatus(),
// HGCG003B dbSc003B = dbCg003BMap.get(fCg003B.getId()); String.format("采购收货单[%s]的状态不是\"已收货\",不允许操作", dbSc003B.getId()));
// }
// }
} }
/** /**
......
...@@ -124,11 +124,12 @@ public class ServiceXS3201B extends ServiceEPBase { ...@@ -124,11 +124,12 @@ public class ServiceXS3201B extends ServiceEPBase {
dbMainAuth.put("subjectId", groupId); dbMainAuth.put("subjectId", groupId);
dbMainAuth.put("recCreator", UserSessionUtils.getLoginName()); dbMainAuth.put("recCreator", UserSessionUtils.getLoginName());
dbMainAuth.put("recCreateTime", DateUtils.shortDateTime()); dbMainAuth.put("recCreateTime", DateUtils.shortDateTime());
dbMainAuth.put("archiveFlag", 0);
dbMainAuth.put("sortIndex", 0); dbMainAuth.put("sortIndex", 0);
return dbMainAuth; return dbMainAuth;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(filterAuths)) { if (CollectionUtils.isNotEmpty(filterAuths)) {
DaoUtils.insertBatch("XS07.insert", filterAuths); DaoUtils.batchInsert("XS07.batchInsert", filterAuths);
} }
} }
} }
......
...@@ -30,6 +30,18 @@ ...@@ -30,6 +30,18 @@
) )
</insert> </insert>
<insert id="batchInsert">
INSERT INTO ${platSchema}.XS_AUTHORIZATION (
SUBJECT_ID, SUBJECT_TYPE, OBJECT_ID, OBJECT_TYPE, OPERATION_TYPE, REC_CREATOR,
REC_CREATE_TIME, ARCHIVE_FLAG, SORT_INDEX
) VALUES
<iterate open="(" conjunction="), (" close=")" property="rows">
#rows[].subjectId#, #rows[].subjectType#, #rows[].objectId#, #rows[].objectType#,
#rows[].operationType#, #rows[].recCreator#, #rows[].recCreateTime#,
#rows[].archiveFlag#, #rows[].sortIndex#
</iterate>
</insert>
<select id="authorizationExists" resultClass="java.util.HashMap"> <select id="authorizationExists" resultClass="java.util.HashMap">
SELECT * FROM ${platSchema}.XS_AUTHORIZATION SELECT * FROM ${platSchema}.XS_AUTHORIZATION
WHERE 1=1 WHERE 1=1
......
...@@ -51,7 +51,7 @@ public class XsTools { ...@@ -51,7 +51,7 @@ public class XsTools {
AssertUtils.isEmpty(subjectId, "subjectId不能为空"); AssertUtils.isEmpty(subjectId, "subjectId不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("subjectId", subjectId); queryMap.put("subjectId", subjectId);
return DaoBase.getInstance().query("XS07.get", queryMap); return DaoBase.getInstance().queryAll("XS07.get", queryMap);
} }
/** /**
...@@ -62,7 +62,7 @@ public class XsTools { ...@@ -62,7 +62,7 @@ public class XsTools {
AssertUtils.isEmpty(subjectIds, "subjectId不能为空"); AssertUtils.isEmpty(subjectIds, "subjectId不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("subjectIds", subjectIds); queryMap.put("subjectIds", subjectIds);
return DaoBase.getInstance().query("XS07.get", queryMap); return DaoBase.getInstance().queryAll("XS07.get", queryMap);
} }
/** /**
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<!-- 数据权限 --> <!-- 数据权限 -->
<sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXSDataAuth.xml"/> <sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXSDataAuth.xml"/>
<!-- 客户服务-->
<sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXS006.xml"/>
<sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXS007.xml"/> <sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXS007.xml"/>
<!-- 工具 --> <!-- 工具 -->
......
...@@ -77,7 +77,8 @@ ...@@ -77,7 +77,8 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/> <EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" width="100" align="center" required="true"> <EF:EFComboColumn ename="calculationMethod" cname="计算方式" width="100" align="center" required="true"
copy="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/> <EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/> <EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect> </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" <EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#"> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 100, 200],
},
columns: [{
field: "operator",
template: function (item) {
let status = item.repStatus;
let template = '';
if (status && status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" '
+ 'onclick="modify(' + item.id + ')" >修改</a>&nbsp;&nbsp;';
}
return template;
}
}],
loadComplete: function (grid) {
},
onRowClick: function (e) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 新增
$("#ADD").on("click", add);
// 删除
$("#REMOVE").on("click", remove);
// 审核
$("#CHECK").on("click", check);
// 键盘按键
downKeyUp();
});
/**
* 页面加载完成
*/
$(window).load(function () {
// 查
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 新增
*/
let add = function () {
addOrUpdate("");
}
/**
* 修改
*/
let modify = function (id) {
let params = "inqu_status-0-id=" + id;
addOrUpdate(params);
}
/**
* 新增
*/
let addOrUpdate = function (params) {
JSColorbox.open({
href: "HGXS0061?" + params,
title: "<div style='text-align: center;'>" + (isBlank(params) ? "新增维修单" : "修改维修单") + "</div>",
width: "60%",
height: "70%",
callbackName: addOrUpdateCallback
});
}
/**
* 新增成功后回调
*/
let addOrUpdateCallback = function (res) {
// 消息
message(res.msg);
// 刷新列表
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 删除
*/
function remove() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HGXS006", "remove",
false, function (res) {
message(res.msg);
if (res.status > -1) {
resultGrid.dataSource.page(1);
}
}
);
}
})
}
/**
* 审核
*
* @param id
* @param auditStatus
*/
function check(id) {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HGXS006", "check",
false, function (res) {
message(res.msg);
if (res.status > -1) {
resultGrid.dataSource.page(1);
}
}
);
}
})
}
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="售后维修">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect 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:EFDatePicker cname="维修日期" ename="repDate" blockId="inqu_status" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="客户人员" ename="repCustomName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="维修人员" ename="repUserName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFSelect cname="维修状态" ename="repStatus" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.xs.repStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="ID" enable="false" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="220" align="left"/>
<EF:EFColumn ename="repOrderNo" cname="维修单号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="repDate" cname="维修日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFComboColumn ename="repStatus" cname="维修状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.xs.repStatus"/>
</EF:EFComboColumn>
<EF:EFColumn cname="客户人员" ename="repCustomName" enable="false" width="120" align="center"/>
<EF:EFColumn cname="维修人员" ename="repUserName" enable="false" width="120" align="center"/>
<EF:EFColumn cname="创建人" ename="createdName" enable="false" width="100" align="center"/>
<EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="150" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn cname="修改人" ename="updatedName" enable="false" width="100" align="center"/>
<EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="150" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']" dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFSelect = {
"result-0-companyCode": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = dataItem['textField'];
if (valueField) {
textField = textField.indexOf("-") > -1 ? textField.split("-")[1] : textField;
$("#result-0-companyName").val(textField);
} else {
$("#result-0-companyName").val("");
}
}
},
"result-0-repCustomId": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = dataItem['textField'];
if (valueField) {
textField = textField.indexOf("-") > -1 ? textField.split("-")[1] : textField;
$("#result-0-repCustomName").val(textField);
} else {
$("#result-0-repCustomName").val("");
}
}
},
"result-0-repUserId": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = dataItem['textField'];
if (valueField) {
textField = textField.indexOf("-") > -1 ? textField.split("-")[1] : textField;
$("#result-0-repUserName").val(textField);
} else {
$("#result-0-repUserName").val("");
}
}
}
}
IPLATUI.EFGrid = {
"result": {
pageable: false,
exportGrid: false,
toolbarConfig: {
hidden: false,
},
columns: [],
loadComplete: function (grid) {
},
onSuccess: function (e) {
}
}
};
// 确认
$('#SAVE').on('click', save);
// 键盘按键
downKeyUp();
})
/**
* 保存
*/
let save = function () {
let companyCode = $("#result-0-companyCode").val();
if (isBlank(companyCode)) {
message("企业名称不能为空");
return;
}
let repDate = $("#result-0-repDate").val();
if (isBlank(repDate)) {
message("维修日期不能为空");
return;
}
let repCustomId = $("#result-0-repCustomId").val();
if (isBlank(repCustomId)) {
message("客户人员不能为空");
return;
}
let repUserId = $("#result-0-repUserId").val();
if (isBlank(repUserId)) {
message("维修人员不能为空");
return;
}
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("", "HGXS0061", "save", true, function (res) {
if (res.status > -1) {
parent.JSColorbox.setValueCallback(res);
} else {
message(res.msg);
}
});
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="维修单详情">
<EF:EFRegion id="result" title="数据区域">
<EF:EFInput ename="id" cname="ID" blockId="result" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="repOrderNo" cname="维修单号" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true" readonly="true"/>
</div>
<div class="row">
<EF:EFSelect ename="companyCode" cname="公司" blockId="result" row="0" colWidth="6" ratio="2:10"
filter="contains">
<EF:EFOption label="请选择" value=""/>
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput ename="companyName" cname="公司名称" blockId="result" row="0" colWidth="6" ratio="2:10"
type="hidden"/>
</div>
<div class="row">
<EF:EFDatePicker ename="repDate" cname="维修日期" blockId="result" row="0" colWidth="3" ratio="2:10"
format="yyyy-MM-dd" readonly="true"/>
</div>
<div class="row">
<EF:EFSelect ename="repCustomId" cname="客户人员" blockId="result" row="0" colWidth="3" ratio="2:10"
filter="contains">
<EF:EFOption label="请选择" value=""/>
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput ename="repCustomName" cname="客户人员姓名" blockId="result" row="0" colWidth="6" ratio="2:10"
type="hidden"/>
</div>
<div class="row">
<EF:EFSelect ename="repUserId" cname="维修人员" blockId="result" row="0" colWidth="3" ratio="2:10"
filter="contains">
<EF:EFOption label="请选择" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput ename="repUserName" cname="维修人员姓名" blockId="result" row="0" colWidth="6" ratio="2:10"
type="hidden"/>
</div>
<br/>
<span style="color: red; ">说明:维修单号由系统自动生成</span><br>
</EF:EFRegion>
</EF:EFPage>
...@@ -421,7 +421,7 @@ const copyAuth = function () { ...@@ -421,7 +421,7 @@ const copyAuth = function () {
href: "XS3201B", href: "XS3201B",
title: "<div style='text-align: center;'>正在复制:【" + groupCname + "】的菜单权限...</div>", title: "<div style='text-align: center;'>正在复制:【" + groupCname + "】的菜单权限...</div>",
width: "70%", width: "70%",
height: "80%", height: "90%",
params: params, params: params,
callbackName: copyAuthCallback callbackName: copyAuthCallback
}); });
......
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