| | |
| | | package com.dy.pipIrrSell.general; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.excel.CellWriteHandler; |
| | | import com.dy.pipIrrGlobal.excel.ExcelUtil; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeAudits; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoTradeDetails; |
| | | import com.dy.pipIrrSell.general.dto.DtoGeneral; |
| | | import com.dy.pipIrrSell.general.qo.QoGeneral; |
| | | import com.dy.pipIrrSell.general.qo.QoSummary; |
| | | import com.dy.pipIrrSell.general.qo.QoToAudit; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出总账记录 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/export_general", method = RequestMethod.GET) |
| | | @SsoAop() |
| | | public void exportGeneral(HttpServletResponse response, QoGeneral vo) { |
| | | ExcelUtil.setExcelRespProp(response, "总账" + LocalDate.now()); |
| | | List<VoGeneral> generalList = generalSv.exportGenerals(vo).getObj(); |
| | | |
| | | EasyExcel.write(response.getOutputStream(), VoGeneral.class) |
| | | .registerWriteHandler(new CellWriteHandler("财务对账-总账")) |
| | | .sheet("总账") |
| | | .doWrite(generalList); |
| | | } |
| | | |
| | | /** |
| | |
| | | return BaseResponseUtils.buildSuccess() ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获得待审核交易汇总记录 |
| | | * 开卡系统交易汇总查询与对账系统交易汇总查询共用接口 |
| | | * 开卡系统参数:收银员ID、查询起止日期 |
| | | * 对账系统参数:收银员ID、交易日期 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得待审核交易汇总记录", description = "返回待审核交易汇总记录") |
| | | @Operation(summary = "获得开卡系统交易统计记录", description = "返回开卡系统交易统计记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getToAudit") |
| | | @GetMapping(path = "getSummaries") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getToAudit(QoToAudit vo){ |
| | | public BaseResponse<Map> getSummaries( @Valid QoSummary vo, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | try { |
| | | Map res = generalSv.getToAudit(vo); |
| | | Map res = generalSv.getSummaries(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易汇总记录异常", e); |
| | |
| | | @SsoAop() |
| | | public BaseResponse<Map> getTradeDetails(QoToAudit vo){ |
| | | try { |
| | | Map res = Optional.ofNullable(generalSv.getTradeDetails(vo)).orElse(new HashMap()); |
| | | if(res.size() > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_TRADE_DETAILS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(generalSv.getTradeDetails(vo)); |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出财务对账_交易明细 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/export_trade_details", method = RequestMethod.GET) |
| | | @SsoAop() |
| | | public void exportTradeDetails(HttpServletResponse response, QoToAudit vo) { |
| | | ExcelUtil.setExcelRespProp(response, "交易明细" + LocalDate.now()); |
| | | |
| | | Map map_result = generalSv.exportTradeDetails(vo); |
| | | Map map_record = (Map) map_result.get("records"); |
| | | List<VoTradeDetails> list = (List<VoTradeDetails>) map_record.get("list"); |
| | | Double totalTradeAmount = Double.parseDouble(map_result.get("totalTradeAmount").toString()); |
| | | VoTradeDetails po = new VoTradeDetails(); |
| | | po.setTradeAmount(totalTradeAmount); |
| | | list.add(po); |
| | | |
| | | EasyExcel.write(response.getOutputStream(), VoTradeDetails.class) |
| | | .registerWriteHandler(new CellWriteHandler("财务对账-交易明细")) |
| | | .sheet("交易明细") |
| | | .doWrite(list); |
| | | } |
| | | |
| | | } |