|
@@ -46,7 +46,7 @@ public class InvoiceApiController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name="keyId", value="keyId", required=true, paramType="query"),
|
|
|
@ApiImplicitParam(name="keySecret", value="keySecret", required=true, paramType="query"),
|
|
|
- @ApiImplicitParam(name="destinationName", value="目的地", required=true, paramType="query"),
|
|
|
+ @ApiImplicitParam(name="destinationId", value="目的地编号", required=true, paramType="query"),
|
|
|
@ApiImplicitParam(name="shipment", value="发货日期", required=true, paramType="query", dataType="date"),
|
|
|
@ApiImplicitParam(name="recipient", value="收货人", required=true, paramType="query"),
|
|
|
@ApiImplicitParam(name="telephone", value="联系电话", required=true, paramType="query", dataType="int"),
|
|
@@ -54,35 +54,28 @@ public class InvoiceApiController {
|
|
|
@ApiImplicitParam(name="address", value="收货地址", required=true, paramType="query"),
|
|
|
@ApiImplicitParam(name="goodsValue", value="货值", required=true, paramType="query", dataType="int"),
|
|
|
})
|
|
|
- public MessageResult addInvoice(String keyId, String keySecret, String destinationName, Date shipment, String recipient, String telephone, String company, String address, Integer goodsValue){
|
|
|
+ public MessageResult addInvoice(String keyId, String keySecret, String destinationId, Date shipment, String recipient, String telephone, String company, String address, Integer goodsValue){
|
|
|
MessageResult msgResult = new MessageResult<>();
|
|
|
|
|
|
User user = userService.findByUserName(keyId);
|
|
|
if(user.getPassword().equals(keySecret)) {
|
|
|
- Destination destination = destinationService.getByName(destinationName);
|
|
|
- if(destination != null) {
|
|
|
- Invoice invoice = new Invoice();
|
|
|
- invoice.setId(UUID.randomUUID().toString());
|
|
|
- invoice.setDestinationId(destination.getId());
|
|
|
- invoice.setShipment(shipment);
|
|
|
- invoice.setRecipient(recipient);
|
|
|
- invoice.setRecipientTelephone(telephone);
|
|
|
- invoice.setRecipientEntity(company);
|
|
|
- invoice.setRecipientAddress(address);
|
|
|
- invoice.setGoodsValue(goodsValue);
|
|
|
- invoice.setStatus(false);
|
|
|
- invoice.setDelFlag(false);
|
|
|
- invoice.setCreateTime(new Date());
|
|
|
- invoice.setCreateBy(user.getId());
|
|
|
- invoiceService.insert(invoice);
|
|
|
+ Invoice invoice = new Invoice();
|
|
|
+ invoice.setId(UUID.randomUUID().toString());
|
|
|
+ invoice.setDestinationId(destinationId);
|
|
|
+ invoice.setShipment(shipment);
|
|
|
+ invoice.setRecipient(recipient);
|
|
|
+ invoice.setRecipientTelephone(telephone);
|
|
|
+ invoice.setRecipientEntity(company);
|
|
|
+ invoice.setRecipientAddress(address);
|
|
|
+ invoice.setGoodsValue(goodsValue);
|
|
|
+ invoice.setStatus(false);
|
|
|
+ invoice.setDelFlag(false);
|
|
|
+ invoice.setCreateTime(new Date());
|
|
|
+ invoice.setCreateBy(user.getId());
|
|
|
+ invoiceService.insert(invoice);
|
|
|
|
|
|
- msgResult.setResult(true);
|
|
|
- msgResult.setData(invoice.getId());
|
|
|
- }
|
|
|
- else{
|
|
|
- msgResult.setResult(false);
|
|
|
- msgResult.setMessage("未收录的目的地。");
|
|
|
- }
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(invoice.getId());
|
|
|
}
|
|
|
else{
|
|
|
msgResult.setResult(false);
|
|
@@ -147,4 +140,23 @@ public class InvoiceApiController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "目的地")
|
|
|
+ @RequestMapping(value = "query", method = RequestMethod.POST)
|
|
|
+ public MessageResult<List> query() {
|
|
|
+ MessageResult<List> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("parent_id", "asc"));
|
|
|
+ sortList.add(new Sort("name_", "asc"));
|
|
|
+
|
|
|
+ Page<Destination> page = destinationService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(page.getResult());
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|