平潭收费生成单据问题

dev_fifo1.0
anthonywj 1 year ago
parent 2983a32c3e
commit 5e62af17e7

@ -58,8 +58,8 @@ public class AuthorizeAspect {
// 根据头部名称获取相应的值
String value = request.getHeader(name);
log.info("Header Name: " + name);
log.info("Header Value: " + value);
// log.info("Header Name: " + name);
// log.info("Header Value: " + value);
}
String id = request.getHeader("ADMINID");

@ -108,6 +108,11 @@ public class ThrInvOrder implements Serializable {
*/
private Integer sourceType;
/**
* 1.2.3.
*/
private Integer genStatus;
/**
*
*/

@ -79,6 +79,7 @@ public class SpGetHttpClient {
public BaseResponse<String> postData(String taskId, BasicExportTypeEnum exportType, Object data) {
SyncUpLoadRequest build = SyncUpLoadRequest.builder().taskId(taskId).exportType(exportType).data(data).build();
String result = okHttpCli.doPostJson(getIpUrl() + "/sps/sync/upload/data", JSONUtil.toJsonStr(build), buildHeader());
log.info(result);
return JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});
}
@ -88,6 +89,7 @@ public class SpGetHttpClient {
public BaseResponse<String> postAllOrder(SpsSyncOrderResponse spsSyncOrderResponse) {
String json = JSONUtil.toJsonStr(spsSyncOrderResponse);
String result = okHttpCli.doPostJson(getIpUrl() + "/orderApi/sps/sync/order/upload", json, buildHeader());
log.info(result);
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});
@ -98,6 +100,7 @@ public class SpGetHttpClient {
public BaseResponse<String> postAllBusOrder(SpsSyncBusOrderResponse spsSyncOrderResponse) {
String json = JSONUtil.toJsonStr(spsSyncOrderResponse);
String result = okHttpCli.doPostJson(getIpUrl() + "/busOrderApi/sps/sync/busOrder/upload", json, buildHeader());
log.info(result);
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});
@ -109,6 +112,7 @@ public class SpGetHttpClient {
public BaseResponse<String> postAllBusType(SpsSyncBusResponse spsSyncBusResponse) {
String json = JSONUtil.toJsonStr(spsSyncBusResponse);
String result = okHttpCli.doPostJson(getIpUrl() + "/sps/sync/busType/upload", json, buildHeader());
log.info(result);
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});

