Commit b769ea84 by 宋祥

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

parents 19651d4b 3d819ae6
......@@ -12,7 +12,9 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -57,7 +59,38 @@ public class DaoUtils {
}
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.
*
......@@ -106,7 +139,7 @@ public class DaoUtils {
});
return DaoBase.getInstance().insertBatch(sql, parameters);
}
/**
* 创建人工号 创建人姓名 创建人岗号 创建时刻
*
......
......@@ -189,6 +189,9 @@
<isNotEmpty prepend=" AND " property="primaryIds">
PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNos">
RECEIVE_NO IN <iterate open="(" close=")" conjunction="," property="receiveNos">#receiveNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="updateRevise">
......
......@@ -3,13 +3,16 @@ package com.baosight.hggp.hg.cg.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.constant.HgCgConst;
import com.baosight.hggp.hg.cg.domain.*;
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.cw.domain.HGCW013;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.zl.domain.HGZL001;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.ObjectUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
......@@ -260,6 +263,22 @@ public class HGCGTools {
AssertUtils.isEmpty(results, String.format("采购合同[%s]不存在", id));
return results.get(0);
}
/**
* 锁
*
* @param ids
* @return
*/
public static void lockById(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map paramMap = new HashMap();
paramMap.put("ids", ids);
DaoBase.getInstance().update(HGSqlConstant.HgCg002.LOCK, paramMap);
}
/**
* 锁
*
......@@ -314,12 +333,57 @@ public class HGCGTools {
}
/**
* 修改状态
*
* @param dbCg002
* @param receiveQty
* @param receiveWeight
*/
public static void updateReceiveMain(HGCG002 dbCg002, BigDecimal receiveQty, BigDecimal receiveWeight) {
AssertUtils.isNull(dbCg002, "合同号不能为空!");
AssertUtils.isNull(receiveQty, "收货数量不能为空!");
Integer status = dbCg002.getPurQty().compareTo(receiveQty) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_CONTRACT_NO, dbCg002.getContractNo());
paramMap.put(HGCG002.FIELD_STATUS, status);
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, receiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, receiveWeight);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap);
}
/**
* 更新合同状态
*
* @param dbCg002As
*/
public static void updateReceiveMain(List<HGCG002A> dbCg002As) {
if (CollectionUtils.isEmpty(dbCg002As)) {
return;
}
List<Long> ids = ObjectUtils.listEpKey(dbCg002As, "id");
// 合同明细信息
Map<Long, List<HGCG002B>> dbCg002BMap = HGCGTools.HgCg002B.mapByPrimaryId(ids);
for (HGCG002A dbCg002A : dbCg002As) {
List<HGCG002B> dbCg002Bs = dbCg002BMap == null ? null : dbCg002BMap.get(dbCg002A.getId());
AssertUtils.isEmpty(dbCg002Bs, String.format("采购合同【%s】无明细数据,请检查", dbCg002A.getContractNo()));
// 收货数量
BigDecimal receiveQtySum = dbCg002Bs.stream().map(HGCG002B::getReceiveQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 收货重量
BigDecimal receiveWeightSum = dbCg002Bs.stream().map(HGCG002B::getReceiveWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add);
updateReceiveMain(dbCg002A, receiveQtySum, receiveWeightSum);
}
}
/**
* 查询
*
* @param ids
* @return
*/
public static List<HGCG002> listByIds(List<Long> ids) {
public static List<HGCG002A> listByIds(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
......@@ -332,9 +396,9 @@ public class HGCGTools {
* @param ids
* @return
*/
public static Map<Long, HGCG002> mapByIds(List<Long> ids) {
List<HGCG002> results = listByIds(ids);
return results.stream().collect(Collectors.toMap(HGCG002::getId, item -> item));
public static Map<Long, HGCG002A> mapByIds(List<Long> ids) {
List<HGCG002A> results = listByIds(ids);
return results.stream().collect(Collectors.toMap(HGCG002A::getId, item -> item));
}
/**
......@@ -371,12 +435,11 @@ public class HGCGTools {
Map<Long, List<HGCG002B>> dbCg002BMap = HGCGTools.HgCg002B.mapByPrimaryId(primaryIds);
cg002s.forEach(cg002 -> {
List<HGCG002B> dbCg002Bs = dbCg002BMap.get(cg002.getId());
//修改主表信息
//采购数量
// 采购数量
BigDecimal purQtySum = dbCg002Bs.stream().map(HGCG002B::getPurQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setPurQty(purQtySum);
//采购重量
// 采购重量
BigDecimal purWeightSum = dbCg002Bs.stream().map(HGCG002B::getPurWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setPurWeight(purWeightSum);
......@@ -692,30 +755,76 @@ public class HGCGTools {
paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_STATUS, paramMap);
}
/**
* 修改是否开票
*
* @param hgcw013
*/
public static void updateIsInvoicing(HGCW013 hgcw013) {
AssertUtils.isNull(hgcw013, "采购收货详情不能为空!");
List<HGCG003B> hgcg003Bs =DaoBase.getInstance().query(HGCG003B.QUERY, new HashMap<String, Object>(){{
List<HGCG003B> hgcg003Bs = DaoBase.getInstance().query(HGCG003B.QUERY, new HashMap<String, Object>() {{
put(HGCG003B.FIELD_RECEIVE_NO, hgcw013.getSettlementNumber());
}});
List<HGCG003B> hgcg003BList = hgcg003Bs.stream().filter(item->
List<HGCG003B> hgcg003BList = hgcg003Bs.stream().filter(item ->
item.getInventCode().equals(hgcw013.getInventCode())
&& item.getSpec().equals(hgcw013.getSpec())
&& item.getSpec().equals(hgcw013.getSpec())
).collect(Collectors.toList());
if (hgcg003BList.size() > 0){
if (hgcg003BList.size() > 0) {
HGCG003B hgcg003B = hgcg003BList.get(0);
hgcg003B.setIsInvoicing(HGConstant.CgIsInvoicing.S_0);
hgcg003B.setCancelAmount(hgcg003B.getCancelAmount().subtract(hgcw013.getTotalContractPriceIncluding()));
hgcg003B.setUnCancelAmount(hgcg003B.getUnCancelAmount().add(hgcw013.getTotalContractPriceIncluding()));
DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
}
}
/**
* 修改收货信息
*
* @param receiveNo
* @param depositQty
* @param deliverQty
* @param status
*/
public static void updateDeposit(String receiveNo, BigDecimal depositQty, BigDecimal deliverQty,
Integer status) {
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003.FIELD_RECEIVE_NO, receiveNo);
paramDetailMap.put(HGCG003.FIELD_DEPOSIT_QTY, depositQty);
paramDetailMap.put(HGCG003.FIELD_DELIVER_QTY, deliverQty);
paramDetailMap.put(HGCG003.FIELD_STATUS, status);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_CONFIRM, paramDetailMap);
}
/**
* 更新收货单状态
*
* @param receiveNos
*/
public static void updateReceiveMain(List<String> receiveNos) {
if (CollectionUtils.isEmpty(receiveNos)) {
return;
}
// 收货单子表信息
Map<String, List<HGCG003B>> dbCg003BMap = HGCGTools.HgCg003B.mapByReceiveNo(receiveNos);
for (String receiveNo : receiveNos) {
List<HGCG003B> dbCg003Bs = dbCg003BMap == null ? null : dbCg003BMap.get(receiveNo);
AssertUtils.isEmpty(dbCg003Bs, String.format("采购收货单【%s】无明细数据,请检查", receiveNo));
// 明细状态去重
List<Integer> statuses = dbCg003Bs.stream().map(HGCG003B::getStatus).distinct()
.collect(Collectors.toList());
// 如果存在收货中,则主状态为收货中
Integer status = HGCGUtils.HgCg003.calcStatus(statuses);
BigDecimal depositQtySum = dbCg003Bs.stream().map(HGCG003B::getDepositQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal deliverQtySum = dbCg003Bs.stream().map(HGCG003B::getDeliverQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
updateDeposit(receiveNo, depositQtySum, deliverQtySum, status);
}
}
/**
* 修改状态
*
......@@ -865,7 +974,20 @@ public class HGCGTools {
paramMap.put("ids", ids);
DaoBase.getInstance().update(HGSqlConstant.HgCg003B.LOCK, paramMap);
}
/**
* 查询
*
* @param ids
* @return
*/
public static List<HGCG003B> list(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同明细iD不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGCG003B.QUERY, paramMap);
}
/**
* 查询
*
......@@ -876,20 +998,31 @@ public class HGCGTools {
List<HGCG003B> results = list(ids);
return results.stream().collect(Collectors.toMap(HGCG003B::getId, item -> item));
}
/**
* 查询
*
* @param ids
* @param receiveNos
* @return
*/
public static List<HGCG003B> list(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同明细iD不能为空");
public static List<HGCG003B> listByReceiveNo(List<String> receiveNos) {
AssertUtils.isEmpty(receiveNos, "合同明细iD不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
paramMap.put("receiveNos", receiveNos);
return DaoBase.getInstance().query(HGCG003B.QUERY, paramMap);
}
/**
* 查询
*
* @param receiveNos
* @return
*/
public static Map<String, List<HGCG003B>> mapByReceiveNo(List<String> receiveNos) {
List<HGCG003B> results = listByReceiveNo(receiveNos);
return results.stream().collect(Collectors.groupingBy(HGCG003B::getReceiveNo));
}
/**
* 修改状态
*
......@@ -904,7 +1037,26 @@ public class HGCGTools {
paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_STATUS, paramMap);
}
/**
* 修改收货信息
*
* @param id
* @param depositQty
* @param deliverQty
*/
public static void updateDeposit(Long id, BigDecimal depositQty, BigDecimal deliverQty) {
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003B.FIELD_ID, id);
paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, depositQty);
paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, deliverQty);
if (depositQty.compareTo(BigDecimal.ZERO) == 0 && deliverQty.compareTo(BigDecimal.ZERO) == 0) {
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
} else {
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_4);
}
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap);
}
}
}
......@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.utils;
import com.baosight.hggp.hg.cg.domain.*;
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.util.DateUtils;
import com.baosight.hggp.util.MapUtils;
......@@ -87,7 +88,33 @@ public class HGCGUtils {
// db数据
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 {
public static Map<String, HGCG003> lockGetDataEp(List<? extends HGCG003> fCg003s) {
return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO));
}
/**
* 锁并且获取数据
*
......@@ -168,7 +195,32 @@ public class HGCGUtils {
// db数据
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 {
public static final String WD_FILE_ID = "WD_FILE_ID";
// 回访单号
public static final String FOL_NO = "FOL_NO";
// 维修单号
public static final String REP_ORDER_NO = "REP_ORDER_NO";
}
/**
......
......@@ -189,11 +189,14 @@ public class ServiceHGKC001 extends ServiceBase {
HGKC001 dbKc001 = dbKc001Map.get(depositNo);
dbKc001.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGKC001.DELETE, dbKc001);
// 扣减库存
HGKCUtils.HgKc010.updateInv(dbKc001.getCompanyCode(), dbKc001.getWhCode(), dbKc001.getInventCode(),
dbKc001.getDepositQty().negate(), dbKc001.getDepositWeight().negate());
// 已提交状态需要扣减库存
if (HGConstant.ProductStatus.YTJ.equals(dbKc001.getSubmitStatus())) {
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.HgCg003.updateStatus(dbKc001.getReceiveNo(), HGConstant.CgReceiveStatus.S_0);
HGCGTools.HgCg003B.updateStatus(dbKc001.getReceiveDetailId(), HGConstant.CgReceiveStatus.S_2);
}
}
......
......@@ -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.sc.domain.HGSC008;
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.HGZL004;
import com.baosight.hggp.util.AssertUtils;
......@@ -105,19 +106,23 @@ public class HGKCTools {
List<HGKC001> results = list(depositNos);
return results.stream().collect(Collectors.toMap(HGKC001::getDepositNo, item -> item));
}
/**
* 生产入库(入库质检单)
*
* @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);
newKc001.setDepositDate(DateUtils.shortDate());
newKc001.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_DEPOSIT_NO));
newKc001.setDepositQty(dbCg003B.getDepositQty());
newKc001.setDepositQty(fZl001.getQualifyQty());
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.setSubmitStatus(HGConstant.ProductStatus.WTJ);
newKc001.setStorageType(HGConstant.StorageType.RK);
......
......@@ -283,7 +283,7 @@ public class HGKCUtils {
* @param weight
*/
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);
// 参数校验
checkUpdateInv(companyCode, whCode, inventCode, qty, weight);
......
......@@ -159,44 +159,40 @@ public class ServiceHGSC003 extends ServiceBase {
DaoUtils.update(HGSC003.UPDATE_BLUEPRINT_STATUS, hgsc003);
}
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) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo, i, e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
return inInfo;
}
/**
* 项目档案下拉框
* @param inInfo
* @return
*/
public EiInfo projComboBox(EiInfo inInfo){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC001.FIELD_company_code);
String approvalStatus = MapUtils.getString(queryMap, HGSC001.FIELD_approval_status);
Map map = new HashMap();
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
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){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String companyCode = MapUtils.getString(queryMap, HGSC003.FIELD_company_code);
String blueprintStatus = MapUtils.getString(queryMap, HGSC003.FIELD_blueprint_status);
/**
* 项目档案下拉框
*
* @param inInfo
* @return
*/
public EiInfo projComboBox(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID), queryMap, false);
return inInfo;
}
/**
* 蓝图查询下拉框
*
* @param inInfo
* @return
*/
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);
Map map = new HashMap();
map.put(HGSC003.FIELD_account_code, UserSessionUtils.getAccountCode());
......
......@@ -78,7 +78,7 @@
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name like ('%$projName$%')
proj_name like '%$projName$%'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType">
proj_type = #projType#
......
......@@ -1329,7 +1329,8 @@ public class HGSCTools {
}
}
}
return workHour.get().divide(baseWorkHour, 0, ROUND_DOWN);
System.out.println(workHour.toString());
return workHour.get();
}
/**
......
......@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.xs.constant;
public class HgXsConstant {
/**
* 状态
* 回访状态
*
* @author:songx
* @date:2024/5/7,16:36
......@@ -20,4 +20,17 @@ public class HgXsConstant {
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 {
}
/**
* 售后维修
*
* @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
......
package com.baosight.hggp.hg.xs.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:Hgxs006.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-09-13 10:32:04 create
*/
public class HGXS006 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 账套*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 修改人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除 0-否1-是*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_REP_ORDER_NO = "repOrderNo"; /* 维修单号*/
public static final String FIELD_REP_DATE = "repDate"; /* 维修日期*/
public static final String FIELD_REP_CUSTOM_ID = "repCustomId"; /* 客户人员ID*/
public static final String FIELD_REP_CUSTOM_NAME = "repCustomName"; /* 客户人员姓名*/
public static final String FIELD_REP_USER_ID = "repUserId"; /* 维修人员*/
public static final String FIELD_REP_USER_NAME = "repUserName"; /* 维修人员姓名*/
public static final String FIELD_REP_STATUS = "repStatus"; /* 维修状态 0-待维修 1-已维修*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 修改人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除 0-否1-是*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 公司编码*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/
public static final String COL_REP_ORDER_NO = "REP_ORDER_NO"; /* 维修单号*/
public static final String COL_REP_DATE = "REP_DATE"; /* 维修日期*/
public static final String COL_REP_CUSTOM_ID = "REP_CUSTOM_ID"; /* 客户人员ID*/
public static final String COL_REP_CUSTOM_NAME = "REP_CUSTOM_NAME"; /* 客户人员姓名*/
public static final String COL_REP_USER_ID = "REP_USER_ID"; /* 维修人员*/
public static final String COL_REP_USER_NAME = "REP_USER_NAME"; /* 维修人员姓名*/
public static final String COL_REP_STATUS = "REP_STATUS"; /* 维修状态 0-待维修 1-已维修*/
public static final String QUERY = "HGXS006.query";
public static final String COUNT = "HGXS006.count";
public static final String INSERT = "HGXS006.insert";
public static final String UPDATE = "HGXS006.update";
public static final String DELETE = "HGXS006.delete";
private Long id = new Long(0); /* ID*/
private String accountCode = " "; /* 账套*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 修改人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/
private Integer deleteFlag; /* 是否删除 0-否1-是*/
private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/
private String repOrderNo = " "; /* 维修单号*/
private String repDate = " "; /* 维修日期*/
private String repCustomId = " "; /* 客户人员ID*/
private String repCustomName = " "; /* 客户人员姓名*/
private String repUserId = " "; /* 维修人员*/
private String repUserName = " "; /* 维修人员姓名*/
private Integer repStatus; /* 维修状态 0-待维修 1-已维修*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("账套");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("修改人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("修改人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除 0-否1-是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("公司编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("公司名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_ORDER_NO);
eiColumn.setDescName("维修单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_DATE);
eiColumn.setDescName("维修日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_CUSTOM_ID);
eiColumn.setDescName("客户人员ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_CUSTOM_NAME);
eiColumn.setDescName("客户人员姓名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_USER_ID);
eiColumn.setDescName("维修人员");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_USER_NAME);
eiColumn.setDescName("维修人员姓名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REP_STATUS);
eiColumn.setDescName("维修状态 0-待维修 1-已维修");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGXS006() {
initMetaData();
}
/**
* get the id - ID.
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id - ID.
*
* @param id - ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 账套.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 账套.
*
* @param accountCode - 账套
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 修改人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 修改人.
*
* @param updatedBy - 修改人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 修改人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 修改人名称.
*
* @param updatedName - 修改人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 修改时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 修改时间.
*
* @param updatedTime - 修改时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除 0-否1-是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除 0-否1-是.
*
* @param deleteFlag - 是否删除 0-否1-是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the companyCode - 公司编码.
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 公司编码.
*
* @param companyCode - 公司编码
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the companyName - 公司名称.
* @return the companyName
*/
public String getCompanyName() {
return this.companyName;
}
/**
* set the companyName - 公司名称.
*
* @param companyName - 公司名称
*/
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
/**
* get the repOrderNo - 维修单号.
* @return the repOrderNo
*/
public String getRepOrderNo() {
return this.repOrderNo;
}
/**
* set the repOrderNo - 维修单号.
*
* @param repOrderNo - 维修单号
*/
public void setRepOrderNo(String repOrderNo) {
this.repOrderNo = repOrderNo;
}
/**
* get the repDate - 维修日期.
* @return the repDate
*/
public String getRepDate() {
return this.repDate;
}
/**
* set the repDate - 维修日期.
*
* @param repDate - 维修日期
*/
public void setRepDate(String repDate) {
this.repDate = repDate;
}
/**
* get the repCustomId - 客户人员ID.
* @return the repCustomId
*/
public String getRepCustomId() {
return this.repCustomId;
}
/**
* set the repCustomId - 客户人员ID.
*
* @param repCustomId - 客户人员ID
*/
public void setRepCustomId(String repCustomId) {
this.repCustomId = repCustomId;
}
/**
* get the repCustomName - 客户人员姓名.
* @return the repCustomName
*/
public String getRepCustomName() {
return this.repCustomName;
}
/**
* set the repCustomName - 客户人员姓名.
*
* @param repCustomName - 客户人员姓名
*/
public void setRepCustomName(String repCustomName) {
this.repCustomName = repCustomName;
}
/**
* get the repUserId - 维修人员.
* @return the repUserId
*/
public String getRepUserId() {
return this.repUserId;
}
/**
* set the repUserId - 维修人员.
*
* @param repUserId - 维修人员
*/
public void setRepUserId(String repUserId) {
this.repUserId = repUserId;
}
/**
* get the repUserName - 维修人员姓名.
* @return the repUserName
*/
public String getRepUserName() {
return this.repUserName;
}
/**
* set the repUserName - 维修人员姓名.
*
* @param repUserName - 维修人员姓名
*/
public void setRepUserName(String repUserName) {
this.repUserName = repUserName;
}
/**
* get the repStatus - 维修状态 0-待维修 1-已维修.
* @return the repStatus
*/
public Integer getRepStatus() {
return this.repStatus;
}
/**
* set the repStatus - 维修状态 0-待维修 1-已维修.
*
* @param repStatus - 维修状态 0-待维修 1-已维修
*/
public void setRepStatus(Integer repStatus) {
this.repStatus = repStatus;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setRepOrderNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REP_ORDER_NO)), repOrderNo));
setRepDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REP_DATE)), repDate));
setRepCustomId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REP_CUSTOM_ID)), repCustomId));
setRepCustomName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REP_CUSTOM_NAME)), repCustomName));
setRepUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REP_USER_ID)), repUserId));
setRepUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REP_USER_NAME)), repUserName));
setRepStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REP_STATUS)), repStatus));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_REP_ORDER_NO, StringUtils.toString(repOrderNo, eiMetadata.getMeta(FIELD_REP_ORDER_NO)));
map.put(FIELD_REP_DATE, StringUtils.toString(repDate, eiMetadata.getMeta(FIELD_REP_DATE)));
map.put(FIELD_REP_CUSTOM_ID, StringUtils.toString(repCustomId, eiMetadata.getMeta(FIELD_REP_CUSTOM_ID)));
map.put(FIELD_REP_CUSTOM_NAME, StringUtils.toString(repCustomName, eiMetadata.getMeta(FIELD_REP_CUSTOM_NAME)));
map.put(FIELD_REP_USER_ID, StringUtils.toString(repUserId, eiMetadata.getMeta(FIELD_REP_USER_ID)));
map.put(FIELD_REP_USER_NAME, StringUtils.toString(repUserName, eiMetadata.getMeta(FIELD_REP_USER_NAME)));
map.put(FIELD_REP_STATUS, StringUtils.toString(repStatus, eiMetadata.getMeta(FIELD_REP_STATUS)));
return map;
}
}
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 @@
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUserName">
USER_NAME LIKE CONCAT('%', #accountCode#, '%')
</isNotEmpty>
</sql>
<!-- 查询用户信息 -->
......
......@@ -5,6 +5,7 @@ import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGSqlConstant;
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.Org;
import com.baosight.hggp.hg.xs.domain.User;
......@@ -36,6 +37,84 @@ import java.util.stream.Collectors;
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
......@@ -106,6 +185,9 @@ public class HGXSTools {
*/
public static Map<Long, HGXS007> map(List<Long> ids) {
List<HGXS007> results = list(ids);
if(CollectionUtils.isEmpty(results)){
return null;
}
return results.stream().collect(Collectors.toMap(HGXS007::getId, item -> item));
}
}
......
package com.baosight.hggp.hg.xs.utils;
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.Org;
import com.baosight.hggp.hg.xs.domain.User;
......@@ -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
......
......@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG002B;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
......@@ -23,6 +24,7 @@ import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
......@@ -206,13 +208,18 @@ public class ServiceHGZL001 extends ServiceBase {
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());
List<Long> receiveDetailIds = ObjectUtils.listEpKey(fZl001s, "receiveDetailId");
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.saveProcessData(fZl001s, dbZl001Map, dbCg003BMap);
this.saveProcessData(fZl001s, dbZl001Map, dbCg003BMap, dbCg002BMap, dbCg002As);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fZl001s.size() + "]条数据处理成功!");
......@@ -253,9 +260,11 @@ public class ServiceHGZL001 extends ServiceBase {
* @param fZl001s
* @param dbZl001Map
* @param dbCg003BMap
* @param dbCg002BMap
* @param dbCg002As
*/
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) {
// 更新质检单状态
String checkNo = fZl001.getCheckNo();
......@@ -264,13 +273,14 @@ public class ServiceHGZL001 extends ServiceBase {
dbZl001.setUnqualifyQty(fZl001.getUnqualifyQty());
dbZl001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSqlConstant.HgZl001.PROCESS, dbZl001);
// 更新收货明细
this.updateReceiveDetail(fZl001, dbCg003BMap);
// 更新收货明细
this.updateReceiveDetail(fZl001, dbCg003BMap, dbCg002BMap);
}
// 更新收货单主表信息
this.updateReceiveMain(fZl001s);
// 质检修改合同状态
this.updateContract(fZl001s, dbCg003BMap);
// 更新收货单主表信息,收货单号去重
List<String> receiveNos = ObjectUtils.listEpKey(fZl001s, "receiveNo");
HGCGTools.HgCg003.updateReceiveMain(receiveNos);
// 质检修改主合同状态
HGCGTools.HgCg002.updateReceiveMain(dbCg002As);
}
/**
......@@ -278,88 +288,20 @@ public class ServiceHGZL001 extends ServiceBase {
*
* @param fZl001
* @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();
HGCG003B dbCg003B = dbCg003BMap.get(receiveDetailId);
// 更新采购收货明细的入库数量
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);
HGCGTools.HgCg003B.updateDeposit(receiveDetailId, fZl001.getQualifyQty(), fZl001.getUnqualifyQty());
// 更新合同明细的收货数量
HGCG002B dbCg002B = dbCg002BMap.get(dbCg003B.getContractDetailId());
BigDecimal unqualifyQty = fZl001.getUnqualifyQty().negate();
BigDecimal unqualifyWeight = unqualifyQty.multiply(dbCg003B.getReceiveUnitWeight());
HGCGTools.HgCg002B.updateReceive(dbCg002B, unqualifyQty, unqualifyWeight);
// 生成采购入库单
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);
}
HGKCTools.HgKc001.putInStorageData(fZl001, dbCg003B);
}
}
......@@ -124,11 +124,12 @@ public class ServiceXS3201B extends ServiceEPBase {
dbMainAuth.put("subjectId", groupId);
dbMainAuth.put("recCreator", UserSessionUtils.getLoginName());
dbMainAuth.put("recCreateTime", DateUtils.shortDateTime());
dbMainAuth.put("archiveFlag", 0);
dbMainAuth.put("sortIndex", 0);
return dbMainAuth;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(filterAuths)) {
DaoUtils.insertBatch("XS07.insert", filterAuths);
DaoUtils.batchInsert("XS07.batchInsert", filterAuths);
}
}
}
......
......@@ -30,6 +30,18 @@
)
</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 * FROM ${platSchema}.XS_AUTHORIZATION
WHERE 1=1
......
......@@ -12,6 +12,9 @@
<!-- 数据权限 -->
<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"/>
<!-- 工具 -->
......
$(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>
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