Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
59个文件已修改
5个文件已删除
48个文件已添加
| | |
| | | package com.dy.common.mybatis; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alibaba.fastjson2.JSONWriter; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.dy.common.util.IDLongGenerator; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.mapping.SqlCommandType; |
| | | import org.apache.ibatis.plugin.Interceptor; |
| | | import org.apache.ibatis.plugin.Intercepts; |
| | | import org.apache.ibatis.plugin.Invocation; |
| | | import org.apache.ibatis.plugin.Plugin; |
| | | import org.apache.ibatis.plugin.Signature; |
| | | import org.apache.ibatis.plugin.*; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | |
| | | static int MAPPED_STATEMENT_INDEX = 0; |
| | | static int PARAMETER_INDEX = 1; |
| | | static String BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME = "setId"; |
| | | static String BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME2 = "setUserId"; |
| | | |
| | | /** |
| | | * 拦截逻辑实现 |
| | |
| | | Class<?> entityClass = entity.getClass(); |
| | | Method setMt = null ; |
| | | try{ |
| | | //有一些实体没有id,例如中间表 |
| | | setMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME, Long.class) ; |
| | | // 添加用户时userId为自动生成主键。roleId存在时是为用户绑角色 |
| | | String jsonString = JSONObject.toJSONString(entity, JSONWriter.Feature.WriteMapNullValue); |
| | | JSONObject jsonObject = JSONObject.parseObject(jsonString); |
| | | if(jsonObject.containsKey("userId") && !jsonObject.containsKey("roleId")) { |
| | | setMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME2, Long.class) ; |
| | | }else { |
| | | //有一些实体没有id,例如中间表 |
| | | setMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME, Long.class) ; |
| | | } |
| | | }catch (Exception e){ |
| | | //当entityClass没有setId方法时,会抛出异常 |
| | | } |
| | |
| | | this.pageSize = 1 ; |
| | | } |
| | | if(this.pageSize == null || this.pageSize <= 0){ |
| | | this.pageSize = 1 ;//供下面作为除数 |
| | | /** |
| | | * 朱宝民 2024-01-30 修改 |
| | | * 未传入分页参数时,取全部记录 |
| | | */ |
| | | //this.pageSize = 1 ;//供下面作为除数 |
| | | this.pageSize = 10000 ;//供下面作为除数 |
| | | } |
| | | |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-18 19:28 |
| | | * @LastEditTime 2024-01-18 19:28 |
| | | * @date 2024-02-02 16:00 |
| | | * @LastEditTime 2024-02-02 16:00 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface SeCardOperateMapper extends BaseMapper { |
| | | public interface SeCardOperateMapper extends BaseMapper<SeCardOperate> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeCardOperate record); |
| | |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTransaction> getTransactions(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取购水汇总和购卡汇总,获取交易明细使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getTransactionSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易统计记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getTransactionStatisticsRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易统计记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTransactionStatistics> getTransactionStatistics(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根基指定条件获取笔数合计、实收金额合计、赠送金额合计 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getTransactionStatisticsSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期、指定支付方式实收金额合计 |
| | | * @param tradeDate |
| | | * @param paymentId |
| | | * @return |
| | | */ |
| | | //Float getPaymentSums(Map<?, ?> params); |
| | | Float getPaymentSums(@Param("tradeDate") String tradeDate, @Param("paymentId") Long paymentId); |
| | | /*List<VoTransaction> getTransactions(Map<?, ?> params);*/ |
| | | List<VoTradeDetails> getTransactions(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取开卡记录数 |
| | |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoActiveCardNew> getActiveCards(Map<?, ?> params); |
| | | List<VoActiveCard> getActiveCards(Map<?, ?> params); |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | List<VoReissueCard> getReissueCards(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取通用操作记录数量 |
| | | * 注销、挂失、冲正、解锁通用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getCommonOperationRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取通用操作记录 |
| | | * 注销、挂失、冲正、解锁通用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoOperate> getCommonOperations(Map<?, ?> params); |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取收据列表数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getReceiptsRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据指定条件获取收据列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoReceipt> getReceipts(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取收据收费金额合计 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Double getTotalAmount(Map<?, ?> params); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoSe; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeConsume; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletConsume; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-30 15:44 |
| | | * @LastEditTime 2024-01-30 15:44 |
| | | * @Description 电子钱包消费Mapper接口 |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface SeConsumeMapper extends BaseMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeConsume record); |
| | | |
| | | int insertSelective(SeConsume record); |
| | | |
| | | SeConsume selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(SeConsume record); |
| | | |
| | | int updateByPrimaryKey(SeConsume record); |
| | | |
| | | /** |
| | | * 根据农户ID获取消费汇总记录 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | Map getWalletConsumeSum(@Param("clientId") Long clientId); |
| | | |
| | | /** |
| | | * 根据农户ID获取电子钱包消费记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据农户ID获取电子钱包消费记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWalletConsume> getWalletConsumes(Map<?, ?> params); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoTradeDetails; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransactionStatistics; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getToAuditRecordCount(Map<?, ?> params); |
| | | //Long getToAuditRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 财务对账审核页,收银员+日期分组,排除交易类型分组 |
| | | * 开卡系统交易统计,收银员+日期+类型分组 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTransactionStatistics> getToAudit(Map<?, ?> params); |
| | | List<VoTransactionStatistics> getSummaries(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期、指定收银员、指定支付方式实收金额合计 |
| | |
| | | Float getPaymentSums(@Param("tradeDate") String tradeDate, @Param("cashierId") Long cashierId, @Param("paymentId") Long paymentId); |
| | | |
| | | /** |
| | | * 根基指定日期、指定收银员获取笔数合计、实收金额合计、赠送金额合计 |
| | | * 根据收银员ID及日期获取财务对账_交易明细记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getTransactionStatisticsSums(Map<?, ?> params); |
| | | Long getTradeDetailsRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据收银员ID及日期获取财务对账_交易明细记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTradeDetails> getTradeDetails(Map<?, ?> params); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoSe; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRefund; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRefund; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-30 15:45 |
| | | * @LastEditTime 2024-01-30 15:45 |
| | | * @Description 电子钱包退款Mapper接口 |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface SeRefundMapper extends BaseMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeRefund record); |
| | | |
| | | int insertSelective(SeRefund record); |
| | | |
| | | SeRefund selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(SeRefund record); |
| | | |
| | | int updateByPrimaryKey(SeRefund record); |
| | | |
| | | /** |
| | | * 根据钱包ID获取待审核的退款申请对象 |
| | | * @param walletId |
| | | * @return |
| | | */ |
| | | SeRefund getRefundByWallerId(@Param("walletId") Long walletId); |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包退款记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据指定条件获取电子钱包退款记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWalletRefund> getWalletRefunds(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期微信退款(只计算已退的)总额,财务对账审核页使用 |
| | | * @param tradeDate |
| | | * @return |
| | | */ |
| | | Double getRefundSum(@Param("tradeDate") String tradeDate); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWallet; |
| | | import com.dy.pipIrrGlobal.voSe.VoWallet; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/11 16:29 |
| | | * @LastEditTime 2023/12/11 16:29 |
| | | * @Description |
| | | * @date 2024-01-30 15:41 |
| | | * @LastEditTime 2024-01-30 15:41 |
| | | * @Description 电子钱包Mapper接口 |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface SeWalletMapper extends BaseMapper<SeWallet> { |
| | | public interface SeWalletMapper extends BaseMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeWallet record); |
| | |
| | | int updateByPrimaryKeySelective(SeWallet record); |
| | | |
| | | int updateByPrimaryKey(SeWallet record); |
| | | |
| | | /** |
| | | * 根据农户ID获取电子钱包对象 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | SeWallet getWalletByClientId(@Param("clientId") Long clientId); |
| | | |
| | | /** |
| | | * 根据农户姓名获取电子钱包账户记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据农户姓名获取电子钱包账户记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWallet> getWallets(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/12 9:06 |
| | | * @LastEditTime 2023/12/12 9:06 |
| | | * @Description |
| | | * @date 2024-01-30 15:44 |
| | | * @LastEditTime 2024-01-30 15:44 |
| | | * @Description 电子钱包充值Mapper接口 |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface SeWalletRechargeMapper extends BaseMapper<SeWalletRecharge> { |
| | | public interface SeWalletRechargeMapper extends BaseMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeWalletRecharge record); |
| | |
| | | int updateByPrimaryKeySelective(SeWalletRecharge record); |
| | | |
| | | int updateByPrimaryKey(SeWalletRecharge record); |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包充值记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据指定条件获取电子钱包充值记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWalletRecharge> getWalletRecharges(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期微信收款总额,财务对账审核页使用 |
| | | * @param tradeDate |
| | | * @return |
| | | */ |
| | | Double getRechargeSum(@Param("tradeDate") String tradeDate); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoSe; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 17:31 |
| | | * @LastEditTime 2024-02-22 17:31 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface SeWebchatLogonStateMapper extends BaseMapper<SeWebchatLogonState> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeWebchatLogonState record); |
| | | |
| | | int insertSelective(SeWebchatLogonState record); |
| | | |
| | | SeWebchatLogonState selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(SeWebchatLogonState record); |
| | | |
| | | int updateByPrimaryKey(SeWebchatLogonState record); |
| | | } |
| | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-18 19:10 |
| | | * @LastEditTime 2024-01-18 19:10 |
| | | * @LastEditTime 2024-02-02 16:00 |
| | | * @Description |
| | | */ |
| | | |
| | |
| | | private Float gift; |
| | | |
| | | /** |
| | | * 返还金额;补扣操作时返还的金额 |
| | | */ |
| | | @Schema(description = "返还金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "返还金额不小于{min}", min = 0) |
| | | private Float refundAmount; |
| | | |
| | | /** |
| | | * 非交易金额;补卡金额、补扣金额、剩余金额(解锁) |
| | | */ |
| | | @Schema(description = "非交易金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoSe; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-30 15:44 |
| | | * @LastEditTime 2024-01-30 15:44 |
| | | * @Description 电子钱包消费实体 |
| | | */ |
| | | |
| | | @TableName(value="se_consume", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "电子钱包消费实体") |
| | | public class SeConsume implements BaseEntity { |
| | | public static final long serialVersionUID = 202401301552003L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 钱包ID |
| | | */ |
| | | @Schema(description = "钱包ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | //@NotNull(message = "钱包ID不能为空") |
| | | private Long walletId; |
| | | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "农户ID不能为空") |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 钱包余额 |
| | | */ |
| | | @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "钱包余额不能小于0") |
| | | private Double money; |
| | | |
| | | /** |
| | | * 消费金额 |
| | | */ |
| | | @Schema(description = "消费金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "消费金额不能小于0") |
| | | @NotNull(message = "消费金额不能为空") |
| | | private Double consumption; |
| | | |
| | | /** |
| | | * 消费后余额 |
| | | */ |
| | | @Schema(description = "消费后余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "消费后余额不能小于0") |
| | | private Double afterConsume; |
| | | |
| | | /** |
| | | * 用水时长 |
| | | */ |
| | | @Schema(description = "用水时长", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "用水时长不能小于0") |
| | | private Double duration; |
| | | |
| | | /** |
| | | * 开阀时间 |
| | | */ |
| | | @Schema(description = "开阀时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "开阀时间不能为空") |
| | | private Date vot; |
| | | |
| | | /** |
| | | * 关阀时间 |
| | | */ |
| | | @Schema(description = "关阀时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "关阀时间不能为空") |
| | | private Date vct; |
| | | } |
| | |
| | | private Double gift; |
| | | |
| | | /** |
| | | * 总额 |
| | | * 返还金额 |
| | | */ |
| | | @Schema(description = "总额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "总额不能为空") |
| | | private Double totalAmount; |
| | | @Schema(description = "返还金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "返还金额不能为空") |
| | | private Double refundAmount; |
| | | |
| | | /** |
| | | * 交易日期 |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoSe; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-30 15:45 |
| | | * @LastEditTime 2024-01-30 15:45 |
| | | * @Description 电子钱包退款实体 |
| | | */ |
| | | |
| | | @TableName(value="se_refund", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "电子钱包退款实体") |
| | | public class SeRefund implements BaseEntity { |
| | | public static final long serialVersionUID = 202401301552004L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 钱包ID |
| | | */ |
| | | @Schema(description = "钱包ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long walletId; |
| | | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "农户ID不能为空") |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 钱包余额 |
| | | */ |
| | | @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "钱包余额不能小于0") |
| | | private Double money; |
| | | |
| | | /** |
| | | * 退款金额 |
| | | */ |
| | | @Schema(description = "退款金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "消退款金额不能小于0") |
| | | //@NotNull(message = "退款金额不能为空") |
| | | private Double refundAmount; |
| | | |
| | | /** |
| | | * 退款后余额 |
| | | */ |
| | | @Schema(description = "退款后余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "退款后余额不能小于0") |
| | | private Double afterRefund; |
| | | |
| | | /** |
| | | * 申请时间 |
| | | */ |
| | | @Schema(description = "申请时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date applicationTime; |
| | | |
| | | /** |
| | | * 退款状态;1-未退款,2-已退款 |
| | | */ |
| | | @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 1, message = "退款状态不能小于1") |
| | | @Max(value = 2, message = "退款状态不能大于2") |
| | | private Byte refundStatus; |
| | | |
| | | /** |
| | | * 审核人 |
| | | */ |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long auditor; |
| | | |
| | | /** |
| | | * 审核时间 |
| | | */ |
| | | @Schema(description = "审核时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date auditTime; |
| | | |
| | | /** |
| | | * 审核备注 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 0, max = 200) |
| | | private String remarks; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Positive; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/11 16:29 |
| | | * @LastEditTime 2023/12/11 16:29 |
| | | * @Description |
| | | */ |
| | | |
| | | /** |
| | | * 电子钱包表 |
| | | * @date 2024-01-30 15:41 |
| | | * @LastEditTime 2024-01-30 15:41 |
| | | * @Description 电子钱包账户实体 |
| | | */ |
| | | |
| | | @TableName(value="se_wallet", autoResultMap = true) |
| | |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "电子钱包表实体") |
| | | @Schema(name = "电子钱包账户实体") |
| | | public class SeWallet implements BaseEntity { |
| | | public static final long serialVersionUID = 202401151519005L; |
| | | public static final long serialVersionUID = 202401301552001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "主键必须为大于0的整数") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 用水户编号 |
| | | */ |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "农户编号不小于{min}", min = 1) |
| | | private Long clientid; |
| | | * 农户ID |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "农户ID不能为空") |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 钱包余额 |
| | | */ |
| | | @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Length(message = "钱包余额不小于{min}", min = 0) |
| | | private Float money; |
| | | * 钱包余额 |
| | | */ |
| | | @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "钱包余额不能小于0") |
| | | private Double money; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | * 最后操作;1-开户,2-充值,3-消费,4-申请退款,5-退款审核 |
| | | */ |
| | | @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 1, message = "最后操作不能小于1") |
| | | @Max(value = 5, message = "最后操作不能大于5") |
| | | private Byte lastOperate; |
| | | |
| | | /** |
| | | * 最后操作时间 |
| | | */ |
| | | @Schema(description = "最后操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date lastOperateTime; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date createdt; |
| | | private Date createTime; |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.pojoSe; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/12 9:06 |
| | | * @LastEditTime 2023/12/12 9:06 |
| | | * @Description |
| | | * @date 2024-01-30 15:44 |
| | | * @LastEditTime 2024-01-30 15:44 |
| | | * @Description 电子钱包充值实体 |
| | | */ |
| | | /** |
| | | * 电子钱包充值表 |
| | | */ |
| | | public class SeWalletRecharge { |
| | | |
| | | @TableName(value="se_wallet_recharge", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "电子钱包充值实体") |
| | | public class SeWalletRecharge implements BaseEntity { |
| | | public static final long serialVersionUID = 202401301552002L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 钱包编号 |
| | | */ |
| | | private Long walletid; |
| | | * 钱包ID |
| | | */ |
| | | @Schema(description = "钱包ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | //@NotNull(message = "钱包ID不能为空") |
| | | private Long walletId; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | private Long clientid; |
| | | * 农户ID |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "农户ID不能为空") |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 钱包余额 |
| | | */ |
| | | * 钱包余额 |
| | | */ |
| | | @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "钱包余额不能小于0") |
| | | private Double money; |
| | | |
| | | /** |
| | | * 充值金额 |
| | | */ |
| | | * 充值金额 |
| | | */ |
| | | @Schema(description = "充值金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "钱包余额不能小于0") |
| | | @NotNull(message = "充值金额不能为空") |
| | | private Double amount; |
| | | |
| | | /** |
| | | * 充值后余额 |
| | | */ |
| | | private Double afterrecharge; |
| | | * 充值后余额 |
| | | */ |
| | | @Schema(description = "充值后余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Min(value = 0, message = "钱包余额不能小于0") |
| | | private Double afterRecharge; |
| | | |
| | | /** |
| | | * 充值时间 |
| | | */ |
| | | private Date rechargedt; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | private String remarks; |
| | | |
| | | * 充值时间 |
| | | */ |
| | | @Schema(description = "充值时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date rechargeTime; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoSe; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 17:31 |
| | | * @LastEditTime 2024-02-22 17:31 |
| | | * @Description |
| | | */ |
| | | |
| | | @TableName(value="se_webchat_logon_state", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "登录态记录实体") |
| | | public class SeWebchatLogonState implements BaseEntity { |
| | | public static final long serialVersionUID = 202402221735001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 用户唯一标识 |
| | | */ |
| | | @Schema(description = "用户唯一标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "用户唯一标识不能为空") |
| | | private String openId; |
| | | |
| | | /** |
| | | * 会话密钥 |
| | | */ |
| | | @Schema(description = "会话密钥", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "会话密钥不能为空") |
| | | private String sessionKey; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "创建时间不能为空") |
| | | private Date createTime; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 9:58 |
| | | * @LastEditTime 2024-02-01 9:58 |
| | | * @Description 金额数字转中文大写 |
| | | */ |
| | | public class AmountToChinese { |
| | | private static final String[] CN_UPPER_NUMBER = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; |
| | | private static final String[] CN_UPPER_MONETRAY_UNIT = { "分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟" }; |
| | | private static final String CN_FULL = "整"; |
| | | private static final String CN_NEGATIVE = "负"; |
| | | private static final int MONEY_PRECISION = 2; |
| | | private static final String CN_ZEOR_FULL = "零元" + CN_FULL; |
| | | |
| | | public static String toChinese(BigDecimal amount) { |
| | | StringBuilder result = new StringBuilder(); |
| | | amount = amount.setScale(MONEY_PRECISION, BigDecimal.ROUND_HALF_UP); |
| | | long number = amount.movePointRight(MONEY_PRECISION).setScale(0, BigDecimal.ROUND_HALF_UP).longValue(); |
| | | boolean zero = true; |
| | | int unitIndex = 0; |
| | | if (number == 0) { |
| | | return CN_ZEOR_FULL; |
| | | } |
| | | if (number < 0) { |
| | | number = -number; |
| | | result.append(CN_NEGATIVE); |
| | | } |
| | | long scale = 10; |
| | | while (true) { |
| | | if (number == 0) { |
| | | break; |
| | | } |
| | | long numIndex = number % scale; |
| | | if (zero && numIndex == 0) { |
| | | zero = false; |
| | | } |
| | | if (numIndex != 0) { |
| | | result.insert(0, CN_UPPER_MONETRAY_UNIT[unitIndex]) |
| | | .insert(0, CN_UPPER_NUMBER[(int) numIndex]); |
| | | zero = false; |
| | | } |
| | | else if (!zero) { |
| | | result.insert(0, CN_UPPER_NUMBER[(int) numIndex]); |
| | | } |
| | | number = number / scale; |
| | | unitIndex++; |
| | | } |
| | | if (zero) { |
| | | result.append(CN_FULL); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | } |
| | |
| | | @Schema(title = "赠送金额") |
| | | private Float gift; |
| | | |
| | | @Schema(title = "总额") |
| | | private Float totalAmount; |
| | | @Schema(title = "返还金额") |
| | | private Float refundAmount; |
| | | |
| | | @Schema(title = "交易日期") |
| | | private String operateDate; |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-05 11:23 |
| | | * @LastEditTime 2024-02-05 11:23 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "通用操作记录视图对象") |
| | | public class VoOperate { |
| | | private static final long serialVersionUID = 202402051126001L; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private String cardNum; |
| | | |
| | | @Schema(title = "操作人") |
| | | private String operator; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "操作时间") |
| | | private Date operateDt; |
| | | |
| | | //注销查询2个返回值 |
| | | @Schema(title = "退回金额") |
| | | private Float refund; |
| | | |
| | | @Schema(title = "退款方式名称") |
| | | private String refundTypeName; |
| | | |
| | | //挂失1个返回值 |
| | | @Schema(title = "卡片余额及冲正后余额") |
| | | private Double money; |
| | | |
| | | //冲正2个返回值,冲正后余额与挂失共用 |
| | | @Schema(title = "冲正前余额") |
| | | private Double systemBalance; |
| | | |
| | | //解锁1个返回值,与挂失共用 |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 10:36 |
| | | * @LastEditTime 2024-02-01 10:36 |
| | | * @Description 收据视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "收据视图对象") |
| | | public class VoReceipt { |
| | | private static final long serialVersionUID = 202402011037001L; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | private String cashierId; |
| | | |
| | | @Schema(title = "订单号") |
| | | private String orderNumber; |
| | | |
| | | @Schema(title = "镇名称") |
| | | private String townName; |
| | | |
| | | @Schema(title = "村名称") |
| | | private String villageName; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "电话") |
| | | private String phone; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private String cardNum; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "购水金额") |
| | | private Double waterCost; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | private Double cardCost; |
| | | |
| | | @Schema(title = "收费金额") |
| | | private Double amount; |
| | | |
| | | @Schema(title = "水卡余额") |
| | | private Double money; |
| | | |
| | | @Schema(title = "支付方式") |
| | | private String paymentName; |
| | | |
| | | @Schema(title = "操作人") |
| | | private String operatorName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "操作时间") |
| | | private Date operateTime; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "当前时间") |
| | | private Date currentTime; |
| | | } |
| | |
| | | @Schema(title = "充值金额") |
| | | private Float amount; |
| | | |
| | | @Schema(title = "返回金额") |
| | | private Float refundAmount; |
| | | |
| | | @Schema(title = "充值后金额") |
| | | private Float afterRecharge; |
| | | |
| | | @Schema(title = "支付方式") |
| | | private Integer paymentId; |
| | | private String paymentName; |
| | | |
| | | @Schema(title = "水价") |
| | | private Float price; |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 20:38 |
| | | * @LastEditTime 2024-02-01 20:38 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "财务对账,交易明细视图对象") |
| | | public class VoTradeDetails implements BaseEntity { |
| | | private static final long serialVersionUID = 202402012040001L; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | private String cashierId; |
| | | |
| | | @Schema(title = "区划名称串") |
| | | private String districtTitle; |
| | | |
| | | @Schema(title = "村庄ID") |
| | | private String villageId; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "联系电话") |
| | | private String phone; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "交易金额") |
| | | private Double tradeAmount; |
| | | |
| | | @Schema(title = "购水金额") |
| | | private Double waterCost; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | private Double cardCost; |
| | | |
| | | @Schema(title = "赠送金额") |
| | | private Double gift; |
| | | |
| | | @Schema(title = "返回金额") |
| | | private Double refundAmount; |
| | | |
| | | @Schema(title = "付款方式") |
| | | private String paymentName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "交易时间") |
| | | private Date tradeTime; |
| | | } |
| | |
| | | |
| | | @Schema(title = "赠送金额") |
| | | private Float gift; |
| | | |
| | | @Schema(title = "返还金额") |
| | | private Float refundAmount; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | private String cashierId; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 16:15 |
| | | * @LastEditTime 2024-01-31 16:15 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包账户视图对象") |
| | | public class VoWallet implements BaseEntity { |
| | | private static final long serialVersionUID = 202401311618001L; |
| | | |
| | | @Schema(title = "农户ID") |
| | | private String clientId; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "电子钱包余额") |
| | | private Double money; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 18:23 |
| | | * @LastEditTime 2024-01-31 18:23 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包消费视图对象") |
| | | public class VoWalletConsume { |
| | | private static final long serialVersionUID = 202401311824001L; |
| | | |
| | | @Schema(title = "消费金额") |
| | | private Double consumption; |
| | | |
| | | @Schema(title = "用水时长") |
| | | private Double duration; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "开阀时间") |
| | | private Date vot; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "关阀时间") |
| | | private Date vct; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 16:43 |
| | | * @LastEditTime 2024-01-31 16:43 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包充值视图对象") |
| | | public class VoWalletRecharge { |
| | | private static final long serialVersionUID = 202401311644001L; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "充值金额") |
| | | private Double amount; |
| | | |
| | | @Schema(title = "电子钱包余额") |
| | | private Double afterRecharge; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "充值时间") |
| | | private Date rechargeTime; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 18:29 |
| | | * @LastEditTime 2024-01-31 18:29 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包退款视图对象") |
| | | public class VoWalletRefund { |
| | | private static final long serialVersionUID = 202401311830001L; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "申请退款金额") |
| | | private Double refundAmount; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "申请时间") |
| | | private Date applicationTime; |
| | | |
| | | @Schema(title = "退款状态代码") |
| | | private Byte refundStatus; |
| | | |
| | | @Schema(title = "退款状态名称") |
| | | private String refundStatusName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "审核时间") |
| | | private Date auditTime; |
| | | |
| | | @Schema(title = "审核备注") |
| | | private String remarks; |
| | | } |
| | |
| | | webPort: 8085 |
| | | actutorPort: 9085 |
| | | idSuffix: 7 |
| | | webchat: |
| | | webPort: 8086 |
| | | actutorPort: 9086 |
| | | idSuffix: 8 |
| | | |
| | | #项目编号 |
| | | #projectCode: |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY role.operate_dt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | AND user.supperAdmin != 1 |
| | | AND user.deleted = 0 |
| | | |
| | | <if test = "name != null and name !=''"> |
| | | AND user.name like CONCAT('%',#{name},'%') |
| | | <if test = "userName != null and userName !=''"> |
| | | AND user.name like CONCAT('%',#{userName},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | |
| | | AND user.supperAdmin != 1 |
| | | AND user.deleted = 0 |
| | | |
| | | <if test = "name != null and name !=''"> |
| | | AND user.name like CONCAT('%',#{name},'%') |
| | | <if test = "userName != null and userName !=''"> |
| | | AND user.name like CONCAT('%',#{userName},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY user.id DESC |
| | | <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> |
| | | |
| | | <!--根据用户编号获取角色ID列表--> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY con.operateDt DESC |
| | | <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> |
| | | |
| | | <!--根据控制器地址获取控制器列表--> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY divi.operateDt DESC |
| | | <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> |
| | | |
| | | <!--根据分水房ID逻辑删除分水房--> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY pmofl.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY pfm.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY act.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY can.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | <result column="price" jdbcType="FLOAT" property="price" /> |
| | | <result column="card_cost" jdbcType="INTEGER" property="cardCost" /> |
| | | <result column="gift" jdbcType="FLOAT" property="gift" /> |
| | | <result column="refund_amount" jdbcType="FLOAT" property="refundAmount" /> |
| | | <result column="no_trade_amount" jdbcType="FLOAT" property="noTradeAmount" /> |
| | | <result column="operate_type_id" jdbcType="BIGINT" property="operateType" /> |
| | | <result column="operate_type" jdbcType="TINYINT" property="operateType" /> |
| | | <result column="payment_id" jdbcType="BIGINT" property="paymentId" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, card_id, client_id, money, system_balance, trade_amount, price, card_cost, gift, |
| | | no_trade_amount, operate_type_id, payment_id, remarks, `operator`, operate_dt |
| | | refund_amount, no_trade_amount, operate_type, payment_id, remarks, `operator`, operate_dt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | insert into se_card_operate (id, card_id, client_id, |
| | | money, system_balance, trade_amount, |
| | | price, card_cost, gift, |
| | | no_trade_amount, operate_type, payment_id, |
| | | remarks, `operator`, operate_dt |
| | | ) |
| | | refund_amount, no_trade_amount, operate_type, |
| | | payment_id, remarks, `operator`, |
| | | operate_dt) |
| | | values (#{id,jdbcType=BIGINT}, #{cardId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, #{systemBalance,jdbcType=FLOAT}, #{tradeAmount,jdbcType=FLOAT}, |
| | | #{price,jdbcType=FLOAT}, #{cardCost,jdbcType=INTEGER}, #{gift,jdbcType=FLOAT}, |
| | | #{noTradeAmount,jdbcType=FLOAT}, #{operateType,jdbcType=BIGINT}, #{paymentId,jdbcType=BIGINT}, |
| | | #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP} |
| | | ) |
| | | #{refundAmount,jdbcType=FLOAT}, #{noTradeAmount,jdbcType=FLOAT}, #{operateType,jdbcType=TINYINT}, |
| | | #{paymentId,jdbcType=BIGINT}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operateDt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCardOperate"> |
| | | <!--@mbg.generated--> |
| | |
| | | <if test="gift != null"> |
| | | gift, |
| | | </if> |
| | | <if test="refundAmount != null"> |
| | | refund_amount, |
| | | </if> |
| | | <if test="noTradeAmount != null"> |
| | | no_trade_amount, |
| | | </if> |
| | | <if test="operateType != null"> |
| | | operate_type_id, |
| | | operate_type, |
| | | </if> |
| | | <if test="paymentId != null"> |
| | | payment_id, |
| | |
| | | <if test="gift != null"> |
| | | #{gift,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="refundAmount != null"> |
| | | #{refundAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="noTradeAmount != null"> |
| | | #{noTradeAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="operateType != null"> |
| | | #{operateType,jdbcType=BIGINT}, |
| | | #{operateType,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="paymentId != null"> |
| | | #{paymentId,jdbcType=BIGINT}, |
| | |
| | | <if test="gift != null"> |
| | | gift = #{gift,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="refundAmount != null"> |
| | | refund_amount = #{refundAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="noTradeAmount != null"> |
| | | no_trade_amount = #{noTradeAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="operateType != null"> |
| | | operate_type_id = #{operateType,jdbcType=BIGINT}, |
| | | operate_type = #{operateType,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="paymentId != null"> |
| | | payment_id = #{paymentId,jdbcType=BIGINT}, |
| | |
| | | price = #{price,jdbcType=FLOAT}, |
| | | card_cost = #{cardCost,jdbcType=INTEGER}, |
| | | gift = #{gift,jdbcType=FLOAT}, |
| | | refund_amount = #{refundAmount,jdbcType=FLOAT}, |
| | | no_trade_amount = #{noTradeAmount,jdbcType=FLOAT}, |
| | | operate_type_id = #{operateType,jdbcType=BIGINT}, |
| | | operate_type = #{operateType,jdbcType=TINYINT}, |
| | | payment_id = #{paymentId,jdbcType=BIGINT}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | Left JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type = 2 |
| | | AND ope.operate_type in(2, 5) |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | |
| | | <!--根据指定条件获取充值记录--> |
| | | <select id="getRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoRecharge"> |
| | | SELECT |
| | | CAST(ope.id AS char) AS id , |
| | | CAST(ope.id AS char) AS id, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | card.cardNum, |
| | | ope.trade_amount AS amount, |
| | | (ope.money + ope.trade_amount) AS afterRecharge, |
| | | ope.payment_id, |
| | | CAST(card.cardNum AS char) AS cardNum, |
| | | IFNULL(ope.trade_amount, 0) AS amount, |
| | | IFNULL(ope.refund_amount, 0) AS refundAmount, |
| | | (IFNULL(ope.money, 0) + IFNULL(ope.trade_amount, 0)) AS afterRecharge, |
| | | -- ope.payment_id AS paymentId, |
| | | pay.name AS paymentName, |
| | | ope.price, |
| | | (SELECT `name` FROM ba_user WHERE id = ope.operator) AS operator, |
| | | us.name AS operator, |
| | | ope.operate_dt |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | Left JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type = 2 |
| | | AND ope.operate_type in(2, 5) |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <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> |
| | | |
| | | <!--根据指定条件获取交易记录数--> |
| | | <select id="getTransactionRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user user ON ope.operator = user.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | FROM v_trade_details |
| | | <where> |
| | | AND ope.operate_type IN(1,2,3,4) |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND cli.villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum >0"> |
| | | AND card.cardNum = ${cardNum} |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | AND tradeTime BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeTime != null"> |
| | | AND tradeTime = #{tradeTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录--> |
| | | <select id="getTransactions" resultType="com.dy.pipIrrGlobal.voSe.VoTransaction"> |
| | | SELECT |
| | | ope.id AS orderNumber, |
| | | cli.villageId, |
| | | cli.districtTitle, |
| | | cli.clientNum, |
| | | cli.`name`, |
| | | card.cardNum, |
| | | cli.idCard, |
| | | cli.phone, |
| | | (CASE operate_type |
| | | WHEN 1 THEN '开卡' |
| | | WHEN 2 THEN '充值' |
| | | WHEN 3 THEN '销卡' |
| | | WHEN 4 THEN '补卡' |
| | | END) AS operateType, |
| | | ope.operate_dt AS operateTime, |
| | | IFNULL(ope.money, 0) AS money, |
| | | IFNULL(ope.trade_amount, 0) AS waterCost, |
| | | IFNULL(ope.gift, 0) AS gift, |
| | | IFNULL(ope.card_cost, 0) AS cardCost, |
| | | pay.`name` paymentMethod, |
| | | user.name AS operatorName |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user user ON ope.operator = user.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <select id="getTransactions" resultType="com.dy.pipIrrGlobal.voSe.VoTradeDetails"> |
| | | SELECT * FROM v_trade_details |
| | | <where> |
| | | AND ope.operate_type IN(1,2,3,4) |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND cli.villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum >0"> |
| | | AND card.cardNum = ${cardNum} |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | AND tradeTime BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND user.id = ${cashierId} |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt |
| | | ORDER BY tradeTime |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取购水汇总和购卡汇总,获取交易明细使用--> |
| | | <select id="getTransactionSums" resultType="java.util.Map"> |
| | | SELECT |
| | | IFNULL(SUM(trade_amount),0) AS waterCost, |
| | | IFNULL(SUM(card_cost),0) AS cardCost |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user user ON ope.operator = user.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2,3,4) |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND cli.villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum >0"> |
| | | AND card.cardNum = ${cardNum} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <!--根据指定条件获取交易统计记录数--> |
| | | <select id="getTransactionStatisticsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易统计记录--> |
| | | <select id="getTransactionStatistics" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根基指定条件获取笔数合计、实收金额合计、赠送金额合计--> |
| | | <select id="getTransactionStatisticsSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(count) AS totalCount, |
| | | SUM(received) AS totalReceived, |
| | | SUM(gift) AS totalGift |
| | | FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取指定日期、指定支付方式实收金额合计--> |
| | | <select id="getPaymentSums" resultType="java.lang.Float"> |
| | | SELECT |
| | | SUM(ope.trade_amount) AS tradeAmount |
| | | FROM se_card_operate ope |
| | | <where> |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(ope.operate_dt) = #{tradeDate} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND ope.payment_id = ${paymentId} |
| | | </if> |
| | | </where> |
| | | GROUP BY ope.payment_id, Date(ope.operate_dt) |
| | | </select> |
| | | |
| | | <!--根据指定条件获取开卡记录数量--> |
| | |
| | | </select> |
| | | |
| | | <!--根据指定条件获取开卡记录--> |
| | | <select id="getActiveCards" resultType="com.dy.pipIrrGlobal.voSe.VoActiveCardNew"> |
| | | <select id="getActiveCards" resultType="com.dy.pipIrrGlobal.voSe.VoActiveCard"> |
| | | SELECT |
| | | CAST(ope.id AS char) AS id , |
| | | cli.name AS clientName, |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <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> |
| | | |
| | | <!--根据指定条件获取补卡记录数量--> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <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> |
| | | |
| | | <!--根据指定条件获取通用操作记录数量--> |
| | | <select id="getCommonOperationRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | <where> |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND ope.operate_type = ${operateType} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取通用操作记录--> |
| | | <select id="getCommonOperations" resultType="com.dy.pipIrrGlobal.voSe.VoOperate"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CAST(card.cardNum AS char) AS cardNum, |
| | | us.name AS operator, |
| | | ope.operate_dt AS operateDt, |
| | | IFNULL(ope.trade_amount,0) AS refund, |
| | | (CASE |
| | | WHEN ope.payment_id = 1 THEN "现金" |
| | | END) AS refundTypeName, |
| | | card.money, |
| | | IFNULL(ope.system_balance,0) AS systemBalance |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | <where> |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND ope.operate_type = ${operateType} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取收据列表数--> |
| | | <select id="getReceiptsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2) |
| | | <if test = "operateId != null and operateId > 0"> |
| | | AND ope.id = ${operateId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取收据列表--> |
| | | <select id="getReceipts" resultType="com.dy.pipIrrGlobal.voSe.VoReceipt"> |
| | | SELECT |
| | | CAST(ope.id AS char) AS orderNumber, |
| | | tow.name AS townName, |
| | | vil.name AS villageName, |
| | | cli.`name`, |
| | | cli.phone, |
| | | CAST(cli.clientNum AS char) AS clientNum, |
| | | CAST(card.cardNum AS char) AS cardNum, |
| | | (CASE |
| | | WHEN ope.operate_type = 1 THEN '开卡' |
| | | WHEN ope.operate_type = 2 THEN '充值' |
| | | END) AS operateType, |
| | | IFNULL(ope.trade_amount,0) AS waterCost, |
| | | IFNULL(ope.card_cost,0) AS cardCost, |
| | | (IFNULL(ope.trade_amount,0) + IFNULL(ope.card_cost,0)) AS amount, |
| | | card.money, |
| | | pay.`name` AS paymentName, |
| | | us.`name` AS operatorName, |
| | | ope.operate_dt AS operateTime, |
| | | NOW() AS currentTime |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2) |
| | | <if test = "operateId != null and operateId > 0"> |
| | | AND ope.id = ${operateId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取收据收费金额合计--> |
| | | <select id="getTotalAmount" parameterType="java.util.Map" resultType="java.lang.Double"> |
| | | SELECT |
| | | SUM(IFNULL(ope.trade_amount,0) + IFNULL(ope.card_cost,0)) AS totalAmount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2) |
| | | <if test = "operateId != null and operateId > 0"> |
| | | AND ope.id = ${operateId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY card.id |
| | | <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> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY cli.operateDt DESC |
| | | <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> |
| | | |
| | | <!--根据农户编号获取5级行政区划代码--> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoSe.SeConsumeMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeConsume"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_consume--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="wallet_id" jdbcType="BIGINT" property="walletId" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="consumption" jdbcType="FLOAT" property="consumption" /> |
| | | <result column="after_consume" jdbcType="FLOAT" property="afterConsume" /> |
| | | <result column="duration" jdbcType="FLOAT" property="duration" /> |
| | | <result column="vot" jdbcType="TIMESTAMP" property="vot" /> |
| | | <result column="vct" jdbcType="TIMESTAMP" property="vct" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, wallet_id, client_id, money, consumption, after_consume, duration, vot, vct |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from se_consume |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from se_consume |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume"> |
| | | <!--@mbg.generated--> |
| | | insert into se_consume (id, wallet_id, client_id, |
| | | money, consumption, after_consume, |
| | | duration, vot, vct |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{walletId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, #{consumption,jdbcType=FLOAT}, #{afterConsume,jdbcType=FLOAT}, |
| | | #{duration,jdbcType=FLOAT}, #{vot,jdbcType=TIMESTAMP}, #{vct,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume"> |
| | | <!--@mbg.generated--> |
| | | insert into se_consume |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="walletId != null"> |
| | | wallet_id, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | | </if> |
| | | <if test="consumption != null"> |
| | | consumption, |
| | | </if> |
| | | <if test="afterConsume != null"> |
| | | after_consume, |
| | | </if> |
| | | <if test="duration != null"> |
| | | duration, |
| | | </if> |
| | | <if test="vot != null"> |
| | | vot, |
| | | </if> |
| | | <if test="vct != null"> |
| | | vct, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="walletId != null"> |
| | | #{walletId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="consumption != null"> |
| | | #{consumption,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="afterConsume != null"> |
| | | #{afterConsume,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="duration != null"> |
| | | #{duration,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="vot != null"> |
| | | #{vot,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="vct != null"> |
| | | #{vct,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume"> |
| | | <!--@mbg.generated--> |
| | | update se_consume |
| | | <set> |
| | | <if test="walletId != null"> |
| | | wallet_id = #{walletId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="consumption != null"> |
| | | consumption = #{consumption,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="afterConsume != null"> |
| | | after_consume = #{afterConsume,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="duration != null"> |
| | | duration = #{duration,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="vot != null"> |
| | | vot = #{vot,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="vct != null"> |
| | | vct = #{vct,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume"> |
| | | <!--@mbg.generated--> |
| | | update se_consume |
| | | set wallet_id = #{walletId,jdbcType=BIGINT}, |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | consumption = #{consumption,jdbcType=FLOAT}, |
| | | after_consume = #{afterConsume,jdbcType=FLOAT}, |
| | | duration = #{duration,jdbcType=FLOAT}, |
| | | vot = #{vot,jdbcType=TIMESTAMP}, |
| | | vct = #{vct,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据农户ID获取消费汇总记录--> |
| | | <select id="getWalletConsumeSum" resultType="java.util.Map"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | wal.money, |
| | | (SELECT SUM(consumption) FROM se_consume WHERE client_id = cli.id) AS totalConsume |
| | | FROM se_client cli |
| | | INNER JOIN se_wallet wal ON wal.client_id = cli.id |
| | | <where> |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND cli.id = ${clientId} |
| | | </if> |
| | | </where> |
| | | |
| | | </select> |
| | | |
| | | <!--根据农户ID获取电子钱包消费记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_consume |
| | | <where> |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND client_id = ${clientId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据农户ID获取电子钱包消费记录--> |
| | | <select id="getWalletConsumes" resultType="com.dy.pipIrrGlobal.voSe.VoWalletConsume"> |
| | | SELECT |
| | | consumption, |
| | | duration, |
| | | vot, |
| | | vct |
| | | FROM se_consume |
| | | <where> |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND client_id = ${clientId} |
| | | </if> |
| | | </where> |
| | | ORDER BY vct DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="cashier_name" jdbcType="VARCHAR" property="cashierName" /> |
| | | <result column="trade_amount" jdbcType="FLOAT" property="tradeAmount" /> |
| | | <result column="gift" jdbcType="FLOAT" property="gift" /> |
| | | <result column="total_amount" jdbcType="FLOAT" property="totalAmount" /> |
| | | <result column="refund_amount" jdbcType="FLOAT" property="refundAmount" /> |
| | | <result column="operate_date" jdbcType="TIMESTAMP" property="operateDate" /> |
| | | <result column="audit_status" jdbcType="TINYINT" property="auditStatus" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, cashier_id, cashier_name, trade_amount, gift, total_amount, operate_date, audit_status |
| | | id, cashier_id, cashier_name, trade_amount, gift, refund_amount, operate_date, audit_status |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> |
| | | <!--@mbg.generated--> |
| | | insert into se_general (id, cashier_id, cashier_name, |
| | | trade_amount, gift, total_amount, |
| | | trade_amount, gift, refund_amount, |
| | | operate_date, audit_status) |
| | | values (#{id,jdbcType=BIGINT}, #{cashierId,jdbcType=BIGINT}, #{cashierName,jdbcType=VARCHAR}, |
| | | #{tradeAmount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{totalAmount,jdbcType=FLOAT}, |
| | | #{tradeAmount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{refundAmount,jdbcType=FLOAT}, |
| | | #{operateDate,jdbcType=TIMESTAMP}, #{auditStatus,jdbcType=TINYINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> |
| | |
| | | <if test="gift != null"> |
| | | gift, |
| | | </if> |
| | | <if test="totalAmount != null"> |
| | | total_amount, |
| | | <if test="refundAmount != null"> |
| | | refund_amount, |
| | | </if> |
| | | <if test="operateDate != null"> |
| | | operate_date, |
| | |
| | | <if test="gift != null"> |
| | | #{gift,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="totalAmount != null"> |
| | | #{totalAmount,jdbcType=FLOAT}, |
| | | <if test="refundAmount != null"> |
| | | #{refundAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="operateDate != null"> |
| | | #{operateDate,jdbcType=TIMESTAMP}, |
| | |
| | | <if test="gift != null"> |
| | | gift = #{gift,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="totalAmount != null"> |
| | | total_amount = #{totalAmount,jdbcType=FLOAT}, |
| | | <if test="refundAmount != null"> |
| | | refund_amount = #{refundAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="operateDate != null"> |
| | | operate_date = #{operateDate,jdbcType=TIMESTAMP}, |
| | |
| | | cashier_name = #{cashierName,jdbcType=VARCHAR}, |
| | | trade_amount = #{tradeAmount,jdbcType=FLOAT}, |
| | | gift = #{gift,jdbcType=FLOAT}, |
| | | total_amount = #{totalAmount,jdbcType=FLOAT}, |
| | | refund_amount = #{refundAmount,jdbcType=FLOAT}, |
| | | operate_date = #{operateDate,jdbcType=TIMESTAMP}, |
| | | audit_status = #{auditStatus,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | SELECT |
| | | us.id AS cashierId, |
| | | us.`name` AS cashierName, |
| | | IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, |
| | | (IFNULL(SUM(ope.trade_amount),0) + IFNULL(SUM(ope.card_cost),0)) AS tradeAmount, |
| | | IFNULL(SUM(ope.gift),0) AS gift, |
| | | IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, |
| | | IFNULL(SUM(ope.refund_amount),0) AS refundAmount, |
| | | Date(ope.operate_dt) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_card_operate ope |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | WHERE Date(ope.operate_dt) = #{operateDate} |
| | | GROUP BY ope.operator, Date(ope.operate_dt) |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | 1000000 AS cashierId, |
| | | '微信' AS cashierName, |
| | | IFNULL(SUM(amount), 0) AS tradeAmount, |
| | | 0 AS gift, |
| | | 0 AS refundAmount, |
| | | Date(recharge_time) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_wallet_recharge |
| | | WHERE Date(recharge_time) = #{operateDate} |
| | | GROUP BY Date(recharge_time) |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | 1000000 AS cashierId, |
| | | '微信' AS cashierName, |
| | | IFNULL(-SUM(refund_amount), 0) AS tradeAmount, |
| | | 0 AS gift, |
| | | 0 AS refundAmount, |
| | | Date(audit_time) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_refund |
| | | WHERE Date(audit_time) = #{operateDate} |
| | | GROUP BY Date(audit_time) |
| | | </select> |
| | | |
| | | <!--根据指定条件获取总账记录数--> |
| | |
| | | cashier_name AS cashierName, |
| | | trade_amount AS tradeAmount, |
| | | gift, |
| | | total_amount AS totalAmount, |
| | | refund_amount AS refundAmount, |
| | | Date(operate_date) AS operateDate, |
| | | (CASE |
| | | WHEN audit_status = 1 THEN "未审核" |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY Date(operate_date) DESC |
| | | <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> |
| | | |
| | | <!--获取指定日期、指定收银员、指定支付方式实收金额合计--> |
| | |
| | | GROUP BY ope.payment_id, Date(ope.operate_dt) |
| | | </select> |
| | | |
| | | <!--根基指定日期、指定收银员获取笔数合计、实收金额合计、赠送金额合计--> |
| | | <select id="getTransactionStatisticsSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(count) AS totalCount, |
| | | SUM(received) AS totalReceived, |
| | | SUM(gift) AS totalGift |
| | | FROM v_transactionstatistics2 |
| | | <where> |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND tradeDate = #{tradeDate} |
| | | </if> |
| | | |
| | | <if test = "cashierId != null and cashierId >0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- 财务对账审核页,收银员+日期分组,排除交易类型分组,记录数--> |
| | | <select id="getToAuditRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_transactionstatistics2 |
| | | <!-- <select id="getToAuditRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">--> |
| | | <!-- SELECT--> |
| | | <!-- COUNT(*) AS recordCount--> |
| | | <!-- FROM v_trade_summary--> |
| | | <!-- <where>--> |
| | | <!-- <if test = "cashierId != null and cashierId > 0">--> |
| | | <!-- AND cashierId = ${cashierId}--> |
| | | <!-- </if>--> |
| | | |
| | | <!-- <if test = "tradeDate != null">--> |
| | | <!-- AND tradeDate = #{tradeDate}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- </select>--> |
| | | |
| | | <!--开卡系统交易统计,收银员+日期+类型分组--> |
| | | <select id="getSummaries" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_trade_summary |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND tradeDate = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--财务对账审核页,收银员+日期分组,排除交易类型分组--> |
| | | <select id="getToAudit" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_transactionstatistics2 |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND tradeDate = #{tradeDate} |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND Date(tradeDate) BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 根据收银员ID及日期获取财务对账_交易明细记录数--> |
| | | <select id="getTradeDetailsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_trade_details |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND Date(tradeTime) = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据收银员ID及日期获取财务对账_交易明细记录--> |
| | | <select id="getTradeDetails" resultType="com.dy.pipIrrGlobal.voSe.VoTradeDetails"> |
| | | SELECT * FROM v_trade_details |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND Date(tradeTime) = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeTime |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY loss.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY rec.operateDt DESC |
| | | <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> |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoSe.SeRefundMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeRefund"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_refund--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="wallet_id" jdbcType="BIGINT" property="walletId" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="refund_amount" jdbcType="FLOAT" property="refundAmount" /> |
| | | <result column="after_refund" jdbcType="FLOAT" property="afterRefund" /> |
| | | <result column="application_time" jdbcType="TIMESTAMP" property="applicationTime" /> |
| | | <result column="refund_status" jdbcType="TINYINT" property="refundStatus" /> |
| | | <result column="auditor" jdbcType="BIGINT" property="auditor" /> |
| | | <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, wallet_id, client_id, money, refund_amount, after_refund, application_time, refund_status, |
| | | auditor, audit_time, remarks |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from se_refund |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from se_refund |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund"> |
| | | <!--@mbg.generated--> |
| | | insert into se_refund (id, wallet_id, client_id, |
| | | money, refund_amount, after_refund, |
| | | application_time, refund_status, auditor, |
| | | audit_time, remarks) |
| | | values (#{id,jdbcType=BIGINT}, #{walletId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, #{refundAmount,jdbcType=FLOAT}, #{afterRefund,jdbcType=FLOAT}, |
| | | #{applicationTime,jdbcType=TIMESTAMP}, #{refundStatus,jdbcType=TINYINT}, #{auditor,jdbcType=BIGINT}, |
| | | #{auditTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund"> |
| | | <!--@mbg.generated--> |
| | | insert into se_refund |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="walletId != null"> |
| | | wallet_id, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | | </if> |
| | | <if test="refundAmount != null"> |
| | | refund_amount, |
| | | </if> |
| | | <if test="afterRefund != null"> |
| | | after_refund, |
| | | </if> |
| | | <if test="applicationTime != null"> |
| | | application_time, |
| | | </if> |
| | | <if test="refundStatus != null"> |
| | | refund_status, |
| | | </if> |
| | | <if test="auditor != null"> |
| | | auditor, |
| | | </if> |
| | | <if test="auditTime != null"> |
| | | audit_time, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="walletId != null"> |
| | | #{walletId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="refundAmount != null"> |
| | | #{refundAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="afterRefund != null"> |
| | | #{afterRefund,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="applicationTime != null"> |
| | | #{applicationTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="refundStatus != null"> |
| | | #{refundStatus,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="auditor != null"> |
| | | #{auditor,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="auditTime != null"> |
| | | #{auditTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund"> |
| | | <!--@mbg.generated--> |
| | | update se_refund |
| | | <set> |
| | | <if test="walletId != null"> |
| | | wallet_id = #{walletId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="refundAmount != null"> |
| | | refund_amount = #{refundAmount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="afterRefund != null"> |
| | | after_refund = #{afterRefund,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="applicationTime != null"> |
| | | application_time = #{applicationTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="refundStatus != null"> |
| | | refund_status = #{refundStatus,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="auditor != null"> |
| | | auditor = #{auditor,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="auditTime != null"> |
| | | audit_time = #{auditTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund"> |
| | | <!--@mbg.generated--> |
| | | update se_refund |
| | | set wallet_id = #{walletId,jdbcType=BIGINT}, |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | refund_amount = #{refundAmount,jdbcType=FLOAT}, |
| | | after_refund = #{afterRefund,jdbcType=FLOAT}, |
| | | application_time = #{applicationTime,jdbcType=TIMESTAMP}, |
| | | refund_status = #{refundStatus,jdbcType=TINYINT}, |
| | | auditor = #{auditor,jdbcType=BIGINT}, |
| | | audit_time = #{auditTime,jdbcType=TIMESTAMP}, |
| | | remarks = #{remarks,jdbcType=VARCHAR} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据钱包ID获取待审核的退款申请对象--> |
| | | <select id="getRefundByWallerId" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from se_refund |
| | | where refund_status = 1 AND wallet_id = ${walletId} |
| | | </select> |
| | | |
| | | <!--根据指定条件获取电子钱包退款记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_refund ref |
| | | INNER JOIN se_client cli ON ref.client_id = cli.id |
| | | <where> |
| | | <if test = "refundStatus != null and refundStatus > 0"> |
| | | AND ref.refund_status = ${refundStatus} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取电子钱包退款记录--> |
| | | <select id="getWalletRefunds" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRefund"> |
| | | SELECT |
| | | cli.`name`, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | ref.refund_amount AS refundAmount, |
| | | ref.application_time AS applicationTime, |
| | | ref.refund_status AS refundStatus, |
| | | (CASE |
| | | WHEN ref.refund_status = 1 THEN '未退款' |
| | | WHEN ref.refund_status = 2 THEN '已退款' |
| | | End) AS refundStatusName, |
| | | ref.audit_time AS auditTime, |
| | | ref.remarks |
| | | FROM se_refund ref |
| | | INNER JOIN se_client cli ON ref.client_id = cli.id |
| | | <where> |
| | | <if test = "refundStatus != null and refundStatus > 0"> |
| | | AND ref.refund_status = ${refundStatus} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY ref.application_time DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取指定日期微信退款(只计算已退的)总额,财务对账审核页使用--> |
| | | <select id="getRefundSum" resultType="java.lang.Double"> |
| | | SELECT |
| | | SUM(refund_amount) AS tradeAmount |
| | | FROM se_refund |
| | | <where> |
| | | AND refund_status = 2 |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(audit_time) = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | GROUP BY Date(audit_time) |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY rev.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY unl.operateDt DESC |
| | | <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> |
| | | </mapper> |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_wallet--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="clientId" jdbcType="BIGINT" property="clientid" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="createDt" jdbcType="TIMESTAMP" property="createdt" /> |
| | | <result column="last_operate" jdbcType="TINYINT" property="lastOperate" /> |
| | | <result column="last_operate_time" jdbcType="TIMESTAMP" property="lastOperateTime" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, clientId, money, createDt |
| | | id, client_id, money, last_operate, last_operate_time, create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet"> |
| | | <!--@mbg.generated--> |
| | | insert into se_wallet (id, clientId, money, createDt) |
| | | values (#{id,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT}, #{money,jdbcType=FLOAT}, |
| | | #{createdt,jdbcType=TIMESTAMP}) |
| | | insert into se_wallet (id, client_id, money, |
| | | last_operate, last_operate_time, create_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{money,jdbcType=FLOAT}, |
| | | #{lastOperate,jdbcType=TINYINT}, #{lastOperateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet"> |
| | | <!--@mbg.generated--> |
| | |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId, |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | | </if> |
| | | <if test="createdt != null"> |
| | | createDt, |
| | | <if test="lastOperate != null"> |
| | | last_operate, |
| | | </if> |
| | | <if test="lastOperateTime != null"> |
| | | last_operate_time, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="createdt != null"> |
| | | #{createdt,jdbcType=TIMESTAMP}, |
| | | <if test="lastOperate != null"> |
| | | #{lastOperate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="lastOperateTime != null"> |
| | | #{lastOperateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <!--@mbg.generated--> |
| | | update se_wallet |
| | | <set> |
| | | <if test="clientid != null"> |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="createdt != null"> |
| | | createDt = #{createdt,jdbcType=TIMESTAMP}, |
| | | <if test="lastOperate != null"> |
| | | last_operate = #{lastOperate,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="lastOperateTime != null"> |
| | | last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet"> |
| | | <!--@mbg.generated--> |
| | | update se_wallet |
| | | set clientId = #{clientid,jdbcType=BIGINT}, |
| | | set client_id = #{clientId,jdbcType=BIGINT}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | createDt = #{createdt,jdbcType=TIMESTAMP} |
| | | last_operate = #{lastOperate,jdbcType=TINYINT}, |
| | | last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据农户ID获取电子钱包对象--> |
| | | <select id="getWalletByClientId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM se_wallet |
| | | WHERE client_id = ${clientId} |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--根据农户姓名获取电子钱包账户记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_wallet wal |
| | | INNER JOIN se_client cli ON wal.client_id = cli.id |
| | | <where> |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据农户姓名获取电子钱包账户记录--> |
| | | <select id="getWallets" resultType="com.dy.pipIrrGlobal.voSe.VoWallet"> |
| | | SELECT |
| | | CAST(cli.id AS char) AS clientId, |
| | | cli.`name`, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | wal.money |
| | | FROM se_wallet wal |
| | | INNER JOIN se_client cli ON wal.client_id = cli.id |
| | | <where> |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY wal.last_operate_time DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_wallet_recharge--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="walletId" jdbcType="BIGINT" property="walletid" /> |
| | | <result column="clientId" jdbcType="BIGINT" property="clientid" /> |
| | | <result column="wallet_id" jdbcType="BIGINT" property="walletId" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="amount" jdbcType="FLOAT" property="amount" /> |
| | | <result column="afterRecharge" jdbcType="FLOAT" property="afterrecharge" /> |
| | | <result column="rechargeDt" jdbcType="TIMESTAMP" property="rechargedt" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="after_recharge" jdbcType="FLOAT" property="afterRecharge" /> |
| | | <result column="recharge_time" jdbcType="TIMESTAMP" property="rechargeTime" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, walletId, clientId, money, amount, afterRecharge, rechargeDt, remarks |
| | | id, wallet_id, client_id, money, amount, after_recharge, recharge_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge"> |
| | | <!--@mbg.generated--> |
| | | insert into se_wallet_recharge (id, walletId, clientId, |
| | | money, amount, afterRecharge, |
| | | rechargeDt, remarks) |
| | | values (#{id,jdbcType=BIGINT}, #{walletid,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, #{amount,jdbcType=FLOAT}, #{afterrecharge,jdbcType=FLOAT}, |
| | | #{rechargedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}) |
| | | insert into se_wallet_recharge (id, wallet_id, client_id, |
| | | money, amount, after_recharge, |
| | | recharge_time) |
| | | values (#{id,jdbcType=BIGINT}, #{walletId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, #{amount,jdbcType=FLOAT}, #{afterRecharge,jdbcType=FLOAT}, |
| | | #{rechargeTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge"> |
| | | <!--@mbg.generated--> |
| | |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="walletid != null"> |
| | | walletId, |
| | | <if test="walletId != null"> |
| | | wallet_id, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId, |
| | | <if test="clientId != null"> |
| | | client_id, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | |
| | | <if test="amount != null"> |
| | | amount, |
| | | </if> |
| | | <if test="afterrecharge != null"> |
| | | afterRecharge, |
| | | <if test="afterRecharge != null"> |
| | | after_recharge, |
| | | </if> |
| | | <if test="rechargedt != null"> |
| | | rechargeDt, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | <if test="rechargeTime != null"> |
| | | recharge_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="walletid != null"> |
| | | #{walletid,jdbcType=BIGINT}, |
| | | <if test="walletId != null"> |
| | | #{walletId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientId != null"> |
| | | #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | |
| | | <if test="amount != null"> |
| | | #{amount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="afterrecharge != null"> |
| | | #{afterrecharge,jdbcType=FLOAT}, |
| | | <if test="afterRecharge != null"> |
| | | #{afterRecharge,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="rechargedt != null"> |
| | | #{rechargedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | <if test="rechargeTime != null"> |
| | | #{rechargeTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <!--@mbg.generated--> |
| | | update se_wallet_recharge |
| | | <set> |
| | | <if test="walletid != null"> |
| | | walletId = #{walletid,jdbcType=BIGINT}, |
| | | <if test="walletId != null"> |
| | | wallet_id = #{walletId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientId != null"> |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | |
| | | <if test="amount != null"> |
| | | amount = #{amount,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="afterrecharge != null"> |
| | | afterRecharge = #{afterrecharge,jdbcType=FLOAT}, |
| | | <if test="afterRecharge != null"> |
| | | after_recharge = #{afterRecharge,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="rechargedt != null"> |
| | | rechargeDt = #{rechargedt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | <if test="rechargeTime != null"> |
| | | recharge_time = #{rechargeTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge"> |
| | | <!--@mbg.generated--> |
| | | update se_wallet_recharge |
| | | set walletId = #{walletid,jdbcType=BIGINT}, |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | set wallet_id = #{walletId,jdbcType=BIGINT}, |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | amount = #{amount,jdbcType=FLOAT}, |
| | | afterRecharge = #{afterrecharge,jdbcType=FLOAT}, |
| | | rechargeDt = #{rechargedt,jdbcType=TIMESTAMP}, |
| | | remarks = #{remarks,jdbcType=VARCHAR} |
| | | after_recharge = #{afterRecharge,jdbcType=FLOAT}, |
| | | recharge_time = #{rechargeTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定条件获取电子钱包充值记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_wallet_recharge rec |
| | | INNER JOIN se_client cli ON rec.client_id = cli.id |
| | | <where> |
| | | <if test = "walletId != null and walletId > 0"> |
| | | AND rec.wallet_id = ${walletId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND rec.recharge_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取电子钱包充值记录--> |
| | | <select id="getWalletRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRecharge"> |
| | | SELECT |
| | | cli.`name`, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | rec.amount, |
| | | rec.after_recharge AS afterRecharge, |
| | | rec.recharge_time AS rechargeTime |
| | | FROM se_wallet_recharge rec |
| | | INNER JOIN se_client cli ON rec.client_id = cli.id |
| | | <where> |
| | | <if test = "walletId != null and walletId > 0"> |
| | | AND rec.wallet_id = ${walletId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND rec.recharge_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY rec.recharge_time DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取指定日期微信收款总额,财务对账审核页使用--> |
| | | <select id="getRechargeSum" resultType="java.lang.Double"> |
| | | SELECT |
| | | SUM(amount) AS tradeAmount |
| | | FROM se_wallet_recharge |
| | | <where> |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(recharge_time) = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | GROUP BY Date(recharge_time) |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_webchat_logon_state--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="open_id" jdbcType="VARCHAR" property="openId" /> |
| | | <result column="session_key" jdbcType="VARCHAR" property="sessionKey" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, open_id, session_key, create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from se_webchat_logon_state |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from se_webchat_logon_state |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> |
| | | <!--@mbg.generated--> |
| | | insert into se_webchat_logon_state (id, open_id, session_key, |
| | | create_time) |
| | | values (#{id,jdbcType=BIGINT}, #{openId,jdbcType=VARCHAR}, #{sessionKey,jdbcType=VARCHAR}, |
| | | #{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> |
| | | <!--@mbg.generated--> |
| | | insert into se_webchat_logon_state |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="openId != null"> |
| | | open_id, |
| | | </if> |
| | | <if test="sessionKey != null"> |
| | | session_key, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="openId != null"> |
| | | #{openId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sessionKey != null"> |
| | | #{sessionKey,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> |
| | | <!--@mbg.generated--> |
| | | update se_webchat_logon_state |
| | | <set> |
| | | <if test="openId != null"> |
| | | open_id = #{openId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sessionKey != null"> |
| | | session_key = #{sessionKey,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState"> |
| | | <!--@mbg.generated--> |
| | | update se_webchat_logon_state |
| | | set open_id = #{openId,jdbcType=VARCHAR}, |
| | | session_key = #{sessionKey,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaBlockMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClientType; |
| | | 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.Map; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | Long itemTotal = baRolePermissionsMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoRole>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | //Integer pageCurr = 0; |
| | | //Integer pageSize = 10000; |
| | | //rsVo.pageCurr = 1; |
| | | //rsVo.pageSize = 10000; |
| | | //if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | // rsVo.pageSize = queryVo.pageSize ; |
| | | // rsVo.pageCurr = queryVo.pageCurr; |
| | | // pageSize = queryVo.pageSize ; |
| | | // pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | //} |
| | | //params.put("pageCurr", pageCurr); |
| | | //params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | //rsVo.obj = baRoleMapper.getRoles(params); |
| | |
| | | public class QueryVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "用户姓名") |
| | | public String name; |
| | | public String userName; |
| | | |
| | | @Schema(description = "用户姓名电话") |
| | | public String phone; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "some") |
| | | //@PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoUserInfo>>> some(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoUserInfo>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); |
| | | }else { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | log.error("查询用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | po.userId = null; |
| | | int count; |
| | | Long userId; |
| | | try { |
| | | po.supperAdmin = Constant.no.byteValue() ; |
| | | po.disabled = Disabled.NO;//默认不禁用 |
| | |
| | | } else { |
| | | po.password = MD5.encrypt(defaultPassword); |
| | | } |
| | | count = this.sv.save(po); |
| | | this.sv.setRoles(po.userId, po.roleIds); |
| | | userId = this.sv.save(po); |
| | | this.sv.setRoles(userId, po.roleIds); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | | if (userId <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | |
| | | Long itemTotal = this.dao.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoUserInfo>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | |
| | |
| | | * @return 影响记录数量 |
| | | */ |
| | | @Transactional |
| | | public int save(BaUser po){ |
| | | return this.dao.putin(po) ; |
| | | public Long save(BaUser po){ |
| | | //return this.dao.putin(po) ; |
| | | this.dao.putin(po) ; |
| | | return po.getUserId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | Long itemTotal = prControllerMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoController>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prControllerMapper.getControllers(params); |
| | |
| | | Long itemTotal = prDivideMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoDivide>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prDivideMapper.getDivides(params); |
| | |
| | | import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowMonitoringMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrIntake; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | |
| | | QueryResultVo<List<VoFlowMonitoring>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | // 计算符合条件的记录数 |
| | | Integer itemTotal = prFlowMonitoringMapper.getRecordCountOfFlowMonitoring(params); |
| | |
| | | import com.dy.pipIrrGlobal.daoPr.PrFlowmeterMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMeter; |
| | | import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | |
| | | QueryResultVo<List<VoFlowMeter>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | // 计算符合条件的记录数 |
| | | Integer itemTotal = prFlowmeterMapper.getRecordCountOfFlowMeterByOthers(params); |
| | |
| | | Long itemTotal = seActiveCardMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoActiveCard>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seActiveCardMapper.getActiveCards(params); |
| | |
| | | Long itemTotal = seCancelMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoCancel>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCancelMapper.getCancels(params); |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.util.AmountToChinese; |
| | | import com.dy.pipIrrGlobal.util.Constant; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCardNew; |
| | | import com.dy.pipIrrGlobal.voSe.VoRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoReissueCard; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | | import com.dy.pipIrrSell.cardOperate.converter.RechargeDtoMapper; |
| | | import com.dy.pipIrrSell.cardOperate.dto.*; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | |
| | | seCardOperate.setClientId(clientId); |
| | | seCardOperate.setMoney(money); |
| | | seCardOperate.setTradeAmount(-refund); |
| | | seCardOperate.setPaymentId(1L); |
| | | seCardOperate.setOperateType(OperateTypeENUM.LOSS.getCode()); |
| | | seCardOperate.setRemarks(remarks); |
| | | seCardOperate.setOperator(operator); |
| | |
| | | seCardOperate.setCardId(cardId); |
| | | seCardOperate.setClientId(clientId); |
| | | seCardOperate.setMoney(money); |
| | | seCardOperate.setNoTradeAmount(refund); |
| | | //seCardOperate.setNoTradeAmount(refund); |
| | | seCardOperate.setRefundAmount(refund); |
| | | seCardOperate.setOperateType(OperateTypeENUM.REFUND.getCode()); |
| | | seCardOperate.setRemarks(remarks); |
| | | seCardOperate.setOperator(operator); |
| | |
| | | public BaseResponse<QueryResultVo<List<VoRecharge>>> get(QoRecharge vo){ |
| | | try { |
| | | QueryResultVo<List<VoRecharge>> res = cardOperateSv.getRecharges(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_RECHARGES.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取充值记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取交易明细 |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取交易汇总记录 |
| | | * @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 = "getStatistics") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getStatistics(QoTransactionStatistics vo){ |
| | | try { |
| | | Map res = cardOperateSv.getTransactionStatistics(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易汇总记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取开卡记录 |
| | | * @param vo |
| | | * @return |
| | |
| | | }) |
| | | @GetMapping(path = "/getActiveCards") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoActiveCardNew>>> getActiveCards(QoActiveCard vo){ |
| | | public BaseResponse<QueryResultVo<List<VoActiveCard>>> getActiveCards(QoActiveCard vo){ |
| | | try { |
| | | QueryResultVo<List<VoActiveCardNew>> res = cardOperateSv.getActiveCards(vo); |
| | | QueryResultVo<List<VoActiveCard>> res = cardOperateSv.getActiveCards(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_ActiveCards.getMessage()); |
| | | } |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取补卡记录 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取通用操作记录 |
| | | * 注销、挂失、冲正、解锁通用 |
| | | * 注销-3,挂失-6,冲正-7,解锁-8 |
| | | * @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getOptions") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoOperate>>> getCommonOperations(QoCommonOperate vo){ |
| | | // 验证操作类型是否正确 |
| | | Integer operateType = Optional.ofNullable(vo.getOperateType()).orElse(0); |
| | | if(operateType != 3 && operateType != 6 && operateType != 7 && operateType != 8) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.PARAMS_ERROR.getMessage()); |
| | | } |
| | | |
| | | try { |
| | | QueryResultVo<List<VoOperate>> res = cardOperateSv.getCommonOperations(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_CANCELS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取收据列表 |
| | | * @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_receipts") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getReceipts(QoReceipt vo){ |
| | | try { |
| | | Map res = Optional.ofNullable(cardOperateSv.getReceipts(vo)).orElse(new HashMap()); |
| | | if(res.size() == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_RECEIPTS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包账户记录", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 金额转大写 |
| | | * @param amount |
| | | * @return |
| | | */ |
| | | |
| | | @GetMapping(path = "/amount_to_chinese") |
| | | public BaseResponse<Boolean> amountToChinese(BigDecimal amount) { |
| | | try { |
| | | AmountToChinese amountToChinese = new AmountToChinese(); |
| | | String chinese = amountToChinese.toChinese(amount); |
| | | return BaseResponseUtils.buildSuccess(chinese) ; |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.cardOperate; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | |
| | | import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeGeneralMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private ClientCardSv clientCardSv; |
| | | |
| | | @Autowired |
| | | private SeGeneralMapper seGeneralMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | Long itemTotal = seCardOperateMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoRecharge>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCardOperateMapper.getRecharges(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录 |
| | |
| | | * @return |
| | | */ |
| | | public Map getTransactions(QoTransaction vo){ |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | // 获取汇总的购水金额、购卡金额 |
| | | Float waterCost = 0f; |
| | | Float cardCost = 0f; |
| | | Map map_sum = Optional.ofNullable(seCardOperateMapper.getTransactionSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | waterCost = Float.parseFloat(map_sum.get("waterCost").toString()); |
| | | cardCost = Float.parseFloat(map_sum.get("cardCost").toString()); |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = Optional.ofNullable(seCardOperateMapper.getTransactionRecordCount(params)).orElse(0L); |
| | | |
| | | List<VoTradeDetails> list = seCardOperateMapper.getTransactions(params); |
| | | if(list.size() == 0) { |
| | | return new HashMap(); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seCardOperateMapper.getTransactionRecordCount(params); |
| | | // 遍历交易明细记录,汇总购水金额、购卡金额 |
| | | Double totalWaterCost = 0.0; |
| | | Double totalCardCost = 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); |
| | | totalWaterCost = totalWaterCost + waterCost; |
| | | totalCardCost = totalCardCost + cardCost; |
| | | } |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoTransaction> lit = seCardOperateMapper.getTransactions(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", lit); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("waterCost", waterCost); |
| | | map_result.put("cardCost", cardCost); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 获取交易统计记录 |
| | | * 1.交易统计记录 |
| | | * 2.笔数合计、实收金额合计、赠送金额合计 |
| | | * 3.每一天、各种支付方式实收金额合计 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public Map getTransactionStatistics(QoTransactionStatistics vo) throws ParseException { |
| | | /** |
| | | * 遍历查询日期,取出每天三种支付方式(现金、扫码、转账)实收金额 |
| | | * 每天一个对象 |
| | | * 对象组成JSONArray添加到返回对象中 |
| | | */ |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date startDate = dateFormat.parse(vo.getOperateTimeStart()); |
| | | Date stopDate = dateFormat.parse(vo.getOperateTimeStop()); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startDate); |
| | | |
| | | JSONArray array_paymentSums = new JSONArray(); |
| | | while (calendar.getTime().before(stopDate) || calendar.getTime().equals(stopDate)) { |
| | | String tradeDate = dateFormat.format(calendar.getTime()) ; |
| | | Float receivedCash = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate ,1L)).orElse(0f); |
| | | Float receivedQRCode = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate,2L)).orElse(0f); |
| | | Float receivedTransfer = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate, 3L)).orElse(0f); |
| | | JSONObject job = new JSONObject(); |
| | | job.put("tradeDate", tradeDate); |
| | | job.put("receivedCash", receivedCash); |
| | | job.put("receivedQRCode", receivedQRCode); |
| | | job.put("receivedTransfer", receivedTransfer); |
| | | |
| | | array_paymentSums.add(job); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 1); |
| | | } |
| | | |
| | | |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | //获取笔数合计、实收金额合计、赠送金额合计 |
| | | Integer totalCount = 0; |
| | | Float totalReceived = 0f; |
| | | Float totalGift = 0f; |
| | | Map map_sum = Optional.ofNullable(seCardOperateMapper.getTransactionStatisticsSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | totalCount = Integer.parseInt(map_sum.get("totalCount").toString()); |
| | | totalReceived = Float.parseFloat(map_sum.get("totalReceived").toString()); |
| | | totalGift = Float.parseFloat(map_sum.get("totalGift").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seCardOperateMapper.getTransactionStatisticsRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoTransactionStatistics> list = seCardOperateMapper.getTransactionStatistics(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalCount", totalCount); |
| | | map_result.put("totalReceived", totalReceived); |
| | | map_result.put("totalGift", totalGift); |
| | | map_result.put("waterCost", df.format(totalWaterCost)); |
| | | map_result.put("cardCost", df.format(totalCardCost)); |
| | | map_result.put("records", map_record); |
| | | map_result.put("paymentSums", array_paymentSums); |
| | | |
| | | return map_result; |
| | | } |
| | |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoActiveCardNew>> getActiveCards(QoActiveCard queryVo) { |
| | | public QueryResultVo<List<VoActiveCard>> getActiveCards(QoActiveCard queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | String activeTimeStart = queryVo.activeTimeStart; |
| | | String activeTimeStop = queryVo.activeTimeStop; |
| | |
| | | |
| | | Long itemTotal = seCardOperateMapper.getActiveCardRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoActiveCardNew>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | QueryResultVo<List<VoActiveCard>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCardOperateMapper.getActiveCards(params); |
| | |
| | | Long itemTotal = seCardOperateMapper.getReissueCardRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoReissueCard>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCardOperateMapper.getReissueCards(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取IC卡注销记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoOperate>> getCommonOperations(QoCommonOperate queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | String timeStart = queryVo.getTimeStart(); |
| | | String timeStop = queryVo.getTimeStop(); |
| | | if(timeStart != null) { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | queryVo.setTimeStart(timeStart); |
| | | } |
| | | if(timeStop != null) { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | queryVo.setTimeStop(timeStop); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = Optional.ofNullable(seCardOperateMapper.getCommonOperationRecordCount(params)).orElse(0L); |
| | | |
| | | QueryResultVo<List<VoOperate>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCardOperateMapper.getCommonOperations(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取收据列表 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map getReceipts(QoReceipt queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | Double totalAmount = Optional.ofNullable(seCardOperateMapper.getTotalAmount(params)).orElse(0.0); |
| | | |
| | | Long itemTotal = seCardOperateMapper.getReceiptsRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoReceipt>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | //rsVo.obj = seCardOperateMapper.getReceipts(params); |
| | | //return rsVo ; |
| | | |
| | | List<VoReceipt> list = seCardOperateMapper.getReceipts(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("pageSize", rsVo.pageSize); |
| | | map_record.put("pageTotal", rsVo.pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalAmount", df.format(totalAmount)); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.cardOperate.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-05 9:29 |
| | | * @LastEditTime 2024-02-05 9:29 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "IC卡注销记录查询条件") |
| | | public class QoCancel extends QueryConditionVo { |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "水卡编号") |
| | | public String cardNum; |
| | | |
| | | |
| | | @Schema(description = "注销时间_开始") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "注销时间_结束") |
| | | public String timeStop; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.cardOperate.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-05 11:00 |
| | | * @LastEditTime 2024-02-05 11:00 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "IC卡挂失记录查询条件") |
| | | public class QoCommonOperate extends QueryConditionVo { |
| | | /** |
| | | * 注销-3,挂失-6,冲正-7,解锁-8 |
| | | */ |
| | | @Schema(description = "操作类型") |
| | | public Integer operateType; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "水卡编号") |
| | | public Long cardNum; |
| | | |
| | | @Schema(description = "挂失时间_开始") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "挂失时间_结束") |
| | | public String timeStop; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.cardOperate.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 11:03 |
| | | * @LastEditTime 2024-02-01 11:03 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "收据查询条件") |
| | | public class QoReceipt extends QueryConditionVo { |
| | | @Schema(description = "交易ID") |
| | | public Long operateId; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "充值机时间_开始") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "充值机时间_结束") |
| | | public String timeStop; |
| | | } |
| | |
| | | @Schema(description = "村ID") |
| | | public Long villageId; |
| | | |
| | | @Schema(description = "水卡编号") |
| | | public Long cardNum; |
| | | //@Schema(description = "水卡编号") |
| | | //public Long cardNum; |
| | | |
| | | @Schema(description = "交易查询起始时间") |
| | | public String operateTimeStart; |
| | |
| | | |
| | | @Schema(description = "收银员ID") |
| | | public Long cashierId; |
| | | |
| | | |
| | | } |
| | |
| | | Long itemTotal = seClientMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seClientMapper.getClients(params); |
| | |
| | | Long itemTotal = seClientCardMapper.getCardsCount(params); |
| | | |
| | | QueryResultVo<List<VoCards>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seClientCardMapper.getCards(params); |
| | |
| | | import com.dy.pipIrrGlobal.voSe.VoGeneral; |
| | | 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; |
| | |
| | | try { |
| | | add_general(); |
| | | QueryResultVo<List<VoGeneral>> res = generalSv.getGenerals(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | if(res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_GENERALS.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | |
| | | return BaseResponseUtils.buildSuccess() ; |
| | | } |
| | | |
| | | @Operation(summary = "获得待审核交易汇总记录", description = "返回待审核交易汇总记录") |
| | | |
| | | /** |
| | | * 开卡系统交易汇总查询与对账系统交易汇总查询共用接口 |
| | | * 开卡系统参数:收银员ID、查询起止日期 |
| | | * 对账系统参数:收银员ID、交易日期 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @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(QoSummary vo){ |
| | | try { |
| | | Map res = generalSv.getToAudit(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | Map res = generalSv.getSummaries(vo); |
| | | if(res.size() > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_TRADE_SUMMARIES.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询交易汇总记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取财务对账_交易明细 |
| | | * @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 = "get_trade_details") |
| | | @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()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.general; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoSe.SeAuditsMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeGeneralMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.*; |
| | | 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.pipIrrGlobal.voSe.VoTransactionStatistics; |
| | | import com.dy.pipIrrSell.general.qo.QoGeneral; |
| | | import com.dy.pipIrrSell.general.qo.QoSummary; |
| | | import com.dy.pipIrrSell.general.qo.QoToAudit; |
| | | 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 java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private SeCardOperateMapper seCardOperateMapper; |
| | | |
| | | @Autowired |
| | | private SeWalletRechargeMapper seWalletRechargeMapper; |
| | | |
| | | @Autowired |
| | | private SeRefundMapper seRefundMapper; |
| | | |
| | | /** |
| | | * 获取未生成总账的交易日期列表(当天的交易记录不生成总账) |
| | |
| | | Long itemTotal = seGeneralMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoGeneral>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seGeneralMapper.getGenerals(params); |
| | |
| | | } |
| | | |
| | | /** |
| | | * t添加总账审核记录 |
| | | * 添加总账审核记录 |
| | | * @param po |
| | | * @return |
| | | */ |
| | |
| | | return seAuditsMapper.insert(po); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 财务对账审核页,收银员+日期分组,排除交易类型分组 |
| | | * 开卡系统交易汇总查询与对账系统交易汇总查询共用服务实现类 |
| | | * @param vo |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | public Map getToAudit(QoToAudit vo) { |
| | | /** |
| | | * 取出指定日期三种支付方式(现金、扫码、转账)实收金额 |
| | | */ |
| | | public Map getSummaries(QoSummary vo) throws ParseException { |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | // 接收传入参数:交易起止日期、收银员ID |
| | | JSONArray array_paymentSums = new JSONArray(); |
| | | String tradeDate = vo.getTradeDate(); |
| | | Date timeStart = dateFormat.parse(vo.getTimeStart()); |
| | | Date timeStop = dateFormat.parse(vo.getTimeStop()); |
| | | Long cashierId = vo.cashierId; |
| | | |
| | | Float receivedCash = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId, 1L)).orElse(0f); |
| | | Float receivedQRCode = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId,2L)).orElse(0f); |
| | | Float receivedTransfer = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId, 3L)).orElse(0f); |
| | | JSONObject job = new JSONObject(); |
| | | job.put("tradeDate", tradeDate); |
| | | job.put("receivedCash", receivedCash); |
| | | job.put("receivedQRCode", receivedQRCode); |
| | | job.put("receivedTransfer", receivedTransfer); |
| | | array_paymentSums.add(job); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(timeStart); |
| | | while (calendar.getTime().before(timeStop) || calendar.getTime().equals(timeStop)) { |
| | | String tradeDate = dateFormat.format(calendar.getTime()) ; |
| | | if(cashierId != 1000000L) { |
| | | Float receivedCash = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId, 1L)).orElse(0f); |
| | | Float receivedQRCode = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId,2L)).orElse(0f); |
| | | Float receivedTransfer = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId, 3L)).orElse(0f); |
| | | |
| | | JSONObject job = new JSONObject(); |
| | | job.put("tradeDate", tradeDate); |
| | | job.put("receivedCash", receivedCash); |
| | | job.put("receivedQRCode", receivedQRCode); |
| | | job.put("receivedTransfer", receivedTransfer); |
| | | array_paymentSums.add(job); |
| | | |
| | | }else { |
| | | // 分级计算指定日期微信收退款合计,再计算实收金额 |
| | | Double rechargeWeChat = Optional.ofNullable(seWalletRechargeMapper.getRechargeSum(tradeDate)).orElse(0.0); |
| | | Double refundWeChat = Optional.ofNullable(seRefundMapper.getRefundSum(tradeDate)).orElse(0.0); |
| | | Double receiveWeChat = rechargeWeChat - refundWeChat; |
| | | |
| | | // 微信实收金额写入返回对象(写入前格式化) |
| | | JSONObject job = new JSONObject(); |
| | | job.put("receiveWeChat", df.format(receiveWeChat)); |
| | | array_paymentSums.add(job); |
| | | } |
| | | calendar.add(Calendar.DAY_OF_MONTH, 1); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | //获取笔数合计、实收金额合计、赠送金额合计 |
| | | // 获取符合条件的记录数(代码全部注释掉了,没删) |
| | | //Long itemTotal = seGeneralMapper.getToAuditRecordCount(params); |
| | | |
| | | /** |
| | | * 根据收银员编号、交易日期查询汇总记录 |
| | | * 遍历汇总记录查询结果,计算笔数合计、实收金额合计、赠送金额合计、返还金额合计 |
| | | */ |
| | | List<VoTransactionStatistics> list = Optional.ofNullable(seGeneralMapper.getSummaries(params)).orElse(new ArrayList<>()); |
| | | if(list.size() == 0) { |
| | | return new HashMap(); |
| | | } |
| | | |
| | | Integer totalCount = 0; |
| | | Float totalReceived = 0f; |
| | | Float totalGift = 0f; |
| | | Map map_sum = Optional.ofNullable(seGeneralMapper.getTransactionStatisticsSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | totalCount = Integer.parseInt(map_sum.get("totalCount").toString()); |
| | | totalReceived = Float.parseFloat(map_sum.get("totalReceived").toString()); |
| | | totalGift = Float.parseFloat(map_sum.get("totalGift").toString()); |
| | | Float totalRefund = 0f; |
| | | JSONArray array= JSONArray.parseArray(JSON.toJSONString(list)); |
| | | for(int i = 0; i < array.size(); i++) { |
| | | JSONObject job_summary = array.getJSONObject(i); |
| | | totalCount = totalCount + Optional.ofNullable(job_summary.getInteger("count")).orElse(0); |
| | | totalReceived = totalReceived + Optional.ofNullable(job_summary.getFloat("received")).orElse(0f); |
| | | totalGift = totalGift + Optional.ofNullable(job_summary.getFloat("gift")).orElse(0f); |
| | | totalRefund = totalRefund + Optional.ofNullable(job_summary.getFloat("refundAmount")).orElse(0f); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seGeneralMapper.getToAuditRecordCount(params); |
| | | |
| | | List<VoTransactionStatistics> list = seGeneralMapper.getToAudit(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | //map_record.put("itemTotal", itemTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalCount", totalCount); |
| | | map_result.put("totalReceived", totalReceived); |
| | | map_result.put("totalGift", totalGift); |
| | | map_result.put("totalRefund", totalRefund); |
| | | |
| | | map_result.put("records", map_record); |
| | | map_result.put("paymentSums", array_paymentSums); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 根据收银员ID及日期获取财务对账_交易明细记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map getTradeDetails(QoToAudit queryVo) { |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seGeneralMapper.getTradeDetailsRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoTradeDetails>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | List<VoTradeDetails> list = Optional.ofNullable(seGeneralMapper.getTradeDetails(params)).orElse(new ArrayList<>()); |
| | | if(list.size() == 0) { |
| | | return new HashMap(); |
| | | } |
| | | |
| | | // 遍历交易明细记录,汇总交易金额 |
| | | Double totalTradeAmount = 0.0; |
| | | JSONArray array= JSONArray.parseArray(JSON.toJSONString(list)); |
| | | for(int i = 0; i < array.size(); i++) { |
| | | JSONObject job = array.getJSONObject(i); |
| | | Double tradeAmount = Optional.ofNullable(job.getDouble("tradeAmount")).orElse(0.0); |
| | | totalTradeAmount = totalTradeAmount + tradeAmount; |
| | | } |
| | | |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("pageSize", rsVo.pageSize); |
| | | map_record.put("pageTotal", rsVo.pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | |
| | | map_result.put("totalTradeAmount", df.format(totalTradeAmount)); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.general.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-04 17:15 |
| | | * @LastEditTime 2024-02-04 17:15 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "交易汇总查询条件") |
| | | public class QoSummary extends QueryConditionVo { |
| | | @Schema(description = "查询起始日期") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "查询截止日期") |
| | | public String timeStop; |
| | | |
| | | @Schema(description = "收银员ID") |
| | | public Long cashierId; |
| | | } |
| | |
| | | @Builder |
| | | @Schema(name = "待审核交易汇总查询条件") |
| | | public class QoToAudit extends QueryConditionVo { |
| | | @Schema(description = "交易时间") |
| | | @Schema(description = "交易日期") |
| | | public String tradeDate; |
| | | |
| | | @Schema(description = "收银员ID") |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private SeLossMapper seLossMapper; |
| | | |
| | | public QueryResultVo<List<VoLoss>> getLosses(QueryVo queryVo) { |
| | | //完善查询挂失记录的起止时间 |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | //LocalDateTime lossTimeStart = queryVo.lossTimeStart; |
| | | //LocalDateTime lossTimeStop = queryVo.lossTimeStop; |
| | | //if(lossTimeStart != null) { |
| | | // lossTimeStart = LocalDateTime.parse(df.format(lossTimeStart) + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // queryVo.setLossTimeStart(lossTimeStart); |
| | | //} |
| | | // |
| | | //if(lossTimeStop != null) { |
| | | // lossTimeStop = LocalDateTime.parse(df.format(lossTimeStop) + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // queryVo.setLossTimeStop(lossTimeStop); |
| | | //} |
| | | |
| | | String lossTimeStart = queryVo.lossTimeStart; |
| | | String lossTimeStop = queryVo.lossTimeStop; |
| | | if(lossTimeStart != null) { |
| | |
| | | Long itemTotal = seLossMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoLoss>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seLossMapper.getLosses(params); |
| | |
| | | Long itemTotal = seRechargeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoRecharge>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seRechargeMapper.getRecharges(params); |
| | |
| | | REPLACE_FAIL_WRITE_CLIENT_CARD_ERROR(10007, "补卡失败-农户卡修改异常"), |
| | | REPLACE_FAIL_WRITE_RECHARGE_ERROR(10008, "补卡失败-补卡记录写入异常"), |
| | | No_ActiveCards(10009, "没有符合条件的开卡数据"), |
| | | No_ReissueCards(10010, "没有符合条件的补卡数据"), |
| | | No_RECHARGES(10010, "没有符合条件的充值数据"), |
| | | No_ReissueCards(10011, "没有符合条件的补卡数据"), |
| | | No_CANCELS(10010, "没有符合条件的注销数据"), |
| | | PARAMS_ERROR(10010, "操作类型参数错误"), |
| | | |
| | | THE_CARD_NOT_EXIST(10011, "没有符合条件的水卡"), |
| | | THE_CARD_NOT_SUPPORT_THIS_OPERATION(10012, "水卡状态不支持当前操作"), |
| | | THE_CARD_NOT_EXIST(10012, "没有符合条件的水卡"), |
| | | THE_CARD_NOT_SUPPORT_THIS_OPERATION(10013, "水卡状态不支持当前操作"), |
| | | |
| | | /** |
| | | * 充值 |
| | |
| | | GENERAL_ID_CANNOT_BE_NULL(80001, "总账编号不能为空"), |
| | | GENERAL_NOT_EXIST(80001, "总账不存在"), |
| | | GENERAL_AUDIT_FAIL(80001, "总账审核失败"), |
| | | AUDITS_ADD_FAIL(80001, "总账审核记录添加失败"); |
| | | AUDITS_ADD_FAIL(80001, "总账审核记录添加失败"), |
| | | |
| | | /** |
| | | * 电子钱包 |
| | | */ |
| | | CLIENT_ID_CANNOT_BE_NULL(90001, "农户编号不能为空"), |
| | | WALLET_OPEN_ACCOUNT_FAIL(90002, "电子钱包账户注册失败"), |
| | | WALLET_ACCOUNT_EXIST(90003, "该农户已注册电子钱包"), |
| | | NO_ACCOUNT(90004, "您尚未注册电子钱包账户"), |
| | | UPDATE_ACCOUNT_FAIL(90005, "充值失败,电子钱包账户更新失败"), |
| | | RECHARGE_FAIL(90006, "充值失败"), |
| | | BALANCE_IS_INSUFFICIENT(90007, "消费失败,余额不足"), |
| | | CONSUME_FAIL(90008, "消费失败"), |
| | | REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY(90009, "申请退款失败,退款金额不能大于余额"), |
| | | APPLICATION_REFUND_FAIL(900010, "申请退款失败"), |
| | | NO_TO_AUDIT_REFUND(900011, "该电子钱包没有待审核的退款申请"), |
| | | AUDIT_REFUND_FAIL(900012, "审核退款申请失败"), |
| | | No_WALLER_RECHARGES(900013, "没有符合条件的充值数据"), |
| | | WALLET_CLIENT_ID_CANNOT_BE_NULL(900014, "查询电子钱包消费汇总失败,农户ID不能为空"), |
| | | No_REFUNDS(900015, "没有符合条件的退款数据"), |
| | | |
| | | /** |
| | | * 收据 |
| | | */ |
| | | No_RECEIPTS(100001, "没有符合条件的收据"), |
| | | |
| | | /** |
| | | * 财务对账 |
| | | */ |
| | | No_GENERALS(100001, "没有符合条件的总账记录"), |
| | | No_TRADE_SUMMARIES(100001, "没有符合条件的交易汇总记录"), |
| | | No_TRADE_DETAILS(100001, "没有符合条件的交易明细"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | |
| | | Long itemTotal = seReversalMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoReversal>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seReversalMapper.getReversals(params); |
| | |
| | | Long itemTotal = seUnlockMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoUnlock>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seUnlockMapper.getUnlocks(params); |
| | |
| | | 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.pojoSe.SeConsume; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRefund; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWallet; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoWallet; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRefund; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import com.dy.pipIrrSell.wallet.enums.LastOperateENUM; |
| | | import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM; |
| | | import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; |
| | | import com.dy.pipIrrSell.wallet.qo.QueryVo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | 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.validation.Valid; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Optional; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | public class WalletCtrl { |
| | | private final WalletSv walletSv; |
| | | |
| | | /** |
| | | * 注册电子钱包账户 |
| | | * 需要考虑已注册账户的情况 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | @Operation(summary = "注册电子钱包", description = "注册电子钱包") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping(path = "add_wallet") |
| | | @SsoAop() |
| | | //public BaseResponse<Boolean> add(@RequestBody Long clientId){ |
| | | public BaseResponse<Boolean> add(@RequestParam("clientId") @NotNull(message = "农户编号不能为空") Long clientId){ |
| | | public BaseResponse<Boolean> addWallet(@RequestParam("clientId") @NotNull(message = "农户编号不能为空") Long clientId){ |
| | | if(clientId == null || clientId < 0) { |
| | | return BaseResponseUtils.buildFail("农户编号不能为空"); |
| | | return BaseResponseUtils.buildFail(SellResultCode.CLIENT_ID_CANNOT_BE_NULL.getMessage()); |
| | | } |
| | | |
| | | if(walletSv.getWalletByClientId(clientId) != null) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage()); |
| | | } |
| | | |
| | | SeWallet seWallet = new SeWallet(); |
| | | seWallet.setClientid(clientId); |
| | | seWallet.setMoney(0f); |
| | | seWallet.setCreatedt(new Date()); |
| | | Integer rec = Optional.ofNullable(walletSv.add(seWallet)).orElse(0); |
| | | seWallet.setClientId(clientId); |
| | | seWallet.setMoney(0d); |
| | | seWallet.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode()); |
| | | seWallet.setLastOperateTime(new Date()); |
| | | seWallet.setCreateTime(new Date()); |
| | | Long rec = Optional.ofNullable(walletSv.addWallet(seWallet)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("注册电子钱包-电子钱包记录写入异常"); |
| | | return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage()); |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | //@Operation(summary = "电子钱包充值", description = "电子钱包充值") |
| | | //@ApiResponses(value = { |
| | | // @ApiResponse( |
| | | // responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | // description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | // content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | // schema = @Schema(implementation = Boolean.class))} |
| | | // ) |
| | | //}) |
| | | //@PostMapping(path = "addRecharge") |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | //@SsoAop() |
| | | //public BaseResponse<Boolean> addRecharge(@RequestBody @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // if(bindingResult != null && bindingResult.hasErrors()){ |
| | | // return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // SeWallet seWallet = new SeWallet(); |
| | | // seWallet.setClientid(clientId); |
| | | // seWallet.setMoney(0f); |
| | | // seWallet.setCreatedt(new Date()); |
| | | // Integer rec = Optional.ofNullable(walletSv.add(seWallet)).orElse(0); |
| | | // if(rec == 0) { |
| | | // return BaseResponseUtils.buildFail("注册电子钱包-电子钱包记录写入异常"); |
| | | // } |
| | | // |
| | | // return BaseResponseUtils.buildSuccess(true) ; |
| | | //} |
| | | /** |
| | | * 电子钱包账户充值 |
| | | * 需要考虑未注册账户的情况 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "电子钱包充值", description = "电子钱包充值") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add_recharge", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> addRecharge(@RequestBody @Valid SeWalletRecharge po, BindingResult bindingResult){ |
| | | Long clientId = Optional.ofNullable(po .getClientId()).orElse(0L); |
| | | Double amount = Optional.ofNullable(po.getAmount()).orElse(0.0); |
| | | |
| | | // 验证该农户是否已经注册电子钱包账户并取出ID及当前账户余额 |
| | | SeWallet seWallet = walletSv.getWalletByClientId(clientId); |
| | | if(seWallet == null) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage()); |
| | | } |
| | | Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L); |
| | | Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0); |
| | | |
| | | // 计算充值后余额 |
| | | Double afterRrecharge = money + amount; |
| | | |
| | | // 修改电子钱包余额、最后操作类型、最后操作时间 |
| | | seWallet.setMoney(afterRrecharge); |
| | | seWallet.setLastOperate(LastOperateENUM.RECHARGE.getCode()); |
| | | seWallet.setLastOperateTime(new Date()); |
| | | Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0); |
| | | if(rec_updateWaller == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage()); |
| | | } |
| | | |
| | | // 添加充值记录 |
| | | po.setWalletId(wallerId); |
| | | po.setClientId(clientId); |
| | | po.setMoney(money); |
| | | po.setAmount(amount); |
| | | po.setAfterRecharge(afterRrecharge); |
| | | po.setRechargeTime(new Date()); |
| | | Long rec = Optional.ofNullable(walletSv.addRecharge(po)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 电子钱包消费 |
| | | * 需要考虑未注册账户的情况、余额不足的情况 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "电子钱包消费", description = "电子钱包消费") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add_consume", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> addConsume(@RequestBody @Valid SeConsume po, BindingResult bindingResult){ |
| | | Long clientId = po .getClientId(); |
| | | Double consumption = po.getConsumption(); |
| | | Date vot = po.getVot(); |
| | | Date vct = po.getVct(); |
| | | |
| | | // 计算开关阀时间差及用水时长 |
| | | Long timeDifference = vct.getTime() - vot.getTime(); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | Double duration = Double.parseDouble(df.format((float)timeDifference / (1000 * 60 * 60))); |
| | | |
| | | // 验证该农户是否已经注册电子钱包账户并取出ID及当前账户余额 |
| | | SeWallet seWallet = walletSv.getWalletByClientId(clientId); |
| | | if(seWallet == null) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage()); |
| | | } |
| | | Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L); |
| | | Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0); |
| | | |
| | | if(money < consumption) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.BALANCE_IS_INSUFFICIENT.getMessage()); |
| | | } |
| | | // 计算消费后余额 |
| | | Double afterConsume = money - consumption; |
| | | |
| | | // 修改电子钱包余额、最后操作类型、最后操作时间 |
| | | seWallet.setMoney(afterConsume); |
| | | seWallet.setLastOperate(LastOperateENUM.CONSUME.getCode()); |
| | | seWallet.setLastOperateTime(new Date()); |
| | | Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0); |
| | | if(rec_updateWaller == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage()); |
| | | } |
| | | |
| | | // 添加消费记录 |
| | | po.setWalletId(wallerId); |
| | | po.setMoney(money); |
| | | po.setAfterConsume(afterConsume); |
| | | po.setDuration(duration); |
| | | Long rec = Optional.ofNullable(walletSv.addConsume(po)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.CONSUME_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 申请退款 |
| | | * 需要考虑申请退款金额大于余额的情况 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "电子钱包申请退费", description = "电子钱包申请退费") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add_refund", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> addRefund(@RequestBody @Valid SeRefund po, BindingResult bindingResult){ |
| | | Long clientId = po .getClientId(); |
| | | Double refundAmount = po.getRefundAmount(); |
| | | |
| | | // 验证该农户是否已经注册电子钱包账户并取出ID及当前账户余额 |
| | | SeWallet seWallet = walletSv.getWalletByClientId(clientId); |
| | | if(seWallet == null) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage()); |
| | | } |
| | | Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L); |
| | | Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0); |
| | | |
| | | // 验证退款金额是否大于余额 |
| | | if(money < refundAmount) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY.getMessage()); |
| | | } |
| | | // 计算消费后余额 |
| | | Double afterRefund = money - refundAmount; |
| | | |
| | | // 修改电子钱包余额、最后操作类型、最后操作时间 |
| | | seWallet.setMoney(afterRefund); |
| | | seWallet.setLastOperate(LastOperateENUM.APPLY_REFUND.getCode()); |
| | | seWallet.setLastOperateTime(new Date()); |
| | | Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0); |
| | | if(rec_updateWaller == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage()); |
| | | } |
| | | |
| | | // 添加消费记录 |
| | | po.setWalletId(wallerId); |
| | | po.setMoney(money); |
| | | po.setAfterRefund(afterRefund); |
| | | po.setApplicationTime(new Date()); |
| | | po.setRefundStatus(RefundStatusENUM.NO_REFUND.getCode()); |
| | | Long rec = Optional.ofNullable(walletSv.addRefund(po)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.APPLICATION_REFUND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 审核退款申请 |
| | | * 需要考虑该电子钱包没有待审核的退款申请的情况 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "电子钱包审核退款申请", description = "电子钱包审核退款申请") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "audit_refund", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> auditRefund(@RequestBody @Valid SeRefund po, BindingResult bindingResult){ |
| | | Long clientId = po.getClientId(); |
| | | Byte refundStatus = po.getRefundStatus(); |
| | | Long auditor = po.getAuditor(); |
| | | String remarks = po.getRemarks(); |
| | | |
| | | // 验证该农户是否已经注册电子钱包账户并取出ID及当前账户余额 |
| | | SeWallet seWallet = walletSv.getWalletByClientId(clientId); |
| | | if(seWallet == null) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage()); |
| | | } |
| | | Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L); |
| | | Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0); |
| | | |
| | | // 验证该电子钱包是否有待审核的退款申请(根据钱包ID获取待审核的退款申请对象) |
| | | SeRefund seRefund = walletSv.getRefundByWallerId(wallerId); |
| | | if(seRefund == null) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.NO_TO_AUDIT_REFUND.getMessage()); |
| | | } |
| | | |
| | | // 修改电子钱包最后操作类型、最后操作时间 |
| | | seWallet.setLastOperate(LastOperateENUM.AUDIT_REFUND.getCode()); |
| | | seWallet.setLastOperateTime(new Date()); |
| | | Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0); |
| | | if(rec_updateWaller == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage()); |
| | | } |
| | | |
| | | // 添加消费记录 |
| | | seRefund.setRefundStatus(refundStatus); |
| | | seRefund.setAuditor(auditor); |
| | | seRefund.setAuditTime(new Date()); |
| | | seRefund.setRemarks(remarks); |
| | | Integer rec = Optional.ofNullable(walletSv.auditRefund(seRefund)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.AUDIT_REFUND_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据农户姓名获取电子钱包账户记录 |
| | | * @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_wallets") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWallet>>> getWallets(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoWallet>> res = walletSv.getWallets(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_ReissueCards.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包账户记录", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取电子钱包充值记录 |
| | | * @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_recharges") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWalletRecharge>>> getWalletRecharges(QoWalletRecharge vo){ |
| | | try { |
| | | QueryResultVo<List<VoWalletRecharge>> res = walletSv.getWalletRecharges(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包充值记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_consume") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getWalletConsumes(QueryVo vo){ |
| | | Long clientId = Optional.ofNullable(vo.getClientId()).orElse(0L); |
| | | if(clientId == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.WALLET_CLIENT_ID_CANNOT_BE_NULL.getMessage()); |
| | | } |
| | | try { |
| | | Map res = Optional.ofNullable(walletSv.getWalletConsumes(vo)).orElse(new HashMap()); |
| | | if(res.size() <= 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包充值记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取电子钱包退款记录 |
| | | * @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_refunds") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWalletRefund>>> getWalletRefunds(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoWalletRefund>> res = walletSv.getWalletRefunds(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_REFUNDS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包退款记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.wallet; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoSe.SeConsumeMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeRefundMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeWalletMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeConsume; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRefund; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWallet; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWallet; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletConsume; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRefund; |
| | | import com.dy.pipIrrSell.wallet.qo.QueryVo; |
| | | import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; |
| | | 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 java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | private SeWalletRechargeMapper seWalletRechargeMapper; |
| | | |
| | | @Autowired |
| | | private SeWalletRechargeHistoryMapper seWalletRechargeHistoryMapper; |
| | | private SeConsumeMapper seConsumeMapper; |
| | | |
| | | @Autowired |
| | | private SeRefundMapper seRefundMapper; |
| | | |
| | | /** |
| | | * 根据农户ID获取电子钱包对象 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | public SeWallet getWalletByClientId(Long clientId) { |
| | | return seWalletMapper.getWalletByClientId(clientId); |
| | | } |
| | | |
| | | /** |
| | | * 注册电子钱包账号 |
| | | * @param po 电子钱包实体类 |
| | | * @return 电子钱包ID |
| | | */ |
| | | public Long addWallet(SeWallet po) { |
| | | seWalletMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 电子钱包充值 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer add(SeWallet po) { |
| | | return seWalletMapper.insert(po); |
| | | public Long addRecharge(SeWalletRecharge po) { |
| | | seWalletRechargeMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 根据编号从钱包表中获取该钱包余额 |
| | | * @param id |
| | | * 电子钱包消费 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Float getMoneyById(Long id) { |
| | | SeWallet po = seWalletMapper.selectByPrimaryKey(id); |
| | | return po.getMoney(); |
| | | public Long addConsume(SeConsume po) { |
| | | seConsumeMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 根据钱包编号修改钱包余额 |
| | | * @param id 钱包编号(主键) |
| | | * @param money 钱包余额 |
| | | * @return 修改记录数量 |
| | | */ |
| | | public Integer updateMoneyById(Long id, Float money) { |
| | | SeWallet po = seWalletMapper.selectByPrimaryKey(id); |
| | | po.setMoney(money); |
| | | return seWalletMapper.updateByPrimaryKey(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据id删除充值记录 |
| | | * @param id |
| | | * 添加退款申请 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer deleteWallerRechargeById(Long id) { |
| | | return seWalletMapper.deleteByPrimaryKey(id); |
| | | public Long addRefund(SeRefund po) { |
| | | seRefundMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 将充值记录添加到充值历史表 |
| | | * @param po 充值历史实体 |
| | | * 根据钱包ID获取待审核的退款申请对象 |
| | | * @param walletId |
| | | * @return |
| | | */ |
| | | public Integer addWallerRechargeHistory(SeWalletRechargeHistory po) { |
| | | return seWalletRechargeHistoryMapper.insert(po); |
| | | public SeRefund getRefundByWallerId(Long walletId) { |
| | | return seRefundMapper.getRefundByWallerId(walletId); |
| | | } |
| | | |
| | | /** |
| | | * 审核退款申请 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer auditRefund(SeRefund po) { |
| | | return seRefundMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | /** |
| | | * 修改电子钱包 |
| | | * 充值、消费、申请退款、审核退款时需要修改电子钱包的:余额、最后操作、最后操作时间 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer updateWallet(SeWallet po) { |
| | | return seWalletMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据农户姓名获取电子钱包账户记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoWallet>> getWallets(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seWalletMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWallet>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seWalletMapper.getWallets(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包充值记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoWalletRecharge>> getWalletRecharges(QoWalletRecharge queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | String timeStart = queryVo.getTimeStart(); |
| | | String timeStop = queryVo.getTimeStop(); |
| | | if(timeStart != null) { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | queryVo.setTimeStart(timeStart); |
| | | } |
| | | if(timeStop != null) { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | queryVo.setTimeStop(timeStop); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seWalletRechargeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWalletRecharge>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seWalletRechargeMapper.getWalletRecharges(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据农户ID获取电子钱包消费记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map getWalletConsumes(QueryVo queryVo) { |
| | | // 获取电子钱包消费汇总信息 |
| | | String clientName = ""; |
| | | String clientNum = ""; |
| | | Double money = 0.0; |
| | | Double totalConsume = 0.0; |
| | | Long clientId = Optional.ofNullable(queryVo.getClientId()).orElse(0L); |
| | | Map map_consumeSum = Optional.ofNullable(seConsumeMapper.getWalletConsumeSum(clientId)).orElse(new HashMap()); |
| | | if(map_consumeSum.size() > 0) { |
| | | clientName = map_consumeSum.get("clientName").toString(); |
| | | clientNum = map_consumeSum.get("clientNum").toString(); |
| | | money = Double.parseDouble(map_consumeSum.get("money").toString()); |
| | | totalConsume = Double.parseDouble(map_consumeSum.get("totalConsume").toString()); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | Long itemTotal = seConsumeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWalletConsume>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | List<VoWalletConsume> list = seConsumeMapper.getWalletConsumes(params); |
| | | |
| | | |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("pageSize", rsVo.pageSize); |
| | | map_record.put("pageTotal", rsVo.pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("clientName", clientName); |
| | | map_result.put("clientNum", clientNum); |
| | | map_result.put("money", money); |
| | | map_result.put("totalConsume", totalConsume); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包退款记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoWalletRefund>> getWalletRefunds(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seRefundMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWalletRefund>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seRefundMapper.getWalletRefunds(params); |
| | | return rsVo ; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.wallet.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-30 17:12 |
| | | * @LastEditTime 2024-01-30 17:12 |
| | | * @Description 电子钱包最后操作枚举类 |
| | | */ |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum LastOperateENUM { |
| | | OPEN_ACCOUNT((byte)1, "开户"), |
| | | RECHARGE((byte)2, "充值"), |
| | | CONSUME((byte)3, "消费"), |
| | | APPLY_REFUND((byte)4, "申请退款"), |
| | | AUDIT_REFUND((byte)5, "退款审核"); |
| | | |
| | | private final Byte code; |
| | | private final String message; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.wallet.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 14:19 |
| | | * @LastEditTime 2024-01-31 14:19 |
| | | * @Description |
| | | */ |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum RefundStatusENUM { |
| | | NO_REFUND((byte)1, "未退款"), |
| | | REFUNDED((byte)2, "已退款"); |
| | | |
| | | private final Byte code; |
| | | private final String message; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.wallet.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 19:27 |
| | | * @LastEditTime 2024-01-31 19:27 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "电子钱包充值查询条件") |
| | | public class QoWalletRecharge extends QueryConditionVo { |
| | | @Schema(description = "电子钱包账户ID") |
| | | public Long walletId; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "充值机时间_开始") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "充值机时间_结束") |
| | | public String timeStop; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrSell.wallet.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 19:21 |
| | | * @LastEditTime 2024-01-31 19:21 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "电子钱包账户查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "农户ID") |
| | | public Long clientId; |
| | | |
| | | @Schema(description = "退款状态") |
| | | public Integer refundStatus; |
| | | } |
| New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
| New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
| New file |
| | |
| | | #!/bin/sh |
| | | # ---------------------------------------------------------------------------- |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # https://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | # ---------------------------------------------------------------------------- |
| | | # Apache Maven Wrapper startup batch script, version 3.2.0 |
| | | # |
| | | # Required ENV vars: |
| | | # ------------------ |
| | | # JAVA_HOME - location of a JDK home dir |
| | | # |
| | | # Optional ENV vars |
| | | # ----------------- |
| | | # MAVEN_OPTS - parameters passed to the Java VM when running Maven |
| | | # e.g. to debug Maven itself, use |
| | | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
| | | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | if [ -z "$MAVEN_SKIP_RC" ] ; then |
| | | |
| | | if [ -f /usr/local/etc/mavenrc ] ; then |
| | | . /usr/local/etc/mavenrc |
| | | fi |
| | | |
| | | if [ -f /etc/mavenrc ] ; then |
| | | . /etc/mavenrc |
| | | fi |
| | | |
| | | if [ -f "$HOME/.mavenrc" ] ; then |
| | | . "$HOME/.mavenrc" |
| | | fi |
| | | |
| | | fi |
| | | |
| | | # OS specific support. $var _must_ be set to either true or false. |
| | | cygwin=false; |
| | | darwin=false; |
| | | mingw=false |
| | | case "$(uname)" in |
| | | CYGWIN*) cygwin=true ;; |
| | | MINGW*) mingw=true;; |
| | | Darwin*) darwin=true |
| | | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home |
| | | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html |
| | | if [ -z "$JAVA_HOME" ]; then |
| | | if [ -x "/usr/libexec/java_home" ]; then |
| | | JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME |
| | | else |
| | | JAVA_HOME="/Library/Java/Home"; export JAVA_HOME |
| | | fi |
| | | fi |
| | | ;; |
| | | esac |
| | | |
| | | if [ -z "$JAVA_HOME" ] ; then |
| | | if [ -r /etc/gentoo-release ] ; then |
| | | JAVA_HOME=$(java-config --jre-home) |
| | | fi |
| | | fi |
| | | |
| | | # For Cygwin, ensure paths are in UNIX format before anything is touched |
| | | if $cygwin ; then |
| | | [ -n "$JAVA_HOME" ] && |
| | | JAVA_HOME=$(cygpath --unix "$JAVA_HOME") |
| | | [ -n "$CLASSPATH" ] && |
| | | CLASSPATH=$(cygpath --path --unix "$CLASSPATH") |
| | | fi |
| | | |
| | | # For Mingw, ensure paths are in UNIX format before anything is touched |
| | | if $mingw ; then |
| | | [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && |
| | | JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" |
| | | fi |
| | | |
| | | if [ -z "$JAVA_HOME" ]; then |
| | | javaExecutable="$(which javac)" |
| | | if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then |
| | | # readlink(1) is not available as standard on Solaris 10. |
| | | readLink=$(which readlink) |
| | | if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then |
| | | if $darwin ; then |
| | | javaHome="$(dirname "\"$javaExecutable\"")" |
| | | javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" |
| | | else |
| | | javaExecutable="$(readlink -f "\"$javaExecutable\"")" |
| | | fi |
| | | javaHome="$(dirname "\"$javaExecutable\"")" |
| | | javaHome=$(expr "$javaHome" : '\(.*\)/bin') |
| | | JAVA_HOME="$javaHome" |
| | | export JAVA_HOME |
| | | fi |
| | | fi |
| | | fi |
| | | |
| | | if [ -z "$JAVACMD" ] ; then |
| | | if [ -n "$JAVA_HOME" ] ; then |
| | | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
| | | # IBM's JDK on AIX uses strange locations for the executables |
| | | JAVACMD="$JAVA_HOME/jre/sh/java" |
| | | else |
| | | JAVACMD="$JAVA_HOME/bin/java" |
| | | fi |
| | | else |
| | | JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" |
| | | fi |
| | | fi |
| | | |
| | | if [ ! -x "$JAVACMD" ] ; then |
| | | echo "Error: JAVA_HOME is not defined correctly." >&2 |
| | | echo " We cannot execute $JAVACMD" >&2 |
| | | exit 1 |
| | | fi |
| | | |
| | | if [ -z "$JAVA_HOME" ] ; then |
| | | echo "Warning: JAVA_HOME environment variable is not set." |
| | | fi |
| | | |
| | | # traverses directory structure from process work directory to filesystem root |
| | | # first directory with .mvn subdirectory is considered project base directory |
| | | find_maven_basedir() { |
| | | if [ -z "$1" ] |
| | | then |
| | | echo "Path not specified to find_maven_basedir" |
| | | return 1 |
| | | fi |
| | | |
| | | basedir="$1" |
| | | wdir="$1" |
| | | while [ "$wdir" != '/' ] ; do |
| | | if [ -d "$wdir"/.mvn ] ; then |
| | | basedir=$wdir |
| | | break |
| | | fi |
| | | # workaround for JBEAP-8937 (on Solaris 10/Sparc) |
| | | if [ -d "${wdir}" ]; then |
| | | wdir=$(cd "$wdir/.." || exit 1; pwd) |
| | | fi |
| | | # end of workaround |
| | | done |
| | | printf '%s' "$(cd "$basedir" || exit 1; pwd)" |
| | | } |
| | | |
| | | # concatenates all lines of a file |
| | | concat_lines() { |
| | | if [ -f "$1" ]; then |
| | | # Remove \r in case we run on Windows within Git Bash |
| | | # and check out the repository with auto CRLF management |
| | | # enabled. Otherwise, we may read lines that are delimited with |
| | | # \r\n and produce $'-Xarg\r' rather than -Xarg due to word |
| | | # splitting rules. |
| | | tr -s '\r\n' ' ' < "$1" |
| | | fi |
| | | } |
| | | |
| | | log() { |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | printf '%s\n' "$1" |
| | | fi |
| | | } |
| | | |
| | | BASE_DIR=$(find_maven_basedir "$(dirname "$0")") |
| | | if [ -z "$BASE_DIR" ]; then |
| | | exit 1; |
| | | fi |
| | | |
| | | MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR |
| | | log "$MAVEN_PROJECTBASEDIR" |
| | | |
| | | ########################################################################################## |
| | | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
| | | # This allows using the maven wrapper in projects that prohibit checking in binary data. |
| | | ########################################################################################## |
| | | wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" |
| | | if [ -r "$wrapperJarPath" ]; then |
| | | log "Found $wrapperJarPath" |
| | | else |
| | | log "Couldn't find $wrapperJarPath, downloading it ..." |
| | | |
| | | if [ -n "$MVNW_REPOURL" ]; then |
| | | wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" |
| | | else |
| | | wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" |
| | | fi |
| | | while IFS="=" read -r key value; do |
| | | # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) |
| | | safeValue=$(echo "$value" | tr -d '\r') |
| | | case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; |
| | | esac |
| | | done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" |
| | | log "Downloading from: $wrapperUrl" |
| | | |
| | | if $cygwin; then |
| | | wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") |
| | | fi |
| | | |
| | | if command -v wget > /dev/null; then |
| | | log "Found wget ... using wget" |
| | | [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" |
| | | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
| | | wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
| | | else |
| | | wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
| | | fi |
| | | elif command -v curl > /dev/null; then |
| | | log "Found curl ... using curl" |
| | | [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" |
| | | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
| | | curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" |
| | | else |
| | | curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" |
| | | fi |
| | | else |
| | | log "Falling back to using Java to download" |
| | | javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" |
| | | javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" |
| | | # For Cygwin, switch paths to Windows format before running javac |
| | | if $cygwin; then |
| | | javaSource=$(cygpath --path --windows "$javaSource") |
| | | javaClass=$(cygpath --path --windows "$javaClass") |
| | | fi |
| | | if [ -e "$javaSource" ]; then |
| | | if [ ! -e "$javaClass" ]; then |
| | | log " - Compiling MavenWrapperDownloader.java ..." |
| | | ("$JAVA_HOME/bin/javac" "$javaSource") |
| | | fi |
| | | if [ -e "$javaClass" ]; then |
| | | log " - Running MavenWrapperDownloader.java ..." |
| | | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" |
| | | fi |
| | | fi |
| | | fi |
| | | fi |
| | | ########################################################################################## |
| | | # End of extension |
| | | ########################################################################################## |
| | | |
| | | # If specified, validate the SHA-256 sum of the Maven wrapper jar file |
| | | wrapperSha256Sum="" |
| | | while IFS="=" read -r key value; do |
| | | case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; |
| | | esac |
| | | done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" |
| | | if [ -n "$wrapperSha256Sum" ]; then |
| | | wrapperSha256Result=false |
| | | if command -v sha256sum > /dev/null; then |
| | | if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then |
| | | wrapperSha256Result=true |
| | | fi |
| | | elif command -v shasum > /dev/null; then |
| | | if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then |
| | | wrapperSha256Result=true |
| | | fi |
| | | else |
| | | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." |
| | | echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." |
| | | exit 1 |
| | | fi |
| | | if [ $wrapperSha256Result = false ]; then |
| | | echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 |
| | | echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 |
| | | echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 |
| | | exit 1 |
| | | fi |
| | | fi |
| | | |
| | | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" |
| | | |
| | | # For Cygwin, switch paths to Windows format before running java |
| | | if $cygwin; then |
| | | [ -n "$JAVA_HOME" ] && |
| | | JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") |
| | | [ -n "$CLASSPATH" ] && |
| | | CLASSPATH=$(cygpath --path --windows "$CLASSPATH") |
| | | [ -n "$MAVEN_PROJECTBASEDIR" ] && |
| | | MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") |
| | | fi |
| | | |
| | | # Provide a "standardized" way to retrieve the CLI args that will |
| | | # work with both Windows and non-Windows executions. |
| | | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" |
| | | export MAVEN_CMD_LINE_ARGS |
| | | |
| | | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
| | | |
| | | # shellcheck disable=SC2086 # safe args |
| | | exec "$JAVACMD" \ |
| | | $MAVEN_OPTS \ |
| | | $MAVEN_DEBUG_OPTS \ |
| | | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ |
| | | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ |
| | | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
| New file |
| | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Licensed to the Apache Software Foundation (ASF) under one |
| | | @REM or more contributor license agreements. See the NOTICE file |
| | | @REM distributed with this work for additional information |
| | | @REM regarding copyright ownership. The ASF licenses this file |
| | | @REM to you under the Apache License, Version 2.0 (the |
| | | @REM "License"); you may not use this file except in compliance |
| | | @REM with the License. You may obtain a copy of the License at |
| | | @REM |
| | | @REM https://www.apache.org/licenses/LICENSE-2.0 |
| | | @REM |
| | | @REM Unless required by applicable law or agreed to in writing, |
| | | @REM software distributed under the License is distributed on an |
| | | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | @REM KIND, either express or implied. See the License for the |
| | | @REM specific language governing permissions and limitations |
| | | @REM under the License. |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Apache Maven Wrapper startup batch script, version 3.2.0 |
| | | @REM |
| | | @REM Required ENV vars: |
| | | @REM JAVA_HOME - location of a JDK home dir |
| | | @REM |
| | | @REM Optional ENV vars |
| | | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
| | | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
| | | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
| | | @REM e.g. to debug Maven itself, use |
| | | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
| | | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
| | | @echo off |
| | | @REM set title of command window |
| | | title %0 |
| | | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
| | | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
| | | |
| | | @REM set %HOME% to equivalent of $HOME |
| | | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
| | | |
| | | @REM Execute a user defined script before this one |
| | | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
| | | @REM check for pre script, once with legacy .bat ending and once with .cmd ending |
| | | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* |
| | | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* |
| | | :skipRcPre |
| | | |
| | | @setlocal |
| | | |
| | | set ERROR_CODE=0 |
| | | |
| | | @REM To isolate internal variables from possible post scripts, we use another setlocal |
| | | @setlocal |
| | | |
| | | @REM ==== START VALIDATION ==== |
| | | if not "%JAVA_HOME%" == "" goto OkJHome |
| | | |
| | | echo. |
| | | echo Error: JAVA_HOME not found in your environment. >&2 |
| | | echo Please set the JAVA_HOME variable in your environment to match the >&2 |
| | | echo location of your Java installation. >&2 |
| | | echo. |
| | | goto error |
| | | |
| | | :OkJHome |
| | | if exist "%JAVA_HOME%\bin\java.exe" goto init |
| | | |
| | | echo. |
| | | echo Error: JAVA_HOME is set to an invalid directory. >&2 |
| | | echo JAVA_HOME = "%JAVA_HOME%" >&2 |
| | | echo Please set the JAVA_HOME variable in your environment to match the >&2 |
| | | echo location of your Java installation. >&2 |
| | | echo. |
| | | goto error |
| | | |
| | | @REM ==== END VALIDATION ==== |
| | | |
| | | :init |
| | | |
| | | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
| | | @REM Fallback to current working directory if not found. |
| | | |
| | | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
| | | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
| | | |
| | | set EXEC_DIR=%CD% |
| | | set WDIR=%EXEC_DIR% |
| | | :findBaseDir |
| | | IF EXIST "%WDIR%"\.mvn goto baseDirFound |
| | | cd .. |
| | | IF "%WDIR%"=="%CD%" goto baseDirNotFound |
| | | set WDIR=%CD% |
| | | goto findBaseDir |
| | | |
| | | :baseDirFound |
| | | set MAVEN_PROJECTBASEDIR=%WDIR% |
| | | cd "%EXEC_DIR%" |
| | | goto endDetectBaseDir |
| | | |
| | | :baseDirNotFound |
| | | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
| | | cd "%EXEC_DIR%" |
| | | |
| | | :endDetectBaseDir |
| | | |
| | | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
| | | |
| | | @setlocal EnableExtensions EnableDelayedExpansion |
| | | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
| | | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
| | | |
| | | :endReadAdditionalConfig |
| | | |
| | | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
| | | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
| | | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
| | | |
| | | set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" |
| | | |
| | | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
| | | IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B |
| | | ) |
| | | |
| | | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
| | | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
| | | if exist %WRAPPER_JAR% ( |
| | | if "%MVNW_VERBOSE%" == "true" ( |
| | | echo Found %WRAPPER_JAR% |
| | | ) |
| | | ) else ( |
| | | if not "%MVNW_REPOURL%" == "" ( |
| | | SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" |
| | | ) |
| | | if "%MVNW_VERBOSE%" == "true" ( |
| | | echo Couldn't find %WRAPPER_JAR%, downloading it ... |
| | | echo Downloading from: %WRAPPER_URL% |
| | | ) |
| | | |
| | | powershell -Command "&{"^ |
| | | "$webclient = new-object System.Net.WebClient;"^ |
| | | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
| | | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
| | | "}"^ |
| | | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ |
| | | "}" |
| | | if "%MVNW_VERBOSE%" == "true" ( |
| | | echo Finished downloading %WRAPPER_JAR% |
| | | ) |
| | | ) |
| | | @REM End of extension |
| | | |
| | | @REM If specified, validate the SHA-256 sum of the Maven wrapper jar file |
| | | SET WRAPPER_SHA_256_SUM="" |
| | | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
| | | IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B |
| | | ) |
| | | IF NOT %WRAPPER_SHA_256_SUM%=="" ( |
| | | powershell -Command "&{"^ |
| | | "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ |
| | | "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ |
| | | " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ |
| | | " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ |
| | | " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ |
| | | " exit 1;"^ |
| | | "}"^ |
| | | "}" |
| | | if ERRORLEVEL 1 goto error |
| | | ) |
| | | |
| | | @REM Provide a "standardized" way to retrieve the CLI args that will |
| | | @REM work with both Windows and non-Windows executions. |
| | | set MAVEN_CMD_LINE_ARGS=%* |
| | | |
| | | %MAVEN_JAVA_EXE% ^ |
| | | %JVM_CONFIG_MAVEN_PROPS% ^ |
| | | %MAVEN_OPTS% ^ |
| | | %MAVEN_DEBUG_OPTS% ^ |
| | | -classpath %WRAPPER_JAR% ^ |
| | | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ |
| | | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
| | | if ERRORLEVEL 1 goto error |
| | | goto end |
| | | |
| | | :error |
| | | set ERROR_CODE=1 |
| | | |
| | | :end |
| | | @endlocal & set ERROR_CODE=%ERROR_CODE% |
| | | |
| | | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost |
| | | @REM check for post script, once with legacy .bat ending and once with .cmd ending |
| | | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" |
| | | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" |
| | | :skipRcPost |
| | | |
| | | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
| | | if "%MAVEN_BATCH_PAUSE%"=="on" pause |
| | | |
| | | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% |
| | | |
| | | cmd /C exit /B %ERROR_CODE% |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-web</artifactId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | |
| | | <packaging>jar</packaging> |
| | | |
| | | <artifactId>pipIrr-web-webchat</artifactId> |
| | | <name>pipIrr-web-webchat</name> |
| | | <description>web微信支付模块</description> |
| | | |
| | | <dependencies> |
| | | <!--微信支付--> |
| | | <dependency> |
| | | <groupId>com.github.wechatpay-apiv3</groupId> |
| | | <artifactId>wechatpay-java</artifactId> |
| | | <version>0.2.12</version> |
| | | </dependency> |
| | | |
| | | <!--OkHttp--> |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | <version>4.5.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents.client5</groupId> |
| | | <artifactId>httpclient5</artifactId> |
| | | <version>5.1.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents.client5</groupId> |
| | | <artifactId>httpclient5-fluent</artifactId> |
| | | <version>5.1.3</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | <build> |
| | | <plugins> |
| | | <!-- 生成不包含依赖jar的可执行jar包 |
| | | <plugin> |
| | | !- spring boot提供的maven打包插件 - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 不指定生成路径的话, 默认保存在 ${build.directory} 下 - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- 拷贝依赖的jar包到lib目录--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}是maven变量,内置的,表示target目录,如果不写,将在根目录下创建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:是否不包含间接依赖包,比如我们依赖A,但是A又依赖了B,我们是否也要把B打进去 默认不打--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- 复制的jar文件去掉版本信息 --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置java编译版本,运行环境版本 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- source: 源代码编译版本;target: 目标平台编译版本;encoding: 字符集编码。 --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 解决资源文件的编码问题 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- maven里执行测试用例的插件 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 下面解决:当进行Maven Lifecycle package时报错:Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| New file |
| | |
| | | package com.dy.pipirrWebChat; |
| | | |
| | | import com.dy.common.multiDataSource.EnableMultiDataSource; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024/02/21 16:07 |
| | | * @LastEditTime 2024/02/21 16:07 |
| | | * @Description |
| | | */ |
| | | |
| | | @SpringBootApplication |
| | | @EnableAspectJAutoProxy |
| | | @EnableMultiDataSource |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipirrWebChat"}) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) |
| | | public class PipIrrWebChatApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(PipIrrWebChatApplication.class, args); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.converter.HttpMessageConverter; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | //import org.apache.http.client.HttpClient; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-23 15:42 |
| | | * @LastEditTime 2024-02-23 15:42 |
| | | * @Description |
| | | */ |
| | | |
| | | @Configuration |
| | | public class RestTemplateConfig { |
| | | @Autowired |
| | | private RestTemplateWechatCertConfig restTemplateWechatCertConfig; |
| | | |
| | | //@Bean |
| | | //public RestTemplate restTemplate() { |
| | | // return new RestTemplate(); |
| | | //} |
| | | |
| | | //@Bean |
| | | //public RestTemplate restTemplate() { |
| | | // String mchid = PayInfo.mchid; |
| | | // RestTemplate restTemplate = null; |
| | | // try { |
| | | // KeyStore keyStore = KeyStore.getInstance("PKCS12"); |
| | | // //InputStream cp = this.getClass().getResourceAsStream("apiclient_cert.p12"); |
| | | // FileInputStream instream = new FileInputStream(new File("C:\\webchat\\apiclient_cert.p12")); |
| | | // keyStore.load(instream, mchid.toCharArray()); |
| | | // // Trust own CA and all self-signed certs |
| | | // SSLContext sslcontext = SSLContextBuilder.create() |
| | | // .loadKeyMaterial(keyStore, mchid.toCharArray()) |
| | | // .build(); |
| | | // //Allow TLSv1 protocol only |
| | | // SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[]{"TLSv1"}, null, NoopHostnameVerifier.INSTANCE); |
| | | // CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | // HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); |
| | | // |
| | | // restTemplate = new RestTemplate(factory); |
| | | // //将转换器的编码换成utf-8 |
| | | // restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(Charset.forName("utf-8"))); |
| | | // //System.out.println("restTemplate.hashCode():" + restTemplate.hashCode()); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return restTemplate; |
| | | //} |
| | | |
| | | //@Bean(name = "wechatRestTemplate") |
| | | @Bean() |
| | | public RestTemplate restTemplate() throws Exception { |
| | | RestTemplate restTemplate = new RestTemplate(restTemplateWechatCertConfig.wechatHttpRequestFactory()); |
| | | // 添加拦截器 |
| | | //List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(); |
| | | //RestTemplateWechatCertConfig.MyRequestInterceptor myRequestInterceptor = new RestTemplateWechatCertConfig.MyRequestInterceptor(); |
| | | //interceptors.add(myRequestInterceptor); |
| | | //restTemplate.setInterceptors(interceptors); |
| | | |
| | | // 中文乱码,主要是 StringHttpMessageConverter的默认编码为ISO导致的 |
| | | List<HttpMessageConverter<?>> list = restTemplate.getMessageConverters(); |
| | | for (HttpMessageConverter converter : list) { |
| | | if (converter instanceof StringHttpMessageConverter) { |
| | | ((StringHttpMessageConverter) converter).setDefaultCharset(StandardCharsets.UTF_8); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return restTemplate; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package com.dy.pipirrWebChat.config; |
| | | |
| | | import com.dy.pipirrWebChat.payment.PayInfo; |
| | | import okhttp3.OkHttpClient; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.client.ClientHttpRequestFactory; |
| | | import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; |
| | | |
| | | import javax.net.ssl.KeyManagerFactory; |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.TrustManagerFactory; |
| | | import javax.net.ssl.X509TrustManager; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.security.KeyStore; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-23 19:18 |
| | | * @LastEditTime 2024-02-23 19:18 |
| | | * @Description |
| | | */ |
| | | |
| | | @Configuration |
| | | public class RestTemplateWechatCertConfig { |
| | | String mchid = PayInfo.mchid; |
| | | |
| | | @Bean |
| | | @ConfigurationProperties(prefix = "org.liurb.core.rest-template.config.connection") |
| | | public ClientHttpRequestFactory wechatHttpRequestFactory() throws Exception { |
| | | |
| | | KeyStore keyStore = KeyStore.getInstance("PKCS12"); |
| | | //InputStream cp = this.getClass().getResourceAsStream("apiclient_cert.p12"); |
| | | FileInputStream instream = new FileInputStream(new File("C:\\webchat\\apiclient_cert.p12")); |
| | | keyStore.load(instream, mchid.toCharArray()); |
| | | |
| | | KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); |
| | | keyManagerFactory.init(keyStore, mchid.toCharArray()); |
| | | |
| | | SSLContext context = SSLContext.getInstance("TLS"); |
| | | context.init(keyManagerFactory.getKeyManagers(), null, null); |
| | | |
| | | OkHttpClient okHttpClient = new OkHttpClient.Builder() |
| | | .sslSocketFactory(context.getSocketFactory(), getDefaultX509TrustManager()) |
| | | .build(); |
| | | |
| | | return new OkHttp3ClientHttpRequestFactory(okHttpClient); |
| | | } |
| | | |
| | | private static X509TrustManager getDefaultX509TrustManager() throws Exception { |
| | | TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); |
| | | factory.init((KeyStore) null); |
| | | return (X509TrustManager) factory.getTrustManagers()[0]; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.config; |
| | | |
| | | import com.dy.common.webFilter.DevOfDataSourceNameSetFilter; |
| | | import com.dy.common.webFilter.UserTokenFilter; |
| | | import jakarta.servlet.Filter; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-21 16:10 |
| | | * @LastEditTime 2024-02-21 16:10 |
| | | * @Description |
| | | */ |
| | | |
| | | @Configuration |
| | | public class WebFilterConfiguration { |
| | | |
| | | @Value("${pipIrr.global.dev}") |
| | | public String isDevStage ;//是否为开发阶段 |
| | | @Value("${pipIrr.global.dsName}") |
| | | public String dsName ;//开发阶段的数据源名称 |
| | | |
| | | /** |
| | | * DevOfDataSourceNameSetFilter与UserTokenFilter只能一个被配置上, |
| | | * 所以他们的order都是1 |
| | | */ |
| | | private static final int order_UserTokenFilter = 1 ;//与下面 |
| | | private static final int order_DevOfDataSourceNameSetFilter = 1 ; |
| | | |
| | | |
| | | @Bean |
| | | public FilterRegistrationBean<? extends Filter> RegFilter() { |
| | | FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); |
| | | if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ |
| | | filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 |
| | | filterRegistrationBean.addInitParameter("dataSourceName",dsName);//设置init参数 |
| | | filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//设置过滤器名称 |
| | | filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//执行次序 |
| | | }else{ |
| | | filterRegistrationBean.setFilter(new UserTokenFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 |
| | | filterRegistrationBean.setName("UserTokenFilter");//设置过滤器名称 |
| | | filterRegistrationBean.setOrder(order_UserTokenFilter);//执行次序 |
| | | } |
| | | return filterRegistrationBean; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.config; |
| | | |
| | | import com.dy.common.webListener.GenerateIdSetSuffixListener; |
| | | import jakarta.servlet.ServletContextListener; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-21 16:11 |
| | | * @LastEditTime 2024-02-21 16:11 |
| | | * @Description |
| | | */ |
| | | |
| | | @Configuration |
| | | public class WebListenerConfiguration { |
| | | |
| | | /** |
| | | * 启动顺序 |
| | | */ |
| | | //private static final int order_config = 0 ; |
| | | private static final int order_idSetSuffix = 1 ; |
| | | //private static final int order_init = 2 ; |
| | | |
| | | /* |
| | | * 解析各种***.config配置的ConfigListener,暂时不采用此种配置方式 |
| | | * |
| | | @Bean |
| | | public ConfigListener getGlConfigListener(){ |
| | | return new ConfigListener() ; |
| | | } |
| | | /** |
| | | * 外部提供Listener |
| | | * @param listener 外部提供Listener |
| | | * @return 注册Bean |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) { |
| | | ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(listener); |
| | | listenerRegistrationBean.setOrder(order_config); |
| | | return listenerRegistrationBean; |
| | | } |
| | | */ |
| | | |
| | | /** |
| | | * 内部提供listener,该listener在系统启动时,根据配置 设置ID产生器的后缀 |
| | | * @return 注册Bean |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() { |
| | | ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); |
| | | listenerRegistrationBean.setOrder(order_idSetSuffix); |
| | | return listenerRegistrationBean; |
| | | } |
| | | |
| | | // /** |
| | | // * 内部提供listener,该listener在系统启动时,初始化数据库数据 |
| | | // * @return 注册Bean |
| | | // */ |
| | | // @Bean |
| | | // public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() { |
| | | // ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | // listenerRegistrationBean.setListener(new InitListener()); |
| | | // listenerRegistrationBean.setOrder(order_init); |
| | | // return listenerRegistrationBean; |
| | | // } |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.payment; |
| | | |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import java.io.IOException; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.security.*; |
| | | import java.security.spec.InvalidKeySpecException; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.util.Base64; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 20:31 |
| | | * @LastEditTime 2024-02-22 20:31 |
| | | * @Description |
| | | */ |
| | | public class PayHelper { |
| | | private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
| | | |
| | | /** |
| | | * 获取32位随机字符串 |
| | | * @return 随机串 |
| | | */ |
| | | public static String generateRandomString() { |
| | | Random random = new Random(); |
| | | StringBuilder sb = new StringBuilder(32); |
| | | for (int i = 0; i < 32; i++) { |
| | | int index = random.nextInt(CHARACTERS.length()); |
| | | sb.append(CHARACTERS.charAt(index)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取私钥对象 |
| | | * @param filename 私钥文件路径 |
| | | * @return 私钥对象 |
| | | * @throws IOException |
| | | */ |
| | | public static PrivateKey getPrivateKey(String filename) throws IOException { |
| | | //String filename = "C:\\webchat\\apiclient_key.pem"; |
| | | String content = new String(Files.readAllBytes(Paths.get(filename)), "utf-8"); |
| | | try { |
| | | String privateKey = content.replace("-----BEGIN PRIVATE KEY-----", "") |
| | | .replace("-----END PRIVATE KEY-----", "") |
| | | .replaceAll("\\s+", ""); |
| | | KeyFactory kf = KeyFactory.getInstance("RSA"); |
| | | return kf.generatePrivate( |
| | | new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey))); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | throw new RuntimeException("当前Java环境不支持RSA", e); |
| | | } catch (InvalidKeySpecException e) { |
| | | throw new RuntimeException("无效的密钥格式"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 构造签名串_下单 |
| | | * @param method HTTP请求方法 |
| | | * @param url URL |
| | | * @param timestamp 时间戳 |
| | | * @param nonceStr 随机串 |
| | | * @param body 报文主题 |
| | | * @return 签名串 |
| | | */ |
| | | public static String buildMessage_order(String method, String url, long timestamp, String nonceStr, String body) { |
| | | return method + "\n" |
| | | + url + "\n" |
| | | + timestamp + "\n" |
| | | + nonceStr + "\n" |
| | | + body + "\n"; |
| | | } |
| | | |
| | | public static String buildMessage_signAgain(String appid, String timestamp, String nonceStr, String pkg) { |
| | | return appid + "\n" |
| | | + timestamp + "\n" |
| | | + nonceStr + "\n" |
| | | + pkg + "\n"; |
| | | } |
| | | |
| | | /** |
| | | * 签名 |
| | | * @param message 被签名信息 |
| | | * @param certFileName 私钥证书文件路径 |
| | | * @return signature签名值,签名信息中的一项,参与生成签名信息 |
| | | * @throws NoSuchAlgorithmException |
| | | * @throws InvalidKeyException |
| | | * @throws SignatureException |
| | | * @throws IOException |
| | | */ |
| | | public static String sign(byte[] message, String certFileName) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException { |
| | | Signature sign = Signature.getInstance("SHA256withRSA"); |
| | | sign.initSign(getPrivateKey(certFileName)); |
| | | sign.update(message); |
| | | return Base64.getEncoder().encodeToString(sign.sign()); |
| | | } |
| | | |
| | | /** |
| | | * 获取签名信息 |
| | | * @param method |
| | | * @param url |
| | | * @param body |
| | | * @return 签名信息,HTTP头中的签名信息 |
| | | * HTTP头:Authorization: 认证类型 签名信息 |
| | | * 认证类型,WECHATPAY2-SHA256-RSA2048 |
| | | */ |
| | | public static String getToken(String method, String url, String body, String nonceStr, Long timestamp, String certFileName) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException, NoSuchPaddingException { |
| | | String message = buildMessage_order(method, url, timestamp, nonceStr, body); |
| | | String signature = sign(message.getBytes("utf-8"), certFileName); |
| | | |
| | | return "mchid=\"" + PayInfo.mchid + "\"," |
| | | + "nonce_str=\"" + nonceStr + "\"," |
| | | + "timestamp=\"" + timestamp + "\"," |
| | | + "serial_no=\"" + PayInfo.serial_no + "\"," |
| | | + "signature=\"" + signature + "\""; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.payment; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 20:20 |
| | | * @LastEditTime 2024-02-22 20:20 |
| | | * @Description |
| | | */ |
| | | public class PayInfo { |
| | | /* |
| | | * 小程序登录API |
| | | */ |
| | | public static String loginUrl = "https://api.weixin.qq.com/sns/jscode2session"; |
| | | |
| | | /* |
| | | * 统一下单API |
| | | */ |
| | | //public static String orderUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | public static String orderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi"; |
| | | |
| | | /** |
| | | * 平台证书下载URL |
| | | */ |
| | | public static String certificates = "https://api.mch.weixin.qq.com/v3/certificates"; |
| | | |
| | | /* |
| | | * 支付结果通知API |
| | | */ |
| | | public static String notifyUrl = "https://www.muxiaobao.com/api/Payment/OrderNotify"; |
| | | |
| | | /* |
| | | * 查询订单API |
| | | */ |
| | | public static String queryUrl = "https://api.mch.weixin.qq.com/pay/orderquery"; |
| | | |
| | | /* |
| | | * 申请退款API |
| | | */ |
| | | public static String refundUrl = "https://api.mch.weixin.qq.com/secapi/pay/refund"; |
| | | |
| | | /* |
| | | * 退款通知API |
| | | */ |
| | | public static String refundNotifyUrl = "https://www.muxiaobao.com/wxpay/pay.action"; |
| | | |
| | | /* |
| | | * 退款查询API |
| | | */ |
| | | public static String refundQueryUrl = "https://api.mch.weixin.qq.com/pay/refundquery"; |
| | | |
| | | /* |
| | | * 小程序唯一标识 |
| | | */ |
| | | public static String appid = "wxf776aebf73f34962"; |
| | | |
| | | /* |
| | | * 小程序的 app secret |
| | | */ |
| | | public static String secret = "b05862b7fa8a944114dbe970c2764ae6"; |
| | | |
| | | /* |
| | | * 小程序的授权类型,登录凭证校验使用 |
| | | */ |
| | | public static String grantType = "authorization_code"; |
| | | |
| | | /* |
| | | * 商户号(微信支付分配的商户号) |
| | | */ |
| | | public static String mchid = "1640721520"; |
| | | |
| | | /* |
| | | * 商户平台设置的密钥key |
| | | */ |
| | | public static String key = "DaYuJieShuiYanJiuYuan20230412ABC"; |
| | | |
| | | /** |
| | | * 商户API证书序列号 |
| | | */ |
| | | public static String serial_no = "52D65AA66405C738670377F467178F4C950E1606"; |
| | | |
| | | /* |
| | | * 终端IP,调用微信支付API的机器IP |
| | | */ |
| | | public static String addrIp = "47.104.211.89"; |
| | | |
| | | /* |
| | | * 随机字符串,长度要求在32位以内 |
| | | */ |
| | | //public static String nonceStr = PayHelper.generateRandomString(); |
| | | |
| | | /* |
| | | * 时间戳 从1970年1月1日00:00:00至今的秒数,即当前的时间 |
| | | */ |
| | | //public static Long timeStamp = PayHelper.getTimeStamp(); |
| | | |
| | | /* |
| | | * 交易类型,小程序取值JSAPI |
| | | */ |
| | | public static String tradeType = "JSAPI"; |
| | | |
| | | /* |
| | | * 签名类型 |
| | | */ |
| | | //public static String signType = "MD5"; |
| | | public static String signType = "RSA"; |
| | | |
| | | /* |
| | | * 商品描述 商品简单描述,该字段请按照规范传递 |
| | | */ |
| | | //public static String body = "大禹研究院-水费"; |
| | | public static String description = "大禹研究院-水费"; |
| | | |
| | | /* |
| | | * 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 |
| | | */ |
| | | public static String attach = "天津"; |
| | | |
| | | /* |
| | | * 签名,参与签名参数:appid、attach、mch_id、nonce_str、body、out_trade_no、total_fee、spbill_create_ip、notify_url、trade_type、openid |
| | | */ |
| | | public String sign = ""; |
| | | |
| | | /** |
| | | * HTTP头认证类型 |
| | | */ |
| | | public static String schema = "WECHATPAY2-SHA256-RSA2048"; |
| | | |
| | | /** |
| | | * 私钥文件路径 |
| | | */ |
| | | public static String certFileName = "C:\\webchat\\apiclient_key.pem"; |
| | | |
| | | /* |
| | | * 微信订单号,优先使用 |
| | | */ |
| | | public static String transactionid = ""; |
| | | |
| | | /* |
| | | * 商户系统内部订单号 |
| | | */ |
| | | public static String out_trade_no = ""; |
| | | |
| | | /* |
| | | * 商户退款单号 |
| | | */ |
| | | public static String out_refund_no = ""; |
| | | |
| | | /* |
| | | * 退款金额 |
| | | */ |
| | | public static Float refundfee; |
| | | |
| | | /* |
| | | * 订单金额 |
| | | */ |
| | | public static Float totalfee; |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.payment; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; |
| | | import com.dy.pipirrWebChat.util.OkHttpUtil; |
| | | import com.dy.pipirrWebChat.util.RestTemplateUtil; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | 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 lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 15:24 |
| | | * @LastEditTime 2024-02-22 15:24 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "微信支付管理", description = "微信支付各种操作") |
| | | @RestController |
| | | @RequestMapping(path="payment") |
| | | @RequiredArgsConstructor |
| | | public class PaymentCtrl { |
| | | private final PaymentSv paymentSv; |
| | | private final RestTemplateUtil restTemplateUtil; |
| | | private String certFileName = PayInfo.certFileName; |
| | | |
| | | /** |
| | | * 登录凭证校验 |
| | | * @param appid 小程序 appId |
| | | * @param secret 小程序 appSecret |
| | | * @param js_code 临时登录凭证code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Operation(summary = "登录凭证校验", description = "登录凭证校验") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "getSessionId") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> getSessionId(@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam("js_code") String js_code) throws Exception { |
| | | String result = OkHttpUtil.builder().url("https://api.weixin.qq.com/sns/jscode2session") |
| | | .addParam("appid", appid) |
| | | .addParam("secret", secret) |
| | | .addParam("js_code", js_code) |
| | | .initGet() |
| | | .sync(); |
| | | JSONObject job = JSONObject.parseObject(result); |
| | | System.out.println(job.getString("session_key")); |
| | | |
| | | if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) { |
| | | return BaseResponseUtils.buildFail("登录凭证校验失败"); |
| | | } |
| | | |
| | | // 添加登录态记录 |
| | | SeWebchatLogonState po = new SeWebchatLogonState(); |
| | | po.setOpenId(job.getString("openid")); |
| | | po.setSessionKey(job.getString("session_key")); |
| | | Date createTime = new Date(); |
| | | po.setCreateTime(createTime); |
| | | Long id = paymentSv.insert(po); |
| | | if(id == null || id <= 0) { |
| | | return BaseResponseUtils.buildFail("登录态记录添加失败"); |
| | | } |
| | | |
| | | String SessionId = String.valueOf(id); |
| | | return BaseResponseUtils.buildSuccess(SessionId) ; |
| | | } |
| | | |
| | | @Operation(summary = "下载平台证书", description = "下载平台证书") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "certificates") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<JSONObject> certificates() throws Exception { |
| | | //String prepayId = ""; |
| | | //SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId)); |
| | | //String openid = po.getOpenId(); |
| | | |
| | | String method = "GET"; |
| | | String httpUrl = "/v3/certificates"; |
| | | String nonceStr = PayHelper.generateRandomString(); |
| | | Long timestamp = System.currentTimeMillis() / 1000; |
| | | |
| | | String header = PayInfo.schema + " " + PayHelper.getToken(method, httpUrl, "", nonceStr, timestamp, certFileName); |
| | | |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", header); |
| | | headers.put("Accept", "application/json"); |
| | | JSONObject job_result = restTemplateUtil.get(PayInfo.certificates,null, headers); |
| | | if(job_result != null) { |
| | | JSONArray array = job_result.getJSONArray("data"); |
| | | if(array != null && array.size() > 0) { |
| | | for(int i = 0; i < array.size(); i++) { |
| | | JSONObject job_data = array.getJSONObject(i); |
| | | String serial_no = job_data.getString("serial_no"); |
| | | String effective_time = job_data.getString("effective_time"); |
| | | String expire_time = job_data.getString("expire_time"); |
| | | JSONObject job_certificate = job_data.getJSONObject("encrypt_certificate"); |
| | | String algorithm = job_certificate.getString("algorithm"); |
| | | String nonce = job_certificate.getString("nonce"); |
| | | String associated_data = job_certificate.getString("associated_data"); |
| | | String ciphertext = job_certificate.getString("ciphertext"); |
| | | } |
| | | } |
| | | } |
| | | System.out.println(job_result.toJSONString()); |
| | | return BaseResponseUtils.buildSuccess(job_result.toJSONString()) ; |
| | | } |
| | | |
| | | /** |
| | | * JSAPI下单 |
| | | * @param sessionId |
| | | * @param orderNumber |
| | | * @param payAmount |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Operation(summary = "统一下单", description = "统一下单") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "unifiedOrder") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> unifiedOrder(@RequestParam("sessionId") String sessionId, @RequestParam("orderNumber") String orderNumber, @RequestParam("payAmount") String payAmount) throws Exception { |
| | | String prepayId = ""; |
| | | SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId)); |
| | | String openid = po.getOpenId(); |
| | | |
| | | JSONObject job_body = new JSONObject(); |
| | | job_body.put("appid", PayInfo.appid); |
| | | job_body.put("mchid", PayInfo.mchid); |
| | | job_body.put("description", PayInfo.description); |
| | | job_body.put("out_trade_no", orderNumber); |
| | | job_body.put("notify_url", PayInfo.notifyUrl); |
| | | |
| | | //订单金额 |
| | | JSONObject job_amount = new JSONObject(); |
| | | job_amount.put("total", 1); |
| | | job_amount.put("currency", "CNY"); |
| | | job_body.put("amount", job_amount); |
| | | |
| | | //支付者 |
| | | JSONObject job_payer = new JSONObject(); |
| | | job_payer.put("openid", openid); |
| | | job_body.put("payer", job_payer); |
| | | |
| | | // 获取随机串和时间戳,放在此处以保证 |
| | | String nonceStr = PayHelper.generateRandomString(); |
| | | Long timestamp = System.currentTimeMillis() / 1000; |
| | | |
| | | String method = "POST"; |
| | | String httpUrl = "/v3/pay/transactions/jsapi"; |
| | | |
| | | String body = job_body.toJSONString(); |
| | | String header = PayInfo.schema + " " + PayHelper.getToken(method, httpUrl, body, nonceStr, timestamp, certFileName); |
| | | |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Authorization", header); |
| | | headers.put("Accept", "application/json"); |
| | | headers.put("Content-Type", "application/json"); |
| | | |
| | | JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers); |
| | | if(job_result != null) { |
| | | System.out.println(job_result.toString()); |
| | | prepayId = job_result.getString("prepay_id"); |
| | | } |
| | | |
| | | |
| | | |
| | | //String result = OkHttpUtil.builder().url(PayInfo.orderUrl) |
| | | // .addBody(body) |
| | | // .addHeader("Authorization", header) |
| | | // .addHeader("Accept", "application/json") |
| | | // .addHeader("Content-Type", "application/json") |
| | | // .initPost(true) |
| | | // .sync(); |
| | | //System.out.println(result); |
| | | |
| | | return BaseResponseUtils.buildSuccess(prepayId) ; |
| | | } |
| | | |
| | | /** |
| | | * 再次签名 |
| | | * @param prepayId 预支付交易会话标识 |
| | | * @return 小程序调起支付参数 |
| | | * @throws Exception |
| | | */ |
| | | @Operation(summary = "再次签名", description = "再次签名") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/signAgain") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception { |
| | | |
| | | // 获取随机串和时间戳,放在此处以保证 |
| | | String appid = PayInfo.appid; |
| | | String timestamp = String.valueOf(System.currentTimeMillis() / 1000); |
| | | String nonceStr = PayHelper.generateRandomString(); |
| | | String pkg = "prepay_id=" + prepayId; |
| | | String signType = PayInfo.signType; |
| | | String message = PayHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg); |
| | | String paySign = PayHelper.sign(message.getBytes("utf-8"), certFileName); |
| | | |
| | | JSONObject job_result = new JSONObject(); |
| | | job_result.put("timestamp", timestamp); |
| | | job_result.put("nonceStr", nonceStr); |
| | | job_result.put("package", pkg); |
| | | job_result.put("signType", signType); |
| | | job_result.put("paySign", paySign); |
| | | |
| | | return BaseResponseUtils.buildSuccess(job_result) ; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.payment; |
| | | |
| | | import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 17:39 |
| | | * @LastEditTime 2024-02-22 17:39 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class PaymentSv { |
| | | @Autowired |
| | | private SeWebchatLogonStateMapper seWebchatLogonStateMapper; |
| | | |
| | | /** |
| | | * 添加登录态状态记录 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | Long insert(SeWebchatLogonState po) { |
| | | seWebchatLogonStateMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | SeWebchatLogonState selectOne(Long id) { |
| | | return seWebchatLogonStateMapper.selectByPrimaryKey(id); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.payment.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 15:34 |
| | | * @LastEditTime 2024-02-22 15:34 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "登录凭证校验传入对象") |
| | | public class Code2Session { |
| | | public static final long serialVersionUID = 202402221335001L; |
| | | |
| | | /** |
| | | * 小程序 appId |
| | | */ |
| | | @Schema(description = "小程序 appId", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "小程序 appId不能为空") |
| | | private String appid; |
| | | |
| | | /** |
| | | * 小程序 appSecret |
| | | */ |
| | | @Schema(description = "小程序 appSecret", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "小程序 appSecret不能为空") |
| | | private String secret; |
| | | |
| | | /** |
| | | * js_code |
| | | */ |
| | | @Schema(description = "js_code", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "js_code不能为空") |
| | | private String js_code; |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.result; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-21 16:13 |
| | | * @LastEditTime 2024-02-21 16:13 |
| | | * @Description |
| | | */ |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum WebChatResultCode { |
| | | /** |
| | | * 微信支付 |
| | | */ |
| | | DIVIDE_FAIL(10001, "分水房添加失败"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.util; |
| | | |
| | | import okhttp3.Call; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 15:22 |
| | | * @LastEditTime 2024-02-22 15:22 |
| | | * @Description |
| | | */ |
| | | |
| | | public interface ICallback { |
| | | void onSuccess(Call call, String data); |
| | | void onFail(Call call, String errorMsg); |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.util; |
| | | |
| | | import okhttp3.*; |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.SSLSocketFactory; |
| | | import javax.net.ssl.TrustManager; |
| | | import javax.net.ssl.X509TrustManager; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.security.SecureRandom; |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.Semaphore; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-22 13:39 |
| | | * @LastEditTime 2024-02-22 13:39 |
| | | * @Description |
| | | */ |
| | | |
| | | public class OkHttpUtil { |
| | | |
| | | private static volatile OkHttpClient okHttpClient = null; |
| | | private static volatile Semaphore semaphore = null; |
| | | private Map<String, String> headerMap; |
| | | private Map<String, Object> paramMap; |
| | | private String url; |
| | | private Request.Builder request; |
| | | private String body; |
| | | |
| | | private OkHttpUtil() { |
| | | if (Objects.isNull(okHttpClient)) { |
| | | synchronized (OkHttpUtil.class) { |
| | | if (Objects.isNull(okHttpClient)) { |
| | | TrustManager[] trustManagers = buildTrustManager(); |
| | | okHttpClient = new OkHttpClient.Builder() |
| | | .connectTimeout(15, TimeUnit.SECONDS) |
| | | .writeTimeout(20, TimeUnit.SECONDS) |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .sslSocketFactory(createSSLSocketFactory(trustManagers), (X509TrustManager)trustManagers[0]) |
| | | .hostnameVerifier((hostname, session) -> true) |
| | | .retryOnConnectionFailure(true) |
| | | .build(); |
| | | addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public OkHttpUtil initGet() { |
| | | request = new Request.Builder().get(); |
| | | StringBuilder builder = new StringBuilder(url); |
| | | if (Objects.nonNull(paramMap)) { |
| | | builder.append("?"); |
| | | paramMap.forEach((key, value) -> { |
| | | try { |
| | | builder.append(URLEncoder.encode(key, "utf-8")) |
| | | .append("=") |
| | | .append(URLEncoder.encode((String)value, "utf-8")) |
| | | .append("&"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | builder.deleteCharAt(builder.length() - 1); |
| | | } |
| | | request.url(builder.toString()); |
| | | return this; |
| | | } |
| | | |
| | | public OkHttpUtil initPost(boolean isJson) { |
| | | RequestBody requestBody = null; |
| | | if (isJson) { |
| | | requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), body); |
| | | } else { |
| | | FormBody.Builder formBody = new FormBody.Builder(); |
| | | if (Objects.nonNull(paramMap)) { |
| | | paramMap.forEach((x, y) -> formBody.add(x, (String) y)); |
| | | } |
| | | requestBody = formBody.build(); |
| | | } |
| | | request = new Request.Builder().post(requestBody).url(url); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * @Description:同步请求 |
| | | * @Author: zzc |
| | | * @Date: 2022-12-04 18:06 |
| | | * @return: java.lang.String |
| | | **/ |
| | | public String sync() throws Exception { |
| | | setHeader(request); |
| | | try { |
| | | Response result = okHttpClient.newCall(request.build()).execute(); |
| | | if (result.isSuccessful()) { |
| | | return result.body().string(); |
| | | } |
| | | throw new Exception(result.body().string()); |
| | | } catch (IOException e) { |
| | | throw new Exception(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @Description:异步请求,有返回值 |
| | | * @Author: zzc |
| | | * @Date: 2022-12-04 18:05 |
| | | * @return: java.lang.String |
| | | **/ |
| | | public String async() { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | setHeader(request); |
| | | okHttpClient.newCall(request.build()).enqueue(new Callback() { |
| | | @Override |
| | | public void onResponse(@NotNull okhttp3.Call call, @NotNull Response response) throws IOException { |
| | | if (Objects.nonNull(response.body())) { |
| | | buffer.append(response.body().string()); |
| | | getSemaphore().release(); |
| | | } |
| | | } |
| | | @Override |
| | | public void onFailure(@NotNull okhttp3.Call call, @NotNull IOException e) { |
| | | buffer.append("请求出错").append(e.getMessage()); |
| | | } |
| | | }); |
| | | try { |
| | | getSemaphore().acquire(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | private static Semaphore getSemaphore() { |
| | | synchronized (OkHttpUtil.class) { |
| | | if (Objects.isNull(semaphore)) { |
| | | semaphore = new Semaphore(0); |
| | | } |
| | | } |
| | | return semaphore; |
| | | } |
| | | |
| | | public static OkHttpUtil builder() { |
| | | return new OkHttpUtil(); |
| | | } |
| | | |
| | | public OkHttpUtil url(String url) { |
| | | this.url = url; |
| | | return this; |
| | | } |
| | | |
| | | public OkHttpUtil addParam(String key, String value) { |
| | | if (Objects.isNull(paramMap)) { |
| | | paramMap = new LinkedHashMap<>(16); |
| | | } |
| | | paramMap.put(key, value); |
| | | return this; |
| | | } |
| | | |
| | | public OkHttpUtil addBody(String body) { |
| | | this.body = body; |
| | | return this; |
| | | } |
| | | |
| | | public void setHeader(Request.Builder request) { |
| | | if (Objects.nonNull(headerMap)) { |
| | | headerMap.forEach(request::addHeader); |
| | | } |
| | | } |
| | | |
| | | public OkHttpUtil addHeader(String key, String value) { |
| | | if (Objects.isNull(headerMap)) { |
| | | headerMap = new LinkedHashMap<>(16); |
| | | } |
| | | headerMap.put(key, value); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * @Description:生成安全套接字工厂,用于Https请求的证书跳过 |
| | | * @Author: zzc |
| | | * @Date: 2022-11-30 16:03 |
| | | * @param trustManagers: |
| | | * @return: javax.net.ssl.SSLSocketFactory |
| | | **/ |
| | | //private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustManagers) { |
| | | // SSLSocketFactory sslSocketFactory = null; |
| | | // try { |
| | | // SSLContext ssl = SSLContext.getInstance("SSL"); |
| | | // ssl.init(null, trustManagers, new SecureRandom()); |
| | | // sslSocketFactory = ssl.getSocketFactory(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return sslSocketFactory; |
| | | //} |
| | | |
| | | private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustManagers) { |
| | | SSLSocketFactory sslSocketFactory = null; |
| | | try { |
| | | SSLContext ssl = SSLContext.getInstance("SSL"); |
| | | ssl.init(null, trustManagers, new SecureRandom()); |
| | | sslSocketFactory = ssl.getSocketFactory(); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return sslSocketFactory; |
| | | } |
| | | |
| | | private static TrustManager[] buildTrustManager() { |
| | | return new TrustManager[] { |
| | | new X509TrustManager() { |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { |
| | | } |
| | | |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { |
| | | } |
| | | |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return new X509Certificate[]{}; |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipirrWebChat.util; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.*; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-23 15:42 |
| | | * @LastEditTime 2024-02-23 15:42 |
| | | * @Description |
| | | */ |
| | | |
| | | @Component |
| | | public class RestTemplateUtil { |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | //@Qualifier("RestTemplateWithCert") |
| | | //@Resource |
| | | //private RestTemplate restTemplate; |
| | | |
| | | public JSONObject get(String url, Map<String, Object> queryParams) throws IOException { |
| | | return get(url, queryParams, new HashMap<>(1)); |
| | | } |
| | | |
| | | public JSONObject get(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException { |
| | | String tempUrl = setParamsByAppendUrl(queryParams, url); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headerParams.forEach(headers::add); |
| | | HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers); |
| | | ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class); |
| | | return JSONObject.parseObject(response.getBody()); |
| | | } |
| | | |
| | | public JSONObject get2(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException { |
| | | String tempUrl = setParamsByPath(queryParams, url); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headerParams.forEach(headers::add); |
| | | HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers); |
| | | ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class, queryParams); |
| | | return JSONObject.parseObject(response.getBody()); |
| | | } |
| | | |
| | | public JSONObject post(String url, String json, Map<String, String> headerParams) { |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headerParams.forEach(headers::add); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | headers.add("Accept", MediaType.APPLICATION_JSON.toString()); |
| | | HttpEntity<String> httpEntity = new HttpEntity<>(json, headers); |
| | | ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class); |
| | | return JSONObject.parseObject(response.getBody()); |
| | | } |
| | | |
| | | private String setParamsByPath(Map<String, Object> queryParams, String url) { |
| | | // url?id={id}&name={name} |
| | | if (queryParams == null || queryParams.isEmpty()) { |
| | | return url; |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | try { |
| | | for (Map.Entry<String, Object> entry : queryParams.entrySet()) { |
| | | sb.append("&").append(entry.getKey()).append("=").append("{").append(entry.getKey()).append("}"); |
| | | } |
| | | if (!url.contains("?")) { |
| | | sb.deleteCharAt(0).insert(0, "?"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return url + sb; |
| | | } |
| | | |
| | | private String setParamsByAppendUrl(Map<String, Object> queryParams, String url) { |
| | | // url?id=1&name=zzc |
| | | if (queryParams == null || queryParams.isEmpty()) { |
| | | return url; |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | try { |
| | | for (Map.Entry<String, Object> entry : queryParams.entrySet()) { |
| | | sb.append("&").append(entry.getKey()).append("="); |
| | | sb.append(entry.getValue()); |
| | | } |
| | | if (!url.contains("?")) { |
| | | sb.deleteCharAt(0).insert(0, "?"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return url + sb; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | |
| | | #actutor的web端口 |
| | | management: |
| | | server: |
| | | port: ${pipIrr.webchat.actutorPort} |
| | | #web服务端口,8086 |
| | | server: |
| | | port: ${pipIrr.webchat.webPort} |
| | | servlet: |
| | | context-path: /webchat #webchat访问上下文路径 |
| | | context-parameters: |
| | | #GenerateIdSetSuffixListener中应用,取值范围是0-99 |
| | | idSuffix: ${pipIrr.webchat.idSuffix} |
| | | #ConfigListener中应用 |
| | | #configFileNames: config-global.xml,config-demo.xml |
| New file |
| | |
| | | Configuration: |
| | | #status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出;可以设置成Off(关闭)或Error(只输出错误信息) |
| | | status: Error |
| | | |
| | | Properties: # 定义全局变量 |
| | | Property: |
| | | #日志文件存储的目录 |
| | | - name: log.path |
| | | value: ./logs |
| | | #日志文件存储名称 |
| | | - name: project.name |
| | | value: pipIrrBase |
| | | |
| | | #定义输出器,可以输出到控制台和文件. |
| | | Appenders: |
| | | #输出到控制台 |
| | | Console: |
| | | #Appender命名 |
| | | name: CONSOLE |
| | | target: SYSTEM_OUT |
| | | ThresholdFilter: |
| | | level: debug #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 |
| | | onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 |
| | | #日志内容样式 |
| | | PatternLayout: |
| | | #%n-换行 |
| | | #%m-日志内容,输出代码中指定的日志信息 |
| | | #%p-输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL |
| | | #%r-程序启动到现在的毫秒数 |
| | | #%%- 输出一个"%" 字符 |
| | | #%t-当前线程名 |
| | | #%d-日期和时间, 常用的格式有%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} |
| | | #%l-同%F%L%C%M |
| | | #%F-java源文件名 |
| | | #%L-java源码行数 |
| | | #%C-java类名,%C{1}输出最后一个元素 |
| | | #%M-java方法名 |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | # 输出到文件,超过10MB归档 |
| | | RollingFile: |
| | | - name: ROLLING_FILE |
| | | ignoreExceptions: false |
| | | fileName: ${log.path}/${project.name}.log |
| | | filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" |
| | | ThresholdFilter: |
| | | level: error #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 |
| | | onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 |
| | | #日志内容样式 |
| | | PatternLayout: |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | Policies: |
| | | SizeBasedTriggeringPolicy: |
| | | size: "10 MB" |
| | | DefaultRolloverStrategy: |
| | | max: 1000 |
| | | |
| | | Loggers: |
| | | Root: |
| | | level: info #日志输出级别,共有8个级别,按照从低到高为:all < trace < debug < info < warn < error < fatal < off |
| | | AppenderRef: #Root的子节点,用来指定该日志输出到哪个Appender. |
| | | - ref: CONSOLE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
| | | # 为包配置特殊的Log级别,方便调试, |
| | | # 不受Loggers.Root.level限制 |
| | | Logger: |
| | | - name: com.dy.pipIrrGlobal.daoSe |
| | | additivity: false #去除重复的log |
| | | level: debug #输出日志级别 |
| | | AppenderRef: |
| | | - ref: CONSOLE #输出日志时,首先由本.level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
| New file |
| | |
| | | package com.dy.pipirrWebChat; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | @SpringBootTest |
| | | class PipIrrWebWebchatApplicationTests { |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | } |
| | | |
| | | } |
| | |
| | | <module>pipIrr-web-gis</module> |
| | | <module>pipIrr-web-sell</module> |
| | | <module>pipIrr-web-project</module> |
| | | <module>pipIrr-web-webchat</module> |
| | | </modules> |
| | | |
| | | <dependencies> |