Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoSimpleDivide; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | Long getBlockIdById(@Param("divideId") Long divideId); |
| | | |
| | | /** |
| | | * 根据片区ID获取分水房列表 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | List<VoSimpleDivide> getDividesByBlockId(Long blockId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-09-09 20:05 |
| | | * @LastEditTime 2024-09-09 20:05 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | public class VoSimpleDivide { |
| | | private static final long serialVersionUID = 202409092005001L; |
| | | |
| | | /** |
| | | * 分水房ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long value; |
| | | |
| | | /** |
| | | * 分水房名称 |
| | | */ |
| | | private String label; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | |
| | | @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) |
| | |
| | | <item2 name="微信支付"/> |
| | | <item3 name="支付宝支付"/> |
| | | <item4 name="银行转账"/> |
| | | <item5 name="换卡"/> |
| | | </payments> |
| | | <settings> |
| | | <item1 item_name="lng" item_value="101.87345" remarks="经度"/> |
| | |
| | | update pr_divide set deleted = 1 |
| | | <where> |
| | | <if test = "id != null and id > 0"> |
| | | AND id = ${id} |
| | | AND id = #{id} |
| | | </if> |
| | | </where> |
| | | </update> |
| | | |
| | | <!--根据分水房编号获取所属片区编号--> |
| | | <select id="getBlockIdById" resultType="java.lang.Long"> |
| | | SELECT blockId FROM pr_divide WHERE id = ${divideId} |
| | | SELECT blockId FROM pr_divide WHERE id = #{divideId} |
| | | </select> |
| | | |
| | | <!--根据片区ID获取分水房列表--> |
| | | <select id="getDividesByBlockId" resultType="com.dy.pipIrrGlobal.voPr.VoSimpleDivide"> |
| | | SELECT |
| | | id As value, |
| | | name AS label |
| | | FROM pr_divide |
| | | WHERE deleted = 0 AND blockId = #{blockId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = #{cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeTime != null"> |
| | | AND tradeTime = #{tradeTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | </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> |
| | | |
| | | <!--根据指定条件获取开卡记录数量--> |
| | |
| | | |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 获取片区、分水房联动视图,添加农户时使用 |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/block_divides") |
| | | @SsoAop() |
| | | public BaseResponse<JSONArray> getBlockDivides() { |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(this.sv.getBlockDivides()); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.daoBa.BaBlockMapper; |
| | | import com.dy.pipIrrGlobal.daoBa.BaMapCoordinatesMapper; |
| | | import com.dy.pipIrrGlobal.daoBa.BaMapGraphMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrDivideMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapGraph; |
| | | import com.dy.pipIrrGlobal.voBa.VoBlock; |
| | | import com.dy.pipIrrGlobal.voBa.VoMapCoordinates; |
| | | import com.dy.pipIrrGlobal.voBa.VoMapGraph; |
| | | import com.dy.pipIrrGlobal.voPr.VoSimpleDivide; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | |
| | | @Autowired |
| | | private BaMapCoordinatesMapper baMapCoordinatesMapper; |
| | | |
| | | @Autowired |
| | | private PrDivideMapper prDivideMapper; |
| | | |
| | | /** |
| | | * 得到一个片区 |
| | |
| | | return this.baMapCoordinatesMapper.deleteByBlockId(blockId); |
| | | } |
| | | |
| | | /** |
| | | * 获取片区、分水房联动视图,添加农户时使用 |
| | | * @return |
| | | */ |
| | | public JSONArray getBlockDivides() { |
| | | JSONArray array_blocks = null; |
| | | JSONArray array_divides = null; |
| | | JSONArray array_result = new JSONArray(); |
| | | |
| | | List<BaBlock> list_blocks = dao.selectAll(); |
| | | if(list_blocks != null && list_blocks.size() > 0) { |
| | | array_blocks = (JSONArray) JSON.toJSON(list_blocks); |
| | | for (int i = 0; i < array_blocks.size(); i++) { |
| | | JSONObject job_block = array_blocks.getJSONObject(i); |
| | | JSONObject job_blockNew = new JSONObject(); |
| | | job_blockNew.put("value", job_block.getLong("id").toString()); |
| | | job_blockNew.put("label", job_block.getString("name")); |
| | | |
| | | List<VoSimpleDivide> list_divides = Optional.ofNullable( prDivideMapper.getDividesByBlockId(job_block.getLong("id"))).orElse(new ArrayList<>()); |
| | | array_divides = (JSONArray) JSON.toJSON(list_divides); |
| | | job_blockNew.put("children", array_divides); |
| | | array_result.add(job_blockNew); |
| | | } |
| | | return array_result; |
| | | }else { |
| | | return new JSONArray(); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | private Integer projectNo; |
| | | /** |
| | | * 开卡 |
| | | * 当卡片费用为0时即为换卡操作,不收卡片费用,不收余额 |
| | | * @param po 开卡传入对象 |
| | | * @param bindingResult |
| | | * @return 水卡编号 |
| | |
| | | seClientCard.setOriginalCardId(originalCardId); |
| | | } |
| | | seClientCard.setCreatedt(activeTime); |
| | | seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | | if(cardCost == 0) { |
| | | // 换卡 |
| | | seClientCard.setLastoper(LastOperateENUM.CHANGE_CARD.getCode()); |
| | | }else { |
| | | // 开卡 |
| | | seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | | } |
| | | //seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | | Long cardId = Optional.ofNullable(clientCardSv.add(seClientCard)).orElse(0L) ; |
| | | if(cardId == 0) { |
| | | return BaseResponseUtils.buildErrorMsg(SellResultCode.ACTIVE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); |
| | |
| | | // 补卡 |
| | | seCardOperate.setOperateType(OperateTypeENUM.REISSUE.getCode()); |
| | | }else { |
| | | // 开新卡 |
| | | seCardOperate.setOperateType(OperateTypeENUM.ACTIVE.getCode()); |
| | | // 开新卡或换卡 |
| | | if(cardCost > 0) { |
| | | seCardOperate.setOperateType(OperateTypeENUM.ACTIVE.getCode()); |
| | | }else { |
| | | seCardOperate.setOperateType(OperateTypeENUM.CHANGE_CARD.getCode()); |
| | | } |
| | | } |
| | | seCardOperate.setRemarks(remarks); |
| | | seCardOperate.setOperator(operator); |
| | |
| | | * @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()) ; |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeManagerCard; |
| | | import com.dy.pipIrrGlobal.pojoSe.SePaymentMethod; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | | import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | |
| | | |
| | | @Autowired |
| | | private SeManagerCardMapper seManagerCardMapper; |
| | | |
| | | @Autowired |
| | | private SePaymentMethodMapper sePaymentMethodMapper; |
| | | |
| | | @Value("${project.projectNo}") |
| | | private Integer projectNo; |
| | |
| | | * 补卡时间 |
| | | * 最后操作类型-2 |
| | | */ |
| | | |
| | | // 根据支付方式ID获取支付方式名称 |
| | | SePaymentMethod sePaymentMethod = sePaymentMethodMapper.selectByPrimaryKey(paymentId); |
| | | String paymentName = sePaymentMethod.getName(); |
| | | |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setMoney(afterRecharge); |
| | | seClientCard.setRechargedt(rechargeTime); |
| | | seClientCard.setLastoper(LastOperateENUM.RECHARGE.getCode ()); |
| | | if(paymentName != null && paymentName.equals("换卡")) { |
| | | seClientCard.setLastoper(LastOperateENUM.CHANGE_RECHARGE.getCode ()); |
| | | }else { |
| | | seClientCard.setLastoper(LastOperateENUM.RECHARGE.getCode ()); |
| | | } |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | | return BaseResponseUtils.buildErrorMsg(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); |
| | |
| | | seCardOperate.setMoney(money); |
| | | seCardOperate.setTradeAmount(amount); |
| | | seCardOperate.setGift(gift); |
| | | seCardOperate.setOperateType(OperateTypeENUM.RECHARGE.getCode()); |
| | | if(paymentName != null && paymentName.equals("换卡")) { |
| | | seCardOperate.setOperateType(OperateTypeENUM.CHANGE_RECHARGE.getCode()); |
| | | }else { |
| | | seCardOperate.setOperateType(OperateTypeENUM.RECHARGE.getCode()); |
| | | } |
| | | seCardOperate.setPaymentId(paymentId); |
| | | seCardOperate.setPrice(price); |
| | | seCardOperate.setRemarks(remarks); |
| | |
| | | } |
| | | |
| | | Map map_response = new HashMap(); |
| | | // map_response.put("projectNo", String.format("%02x", Integer.parseInt(getProjectNo()))); |
| | | map_response.put("projectNo", String.format("%02x", projectNo)); |
| | | map_response.put("orderNumber", rec); |
| | | map_response.put("cardNum", cardNum); |
| | |
| | | // 获取符合条件的记录数 |
| | | 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(); |
| | |
| | | // 遍历交易明细记录,汇总购水金额、购卡金额 |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | LOSS((byte)6, "挂失"), |
| | | REVERSAL((byte)7, "冲正"), |
| | | UNLOCK((byte)8, "解锁"), |
| | | CONSUME((byte)9, "消费"); |
| | | CONSUME((byte)9, "消费"), |
| | | CHANGE_CARD((byte)10, "换卡"), |
| | | CHANGE_RECHARGE((byte)11, "换卡充值"); |
| | | |
| | | private final Byte code; |
| | | private final String message; |
| | |
| | | LOSS((byte)6, "挂失"), |
| | | REVERSAL((byte)7, "冲正"), |
| | | UNLOCK((byte)8, "解锁"), |
| | | CONSUME((byte)9, "消费"); |
| | | CONSUME((byte)9, "消费"), |
| | | CHANGE_CARD((byte)10,"换卡"), |
| | | CHANGE_RECHARGE((byte)11,"换卡充值"); |
| | | |
| | | private final Byte code; |
| | | private final String message; |