Browse Source

add: 增加延迟测试;

test-20240527
龚宝雄 4 months ago
parent
commit
fa4025b0a7
  1. 3
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/AllocationBillController.java
  2. 39
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java
  3. 7
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java
  4. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/AllocationBill.java
  5. 6
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java
  6. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java
  7. 15
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/WarehouseInfo.java
  8. 2
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java
  9. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java
  10. 1
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java
  11. 45
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java
  12. 20
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java
  13. 4
      nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

3
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/AllocationBillController.java

@ -81,10 +81,11 @@ public class AllocationBillController {
@Log("单据直接调拨") @Log("单据直接调拨")
@SaIgnore @SaIgnore
//@SaCheckPermission("@el.check(allocationConfirm:edit')") //@SaCheckPermission("@el.check(allocationConfirm:edit')")
public CommonResult confirm(@RequestBody List<AllocationBillVO> params) { public CommonResult confirm(@RequestBody List<AllocationBillVO> params) throws InterruptedException {
if (params.isEmpty()) { if (params.isEmpty()) {
throw new BadRequestException("参数为空!"); throw new BadRequestException("参数为空!");
} }
Thread.sleep(5000);
// return RestBusinessTemplate.execute(() -> allocationBillService.allocationConfirm(params)); // return RestBusinessTemplate.execute(() -> allocationBillService.allocationConfirm(params));
return RestBusinessTemplate.execute(() -> null); return RestBusinessTemplate.execute(() -> null);
} }

39
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java

@ -1,5 +1,6 @@
package org.nl.wms.database.eas.controller; package org.nl.wms.database.eas.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -52,10 +53,11 @@ public class EasOutInBillController {
@Log("出入库单据审核") @Log("出入库单据审核")
@SaIgnore @SaIgnore
//@SaCheckPermission("@el.check(EasOutInBill:edit')") //@SaCheckPermission("@el.check(EasOutInBill:edit')")
public CommonResult audit(@RequestBody List<String> ids) { public CommonResult audit(@RequestBody List<String> ids) throws InterruptedException {
if (ids == null || ids.isEmpty()) { if (ids == null || ids.isEmpty()) {
return CommonResult.failed(ResultCode.FAILED); return CommonResult.failed(ResultCode.FAILED);
} }
Thread.sleep(5000);
return RestBusinessTemplate.execute(()->easOutInBillService.audit(ids, true)); return RestBusinessTemplate.execute(()->easOutInBillService.audit(ids, true));
} }
@ -80,7 +82,13 @@ public class EasOutInBillController {
@PostMapping("/getBillsCount") @PostMapping("/getBillsCount")
@Log("首页显示出入库单据数量") @Log("首页显示出入库单据数量")
public CommonResult<List<HomeBillCounts>> getBillsCount() { public CommonResult<List<HomeBillCounts>> getBillsCount() {
return RestBusinessTemplate.execute(() -> easOutInBillService.getBillsCount()); return RestBusinessTemplate.execute(() -> {
try {
return easOutInBillService.getBillsCount();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
} }
/** /**
@ -89,7 +97,32 @@ public class EasOutInBillController {
@PostMapping("/getOrganizationInfo") @PostMapping("/getOrganizationInfo")
@Log("获取组织机构信息") @Log("获取组织机构信息")
public CommonResult<List<WarehouseInfo>> getOrganizationInfo() { public CommonResult<List<WarehouseInfo>> getOrganizationInfo() {
return null; List<WarehouseInfo> list =new ArrayList<WarehouseInfo>();
WarehouseInfo w1=new WarehouseInfo();
w1.setKczzbm("08");
w1.setKczzmc("浙江宏智物流装备有限公司");
list.add(w1);
WarehouseInfo w2=new WarehouseInfo();
w2.setKczzbm("01.09.10");
w2.setKczzmc("高空平台事业部");
list.add(w2);
WarehouseInfo w3=new WarehouseInfo();
w3.setKczzbm("01.09.03");
w3.setKczzmc("搬运车厂");
list.add(w3);
WarehouseInfo w4=new WarehouseInfo();
w4.setKczzbm("01.09.04");
w4.setKczzmc("电动车厂");
list.add(w4);
WarehouseInfo w5=new WarehouseInfo();
w5.setKczzbm("01.09.0");
w5.setKczzmc("计划管理部");
list.add(w5);
WarehouseInfo w6=new WarehouseInfo();
w6.setKczzbm("01");
w6.setKczzmc("诺力智能装备股份有限公司");
list.add(w6);
return RestBusinessTemplate.execute(() -> list);
} }

7
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java

@ -84,10 +84,11 @@ public class ReceiptBillController {
@Log("收货单确认") @Log("收货单确认")
@SaIgnore @SaIgnore
//@SaCheckPermission("@el.check(receiptConfirm:edit')") //@SaCheckPermission("@el.check(receiptConfirm:edit')")
public CommonResult confirm(@RequestBody List<ReceiptBillVO> params) { public CommonResult confirm(@RequestBody List<ReceiptBillVO> params) throws InterruptedException {
if (params.isEmpty()) { if (params.isEmpty()) {
throw new BadRequestException("参数为空!"); throw new BadRequestException("参数为空!");
} }
Thread.sleep(5000);
// return RestBusinessTemplate.execute(() -> receiptBillService.receiptConfirm(params)); // return RestBusinessTemplate.execute(() -> receiptBillService.receiptConfirm(params));
return RestBusinessTemplate.execute(() -> null); return RestBusinessTemplate.execute(() -> null);
} }
@ -114,8 +115,8 @@ public class ReceiptBillController {
@PostMapping("/update") @PostMapping("/update")
@Log("修改") @Log("修改")
//@SaCheckPermission("@el.check(ReceiptBill:edit')") //@SaCheckPermission("@el.check(ReceiptBill:edit')")
public CommonResult update(@RequestBody ReceiptBillVO entity) { public CommonResult update(@RequestBody List<ReceiptBillVO> entityList) {
return RestBusinessTemplate.execute(() -> receiptBillService.update(entity)); return RestBusinessTemplate.execute(() -> receiptBillService.update(entityList));
} }

4
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/AllocationBill.java

@ -26,6 +26,10 @@ public class AllocationBill extends Model<AllocationBill> {
*/ */
@TableId(value = "flid", type = IdType.NONE) @TableId(value = "flid", type = IdType.NONE)
private String flid; private String flid;
/**
* 审核结果
*/
private String shjg;
/** /**
* 单据ID * 单据ID

6
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java

@ -155,6 +155,12 @@ public class EasOutInBill extends Model<EasOutInBill> {
*/ */
private String update_time; private String update_time;
/**
* 审核结果
*/
private String shjg;
/** /**
* 获取主键值 * 获取主键值

4
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java

@ -29,6 +29,10 @@ public class ReceiptBill extends Model<ReceiptBill> {
@TableId(value = "flid", type = IdType.NONE) @TableId(value = "flid", type = IdType.NONE)
private String flid; private String flid;
/**
* 审核结果
*/
private String shjg;
/** /**
* 送货单id * 送货单id

15
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/WarehouseInfo.java

@ -28,13 +28,24 @@ public class WarehouseInfo implements Serializable {
/** /**
* 组织编码 * 组织编码
*/ */
private String kcbm; private String kczzbm;
/** /**
* 组织名称 * 组织名称
*/ */
private String kcmc; private String kczzmc;
/**
* 仓管员编码
*/
private String cgybm;
/**
* 仓管员名称
*/
private String cgymc;
/** /**
* 状态 * 状态

2
nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java

@ -36,7 +36,7 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
* *
* @return JSONObject * @return JSONObject
*/ */
List<HomeBillCounts> getBillsCount(); List<HomeBillCounts> getBillsCount() throws InterruptedException;
/** /**

4
nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java

@ -60,9 +60,9 @@ public interface IreceiptBillService extends IService<ReceiptBill> {
/** /**
* 编辑 * 编辑
* *
* @param entity / * @param entityList /
*/ */
void update(ReceiptBillVO entity); void update(List<ReceiptBillVO> entityList);
/** /**
* 多选删除 * 多选删除

1
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java

@ -63,7 +63,6 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
long totalCount = allocationBillMapper.getAllocationCount(); long totalCount = allocationBillMapper.getAllocationCount();
Page<AllocationBill> pageObject = new Page<>(params.getPage(), params.getSize()); Page<AllocationBill> pageObject = new Page<>(params.getPage(), params.getSize());
Page<AllocationBill> allocationBills = allocationBillMapper.allocationPage(pageObject, params.getFuzzy()); Page<AllocationBill> allocationBills = allocationBillMapper.allocationPage(pageObject, params.getFuzzy());
Thread.sleep(5000);
return CommonPage.getPage(allocationBills, totalCount); return CommonPage.getPage(allocationBills, totalCount);
} }

45
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.base.CommonPage; import org.nl.common.base.CommonPage;
import org.nl.common.enums.wms.EasBillTypeEnum; import org.nl.common.enums.wms.EasBillTypeEnum;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
@ -78,7 +79,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
* 首页显示出入库单据数量 * 首页显示出入库单据数量
*/ */
@Override @Override
public List<HomeBillCounts> getBillsCount() { public List<HomeBillCounts> getBillsCount() throws InterruptedException {
List<HomeBillCounts> allCounts =easOutInBillMapper.getBillsCount(); List<HomeBillCounts> allCounts =easOutInBillMapper.getBillsCount();
HomeBillCounts allocations =new HomeBillCounts(); HomeBillCounts allocations =new HomeBillCounts();
@ -132,7 +133,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
.lambda() .lambda()
.eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx()) .eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx())
.eq(ObjectUtil.isNotEmpty(params.getCkbm()), EasOutInBill::getCkbm, params.getCkbm()) .eq(ObjectUtil.isNotEmpty(params.getCkbm()), EasOutInBill::getCkbm, params.getCkbm())
.eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "1".equals(params.getDjzt()) ? "提交" : "审核") .eq(EasOutInBill::getDjzt, "提交")
.nested(ObjectUtil.isNotEmpty(params.getFuzzy()), .nested(ObjectUtil.isNotEmpty(params.getFuzzy()),
i -> i.like(EasOutInBill::getDjid, params.getFuzzy()) i -> i.like(EasOutInBill::getDjid, params.getFuzzy())
.or() .or()
@ -549,23 +550,28 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
EasData easData = new EasData(); EasData easData = new EasData();
easData.setData(bill); easData.setData(bill);
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
msgDto = wmsToEasService.sendWebService(billJson); String msg ="审核失败:此入库单在PC端完成操作,单据为:CGRK2024072316142732";
if (msgDto != null) { UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>().set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).eq("djid", bill.getBillId());
if (msgDto.getResult() == 0) { if (StringUtils.isNoneBlank(msg)) {
throw new BadRequestException(msgDto.getMsg()); updateWrapper.set("shjg", msg);
} } else {
updateWrapper.set("djzt", "审核");
} }
easOutInBillMapper.update(null, updateWrapper);
// msgDto = wmsToEasService.sendWebService(billJson);
} else { } else {
SrmMsgDto srmMsgDto; SrmMsgDto srmMsgDto;
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
srmMsgDto = wmsToSrmService.sendWebPostData(billJson); // srmMsgDto = wmsToSrmService.sendWebPostData(billJson);
if (srmMsgDto != null) { String msg ="";
if ("false".equals(srmMsgDto.getSuccess())) { UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>().set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).eq("djid", bill.getBillId());
throw new BadRequestException(srmMsgDto.getMessage()); if (StringUtils.isNoneBlank(msg)) {
} updateWrapper.set("shjg", msg);
} else {
updateWrapper.set("djzt", "审核");
} }
easOutInBillMapper.update(null, updateWrapper);
} }
updateBills(bill);
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
throw new BadRequestException(e.toString()); throw new BadRequestException(e.toString());
@ -582,8 +588,15 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
EasData easData = new EasData(); EasData easData = new EasData();
easData.setData(bill); easData.setData(bill);
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
wmsToEasService.sendWebService(billJson); // wmsToEasService.sendWebService(billJson);
updateBills(bill); String msg ="审核失败:此入库单在PC端完成操作,单据为:CGRK2024072316142732";
UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>().set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).eq("djid", bill.getBillId());
if (StringUtils.isNoneBlank(msg)) {
updateWrapper.set("shjg", msg);
} else {
updateWrapper.set("djzt", "审核");
}
easOutInBillMapper.update(null, updateWrapper);
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
//throw new BadRequestException(e.toString()); //throw new BadRequestException(e.toString());
@ -599,7 +612,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
for (EasOutInBillDto bill : bills) { for (EasOutInBillDto bill : bills) {
try { try {
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
wmsToSrmService.sendWebPostData(billJson); // wmsToSrmService.sendWebPostData(billJson);
updateBills(bill); updateBills(bill);
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());

20
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java

@ -1,9 +1,11 @@
package org.nl.wms.database.eas.service.impl; package org.nl.wms.database.eas.service.impl;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
@ -176,17 +178,21 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
* 修改收货单 * 修改收货单
*/ */
@Override @Override
public void update(ReceiptBillVO entity) { public void update(List<ReceiptBillVO> entityList) {
ReceiptBill2 receiptBill = receiptBill2Mapper.selectOne(new LambdaQueryWrapper<ReceiptBill2>().eq(ReceiptBill2::getDjid,entity.getDjid())); if (CollectionUtils.isNotEmpty(entityList)) {
entityList.forEach(r -> {
ReceiptBill receiptBill = this.getById(r.getFlid());
if (receiptBill == null) { if (receiptBill == null) {
// 如果不存在该记录,则插入数据 // 如果不存在该记录,则插入数据
ReceiptBill2 receiptBillNew = new ReceiptBill2(); ReceiptBill receiptBillNew = new ReceiptBill();
BeanUtils.copyProperties(entity, receiptBillNew); BeanUtils.copyProperties(r, receiptBillNew);
receiptBill2Mapper.insert(receiptBillNew); this.save(receiptBillNew);
} else { } else {
// 如果存在该记录,则更新数据 // 如果存在该记录,则更新数据
BeanUtils.copyProperties(entity, receiptBill); BeanUtils.copyProperties(r, receiptBill);
receiptBill2Mapper.updateById(receiptBill); this.updateById(receiptBill);
}
});
} }
} }

4
nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

@ -113,7 +113,11 @@ public class EasBillSchedule {
SendHomeWebSocketServer.getWebSocketSet(); SendHomeWebSocketServer.getWebSocketSet();
if (webSocketSet.size() > 0) { if (webSocketSet.size() > 0) {
webSocketSet.forEach(c -> { webSocketSet.forEach(c -> {
try {
c.sendDataToClient(easOutInBillService.getBillsCount()); c.sendDataToClient(easOutInBillService.getBillsCount());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}); });
} }
//stopWatch.stop(); //stopWatch.stop();

Loading…
Cancel
Save