@ -285,7 +285,7 @@ public class IoAddInoutService {
if (StrUtil.isEmpty(orderDetailBizEntity.getSupId())) {
errMsg = errMsg + orderDetailBizEntity.getCoName() + "该产品未指定供应商;";
}
if (orderDetailBizEntity.getCount() == 0) {
if (IntUtil.value(orderDetailBizEntity.getCount()) == 0) {
errMsg = errMsg + orderDetailBizEntity.getCoName() + "产品数量不能为0;";
}

@ -2,9 +2,9 @@ package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
@ -21,7 +21,6 @@ import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.exception.JsonException;
import com.glxp.api.http.ErpInvClient;
@ -36,7 +35,6 @@ import com.glxp.api.res.inv.ThrInvResultResponse;
import com.glxp.api.res.thrsys.ThrInvOrderResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.basic.ProductInfoService;
import com.glxp.api.service.basic.UdiRelevanceService;
import com.glxp.api.service.basic.UdiRlSupService;
import com.glxp.api.service.basic.impl.BasicDestinyRelService;
@ -53,7 +51,6 @@ import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -62,6 +59,7 @@ import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -810,39 +808,46 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
@Override
public void scanInvSfOrderGenerateSfOrder() {
log.info("扫描处理第三方收费明细生成单据定时任务开始");
List<ThrInvOrderDetail> list = thrInvOrderDetailMapper.selectSourceTypeList(Constant.THR_INV_SF_ORDER_TYPE);
// List<ThrInvOrderDetail> list = thrInvOrderDetailMapper.selectSourceTypeList(Constant.THR_INV_SF_ORDER_TYPE);
List<ThrInvOrder> thrInvOrders = thrInvOrderMapper.selectList(new LambdaQueryWrapper<ThrInvOrder>()
.eq(ThrInvOrder::getSourceType, Constant.THR_INV_SF_ORDER_TYPE)
.lt(ThrInvOrder::getGenStatus, 3));
if (CollUtil.isNotEmpty(thrInvOrders)) {
for (ThrInvOrder thrInvOrder : thrInvOrders) {
/**
* 1
* 2
* 3
* 4
*/
if (CollectionUtil.isEmpty(list)) return;
Map<String, List<ThrInvOrderDetail>> grouped = list.stream()
.collect(Collectors.groupingBy(ThrInvOrderDetail::getOrderIdFk));
for (Map.Entry<String, List<ThrInvOrderDetail>> entry : grouped.entrySet()) {
String orderIdFk = entry.getKey();
log.info("扫描处理第三方收费明细生成单据定时任务==orderIdFk==:[" + orderIdFk + "]");
List<ThrInvOrderDetail> thrInvOrderDetails = entry.getValue();
List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(
new LambdaQueryWrapper<ThrInvOrderDetail>()
.and(o -> o.isNull(ThrInvOrderDetail::getHandleStatus).or().ne(ThrInvOrderDetail::getHandleStatus, 1)).
eq(ThrInvOrderDetail::getOrderIdFk, thrInvOrder.getBillNo())
);
if (CollectionUtil.isEmpty(thrInvOrderDetails)) return;
log.info("扫描处理第三方收费明细生成单据定时任务==orderIdFk==:[" + thrInvOrder.getBillNo() + "]");
//新单号
String newBillNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd"));
//通过单号获取单据信息
QueryWrapper<ThrInvOrder> qw = new QueryWrapper<>();
qw.eq("billNo", orderIdFk);
ThrInvOrder thrInvOrder = thrInvOrderMapper.selectOne(qw);
qw.eq("billNo", thrInvOrder.getBillNo());
BasicBussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findByAction(thrInvOrder.getBillType());
List<ThrInvOrderDetail> addThrInvOrderDetails = new ArrayList<>();
List<ThrInvOrderDetail> updateThrInvOrderDetails = new ArrayList<>();
List<Long> delThrInvOrderDetailIds = new ArrayList<>();
List<String> delThrCodes = new ArrayList<>();
if (thrInvOrder.getSourceType() == Constant.THR_INV_SF_ORDER_TYPE) {//走组套
log.info("走组套");
AtomicInteger fullGen = new AtomicInteger();
thrInvOrderDetails.forEach(item -> {
Long relId = item.getRelId();
if (ObjectUtil.isNull(relId)) {
//通过thrCode获取到项目组套
String thrCode = item.getThrCode();
Integer count = Integer.valueOf(item.getReCount());
List<BasicSkProjectDetailEntity> skProjectDetailEntityList = basicDestinyRelService.filterDestinyRelListByPId(thrCode);
@ -852,7 +857,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail();
BeanUtils.copyProperties(item, thrInvOrderDetail);
thrInvOrderDetail.setId(null);
thrInvOrderDetail.setOrderIdFk(orderIdFk);
thrInvOrderDetail.setOrderIdFk(thrInvOrder.getBillNo());
thrInvOrderDetail.setRelId(sk.getRelId());
thrInvOrderDetail.setSupId(sk.getSupId() + "");
thrInvOrderDetail.setHandleStatus(1);
@ -862,15 +867,20 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
if (skCount != null && skCount > 0) {
thrInvOrderDetail.setReCount(String.valueOf(skCount * count));
}
addThrInvOrderDetails.add(thrInvOrderDetail);
delThrCodes.add(thrCode);
});
} else {
fullGen.getAndIncrement();
}
}
});
if (thrInvOrderDetails.size() == fullGen.intValue()) {
thrInvOrder.setGenStatus(2);
thrInvOrderMapper.updateById(thrInvOrder);
} else if (thrInvOrder.getGenStatus() < 1 && fullGen.intValue() > 0) {
thrInvOrder.setGenStatus(2);
thrInvOrderMapper.updateById(thrInvOrder);
}
} else {//不走组套
log.info("不走组套");
@ -894,7 +904,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId);
if (udiRlSupEntity != null)
item.setSupId(udiRlSupEntity.getCustomerId());
} else {
}
}
});
@ -918,7 +927,16 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
if (CollectionUtil.isNotEmpty(updateThrInvOrderDetails)) {
thrInvOrderDetailMapper.updateBatchById(updateThrInvOrderDetails);
}
genOrder(newBillNo, updateThrInvOrderDetails, addThrInvOrderDetails, thrInvOrder, bussinessTypeEntity);
log.info("扫描处理第三方收费明细生成单据定时任务结束");
}
}
}
public void genOrder(String newBillNo,
List<ThrInvOrderDetail> updateThrInvOrderDetails, List<ThrInvOrderDetail> addThrInvOrderDetails,
ThrInvOrder thrInvOrder, BasicBussinessTypeEntity bussinessTypeEntity) {
if (updateThrInvOrderDetails.size() > 0 || addThrInvOrderDetails.size() > 0) {
IoOrderEntity ioOrderEntity = new IoOrderEntity();
@ -969,8 +987,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
ioAddInoutService.dealBusProcess(ioOrderEntity, bussinessTypeEntity);
}
}
log.info("扫描处理第三方收费明细生成单据定时任务结束");
}
@Override
public void scanInvPhOrderGeneratePhOrder() {
@ -1259,6 +1275,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
newBillNo) {
List<Long> relIds = thrInvOrderDetails.stream().filter(x -> ObjectUtil.isNotNull(x.getRelId()))
.map(ThrInvOrderDetail::getRelId).collect(Collectors.toList());
if (CollUtil.isEmpty(relIds))
return false;
List<BasicProductsEntity> basicProductsEntities = udiRelevanceDao.selectProductByRelIds(relIds);
if (CollectionUtil.isEmpty(basicProductsEntities)) return false;
Map<Long, BasicProductsEntity> relIdBasicProductsEntityMap = basicProductsEntities.stream().collect(Collectors.toMap(BasicProductsEntity::getId, x -> x));
@ -1266,12 +1284,15 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
for (int i = 0; i < thrInvOrderDetails.size(); i++) {
ThrInvOrderDetail thrInvOrderDetail = thrInvOrderDetails.get(i);
Long relId = thrInvOrderDetail.getRelId();
if (relId != null) {
BasicProductsEntity basicProductsEntity = relIdBasicProductsEntityMap.get(relId);
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
parameterPackag(basicProductsEntity, ioOrderDetailBizEntity, thrInvOrderDetail);
ioOrderDetailBizEntity.setOrderIdFk(newBillNo);
newOrderDetailBiz.add(ioOrderDetailBizEntity);
}
}
return true;
}
@ -1320,7 +1341,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
ioOrderDetailBizEntity.setBindRlFk(basicProductsEntity.getId());
ioOrderDetailBizEntity.setSupId(thrInvOrderDetail.getSupId());
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
ioOrderDetailBizEntity.setCount(Integer.valueOf(thrInvOrderDetail.getReCount()));
ioOrderDetailBizEntity.setCount(IntUtil.value(thrInvOrderDetail.getReCount()));
ioOrderDetailBizEntity.setBatchNo(thrInvOrderDetail.getBatchNo());
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
@ -1374,6 +1395,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
thrInvOrder.setStatus(ConstantStatus.SFIO_DRAFT);//单据状态 草稿
thrInvOrder.setSourceType(SourceType);//来源类型
thrInvOrder.setCreateTime(newDate);
thrInvOrder.setGenStatus(1);
if (thrSystemBusApiEntity != null)
thrInvOrder.setFromCorp(thrSystemBusApiEntity.getFromCorp());
thrInvOrder.setCreateUser("外部系统下载");

