|
@@ -49,6 +49,12 @@ public class BizReturnReceiptController extends BaseController
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
public TableDataInfo list(BizReturnReceipt bizReturnReceipt) throws NoSuchFieldException, IllegalAccessException
|
|
public TableDataInfo list(BizReturnReceipt bizReturnReceipt) throws NoSuchFieldException, IllegalAccessException
|
|
{
|
|
{
|
|
|
|
+ if(bizReturnReceipt.getStartTime()!=null) {
|
|
|
|
+ bizReturnReceipt.setStartTime(bizReturnReceipt.getStartTime()+ " 00:00:00");
|
|
|
|
+ }
|
|
|
|
+ if(bizReturnReceipt.getEndTime()!=null) {
|
|
|
|
+ bizReturnReceipt.setEndTime(bizReturnReceipt.getEndTime()+ " 23:59:59");
|
|
|
|
+ }
|
|
final String supplierId = request.getHeader("tenantId");
|
|
final String supplierId = request.getHeader("tenantId");
|
|
bizReturnReceipt.setSupplierId(Long.parseLong(supplierId));
|
|
bizReturnReceipt.setSupplierId(Long.parseLong(supplierId));
|
|
startPage();
|
|
startPage();
|
|
@@ -81,43 +87,44 @@ public class BizReturnReceiptController extends BaseController
|
|
{
|
|
{
|
|
final String supplierId = request.getHeader("tenantId");
|
|
final String supplierId = request.getHeader("tenantId");
|
|
bizReturnReceipt.setSupplierId(Long.parseLong(supplierId));
|
|
bizReturnReceipt.setSupplierId(Long.parseLong(supplierId));
|
|
- //若有id,则说将之前的明细删除不生成新的单号
|
|
|
|
- if (bizReturnReceipt.getId() != null) {
|
|
|
|
- List<Long> ids = new ArrayList<>();
|
|
|
|
- } else {
|
|
|
|
- /* 生成单号 */
|
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yy"); // 定义日期格式
|
|
|
|
- String formattedDate = dateFormat.format(new Date());
|
|
|
|
- String codeValue;
|
|
|
|
- String codeType = "returnReceiveCode";
|
|
|
|
- //查询redis中外协单号的值
|
|
|
|
- String previous = redisCache.hasKey(codeType) ? redisCache.getCacheObject(codeType) :"";
|
|
|
|
- //若不存在,则直接存入
|
|
|
|
- if (previous.isEmpty()) {
|
|
|
|
- previous = ("SHD" + formattedDate + "000001");
|
|
|
|
- } else {
|
|
|
|
- codeValue=previous;
|
|
|
|
- int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
|
- lastFourDigits += 1; // 加1
|
|
|
|
- codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
|
- previous=codeValue;
|
|
|
|
- }
|
|
|
|
- //存到redis中
|
|
|
|
- redisCache.setCacheObject(codeType, previous);
|
|
|
|
- bizReturnReceipt.setFormCode(previous);
|
|
|
|
- }
|
|
|
|
- //向收回单主表存
|
|
|
|
- bizReturnReceiptService.save(bizReturnReceipt);
|
|
|
|
- //向收回单明细表存
|
|
|
|
- bizReturnReceipt.getDetails().stream()
|
|
|
|
- .forEach(bizReturnReceiptDetail -> {
|
|
|
|
- bizReturnReceiptDetail.setMasterId(bizReturnReceipt.getId());
|
|
|
|
- bizReturnReceiptDetail.setFormCode(bizReturnReceipt.getFormCode());
|
|
|
|
- bizReturnReceiptDetail.setSupplierId(bizReturnReceipt.getSupplierId());
|
|
|
|
- bizReturnReceiptDetail.setSupplierName(bizReturnReceipt.getSupplierName());
|
|
|
|
- bizReturnReceiptDetail.setFormDate(bizReturnReceipt.getFormDate());
|
|
|
|
- });
|
|
|
|
- return success(bizReturnReceiptDetailService.saveBatch(bizReturnReceipt.getDetails()));
|
|
|
|
|
|
+ return success();
|
|
|
|
+// //若有id,则说将之前的明细删除不生成新的单号
|
|
|
|
+// if (bizReturnReceipt.getId() != null) {
|
|
|
|
+// List<Long> ids = new ArrayList<>();
|
|
|
|
+// } else {
|
|
|
|
+// /* 生成单号 */
|
|
|
|
+// SimpleDateFormat dateFormat = new SimpleDateFormat("yy"); // 定义日期格式
|
|
|
|
+// String formattedDate = dateFormat.format(new Date());
|
|
|
|
+// String codeValue;
|
|
|
|
+// String codeType = "returnReceiveCode";
|
|
|
|
+// //查询redis中外协单号的值
|
|
|
|
+// String previous = redisCache.hasKey(codeType) ? redisCache.getCacheObject(codeType) :"";
|
|
|
|
+// //若不存在,则直接存入
|
|
|
|
+// if (previous.isEmpty()) {
|
|
|
|
+// previous = ("SHD" + formattedDate + "000001");
|
|
|
|
+// } else {
|
|
|
|
+// codeValue=previous;
|
|
|
|
+// int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
|
+// lastFourDigits += 1; // 加1
|
|
|
|
+// codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
|
+// previous=codeValue;
|
|
|
|
+// }
|
|
|
|
+// //存到redis中
|
|
|
|
+// redisCache.setCacheObject(codeType, previous);
|
|
|
|
+// bizReturnReceipt.setFormCode(previous);
|
|
|
|
+// }
|
|
|
|
+// //向收回单主表存
|
|
|
|
+// bizReturnReceiptService.save(bizReturnReceipt);
|
|
|
|
+// //向收回单明细表存
|
|
|
|
+// bizReturnReceipt.getDetails().stream()
|
|
|
|
+// .forEach(bizReturnReceiptDetail -> {
|
|
|
|
+// bizReturnReceiptDetail.setMasterId(bizReturnReceipt.getId());
|
|
|
|
+// bizReturnReceiptDetail.setFormCode(bizReturnReceipt.getFormCode());
|
|
|
|
+// bizReturnReceiptDetail.setSupplierId(bizReturnReceipt.getSupplierId());
|
|
|
|
+// bizReturnReceiptDetail.setSupplierName(bizReturnReceipt.getSupplierName());
|
|
|
|
+// bizReturnReceiptDetail.setFormDate(bizReturnReceipt.getFormDate());
|
|
|
|
+// });
|
|
|
|
+// return success(bizReturnReceiptDetailService.saveBatch(bizReturnReceipt.getDetails()));
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 修改外协单主
|
|
* 修改外协单主
|