You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.4 KiB
Java
62 lines
2.4 KiB
Java
2 years ago
|
package com.glxp.api.controller.inout;
|
||
|
|
||
|
import cn.hutool.core.collection.CollUtil;
|
||
|
import cn.hutool.core.util.StrUtil;
|
||
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||
|
import com.glxp.api.annotation.Log;
|
||
|
import com.glxp.api.common.res.BaseResponse;
|
||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||
|
import com.glxp.api.constant.BusinessType;
|
||
|
import com.glxp.api.dao.inout.IoOrderInvoiceMapper;
|
||
|
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
||
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
||
|
import com.glxp.api.idc.service.FileService;
|
||
|
import com.glxp.api.req.inout.AddBizProductReqeust;
|
||
|
import com.glxp.api.req.inout.RefreshInoiceRequest;
|
||
|
import com.glxp.api.service.inout.IoOrderInvoiceService;
|
||
|
import com.glxp.api.service.inout.IoOrderService;
|
||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
@RestController
|
||
|
public class IoOrderInvoiceController {
|
||
|
@Resource
|
||
|
IoOrderInvoiceMapper orderInvoiceMapper;
|
||
|
@Resource
|
||
|
SpGetHttpClient spGetHttpClient;
|
||
|
@Resource
|
||
|
FileService fileService;
|
||
|
|
||
|
@AuthRuleAnnotation("")
|
||
|
@PostMapping("/udiwms/inout/order/refrshInvoice")
|
||
|
@Log(title = "发票", businessType = BusinessType.INSERT)
|
||
|
public BaseResponse addBizProduct(@RequestBody RefreshInoiceRequest refreshInoiceRequest) {
|
||
|
BaseResponse<List<IoOrderInvoiceEntity>> baseResponse = spGetHttpClient.getIoOrderInvoices(refreshInoiceRequest);
|
||
|
if (baseResponse.getCode() == 20000) {
|
||
|
List<IoOrderInvoiceEntity> orderInvoiceEntities = baseResponse.getData();
|
||
|
if (CollUtil.isNotEmpty(orderInvoiceEntities)) {
|
||
|
List<String> syncFiles = new ArrayList<>();
|
||
|
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
|
||
|
if (StrUtil.isNotEmpty(orderInvoiceEntity.getLicenseUrl())) {
|
||
|
syncFiles.add(orderInvoiceEntity.getLicenseUrl());
|
||
|
}
|
||
|
orderInvoiceMapper.insertOrUpdate(orderInvoiceEntity);
|
||
|
}
|
||
|
|
||
|
if (CollUtil.isNotEmpty(syncFiles)) {
|
||
|
fileService.download(syncFiles);
|
||
|
}
|
||
|
}
|
||
|
return ResultVOUtils.success("更新成功!");
|
||
|
} else
|
||
|
return baseResponse;
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|