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.
176 lines
7.7 KiB
Java
176 lines
7.7 KiB
Java
package com.glxp.api.controller.thrsys;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import com.glxp.api.entity.thrsys.*;
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
import com.glxp.api.req.thrsys.*;
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
import com.glxp.api.service.thrsys.ThrInvOrderDetailService;
|
|
import com.glxp.api.service.thrsys.ThrInvOrderService;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
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 javax.validation.Valid;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
public class ThrInvOrderController {
|
|
|
|
@Resource
|
|
ThrInvOrderService thrInvOrderService;
|
|
|
|
@Resource
|
|
ThrInvOrderDetailService thrInvOrderDetailService;
|
|
|
|
@AuthRuleAnnotation("")
|
|
@GetMapping("/udiwms/thrsys/getThrInvOrders")
|
|
public BaseResponse getOrders(FilterThrInvOrderRequest filterThrInvOrderRequest,
|
|
BindingResult bindingResult) {
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
List<ThrInvOrder> thrInvOrders
|
|
= thrInvOrderService.filterThrInvOrder(filterThrInvOrderRequest);
|
|
PageInfo<ThrInvOrder> pageInfo;
|
|
pageInfo = new PageInfo<>(thrInvOrders);
|
|
PageSimpleResponse<ThrInvOrder> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
pageSimpleResponse.setList(thrInvOrders);
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@GetMapping("/udiwms/thrsys/getThrInvOrderDetails")
|
|
public BaseResponse getThrInvOrderDetails(FilterThrInvOrderDetailRequest filterThrInvOrderDetailRequest,
|
|
BindingResult bindingResult) {
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
List<ThrInvOrderDetail> thrInvOrderDetails
|
|
= thrInvOrderDetailService.filterThrInvOrderDetails(filterThrInvOrderDetailRequest);
|
|
PageInfo<ThrInvOrderDetail> pageInfo;
|
|
pageInfo = new PageInfo<>(thrInvOrderDetails);
|
|
PageSimpleResponse<ThrInvOrderDetail> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
pageSimpleResponse.setList(thrInvOrderDetails);
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/udiwms/thrsys/delThrInvOrderDetail")
|
|
public BaseResponse delThrInvOrderDetail(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
String id = deleteRequest.getId();
|
|
int b = thrInvOrderDetailService.delThrInvOrderDetail(Integer.parseInt(id));
|
|
if (b > 0) return ResultVOUtils.success("删除成功");
|
|
else return ResultVOUtils.error(500, "无法删除!");
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/udiwms/thrsys/delThrInvOrder")
|
|
public BaseResponse delThrInvOrder(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
String billNo = deleteRequest.getBillNo();
|
|
int b = thrInvOrderService.delThrInvOrderByBillNo(billNo);
|
|
if (b > 0) {
|
|
thrInvOrderDetailService.delThrInvOrderDetailByBillNo(billNo);
|
|
return ResultVOUtils.success("删除成功");
|
|
} else return ResultVOUtils.error(500, "无法删除!");
|
|
}
|
|
|
|
/**
|
|
* 普耗与收费单据生成
|
|
*
|
|
* @param generateOrderRequest
|
|
* @param bindingResult
|
|
* @return
|
|
*/
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/udiwms/thrsys/generateOrder")
|
|
public BaseResponse generateOrder(@RequestBody @Valid GenerateOrderRequest generateOrderRequest, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
if (thrInvOrderService.generateOrder(generateOrderRequest)) {
|
|
return ResultVOUtils.success("生成成功");
|
|
}
|
|
return ResultVOUtils.error(500, "生成失败!");
|
|
}
|
|
|
|
/**
|
|
* 高值耗材单据生成
|
|
*
|
|
* @param generateOrderRequest
|
|
* @param bindingResult
|
|
* @return
|
|
*/
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/udiwms/thrsys/generateGhOrder")
|
|
public BaseResponse generateGhOrder(@RequestBody @Valid GenerateOrderRequest generateOrderRequest, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
if (thrInvOrderService.generateGhOrder(generateOrderRequest)) {
|
|
return ResultVOUtils.success("生成成功");
|
|
}
|
|
return ResultVOUtils.error(500, "生成失败!");
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/udiwms/thrsys/refreshOrder")
|
|
public BaseResponse refreshOrder(@RequestBody @Valid RefreshOrderRequest refreshOrderRequest, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
if (thrInvOrderService.refreshOrder(refreshOrderRequest)) {
|
|
return ResultVOUtils.success("刷新成功");
|
|
}
|
|
return ResultVOUtils.error(500, "刷新失败!");
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/udiwms/thrsys/refreshGhOrder")
|
|
public BaseResponse refreshGhOrder(@RequestBody @Valid RefreshOrderRequest refreshOrderRequest, BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
}
|
|
if (thrInvOrderService.refreshGhOrder(refreshOrderRequest)) {
|
|
return ResultVOUtils.success("刷新成功");
|
|
}
|
|
return ResultVOUtils.error(500, "刷新失败!");
|
|
}
|
|
|
|
@PostMapping("/udiwms/thrsys/downloadInvOrder")
|
|
public BaseResponse downloadInvOrder(@RequestBody @Valid FilterDownloadInvOrderRequest filterDownloadInvOrderRequest) {
|
|
thrInvOrderService.downloadInvSfOrderFilter(filterDownloadInvOrderRequest);
|
|
return ResultVOUtils.success();
|
|
}
|
|
|
|
@PostMapping("/udiwms/thrsys/downloadInvGhOrder")
|
|
public BaseResponse downloadInvGhOrder(@RequestBody @Valid FilterDownloadInvOrderRequest filterDownloadInvOrderRequest) {
|
|
thrInvOrderService.downloadInvGhOrderFilter(filterDownloadInvOrderRequest);
|
|
|
|
return ResultVOUtils.success();
|
|
}
|
|
|
|
@PostMapping("/udiwms/thrsys/downloadInvPhOrder")
|
|
public BaseResponse downloadInvPhOrder(@RequestBody @Valid FilterDownloadInvOrderRequest filterDownloadInvOrderRequest) {
|
|
thrInvOrderService.downloadInvPhOrderFilter(filterDownloadInvOrderRequest);
|
|
return ResultVOUtils.success();
|
|
}
|
|
}
|