@ -1,10 +1,12 @@
package com.glxp.api.task;
import cn.hutool.core.thread.ThreadUtil;
import com.glxp.api.dao.schedule.ScheduledDao;
import com.glxp.api.entity.system.ScheduledEntity;
import com.glxp.api.req.system.ScheduledRequest;
import com.glxp.api.service.thrsys.ThrInvOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
@ -49,7 +51,7 @@ public class ScanThrOrderGenerateOrderTask implements SchedulingConfigurer {
try {
thrInvOrderService.scanInvSfOrderGenerateSfOrder();
} catch (Exception e) {
log.error(ExceptionUtils.getStackTrace(e));
}
log.info("定时扫描三方的明细表-收费明细类型结束");
//=======================================================================================
@ -57,7 +59,7 @@ public class ScanThrOrderGenerateOrderTask implements SchedulingConfigurer {
try {
thrInvOrderService.scanInvPhOrderGeneratePhOrder();
} catch (Exception e) {
log.error(ExceptionUtils.getStackTrace(e));
}
log.info("定时扫描三方的明细表-普耗明细类型结束");
//=======================================================================================

@ -4,7 +4,7 @@ server:
spring:
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_ct?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
jdbc-url: jdbc:p6spy:mysql://192.168.0.43:3306/udi_wms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
hikari:

@ -33,5 +33,4 @@
AND (thr_inv_order_detail.handleStatus = 0 or thr_inv_order_detail.handleStatus is null)
</where>
</select>
</mapper>

@ -1809,11 +1809,14 @@ values (7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admi
insert IGNORE into sys_dict_type
values (4, '设备来源', 'device_source_type', '0', 'admin', sysdate(), '', null, '设备来源列表');
insert IGNORE into sys_dict_data
values (8, 1, '采购', '1', 'device_source_type', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, 'chooseProductFlag');
values (8, 1, '采购', '1', 'device_source_type', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null,
'chooseProductFlag');
insert IGNORE into sys_dict_data
values (9, 2, '赠与', '2', 'device_source_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, 'selectInvProductVisible');
values (9, 2, '赠与', '2', 'device_source_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null,
'selectInvProductVisible');
insert IGNORE into sys_dict_data
values (10, 3, '寄售', '3', 'device_source_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, 'chooseProductFlag');
values (10, 3, '寄售', '3', 'device_source_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null,
'chooseProductFlag');
ALTER TABLE sys_dict_data
@ -1821,11 +1824,16 @@ ALTER TABLE sys_dict_data
ALTER TABLE sys_dict_type
MODIFY COLUMN `dict_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '字典主键' FIRST;
INSERT IGNORE INTO sys_dict_type(`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES (9, '相关人员类别', 'device_user_type', '0', 'admin', '2024-03-20 11:47:55', 'admin', '2024-03-20 11:47:55', '相关人员类别列表');
insert IGNORE into sys_dict_data values(11, 1, '维护员', '1', 'device_user_type', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '维护人员');
insert IGNORE into sys_dict_data values(12, 2, '厂家技术支持', '2', 'device_user_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '厂家技术支持人员');
insert IGNORE into sys_dict_data values(13, 3, '操作员', '3', 'device_user_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '操作人员');
INSERT IGNORE INTO sys_dict_type(`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`,
`update_time`, `remark`)
VALUES (9, '相关人员类别', 'device_user_type', '0', 'admin', '2024-03-20 11:47:55', 'admin', '2024-03-20 11:47:55',
'相关人员类别列表');
insert IGNORE into sys_dict_data
values (11, 1, '维护员', '1', 'device_user_type', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '维护人员');
insert IGNORE into sys_dict_data
values (12, 2, '厂家技术支持', '2', 'device_user_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '厂家技术支持人员');
insert IGNORE into sys_dict_data
values (13, 3, '操作员', '3', 'device_user_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '操作人员');
CALL Pro_Temp_ColumnWork('device_asset_user', 'userType',
' varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NULL DEFAULT NULL COMMENT ''用户类型'' ',
@ -1839,8 +1847,13 @@ ALTER TABLE device_asset_user
CALL Pro_Temp_ColumnWork('thr_inv_order_detail', 'batchNo', 'varchar(60)', 2);
INSERT IGNORE INTO sys_custom_config_detail(`id`, `configId`, `type`, `isShow`, `columnName`, `columnDesc`, `columnType`, `colorRule`, `sort`, `lableRule`, `width`, `tooltip`, `buttonRule`, `number`, `lineNumber`, `clickFuc`, `size`, `style`, `disabled`, `checkRules`, `inputType`, `disabledFuc`, `expression`, `dataFuc`, `isShowXx`)
VALUES (38032, 16, '1', 1, 'auditTime', '审核时间', 'text', '', NULL, '', NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT IGNORE INTO sys_custom_config_detail(`id`, `configId`, `type`, `isShow`, `columnName`, `columnDesc`,
`columnType`, `colorRule`, `sort`, `lableRule`, `width`, `tooltip`,
`buttonRule`, `number`, `lineNumber`, `clickFuc`, `size`, `style`,
`disabled`, `checkRules`, `inputType`, `disabledFuc`, `expression`,
`dataFuc`, `isShowXx`)
VALUES (38032, 16, '1', 1, 'auditTime', '审核时间', 'text', '', NULL, '', NULL, NULL, '', NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CALL Pro_Temp_ColumnWork('basic_products', 'catalogname1',
' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT ''一级分类名称(学科,品名)''',
@ -1878,3 +1891,8 @@ CALL Pro_Temp_ColumnWork('thr_inv_order_detail', 'toBillNo',
CALL Pro_Temp_ColumnWork('thr_inv_order', 'toBillNo',
' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT ''生成的单据号''',
1);
CALL Pro_Temp_ColumnWork('thr_inv_order', 'genStatus',
' tinyint NULL DEFAULT NULL COMMENT ''生成单据状态''',
1);

Loading…
Cancel
Save