Commit 0ce71ba8 by 宋祥
parents abe57f65 7a2deb79
......@@ -408,6 +408,13 @@ public enum DdynamicEnum {
* 编写:ly
*/
CUST_CODE_BLOCK_ID("custCode_block_id","custCode","custName","HPSC001.queryCustCodeBox"),
/**
* 模块:协同办公
* 用途:用户用品下拉框
* 编写:ly
*/
ITEM_CODE_BLOCK_ID("itemCode_block_id","itemCode","itemName","itemModel","itemType","itemUnit","invQty","whCode","whName","HPBG001.queryItemCodeBox"),
;
......
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG001;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品台账
*/
public class ServiceHPBG001 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG001.QUERY,new HPBG001());
}
@OperationLogAnnotation(operModul = "办公用品台账",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPBG001.DELETE_FLAG);
}
@OperationLogAnnotation(operModul = "办公用品台账",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG001 hpbg001 = new HPBG001();
hpbg001.fromMap(resultRow);
if (hpbg001.getId() == null || hpbg001.getId() == 0) {
this.add(hpbg001);
} else {
this.modify(hpbg001);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG001 hpbg001) {
hpbg001.setItemCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPBG001_ITEM_CODE));
DaoUtils.insert(HPBG001.INSERT, hpbg001);
}
/**
* 修改操作
*/
public void modify(HPBG001 hpbg001) {
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
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.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品入库
*/
public class ServiceHPBG002 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG002().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG002.QUERY,new HPBG002());
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<HPBG002> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG002.class);
List<Long> ids = ObjectUtils.listEpKey(resultRows, HPBG002.FIELD_ID);
List<HPBG002A> hpbg002AList = HPBGTools.HpBg002a.getByParentId(ids);
for (HPBG002 hpbg002: resultRows) {
hpbg002.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg002.getId() == null || hpbg002.getId() == 0) {
continue;
}
List<HPBG002A> hpbg002As = hpbg002AList.stream().filter(hpbg002a1 -> hpbg002a1.getParentId().equals(hpbg002.getId())
&& hpbg002a1.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode())).collect(Collectors.toList());
AssertUtils.isTrue(hpbg002As.size()>0, "数据已提交,无法删除!");
DaoUtils.update(HPBG002.DELETE, hpbg002);
hpbg002As = hpbg002AList.stream().filter(hpbg002a1 -> hpbg002a1.getParentId().equals(hpbg002.getId())).collect(Collectors.toList());
hpbg002As.forEach(hpbg002a -> DaoUtils.update(HPBG002A.DELETE, hpbg002a));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map resultRow = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
HPBG002 hpbg002 = new HPBG002();
hpbg002.fromMap(resultRow);
if (hpbg002.getId() == null || hpbg002.getId() == 0){
this.add(hpbg002);
}else {
this.modify(hpbg002);
}
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map detailRow : detailRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(detailRow);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
hpbg002a.setParentId(hpbg002.getId());
DaoUtils.insert(HPBG002A.INSERT, hpbg002a);
} else {
DaoUtils.update(HPBG002A.UPDATE, hpbg002a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + detailRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG002 hpbg002) {
hpbg002.setDepositCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPBG002_DEPOSIT_CODE));
DaoUtils.insert(HPBG002.INSERT, hpbg002);
}
/**
* 修改操作
*/
public void modify(HPBG002 hpbg002) {
DaoUtils.update(HPBG002.UPDATE, hpbg002);
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG001;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.HPBG004;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品入库明细
*/
public class ServiceHPBG002A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG002A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG002A.QUERY,new HPBG002A());
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow: resultRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(resultRow);
hpbg002a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg002a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG002A.DELETE, hpbg002a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(resultRow);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
this.add(hpbg002a);
} else {
this.modify(hpbg002a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG002A hpbg002a) {
DaoUtils.insert(HPBG002A.INSERT, hpbg002a);
}
/**
* 修改操作
*/
public void modify(HPBG002A hpbg002a) {
DaoUtils.update(HPBG002A.UPDATE, hpbg002a);
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "提交",operDesc = "提交操作")
public EiInfo submit(EiInfo inInfo) {
try {
List<HPBG002A> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG002A.class);
List<String> itemCodes = ObjectUtils.listEpKey(resultRows, HPBG002A.FIELD_ITEM_CODE);
List<HPBG001> hpbg001s = HPBGTools.HpBg001.getByItemCode(itemCodes);
// 写入数据
for (HPBG002A hpbg002A : resultRows) {
AssertUtils.isTrue(hpbg002A.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法重复提交!");
Map<String,HPBG001> hpbg001Map = hpbg001s.stream().filter(item -> item.getItemCode().equals(hpbg002A.getItemCode())).collect(Collectors.toMap(HPBG001::getItemCode, item -> item));
if (!hpbg001Map.isEmpty()){
HPBG001 hpbg001 = hpbg001Map.get(hpbg002A.getItemCode());
BigDecimal invQty = hpbg001.getInvQty().add(hpbg002A.getInvQty());
hpbg001.setInvQty(invQty.compareTo(BigDecimal.ZERO) < 0?BigDecimal.ZERO:invQty);
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
hpbg002A.setStatus(ReviewStatusEnum.SUBMITTED.getCode());
DaoUtils.update(HPBG002A.UPDATE_BY_STATUS, hpbg002A);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG002B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.HPBG003A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG002C extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
Map<String,String> params = EiInfoUtils.getFirstRow(inInfo);
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
Long id = Long.parseLong(params.get(HPBG002.FIELD_ID));
HPBG002 hpbg002 = HPBGTools.HpBg002.get(id);
List<HPBG002A> hpbg002As = HPBGTools.HpBg002a.getByParentId(id,ReviewStatusEnum.UNSUBMITTED.getCode());
EiBlock resultBlock =new EiBlock(EiConstant.resultBlock);
resultBlock.setBlockMeta(new HPBG002().eiMetadata);
resultBlock.setRows(Collections.singletonList(hpbg002));
EiBlock detailBlock =new EiBlock(CommonConstant.Field.DETAIL);
detailBlock.setBlockMeta(new HPBG002A().eiMetadata);
detailBlock.setRows(hpbg002As);
inInfo.setBlock(resultBlock);
inInfo.setBlock(detailBlock);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002A.FIELD_STATUS, ReviewStatusEnum.UNSUBMITTED.getCode());
return super.query(inInfo, HPBG002A.QUERY,new HPBG002A(),false,new EiBlockMeta(),EiConstant.queryBlock,CommonConstant.Field.DETAIL,CommonConstant.Field.DETAIL);
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
for (Map resultRow: resultRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(resultRow);
hpbg002a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg002a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG002A.DELETE, hpbg002a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.HPBG003;
import com.baosight.hpjx.hp.bg.domain.HPBG003A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
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.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品领用
*/
public class ServiceHPBG003 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG003().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG003.QUERY,new HPBG003());
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<HPBG003> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG003.class);
List<Long> ids = ObjectUtils.listEpKey(resultRows, HPBG003.FIELD_ID);
List<HPBG003A> hpbg003AList = HPBGTools.HpBg003a.getByParentId(ids);
for (HPBG003 hpbg003: resultRows) {
hpbg003.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003.getId() == null || hpbg003.getId() == 0) {
continue;
}
List<HPBG003A> hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())
&& hpbg003a1.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode())).collect(Collectors.toList());
AssertUtils.isTrue(hpbg003As.size()>0, "数据已提交,无法删除!");
DaoUtils.update(HPBG003.DELETE, hpbg003);
hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())).collect(Collectors.toList());
hpbg003As.forEach(hpbg003a -> DaoUtils.update(HPBG003A.DELETE, hpbg003a));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map resultRow = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
HPBG003 hpbg003 = new HPBG003();
hpbg003.fromMap(resultRow);
if (hpbg003.getId() == null || hpbg003.getId() == 0){
this.add(hpbg003);
}else {
this.modify(hpbg003);
}
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map detailRow : detailRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(detailRow);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
hpbg003a.setParentId(hpbg003.getId());
DaoUtils.insert(HPBG003A.INSERT, hpbg003a);
} else {
DaoUtils.update(HPBG003A.UPDATE, hpbg003a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + detailRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG003 hpbg003) {
hpbg003.setReceiveCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPBG003_RECEIVE_CODE));
DaoUtils.insert(HPBG003.INSERT, hpbg003);
}
/**
* 修改操作
*/
public void modify(HPBG003 hpbg003) {
DaoUtils.update(HPBG003.UPDATE, hpbg003);
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.*;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品领用
*/
public class ServiceHPBG003A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG003A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG003A.QUERY,new HPBG003A());
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow: resultRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(resultRow);
hpbg003a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg003a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG003A.DELETE, hpbg003a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(resultRow);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
this.add(hpbg003a);
} else {
this.modify(hpbg003a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG003A hpbg003a) {
DaoUtils.insert(HPBG003A.INSERT, hpbg003a);
}
/**
* 修改操作
*/
public void modify(HPBG003A hpbg003a) {
DaoUtils.update(HPBG003A.UPDATE, hpbg003a);
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "提交",operDesc = "提交操作")
public EiInfo submit(EiInfo inInfo) {
try {
List<HPBG003A> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG003A.class);
List<String> itemCodes = ObjectUtils.listEpKey(resultRows, HPBG003A.FIELD_ITEM_CODE);
List<HPBG001> hpbg001s = HPBGTools.HpBg001.getByItemCode(itemCodes);
// 写入数据
for (HPBG003A hpbg003A : resultRows) {
AssertUtils.isTrue(hpbg003A.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法重复提交!");
Map<String,HPBG001> hpbg001Map = hpbg001s.stream().filter(item -> item.getItemCode().equals(hpbg003A.getItemCode())).collect(Collectors.toMap(HPBG001::getItemCode, item -> item));
if (!hpbg001Map.isEmpty()){
HPBG001 hpbg001 = hpbg001Map.get(hpbg003A.getItemCode());
BigDecimal invQty = hpbg001.getInvQty().subtract(hpbg003A.getReceiveQty());
hpbg001.setInvQty(invQty.compareTo(BigDecimal.ZERO) < 0?BigDecimal.ZERO:invQty);
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
hpbg003A.setStatus(ReviewStatusEnum.SUBMITTED.getCode());
DaoUtils.update(HPBG003A.UPDATE_BY_STATUS, hpbg003A);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG003B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG003;
import com.baosight.hpjx.hp.bg.domain.HPBG003A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG003C extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
Map<String,String> params = EiInfoUtils.getFirstRow(inInfo);
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
Long id = Long.parseLong(params.get(HPBG003.FIELD_ID));
HPBG003 hpbg003 = HPBGTools.HpBg003.get(id);
List<HPBG003A> hpbg003As = HPBGTools.HpBg003a.getByParentId(id, ReviewStatusEnum.UNSUBMITTED.getCode());
EiBlock resultBlock =new EiBlock(EiConstant.resultBlock);
resultBlock.setBlockMeta(new HPBG003().eiMetadata);
resultBlock.setRows(Collections.singletonList(hpbg003));
EiBlock detailBlock =new EiBlock(CommonConstant.Field.DETAIL);
detailBlock.setBlockMeta(new HPBG003A().eiMetadata);
detailBlock.setRows(hpbg003As);
inInfo.setBlock(resultBlock);
inInfo.setBlock(detailBlock);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003A.FIELD_STATUS, ReviewStatusEnum.UNSUBMITTED.getCode());
return super.query(inInfo, HPBG003A.QUERY,new HPBG003A(),false,new EiBlockMeta(),EiConstant.queryBlock,CommonConstant.Field.DETAIL,CommonConstant.Field.DETAIL);
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
for (Map resultRow: resultRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(resultRow);
hpbg003a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg003a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG003A.DELETE, hpbg003a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG001;
import com.baosight.hpjx.hp.bg.domain.HPBG004;
import com.baosight.hpjx.hp.bg.domain.HPBG004;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品盘点
*/
public class ServiceHPBG004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG004.QUERY,new HPBG004());
}
@OperationLogAnnotation(operModul = "办公用品盘点",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPBG004.DELETE_FLAG);
}
@OperationLogAnnotation(operModul = "办公用品盘点",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG004 hpbg004 = new HPBG004();
hpbg004.fromMap(resultRow);
if (hpbg004.getId() == null || hpbg004.getId() == 0) {
this.add(hpbg004);
} else {
this.modify(hpbg004);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG004 hpbg004) {
hpbg004.setStatus(ReviewStatusEnum.UNSUBMITTED.getCode());
DaoUtils.insert(HPBG004.INSERT, hpbg004);
}
/**
* 修改操作
*/
public void modify(HPBG004 hpbg004) {
DaoUtils.update(HPBG004.UPDATE, hpbg004);
}
@OperationLogAnnotation(operModul = "办公用品盘点",operType = "提交",operDesc = "提交操作")
public EiInfo submit(EiInfo inInfo) {
try {
List<HPBG004> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG004.class);
List<String> itemCodes =ObjectUtils.listEpKey(resultRows, HPBG004.FIELD_ITEM_CODE);
List<HPBG001> hpbg001s = HPBGTools.HpBg001.getByItemCode(itemCodes);
// 写入数据
for (HPBG004 hpbg004 : resultRows) {
AssertUtils.isTrue(hpbg004.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法提交!");
Map<String,HPBG001> hpbg001Map = hpbg001s.stream().filter(item -> item.getItemCode().equals(hpbg004.getItemCode())).collect(Collectors.toMap(HPBG001::getItemCode, item -> item));
if (!hpbg001Map.isEmpty()){
HPBG001 hpbg001 = hpbg001Map.get(hpbg004.getItemCode());
BigDecimal invQty = hpbg001.getInvQty().add(hpbg004.getProLossQty());
hpbg001.setInvQty(invQty.compareTo(BigDecimal.ZERO) < 0?BigDecimal.ZERO:invQty);
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
hpbg004.setStatus(ReviewStatusEnum.SUBMITTED.getCode());
DaoUtils.update(HPBG004.UPDATE_BY_STATUS, hpbg004);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
ITEM_TYPE TINYINT,
ITEM_CODE VARCHAR,
ITEM_NAME VARCHAR,
ITEM_MODEL VARCHAR,
ITEM_UNIT VARCHAR,
INV_QTY DECIMAL
-->
<sqlMap namespace="HPBG001">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME like concat('%', #itemName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL like concat('%', #itemModel#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCodes">
ITEM_CODE IN <iterate close=")" open="(" conjunction="," property="itemCodes">#itemCodes[]#</iterate>
</isNotEmpty>
</sql>
<!--排除权限条件-->
<sql id="notCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME like concat('%', #itemName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL like concat('%', #itemModel#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG001">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
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.是 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
ITEM_NAME as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
INV_QTY as "invQty" <!-- 库存数量 -->
FROM ${hpjxSchema}.T_HPBG001 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG001 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME = #itemName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL = #itemModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG001 (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
ITEM_TYPE, <!-- 用品分类 -->
ITEM_CODE, <!-- 用品编码 -->
ITEM_NAME, <!-- 用品名称 -->
ITEM_MODEL, <!-- 用品型号 -->
ITEM_UNIT, <!-- 用品单位 -->
INV_QTY <!-- 库存数量 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#whCode#, #whName#, #itemType#, #itemCode#, #itemName#, #itemModel#, #itemUnit#, #invQty#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG001 WHERE ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
ITEM_TYPE = #itemType#, <!-- 用品分类 -->
ITEM_CODE = #itemCode#, <!-- 用品编码 -->
ITEM_NAME = #itemName#, <!-- 用品名称 -->
ITEM_MODEL = #itemModel#, <!-- 用品型号 -->
ITEM_UNIT = #itemUnit#, <!-- 用品单位 -->
INV_QTY = #invQty# <!-- 库存数量 -->
WHERE
ID = #id#
</update>
<select id="queryItemCodeBox" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.bg.domain.HPBG001">
SELECT
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
CONCAT(ITEM_NAME,'-',ITEM_MODEL) as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
INV_QTY as "invQty" <!-- 库存数量 -->
FROM ${hpjxSchema}.T_HPBG001
WHERE DELETE_FLAG = 0
<include refid="condition" />
</select>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG002
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
DEPOSIT_DATE VARCHAR,
DEPOSIT_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
DEPOSIT_USER VARCHAR
-->
<sqlMap namespace="HPBG002">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositCode">
DEPOSIT_CODE = #depositCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositUser">
DEPOSIT_USER = #depositUser#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG002">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
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.是 -->
DEPOSIT_DATE as "depositDate", <!-- 入库日期 -->
DEPOSIT_CODE as "depositCode", <!-- 入库单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
DEPOSIT_USER as "depositUser" <!-- 入库人员 -->
FROM ${hpjxSchema}.T_HPBG002 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
DEPOSIT_DATE DESC, ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG002 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositCode">
DEPOSIT_CODE = #depositCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositUser">
DEPOSIT_USER = #depositUser#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG002 (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
DEPOSIT_DATE, <!-- 入库日期 -->
DEPOSIT_CODE, <!-- 入库单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
DEPOSIT_USER <!-- 入库人员 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#depositDate#, #depositCode#, #whCode#, #whName#, #depositUser#)
<selectKey resultClass="java.lang.Long" keyProperty="id" >
SELECT MAX(ID) as "id" FROM ${hpjxSchema}.T_HPBG002
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG002 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG002
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG002
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
DEPOSIT_DATE = #depositDate#, <!-- 入库日期 -->
DEPOSIT_CODE = #depositCode#, <!-- 入库单号 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
DEPOSIT_USER = #depositUser# <!-- 入库人员 -->
WHERE
ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG002A
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
ITEM_TYPE TINYINT,
ITEM_CODE VARCHAR,
ITEM_NAME VARCHAR,
ITEM_MODEL VARCHAR,
ITEM_UNIT VARCHAR,
INV_QTY DECIMAL,
STATUS TINYINT,
PARENT_ID BIGINT
-->
<sqlMap namespace="HPBG002A">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME like concat('%', #itemName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL like concat('%', #itemModel#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG002A">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
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.是 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
ITEM_NAME as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
INV_QTY as "invQty", <!-- 入库数量 -->
STATUS as "status", <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID as "parentId" <!-- 父级ID -->
FROM ${hpjxSchema}.T_HPBG002A WHERE 1=1
<include refid="condition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG002A WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME = #itemName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL = #itemModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG002A (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
ITEM_TYPE, <!-- 用品分类 -->
ITEM_CODE, <!-- 用品编码 -->
ITEM_NAME, <!-- 用品名称 -->
ITEM_MODEL, <!-- 用品型号 -->
ITEM_UNIT, <!-- 用品单位 -->
INV_QTY, <!-- 入库数量 -->
STATUS, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID <!-- 父级ID -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#itemType#, #itemCode#, #itemName#, #itemModel#, #itemUnit#, #invQty#, #status#, #parentId#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG002A WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG002A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG002A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
ITEM_TYPE = #itemType#, <!-- 用品分类 -->
ITEM_CODE = #itemCode#, <!-- 用品编码 -->
ITEM_NAME = #itemName#, <!-- 用品名称 -->
ITEM_MODEL = #itemModel#, <!-- 用品型号 -->
ITEM_UNIT = #itemUnit#, <!-- 用品单位 -->
INV_QTY = #invQty#, <!-- 入库数量 -->
STATUS = #status#, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID = #parentId# <!-- 父级ID -->
WHERE
ID = #id#
</update>
<update id="updateBystatus">
UPDATE ${hpjxSchema}.T_HPBG002A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 审批状态0.未审核1.已审核 -->
WHERE
ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG003
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
RECEIVE_DATE VARCHAR,
RECEIVE_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
RECEIVE_USER VARCHAR
-->
<sqlMap namespace="HPBG003">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDate">
RECEIVE_DATE = #receiveDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveCode">
RECEIVE_CODE = #receiveCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUser">
RECEIVE_USER = #receiveUser#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG003">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
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.是 -->
RECEIVE_DATE as "receiveDate", <!-- 领用日期 -->
RECEIVE_CODE as "receiveCode", <!-- 领用单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
RECEIVE_USER as "receiveUser" <!-- 领用人员 -->
FROM ${hpjxSchema}.T_HPBG003 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
RECEIVE_DATE desc, ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG003 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDate">
RECEIVE_DATE = #receiveDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveCode">
RECEIVE_CODE = #receiveCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUser">
RECEIVE_USER = #receiveUser#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG003 (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
RECEIVE_DATE, <!-- 领用日期 -->
RECEIVE_CODE, <!-- 领用单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
RECEIVE_USER <!-- 领用人员 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#receiveDate#, #receiveCode#, #whCode#, #whName#, #receiveUser#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) as "id" FROM ${hpjxSchema}.T_HPBG003
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG003 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG003
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG003
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
RECEIVE_DATE = #receiveDate#, <!-- 领用日期 -->
RECEIVE_CODE = #receiveCode#, <!-- 领用单号 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
RECEIVE_USER = #receiveUser# <!-- 领用人员 -->
WHERE
ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG003A
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
ITEM_TYPE TINYINT,
ITEM_CODE VARCHAR,
ITEM_NAME VARCHAR,
ITEM_MODEL VARCHAR,
ITEM_UNIT VARCHAR,
RECEIVE_QTY DECIMAL,
STATUS TINYINT,
PARENT_ID BIGINT
-->
<sqlMap namespace="HPBG003A">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME like concat('%', #itemName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL like concat('%', #itemModel#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveQty">
RECEIVE_QTY = #receiveQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG003A">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
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.是 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
ITEM_NAME as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
RECEIVE_QTY as "receiveQty", <!-- 领用数量 -->
STATUS as "status", <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID as "parentId" <!-- 父级ID -->
FROM ${hpjxSchema}.T_HPBG003A WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG003A WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME = #itemName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL = #itemModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveQty">
RECEIVE_QTY = #receiveQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG003A (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
ITEM_TYPE, <!-- 用品分类 -->
ITEM_CODE, <!-- 用品编码 -->
ITEM_NAME, <!-- 用品名称 -->
ITEM_MODEL, <!-- 用品型号 -->
ITEM_UNIT, <!-- 用品单位 -->
RECEIVE_QTY, <!-- 领用数量 -->
STATUS, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID <!-- 父级ID -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#itemType#, #itemCode#, #itemName#, #itemModel#, #itemUnit#, #receiveQty#,
#status#, #parentId#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG003A WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG003A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG003A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
ITEM_TYPE = #itemType#, <!-- 用品分类 -->
ITEM_CODE = #itemCode#, <!-- 用品编码 -->
ITEM_NAME = #itemName#, <!-- 用品名称 -->
ITEM_MODEL = #itemModel#, <!-- 用品型号 -->
ITEM_UNIT = #itemUnit#, <!-- 用品单位 -->
RECEIVE_QTY = #receiveQty#, <!-- 领用数量 -->
STATUS = #status#, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID = #parentId# <!-- 父级ID -->
WHERE
ID = #id#
</update>
<update id="updateBystatus">
UPDATE ${hpjxSchema}.T_HPBG003A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 审批状态0.未审核1.已审核 -->
WHERE
ID = #id#
</update>
</sqlMap>
package com.baosight.hpjx.hp.bg.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.bg.domain.*;
import com.baosight.hpjx.util.AssertUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
@Slf4j
public class HPBGTools {
public static class HpBg001 {
public static List<HPBG001> getByItemCode(List<String> itemCodes){
if (CollectionUtils.isEmpty(itemCodes)){
return new ArrayList<>();
}
Map params = new HashMap();
params.put("itemCodes", itemCodes);
params.put("deleteFlag", 0);
List<HPBG001> list = DaoBase.getInstance().query(HPBG001.QUERY, params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
public static class HpBg002 {
public static HPBG002 get(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委外入库单ID不能为空!");
HPBG002 hpbg002 = (HPBG002) DaoBase.getInstance().get(HPBG002.QUERY,HPBG002.FIELD_ID, id);
return hpbg002;
}
}
public static class HpBg002a {
public static List<HPBG002A> getByParentId(Long parentId,Integer status){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentId", parentId);
params.put("status", status);
params.put("deleteFlag", 0);
List<HPBG002A> list = DaoBase.getInstance().query(HPBG002A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
public static List<HPBG002A> getByParentId(List<Long> parentIds){
AssertUtils.isTrue(parentIds.size()==0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentIds", parentIds);
params.put("deleteFlag", 0);
List<HPBG002A> list = DaoBase.getInstance().query(HPBG002A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
public static class HpBg003 {
public static HPBG003 get(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委外入库单ID不能为空!");
HPBG003 hpbg003 = (HPBG003) DaoBase.getInstance().get(HPBG003.QUERY,HPBG003.FIELD_ID, id);
return hpbg003;
}
}
public static class HpBg003a {
public static List<HPBG003A> getByParentId(Long parentId, Integer status){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentId", parentId);
params.put("status", status);
params.put("deleteFlag", 0);
List<HPBG003A> list = DaoBase.getInstance().query(HPBG003A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
public static List<HPBG003A> getByParentId(List<Long> parentIds){
AssertUtils.isTrue(parentIds.size()==0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentIds", parentIds);
params.put("deleteFlag", 0);
List<HPBG003A> list = DaoBase.getInstance().query(HPBG003A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
}
package com.baosight.hpjx.hp.cg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.cg.domain.HPCG004;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
*/
public class ServiceHPCG004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.SUPPLIER_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPCG004().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPCG004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPCG004.QUERY, new HPCG004());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "询价管理",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPCG004 hpcg004 = new HPCG004();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpcg004.fromMap(map);
hpcg004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPCG004.DELETE_FLAG, hpcg004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "询价管理",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HPCG004> list = new ArrayList<>();
for (Map resultRow : resultRows) {
HPCG004 hpcg004 = new HPCG004();
hpcg004.fromMap(resultRow);
if (hpcg004.getId() == null || hpcg004.getId() == 0) {
hpcg004.setDeleteFlag(CommonConstant.YesNo.NO_0);
this.add(hpcg004);
} else {
this.modify(hpcg004);
}
list.add(hpcg004);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(list);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPCG004 hpcg004) {
this.setBaseInfo(hpcg004);
//生成采购询价单号
hpcg004.setInquiryNumber(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INQUIRY_NUMBER));
DaoUtils.insert(HPCG004.INSERT, hpcg004);
}
/**
* 设置基础信息
*
* @param hpcg004
*/
private void setBaseInfo(HPCG004 hpcg004) {
// 去除日期字符串中的-
hpcg004.setInquiryDate(StringUtil.removeHorizontalLine(hpcg004.getInquiryDate()));
}
/**
* 修改操作
*/
public void modify(HPCG004 hpcg004) {
DaoUtils.update(HPCG004.UPDATE, hpcg004);
}
@OperationLogAnnotation(operModul = "询价管理",operType = "提交",operDesc = "提交审批操作")
public EiInfo approve(EiInfo inInfo){
int i = 0;
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPCG004 hpcg004 = new HPCG004();
hpcg004.fromMap(resultRow);
hpcg004.setProApplyStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPCG004.UPDATE_PRO_APPLY_STATUS,hpcg004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.approve", "提交")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("提交失败", e.getMessage());
return inInfo;
}
return inInfo;
}
}
package com.baosight.hpjx.hp.cg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.cg.domain.HPCG004;
import com.baosight.hpjx.hp.cg.domain.HPCG004A;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.xt.domain.HPXT002A;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public class ServiceHPCG004A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPCG004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPCG004A.QUERY, new HPCG004A());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "询价管理详情",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPCG004A hpcg004a = new HPCG004A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpcg004a.fromMap(map);
hpcg004a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPCG004A.DELETE_FLAG, hpcg004a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "询价管理详情详情",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HPCG004A> list = new ArrayList<>();
for (Map resultRow : resultRows) {
HPCG004A hpcg004a = new HPCG004A();
hpcg004a.fromMap(resultRow);
if (hpcg004a.getId() == null || hpcg004a.getId() == 0) {
String tHpjg004Id = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPCG004A.FIELD_T_HPJG004_ID);
hpcg004a.settHpjg004Id(Long.valueOf(tHpjg004Id));
this.add(hpcg004a);
} else {
this.modify(hpcg004a);
}
list.add(hpcg004a);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(list);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPCG004A hpcg004a) {
this.setBaseInfo(hpcg004a);
//生成采购询价单号
DaoUtils.insert(HPCG004A.INSERT, hpcg004a);
}
/**
* 设置基础信息
*
* @param hpcg004a
*/
private void setBaseInfo(HPCG004A hpcg004a) {
// 去除日期字符串中的-
hpcg004a.setDeliveryDate(StringUtil.removeHorizontalLine(hpcg004a.getDeliveryDate()));
}
/**
* 修改操作
*/
public void modify(HPCG004A hpcg004a) {
DaoUtils.update(HPCG004A.UPDATE, hpcg004a);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-27 14:04:00
Version : 1.0
schema : hpjx
tableName : T_HPCG004
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
INQUIRY_DATE VARCHAR,
INQUIRY_NUMBER VARCHAR,
SUPPLIER_NAME VARCHAR,
INQUIRY_TYPE VARCHAR,
INQUIRY_PERSON VARCHAR,
DELETE_FLAG TINYINT,
PRO_APPLY_STATUS TINYINT
-->
<sqlMap namespace="HPCG004">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryDate">
INQUIRY_DATE = #inquiryDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryNumber">
INQUIRY_NUMBER = #inquiryNumber#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supplierName">
SUPPLIER_NAME = #supplierName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryType">
INQUIRY_TYPE = #inquiryType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryPerson">
INQUIRY_PERSON = #inquiryPerson#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="proApplyStatus">
PRO_APPLY_STATUS = #proApplyStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
CREATED_TIME &gt;= REPLACE(#createdDateFrom#, '-', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
CREATED_TIME &lt;= REPLACE(#createdDateTo#, '-', '')
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.cg.domain.HPCG004">
SELECT
ID as "id", <!-- 主键id -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
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", <!-- 更新时间 -->
INQUIRY_DATE as "inquiryDate", <!-- 询价日期 -->
INQUIRY_NUMBER as "inquiryNumber", <!-- 询价单号 -->
SUPPLIER_NAME as "supplierName", <!-- 供应商名称 -->
INQUIRY_TYPE as "inquiryType", <!-- 询价单类型 -->
INQUIRY_PERSON as "inquiryPerson", <!-- 询价单申请人 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0.否1.是 -->
PRO_APPLY_STATUS as "proApplyStatus" <!-- 申请状态 -->
FROM ${hpjxSchema}.T_HPCG004 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPCG004 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryDate">
INQUIRY_DATE = #inquiryDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryNumber">
INQUIRY_NUMBER = #inquiryNumber#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supplierName">
SUPPLIER_NAME = #supplierName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryType">
INQUIRY_TYPE = #inquiryType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inquiryPerson">
INQUIRY_PERSON = #inquiryPerson#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="proApplyStatus">
PRO_APPLY_STATUS = #proApplyStatus#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPCG004 (ID, <!-- 主键id -->
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
INQUIRY_DATE, <!-- 询价日期 -->
INQUIRY_NUMBER, <!-- 询价单号 -->
SUPPLIER_NAME, <!-- 供应商名称 -->
INQUIRY_TYPE, <!-- 询价单类型 -->
INQUIRY_PERSON, <!-- 询价单申请人 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
PRO_APPLY_STATUS <!-- 申请状态 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #inquiryDate#, #inquiryNumber#, #supplierName#, #inquiryType#, #inquiryPerson#, #deleteFlag#, #proApplyStatus#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) as "id" FROM ${hpjxSchema}.T_HPCG004
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPCG004 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPCG004
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
WHERE
ID = #id#
</update>
<!--修改提交状态-->
<update id="updateProApplyStatus">
UPDATE ${hpjxSchema}.T_HPCG004
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
PRO_APPLY_STATUS = #proApplyStatus# <!-- 提交状态 0-未提交 1-已提交 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPCG004
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
INQUIRY_DATE = #inquiryDate#, <!-- 询价日期 -->
INQUIRY_NUMBER = #inquiryNumber#, <!-- 询价单号 -->
SUPPLIER_NAME = #supplierName#, <!-- 供应商名称 -->
INQUIRY_TYPE = #inquiryType#, <!-- 询价单类型 -->
INQUIRY_PERSON = #inquiryPerson#, <!-- 询价单申请人 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
PRO_APPLY_STATUS = #proApplyStatus# <!-- 申请状态 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -99,12 +99,38 @@ public class HPConstant {
public static final String WD_FILE_ID = "WD_FILE_ID";
// 售后单号
public static final String AFTER_SALE_NO = "AFTER_SALE_NO";
//车辆申请单号
public static final String VEHICLE_APPLY_NO = "VEHICLE_APPLY_NO";
// 客户关怀单号
public static final String CARE_NO = "CARE_NO";
// 回访单号
public static final String FOL_NO = "FOL_NO";
// 投诉单号
public static final String COMPLAINT_NO = "COMPLAINT_NO";
// 建议单号
public static final String SUGGEST_NO = "SUGGEST_NO";
// 公告号
public static final String NOTICE_NO = "NOTICE_NO";
//询价单号
public static final String INQUIRY_NUMBER = "INQUIRY_NUMBER";
//产品编码
public static final String PRODUCT_CODE = "PRODUCT_CODE";
//渠道编码
public static final String CHANNEL_CODE = "CHANNEL_CODE";
//产品编码
public static final String HPYX005_PRODUCT_CODE = "HPYX005_PRODUCT_CODE";
//用品编码
public static final String HPBG001_ITEM_CODE = "HPBG001_ITEM_CODE";
//办公用品入库单号
public static final String HPBG002_DEPOSIT_CODE = "HPBG002_DEPOSIT_CODE";
//办公用品领用单号
public static final String HPBG003_RECEIVE_CODE = "HPBG003_RECEIVE_CODE";
// 维保单号
public static final String MAINTENANCE_NUMBER = "MAINTENANCE_NUMBER";
//会议室管理申请单号
public static final String CONFERENCE_APPLY_NO = "CONFERENCE_APPLY_NO";
}
/**
......@@ -150,4 +176,19 @@ public class HPConstant {
// 已处理
public static final Integer S1 = 1;
}
/**
* 提交状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class submitStatus {
// 未提交
public static final Integer S0 = 0;
// 已提交
public static final Integer S1 = 1;
}
}
package com.baosight.hpjx.hp.ct.constant;
/**
* @author:songx
* @date:2024/9/24,17:53
*/
public class HpCtConst {
/**
* HPCT01 定义
*
* @author:songx
* @date:2024/9/24,17:54
*/
public static class HpCt001 {
/**
* 状态
*
* @author:songx
* @date:2024/5/15,15:18
*/
public static class Status {
// 未关闭
public static final String OPEN = "open";
// 已关闭
public static final String CLOSE = "close";
}
}
}
package com.baosight.hpjx.hp.ct.constant;
/**
* @author:songx
* @date:2024/9/24,18:09
*/
public class HpCtSqlConst {
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpCt001 {
// 确认
public static final String CONFIRM = "HPCT001.confirm";
}
}
package com.baosight.hpjx.hp.ct.service;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ct.constant.HpCtConst;
import com.baosight.hpjx.hp.ct.constant.HpCtSqlConst;
import com.baosight.hpjx.hp.ct.domain.HPCT001;
import com.baosight.hpjx.hp.ct.tools.HpCtTools;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
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.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
import java.util.Map;
/**
* 通知信息
*
* @author:songx
* @date:2021/10/15,16:46
*/
public class ServiceHPCT001 extends ServiceEPBase {
/**
* 页面加载调用.
*
* @param inInfo
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPCT001().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 页面查询调用入口.
*
* @param inInfo
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 只看自己的通知
queryMap.put(HPCT001.FIELD_USER_ENAME, UserSession.getLoginName());
inInfo = super.query(inInfo, HPCT001.QUERY);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 查询待办
*
* @param inInfo
* @return
*/
public EiInfo queryTodo(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.OPEN);
queryMap.put(HPCT001.FIELD_USER_ENAME, UserSession.getLoginName());
inInfo = super.query(inInfo, HPCT001.QUERY, new HPCT001());
// 查询总数量
List<Integer> counts = dao.query(HPCT001.COUNT, queryMap);
inInfo.set(EiConstant.countStr, CollectionUtils.isEmpty(counts) ? 0 : counts.get(0));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询待办信息");
}
return inInfo;
}
/**
* 查询已办
*
* @param inInfo
* @return
*/
public EiInfo queryRecord(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.CLOSE);
queryMap.put(HPCT001.FIELD_USER_ENAME, UserSession.getLoginName());
inInfo = super.query(inInfo, HPCT001.QUERY, new HPCT001());
// 查询总数量
List<Integer> counts = dao.query(HPCT001.COUNT, queryMap);
inInfo.set(EiConstant.countStr, CollectionUtils.isEmpty(counts) ? 0 : counts.get(0));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询已办信息");
}
return inInfo;
}
/**
* 已读
*
* @param inInfo
* @return
*/
public EiInfo confirm(EiInfo inInfo) {
try {
Map resultRow = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
if (ObjectUtils.isEmpty(resultRow.get(HPCT001.FIELD_INTERNAL_CODE))) {
inInfo.setMsg("无效的待办消息");
return inInfo;
}
resultRow.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.CLOSE);
resultRow.put(HPCT001.FIELD_CLOSE_TIME, DateUtils.shortDateTime());
DaoUtils.update(HpCtSqlConst.HpCt001.CONFIRM, resultRow);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "确认已办失败");
}
return inInfo;
}
/**
* 批量已读
*
* @param inInfo
* @return
*/
public EiInfo batchConfirm(EiInfo inInfo) {
try {
int successCount = 0;
List<HPCT001> fCt01s = MapUtils.toDaoEPBases(inInfo, HPCT001.class);
for (HPCT001 fCt01 : fCt01s) {
int result = HpCtTools.HpCt001.confirm(fCt01.getInternalCode());
successCount += result;
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + successCount + "]条数据确认已办成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "已办失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPCT001">
<sql id="column">
ID as "id", <!-- 主键id -->
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-已删除 -->
STATUS as "status", <!-- 状态 -->
INTERNAL_CODE as "internalCode", <!-- 内码 -->
TITLE as "title", <!-- 标题 -->
CONTENT as "content", <!-- 内容 -->
USER_ENAME as "userEname", <!-- 用户ID -->
USER_CNAME as "userCname", <!-- 用户姓名 -->
FORM_ENAME as "formEname", <!-- 画面英文名 -->
FORM_PARAM as "formParam", <!-- 画面参数 -->
CLOSE_TIME as "closeTime" <!-- 关闭时间 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="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="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="internalCode">
INTERNAL_CODE = #internalCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="title">
TITLE = #title#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="content">
CONTENT = #content#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userEname">
USER_ENAME = #userEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCname">
USER_CNAME = #userCname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="formEname">
FORM_ENAME = #formEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="formParam">
FORM_PARAM = #formParam#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="closeTime">
CLOSE_TIME = #closeTime#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="createTimeFrom">
CREATED_TIME &gt;= REPLACE(REPLACE(REPLACE(#createTimeFrom#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createTimeTo">
CREATED_TIME &lt;= REPLACE(REPLACE(REPLACE(#createTimeTo#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="closeTimeFrom">
CLOSE_TIME &gt;= REPLACE(REPLACE(REPLACE(#closeTimeFrom#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="closeTimeTo">
CLOSE_TIME &lt;= REPLACE(REPLACE(REPLACE(#closeTimeTo#, '-', ''), ':', ''), ' ', '')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
STATUS ASC, CREATED_TIME DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.ct.domain.HPCT001">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPCT001 WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPCT001 WHERE 1=1
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPCT001 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
STATUS, <!-- 状态 -->
INTERNAL_CODE, <!-- 内码 -->
TITLE, <!-- 标题 -->
CONTENT, <!-- 内容 -->
USER_ENAME, <!-- 用户ID -->
USER_CNAME, <!-- 用户姓名 -->
FORM_ENAME, <!-- 画面英文名 -->
FORM_PARAM, <!-- 画面参数 -->
CLOSE_TIME <!-- 关闭时间 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#,
#deleteFlag#, #status#, #internalCode#, #title#, #content#, #userEname#, #userCname#,
#formEname#, #formParam#, #closeTime#)
</insert>
<!-- 确认 -->
<update id="confirm">
UPDATE ${hggpSchema}.T_HPCT001
SET
STATUS = #status#,
CLOSE_TIME = #closeTime#,
<include refid="SqlBase.updateRevise"/>
WHERE INTERNAL_CODE = #internalCode#
AND STATUS = 'open'
</update>
</sqlMap>
package com.baosight.hpjx.hp.ct.tools;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ct.constant.HpCtConst;
import com.baosight.hpjx.hp.ct.constant.HpCtSqlConst;
import com.baosight.hpjx.hp.ct.domain.HPCT001;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/3/25,20:44
*/
public class HpCtTools {
/**
* HPCT001 sql 定义
*
* @author:songx
* @date:2024/3/25,21:04
*/
public static class HpCt001 {
/**
* 写入数据库
*
* @param ct00
*/
public static void insertDb(HPCT001 ct00) {
ct00.setStatus(HpCtConst.HpCt001.Status.OPEN);
DaoUtils.insert(HPCT001.INSERT, ct00);
}
/**
* 确认已办
*
* @param internalCode
*/
public static int confirm(String internalCode) {
if (StringUtils.isBlank(internalCode)) {
return 0;
}
Map paramMap = new HashMap();
paramMap.put(HPCT001.FIELD_INTERNAL_CODE, internalCode);
paramMap.put(HPCT001.FIELD_STATUS, HpCtConst.HpCt001.Status.CLOSE);
paramMap.put(HPCT001.FIELD_CLOSE_TIME, DateUtils.shortDateTime());
return DaoUtils.update(HpCtSqlConst.HpCt001.CONFIRM, paramMap);
}
}
}
package com.baosight.hpjx.hp.ct.utils;
import com.baosight.hpjx.hp.ct.domain.HPCT001;
import com.baosight.hpjx.hp.ct.tools.HpCtTools;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* @author:songx
* @date:2024/3/25,20:45
*/
@Slf4j
public class HpCtUtils {
/**
* @author:songx
* @date:2024/10/8,17:20
*/
public static class HpCt001 {
/**
* 发送通知
*
* @param ct00 消息体
*/
public static void send(HPCT001 ct00) {
AssertUtils.isNull(ct00, "待办内容不能为空");
AssertUtils.isEmpty(ct00.getTitle(), "待办标题不能为空");
AssertUtils.isEmpty(ct00.getContent(), "待办内容不能为空");
AssertUtils.isEmpty(ct00.getUserEname(), "待办对象不能为空");
// 设置通知对象名称
User user = HPXSTools.XsUser.get(ct00.getUserEname());
ct00.setUserCname(user.getUserName());
HpCtTools.HpCt001.insertDb(ct00);
}
/**
* 发送通知
*
* @param ct00 消息体
* @param loginNames loginNames
*/
public static void send(HPCT001 ct00, List<String> loginNames) {
AssertUtils.isNull(ct00, "待办内容不能为空");
AssertUtils.isEmpty(ct00.getTitle(), "待办标题不能为空");
AssertUtils.isEmpty(ct00.getContent(), "待办内容不能为空");
AssertUtils.isEmpty(loginNames, "待办对象不能为空");
try {
for (String loginName : loginNames) {
User user = HPXSTools.XsUser.get(loginName);
ct00.setUserCname(user.getUserName());
ct00.setUserEname(user.getLoginName());
HpCtTools.HpCt001.insertDb(ct00);
}
} catch (Exception e) {
log.error("发送通知消息失败:{}", e.getMessage(), e);
}
}
}
}
......@@ -4,7 +4,7 @@ package com.baosight.hpjx.hp.fw.constant;
* @author:songx
* @date:2024/9/24,17:53
*/
public class HpFwConstant {
public class HpFwConst {
/**
* HPFW001 定义
......
......@@ -4,7 +4,7 @@ package com.baosight.hpjx.hp.fw.constant;
* @author:songx
* @date:2024/9/24,18:09
*/
public class HpFwSqlConstant {
public class HpFwSqlConst {
/**
* @author:songx
......@@ -46,6 +46,18 @@ public class HpFwSqlConstant {
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpFw004 {
// 锁
public static final String LOCK = "HPFW004.lock";
// 修改
public static final String UPDATE_DEAL = "HPFW004.updateDeal";
}
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpFw007 {
// 锁
......
......@@ -5,7 +5,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConst;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
......@@ -184,7 +184,7 @@ public class ServiceHPFW001 extends ServiceBase {
fFw001.setStatus(HPConstant.dealStatus.S1);
fFw001.setDealUserId(UserSessionUtils.getLoginName());
fFw001.setDealUserName(UserSessionUtils.getLoginCName());
DaoUtils.update(HpFwSqlConstant.HpFw001.UPDATE_DEAL, fFw001.toMap());
DaoUtils.update(HpFwSqlConst.HpFw001.UPDATE_DEAL, fFw001.toMap());
}
}
......
......@@ -5,7 +5,6 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.fw.constant.HpFwConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
......
......@@ -66,6 +66,8 @@ public class ServiceHPFW001B extends ServiceEPBase {
} else {
this.modify(fFw001);
}
// 回填实体信息,移动端更新数据使用
inInfo.set("detail", fFw001);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
......
......@@ -5,7 +5,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConst;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
......@@ -184,7 +184,7 @@ public class ServiceHPFW002 extends ServiceBase {
fFw002.setDealUserId(UserSessionUtils.getLoginName());
fFw002.setDealUserName(UserSessionUtils.getLoginCName());
fFw002.setDealContent(content);
DaoUtils.update(HpFwSqlConstant.HpFw002.UPDATE_DEAL, fFw002.toMap());
DaoUtils.update(HpFwSqlConst.HpFw002.UPDATE_DEAL, fFw002.toMap());
}
}
......
......@@ -66,6 +66,8 @@ public class ServiceHPFW002B extends ServiceEPBase {
} else {
this.modify(fFw002);
}
// 回填实体信息,移动端更新数据使用
inInfo.set("detail", fFw002);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
......
......@@ -4,7 +4,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConst;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
......@@ -180,7 +180,7 @@ public class ServiceHPFW003 extends ServiceBase {
fFw003.setDealUserId(UserSessionUtils.getLoginName());
fFw003.setDealUserName(UserSessionUtils.getLoginCName());
fFw003.setDealContent(content);
DaoUtils.update(HpFwSqlConstant.HpFw003.UPDATE_DEAL, fFw003.toMap());
DaoUtils.update(HpFwSqlConst.HpFw003.UPDATE_DEAL, fFw003.toMap());
}
}
......
......@@ -67,6 +67,8 @@ public class ServiceHPFW003B extends ServiceEPBase {
} else {
this.modify(fFw003);
}
// 回填实体信息,移动端更新数据使用
inInfo.set("detail", fFw003);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
......@@ -120,14 +122,14 @@ public class ServiceHPFW003B extends ServiceEPBase {
* 数据校验
*
* @param fFw003
* @param dbFw002
* @param dbFw003
*/
private void checkData(HPFW003 fFw003, HPFW003 dbFw002) {
private void checkData(HPFW003 fFw003, HPFW003 dbFw003) {
String complaintNo = fFw003.getComplaintNo();
AssertUtils.isNull(dbFw002, String.format("投诉单【%s】不存在", complaintNo));
AssertUtils.isNotEquals(dbFw002.getDeleteFlag(), CommonConstant.YesNo.NO_0,
AssertUtils.isNull(dbFw003, String.format("投诉单【%s】不存在", complaintNo));
AssertUtils.isNotEquals(dbFw003.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("投诉单【%s】不是\"未删除\"状态,不允许操作", complaintNo));
AssertUtils.isNotEquals(dbFw002.getStatus(), HPConstant.dealStatus.S0,
AssertUtils.isNotEquals(dbFw003.getStatus(), HPConstant.dealStatus.S0,
String.format("投诉单【%s】不是\"未处理\"状态,不允许操作", complaintNo));
}
......
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConst;
import com.baosight.hpjx.hp.fw.domain.HPFW004;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.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.List;
import java.util.Map;
/**
* 客户建议
*
* @author:songx
* @date:2024/9/24,17:47
*/
public class ServiceHPFW004 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPFW004().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作.
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPFW004.FIELD_SUGGEST_DATE,
DateUtils.formatShort(queryMap.get(HPFW004.FIELD_SUGGEST_DATE)));
inInfo = super.query(inInfo, HPFW004.QUERY, new HPFW004());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<HPFW004> fFw004s = MapUtils.toDaoEPBases(inInfo, HPFW004.class);
// db数据
Map<String, HPFW004> dbFw004Map = HpFwUtils.HpFw004.lockAndGet(fFw004s);
// 数据校验
this.checkRemoveData(fFw004s, dbFw004Map);
// 保存数据
this.removeData(fFw004s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw004s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw004s
* @param dbFw004Map
*/
private void checkRemoveData(List<HPFW004> fFw004s, Map<String, HPFW004> dbFw004Map) {
for (HPFW004 fFw004 : fFw004s) {
String suggestNo = fFw004.getSuggestNo();
HPFW004 dbFw004 = dbFw004Map.get(suggestNo);
this.checkData(suggestNo, dbFw004);
}
}
/**
* 数据保存
*
* @param fFw004s
*/
private void removeData(List<HPFW004> fFw004s) {
for (HPFW004 fFw004 : fFw004s) {
fFw004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPFW004.DELETE, fFw004.toMap());
}
}
/**
* 检查状态
*
* @param inInfo
* @return
*/
public EiInfo checkStatus(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String suggestNo = MapUtils.getString(queryMap, HPFW004.FIELD_SUGGEST_NO);
HPFW004 dbFw004 = HpFwUtils.HpFw004.lockAndGet(suggestNo);
this.checkData(suggestNo, dbFw004);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 处理
*
* @param inInfo
* @return
*/
public EiInfo deal(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String content = MapUtils.getString(queryMap, "content");
List<HPFW004> fFw004s = MapUtils.toDaoEPBases(inInfo, HPFW004.class);
// db数据
Map<String, HPFW004> dbFw004Map = HpFwUtils.HpFw004.lockAndGet(fFw004s);
// 数据校验
this.checkDealData(fFw004s, dbFw004Map);
// 保存数据
this.dealData(fFw004s, content);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fFw004s.size() + "]条数据处理成功!");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "处理失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fFw004s
* @param dbFw004Map
*/
private void checkDealData(List<HPFW004> fFw004s, Map<String, HPFW004> dbFw004Map) {
for (HPFW004 fFw004 : fFw004s) {
String suggestNo = fFw004.getSuggestNo();
HPFW004 dbFw004 = dbFw004Map.get(suggestNo);
this.checkData(suggestNo, dbFw004);
}
}
/**
* 数据保存
*
* @param fFw004s
* @param content
*/
private void dealData(List<HPFW004> fFw004s, String content) {
for (HPFW004 fFw004 : fFw004s) {
fFw004.setStatus(HPConstant.dealStatus.S1);
fFw004.setDealUserId(UserSessionUtils.getLoginName());
fFw004.setDealUserName(UserSessionUtils.getLoginCName());
fFw004.setDealContent(content);
DaoUtils.update(HpFwSqlConst.HpFw004.UPDATE_DEAL, fFw004.toMap());
}
}
/**
* 数据校验
*
* @param suggestNo
* @param dbFw004
*/
private void checkData(String suggestNo, HPFW004 dbFw004) {
AssertUtils.isNull(dbFw004, String.format("建议单[%s]不存在", suggestNo));
AssertUtils.isNotEquals(dbFw004.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("建议单【%s】不是\"未删除\"状态,不允许操作", suggestNo));
AssertUtils.isNotEquals(dbFw004.getStatus(), HPConstant.dealStatus.S0,
String.format("建议单【%s】不是\"待处理\"状态,不允许操作", suggestNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.dm.domain.HPDM099;
import com.baosight.hpjx.hp.fw.domain.HPFW004;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 附件清单
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPFW004A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setDetailInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPDM099().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPDM099.QUERY, new HPDM099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryMap, HPDM099.FIELD_BIZ_ID);
HPFW004 dbFw004 = HpFwUtils.HpFw004.lockAndGet(bizId);
this.checkData(bizId, dbFw004);
List<HPDM099> fDm099s = MapUtils.toDaoEPBases(inInfo, HPDM099.class);
for (HPDM099 fDm099 : fDm099s) {
DaoUtils.update(HPDM099.DELETE, fDm099);
if (!fDm099.getDocId().isEmpty()) {
Iplat4jUtils.deleteFileByDocId(fDm099.getDocId());
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fDm099s.size() + "]条数据删除成功!");
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param complaintNo
* @param dbFw004
*/
private void checkData(String complaintNo, HPFW004 dbFw004) {
AssertUtils.isNull(dbFw004, String.format("建议单[%s]不存在", complaintNo));
AssertUtils.isNotEquals(dbFw004.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("建议单【%s】不是\"未删除\"状态,不允许操作", complaintNo));
AssertUtils.isNotEquals(dbFw004.getStatus(), HPConstant.dealStatus.S0,
String.format("建议单【%s】不是\"未处理\"状态,不允许操作", complaintNo));
}
/**
* 设置信息
*
* @param inInfo
*/
public void setDetailInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String bizId = MapUtils.getString(queryRow, HPDM099.FIELD_BIZ_ID);
if (bizId == null) {
return;
}
EiBlock block = new EiBlock(CommonConstant.Field.DETAIL);
block.addRow(HpFwTools.HpFw004.get(bizId));
block.addBlockMeta(new HPFW004().eiMetadata);
inInfo.setBlock(block);
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.domain.HPFW004;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.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 ServiceHPFW004B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
HPFW004 fFw004 = MapUtils.toDaoEPBase(inInfo, HPFW004.class);
fFw004.setSuggestDate(DateUtils.formatShort(fFw004.getSuggestDate()));
if (StringUtils.isBlank(fFw004.getSuggestNo())) {
this.add(fFw004);
} else {
this.modify(fFw004);
}
// 回填实体信息,移动端更新数据使用
inInfo.set("detail", fFw004);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fFw004
*/
private void add(HPFW004 fFw004) {
fFw004.setSuggestNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.SUGGEST_NO));
fFw004.setStatus(HPConstant.dealStatus.S0);
fFw004.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPFW004.INSERT, fFw004);
}
/**
* 修改数据
*
* @param fFw004
*/
private void modify(HPFW004 fFw004) {
HPFW004 dbFw004 = HpFwUtils.HpFw004.lockAndGet(fFw004);
this.checkData(fFw004, dbFw004);
DaoUtils.update(HPFW004.UPDATE, fFw004);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String suggestNo = MapUtils.getString(queryRow, HPFW004.FIELD_SUGGEST_NO);
if (StringUtils.isBlank(suggestNo)) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HpFwTools.HpFw004.get(suggestNo));
resultBlock.addBlockMeta(new HPFW004().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 数据校验
*
* @param fFw004
* @param dbFw004
*/
private void checkData(HPFW004 fFw004, HPFW004 dbFw004) {
String suggestNo = fFw004.getSuggestNo();
AssertUtils.isNull(dbFw004, String.format("建议单【%s】不存在", suggestNo));
AssertUtils.isNotEquals(dbFw004.getDeleteFlag(), CommonConstant.YesNo.NO_0,
String.format("建议单【%s】不是\"未删除\"状态,不允许操作", suggestNo));
AssertUtils.isNotEquals(dbFw004.getStatus(), HPConstant.dealStatus.S0,
String.format("建议单【%s】不是\"未处理\"状态,不允许操作", suggestNo));
}
}
package com.baosight.hpjx.hp.fw.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConst;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.hp.fw.utils.HpFwUtils;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.contants.ACConstants;
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.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -183,7 +187,7 @@ public class ServiceHPFW007 extends ServiceBase {
fFw007.setDealUserId(UserSessionUtils.getLoginName());
fFw007.setDealUserName(UserSessionUtils.getLoginCName());
fFw007.setDealContent(content);
DaoUtils.update(HpFwSqlConstant.HpFw007.UPDATE_DEAL, fFw007.toMap());
DaoUtils.update(HpFwSqlConst.HpFw007.UPDATE_DEAL, fFw007.toMap());
}
}
......@@ -200,4 +204,24 @@ public class ServiceHPFW007 extends ServiceBase {
AssertUtils.isNotEquals(dbFw007.getStatus(), HPConstant.dealStatus.S0,
String.format("回访单【%s】不是\"待回访\"状态,不允许操作", folNo));
}
/**
* 销售单号
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "组织管理", operType = "查询", operDesc = "组下拉框")
public EiInfo querySaleNo(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.SALE_NO_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, queryRow, false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......@@ -66,6 +66,8 @@ public class ServiceHPFW007B extends ServiceEPBase {
} else {
this.modify(fFw007);
}
// 回填实体信息,移动端更新数据使用
inInfo.set("detail", fFw007);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
......
......@@ -100,7 +100,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
ID DESC
</isEmpty>
</dynamic>
</sql>
......
......@@ -66,7 +66,7 @@
CUSTOM_ID = #customId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="customName">
CUSTOM_NAME = #customName#
CUSTOM_NAME LIKE CONCAT('%', #customName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="suggestWay">
SUGGEST_WAY = #suggestWay#
......@@ -139,48 +139,37 @@
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPLAINT_DATE, <!-- 投诉日期 -->
COMPLAINT_NO, <!-- 投诉单号 -->
STATUS, <!-- 状态 -->
SUGGEST_DATE, <!-- 建议日期 -->
SUGGEST_NO, <!-- 建议单号 -->
CUSTOM_ID, <!-- 客户ID -->
CUSTOM_NAME, <!-- 客户名称 -->
COMPLAINT_WAY, <!-- 投诉方式 -->
COMPLAINT_TYPE, <!-- 投诉类型 -->
COMPLAINT_CONTENT, <!-- 投诉内容 -->
COMPLAINT_USER_ID, <!-- 被投诉人ID -->
COMPLAINT_USER_NAME, <!-- 被投诉人名称 -->
ACCEPT_USER_ID, <!-- 受理人ID -->
ACCEPT_USER_NAME, <!-- 受理人名称 -->
LAST_DATE, <!-- 最后期限 -->
SUGGEST_WAY, <!-- 建议方式 -->
SUGGEST_TYPE, <!-- 建议类型 -->
SUGGEST_CONTENT, <!-- 建议内容 -->
DEAL_CONTENT, <!-- 处理结果 -->
DEAL_USER_ID, <!-- 处理人ID -->
DEAL_USER_NAME <!-- 处理人名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #complaintDate#, #complaintNo#, #status#,
#customId#, #customName#, #complaintWay#, #complaintType#, #complaintContent#,
#complaintUserId#, #complaintUserName#, #acceptUserId#, #acceptUserName#,
#lastDate#, #dealContent#, #dealUserId#, #dealUserName#)
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #status#, #suggestDate#, #suggestNo#, #customId#, #customName#,
#suggestWay#, #suggestType#, #suggestContent#, #dealContent#, #dealUserId#, #dealUserName#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPFW004 SET DELETE_FLAG = 1 WHERE COMPLAINT_NO = #complaintNo#
UPDATE ${hpjxSchema}.T_HPFW004 SET DELETE_FLAG = 1 WHERE SUGGEST_NO = #suggestNo#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPFW004
SET
COMPLAINT_DATE = #complaintDate#, <!-- 投诉日期 -->
SUGGEST_DATE = #suggestDate#, <!-- 建议日期 -->
CUSTOM_ID = #customId#, <!-- 客户ID -->
CUSTOM_NAME = #customName#, <!-- 客户名称 -->
COMPLAINT_WAY = #complaintWay#, <!-- 投诉方式 -->
COMPLAINT_TYPE = #complaintType#, <!-- 投诉类型 -->
COMPLAINT_CONTENT = #complaintContent#, <!-- 投诉内容 -->
COMPLAINT_USER_ID = #complaintUserId#, <!-- 被投诉人ID -->
COMPLAINT_USER_NAME = #complaintUserName#, <!-- 被投诉人名称 -->
ACCEPT_USER_ID = #acceptUserId#, <!-- 受理人ID -->
ACCEPT_USER_NAME = #acceptUserName#, <!-- 受理人名称 -->
LAST_DATE = #lastDate#, <!-- 最后期限 -->
SUGGEST_WAY = #suggestWay#, <!-- 建议方式 -->
SUGGEST_TYPE = #suggestType#, <!-- 建议类型 -->
SUGGEST_CONTENT = #suggestContent#, <!-- 建议内容 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
......@@ -202,7 +191,7 @@
DEAL_USER_NAME = #dealUserName#, <!-- 处理人名称 -->
DEAL_CONTENT = #dealContent#, <!-- 处理内容 -->
<include refid="SqlBase.updateRevise"/>
WHERE COMPLAINT_NO = #complaintNo#
WHERE SUGGEST_NO = #suggestNo#
</update>
</sqlMap>
package com.baosight.hpjx.hp.fw.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConstant;
import com.baosight.hpjx.hp.fw.constant.HpFwSqlConst;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.domain.HPFW004;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
......@@ -35,7 +36,7 @@ public class HpFwTools {
AssertUtils.isEmpty(afterSaleNo, "售后单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW001.FIELD_AFTER_SALE_NO, afterSaleNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw001.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw001.LOCK, paramMap);
}
/**
......@@ -47,7 +48,7 @@ public class HpFwTools {
AssertUtils.isEmpty(afterSaleNos, "售后单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("afterSaleNos", afterSaleNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw001.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw001.LOCK, paramMap);
}
/**
......@@ -105,7 +106,7 @@ public class HpFwTools {
AssertUtils.isEmpty(careNo, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW002.FIELD_CARE_NO, careNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw002.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw002.LOCK, paramMap);
}
/**
......@@ -117,7 +118,7 @@ public class HpFwTools {
AssertUtils.isEmpty(careNos, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("careNos", careNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw002.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw002.LOCK, paramMap);
}
/**
......@@ -175,7 +176,7 @@ public class HpFwTools {
AssertUtils.isEmpty(complaintNo, "投诉单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW003.FIELD_COMPLAINT_NO, complaintNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw003.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw003.LOCK, paramMap);
}
/**
......@@ -187,7 +188,7 @@ public class HpFwTools {
AssertUtils.isEmpty(complaintNos, "投诉单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("complaintNos", complaintNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw003.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw003.LOCK, paramMap);
}
/**
......@@ -234,6 +235,76 @@ public class HpFwTools {
* @author:songx
* @date:2024/9/24,18:08
*/
public static class HpFw004 {
/**
* 锁.
*
* @param suggestNo
*/
public static void lock(String suggestNo) {
AssertUtils.isEmpty(suggestNo, "建议单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW004.FIELD_SUGGEST_NO, suggestNo);
DaoBase.getInstance().update(HpFwSqlConst.HpFw004.LOCK, paramMap);
}
/**
* 锁.
*
* @param suggestNos
*/
public static void lock(List<String> suggestNos) {
AssertUtils.isEmpty(suggestNos, "建议号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("suggestNos", suggestNos);
DaoBase.getInstance().update(HpFwSqlConst.HpFw004.LOCK, paramMap);
}
/**
* 查询
*
* @param suggestNo
* @return
*/
public static HPFW004 get(String suggestNo) {
AssertUtils.isEmpty(suggestNo, "建议单号不能为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put(HPFW004.FIELD_SUGGEST_NO, suggestNo);
List<HPFW004> results = DaoBase.getInstance().query(HPFW004.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param suggestNos
* @return
*/
public static List<HPFW004> list(List<String> suggestNos) {
AssertUtils.isEmpty(suggestNos, "建议单号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("suggestNos", suggestNos);
return DaoBase.getInstance().query(HPFW004.QUERY, paramMap);
}
/**
* 查询
*
* @param suggestNos
* @return
*/
public static Map<String, HPFW004> map(List<String> suggestNos) {
List<HPFW004> results = list(suggestNos);
return results.stream().collect(Collectors.toMap(HPFW004::getSuggestNo, item -> item));
}
}
/**
* @author:songx
* @date:2024/9/24,18:08
*/
public static class HpFw007 {
/**
......@@ -245,7 +316,7 @@ public class HpFwTools {
AssertUtils.isEmpty(folNo, "关怀单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HPFW007.FIELD_FOL_NO, folNo);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw007.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw007.LOCK, paramMap);
}
/**
......@@ -257,7 +328,7 @@ public class HpFwTools {
AssertUtils.isEmpty(folNos, "回访单号不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("folNos", folNos);
DaoBase.getInstance().update(HpFwSqlConstant.HpFw007.LOCK, paramMap);
DaoBase.getInstance().update(HpFwSqlConst.HpFw007.LOCK, paramMap);
}
/**
......
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.fw.utils;
import com.baosight.hpjx.hp.fw.domain.HPFW001;
import com.baosight.hpjx.hp.fw.domain.HPFW002;
import com.baosight.hpjx.hp.fw.domain.HPFW003;
import com.baosight.hpjx.hp.fw.domain.HPFW004;
import com.baosight.hpjx.hp.fw.domain.HPFW007;
import com.baosight.hpjx.hp.fw.tools.HpFwTools;
import com.baosight.hpjx.util.ObjectUtils;
......@@ -137,14 +138,58 @@ public class HpFwUtils {
/**
* 锁并获取数据
*
* @param complaintNos
* @param complaintNo
* @return
*/
public static HPFW003 lockAndGet(String complaintNos) {
public static HPFW003 lockAndGet(String complaintNo) {
// 锁
HpFwTools.HpFw003.lock(complaintNos);
HpFwTools.HpFw003.lock(complaintNo);
// 查询数据
return HpFwTools.HpFw003.get(complaintNo);
}
}
/**
* @author:songx
* @date:2024/9/24,18:07
*/
public static class HpFw004 {
/**
* 锁并获取数据
*
* @param fFw004s
* @return
*/
public static Map<String, HPFW004> lockAndGet(List<HPFW004> fFw004s) {
List<String> suggests = ObjectUtils.listEpKey(fFw004s, HPFW004.FIELD_SUGGEST_NO);
// 锁
HpFwTools.HpFw004.lock(suggests);
// 查询数据
return HpFwTools.HpFw004.map(suggests);
}
/**
* 锁并获取数据
*
* @param fFw004
* @return
*/
public static HPFW004 lockAndGet(HPFW004 fFw004) {
return lockAndGet(fFw004.getSuggestNo());
}
/**
* 锁并获取数据
*
* @param suggestNo
* @return
*/
public static HPFW004 lockAndGet(String suggestNo) {
// 锁
HpFwTools.HpFw004.lock(suggestNo);
// 查询数据
return HpFwTools.HpFw003.get(complaintNos);
return HpFwTools.HpFw004.get(suggestNo);
}
}
......
......@@ -59,7 +59,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
T.ID asc
T.ID DESC
</isEmpty>
</dynamic>
</sql>
......@@ -79,7 +79,7 @@
FROM ${hpjxSchema}.T_HPWD009 T
INNER JOIN ${platSchema}.XS_USER B ON T.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON D.ORG_ID = T.FACTORY_CODE
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
......@@ -88,8 +88,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPWD009 T
INNER JOIN ${platSchema}.XS_USER B ON T.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON D.ORG_ID = T.FACTORY_CODE
WHERE 1=1
<include refid="condition"/>
</select>
......
package com.baosight.hpjx.hp.xt.constant;
/**
* @author:songx
* @date:2024/9/24,17:53
*/
public class HpXtConst {
/**
* HPFW001 定义
*
* @author:songx
* @date:2024/9/24,17:54
*/
public static class HpFw001 {
}
/**
* HPFW001 定义
*
* @author:songx
* @date:2024/9/24,17:54
*/
public static class HpFw002 {
}
}
package com.baosight.hpjx.hp.xt.constant;
/**
* @author:songx
* @date:2024/9/24,18:09
*/
public class HpXtSqlConst {
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HpXt011 {
// 锁
public static final String LOCK = "HPXT011.lock";
// 发布
public static final String UPDATE_SUBMIT = "HPXT011.updateSubmit";
}
}
package com.baosight.hpjx.hp.xt.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.xt.domain.HPXT001;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import lombok.val;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
/**
*
*/
public class ServiceHPXT001 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPXT001().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXT001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPXT001.QUERY, new HPXT001());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆申请",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPXT001 hpxt001 = new HPXT001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxt001.fromMap(map);
hpxt001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPXT001.DELETE_FLAG, hpxt001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆申请",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HPXT001> list = new ArrayList<>();
for (Map resultRow : resultRows) {
HPXT001 hpxt001 = new HPXT001();
hpxt001.fromMap(resultRow);
if (hpxt001.getId() == null || hpxt001.getId() == 0) {
this.add(hpxt001);
} else {
this.modify(hpxt001);
}
list.add(hpxt001);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(list);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPXT001 hpxt001) {
this.setBaseInfo(hpxt001);
//生成车辆申请单号
hpxt001.setApplyNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.VEHICLE_APPLY_NO));
DaoUtils.insert(HPXT001.INSERT, hpxt001);
}
/**
* 设置基础信息
*
* @param hpxt001
*/
private void setBaseInfo(HPXT001 hpxt001) {
// 去除日期字符串中的-
hpxt001.setApplyDate(StringUtil.removeHorizontalLine(hpxt001.getApplyDate()));
hpxt001.setStartTime(StringUtil.removeHorizontalLine(hpxt001.getStartTime()));
hpxt001.setEndTime(StringUtil.removeHorizontalLine(hpxt001.getEndTime()));
}
/**
* 修改操作
*/
public void modify(HPXT001 hpxt001) {
DaoUtils.update(HPXT001.UPDATE, hpxt001);
}
@OperationLogAnnotation(operModul = "车辆申请",operType = "提交",operDesc = "提交审批操作")
public EiInfo approve(EiInfo inInfo){
int i = 0;
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPXT001 hpxt001 = new HPXT001();
hpxt001.fromMap(resultRow);
hpxt001.setProApplyStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPXT001.UPDATE_PRO_APPLY_STATUS,hpxt001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.approve", "提交")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("提交失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆申请",operType = "返还",operDesc = "返还操作")
public EiInfo returnStatus(EiInfo inInfo){
int i = 0;
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPXT001 hpxt001 = new HPXT001();
hpxt001.fromMap(resultRow);
hpxt001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPXT001.UPDATE_STATUS, hpxt001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.returnStatus", "返还")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
logError("返还失败", e.getMessage());
return inInfo;
}
return inInfo;
}
}
package com.baosight.hpjx.hp.xt.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.xt.domain.HPXT099;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/25,15:25
*/
public class ServiceHPXT001A extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "车辆管理-附件清单A-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPXT099().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "车辆管理-附件清单A-查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (CommonConstant.ProjectEnv.RUN.equalsIgnoreCase(projectEnv)) {
inInfo = super.query(inInfo, "HPXT099.queryRun", new HPXT099());
} else {
inInfo = super.query(inInfo, "HPXT099.queryDev", new HPXT099());
}
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.xt.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.xt.domain.HPXT001;
import com.baosight.hpjx.hp.xt.domain.HPXT002;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
*/
public class ServiceHPXT002 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPXT002().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXT002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPXT002.QUERY, new HPXT002());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆保险",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPXT002 hpxt002 = new HPXT002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxt002.fromMap(map);
hpxt002.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPXT002.DELETE_FLAG, hpxt002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆保险",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HPXT002> list = new ArrayList<>();
for (Map resultRow : resultRows) {
HPXT002 hpxt002 = new HPXT002();
hpxt002.fromMap(resultRow);
if (hpxt002.getId() == null || hpxt002.getId() == 0) {
this.add(hpxt002);
} else {
this.modify(hpxt002);
}
list.add(hpxt002);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(list);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPXT002 hpxt002) {
this.setBaseInfo(hpxt002);
DaoUtils.insert(HPXT002.INSERT, hpxt002);
}
/**
* 设置基础信息
*
* @param hpxt002
*/
private void setBaseInfo(HPXT002 hpxt002) {
// 去除日期字符串中的-
hpxt002.setApplyDate(StringUtil.removeHorizontalLine(hpxt002.getApplyDate()));
hpxt002.setApplyStatus(CommonConstant.YesNo.NO_0);
}
/**
* 修改操作
*/
public void modify(HPXT002 hpxt002) {
DaoUtils.update(HPXT002.UPDATE, hpxt002);
}
@OperationLogAnnotation(operModul = "车辆保险",operType = "提交",operDesc = "提交审批操作")
public EiInfo approve(EiInfo inInfo){
int i = 0;
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPXT002 hpxt002 = new HPXT002();
hpxt002.fromMap(resultRow);
hpxt002.setApplyStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPXT002.UPDATE_PRO_APPLY_STATUS,hpxt002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.approve", "提交")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("提交失败", e.getMessage());
return inInfo;
}
return inInfo;
}
}
package com.baosight.hpjx.hp.xt.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.xt.domain.HPXT002;
import com.baosight.hpjx.hp.xt.domain.HPXT002A;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public class ServiceHPXT002A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXT002A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPXT002A.QUERY, new HPXT002A());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆保险详情",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPXT002A hpxt002A = new HPXT002A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxt002A.fromMap(map);
hpxt002A.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPXT002A.DELETE_FLAG, hpxt002A);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "车辆保险详情",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
List<HPXT002A> list = new ArrayList<>();
for (Map resultRow : resultRows) {
HPXT002A hpxt002A = new HPXT002A();
hpxt002A.fromMap(resultRow);
if (hpxt002A.getId() == null || hpxt002A.getId() == 0) {
String hpxt002Id = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXT002A.FIELD_T_HPXT002_ID);
hpxt002A.settHpxt002Id(Long.valueOf(hpxt002Id));
this.add(hpxt002A);
} else {
this.modify(hpxt002A);
}
list.add(hpxt002A);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(list);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPXT002A hpxt002A) {
this.setBaseInfo(hpxt002A);
DaoUtils.insert(HPXT002A.INSERT, hpxt002A);
}
/**
* 设置基础信息
*
* @param hpxt002A
*/
private void setBaseInfo(HPXT002A hpxt002A) {
// 去除日期字符串中的-
hpxt002A.setInsuranceStartDate(StringUtil.removeHorizontalLine(hpxt002A.getInsuranceStartDate()));
hpxt002A.setInsuranceEndDate(StringUtil.removeHorizontalLine(hpxt002A.getInsuranceEndDate()));
}
/**
* 修改操作
*/
public void modify(HPXT002A hpxt002A) {
DaoUtils.update(HPXT002A.UPDATE, hpxt002A);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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