pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTradeDetails.java
@@ -5,9 +5,10 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; import com.dy.common.po.BaseEntity; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -21,64 +22,111 @@ */ @Data @JsonPropertyOrder({ "cashierId", "villageId", "clientNum", "districtTitle", "clientName", "phone", "operateType", "tradeAmount", "waterCost", "cardCost", "gift", "refundAmount", "paymentName", "tradeTime"}) @JsonPropertyOrder({"cardNum", "cashierId", "villageId", "clientNum", "districtTitle", "clientName", "phone", "operateType", "tradeAmount", "waterCost", "cardCost", "gift", "refundAmount", "paymentName", "tradeTime"}) @HeadRowHeight(30) @ContentRowHeight(20) public class VoTradeDetails implements BaseEntity { private static final long serialVersionUID = 202402012040001L; @Schema(title = "收银员ID") @ExcelIgnore private String cashierId; /** * 水卡编号 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) private Long cardNum; @Schema(title = "村庄ID") /** * 收银员ID */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @ExcelIgnore private String villageId; private Long cashierId; @Schema(title = "农户编号") /** * 村庄ID */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @ExcelIgnore private Long villageId; /** * 农户编号 */ @ExcelIgnore private String clientNum; /** * 村庄名称 */ @ExcelProperty(value = {"${title}", "村庄名称"}) @ColumnWidth(20) private String districtTitle; /** * 农户姓名 */ @ExcelProperty(value = {"${title}", "农户姓名"}) @ColumnWidth(15) private String clientName; /** * 联系电话 */ @ExcelProperty(value = {"${title}", "联系电话"}) @ColumnWidth(15) private String phone; /** * 业务类型 */ @ExcelProperty(value = {"${title}", "业务类型"}) @ColumnWidth(15) private String operateType; /** * 交易金额 */ @ExcelProperty(value = {"${title}", "交易金额"}) @ColumnWidth(15) private Double tradeAmount; /** * 购水金额 */ @ExcelProperty(value = {"${title}", "购水金额"}) @ColumnWidth(15) private Double waterCost; /** * 购卡金额 */ @ExcelProperty(value = {"${title}", "购卡金额"}) @ColumnWidth(15) private Double cardCost; /** * 赠送金额 */ @ExcelProperty(value = {"${title}", "赠送金额"}) @ColumnWidth(15) private Double gift; /** * 返还金额 */ @ExcelProperty(value = {"${title}", "返还金额"}) @ColumnWidth(15) private Double refundAmount; /** * 付款方式 */ @ExcelProperty(value = {"${title}", "付款方式"}) @ColumnWidth(15) private String paymentName; /** * 交易时间 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelProperty(value = {"${title}", "交易时间"}) @ColumnWidth(20) pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -344,10 +344,6 @@ <if test = "cashierId != null and cashierId > 0"> AND cashierId = #{cashierId} </if> <if test = "tradeTime != null"> AND tradeTime = #{tradeTime} </if> </where> </select> @@ -368,9 +364,11 @@ </if> </where> ORDER BY tradeTime <if test="pageCurr != null and pageSize != null"> LIMIT #{pageCurr}, #{pageSize} </if> <trim prefix="limit "> <if test="start != null and count != null"> #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} </if> </trim> </select> <!--根据指定条件获取开卡记录数量--> pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -7,7 +7,6 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoBa.BaClient; import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.pojoSe.SeManagerCard; @@ -848,21 +847,11 @@ * @param vo * @return */ @Operation(summary = "获得交易记录明细", description = "返回交易记录明细") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = BaClient.class))} ) }) @GetMapping(path = "getTransactions") @SsoAop() public BaseResponse<Map> getOperates(QoTransaction vo){ try { Map res = cardOperateSv.getTransactions(vo); return BaseResponseUtils.buildSuccess(res); return BaseResponseUtils.buildSuccess(cardOperateSv.getTransactions(vo)); } catch (Exception e) { log.error("查询交易记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -291,6 +291,11 @@ // 获取符合条件的记录数 Long itemTotal = Optional.ofNullable(seCardOperateMapper.getTransactionRecordCount(params)).orElse(0L); QueryResultVo rsVo = new QueryResultVo<>() ; rsVo.pageSize = vo.pageSize ; rsVo.pageCurr = vo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); List<VoTradeDetails> list = seCardOperateMapper.getTransactions(params); if(list.size() == 0) { return new HashMap(); @@ -299,13 +304,21 @@ // 遍历交易明细记录,汇总购水金额、购卡金额 Double totalWaterCost = 0.0; Double totalCardCost = 0.0; Double totalGift = 0.0; Double totalRefund = 0.0; JSONArray array= JSONArray.parseArray(JSON.toJSONString(list)); for(int i = 0; i < array.size(); i++) { JSONObject job = array.getJSONObject(i); Double waterCost = Optional.ofNullable(job.getDouble("waterCost")).orElse(0.0); Double cardCost = Optional.ofNullable(job.getDouble("cardCost")).orElse(0.0); Double gift = Optional.ofNullable(job.getDouble("gift")).orElse(0.0); Double refundAmount = Optional.ofNullable(job.getDouble("refundAmount")).orElse(0.0); totalWaterCost = totalWaterCost + waterCost; totalCardCost = totalCardCost + cardCost; totalGift = totalGift + gift; totalRefund = totalRefund + refundAmount; } Map map_record = new HashMap(); @@ -315,6 +328,10 @@ Map map_result = new HashMap(); map_result.put("waterCost", df.format(totalWaterCost)); map_result.put("cardCost", df.format(totalCardCost)); map_result.put("gift", df.format(totalGift)); map_result.put("refund", df.format(totalRefund)); map_result.put("records", map_record); return map_result;