Merge remote-tracking branch 'origin/master'
3 文件已重命名
3个文件已删除
33个文件已添加
121个文件已修改
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-websocket</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | package com.ruoyi.system.api; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | import com.ruoyi.system.api.factory.RemoteFileFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | import com.ruoyi.system.api.factory.RemoteFileFallbackFactory; |
| | | |
| | | /** |
| | | * 文件服务 |
| | |
| | | */ |
| | | @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file); |
| | | |
| | | @PostMapping(value = "/obs/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public R<String> obsUpload(@RequestPart("file") MultipartFile file); |
| | | } |
| | |
| | | @ApiModelProperty(value = "支付合计") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty(value = "订单状态 1=待支付 2=待发货 3=待收货 4=已完成 5=已取消 6=售后中 7=已退款 8=已退款退货") |
| | | @ApiModelProperty(value = "订单状态 1=待支付 2=待发货 3=待收货 4=已完成 5=已取消 6=售后中") |
| | | private OrderStatusEnum orderStatus; |
| | | |
| | | @ApiModelProperty(value = "支付时间") |
| | |
| | | package com.ruoyi.system.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import com.ruoyi.common.core.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.core.web.domain.BaseEntity; |
| | | import java.util.Set; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import com.ruoyi.common.core.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.core.web.domain.BaseEntity; |
| | | |
| | | /** |
| | | * 角色表 sys_role |
| | |
| | | @TableField(exist = false) |
| | | private Set<String> permissions; |
| | | |
| | | /** 车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限 */ |
| | | private Integer carDataAuth; |
| | | |
| | | /** 车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限 */ |
| | | private Integer carTrainOperAuth; |
| | | |
| | | /** 合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限 */ |
| | | private Integer contractDataAuth; |
| | | |
| | | /** 公司id */ |
| | | private Integer companyId; |
| | | |
| | | |
| | | |
| | | public SysRole() |
| | | { |
| | |
| | | public SysRole(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public Integer getCarDataAuth() { |
| | | return carDataAuth; |
| | | } |
| | | |
| | | public void setCarDataAuth(Integer carDataAuth) { |
| | | this.carDataAuth = carDataAuth; |
| | | } |
| | | |
| | | public Integer getCarTrainOperAuth() { |
| | | return carTrainOperAuth; |
| | | } |
| | | |
| | | public void setCarTrainOperAuth(Integer carTrainOperAuth) { |
| | | this.carTrainOperAuth = carTrainOperAuth; |
| | | } |
| | | |
| | | public Integer getContractDataAuth() { |
| | | return contractDataAuth; |
| | | } |
| | | |
| | | public void setContractDataAuth(Integer contractDataAuth) { |
| | | this.contractDataAuth = contractDataAuth; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | |
| | | /** |
| | | * 角色类型 1=平台 2=公司 3=门店 4=修理厂 |
| | | */ |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=公司 3=门店 4=修理厂") |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=公司 3=门店 4=修理厂", hidden = true) |
| | | private Integer roleType; |
| | | |
| | | @Excel(name = "密码修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "角色名称") |
| | | @TableField(exist = false) |
| | | private String roleName; |
| | | |
| | | @ApiModelProperty(value = "是否为拍卖师 1=否 2=是") |
| | | @TableField(exist = false) |
| | | private Integer isAuctioneer; |
| | | @Override |
| | | public String getRemark() { |
| | | return remark; |
New file |
| | |
| | | package com.ruoyi.system.api.domain; |
| | | |
| | | import com.ruoyi.common.core.enums.ClientTypeEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/21 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @ApiModel(value = "websocket消息传输对象", description = "websocket消息传输对象") |
| | | public class WebsocketMessageDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 5118829583970565292L; |
| | | |
| | | /** |
| | | * 客户端类型 |
| | | */ |
| | | private ClientTypeEnum clientType; |
| | | /** |
| | | * 消息 |
| | | */ |
| | | private String message; |
| | | } |
File was renamed from ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtAfterSaleSettingDTO.java |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | package com.ruoyi.system.api.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModel(value = "售后订单传输对象", description = "售后订单传输对象") |
| | | public class OrderReturnDTO { |
| | | @ApiModelProperty(value = "数据id") |
| | | private Integer id; |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | |
| | | private String requestReason; |
| | | |
| | | @ApiModelProperty(value = "详情图,不超过五张图片") |
| | | private MultipartFile[] album; |
| | | private String album; |
| | | |
| | | @ApiModelProperty(value = "快递单号") |
| | | private String courierNumber; |
| | | |
| | | |
| | | @ApiModelProperty(value = "快递公司编号") |
| | | private String Logistics; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String unit; |
| | | |
| | | @ApiModelProperty(value = "最高出价") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private BigDecimal zgBid; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品描述") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "商品说明") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String explain; |
| | | |
| | | @ApiModelProperty(value = "商品介绍") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String detail; |
| | | |
| | | @ApiModelProperty(value = "商品年份") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String years; |
| | | private LocalDateTime years; |
| | | |
| | | @ApiModelProperty(value = "商品分类") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | |
| | | @ApiModelProperty(value = "分享图片") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String sharePic; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "保证金") |
| | | private BigDecimal bond; |
| | | |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String album; |
| | | |
| | | @ApiModelProperty(value = "分享标题") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String shareTitle; |
| | | |
| | | @ApiModelProperty(value = "分享图片") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String sharePic; |
| | | |
| | | @ApiModelProperty(value = "是否出价 1未出价,2出价") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Integer isBond; |
| | |
| | | @ApiModelProperty(value = "当前出价") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private BigDecimal presentBid; |
| | | |
| | | @ApiModelProperty(value = "最高出价") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private BigDecimal zgBid; |
| | | |
| | | @ApiModelProperty(value = "最低加价金额") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String detail; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String orderNo; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品说明") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String explain; |
| | | |
| | | |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private List<ForepartAuctionSalesroomGoodsVO> elseAuctionSalesroomGoods; |
| | | |
| | | @ApiModelProperty(value = "商品信息") |
| | | private List<getHomeGoodsSkuXxiVO> xiq; |
| | | |
| | | } |
| | |
| | | private String com; |
| | | private String state; |
| | | private String status; |
| | | private String logisticsName; |
| | | private List<LogisticsInfoVO> data; |
| | | } |
| | |
| | | import com.ruoyi.common.core.enums.GroupStatusEnum; |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import com.ruoyi.common.core.enums.StartStatusEnum; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Integer isGoodsGroupPurchase; |
| | | |
| | | @ApiModelProperty(value = "團購商品訂單") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Order order; |
| | | |
| | | @ApiModelProperty(value = "是收藏 1未收藏,2收藏") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Integer isCollection; |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private ReturnRequestStatusEnum status; |
| | | |
| | | @ApiModelProperty(value = "是否售后") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Integer isRequest; |
| | | |
| | | @ApiModelProperty(value = "售后订单") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Long requestId; |
| | | |
| | | @ApiModelProperty(value = "快递单号") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String courierNumber; |
| | | |
| | | @ApiModelProperty("发货快递") |
| | | private String logisticsNum; |
| | | |
| | | |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private String courierNumber; |
| | | |
| | | @ApiModelProperty("发货快递") |
| | | private String logisticsNum; |
| | | |
| | | @ApiModelProperty("退货时间") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private LocalDateTime returnTime; |
| | | |
| | | @ApiModelProperty("平台收货时间") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private LocalDateTime platformReceiptTime; |
| | | |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private LocalDateTime purchase; |
| | | |
| | | @ApiModelProperty(value = "是否售后") |
| | | @ApiModelProperty(value = "是否售后 1否,2 是") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Integer isRequest; |
| | | |
| | |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Integer isAuctionBond; |
| | | |
| | | @ApiModelProperty(value = "售后订单") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Long requestId; |
| | | |
| | | @ApiModelProperty("发货快递") |
| | | private String logisticsNum; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.AppMiniLoginVO; |
| | | import com.ruoyi.system.api.domain.AuctionGoods; |
| | | import com.ruoyi.system.api.domain.AuctionSalesroom; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO; |
| | | import com.ruoyi.system.api.domain.dto.BondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<OrderAuctionBond> getBond(BondDTO BondVO, String source) { |
| | | return R.fail("获取保证金支付状态失败" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<AuctionSalesroom>> getAuctionSalesroomByIds( |
| | | Collection<Long> auctionSalesroomGoodsIdSet, String source) { |
| | | return R.fail("获取拍卖场列表失败" + cause.getMessage()); |
| | |
| | | import com.ruoyi.common.core.enums.BondStatusEnum; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.RefundDTO; |
| | | import com.ruoyi.system.api.domain.vo.OrderVO; |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | |
| | | @Override |
| | | public R<Boolean> saveOrderOne(OrderDTO orderDTO, String source) { |
| | | return R.fail("保存订单失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Order> getOrderOne(OrderDTO orderDTO, String source) { |
| | | return R.fail("获取订单失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Order> getOrderOne1(OrderDTO orderDTO, String source) { |
| | | return R.fail("获取订单失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return R.fail("普通拍卖获取保证金失败" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<?> returnBondByAuctionGoodsId(Long id, String source) { |
| | | return R.fail("普通拍卖退保证金失败" + cause.getMessage()); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.RemoteFileService; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.RemoteFileService; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | |
| | | /** |
| | | * 文件服务降级处理 |
| | |
| | | { |
| | | return R.fail("上传文件失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> obsUpload(MultipartFile file) { |
| | | return R.fail("obs上传文件失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.DelayTask; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import java.util.List; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public R<List<SysUser>> getUserListByName(SysUser sysUser, String source) { |
| | | return R.fail("获取系统用户失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<MgtAfterSaleSettingDTO> getAfterSaleSetting() { |
| | | return R.fail("获取售后设置失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<?> pushByClientType(WebsocketMessageDTO dto, String source) { |
| | | return R.fail("向" + dto.getClientType().getDesc() + "发送websocket消息失败:" |
| | | + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<?> pushAll(String message, String source) { |
| | | return R.fail("向所有用户发送websocket消息失败:" |
| | | + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.AppMiniLoginVO; |
| | | import com.ruoyi.system.api.domain.AuctionGoods; |
| | | import com.ruoyi.system.api.domain.AuctionSalesroom; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO; |
| | | import com.ruoyi.system.api.domain.dto.BondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | |
| | | @PostMapping("/order-auction-bond/UpdateBond") |
| | | R<?> UpdateBond(@RequestBody BondDTO BondVO, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | @PostMapping("/order-auction-bond/getBond") |
| | | R<OrderAuctionBond> getBond(@RequestBody BondDTO BondVO, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | @PostMapping("/auction-salesroom/list-by-ids") |
| | | R<List<AuctionSalesroom>> getAuctionSalesroomByIds( |
| | | @RequestBody Collection<Long> auctionSalesroomGoodsIdSet, |
| | |
| | | import com.ruoyi.common.core.enums.BondStatusEnum; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.RefundDTO; |
| | | import com.ruoyi.system.api.domain.vo.OrderVO; |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import com.ruoyi.system.api.factory.OrderFallbackFactory; |
| | |
| | | |
| | | @PostMapping("/order/saveOrderOne") |
| | | R<Boolean> saveOrderOne(@RequestBody OrderDTO orderDTO, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | |
| | | @PostMapping("/order/getOrderOne") |
| | | R<Order> getOrderOne(@RequestBody OrderDTO orderDTO, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | @PostMapping("/order/getOrderOne1") |
| | | R<Order> getOrderOne1(@RequestBody OrderDTO orderDTO, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | |
| | |
| | | @PostMapping("/order/list-by-coupon") |
| | | R<List<Order>> getOrderByCouponIds(@RequestBody Collection<Long> couponIds, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | /** |
| | | * 拍卖商品退保证金 |
| | | * |
| | | * @param id 拍卖商品id |
| | | * @param source 内部调用标志 |
| | | */ |
| | | @GetMapping("/order-auction-bond/refund-bond/{id}") |
| | | R<?> returnBondByAuctionGoodsId(@PathVariable("id") Long id, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.DelayTask; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.api.factory.SysUserFallbackFactory; |
| | | import java.util.List; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | @GetMapping("/user/list-by-name") |
| | | R<List<SysUser>> getUserListByName(@RequestBody SysUser sysUser, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | @GetMapping("/custom-config/get-after-sale-setting") |
| | | R<MgtAfterSaleSettingDTO> getAfterSaleSetting(); |
| | | |
| | | @PostMapping("/websocket/push-by-client-type") |
| | | R<?> pushByClientType(@RequestBody WebsocketMessageDTO dto, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | @GetMapping("/websocket/push-all/{message}") |
| | | R<?> pushAll(@PathVariable("message") String message, |
| | | @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | } |
File was renamed from ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/validate/ModifyGroup.java |
| | |
| | | * @date 2024/6/9 |
| | | * <p>编辑数据校验分组</p> |
| | | */ |
| | | public interface ModifyGroup { |
| | | public interface UpdateGroup { |
| | | |
| | | } |
| | |
| | | import com.ruoyi.auth.form.LoginBody; |
| | | import com.ruoyi.auth.form.RegisterBody; |
| | | import com.ruoyi.auth.service.SysLoginService; |
| | | import com.ruoyi.auth.utils.JuTongDaSMSUtil; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO; |
| | | import com.ruoyi.system.api.domain.dto.AppMiniRegisterDTO; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | { |
| | | // 用户登录 |
| | | LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); |
| | | SysUser sysUser1 = userInfo.getSysUser(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token",tokenService.createToken(userInfo)); |
| | | List<SysRole> roles = userInfo.getSysUser().getRoles(); |
| | | List<SysRole> roles = sysUser1.getRoles(); |
| | | if (Objects.equals("00", sysUser1.getUserType())) { |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return R.fail("请关联角色!"); |
| | | } |
| | | |
| | | map.put("roleName",roles.get(0).getRoleName()); |
| | | } |
| | | |
| | | map.put("info",userInfo); |
| | | map.put("userType", sysUser1.getUserType()); |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(userInfo.getSysUser().getUserId()); |
| | | sysUser.setUserId(sysUser1.getUserId()); |
| | | sysUser.setLoginDate(new Date()); |
| | | System.out.println("修改用户登录时间"+sysUser); |
| | | userClient.updateSysUser(sysUser); |
| | |
| | | @GetMapping("send-verification-code") |
| | | @ApiOperation(value = "管理后台-发送验证码") |
| | | public R<?> changePassword(@RequestParam("username") String username) { |
| | | Boolean result = redisService.hasKey( |
| | | CacheConstants.CHANGE_PASSWORD_CAPTCHA_CODE_KEY + username); |
| | | if (result) { |
| | | throw new ServiceException("请勿重复发送验证码"); |
| | | } |
| | | //校验手机号码 |
| | | SysUser sysUser = userClient.queryUserByUserName(username).getData(); |
| | | if (StringUtils.isNull(sysUser)) { |
| | |
| | | } |
| | | String code = RandomUtil.randomNumbers(6); |
| | | try { |
| | | //TODO 发送短信未配置 |
| | | // HuaWeiSMSUtil.sendSms(code, sysUser.getUserName(), "8823121426646", |
| | | // "cf1707ec44694627b1b483b0277e12fd"); |
| | | JuTongDaSMSUtil.smsSend(sysUser.getUserName(), code, "", ""); |
| | | } catch (Exception e) { |
| | | log.error("【修改密码】发送短信失败", e); |
| | | return R.fail("发送失败"); |
New file |
| | |
| | | package com.ruoyi.auth.utils; |
| | | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.PrintWriter; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.Base64; |
| | | |
| | | /** |
| | | * 聚通达短信发送工具类 |
| | | * |
| | | * @author mitao |
| | | * @date 2024/6/17 |
| | | */ |
| | | public class JuTongDaSMSUtil { |
| | | |
| | | private static final String UID = "201000"; |
| | | private static final String PWD = "926893"; |
| | | private static final String template = "【酒鼎老酒】您的验证码为:${code},该验证码5分钟内有效,请勿泄露于他人!"; |
| | | |
| | | public static void main(String[] args) { |
| | | String moblies = "18283820718"; |
| | | String content = "123456"; |
| | | String ext = ""; |
| | | String attime = ""; |
| | | String result = JuTongDaSMSUtil.smsSend(moblies, content, ext, attime); |
| | | System.out.println("result=" + result); |
| | | } |
| | | |
| | | // 发送短信 |
| | | public static String smsSend(String mobile, String content, |
| | | String ext, String attime) { |
| | | String errMess = ""; |
| | | StringBuffer sendData = new StringBuffer(""); |
| | | try { |
| | | sendData.append("uid=").append(UID); // 用户名 |
| | | String pwd = getMD5(PWD);// 原始密码做MD5加密,32位大写格式 |
| | | sendData.append("&password=").append(pwd); // 密码 |
| | | |
| | | sendData.append("&encode=").append("GBK"); // encode=GBK或者encode=utf8 |
| | | content = template.replace("${code}", content); |
| | | String contentBase64 = Base64.getEncoder() |
| | | .encodeToString(content.getBytes("gbk"));// 先用encode中定义的格式编码,再用base64加密内容 |
| | | sendData.append("&encodeType=base64"); // 固定 |
| | | sendData.append("&content=").append(contentBase64); // base64加密后的内容 |
| | | |
| | | sendData.append("&mobile=").append(mobile); // 手机号 |
| | | // sendData.append("&cid=").append("45955855252252555"); // 唯一标识,选填,如果不填系统自动生成作为当前批次的唯一标识 |
| | | if (!StringUtils.isNotBlank(ext)) { |
| | | sendData.append("&extNumber=").append(ext); // 扩展 |
| | | } |
| | | |
| | | if (!StringUtils.isNotBlank(attime)) { |
| | | sendData.append("&schtime=").append(attime); // 定时时间,选填,格式2008-06-09 12:00:00 |
| | | } |
| | | errMess = sendPost("https://sms3api.jvtd.cn/jtdsms/smsSend", |
| | | sendData.toString());// 普通短信 |
| | | // errMess =sendPost("http://ip:8090/jtdsms/sendData.do", sendData.toString());//个性短信 |
| | | } catch (Exception e) { |
| | | errMess = "-601"; |
| | | } |
| | | return errMess; |
| | | } |
| | | |
| | | |
| | | public static String sendPost(String url, String param) { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | String result = ""; |
| | | try { |
| | | URL realUrl = new URL(url); |
| | | // 打开和URL之间的连接 |
| | | URLConnection conn = realUrl.openConnection(); |
| | | // 设置通用的请求属性 |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", |
| | | "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | // 发送POST请求必须设置如下两行 |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | // 获取URLConnection对象对应的输出流 |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | // 发送请求参数 |
| | | out.print(param); |
| | | // flush输出流的缓冲 |
| | | out.flush(); |
| | | // 定义BufferedReader输入流来读取URL的响应 |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream())); |
| | | String line; |
| | | while ((line = in.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("发送 POST 请求出现异常!" + e); |
| | | e.printStackTrace(); |
| | | } |
| | | // 使用finally块来关闭输出流、输入流 |
| | | finally { |
| | | try { |
| | | if (out != null) { |
| | | out.close(); |
| | | } |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (IOException ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public static String getMD5(String sourceStr) { |
| | | String resultStr = ""; |
| | | try { |
| | | byte[] temp = sourceStr.getBytes(); |
| | | MessageDigest md5 = MessageDigest.getInstance("MD5"); |
| | | md5.update(temp); |
| | | byte[] b = md5.digest(); |
| | | for (int i = 0; i < b.length; i++) { |
| | | char[] digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', |
| | | '9', 'A', 'B', 'C', 'D', 'E', 'F'}; |
| | | char[] ob = new char[2]; |
| | | ob[0] = digit[(b[i] >>> 4) & 0X0F]; |
| | | ob[1] = digit[b[i] & 0X0F]; |
| | | resultStr += new String(ob); |
| | | } |
| | | return resultStr; |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | GOODS_TO_BE_RECEIVED(3, "待收货"), |
| | | FINISHED(4, "已完成"), |
| | | CANCELED(5, "已取消"), |
| | | AFTER_SALE(6, "售后中"), |
| | | REFUNDED(7, "已退款"), |
| | | REFUNDED_AND_RETURNED(8, "已退货退款"); |
| | | AFTER_SALE(6, "售后中"); |
| | | |
| | | @EnumValue |
| | | private final int code; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static boolean isMallOrder(OrderTypeEnum type) { |
| | | return type.getCode() == MALL_ODER.getCode(); |
| | | } |
| | | |
| | | public static boolean isAuctionOrder(OrderTypeEnum type) { |
| | | return type.getCode() == AUCTION_ORDER.getCode(); |
| | | } |
| | | } |
| | |
| | | TO_BE_RETURNED(2, "待退货"), |
| | | TO_BE_RECEIVED_BY_THE_PLATFORM(3, "待平台收货"), |
| | | COMPLETED(4, "已完成"), |
| | | REJECTED(5, "已拒绝"); |
| | | REJECTED(5, "已拒绝"), |
| | | QX(6, "已拒绝"); |
| | | @EnumValue |
| | | private final int code; |
| | | @JsonValue |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TimeTypeEnum { |
| | | TODAY(1, "今天"), |
| | | PAST_SEVEN_DAYS(2, "最近7天"), |
| | | PAST_THIRTY_DAYS(3, "最近30天"), |
| | | CUSTOM(4, "自定义"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | public static TimeTypeEnum getEnumByCode(Integer code) { |
| | | for (TimeTypeEnum e : TimeTypeEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | |
| | | return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); |
| | | return "0:0:0:0:0:0:0:1".equals(ip) ? "192.168.110.188" : getMultistageReverseProxyIp(ip); |
| | | } |
| | | |
| | | /** |
| | |
| | | public static boolean internalIp(String ip) |
| | | { |
| | | byte[] addr = textToNumericFormatV4(ip); |
| | | return internalIp(addr) || "127.0.0.1".equals(ip); |
| | | return internalIp(addr) || "192.168.110.188".equals(ip); |
| | | } |
| | | |
| | | /** |
| | |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "127.0.0.1"; |
| | | return "192.168.110.188"; |
| | | } |
| | | |
| | | /** |
| | |
| | | // 1.创建配置 |
| | | Config config = new Config(); |
| | | // 集群模式 |
| | | // config.useClusterServers().addNodeAddress("127.0.0.1:7004", "127.0.0.1:7001"); |
| | | // config.useClusterServers().addNodeAddress("192.168.110.188:7004", "192.168.110.188:7001"); |
| | | // 2.根据 Config 创建出 RedissonClient 示例。 |
| | | config.useSingleServer().setAddress("redis://192.168.110.188:6379").setPassword("123456"); |
| | | return Redisson.create(config); |
| | |
| | | page = this.lambdaQuery() |
| | | .eq(ArticleComments::getArticleId, query.getArticleId()) |
| | | .in(StringUtils.isNotEmpty(memberIdSet), ArticleComments::getMemberId, memberIdSet) |
| | | .orderByDesc(ArticleComments::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | result = PageDTO.empty(page); |
| | |
| | | PageDTO<MgtSensitiveWordsVO> pageVO; |
| | | Page<SensitiveWords> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(query.getWord()), SensitiveWords::getWord, |
| | | query.getWord()).page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | query.getWord()).orderByDesc(SensitiveWords::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | pageVO = PageDTO.empty(page); |
| | | } else { |
| | |
| | | @Bean |
| | | public WxMaConfig memberWxMaConfig(){ |
| | | WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
| | | config.setAppid("wxe91f1af7638aa5dd"); |
| | | config.setSecret("a787e1a462715604e0c9528b6d8960d1"); |
| | | config.setAppid("wx69e3ac6e13a889b7"); |
| | | config.setSecret("1b8bcfcb681524ac553e72054e5271ef"); |
| | | return config; |
| | | } |
| | | } |
| | |
| | | @ApiOperation("结束当前拍卖商品") |
| | | public R<?> stopCurrentGoods( |
| | | @ApiParam(name = "id", value = "拍卖场商品id", required = true) @PathVariable("id") Long id) { |
| | | try { |
| | | auctionSalesroomService.stopCurrentGoods(id); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ApiOperation("开始下一拍卖商品") |
| | | public R<?> startNextGoods( |
| | | @ApiParam(name = "id", value = "拍卖场商品id", required = true) @PathVariable("id") Long id) { |
| | | try { |
| | | auctionSalesroomService.startNextGoods(id); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param id 拍卖场商品id |
| | | */ |
| | | void stopCurrentGoods(Long id); |
| | | void stopCurrentGoods(Long id) throws JsonProcessingException; |
| | | |
| | | /** |
| | | * 开始下一拍卖商品 |
| | | * |
| | | * @param id 拍卖场商品id |
| | | */ |
| | | void startNextGoods(Long id); |
| | | void startNextGoods(Long id) throws JsonProcessingException; |
| | | |
| | | /** |
| | | * 播放视频 |
| | |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import com.ruoyi.common.core.enums.OrderFromEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.system.api.constants.ConfigEnum; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.AuctionGoods; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.Member; |
| | | import com.ruoyi.system.api.domain.MemberAddress; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListPageDTO; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | |
| | | private final GoodsSkuClient goodsSkuClient; |
| | | private final MemberClient memberClient; |
| | | private final OrderClient orderClient; |
| | | private final SysUserClient sysUserClient; |
| | | |
| | | private final AuctionClient auctionClient; |
| | | private final IAuctionBidRecordService auctionBidRecordService; |
| | |
| | | query.getListingStatus()) |
| | | .eq(StringUtils.isNotNull(query.getStartStatus()), AuctionGoods::getStartStatus, |
| | | query.getStartStatus()) |
| | | .orderByDesc(AuctionGoods::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | |
| | | auctionBidRecordService.updateById(auctionBidRecord); |
| | | memberId = auctionBidRecord.getMemberId(); |
| | | // 创建待支付订单 |
| | | CustomConfig moneyConfig = sysUserClient.getconfig( |
| | | ConfigEnum.MEMBER_POINTS_MONEY.getKey()).getData(); |
| | | CustomConfig pointsConfig = sysUserClient.getconfig( |
| | | ConfigEnum.MEMBER_POINTS_POINTS.getKey()).getData(); |
| | | double ratio = |
| | | Double.parseDouble( |
| | | pointsConfig.getConfigValue()) / Double.parseDouble( |
| | | moneyConfig.getConfigValue()); |
| | | OrderDTO orderDTO = new OrderDTO(); |
| | | orderDTO.setAuctionType(AuctionOrderTypeEnum.REGULAR_ITEMS); |
| | | orderDTO.setGoodsQuantity(auctionGoods.getAuctionStock()); |
| | |
| | | orderDTO.setTotalAmount(auctionBidRecord.getLastBidAmount()); |
| | | orderDTO.setOrderFrom(OrderFromEnum.AUCTION_ORDERS); |
| | | orderDTO.setOrderTime(LocalDateTime.now()); |
| | | orderDTO.setPoints(auctionBidRecord.getLastBidAmount() |
| | | .multiply(BigDecimal.valueOf(ratio)).intValue()); |
| | | MemberAddress data = memberClient.getMemberAddressOne( |
| | | auctionBidRecord.getMemberId(), SecurityConstants.INNER).getData(); |
| | | if (StringUtils.isNotNull(data)) { |
| | |
| | | auctionGoodsinfoVO.setStartTime(byId.getStartTime()); |
| | | auctionGoodsinfoVO.setEndTime(byId.getEndTime()); |
| | | auctionGoodsinfoVO.setUnit(goodsSkuOne.getUnit()); |
| | | auctionGoodsinfoVO.setBond(byId.getBond()); |
| | | auctionGoodsinfoVO.setDescription(goodsSkuOne.getDescription()); |
| | | auctionGoodsinfoVO.setYears(String.valueOf(goodsSkuOne.getYears())); |
| | | auctionGoodsinfoVO.setYears(goodsSkuOne.getYears()); |
| | | GoodsBrand data = goodsSkuClient.getBrandOne(goodsSkuOne.getBrandId(), SecurityConstants.INNER).getData(); |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(goodsSkuOne.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(goodsSkuOne.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(goodsSkuOne.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | if (data!=null){ |
| | | auctionGoodsinfoVO.setBrand(data.getBrandName()); |
| | | } |
| | | if (data1!=null){ |
| | | auctionGoodsinfoVO.setCategory(data1.getCategoryName()); |
| | | } |
| | | if (data2!=null){ |
| | | auctionGoodsinfoVO.setSeries(data2.getSeriesName()); |
| | | } |
| | | if (data3!=null) { |
| | | auctionGoodsinfoVO.setFlavorType(data3.getFlavorTypeName()); |
| | | } |
| | | auctionGoodsinfoVO.setCoverPic(goodsSkuOne.getCoverPic()); |
| | | auctionGoodsinfoVO.setAlbum(goodsSkuOne.getAlbum()); |
| | | auctionGoodsinfoVO.setAuthentication(byId.getAuthentication()); |
| | |
| | | auctionGoodsinfoVO.setShareTitle(goodsSkuOne.getShareTitle()); |
| | | auctionGoodsinfoVO.setSpecUnit(goodsSkuOne.getSpecUnit()); |
| | | auctionGoodsinfoVO.setDetail(goodsSkuOne.getDetail()); |
| | | auctionGoodsinfoVO.setYears(String.valueOf(goodsSkuOne.getYears())); |
| | | auctionGoodsinfoVO.setBond(byId.getBond()); |
| | | auctionGoodsinfoVO.setYears(goodsSkuOne.getYears()); |
| | | auctionGoodsinfoVO.setSharePic(goodsSkuOne.getSharePic()); |
| | | auctionGoodsinfoVO.setShareTitle(goodsSkuOne.getShareTitle()); |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionGoodsListDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionType,1); |
| | | wrapper1.eq(AuctionBidRecord::getTargetId,byId.getId()); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionGoodsListDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getDelFlag,0); |
| | | AuctionBidRecord list1 = auctionBidRecordService.getOne(wrapper1); |
| | | if (list1!=null){ |
| | |
| | | auctionGoodsinfoVO.setPresentBid(list1.getLastBidAmount()); |
| | | if (list1.getStatus().getCode()==2){ |
| | | auctionGoodsinfoVO.setIsStatus(2); |
| | | |
| | | OrderDTO orderDTO =new OrderDTO(); |
| | | orderDTO.setMemberId(auctionGoodsListDTO.getMemberId()); |
| | | orderDTO.setGoodsSkuId(byId.getId()); |
| | | Order data4 = orderClient.getOrderOne1(orderDTO, SecurityConstants.INNER).getData(); |
| | | if (data4!=null){ |
| | | auctionGoodsinfoVO.setOrderId(data4.getId()); |
| | | auctionGoodsinfoVO.setOrderNo(data4.getOrderNo()); |
| | | } |
| | | }else{ |
| | | auctionGoodsinfoVO.setIsStatus(1); |
| | | } |
| | |
| | | } |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | String formattedDate = now.format(formatter); |
| | | LocalDateTime parseTime = LocalDateTime.parse(formattedDate, formatter); |
| | | LocalDateTime newTime7 = now.minusDays(7); |
| | | String formattedDate7 = newTime7.format(formatter); |
| | | LocalDateTime parseTime7 = LocalDateTime.parse(formattedDate7, formatter); |
| | | |
| | | LambdaQueryWrapper<AuctionBrowseRecord> wrapper3=Wrappers.lambdaQuery(); |
| | | wrapper3.eq(AuctionBrowseRecord::getDelFlag,0); |
| | | wrapper3.eq(AuctionBrowseRecord::getTargetId,auctionGoodsListDTO.getGoodsSkuId()); |
| | | wrapper3.eq(AuctionBrowseRecord::getMemberId,auctionGoodsListDTO.getMemberId()); |
| | | wrapper3.ge(AuctionBrowseRecord::getCreateTime, parseTime7) |
| | | .le(AuctionBrowseRecord::getCreateTime, parseTime); |
| | | wrapper3.ge(AuctionBrowseRecord::getCreateTime, newTime7) |
| | | .le(AuctionBrowseRecord::getCreateTime, now); |
| | | List<AuctionBrowseRecord> list = iAuctionBrowseRecordService.list(wrapper3); |
| | | if (list.size()==0){ |
| | | AuctionBrowseRecord auctionBrowseRecord=new AuctionBrowseRecord(); |
| | |
| | | iAuctionBrowseRecordService.save(auctionBrowseRecord); |
| | | } |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper5= Wrappers.lambdaQuery(); |
| | | wrapper5.eq(AuctionBidRecord::getAuctionType,1); |
| | | wrapper5.eq(AuctionBidRecord::getTargetId,byId.getId()); |
| | | wrapper5.eq(AuctionBidRecord::getDelFlag,0); |
| | | AuctionBidRecord list5 = auctionBidRecordService.getOne(wrapper5); |
| | | if (list5!=null){ |
| | | auctionGoodsinfoVO.setZgBid(list5.getLastBidAmount()); |
| | | } |
| | | |
| | | |
| | | CustomConfig returnAddressUserName = sysUserClient.getconfig("MALL_ORDER_DESCRIPTION").getData(); |
| | | auctionGoodsinfoVO.setExplain(returnAddressUserName.getConfigValue()); |
| | | return auctionGoodsinfoVO; |
| | | } |
| | | |
| | |
| | | if (StringUtils.isNotNull(auctionGoods) && auctionGoods.getListingStatus().equals( |
| | | ListingStatusEnum.ON_SHELVES) && auctionGoods.getStartStatus() |
| | | .equals(AuctionStartStatusEnum.IN_AUCTION)) { |
| | | this.lambdaUpdate().set(AuctionGoods::getStartStatus, AuctionStartStatusEnum.ENDED) |
| | | .eq(AuctionGoods::getId, id); |
| | | auctionGoods.setStartStatus(AuctionStartStatusEnum.ENDED); |
| | | this.updateById(auctionGoods); |
| | | // TODO 退保证金 |
| | | orderClient.returnBondByAuctionGoodsId(id, SecurityConstants.INNER); |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_GOODS); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", id); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(1, msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | } |
| | |
| | | if (StringUtils.isNotNull(auctionGoods) && auctionGoods.getListingStatus().equals( |
| | | ListingStatusEnum.ON_SHELVES) && auctionGoods.getStartStatus() |
| | | .equals(AuctionStartStatusEnum.IN_PREVIEW)) { |
| | | this.lambdaUpdate().set(AuctionGoods::getStartStatus, AuctionStartStatusEnum.IN_AUCTION) |
| | | .eq(AuctionGoods::getId, id); |
| | | auctionGoods.setStartStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | this.updateById(auctionGoods); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_GOODS); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", id); |
| | | map.put("message_type", "start"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | } |
| | |
| | | auctionGoods.setListingStatus(dto.getListingStatus()); |
| | | this.updateById(auctionGoods); |
| | | } |
| | | |
| | | public static void main(String[] args) throws JsonProcessingException { |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_GOODS); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", 1); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | System.out.println(msg); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.AuctionStartStatusEnum; |
| | | import com.ruoyi.common.core.enums.BidStatusEnum; |
| | | import com.ruoyi.common.core.enums.ClientTypeEnum; |
| | | import com.ruoyi.common.core.enums.OrderFromEnum; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.AuctionSalesroom; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | | import com.ruoyi.system.api.domain.GoodsSeries; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.Member; |
| | | import com.ruoyi.system.api.domain.MemberAddress; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomGoodsInfoDTO; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionBidRecordVO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionSalesroomGoodsInfoVO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionSalesroomVO; |
| | | import com.ruoyi.system.api.domain.vo.ForepartAuctionSalesroomGoodsVO; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods.getId()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | currentAuctionSalesroomGoods.setStartTime(auctionSalesroomGoods.getStartTime()); |
| | | currentAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoods.getStatus()); |
| | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | if (auctionSalesroomGoods!=null) { |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum, auctionSalesroomGoods.getSortNum() + 1); |
| | | list.add(auctionSalesroomGoods.getSortNum()+1); |
| | |
| | | auctionSalesroomGoodss.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoodss.getGoodsSkuId()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoodss.getId()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | currentAuctionSalesroomGoods.setStartTime(auctionSalesroomGoodss.getStartTime()); |
| | | currentAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoodss.getStatus()); |
| | | currentAuctionSalesroomGoods.setListingDuration(auctionSalesroomGoodss.getListingDuration()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | } |
| | | wrappers.eq(AuctionSalesroomGoods::getSortNum, auctionSalesroomGoodss.getSortNum()); |
| | | list.add(auctionSalesroomGoodss.getSortNum()); |
| | | } |
| | | |
| | | |
| | | } |
| | | wrapper1.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1 = this.getOne(wrapper1); |
| | |
| | | nextAuctionSalesroomGoods.setNextGoodsSkuName(goodsSku1.getSkuName()); |
| | | nextAuctionSalesroomGoods.setCoverPic(goodsSku1.getCoverPic()); |
| | | nextAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoods1.getStatus()); |
| | | nextAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods1.getGoodsSkuId()); |
| | | nextAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods1.getId()); |
| | | auctionSalesroomVO.setNextAuctionSalesroomGoods(nextAuctionSalesroomGoods); |
| | | } |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | if(list.size()>0){ |
| | | wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list); |
| | | wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | } |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getStatus); |
| | |
| | | GoodsSku goodsSku2=goodsSkuOne2.getData(); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuName(goodsSku2.getSkuName()); |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku2.getCoverPic()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuId(salesroomGoods.getGoodsSkuId()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuId(salesroomGoods.getId()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkustatus(salesroomGoods.getStatus()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getOne(wrapper2); |
| | | if(auctionSalesroomGoods!=null){ |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | auctionSalesroomGoods.setStartTime(LocalDateTime.now()); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | } |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("AuctionTypeEnum",auctionSalesroom.getStatus()); |
| | | map.put("message_type", "start"); |
| | | map.put("type", "1"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("AuctionTypeEnum",auctionSalesroom.getStatus()); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("message_type", "end"); |
| | | map.put("type", "1"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | } |
| | | |
| | | |
| | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=this.getOne(wrapper2); |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | auctionSalesroomGoods.setStartTime(LocalDateTime.now()); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | /* Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId().toString()); |
| | | map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString()); |
| | | map.put("message_type", "start"); |
| | | map.put("type",2); |
| | | map.put("AuctionGoodsStatusEnum",auctionSalesroomGoods.getStatus()); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg);*/ |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | } |
| | | |
| | | |
| | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=this.getOne(wrapper2); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | |
| | |
| | | if(auctionBidRecordList.size()>0){ |
| | | //判断 |
| | | if (auctionBidRecordList.size() >= auctionSalesroomGoods.getSalesroomStock()) { |
| | | for (int i = 0; i <= auctionSalesroomGoods.getSalesroomStock(); i++) { |
| | | for (int i = 0; i < auctionSalesroomGoods.getSalesroomStock(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | |
| | | SecurityConstants.INNER); |
| | | |
| | | |
| | | for (int i = 0; i <= auctionBidRecordList.size(); i++) { |
| | | for (int i = 0; i < auctionBidRecordList.size(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | /* Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId().toString()); |
| | | map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString()); |
| | | map.put("message_type", "end"); |
| | | map.put("type",2); |
| | | map.put("AuctionGoodsStatusEnum",auctionSalesroomGoods.getStatus()); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg);*/ |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | |
| | | } |
| | | |
| | |
| | | AuctionSalesroomGoodsInfoVO.setUnit(goodsSku.getUnit()); |
| | | AuctionSalesroomGoodsInfoVO.setDescription(goodsSku.getDescription()); |
| | | AuctionSalesroomGoodsInfoVO.setDetail(goodsSku.getDetail()); |
| | | AuctionSalesroomGoodsInfoVO.setSharePic(goodsSku.getSharePic()); |
| | | AuctionSalesroomGoodsInfoVO.setShareTitle(goodsSku.getShareTitle()); |
| | | AuctionSalesroomGoodsInfoVO.setYears(String.valueOf(goodsSku.getYears().getYear())); |
| | | GoodsBrand data = goodsSkuClient.getBrandOne(goodsSku.getBrandId(), SecurityConstants.INNER).getData(); |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(goodsSku.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(goodsSku.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(goodsSku.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | if(data!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setBrand(data.getBrandName()); |
| | | } |
| | | if(data1!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setCategory(data1.getCategoryName()); |
| | | } |
| | | if(data2!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setSeries(data2.getSeriesName()); |
| | | } |
| | | if(data3!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setFlavorType(data3.getFlavorTypeName()); |
| | | } |
| | | AuctionSalesroomGoodsInfoVO.setCoverPic(goodsSku.getCoverPic()); |
| | | AuctionSalesroomGoodsInfoVO.setAlbum(goodsSku.getAlbum()); |
| | | AuctionSalesroomGoodsInfoVO.setSpec(goodsSku.getSpec()); |
| | | AuctionSalesroomGoodsInfoVO.setSpecUnit(goodsSku.getSpecUnit()); |
| | | |
| | | CustomConfig returnAddressUserName = sysUserClient.getconfig("MALL_ORDER_DESCRIPTION").getData(); |
| | | AuctionSalesroomGoodsInfoVO.setExplain(returnAddressUserName.getConfigValue()); |
| | | AuctionSalesroomGoodsInfoVO.setMinimumMarkupAmount(byId1.getMinimumMarkupAmount()); |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId()); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionType,2); |
| | | wrapper1.eq(AuctionBidRecord::getTargetId,byId1.getId()); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getDelFlag,0); |
| | | AuctionBidRecord list1 = auctionBidRecordMapper.selectOne(wrapper1); |
| | | if (list1!=null){ |
| | |
| | | AuctionSalesroomGoodsInfoVO.setPresentBid(list1.getLastBidAmount()); |
| | | if (list1.getStatus().getCode()==2){ |
| | | AuctionSalesroomGoodsInfoVO.setIsStatus(2); |
| | | OrderDTO orderDTO =new OrderDTO(); |
| | | orderDTO.setMemberId(auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | orderDTO.setGoodsSkuId(byId1.getId()); |
| | | Order data4 = orderClient.getOrderOne(orderDTO, SecurityConstants.INNER).getData(); |
| | | if (data4!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setOrderId(data4.getId()); |
| | | AuctionSalesroomGoodsInfoVO.setOrderNo(data4.getOrderNo()); |
| | | } |
| | | |
| | | }else{ |
| | | AuctionSalesroomGoodsInfoVO.setIsStatus(1); |
| | | } |
| | |
| | | AuctionSalesroomGoodsInfoVO.setIsBond(1); |
| | | AuctionSalesroomGoodsInfoVO.setIsStatus(1); |
| | | } |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId()); |
| | | wrapper2.eq(AuctionBidRecord::getAuctionType,2); |
| | | wrapper2.eq(AuctionBidRecord::getTargetId,byId1.getId()); |
| | | wrapper2.eq(AuctionBidRecord::getDelFlag,0); |
| | | AuctionBidRecord list2 = auctionBidRecordMapper.selectOne(wrapper1); |
| | | if (list2!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setZgBid(list2.getLastBidAmount()); |
| | | } |
| | | |
| | | /* List<GoodsInfoTitleValueVO> goodsInfoTitleValueVOList = goodsInfoTitleValueService.listByGoodsId(homeGoodsSkuDTO.getGoodsSkuId()); |
| | | Collections.sort(goodsInfoTitleValueVOList, Comparator.comparingInt(GoodsInfoTitleValueVO::getSortNum)); |
| | | for (GoodsInfoTitleValueVO goodsInfoTitleValueVO:goodsInfoTitleValueVOList){ |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVOs=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVOs.setContent(goodsInfoTitleValueVO.getContent()); |
| | | getHomeGoodsSkuXxiVOs.setTitleName(goodsInfoTitleValueVO.getTitleName()); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVOs); |
| | | }*/ |
| | | |
| | | return AuctionSalesroomGoodsInfoVO; |
| | | } |
| | |
| | | auctionBidRecordVO.setSort(i+1); |
| | | auctionBidRecordVO.setLastBidAmount(auctionBidRecordList.get(i).getLastBidAmount()); |
| | | auctionBidRecordVO.setLastBidTime(auctionBidRecordList.get(i).getLastBidTime()); |
| | | Member data = emberClient.getMembeOne(auctionBidRecordList.get(i).getMemberId(), |
| | | SecurityConstants.INNER).getData(); |
| | | auctionBidRecordVO.setMemberName(data.getNickname()); |
| | | auctionBidRecordVO.setMemberId(data.getId()); |
| | | auctionBidRecordVO.setMemberName(auctionBidRecordList.get(i).getNickname()); |
| | | auctionBidRecordVO.setMemberId(auctionBidRecordList.get(i).getId()); |
| | | auctionBidRecordVOList.add(auctionBidRecordVO); |
| | | } |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery(); |
| | |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | wrapper.last("limit 1"); |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordMapper.selectOne(wrapper); |
| | | |
| | | if (auctionBidRecord!=null){ |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery(); |
| | | wrapper3.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | wrapper3.eq(AuctionBidRecord::getDelFlag,0); |
| | |
| | | auctionBidRecordVO.setMemberId(data.getId()); |
| | | auctionBidRecordVOList.add(auctionBidRecordVO); |
| | | } |
| | | } |
| | | |
| | | return auctionBidRecordVOList; |
| | | } |
| | | |
| | |
| | | Double aDouble= Double.valueOf(memberPointsMoney.getConfigValue()) * Double.valueOf(memberPointsPoints.getConfigValue()); |
| | | BigDecimal pi=lastBidAmount.multiply(new BigDecimal(aDouble)); |
| | | order.setPoints(pi.intValue()); |
| | | |
| | | |
| | | if (memberAddress!=null){ |
| | | order.setReceiverCity(memberAddress.getCity()); |
| | | order.setReceiverDetailAddress(memberAddress.getDetailedAddress()); |
| | | order.setReceiverphone(memberAddress.getRecipientPhone()); |
| | | order.setReceiverName(memberAddress.getRecipientName()); |
| | | } |
| | | |
| | | order.setBound(bound); |
| | | order.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER) |
| | |
| | | import com.ruoyi.common.core.utils.page.Checker; |
| | | import com.ruoyi.common.core.utils.page.CollUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.RemoteFileService; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.AppMiniLoginVO; |
| | | import com.ruoyi.system.api.domain.AuctionGoods; |
| | |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.PromotionVideo; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.BidDTO; |
| | |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.feignClient.PromotionClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | |
| | | @Resource |
| | | private AuctionBidRecordMapper auctionBidRecordMapper; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | public static RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setSocketTimeout(5000).build(); |
| | | // 配置您申请的KEY,在个人中心->我的数据,接口名称上方查看 |
| | | public static final String APPKEY = ""; |
| | |
| | | |
| | | private static final ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | |
| | | @Override |
| | | public List<AuctionSalesroom> getAuctionBidRecordList(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); |
| | |
| | | if (sysUser==null){ |
| | | throw new ServiceException("手机号未注册"); |
| | | } |
| | | if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){ |
| | | /* if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){ |
| | | throw new ServiceException("密码输入错误"); |
| | | } |
| | | }*/ |
| | | |
| | | LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,arepartAuctionBidRecordDTO.getAuctionSalesroomQrcode()); |
| | |
| | | R<SysUser> sysUserR = sysUserClient.queryUserByPhone(appMiniLoginDto.getPhone()); |
| | | SysUser data = sysUserR.getData(); |
| | | appMiniLoginVo.setSysUser(data); |
| | | appMiniLoginVo.setPhone(appMiniLoginDto.getAuth_code()); |
| | | appMiniLoginVo.setPhone(appMiniLoginDto.getPhone()); |
| | | return appMiniLoginVo; |
| | | |
| | | } |
| | |
| | | MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1=new MemberAuctionSalesroomDTO(); |
| | | memberAuctionSalesroomDTO1.setAuctionSalesroomId(auctionSalesroom.getId()); |
| | | List<OrderAuctionBond> data1 = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO1, SecurityConstants.INNER).getData(); |
| | | if(data1!=null){ |
| | | memberAuctionSalesroomVO.setApplyNum(data1.size()); |
| | | List.add(memberAuctionSalesroomVO); |
| | | }else{ |
| | | memberAuctionSalesroomVO.setApplyNum(0); |
| | | } |
| | | |
| | | |
| | | } |
| | | page.setRecords(List); |
| | | return PageDTO.of(page); |
| | |
| | | one.setTargetId(bidVO.getTargetId()); |
| | | one.setMemberId(bidVO.getMemberId()); |
| | | one.setLastBidTime(LocalDateTime.now()); |
| | | one.setNickname(membeOne.getNickname()); |
| | | one.setPhone(membeOne.getPhone()); |
| | | one.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | one.setStatus(BidStatusEnum.ELIMINATE); |
| | | one.setBidCount(1); |
| | |
| | | } |
| | | |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId()); |
| | | wrapper2.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | AuctionBidRecord one2 = auctionBidRecordService.getOne(wrapper1); |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", bidVO.getAuctionSalesroomId()); |
| | | map.put("byId", byId.getStatus()); |
| | | map.put("lastBidAmount",one2.getLastBidAmount()); |
| | | map.put("message_type", "BidRecor"); |
| | | map.put("type",3); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | String finalMsg = msg; |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | |
| | | |
| | | |
| | | |
| | | }else { |
| | | AuctionGoods byId = auctionGoodsService.getById(bidVO.getTargetId()); |
| | | if (byId.getStartingPrice().doubleValue()<bidVO.getLastBidAmount().doubleValue()){ |
| | | if (byId.getStartingPrice().doubleValue()>bidVO.getLastBidAmount().doubleValue()){ |
| | | throw new ServiceException("出价不能比起拍价低"); |
| | | } |
| | | BigDecimal bigDecimal=byId.getStartingPrice().add(byId.getMinimumMarkupAmount()); |
| | | if (bigDecimal.doubleValue()<bidVO.getLastBidAmount().doubleValue()){ |
| | | if (bigDecimal.doubleValue()>bidVO.getLastBidAmount().doubleValue()){ |
| | | throw new ServiceException("出价不能比每次最少加价低"); |
| | | } |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery(); |
| | |
| | | one.setLastBidTime(LocalDateTime.now()); |
| | | one.setBidCount(one.getBidCount()+1); |
| | | auctionBidRecordService.updateById(one); |
| | | |
| | | |
| | | }else{ |
| | | one=new AuctionBidRecord(); |
| | | one.setAuctionSalesroomId(bidVO.getAuctionSalesroomId()); |
| | |
| | | one.setLastBidAmount(bidVO.getLastBidAmount()); |
| | | auctionBidRecordService.save(one); |
| | | } |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId()); |
| | | wrapper2.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | AuctionBidRecord one2 = auctionBidRecordService.getOne(wrapper1); |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", bidVO.getAuctionSalesroomId()); |
| | | map.put("byId", byId.getStartStatus()); |
| | | map.put("lastBidAmount",one2.getLastBidAmount()); |
| | | map.put("message_type", "BidRecor"); |
| | | map.put("type",4); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | String finalMsg = msg; |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | query.getEndTime()), AuctionSalesroom::getStartTime, |
| | | query.getStartTime(), |
| | | query.getEndTime()) |
| | | .orderByDesc(AuctionSalesroom::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | |
| | | List<AuctionSalesroom> records = page.getRecords(); |
| | | if (StringUtils.isNull(records)) { |
| | | return PageDTO.empty(page); |
| | |
| | | // 生成唯一编号 |
| | | Long nextId = IDhelper.getNextId(); |
| | | auctionSalesroom.setAuctionSalesroomNo(nextId.toString()); |
| | | String qrCodeToObs = CreateQrCode.createQRCodeToObs(nextId.toString()); |
| | | auctionSalesroom.setQrCode(qrCodeToObs); |
| | | String url = remoteFileService.obsUpload( |
| | | CreateQrCode.createQRCodeStream(nextId.toString())).getData(); |
| | | auctionSalesroom.setQrCode(url); |
| | | // 添加 |
| | | this.save(auctionSalesroom); |
| | | List<GoodsStockUpdDTO> goodsStockUpdDTOS = auctionSalesroomGoods.stream().map(item -> { |
| | |
| | | .between(StringUtils.isNotNull(query.getStartTime()) && StringUtils.isNotNull( |
| | | query.getEndTime()), AuctionSalesroom::getStartTime, query.getStartTime(), |
| | | query.getEndTime()) |
| | | .orderByAsc(AuctionSalesroom::getStartTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | List<AuctionSalesroom> records = page.getRecords(); |
| | | if (StringUtils.isNull(records)) { |
| | |
| | | * @param id 拍卖场商品id |
| | | */ |
| | | @Override |
| | | public void stopCurrentGoods(Long id) { |
| | | public void stopCurrentGoods(Long id) throws JsonProcessingException { |
| | | AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(id); |
| | | if (StringUtils.isNull(auctionSalesroomGoods)) { |
| | | throw new ServiceException("拍卖商品不存在"); |
| | | } |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); |
| | | auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString()); |
| | | map.put("auctionSalesroomGoodsId", auctionSalesroomGoods.getId().toString()); |
| | | map.put("AuctionTypeEnum", auctionSalesroomGoods.getStatus()); |
| | | map.put("message_type", "stop"); |
| | | map.put("type", "2"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param id 拍卖场商品id |
| | | */ |
| | | @Override |
| | | public void startNextGoods(Long id) { |
| | | public void startNextGoods(Long id) throws JsonProcessingException { |
| | | AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(id); |
| | | if (StringUtils.isNull(auctionSalesroomGoods)) { |
| | | throw new ServiceException("拍卖商品不存在"); |
| | | } |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString()); |
| | | map.put("auctionSalesroomGoodsId", auctionSalesroomGoods.getId().toString()); |
| | | map.put("AuctionTypeEnum", auctionSalesroomGoods.getStatus()); |
| | | map.put("message_type", "start"); |
| | | map.put("type", "2"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (StringUtils.isNull(data)) { |
| | | throw new ServiceException("视频不存在"); |
| | | } |
| | | iAuctionVideoService.remove(Wrappers.<AuctionVideo>lambdaQuery().eq |
| | | (AuctionVideo::getAuctionSalesroomId, dto.getAuctionSalesroomId())); |
| | | AuctionVideo auctionVideo = new AuctionVideo(); |
| | | auctionVideo.setAuctionSalesroomId(dto.getAuctionSalesroomId()); |
| | | auctionVideo.setPromotionVideoId(dto.getVideoId()); |
| | |
| | | @Override |
| | | public void stopPlay(Long auctionSalesroomId) { |
| | | iAuctionVideoService.remove(Wrappers.<AuctionVideo>lambdaQuery().eq |
| | | (AuctionVideo::getAuctionSalesroomId, 1L)); |
| | | (AuctionVideo::getAuctionSalesroomId, auctionSalesroomId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId().toString()); |
| | | map.put("AuctionTypeEnum", auctionSalesroom.getStatus()); |
| | | map.put("message_type", "start"); |
| | | map.put("type", "1"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.AUCTIONEER).build(), SecurityConstants.INNER); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Transactional |
| | | public void stopCurrentAuctionSalesroom(Long auctionSalesroomId) |
| | | throws JsonProcessingException { |
| | | // 修改拍卖场开始状态 |
| | | AuctionSalesroom auctionSalesroom = this.getById(auctionSalesroomId); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); |
| | | auctionSalesroom.setEndTime(LocalDateTime.now()); |
| | | auctionSalesroomMapper.updateById(auctionSalesroom); |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus, AuctionGoodsStatusEnum.WAITING); |
| | | wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId, auctionSalesroomId); |
| | | wrapper.orderByDesc(AuctionSalesroomGoods::getSortNum); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList( |
| | | wrapper); |
| | | long count = auctionSalesroomGoods.stream() |
| | | .filter(goods -> goods.getStatus().equals(AuctionGoodsStatusEnum.IN_PROGRESS)) |
| | | .count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("当前拍卖场正在拍卖商品,不能停止"); |
| | | } |
| | | // 修改拍卖场开始状态 |
| | | AuctionSalesroom auctionSalesroom = this.getById(auctionSalesroomId); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); |
| | | auctionSalesroom.setEndTime(LocalDateTime.now()); |
| | | auctionSalesroomMapper.updateById(auctionSalesroom); |
| | | |
| | | if (StringUtils.isNotEmpty(auctionSalesroomGoods)) { |
| | | List<GoodsStockUpdDTO> dtoList = new ArrayList<>(); |
| | | for (AuctionSalesroomGoods salesroomGoods : auctionSalesroomGoods) { |
| | |
| | | } |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId().toString()); |
| | | map.put("AuctionTypeEnum",auctionSalesroom.getStatus()); |
| | | map.put("message_type", "end"); |
| | | map.put("type", "1"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.AUCTIONEER).build(), SecurityConstants.INNER); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.QRCodeWriter; |
| | | import com.ruoyi.system.api.util.HuaWeiOBSUtil; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.util.Base64; |
| | | import java.util.HashMap; |
| | | import org.apache.commons.fileupload.FileItem; |
| | | import org.apache.commons.fileupload.FileItemFactory; |
| | | import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | public class CreateQrCode { |
| | | |
| | | private static final String base64Url = "data:image/png;base64,"; |
| | | |
| | | /** |
| | | * 创建二维码 |
| | | * |
| | |
| | | * @throws IOException |
| | | * @throws WriterException |
| | | */ |
| | | public static String createQRCodeToObs(String json) throws IOException, WriterException { |
| | | public static MultipartFile createQRCodeStream(String json) |
| | | throws IOException, WriterException { |
| | | QRCodeWriter qrCodeWriter = new QRCodeWriter(); |
| | | |
| | | HashMap<EncodeHintType, Object> hints = new HashMap<>(); |
| | |
| | | BitMatrix bitMatrix = qrCodeWriter.encode(json, BarcodeFormat.QR_CODE, 600, 600, hints); |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | MatrixToImageWriter.writeToStream(bitMatrix, "PNG", outputStream); |
| | | InputStream is = new ByteArrayInputStream( |
| | | InputStream byteArrayInputStream = new ByteArrayInputStream( |
| | | outputStream.toByteArray()); |
| | | return HuaWeiOBSUtil.obsUploadStream(json, is); |
| | | // byteArrayInputStream 转MultipartFile |
| | | |
| | | return getMultipartFile(byteArrayInputStream, json + ".png"); |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException, WriterException { |
| | | String qrCodeToObs = createQRCodeToObs("123456"); |
| | | System.out.println(qrCodeToObs); |
| | | /** |
| | | * 获取封装得MultipartFile |
| | | * |
| | | * @param inputStream inputStream |
| | | * @param fileName fileName |
| | | * @return MultipartFile |
| | | */ |
| | | public static MultipartFile getMultipartFile(InputStream inputStream, String fileName) { |
| | | FileItem fileItem = createFileItem(inputStream, fileName); |
| | | // CommonsMultipartFile是feign对multipartFile的封装,但是要FileItem类对象 |
| | | return new CommonsMultipartFile(fileItem); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * FileItem类对象创建 |
| | | * |
| | | * @param inputStream inputStream |
| | | * @param fileName fileName |
| | | * @return FileItem |
| | | */ |
| | | public static FileItem createFileItem(InputStream inputStream, String fileName) { |
| | | FileItemFactory factory = new DiskFileItemFactory(16, null); |
| | | String textFieldName = "file"; |
| | | FileItem item = factory.createItem(textFieldName, MediaType.MULTIPART_FORM_DATA_VALUE, true, |
| | | fileName); |
| | | int bytesRead = 0; |
| | | byte[] buffer = new byte[10 * 1024 * 1024]; |
| | | OutputStream os = null; |
| | | // 使用输出流输出输入流的字节 |
| | | try { |
| | | os = item.getOutputStream(); |
| | | while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } finally { |
| | | if (os != null) { |
| | | try { |
| | | os.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | |
| | | } |
| | | } |
| | | if (inputStream != null) { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return item; |
| | | } |
| | | } |
| | |
| | | <artifactId>ruoyi-common-swagger</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>aws-java-sdk-s3</groupId> |
| | | <artifactId>aws</artifactId> |
| | | <version>1.0.0</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/aws-java-sdk-s3.jar</systemPath> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.file.FileUtils; |
| | | import com.ruoyi.file.service.ISysFileService; |
| | | import com.ruoyi.file.utils.StateCloudObsUtil; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | import com.ruoyi.system.api.util.HuaWeiOBSUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | public R<String> obsUpload(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | | // 上传并返回访问地址 |
| | | String url = HuaWeiOBSUtil.obsUpload(file); |
| | | String url = StateCloudObsUtil.uploadFile(file); |
| | | return R.ok(url); |
| | | } catch (Exception e) { |
| | | log.error("上传文件失败", e); |
| | |
| | | List<String> urls = new ArrayList<>(); |
| | | try { |
| | | for (MultipartFile multipartFile : file) { |
| | | String url = HuaWeiOBSUtil.obsUpload(multipartFile); |
| | | String url = StateCloudObsUtil.uploadFile(multipartFile); |
| | | urls.add(url); |
| | | } |
| | | // 上传并返回访问地址 |
| | |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/obs/upload/stream") |
| | | public R<String> obsUpload(@RequestParam("code") String code, |
| | | @RequestParam("stream") InputStream stream) { |
| | | try { |
| | | // 上传并返回访问地址 |
| | | String url = StateCloudObsUtil.obsUploadStream(code, stream); |
| | | return R.ok(url); |
| | | } catch (Exception e) { |
| | | log.error("上传文件失败", e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.file.utils; |
| | | |
| | | import com.amazonaws.ClientConfiguration; |
| | | import com.amazonaws.Protocol; |
| | | import com.amazonaws.auth.AWSCredentials; |
| | | import com.amazonaws.auth.AWSStaticCredentialsProvider; |
| | | import com.amazonaws.auth.BasicAWSCredentials; |
| | | import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; |
| | | import com.amazonaws.services.s3.AmazonS3; |
| | | import com.amazonaws.services.s3.AmazonS3ClientBuilder; |
| | | import com.amazonaws.services.s3.model.ObjectMetadata; |
| | | import com.amazonaws.services.s3.model.PutObjectRequest; |
| | | import com.amazonaws.services.s3.model.PutObjectResult; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 天翼云OBS 工具类 |
| | | * |
| | | * @author mitao |
| | | * @date 2024/6/17 |
| | | */ |
| | | public class StateCloudObsUtil { |
| | | |
| | | public static String ACCESS_KEY = "MZTCFDOW5SGEC88GNMBV"; |
| | | public static String SECRET_KEY = "b3HHfKEiEHjyo4ozzN4ZuaveCKvoFUAOPoba44ix"; |
| | | public static String END_POINT = "obs.cn-sccd1.ctyun.cn"; |
| | | public static String BUCKET = "jyzx-obs"; |
| | | public static String DOMAIN = "https://" + BUCKET + "." + END_POINT + "/"; |
| | | public static AWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY, |
| | | SECRET_KEY); |
| | | |
| | | public static String uploadFile(MultipartFile file) { |
| | | String originalFilename = file.getOriginalFilename(); |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | String fileName; |
| | | AmazonS3 s3client = null; |
| | | try { |
| | | ClientConfiguration awsClientConfig = new ClientConfiguration(); |
| | | awsClientConfig.setSignerOverride("AWSS3V4SignerType"); |
| | | awsClientConfig.setProtocol(Protocol.HTTP); |
| | | s3client = AmazonS3ClientBuilder.standard() |
| | | .withCredentials(new AWSStaticCredentialsProvider(credentials)) |
| | | .withClientConfiguration(awsClientConfig) |
| | | .withEndpointConfiguration(new EndpointConfiguration(END_POINT, "")) |
| | | .disableChunkedEncoding() |
| | | .enablePathStyleAccess() |
| | | .build(); |
| | | System.out.print("=====connect success=====\n"); |
| | | // 上传 object |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | fileName = |
| | | UUID.randomUUID().toString().replaceAll("-", "") + originalFilename.subSequence( |
| | | originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | PutObjectRequest request = new PutObjectRequest(BUCKET, fileName, inputStream, |
| | | objectMetadata); |
| | | PutObjectResult result = s3client.putObject(request); |
| | | System.out.format("Etag: %s, versionId: %s\n", result.getETag(), |
| | | result.getVersionId()); |
| | | System.out.print("=====request success=====\n"); |
| | | return DOMAIN + fileName; |
| | | } catch (Exception e) { |
| | | System.out.print("=====request fail=====\n"); |
| | | System.out.print(e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String obsUploadStream(String code, InputStream content) throws IOException { |
| | | String fileName = ""; |
| | | ObjectMetadata objectMetadata = new ObjectMetadata();// 创建上传Object的Metadata |
| | | fileName = "qrCode/" + UUID.randomUUID().toString().replaceAll("-", "") + "-id" + code |
| | | + ".png"; |
| | | AmazonS3 s3client = null; |
| | | try { |
| | | ClientConfiguration awsClientConfig = new ClientConfiguration(); |
| | | awsClientConfig.setSignerOverride("AWSS3V4SignerType"); |
| | | awsClientConfig.setProtocol(Protocol.HTTP); |
| | | s3client = AmazonS3ClientBuilder.standard() |
| | | .withCredentials(new AWSStaticCredentialsProvider(credentials)) |
| | | .withClientConfiguration(awsClientConfig) |
| | | .withEndpointConfiguration(new EndpointConfiguration(END_POINT, "")) |
| | | .disableChunkedEncoding() |
| | | .enablePathStyleAccess() |
| | | .build(); |
| | | System.out.print("=====connect success=====\n"); |
| | | // 上传 object |
| | | PutObjectRequest request = new PutObjectRequest(BUCKET, fileName, content, |
| | | objectMetadata); |
| | | PutObjectResult result = s3client.putObject(request); |
| | | System.out.format("Etag: %s, versionId: %s\n", result.getETag(), |
| | | result.getVersionId()); |
| | | System.out.print("=====request success=====\n"); |
| | | return DOMAIN + fileName; |
| | | } catch (Exception e) { |
| | | System.out.print("=====request fail=====\n"); |
| | | System.out.print(e.getMessage()); |
| | | } |
| | | return fileName; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.goods.controller.management.dto.GoodsBrandDTO; |
| | | import com.ruoyi.goods.controller.management.dto.GoodsBrandQuery; |
| | | import com.ruoyi.goods.controller.management.vo.GoodsBrandVO; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import com.ruoyi.goods.mapper.GoodsBrandMapper; |
| | | import com.ruoyi.goods.service.IGoodsBrandService; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | Page<GoodsBrand> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getBrandName()), GoodsBrand::getBrandName, |
| | | query.getBrandName()) |
| | | .orderByDesc(GoodsBrand::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | |
| | | import com.ruoyi.goods.controller.management.dto.GoodsCategoryDTO; |
| | | import com.ruoyi.goods.controller.management.dto.GoodsCategoryQuery; |
| | | import com.ruoyi.goods.controller.management.vo.GoodsCategoryVO; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import com.ruoyi.goods.mapper.GoodsCategoryMapper; |
| | | import com.ruoyi.goods.service.IGoodsCategoryService; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | Page<GoodsCategory> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getCategoryName()), |
| | | GoodsCategory::getCategoryName, query.getCategoryName()) |
| | | .orderByDesc(GoodsCategory::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | |
| | | import com.ruoyi.goods.controller.management.dto.GoodsFlavorTypeDTO; |
| | | import com.ruoyi.goods.controller.management.dto.GoodsFlavorTypeQuery; |
| | | import com.ruoyi.goods.controller.management.vo.GoodsFlavorTypeVO; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | | import com.ruoyi.goods.mapper.GoodsFlavorTypeMapper; |
| | | import com.ruoyi.goods.service.IGoodsFlavorTypeService; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | Page<GoodsFlavorType> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getFlavorTypeName()), |
| | | GoodsFlavorType::getFlavorTypeName, query.getFlavorTypeName()) |
| | | .orderByDesc(GoodsFlavorType::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | |
| | | import com.ruoyi.common.core.enums.OrderStatusEnum; |
| | | import com.ruoyi.common.core.enums.StartStatusEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | |
| | | import com.ruoyi.goods.controller.management.dto.GoodsGroupPurchaseDTO; |
| | | import com.ruoyi.goods.controller.management.dto.GoodsGroupPurchaseQuery; |
| | | import com.ruoyi.goods.controller.management.vo.GoodsGroupPurchaseVO; |
| | | import com.ruoyi.goods.domain.MemberGoodsCollection; |
| | | import com.ruoyi.goods.mapper.GoodsGroupPurchaseMapper; |
| | | import com.ruoyi.goods.service.IGoodsGroupPurchaseService; |
| | | import com.ruoyi.goods.service.IGoodsSkuService; |
| | | import com.ruoyi.goods.service.IMemberGoodsCollectionService; |
| | | import com.ruoyi.goods.service.async.AsyncMethodService; |
| | | import com.ruoyi.system.api.constants.DelayTaskEnum; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.GoodsGroupPurchase; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.ListStatusDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderUpdDTO; |
| | |
| | | import com.ruoyi.system.api.domain.vo.OrderVO; |
| | | import com.ruoyi.system.api.domain.vo.WdGoodsGroupPurchaseVO; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import java.time.LocalDateTime; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @RequiredArgsConstructor |
| | | public class GoodsGroupPurchaseServiceImpl extends ServiceImpl<GoodsGroupPurchaseMapper, GoodsGroupPurchase> implements IGoodsGroupPurchaseService { |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | private final OrderClient orderClient; |
| | | private final IGoodsSkuService goodsSkuService; |
| | | private final AsyncMethodService asyncMethodService; |
| | | private final RedisService redisService; |
| | | private final IMemberGoodsCollectionService iMemberGoodsCollectionService; |
| | | private final SysUserClient sysUserClient; |
| | | // 创建一个静态共享的ObjectMapper实例以重用 |
| | | private static final ObjectMapper objectMapper = new ObjectMapper(); |
| | | /** |
| | |
| | | .eq(GoodsGroupPurchase::getId, groupPurchaseId).update(); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.GROUP_PURCHASE); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", groupPurchaseId); |
| | | map.put("message_type", "start"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | } |
| | |
| | | .eq(GoodsGroupPurchase::getId, groupPurchaseId).update(); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.GROUP_PURCHASE); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", groupPurchaseId); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | } |
| | |
| | | goodsGroupPurchaseInfoVO.setListingStatus(one.getListingStatus()); |
| | | goodsGroupPurchaseInfoVO.setGroupStatus(one.getGroupStatus()); |
| | | |
| | | Order data = orderClient.getOrderByGroupPurchaseMemberId(homeGoodsSkuDTO, SecurityConstants.INNER).getData(); |
| | | LambdaQueryWrapper<MemberGoodsCollection> wrapper4= Wrappers.lambdaQuery(); |
| | | wrapper4.eq(MemberGoodsCollection::getDelFlag,0); |
| | | wrapper4.eq(MemberGoodsCollection::getMemberId,homeGoodsSkuDTO.getMemberId()); |
| | | wrapper4.eq(MemberGoodsCollection::getTargetId,one.getId()); |
| | | wrapper4.eq(MemberGoodsCollection::getType,1); |
| | | List<MemberGoodsCollection> list = iMemberGoodsCollectionService.list(wrapper4); |
| | | if (list.size()>0){ |
| | | goodsGroupPurchaseInfoVO.setIsCollection(2); |
| | | }else{ |
| | | goodsGroupPurchaseInfoVO.setIsCollection(1); |
| | | } |
| | | HomeGoodsSkuDTO homeGoodsSkuDTO1=new HomeGoodsSkuDTO(); |
| | | homeGoodsSkuDTO1.setGoodsSkuId(one.getId()); |
| | | homeGoodsSkuDTO1.setMemberId(homeGoodsSkuDTO.getMemberId()); |
| | | Order data = orderClient.getOrderByGroupPurchaseMemberId(homeGoodsSkuDTO1, SecurityConstants.INNER).getData(); |
| | | if (data!=null){ |
| | | goodsGroupPurchaseInfoVO.setIsGoodsGroupPurchase(2); |
| | | goodsGroupPurchaseInfoVO.setOrder(data); |
| | | }else{ |
| | | goodsGroupPurchaseInfoVO.setIsGoodsGroupPurchase(1); |
| | | } |
| | |
| | | Page<GoodsInfoTitle> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getTitleName()), GoodsInfoTitle::getTitleName, |
| | | query.getTitleName()) |
| | | .orderByDesc(GoodsInfoTitle::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import com.ruoyi.common.core.enums.StartStatusEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | |
| | | import com.ruoyi.system.api.domain.GoodsSeckill; |
| | | import com.ruoyi.system.api.domain.GoodsSeries; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.ListStatusDTO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSeckillInfoVO; |
| | |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | import java.util.Set; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | //推送秒杀开始消息 |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.SECKILL); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", seckillId); |
| | | map.put("message_type", "start"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | |
| | |
| | | } |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.SECKILL); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("target_id", seckillId); |
| | | map.put("message_type", "end"); |
| | | String msg = objectMapper.writeValueAsString(map); |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.MEMBER.getCode(), msg); |
| | | sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg) |
| | | .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER); |
| | | log.info("===================>发送websocket通知,消息体{}", msg); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.goods.controller.management.dto.GoodsSeriesDTO; |
| | | import com.ruoyi.goods.controller.management.dto.GoodsSeriesQuery; |
| | | import com.ruoyi.goods.controller.management.vo.GoodsSeriesVO; |
| | | import com.ruoyi.system.api.domain.GoodsSeries; |
| | | import com.ruoyi.goods.mapper.GoodsSeriesMapper; |
| | | import com.ruoyi.goods.service.IGoodsSeriesService; |
| | | import com.ruoyi.system.api.domain.GoodsSeries; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | Page<GoodsSeries> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getSeriesName()), GoodsSeries::getSeriesName, |
| | | query.getSeriesName()) |
| | | .orderByDesc(GoodsSeries::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | |
| | | import com.ruoyi.goods.service.IGoodsInfoTitleValueService; |
| | | import com.ruoyi.goods.service.IGoodsSkuService; |
| | | import com.ruoyi.goods.service.IMemberGoodsCollectionService; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | | import com.ruoyi.system.api.domain.GoodsGroupPurchase; |
| | | import com.ruoyi.system.api.domain.GoodsSeckill; |
| | | import com.ruoyi.system.api.domain.GoodsSeries; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.ListStatusDTO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSkuInfoVO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSkuListVO; |
| | | import com.ruoyi.system.api.domain.vo.OrderVO; |
| | | import com.ruoyi.system.api.domain.vo.getHomeGoodsSkuXxiVO; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.redisson.api.RLock; |
| | |
| | | ), GoodsSku::getListingStatus, query.getListingStatus()) |
| | | .eq(query.getQueryType().equals(1), GoodsSku::getListingStatus, |
| | | ListingStatusEnum.ON_SHELVES) |
| | | .orderByDesc(GoodsSku::getSortNum) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | return PageDTO.of(page, GoodsSkuVO.class); |
| | | } |
| | |
| | | if (homeGoodsSkuDTO.getSkuName()!=null){ |
| | | wrapper3.like(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | } |
| | | if (homeGoodsSkuDTO.getGoodsSkuId()!=null){ |
| | | List<Long> id=new ArrayList<>(); |
| | | id.add(homeGoodsSkuDTO.getGoodsSkuId()); |
| | | wrapper3.notIn(GoodsSku::getId,id); |
| | | } |
| | | if (homeGoodsSkuDTO.getBrandId()!=null){ |
| | | wrapper3.eq(GoodsSku::getBrandId,homeGoodsSkuDTO.getBrandId()); |
| | | } |
| | |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(byId.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(byId.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(byId.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | if (data!=null){ |
| | | homeGoodsSkuInfoVO.setBrand(data.getBrandName()); |
| | | } |
| | | if (data1!=null){ |
| | | homeGoodsSkuInfoVO.setCategory(data1.getCategoryName()); |
| | | } |
| | | if (data2!=null){ |
| | | homeGoodsSkuInfoVO.setSeries(data2.getSeriesName()); |
| | | } |
| | | if (data3!=null) { |
| | | homeGoodsSkuInfoVO.setFlavorType(data3.getFlavorTypeName()); |
| | | } |
| | | homeGoodsSkuInfoVO.setPrice(byId.getPrice()); |
| | | homeGoodsSkuInfoVO.setSoldQuantity(byId.getSoldQuantity()); |
| | | homeGoodsSkuInfoVO.setUnit(byId.getUnit()); |
| | |
| | | HomeGoodsSkuDTO homeGoodsSkuDTO1 =new HomeGoodsSkuDTO(); |
| | | homeGoodsSkuDTO1.setGoodsSkuId(goodsGroupPurchase.getId()); |
| | | homeGoodsSkuDTO1.setMemberId(homeGoodsSkuDTO.getMemberId()); |
| | | Order data5 = orderClient.getOrderByGroupPurchaseMemberId(homeGoodsSkuDTO1, SecurityConstants.INNER).getData(); |
| | | if (data5!=null){ |
| | | List<OrderVO> data4 = orderClient.getOrderByGroupPurchaseMemberList(homeGoodsSkuDTO1, SecurityConstants.INNER).getData(); |
| | | if (data4!=null){ |
| | | homeGoodsSkuInfoVO.setIsGoodsGroupPurchase(2); |
| | | }else{ |
| | | homeGoodsSkuInfoVO.setIsGoodsGroupPurchase(1); |
| | |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(byId.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | |
| | | |
| | | if (data1!=null){ |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO1=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO1.setContent(data1.getCategoryName()); |
| | | getHomeGoodsSkuXxiVO1.setTitleName("分类"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO1); |
| | | } |
| | | |
| | | if (data2!=null){ |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO2=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO2.setContent(data2.getSeriesName()); |
| | | getHomeGoodsSkuXxiVO2.setTitleName("系列"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO2); |
| | | |
| | | } |
| | | if (data!=null) { |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO.setContent(data.getBrandName()); |
| | | getHomeGoodsSkuXxiVO.setTitleName("品牌"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO); |
| | | |
| | | } |
| | | if (data3!=null) { |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO3=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO3.setContent(data3.getFlavorTypeName()); |
| | | getHomeGoodsSkuXxiVO3.setTitleName("香型"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO3); |
| | | |
| | | } |
| | | |
| | | List<GoodsInfoTitleValueVO> goodsInfoTitleValueVOList = goodsInfoTitleValueService.listByGoodsId(homeGoodsSkuDTO.getGoodsSkuId()); |
| | | Collections.sort(goodsInfoTitleValueVOList, Comparator.comparingInt(GoodsInfoTitleValueVO::getSortNum)); |
| | |
| | | return homeGoodsSkuXxiVOS; |
| | | } |
| | | |
| | | @Override |
| | | public List<getHomeGoodsSkuXxiVO> getMsHomeGoodsSkuXxi(HomeGoodsSkuDTO homeGoodsSkuDTO) { |
| | | List<getHomeGoodsSkuXxiVO> homeGoodsSkuXxiVOS=new ArrayList<>(); |
| | | GoodsSeckill goodsSeckill = goodsSeckillMapper.selectById(homeGoodsSkuDTO.getGoodsSkuId()); |
| | |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(byId.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(byId.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(byId.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | |
| | | |
| | | if (data!=null){ |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO1=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO1.setContent(data1.getCategoryName()); |
| | | getHomeGoodsSkuXxiVO1.setTitleName("分类"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO1); |
| | | } |
| | | |
| | | if (data2!=null) { |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO2=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO2.setContent(data2.getSeriesName()); |
| | | getHomeGoodsSkuXxiVO2.setTitleName("系列"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO2); |
| | | |
| | | } |
| | | if (data!=null) { |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO.setContent(data.getBrandName()); |
| | | getHomeGoodsSkuXxiVO.setTitleName("品牌"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO); |
| | | |
| | | } |
| | | if (data3!=null) { |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVO3=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVO3.setContent(data3.getFlavorTypeName()); |
| | | getHomeGoodsSkuXxiVO3.setTitleName("香型"); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVO3); |
| | | |
| | | } |
| | | |
| | | List<GoodsInfoTitleValueVO> goodsInfoTitleValueVOList = goodsInfoTitleValueService.listByGoodsId(homeGoodsSkuDTO.getGoodsSkuId()); |
| | | Collections.sort(goodsInfoTitleValueVOList, Comparator.comparingInt(GoodsInfoTitleValueVO::getSortNum)); |
| | |
| | | @Bean |
| | | public WxMaConfig memberWxMaConfig(){ |
| | | WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
| | | config.setAppid("wxe91f1af7638aa5dd"); |
| | | config.setSecret("a787e1a462715604e0c9528b6d8960d1"); |
| | | config.setAppid("wx69e3ac6e13a889b7"); |
| | | config.setSecret("1b8bcfcb681524ac553e72054e5271ef"); |
| | | return config; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.member.service.IMemberService; |
| | | import com.ruoyi.system.api.RemoteFileService; |
| | | import com.ruoyi.system.api.domain.AppMiniLoginVO; |
| | | import com.ruoyi.system.api.domain.Member; |
| | | import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO; |
| | | import com.ruoyi.system.api.domain.dto.CustomConfigDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberDTO; |
| | | import com.ruoyi.system.api.domain.dto.MobileDTO; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.HuaWeiOBSUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | @PostMapping("/miniLogin") |
| | | @ApiOperation(value = "用户端-第三方登陸") |
| | | public R<AppMiniLoginVO> loginThird(@RequestBody AppMiniLoginDTO appMiniLoginDto) { |
| | |
| | | |
| | | @PostMapping(value = "/mobile") |
| | | @ApiOperation(value = "用户端-小程序获取电话号码") |
| | | public R mobile(@RequestBody MobileDTO mobileDTO) { |
| | | iMemberService.mobile(mobileDTO); |
| | | return R.ok(); |
| | | public R<String> mobile(@RequestBody MobileDTO mobileDTO) { |
| | | |
| | | return R.ok(iMemberService.mobile(mobileDTO)); |
| | | } |
| | | |
| | | @PostMapping("/getMembeid") |
| | |
| | | return R.ok(iMemberService.getMembeid(memberDTO)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/saveUserImg") |
| | | @ApiOperation(value = "用户端-修改头像") |
| | | public R<Member> saveNotice(HttpServletRequest request) { |
| | | try { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile file = (MultipartFile) multipartRequest.getFile("images"); |
| | | String url=HuaWeiOBSUtil.obsUpload(file); |
| | | String url = remoteFileService.obsUpload(file).getData(); |
| | | Member member=new Member(); |
| | | member.setAvatar(url); |
| | | return R.ok(member); |
| | |
| | | List<Member> getMemberListByIds(Collection<Long> memberIdList); |
| | | |
| | | |
| | | void mobile(@RequestBody MobileDTO mobileDTO); |
| | | String mobile(@RequestBody MobileDTO mobileDTO); |
| | | |
| | | /** |
| | | * 获取会员管理分页列表 |
| | |
| | | import com.ruoyi.member.domain.MemberLevel; |
| | | import com.ruoyi.member.mapper.MemberLevelMapper; |
| | | import com.ruoyi.member.mapper.MemberMapper; |
| | | import com.ruoyi.member.service.IMemberLevelService; |
| | | import com.ruoyi.member.service.IMemberPointsService; |
| | | import com.ruoyi.member.service.IMemberService; |
| | | import com.ruoyi.member.util.HttpUtils; |
| | |
| | | //微信 |
| | | private static final String ACCESS_TOKEN_HOST = "https://api.weixin.qq.com/cgi-bin/token"; |
| | | |
| | | private static final String WX_APPID = "wxe91f1af7638aa5dd"; |
| | | private static final String WX_APPID = "wx69e3ac6e13a889b7"; |
| | | |
| | | private static final String WX_SECRET = "a787e1a462715604e0c9528b6d8960d1"; |
| | | private static final String WX_SECRET = "1b8bcfcb681524ac553e72054e5271ef"; |
| | | |
| | | //支付寶 |
| | | /** |
| | |
| | | sysUser = new SysUser(); |
| | | sysUser.setUserName(memberId); |
| | | sysUser.setNickName("白金用户"); |
| | | sysUser.setUserType("03"); |
| | | sysUser.setPhonenumber(response.getOpenId()); |
| | | sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png"); |
| | | String password = "123456"; |
| | |
| | | member.setUserId(sysUser.getUserId()); |
| | | member.setDelFlag(0); |
| | | member.setNickname("白酒用户"); |
| | | member.setPhone(appMiniLoginDto.getPhone()); |
| | | member.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png"); |
| | | member.setZfbOpenid(response.getOpenId()); |
| | | this.save(member); |
| | |
| | | sysUser = new SysUser(); |
| | | sysUser.setUserName(memberId); |
| | | sysUser.setNickName("白金用户"); |
| | | sysUser.setUserType("03"); |
| | | sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png"); |
| | | String password = "123456"; |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(password)); |
| | |
| | | member.setNickname("白酒用户"); |
| | | member.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png"); |
| | | member.setWxUnionid(unionid); |
| | | member.setPhone(appMiniLoginDto.getPhone()); |
| | | member.setMiniOpenid(openid); |
| | | this.save(member); |
| | | appMiniLoginVo.setMiniOpenid(member.getMiniOpenid()); |
| | |
| | | public Member getMembeid(MemberDTO memberDTO) { |
| | | return this.getById(memberDTO.getMemberid()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateMembeid(MemberDTO memberDTO) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void mobile(MobileDTO mobileDTO) { |
| | | public String mobile(MobileDTO mobileDTO) { |
| | | Member byId = this.getById(mobileDTO.getMemberid()); |
| | | String mobile=null; |
| | | if (mobileDTO.getType()==1) { |
| | | if (mobileDTO.getAuth_code() == null || mobileDTO.getAuth_code().length() == 0) { |
| | | } else { |
| | |
| | | String plainData = null; |
| | | if (isDataEncrypted) { |
| | | try { |
| | | plainData = AlipayEncrypt.decryptContent(content, encryptType, "VSpPcLQjLSoTz6Yd7KNoyQ==", charset); |
| | | plainData = AlipayEncrypt.decryptContent(content, encryptType, "XABBSOeWDakvuG9TDez4Qg====", charset); |
| | | } catch (AlipayApiException e) { |
| | | //解密异常, 记录日志 |
| | | e.getMessage(); |
| | |
| | | new TypeReference<Map<String, String>>() { |
| | | }, Feature.OrderedField); |
| | | |
| | | byId.setPhone(openapiResult1.get("mobile")); |
| | | this.updateById(byId); |
| | | mobile=openapiResult1.get("mobile"); |
| | | } |
| | | }else{ |
| | | String responseAccessToken = null; |
| | |
| | | JSONObject jsonUserPhoneNumber = JSONObject.parseObject(responseUserPhoneNumber); |
| | | String phoneInfo = jsonUserPhoneNumber.getString("phone_info"); |
| | | JSONObject jsonUserPhoneInfo = JSONObject.parseObject(phoneInfo); |
| | | String mobile = jsonUserPhoneInfo.getString("purePhoneNumber"); |
| | | byId.setPhone(mobile); |
| | | this.updateById(byId); |
| | | mobile= jsonUserPhoneInfo.getString("purePhoneNumber"); |
| | | |
| | | } |
| | | return mobile; |
| | | } |
| | | |
| | | public static String getAccessTokenByWX() throws Exception { |
| | |
| | | @Override |
| | | public PageDTO<MgtMemberVO> getMemberPage(MgtMemberQuery query) { |
| | | Page<Member> page = this.lambdaQuery() |
| | | .select(Member::getId, Member::getNickname, Member::getRealName, Member::getPhone, |
| | | Member::getIdNumber) |
| | | .like(StringUtils.isNotBlank(query.getRealName()), Member::getRealName, |
| | | query.getRealName()) |
| | | .like(StringUtils.isNotBlank(query.getPhone()), Member::getPhone, query.getPhone()) |
| | | .orderByDesc(Member::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | |
| | | <dependency> |
| | | <groupId>com.alipay.sdk</groupId> |
| | | <artifactId>alipay-sdk-java</artifactId> |
| | | <version>4.39.95.ALL</version> |
| | | <version>4.10.167.ALL</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.wechatpay-apiv3</groupId> |
| | | <artifactId>wechatpay-java</artifactId> |
| | | <version>0.2.12</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.javen205</groupId> |
| | | <artifactId>IJPay</artifactId> |
| | | <version>1.1.9</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common-seata</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | |
| | | |
| | | <build> |
| | | <finalName>${project.artifactId}</finalName> |
| | | <plugins> |
| | |
| | | package com.ruoyi.order.controller.forepart; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.order.domain.MemberInvoice; |
| | |
| | | import com.ruoyi.order.service.ILogisticsService; |
| | | import com.ruoyi.order.service.impl.LogisticsServiceImpl; |
| | | import com.ruoyi.system.api.domain.Logistics; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.dto.LogisticsDTO; |
| | | import com.ruoyi.system.api.domain.vo.Express100VO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private ILogisticsService iLogisticsService; |
| | | @PostMapping("/getLogistics") |
| | | @ApiOperation(value = "用户端-获取快递公司") |
| | | public R<Logistics> getLogistics() { |
| | | iLogisticsService.list(); |
| | | return R.ok(); |
| | | public R<List<Logistics>> getLogistics() { |
| | | return R.ok(iLogisticsService.list()); |
| | | } |
| | | |
| | | @PostMapping("/getLogisticsList") |
| | |
| | | return R.ok(iLogisticsService.getLogisticsList(logisticsDTO)); |
| | | } |
| | | |
| | | @PostMapping("/getLogisticsOne") |
| | | @ApiOperation(value = "用户端-获取快递公司名稱") |
| | | public R<Logistics> getLogisticsOne(@RequestBody LogisticsDTO logisticsDTO) { |
| | | LambdaQueryWrapper<Logistics> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Logistics::getLogisticsNum,logisticsDTO.getCompany()); |
| | | return R.ok( iLogisticsService.getOne(wrapper)); |
| | | } |
| | | |
| | | @PostMapping("/isLogisticsOne") |
| | | @ApiOperation(value = "用户端-获取快递是否正确") |
| | | public R<Boolean> isLogisticsOne(@RequestBody LogisticsDTO logisticsDTO) { |
| | | |
| | | return R.ok( iLogisticsService.isLogisticsOne(logisticsDTO)); |
| | | } |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/delOrderOne") |
| | | @ApiOperation(value = "用户端-删除订单") |
| | | public R delOrderOne(@RequestBody MemberOrderListDTO memberOrderListDTO) { |
| | | orderService.removeById(memberOrderListDTO.getId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/AffirmOrderOne") |
| | | @ApiOperation(value = "用户端-确认收货订单") |
| | | public R AffirmOrderOne(@RequestBody MemberOrderListDTO memberOrderListDTO) { |
| | |
| | | |
| | | @PostMapping("/saveOrderReturnRequest") |
| | | @ApiOperation(value = "用户端-申请订单售后") |
| | | public R saveOrderReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequestService.saveOrderReturnRequest(OrderReturnDTO); |
| | | return R.ok(); |
| | | public R<OrderReturnVO>saveOrderReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | return R.ok(OrderReturnRequestService.saveOrderReturnRequest(OrderReturnDTO)); |
| | | } |
| | | |
| | | @PostMapping("/updOrderReturnRequest") |
| | | @ApiOperation(value = "修改用户端-修改订单售后") |
| | | @ApiOperation(value = "用户端-修改订单售后") |
| | | public R updOrderReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequestService.updOrderReturnRequest(OrderReturnDTO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/OrderReturnRequestInfo") |
| | | @ApiOperation(value = "修改用户端-订单售后详情") |
| | | public R<OrderReturnVO> OrderReturnRequestInfo(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequestService.OrderReturnRequestInfo(OrderReturnDTO); |
| | | @PostMapping("/qxReturnRequest") |
| | | @ApiOperation(value = "用户端-取消订单售后") |
| | | public R qxReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequestService.qxReturnRequest(OrderReturnDTO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/wlReturnRequest") |
| | | @ApiOperation(value = "用户端-订单售后填写物流") |
| | | public R wlReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequestService.wlReturnRequest(OrderReturnDTO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/OrderReturnRequestInfo") |
| | | @ApiOperation(value = "用户端-订单售后详情") |
| | | public R<OrderReturnVO> OrderReturnRequestInfo(@RequestBody OrderReturnDTO OrderReturnDTO) { |
| | | return R.ok( OrderReturnRequestService.OrderReturnRequestInfo(OrderReturnDTO)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | | import com.ruoyi.order.service.IOrderAuctionBondService; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListDTO; |
| | | import com.ruoyi.system.api.domain.dto.BondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestHeader; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | } |
| | | |
| | | @GetMapping("/refund-bond/{id}") |
| | | public R<?> returnBondByAuctionGoodsId(@PathVariable("id") Long id) { |
| | | iOrderAuctionBondService.returnBondByAuctionGoodsId(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.controller.inner; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | |
| | | |
| | | } |
| | | |
| | | @PostMapping("/getOrderOne") |
| | | @ResponseBody |
| | | @InnerAuth |
| | | public R<Order> getOrderOne(@RequestBody OrderDTO OrderDTO) { |
| | | |
| | | LambdaQueryWrapper<Order> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Order::getMemberId,OrderDTO.getMemberId()); |
| | | wrapper.eq(Order::getOrderStatus,4); |
| | | wrapper.eq(Order::getAuctionOrderType,2 ); |
| | | wrapper.eq(Order::getGoodsSkuId,OrderDTO.getGoodsSkuId()); |
| | | wrapper.eq(Order::getDelFlag,0); |
| | | wrapper.orderByDesc(Order::getCancelTime); |
| | | Order page1 = orderService.getOne(wrapper); |
| | | |
| | | return R.ok(page1); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/getOrderOne1") |
| | | @ResponseBody |
| | | @InnerAuth |
| | | public R<Order> getOrderOne1(@RequestBody OrderDTO OrderDTO) { |
| | | |
| | | LambdaQueryWrapper<Order> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Order::getMemberId,OrderDTO.getMemberId()); |
| | | wrapper.eq(Order::getOrderStatus,4); |
| | | wrapper.eq(Order::getAuctionOrderType,1 ); |
| | | wrapper.eq(Order::getGoodsSkuId,OrderDTO.getGoodsSkuId()); |
| | | wrapper.eq(Order::getDelFlag,0); |
| | | wrapper.orderByDesc(Order::getCancelTime); |
| | | Order page1 = orderService.getOne(wrapper); |
| | | |
| | | return R.ok(page1); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取某个商品的已购会员数 |
New file |
| | |
| | | package com.ruoyi.order.controller.management; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.controller.management.dto.MgtOrderStaticsQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtOrderStaticsVO; |
| | | import com.ruoyi.order.service.impl.MgtBusinessDataService; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Api(tags = "业务数据相关接口") |
| | | @RestController |
| | | @RequestMapping("/mgt/business-data") |
| | | @RequiredArgsConstructor |
| | | public class MgtBusinessDataController { |
| | | |
| | | private final MgtBusinessDataService mgtBusinessDataService; |
| | | |
| | | @PostMapping("/get-overview") |
| | | public R<MgtOrderStaticsVO> getOverview(@Validated @RequestBody MgtOrderStaticsQuery query) { |
| | | return R.ok(mgtBusinessDataService.getOverview(query)); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.order.controller.management.dto.MgtMemberInvoicingAuditDTO; |
| | | import com.ruoyi.order.controller.management.dto.MgtMemberInvoicingQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtMemberInvoicingVO; |
| | | import com.ruoyi.order.service.IMemberInvoiceService; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | |
| | | private final IMemberInvoiceService memberInvoiceService; |
| | | |
| | | /** |
| | | * 获取开票申请列表分页数据 |
| | | * |
| | | * @param query 管理后台-开票申请相关接口 |
| | | * @return PageDTO<MgtMemberInvoicingVO> |
| | | */ |
| | | @ApiOperation("获取开票申请列表分页数据") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<MgtMemberInvoicingVO>> getMemberInvoicingPage( |
| | | @Validated @RequestBody MgtMemberInvoicingQuery query) { |
| | | return R.ok(memberInvoiceService.getMemberInvoicingPage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查看详情 |
| | | * |
| | | * @param id 开票申请id |
| | | * @return MgtMemberInvoicingVO |
| | | */ |
| | | @ApiOperation("查看详情") |
| | | @GetMapping("/detail/{id}") |
| | | public R<MgtMemberInvoicingVO> getMemberInvoicingDetail( |
| | | @Validated @PathVariable("id") Long id) { |
| | | return R.ok(memberInvoiceService.getMemberInvoicingDetail(id)); |
| | | } |
| | | |
| | | /** |
| | | * 审核 |
| | | * |
| | | * @param dto 管理后台-开票申请审核数据传输对象 |
| | | */ |
| | | @ApiOperation("开票申请审核") |
| | | @PutMapping("/audit") |
| | | public R<?> audit(@RequestBody MgtMemberInvoicingAuditDTO dto) { |
| | | memberInvoiceService.audit(dto); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | |
| | | * @return MgtOrderReturnRequestVO |
| | | */ |
| | | @ApiOperation("查看详情") |
| | | @PostMapping("/detail/{id}") |
| | | @GetMapping("/detail/{id}") |
| | | public R<MgtOrderReturnRequestVO> getOrderReturnRequestDetail( |
| | | @ApiParam(name = "id", value = "售后id", required = true) @PathVariable("id") Long id) { |
| | | return R.ok(orderReturnRequestService.getOrderReturnRequestDetail(id)); |
New file |
| | |
| | | package com.ruoyi.order.controller.management.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/17 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "管理后台-开票申请审核数据传输对象") |
| | | public class MgtMemberInvoicingAuditDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 270187655212997297L; |
| | | |
| | | @ApiModelProperty(value = "开票申请id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "开票状态 1待审核,2 已开票,3 已拒绝", notes = "传数字") |
| | | private Integer invoiceStatus; |
| | | |
| | | @ApiModelProperty(value = "拒绝原因") |
| | | private String remark; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.controller.management.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("订单统计查询对象") |
| | | public class MgtOrderStaticsQuery implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -3594771110201346889L; |
| | | |
| | | @ApiModelProperty(value = "开始时间", notes = "类型为自定义时必传") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间", notes = "类型为自定义时必传") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty("时间类型 1:今天 2:最近7天 3:最近30天 4:自定义") |
| | | @NotNull(message = "时间类型不能为空") |
| | | private Integer timeType; |
| | | } |
| | |
| | | @ApiModelProperty(value = "开票状态 1待审核,2 已开票,3 已拒绝") |
| | | private Integer invoiceStatus; |
| | | |
| | | @ApiModelProperty(value = "拒绝原因") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "申请金额") |
| | | private BigDecimal invoiceMoney; |
| | | |
| | | @ApiModelProperty("关联订单") |
| | | private String orderNo; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.controller.management.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("订单统计视图对象") |
| | | public class MgtOrderStaticsVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -6511810306263817540L; |
| | | @ApiModelProperty("商城订单统计-订单总数") |
| | | private Integer mallOrderTotalCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-商城订单") |
| | | private Integer mallOrderCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-秒杀订单") |
| | | private Integer seckillOrderCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-团购订单") |
| | | private Integer groupPurchaseOrderCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-订单总金额") |
| | | private BigDecimal mallOrderTotalAmount; |
| | | |
| | | @ApiModelProperty("商城订单统计-商城总金额") |
| | | private BigDecimal mallTotalAmount; |
| | | |
| | | @ApiModelProperty("商城订单统计-秒杀总金额") |
| | | private BigDecimal seckillTotalAmount; |
| | | |
| | | @ApiModelProperty("商城订单统计-团购总金额") |
| | | private BigDecimal groupPurchaseTotalAmount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-订单总数") |
| | | private Integer auctionOrderTotalCount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖商品订单") |
| | | private Integer auctionGoodsOrderCount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖场订单") |
| | | private Integer auctionSalesroomOrderCount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-订单总金额") |
| | | private BigDecimal auctionOrderTotalAmount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖商品总金额") |
| | | private BigDecimal auctionGoodsTotalAmount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖场总金额") |
| | | private BigDecimal auctionSalesroomTotalAmount; |
| | | } |
| | |
| | | private BigDecimal orderMoney; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | private Integer orderId; |
| | | private Long orderId; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "申请原因") |
| | | private String requestReason; |
| | | |
| | | @ApiModelProperty(value = "售后状态 1=待审核 2=待退货 3=待平台收货 4=已完成 5=已拒绝") |
| | | @ApiModelProperty(value = "售后状态 1=待审核 2=待退货 3=待平台收货 4=已完成 5=已拒绝 6取消") |
| | | private ReturnRequestStatusEnum status; |
| | | |
| | | @ApiModelProperty(value = "审核状态 1=待审核 2=已通过 3=已拒绝") |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "开发票传输对象", description = "开发票传输对象") |
| | | public class MemberInvoiceDTO extends BasePage { |
| | | @ApiModelProperty(value = "数据id") |
| | | private Integer id; |
| | |
| | | private String corporationAccount; |
| | | |
| | | @ApiModelProperty(value = "订单编号List") |
| | | private List<Integer> orderId; |
| | | private List<Long> orderId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.restTemplate; |
| | | |
| | | import org.springframework.boot.web.client.RestTemplateBuilder; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | @Configuration |
| | | public class RestTemplateConfig { |
| | | @Bean |
| | | public RestTemplate restTemplate(RestTemplateBuilder builder){ |
| | | return builder.build(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | Express100VO getLogisticsList(@RequestBody LogisticsDTO logisticsDTO); |
| | | |
| | | Boolean isLogisticsOne(@RequestBody LogisticsDTO logisticsDTO); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.order.controller.management.dto.MgtMemberInvoicingAuditDTO; |
| | | import com.ruoyi.order.controller.management.dto.MgtMemberInvoicingQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtMemberInvoicingVO; |
| | | import com.ruoyi.order.domain.MemberInvoice; |
| | |
| | | |
| | | PageDTO<MemberInvoice> getMemberInvoiceList(MemberInvoiceDTO memberInvoiceDTO); |
| | | |
| | | /** |
| | | * 获取开票申请列表分页数据 |
| | | * |
| | | * @param query 管理后台-开票申请相关接口 |
| | | * @return PageDTO<MgtMemberInvoicingVO> |
| | | */ |
| | | PageDTO<MgtMemberInvoicingVO> getMemberInvoicingPage(MgtMemberInvoicingQuery query); |
| | | |
| | | /** |
| | | * 查看详情 |
| | | * |
| | | * @param id 开票申请id |
| | | * @return MgtMemberInvoicingVO |
| | | */ |
| | | MgtMemberInvoicingVO getMemberInvoicingDetail(Long id); |
| | | |
| | | /** |
| | | * 审核 |
| | | * |
| | | * @param dto 管理后台-开票申请审核数据传输对象 |
| | | */ |
| | | void audit(MgtMemberInvoicingAuditDTO dto); |
| | | } |
| | |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.BondStatusEnum; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import java.util.List; |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import java.util.List; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | |
| | | * @param bondStatusEnum 保证金状态 |
| | | */ |
| | | void updateOrderAuctionBondStatus(List<Long> ids, BondStatusEnum bondStatusEnum); |
| | | |
| | | void returnBondByAuctionGoodsId(Long id); |
| | | } |
| | |
| | | */ |
| | | public interface IOrderReturnRequestService extends IService<OrderReturnRequest> { |
| | | |
| | | void saveOrderReturnRequest(OrderReturnDTO OrderReturnDTO); |
| | | OrderReturnVO saveOrderReturnRequest(OrderReturnDTO OrderReturnDTO); |
| | | void updOrderReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO); |
| | | void qxReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO); |
| | | |
| | | void wlReturnRequest(@RequestBody OrderReturnDTO OrderReturnDTO); |
| | | |
| | | |
| | | OrderReturnVO OrderReturnRequestInfo(@RequestBody OrderReturnDTO OrderReturnDTO); |
| | | |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.nacos.shaded.com.google.gson.Gson; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.kuaidi100.sdk.api.QueryTrack; |
| | | import com.kuaidi100.sdk.core.IBaseClient; |
| | |
| | | import com.kuaidi100.sdk.request.QueryTrackParam; |
| | | import com.kuaidi100.sdk.request.QueryTrackReq; |
| | | import com.kuaidi100.sdk.utils.SignUtils; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.mapper.LogisticsMapper; |
| | | import com.ruoyi.order.service.ILogisticsService; |
| | | import com.ruoyi.order.vo.KuaiDiCode; |
| | | import com.ruoyi.system.api.domain.Logistics; |
| | | import com.ruoyi.system.api.domain.dto.LogisticsDTO; |
| | | import com.ruoyi.system.api.domain.vo.Express100VO; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | ILogisticsService { |
| | | |
| | | private String key="BltjQodT7186"; |
| | | |
| | | private String kye1="GMtjjhxp9pdEpfz37M"; |
| | | private String customer="56DE8E9E3D58CE73C60755C8B7483043"; |
| | | |
| | | private static final String AUTONUMBER_AUTO_URL = "http://www.kuaidi100.com/autonumber/auto?num=NUM&key=KEY"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | |
| | | @Override |
| | |
| | | Gson gson = new Gson(); |
| | | String responseBody = execute.getBody(); |
| | | Express100VO response = gson.fromJson(responseBody, Express100VO.class); |
| | | LambdaQueryWrapper<Logistics> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Logistics::getLogisticsNum,logisticsDTO.getCompany()); |
| | | Logistics one = this.getOne(wrapper); |
| | | response.setLogisticsName(one.getLogisticsName()); |
| | | return response; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean isLogisticsOne(LogisticsDTO logisticsDTO) { |
| | | Boolean b=false; |
| | | |
| | | |
| | | |
| | | Map<String,String> params=new HashMap(); |
| | | params.put("secret_key", "GMtjjhxp9pdEpfz37M"); |
| | | params.put("secret_code", "53514ac63f0447d188423221550b0c3e"); |
| | | params.put("secret_sign", "8265A3C04DDA73E5B899F7F750099BB0"); |
| | | params.put("num", logisticsDTO.getPostid()); |
| | | String string=post(params); |
| | | if (string.equals("[]")){ |
| | | return b; |
| | | }else{ |
| | | return b=true; |
| | | } |
| | | |
| | | } |
| | | |
| | | public String post(Map<String,String> params){ |
| | | StringBuilder response=new StringBuilder(""); |
| | | BufferedReader reader = null; |
| | | try { |
| | | StringBuilder builder =new StringBuilder(); |
| | | for(Map.Entry param:params.entrySet()){ |
| | | if(builder.length()>0){ |
| | | builder.append('&'); |
| | | } |
| | | builder.append(URLEncoder.encode(param.getKey().toString(),"UTF-8")); |
| | | builder.append('='); |
| | | builder.append(URLEncoder.encode(String.valueOf(param.getValue()),"UTF-8")); |
| | | } |
| | | byte[]bytes=builder.toString().getBytes("UTF-8"); |
| | | URL url=new URL("http://cloud.kuaidi100.com/api"); |
| | | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
| | | conn.setConnectTimeout(5000); |
| | | conn.setReadTimeout(5000); |
| | | conn.setRequestMethod("POST"); |
| | | conn.setRequestProperty("accept","*/*"); |
| | | conn.setRequestProperty("connection","Keep-Alive"); |
| | | conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); |
| | | conn.setRequestProperty("Content-Length",String.valueOf(bytes.length)); |
| | | conn.setDoOutput(true); |
| | | conn.getOutputStream().write(bytes); |
| | | reader=new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8")); |
| | | String line = ""; |
| | | while ((line =reader.readLine())!=null){ |
| | | response.append(line); |
| | | } |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | }finally{ |
| | | try{ |
| | | if (null!=reader){ |
| | | reader.close(); |
| | | } |
| | | }catch(IOException e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return response.toString(); |
| | | } |
| | | } |
| | |
| | | if (memberInvoiceRise==null){ |
| | | memberInvoiceRise=new MemberInvoiceRise(); |
| | | } |
| | | if (memberInvoiceRiseDTO.getIsDefault()==2){ |
| | | LambdaQueryWrapper<MemberInvoiceRise> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(MemberInvoiceRise::getMemberId,memberInvoiceRiseDTO.getMemberId()); |
| | | wrapper1.eq(MemberInvoiceRise::getDelFlag,0); |
| | | wrapper1.eq(MemberInvoiceRise::getIsDefault,2); |
| | | MemberInvoiceRise memberInvoiceRise2= this.getOne(wrapper1); |
| | | memberInvoiceRise2.setIsDefault(1); |
| | | this.updateById(memberInvoiceRise2); |
| | | } |
| | | |
| | | |
| | | memberInvoiceRise.setInvoiceType(memberInvoiceRiseDTO.getInvoiceType()); |
| | | memberInvoiceRise.setRiseType(memberInvoiceRiseDTO.getRiseType()); |
| | |
| | | memberInvoiceRise.setCorporationAccount(memberInvoiceRiseDTO.getCorporationAccount()); |
| | | memberInvoiceRise.setCorporationOpen(memberInvoiceRiseDTO.getCorporationOpen()); |
| | | memberInvoiceRise.setCorporationPhone(memberInvoiceRiseDTO.getCorporationPhone()); |
| | | memberInvoiceRise.setIsDefault(memberInvoiceRiseDTO.getIsDefault()); |
| | | memberInvoiceRise.setMemberId(memberInvoiceRiseDTO.getMemberId()); |
| | | memberInvoiceRise.setIsDefault(1); |
| | | |
| | | this.saveOrUpdate(memberInvoiceRise); |
| | | } |
| | |
| | | wrapper1.eq(MemberInvoiceRise::getDelFlag,0); |
| | | wrapper1.eq(MemberInvoiceRise::getIsDefault,2); |
| | | MemberInvoiceRise memberInvoiceRise2= this.getOne(wrapper1); |
| | | if(memberInvoiceRise2!=null){ |
| | | memberInvoiceRise2.setIsDefault(1); |
| | | this.updateById(memberInvoiceRise2); |
| | | |
| | | } |
| | | MemberInvoiceRise memberInvoiceRise=this.getById(memberInvoiceRiseDTO.getId()); |
| | | memberInvoiceRise.setIsDefault(2); |
| | | this.updateById(memberInvoiceRise); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.order.controller.management.dto.MgtMemberInvoicingAuditDTO; |
| | | import com.ruoyi.order.controller.management.dto.MgtMemberInvoicingQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtMemberInvoicingVO; |
| | | import com.ruoyi.order.domain.MemberInvoice; |
| | |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import io.seata.common.util.StringUtils; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | memberInvoice.setCorporationPhone(memberInvoiceDTO.getCorporationPhone()); |
| | | memberInvoice.setCorporationOpen(memberInvoiceDTO.getCorporationOpen()); |
| | | memberInvoice.setRiseType(memberInvoiceDTO.getRiseType()); |
| | | this.save(memberInvoice); |
| | | |
| | | List<Integer> memberInvoiceOrderList=memberInvoiceDTO.getOrderId(); |
| | | for (Integer memberInvoiceOrder:memberInvoiceOrderList){ |
| | | BigDecimal pice=new BigDecimal(0.0); |
| | | this.save(memberInvoice); |
| | | List<Long> memberInvoiceOrderList=memberInvoiceDTO.getOrderId(); |
| | | for (Long memberInvoiceOrder:memberInvoiceOrderList){ |
| | | MemberInvoiceOrder memberInvoiceOrder1=new MemberInvoiceOrder(); |
| | | Order order= iOrderService.getById(memberInvoiceOrder); |
| | | order.setInvoiceStatus(1); |
| | |
| | | OrderName=order.getSkuName(); |
| | | memberInvoiceOrder1.setOrderName(OrderName); |
| | | iMemberInvoiceOrderService.save(memberInvoiceOrder1); |
| | | pice.add(order.getTotalAmount()); |
| | | } |
| | | memberInvoice.setInvoiceMoney(pice); |
| | | this.updateById(memberInvoice); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return PageDTO.of(page1); |
| | | } |
| | | |
| | | /** |
| | | * 获取开票申请列表分页数据 |
| | | * |
| | | * @param query 管理后台-开票申请相关接口 |
| | | * @return PageDTO<MgtMemberInvoicingVO> |
| | | */ |
| | | @Override |
| | | public PageDTO<MgtMemberInvoicingVO> getMemberInvoicingPage(MgtMemberInvoicingQuery query) { |
| | | Page<MemberInvoice> page = new Page<>(query.getPageCurr(), query.getPageSize()); |
| | |
| | | .in(com.ruoyi.common.core.utils.StringUtils.isNotEmpty(memberIdSet), |
| | | MemberInvoice::getMemberId, memberIdSet) |
| | | .eq(query.getInvoiceStatus() != null, MemberInvoice::getInvoiceStatus, |
| | | query.getInvoiceStatus()).page(page); |
| | | query.getInvoiceStatus()).orderByDesc(MemberInvoice::getCreateTime) |
| | | .page(page); |
| | | if (page.getRecords().isEmpty()) { |
| | | return PageDTO.empty(page); |
| | | } |
| | |
| | | }); |
| | | return pageVO; |
| | | } |
| | | |
| | | /** |
| | | * 查看详情 |
| | | * |
| | | * @param id 开票申请id |
| | | * @return MgtMemberInvoicingVO |
| | | */ |
| | | @Override |
| | | public MgtMemberInvoicingVO getMemberInvoicingDetail(Long id) { |
| | | MemberInvoice memberInvoice = getMemberInvoice(id); |
| | | MgtMemberInvoicingVO mgtMemberInvoicingVO = BeanUtils.copyBean(memberInvoice, |
| | | MgtMemberInvoicingVO.class); |
| | | // 查询用户信息 |
| | | Member member = memberClient.getMembeOne(mgtMemberInvoicingVO.getMemberId(), |
| | | SecurityConstants.INNER).getData(); |
| | | if (Objects.nonNull(member)) { |
| | | mgtMemberInvoicingVO.setNickname(member.getNickname()); |
| | | mgtMemberInvoicingVO.setPhone(member.getPhone()); |
| | | } |
| | | // 查询关联订单 |
| | | List<MemberInvoiceOrder> memberInvoiceOrderList = iMemberInvoiceOrderService.lambdaQuery() |
| | | .eq(MemberInvoiceOrder::getInvoiceId, id).list(); |
| | | String orderNo = memberInvoiceOrderList.stream().map(MemberInvoiceOrder::getOrderNo) |
| | | .collect(Collectors.joining(",")); |
| | | mgtMemberInvoicingVO.setOrderNo(orderNo); |
| | | return mgtMemberInvoicingVO; |
| | | } |
| | | |
| | | @NotNull |
| | | private MemberInvoice getMemberInvoice(Long id) { |
| | | MemberInvoice memberInvoice = this.getById(id); |
| | | if (Objects.isNull(memberInvoice)) { |
| | | throw new ServiceException("开票申请不存在"); |
| | | } |
| | | return memberInvoice; |
| | | } |
| | | |
| | | /** |
| | | * 审核 |
| | | * |
| | | * @param dto 管理后台-开票申请审核数据传输对象 |
| | | */ |
| | | @Override |
| | | public void audit(MgtMemberInvoicingAuditDTO dto) { |
| | | MemberInvoice memberInvoice = getMemberInvoice(dto.getId()); |
| | | if (!Objects.equals(memberInvoice.getInvoiceStatus(), 1)) { |
| | | throw new ServiceException("该开票申请已被审核"); |
| | | } |
| | | memberInvoice.setInvoiceStatus(dto.getInvoiceStatus()); |
| | | if (Objects.equals(dto.getInvoiceStatus(), 3)) { |
| | | memberInvoice.setRemark(dto.getRemark()); |
| | | } |
| | | this.updateById(memberInvoice); |
| | | // 更新关联订单状态 |
| | | List<MemberInvoiceOrder> memberInvoiceOrderList = iMemberInvoiceOrderService.lambdaQuery() |
| | | .eq(MemberInvoiceOrder::getInvoiceId, memberInvoice) |
| | | .list(); |
| | | Set<Long> orderIdSet = memberInvoiceOrderList.stream() |
| | | .map(MemberInvoiceOrder::getOrderId) |
| | | .collect(Collectors.toSet()); |
| | | if (!orderIdSet.isEmpty()) { |
| | | iOrderService.lambdaUpdate() |
| | | .set(Order::getInvoiceStatus, dto.getInvoiceStatus() == 2 ? 3 : 4) |
| | | .in(Order::getId, orderIdSet).update(); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.ruoyi.common.core.enums.TimeTypeEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.order.controller.management.dto.MgtOrderStaticsQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtOrderStaticsVO; |
| | | import com.ruoyi.order.service.IOrderService; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MgtBusinessDataService { |
| | | |
| | | private final IOrderService orderService; |
| | | |
| | | public MgtOrderStaticsVO getOverview(MgtOrderStaticsQuery query) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | getTimeByTimeType(query, startTime, endTime, now); |
| | | return null; |
| | | } |
| | | |
| | | private static void getTimeByTimeType(MgtOrderStaticsQuery query, LocalDateTime startTime, |
| | | LocalDateTime endTime, LocalDateTime now) { |
| | | if (Objects.equals(TimeTypeEnum.TODAY.getCode(), query.getTimeType())) { |
| | | startTime = DateUtils.getDayStart(now); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } else if (Objects.equals(TimeTypeEnum.PAST_SEVEN_DAYS.getCode(), query.getTimeType())) { |
| | | startTime = DateUtils.getDayStart(now.minusDays(7)); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } else if (Objects.equals(TimeTypeEnum.PAST_THIRTY_DAYS.getCode(), query.getTimeType())) { |
| | | startTime = DateUtils.getDayStart(now.minusDays(30)); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } else if (Objects.equals(TimeTypeEnum.CUSTOM.getCode(), query.getTimeType())) { |
| | | if (Objects.isNull(query.getStartTime()) || Objects.isNull(query.getEndTime())) { |
| | | throw new ServiceException("自定义时间不能为空"); |
| | | } |
| | | startTime = query.getStartTime(); |
| | | endTime = query.getEndTime(); |
| | | } else { |
| | | startTime = DateUtils.getDayStart(now); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.RefundDTO; |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import com.ruoyi.system.api.feignClient.AuctionClient; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | * @author mitao |
| | | * @since 2024-05-16 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class OrderAuctionBondServiceImpl extends ServiceImpl<OrderAuctionBondMapper, OrderAuctionBond> implements IOrderAuctionBondService { |
| | | |
| | |
| | | @Override |
| | | public PayInfoVO SaveOrderAuctionBond(MemberAuctionSalesroomBondDTO memberAuctionSalesroomBondDTO) { |
| | | PayInfoVO payInfoVO = new PayInfoVO(); |
| | | if (memberAuctionSalesroomBondDTO.getBondType() == 2) { |
| | | AuctionSalesroom data = auctionClient.getauctionSalesroomOne(memberAuctionSalesroomBondDTO, SecurityConstants.INNER).getData(); |
| | | if (data.getBond().intValue() == 0) { |
| | | OrderAuctionBond orderAuctionBond = new OrderAuctionBond(); |
| | | orderAuctionBond.setOrderNo(OrderUtil.getOrderNoForPrefix("BO")); |
| | | orderAuctionBond.setAuctionSalesroomId(memberAuctionSalesroomBondDTO.getAuctionSalesroomId()); |
| | | orderAuctionBond.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | orderAuctionBond.setBond(data.getBond()); |
| | | orderAuctionBond.setBoundStatus(BondStatusEnum.PAID); |
| | | orderAuctionBond.setBondType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | this.save(orderAuctionBond); |
| | | payInfoVO.setOrderNO(orderAuctionBond.getOrderNo()); |
| | | payInfoVO.setType(0); |
| | | payInfoVO.setSubject("保证金"); |
| | | payInfoVO.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | payInfoVO.setBody("保证金"); |
| | | } else { |
| | | OrderAuctionBond orderAuctionBond = new OrderAuctionBond(); |
| | | orderAuctionBond.setOrderNo(OrderUtil.getOrderNoForPrefix("BO")); |
| | | orderAuctionBond.setAuctionSalesroomId(memberAuctionSalesroomBondDTO.getAuctionSalesroomId()); |
| | | orderAuctionBond.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | orderAuctionBond.setBond(data.getBond()); |
| | | orderAuctionBond.setBoundStatus(BondStatusEnum.TO_PLAY); |
| | | orderAuctionBond.setBondType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | if (memberAuctionSalesroomBondDTO.getPaymentMethod() == 1) { |
| | | orderAuctionBond.setPaymentMethod(PaymentMethodEnum.WECHAT); |
| | | } else { |
| | | orderAuctionBond.setPaymentMethod(PaymentMethodEnum.ALIPAY); |
| | | } |
| | | |
| | | this.save(orderAuctionBond); |
| | | |
| | | payInfoVO.setOrderNO(orderAuctionBond.getOrderNo()); |
| | | if (memberAuctionSalesroomBondDTO.getPaymentMethod() == 1) { |
| | | payInfoVO.setType(2); |
| | | } else { |
| | | payInfoVO.setType(1); |
| | | } |
| | | payInfoVO.setSubject("保证金"); |
| | | payInfoVO.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | payInfoVO.setBody("保证金"); |
| | | } |
| | | } else { |
| | | if (memberAuctionSalesroomBondDTO.getBondType() == 1) { |
| | | AuctionGoods data = auctionClient.getauctionGoodsOne(memberAuctionSalesroomBondDTO, SecurityConstants.INNER).getData(); |
| | | if (data.getBond().intValue() == 0) { |
| | | OrderAuctionBond orderAuctionBond = new OrderAuctionBond(); |
| | | orderAuctionBond.setOrderNo(OrderUtil.getOrderNoForPrefix("BO")); |
| | | orderAuctionBond.setAuctionGoodsId(memberAuctionSalesroomBondDTO.getAuctionGoodsId()); |
| | | orderAuctionBond.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | orderAuctionBond.setBond(data.getBond()); |
| | | orderAuctionBond.setBoundStatus(BondStatusEnum.PAID); |
| | | orderAuctionBond.setBondType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | this.save(orderAuctionBond); |
| | | payInfoVO.setOrderNO(orderAuctionBond.getOrderNo()); |
| | | payInfoVO.setType(0); |
| | | payInfoVO.setSubject("保证金"); |
| | | payInfoVO.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | payInfoVO.setBody("保证金"); |
| | | } else { |
| | | OrderAuctionBond orderAuctionBond = new OrderAuctionBond(); |
| | | orderAuctionBond.setOrderNo(OrderUtil.getOrderNoForPrefix("BO")); |
| | | orderAuctionBond.setAuctionGoodsId(memberAuctionSalesroomBondDTO.getAuctionGoodsId()); |
| | | orderAuctionBond.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | orderAuctionBond.setBond(data.getBond()); |
| | | orderAuctionBond.setBoundStatus(BondStatusEnum.TO_PLAY); |
| | | orderAuctionBond.setBondType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | if (memberAuctionSalesroomBondDTO.getPaymentMethod() == 1) { |
| | | orderAuctionBond.setPaymentMethod(PaymentMethodEnum.WECHAT); |
| | | } else { |
| | | orderAuctionBond.setPaymentMethod(PaymentMethodEnum.ALIPAY); |
| | | } |
| | | this.save(orderAuctionBond); |
| | | payInfoVO.setOrderNO(orderAuctionBond.getOrderNo()); |
| | | if (memberAuctionSalesroomBondDTO.getPaymentMethod() == 1) { |
| | | payInfoVO.setType(2); |
| | | } else { |
| | | payInfoVO.setType(1); |
| | | } |
| | | payInfoVO.setOrderNO(orderAuctionBond.getOrderNo()); |
| | | payInfoVO.setSubject("保证金"); |
| | | payInfoVO.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | payInfoVO.setBody("保证金"); |
| | | } |
| | | } else { |
| | | AuctionSalesroom data = auctionClient.getauctionSalesroomOne(memberAuctionSalesroomBondDTO, SecurityConstants.INNER).getData(); |
| | | |
| | | if (data.getBond().intValue() == 0) { |
| | | OrderAuctionBond orderAuctionBond = new OrderAuctionBond(); |
| | | orderAuctionBond.setOrderNo(OrderUtil.getOrderNoForPrefix("BO")); |
| | | orderAuctionBond.setAuctionSalesroomId(memberAuctionSalesroomBondDTO.getAuctionSalesroomId()); |
| | | orderAuctionBond.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | orderAuctionBond.setBond(data.getBond()); |
| | |
| | | } else { |
| | | payInfoVO.setType(1); |
| | | } |
| | | payInfoVO.setOrderNO(orderAuctionBond.getOrderNo()); |
| | | payInfoVO.setSubject("保证金"); |
| | | payInfoVO.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); |
| | | payInfoVO.setBody("保证金"); |
| | |
| | | } |
| | | return payInfoVO; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
| | | public void returnBondByAuctionGoodsId(Long id) { |
| | | List<OrderAuctionBond> list = this.lambdaQuery().eq(OrderAuctionBond::getAuctionGoodsId, id) |
| | | .eq(OrderAuctionBond::getBoundStatus, BondStatusEnum.PAID).list(); |
| | | Set<String> orderNoSet = list.stream().map(OrderAuctionBond::getOrderNo) |
| | | .collect(Collectors.toSet()); |
| | | List<RefundDTO> refundDTOList = list.stream().map(item -> { |
| | | RefundDTO refundDTO = new RefundDTO(); |
| | | refundDTO.setAmount(item.getBond()); |
| | | refundDTO.setOrderNo(item.getOrderNo()); |
| | | return refundDTO; |
| | | }).collect(Collectors.toList()); |
| | | Map<String, Object> data = iPaylogService.refund(refundDTOList); |
| | | // 处理退款返回结果 |
| | | List<String> successfulOrders = new ArrayList<>(); |
| | | List<String> failedOrders = new ArrayList<>(); |
| | | |
| | | data.forEach((key, value) -> { |
| | | if ((boolean) value) { |
| | | successfulOrders.add(key); |
| | | } else { |
| | | failedOrders.add(key); |
| | | } |
| | | }); |
| | | log.info("订单号:{},退款失败", failedOrders); |
| | | // 退款成功的订单修改状态 |
| | | List<OrderAuctionBond> collect = list.stream().map(bond -> { |
| | | if (successfulOrders.contains(bond.getOrderNo())) { |
| | | bond.setBoundStatus(BondStatusEnum.REFUNDED); |
| | | return bond; |
| | | } |
| | | return null; |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | this.updateBatchById(collect); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.vo.OrderReturnVO; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.HuaWeiOBSUtil; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class OrderReturnRequestServiceImpl extends ServiceImpl<OrderReturnRequestMapper, OrderReturnRequest> implements IOrderReturnRequestService { |
| | | |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | |
| | | @Resource |
| | | private PaylogServiceImpl paylogService; |
| | | @Override |
| | | public void saveOrderReturnRequest(OrderReturnDTO OrderReturnDTO) { |
| | | public OrderReturnVO saveOrderReturnRequest(OrderReturnDTO OrderReturnDTO) { |
| | | |
| | | Order order = orderMapper.selectById(OrderReturnDTO.getOrderId()); |
| | | order.setOrderStatus(OrderStatusEnum.AFTER_SALE); |
| | | orderMapper.updateById(order); |
| | | OrderReturnRequest orderReturnRequest = new OrderReturnRequest(); |
| | | orderReturnRequest.setOrderId(OrderReturnDTO.getOrderId()); |
| | | orderReturnRequest.setRequestTime(LocalDateTime.now()); |
| | |
| | | orderReturnRequest.setRequestReason(OrderReturnDTO.getRequestReason()); |
| | | orderReturnRequest.setStatus(ReturnRequestStatusEnum.TO_BE_REVIEWED); |
| | | orderReturnRequest.setAuditStatus(AuditStatusEnum.TO_BE_REVIEWED); |
| | | List<String> urlList = new ArrayList<>(); |
| | | if (OrderReturnDTO.getAlbum().length > 0) { |
| | | for (MultipartFile file : OrderReturnDTO.getAlbum()) { |
| | | try { |
| | | String url = HuaWeiOBSUtil.obsUpload(file); |
| | | urlList.add(url); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | orderReturnRequest.setAlbum(urlList.toString()); |
| | | } |
| | | |
| | | orderReturnRequest.setAlbum(OrderReturnDTO.getAlbum()); |
| | | CustomConfig returnAddressUserName = sysUserClient.getconfig("RETURN_ADDRESS_USER_NAME").getData(); |
| | | orderReturnRequest.setRecipientName(returnAddressUserName.getConfigValue()); |
| | | CustomConfig returnAddressUserPhone = sysUserClient.getconfig("RETURN_ADDRESS_USER_PHONE").getData(); |
| | |
| | | CustomConfig returnAddressUserAddress = sysUserClient.getconfig("RETURN_ADDRESS_USER_ADDRESS").getData(); |
| | | orderReturnRequest.setDetailedAddress(returnAddressUserAddress.getConfigValue()); |
| | | this.save(orderReturnRequest); |
| | | |
| | | OrderReturnRequest one = this.getById(orderReturnRequest.getId()); |
| | | OrderReturnVO orderReturnVO = BeanUtils.copyBean(one, OrderReturnVO.class); |
| | | return orderReturnVO; |
| | | |
| | | } |
| | | |
| | |
| | | OrderReturnRequest one = this.getOne(wrapper); |
| | | OrderReturnVO orderReturnVO = BeanUtils.copyBean(one, OrderReturnVO.class); |
| | | return orderReturnVO; |
| | | } |
| | | |
| | | @Override |
| | | public void qxReturnRequest(OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequest byId = this.getById(OrderReturnDTO.getId()); |
| | | byId.setStatus(ReturnRequestStatusEnum.QX); |
| | | Order order = orderMapper.selectById(byId.getOrderId()); |
| | | order.setOrderStatus(OrderStatusEnum.FINISHED); |
| | | orderMapper.updateById(order); |
| | | this.updateById(byId); |
| | | } |
| | | |
| | | @Override |
| | | public void wlReturnRequest(OrderReturnDTO OrderReturnDTO) { |
| | | OrderReturnRequest byId = this.getById(OrderReturnDTO.getId()); |
| | | byId.setStatus(ReturnRequestStatusEnum.TO_BE_RECEIVED_BY_THE_PLATFORM); |
| | | byId.setLogisticsNum(OrderReturnDTO.getLogistics()); |
| | | byId.setCourierNumber(OrderReturnDTO.getCourierNumber()); |
| | | this.updateById(byId); |
| | | } |
| | | |
| | | /** |
| | |
| | | boolean result = handleRefund(paymentMethod, paylog, orderNo); |
| | | if (result) { |
| | | paylog.setState(3);// 已退款 |
| | | order.setOrderStatus(OrderStatusEnum.REFUNDED); |
| | | paylogService.updateById(paylog); |
| | | orderMapper.updateById(order); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.dto.MemberDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberOrderDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberOrderListDTO; |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.dto.updMembeOneDTO; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.domain.vo.Express100VO; |
| | | import com.ruoyi.system.api.domain.vo.MemberOrderListVO; |
| | | import com.ruoyi.system.api.domain.vo.MemberOrderNumVO; |
| | | import com.ruoyi.system.api.domain.vo.MemberTiOrderVO; |
| | | import com.ruoyi.system.api.domain.vo.OrderVO; |
| | | import com.ruoyi.system.api.feignClient.AuctionClient; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | |
| | | wrapper.eq(OrderAuctionBond::getAuctionSalesroomId,OrderDTO.getAuctionSalesroomId()); |
| | | wrapper.eq(OrderAuctionBond::getBondType,2); |
| | | OrderAuctionBond orderAuctionBond = orderAuctionBondMapper.selectOne(wrapper); |
| | | if (orderAuctionBond!=null){ |
| | | orderAuctionBond.setOrderId(order.getId()); |
| | | orderAuctionBondMapper.updateById(orderAuctionBond); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | BigDecimal pice=new BigDecimal(0); |
| | | |
| | | Order order=new Order(); |
| | | order.setMemberId(memberOrderDTO.getMemberId()); |
| | | if (memberOrderDTO.getOrderFrom()==1){ |
| | | order.setOrderFrom(OrderFromEnum.COMMODITY_ORDER); |
| | | order.setOrderNo(OrderUtil.getOrderNoForPrefix("SP")); |
| | |
| | | order.setCoverPic(goodsSku.getCoverPic()); |
| | | order.setSjPrice(goodsSku.getPrice()); |
| | | } |
| | | order.setOrderRemark(memberOrderDTO.getOrderRemark()); |
| | | order.setMemberId(memberOrderDTO.getMemberId()); |
| | | order.setGoodsQuantity(memberOrderDTO.getGoodsQuantity()); |
| | | order.setOrderTime(LocalDateTime.now()); |
| | |
| | | @Override |
| | | public MemberTiOrderVO updMemberOrder(MemberOrderDTO memberOrderDTO) { |
| | | Order order = baseMapper.selectById(memberOrderDTO.getId()); |
| | | if(memberOrderDTO.getOrderRemark()!=null){ |
| | | order.setOrderRemark(memberOrderDTO.getOrderRemark()); |
| | | } |
| | | |
| | | MemberTiOrderVO memberOrderVO=new MemberTiOrderVO(); |
| | | if (memberOrderDTO.getReceiverDetailAddress()!=null){ |
| | |
| | | order.setOrderRemark(memberOrderDTO.getOrderRemark()); |
| | | }if (memberOrderDTO.getGoodsQuantity()!=null){ |
| | | if (order.getOrderFrom().getCode()==1){ |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(memberOrderDTO.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(order.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | if (goodsSku.getStock()<memberOrderDTO.getGoodsQuantity()){ |
| | | throw new ServiceException("对不起,购买数大于库存"); |
| | | }else{ |
| | |
| | | |
| | | } |
| | | } |
| | | if (memberOrderDTO.getGoodsQuantity()!=null){ |
| | | BigDecimal pice=order.getPrice().multiply(new BigDecimal(memberOrderDTO.getGoodsQuantity())); |
| | | if (memberOrderDTO.getCouponId()!=null){ |
| | | CouponMemberDTO couponMemberDTO=new CouponMemberDTO(); |
| | | couponMemberDTO.setId(memberOrderDTO.getCouponId()); |
| | | CouponMember data = promotionClient.getCouponMember(couponMemberDTO, SecurityConstants.INNER).getData(); |
| | | |
| | | |
| | | if (order.getCouponId()!=null){ |
| | | if (order.getCouponId()!=0){ |
| | | CouponMemberDTO couponMemberDTO1=new CouponMemberDTO(); |
| | | couponMemberDTO1.setId(memberOrderDTO.getCouponId()); |
| | | couponMemberDTO1.setCouponStatus(1); |
| | | couponMemberDTO1.setCouponStatus(0); |
| | | promotionClient.updCouponMember(couponMemberDTO1, SecurityConstants.INNER); |
| | | } |
| | | |
| | | order.setCouponId(data.getId()); |
| | | |
| | | if (data.getCouponType().getCode()==1){ |
| | | if (pice.doubleValue()>=data.getFullReductionAmount().doubleValue()){ |
| | | pice.subtract(data.getReductionAmount()); |
| | | pice=pice.subtract(data.getReductionAmount()); |
| | | order.setDiscountMoney(data.getReductionAmount()); |
| | | } |
| | | } |
| | | if (data.getCouponType().getCode()==2){ |
| | | pice= order.getTotalAmount(); |
| | | pice.subtract(data.getVoucherAmount()); |
| | | pice=pice.subtract(data.getVoucherAmount()); |
| | | order.setDiscountMoney(data.getVoucherAmount()); |
| | | } |
| | | if (data.getCouponType().getCode()==3){ |
| | |
| | | order.setCouponId(memberOrderDTO.getCouponId()); |
| | | CouponMemberDTO couponMemberDTO2=new CouponMemberDTO(); |
| | | couponMemberDTO2.setId(memberOrderDTO.getCouponId()); |
| | | couponMemberDTO2.setCouponStatus(2); |
| | | couponMemberDTO2.setCouponStatus(1); |
| | | promotionClient.updCouponMember(couponMemberDTO2, SecurityConstants.INNER); |
| | | |
| | | |
| | | |
| | | }else{ |
| | | if (order.getCouponId()!=null&&order.getCouponId()!=0){ |
| | | CouponMemberDTO couponMemberDTO1=new CouponMemberDTO(); |
| | | couponMemberDTO1.setCouponStatus(0); |
| | | couponMemberDTO1.setId(order.getCouponId()); |
| | | promotionClient.updCouponMember(couponMemberDTO1, SecurityConstants.INNER); |
| | | } |
| | | order.setCouponId(0L); |
| | | order.setDiscountMoney(new BigDecimal(0)); |
| | | } |
| | | order.setTotalAmount(pice); |
| | | |
| | |
| | | BigDecimal pi=pice.multiply(new BigDecimal(aDouble)); |
| | | order.setPoints(pi.intValue()); |
| | | baseMapper.updateById(order); |
| | | } |
| | | |
| | | |
| | | memberOrderVO.setId(order.getId()); |
| | | memberOrderVO.setOrderStatus(OrderStatusEnum.TO_PLAY); |
| | |
| | | memberOrderVO.setReceiverCity(order.getReceiverCity()); |
| | | memberOrderVO.setReceiverDetailAddress(order.getReceiverDetailAddress()); |
| | | memberOrderVO.setReceiverphone(order.getReceiverPhone()); |
| | | memberOrderVO.setYouhiPrice(order.getDiscountMoney()); |
| | | memberOrderVO.setDiscountMoney(order.getDiscountMoney()); |
| | | |
| | | return memberOrderVO; |
| | | } |
| | |
| | | Wrappers.lambdaQuery(OrderReturnRequest.class) |
| | | .eq(OrderReturnRequest::getOrderId, |
| | | MemberOrderList.getId()).last("limit 1")); |
| | | if (StringUtils.isNotNull(orderReturnRequest)) { |
| | | if (StringUtils.isNotNull(orderReturnRequest)&&orderReturnRequest!=null) { |
| | | MemberOrderList.setStatus(orderReturnRequest.getStatus()); |
| | | MemberOrderList.setRequestId(orderReturnRequest.getId()); |
| | | MemberOrderList.setIsRequest(2); |
| | | }else{ |
| | | MemberOrderList.setIsRequest(1); |
| | | } |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper3= Wrappers.lambdaQuery(); |
| | | wrapper3.eq(OrderAuctionBond::getOrderId,MemberOrderList.getId()); |
| | |
| | | Wrappers.lambdaQuery(OrderReturnRequest.class) |
| | | .eq(OrderReturnRequest::getOrderId, |
| | | orderVO.getId()).last("limit 1")); |
| | | if (StringUtils.isNotNull(orderReturnRequest)) { |
| | | if (StringUtils.isNotNull(orderReturnRequest)&&orderReturnRequest!=null) { |
| | | orderVO.setStatus(orderReturnRequest.getStatus()); |
| | | orderVO.setRequestId(orderReturnRequest.getId()); |
| | | orderVO.setIsRequest(2); |
| | | }else{ |
| | | orderVO.setIsRequest(1); |
| | | } |
| | | |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper3= Wrappers.lambdaQuery(); |
| | |
| | | query.getSkuName()) |
| | | .eq(StringUtils.isNotNull(query.getOrderStatus()), Order::getOrderStatus, |
| | | query.getOrderStatus()) |
| | | .orderByDesc(Order::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | pageVO = PageDTO.empty(page); |
| | |
| | | boolean result = handleRefund(paymentMethod, paylog, orderNo); |
| | | if (result) { |
| | | paylog.setState(3);// 已退款 |
| | | order.setOrderStatus(OrderStatusEnum.REFUNDED); |
| | | iPaylogService.updateById(paylog); |
| | | this.updateById(order); |
| | | } |
| | | OrderReturnRequest orderReturnRequest = new OrderReturnRequest(); |
| | | orderReturnRequest.setOrderId(id); |
| | |
| | | @Override |
| | | public void refundReturn(Long id) { |
| | | Order order = getOrder(id); |
| | | if (order.getOrderStatus() == OrderStatusEnum.TO_BE_SHIPPED |
| | | || order.getOrderStatus() == OrderStatusEnum.GOODS_TO_BE_RECEIVED |
| | | || order.getOrderStatus() == OrderStatusEnum.FINISHED) { |
| | | if (order.getOrderStatus() == OrderStatusEnum.FINISHED) { |
| | | OrderReturnRequest orderReturnRequest = new OrderReturnRequest(); |
| | | order.setOrderStatus(OrderStatusEnum.AFTER_SALE); |
| | | this.updateById(order); |
| | | MgtAfterSaleSettingDTO data = sysUserClient.getAfterSaleSetting().getData(); |
| | | if (StringUtils.isNull(data)) { |
| | | throw new ServiceException("获取售后退货信息失败"); |
| | | } |
| | | orderReturnRequest.setRecipientName(data.getReceiverName()); |
| | | orderReturnRequest.setRecipientPhone(data.getReceiverPhone()); |
| | | orderReturnRequest.setDetailedAddress(data.getReceiverAddress()); |
| | | orderReturnRequest.setOrderId(id); |
| | | orderReturnRequest.setRequestTime(LocalDateTime.now()); |
| | | orderReturnRequest.setRequestType(RequestTypeEnum.REFUNDS_AND_RETURNS); |
| | |
| | | import com.alipay.api.response.AlipayTradeRefundResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jpay.ext.kit.PaymentKit; |
| | | import com.jpay.weixin.api.WxPayApi; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.BondStatusEnum; |
| | | import com.ruoyi.common.core.enums.OrderStatusEnum; |
| | | import com.ruoyi.common.core.enums.PointStatusEnum; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.order.domain.Paylog; |
| | | import com.ruoyi.order.mapper.OrderAuctionBondMapper; |
| | | import com.ruoyi.order.mapper.OrderMapper; |
| | | import com.ruoyi.order.mapper.PaylogMapper; |
| | | import com.ruoyi.order.service.IOrderService; |
| | | import com.ruoyi.order.service.IOrderAuctionBondService; |
| | | import com.ruoyi.order.service.IPaylogService; |
| | | import com.ruoyi.order.util.MD5AndKL; |
| | | import com.ruoyi.order.util.SinataUtil; |
| | | import com.ruoyi.order.util.alipay.config.AlipayConfig; |
| | | import com.ruoyi.order.util.alipay.util.PayDemoActivity; |
| | |
| | | import com.ruoyi.order.util.tencent.protocol.AppPayReqData; |
| | | import com.ruoyi.order.util.tencent.protocol.UnifiedorderReqData; |
| | | import com.ruoyi.system.api.domain.Order; |
| | | import com.ruoyi.system.api.domain.OrderAuctionBond; |
| | | import com.ruoyi.system.api.domain.dto.BondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberPointsDTO; |
| | | import com.ruoyi.system.api.domain.dto.RefundDTO; |
| | | import com.ruoyi.system.api.domain.dto.updMembeOneDTO; |
| | | import com.ruoyi.system.api.feignClient.AuctionClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.Assert; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private AuctionClient auctionClient; |
| | | |
| | | |
| | | @Resource |
| | | private MemberClient memberClient; |
| | | |
| | | @Resource |
| | | private OrderAuctionBondMapper orderAuctionBondMapper; |
| | | |
| | | @Override |
| | | public R<Map<String, Object>> getPayInfo(Integer uid, Integer type, String orderNO,String openId, HttpServletRequest request) { |
| | |
| | | String body; |
| | | try { |
| | | if(judgeContainsStr(orderNO)){ |
| | | price= Double.valueOf(1); |
| | | if (orderNO.contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo,orderNO); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one = orderAuctionBondMapper.selectOne(wrapper1); |
| | | price=one.getBond().doubleValue(); |
| | | body = " 订单支付"; |
| | | subject = " 订单支付"; |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(orderNO, subject, body, price, request); |
| | | } else { |
| | | // 微信预下单 |
| | | return this.wxpay(2, orderNO, body,openId, price, request); |
| | | } |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,orderNO); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | | Order page1 = OrderMapper.selectOne(wrapper1); |
| | | price=page1.getTotalAmount().doubleValue(); |
| | | body = " 订单支付"; |
| | | subject = " 订单支付"; |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | |
| | | // 微信预下单 |
| | | return this.wxpay(2, orderNO, body,openId, price, request); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | Paylog one = this.getOne(wrapper); |
| | | if(SinataUtil.isEmpty(one)) { |
| | | this.save(paylog1); |
| | | BondDTO bondVO=new BondDTO(); |
| | | bondVO.setOrderNO(paylog1.getOutTradeNo()); |
| | | auctionClient.UpdateBond(bondVO, SecurityConstants.INNER); |
| | | |
| | | if (paylog1.getOutTradeNo().contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo,paylog1.getOutTradeNo()); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); |
| | | one1.setBoundStatus(BondStatusEnum.PAID); |
| | | |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,paylog1.getOutTradeNo()); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | |
| | | MembeOneDTO.setMoney(page1.getTotalAmount()); |
| | | MembeOneDTO.setTotalPoints(page1.getPoints()); |
| | | memberClient.updMembeOne(MembeOneDTO); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | System.out.println("支付完成时间" + time_end); |
| | | paylog.setAddTime(LocalDateTime.now()); |
| | | this.save(paylog); |
| | | BondDTO bondVO=new BondDTO(); |
| | | if (paylog.getOutTradeNo().contains("BO")) { |
| | | LambdaQueryWrapper<OrderAuctionBond> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(OrderAuctionBond::getOrderNo,paylog.getOutTradeNo()); |
| | | wrapper1.eq(OrderAuctionBond::getDelFlag,0); |
| | | OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); |
| | | one1.setBoundStatus(BondStatusEnum.PAID); |
| | | |
| | | bondVO.setOrderNO(paylog.getOutTradeNo()); |
| | | auctionClient.UpdateBond(bondVO, SecurityConstants.INNER); |
| | | |
| | | }else{ |
| | | LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(Order::getOrderNo,paylog.getOutTradeNo()); |
| | | wrapper1.eq(Order::getDelFlag,0); |
| | |
| | | memberPointsDTO.setPointsStatus(PointStatusEnum.INCREASE); |
| | | memberPointsDTO.setPoints(page1.getPoints()); |
| | | memberClient.addMemberPoints(memberPointsDTO); |
| | | |
| | | updMembeOneDTO MembeOneDTO=new updMembeOneDTO(); |
| | | MembeOneDTO.setType(1); |
| | | MembeOneDTO.setMemberId(page1.getMemberId()); |
| | | MembeOneDTO.setMoney(page1.getTotalAmount()); |
| | | MembeOneDTO.setTotalPoints(page1.getPoints()); |
| | | memberClient.updMembeOne(MembeOneDTO); |
| | | } |
| | | |
| | | log.debug("WxpayController.notify__回调处理成功:SUCCESS"); |
| | | response.getOutputStream().print("success"); |
| | |
| | | public static R<Map<String, Object>> wxpay(Integer apptype, String outTradeNo, String body,String openId, Double price, |
| | | HttpServletRequest request) { |
| | | // 获取预支付接口返回参数 |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | Map<String, Object> map1 = new HashMap<String, Object>(); |
| | | Map<String, Object> appPayMap = new HashMap<String, Object>(); |
| | | try { |
| | | // 构建接口请求参数 |
| | | /* // 构建接口请求参数 |
| | | UnifiedorderReqData unifiedorderReqData = new UnifiedorderReqData(outTradeNo, body, price, Configure.wx_notify_url, |
| | | "JSAPI", openId); |
| | | // 请求接口获取返回接口 |
| | |
| | | System.out.println(result); |
| | | System.out.println("WxpayController.createOrder__result:\n" + result); |
| | | // 获取预支付接口返回参数 |
| | | map = XMLParser.getMapFromXML(result); |
| | | map1 = XMLParser.getMapFromXML(result); |
| | | System.out.println("WxpayController.createOrder__result:\n" + result); |
| | | // 捕获预支付接口错误提示 |
| | | if ("FAIL".equals(map.get("result_code")) || "FAIL".equals(map.get("return_code"))) { |
| | | return R.fail(String.valueOf(map.get("return_msg"))); |
| | | } |
| | | if ("FAIL".equals(map1.get("result_code")) || "FAIL".equals(map1.get("return_code"))) { |
| | | return R.fail(String.valueOf(map1.get("return_msg"))); |
| | | }*/ |
| | | |
| | | // 对获取预支付返回接口参数进行封装(生成支付订单接口数据) |
| | | /* // 对获取预支付返回接口参数进行封装(生成支付订单接口数据) |
| | | AppPayReqData appPay = new AppPayReqData(apptype, (String) map.get("appid"), (String) map.get("mch_id"), |
| | | (String) map.get("prepay_id"), unifiedorderReqData.getNonce_str()); |
| | | (String) map.get("prepay_id"), unifiedorderReqData.getNonce_str());*/ |
| | | |
| | | UUID uuid = UUID.randomUUID(); |
| | | String nonceStr = uuid.toString().replaceAll("-", ""); |
| | | //商品描述 String body = "XX商城-支付订单"; |
| | | // 创建hashmap(用户获得签名) |
| | | SortedMap<String, String> paraMap = new TreeMap<>(); |
| | | //设置请求参数(小程序ID) |
| | | paraMap.put("appid", Configure.getAppid()); |
| | | //设置请求参数(商户号) |
| | | paraMap.put("mch_id", Configure.getMchid()); |
| | | //设置请求参数(随机字符串) |
| | | paraMap.put("nonce_str", nonceStr); |
| | | //设置请求参数(商品描述) |
| | | paraMap.put("body", body); |
| | | //设置请求参数(商户订单号) |
| | | paraMap.put("out_trade_no", outTradeNo); |
| | | //设置请求参数(总金额) |
| | | |
| | | String money=SinataUtil.doubleRetainTwo(price*100d); |
| | | Integer price1 = Integer.parseInt(money.substring(0,money.length()-3)); |
| | | paraMap.put("total_fee", price1.toString()); |
| | | //设置请求参数(通知地址) |
| | | paraMap.put("notify_url", Configure.wx_notify_url); |
| | | //设置请求参数(交易类型) |
| | | paraMap.put("trade_type", String.valueOf(WxPayApi.TradeType.JSAPI)); |
| | | |
| | | paraMap.put("openid",openId); |
| | | |
| | | //设置请求参数(openid)(在接口文档中 该参数 是否必填项 但是一定要注意 如果交易类型设置成'JSAPI'则必须传入openid) |
| | | //MD5运算生成签名,这里是第一次签名,用于调用统一下单接口 |
| | | String sign = PaymentKit.createSign(paraMap, "HSCEWrfSYiwxR6sesZ6De91Xh3m447sh"); |
| | | paraMap.put("sign", sign); |
| | | //统一下单,向微信api发送数据 |
| | | //转成xml |
| | | String xmlResult = WxPayApi.pushOrder(false, paraMap); |
| | | Map<String, String> map = PaymentKit.xmlToMap(xmlResult); |
| | | //返回状态码 |
| | | String returnCode = map.get("return_code"); |
| | | /* Assert.isTrue("SUCCESS".equals(returnCode), getMsgByCode(returnCode));*/ |
| | | |
| | | //返回给小程序端需要的参数 |
| | | Map<String, Object> returnMap = new HashMap<>(20); |
| | | String prepay_id = map.get("prepay_id"); |
| | | //重新进行签名后返回给前端 |
| | | returnMap.put("appId", map.get("appid")); |
| | | returnMap.put("nonceStr", map.get("nonce_str")); |
| | | returnMap.put("package", "prepay_id=" + prepay_id); |
| | | returnMap.put("timeStamp", new Date().getTime() + ""); |
| | | returnMap.put("signType", "MD5"); |
| | | String signature = weixinSignature(returnMap, "HSCEWrfSYiwxR6sesZ6De91Xh3m447sh"); |
| | | |
| | | returnMap.put("prepay_id", prepay_id); |
| | | returnMap.put("mch_id", map.get("mch_id")); |
| | | returnMap.put("trade_type", map.get("trade_type")); |
| | | |
| | | returnMap.put("sign", signature); |
| | | returnMap.put("err_code_des", map.get("err_code_des")); |
| | | // 对获取预支付返回接口参数进行封装(生成支付订单接口数据) |
| | | appPayMap.put("appid", appPay.getAppid());// 小程序ID |
| | | appPayMap.put("nonceStr", appPay.getNoncestr());// 随机字符串(32位) |
| | | appPayMap.put("package", appPay.get_package());// 扩展字段(暂填写固定值Sign=WXPay) |
| | | appPayMap.put("partnerId", appPay.getPartnerid());// 商户号 |
| | | appPayMap.put("prepayId", appPay.getPrepayid());// 预支付编号(微信返回的支付交易会话ID) |
| | | appPayMap.put("timeStamp", appPay.getTimestamp());// 时间戳 |
| | | appPayMap.put("sign", appPay.getSign());// 根据API给的签名规则进行签名 |
| | | return R.ok(appPayMap); |
| | | return R.ok(returnMap); |
| | | } catch (Exception e) { |
| | | System.out.println("统一下单_API_处理异常!"); |
| | | e.printStackTrace(); |
| | |
| | | return R.fail("统一下单失败"); |
| | | } |
| | | |
| | | private static String weixinSignature(Map<String, Object> map, String privateKey) { |
| | | try { |
| | | Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | String key = item.getKey(); |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | | sb.append(key + "=" + val + "&"); |
| | | } |
| | | } |
| | | } |
| | | sb.append("key=" + privateKey); |
| | | String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | return sign; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.order.util; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class MD5AndKL { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(MD5AndKL.class); |
| | | |
| | | /** |
| | | * MD5加码。32位 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String MD5(String inStr) { |
| | | MessageDigest md5 = null; |
| | | try { |
| | | md5 = MessageDigest.getInstance("MD5"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.toString()); |
| | | } |
| | | byte[] md5Bytes = md5.digest(inStr.getBytes()); |
| | | StringBuffer hexValue = new StringBuffer(); |
| | | for (int i = 0; i < md5Bytes.length; i++) { |
| | | int val = ((int) md5Bytes[i]) & 0xff; |
| | | if (val < 16) { |
| | | hexValue.append("0"); |
| | | } |
| | | hexValue.append(Integer.toHexString(val)); |
| | | } |
| | | return hexValue.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 可逆的加密算法 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String KL(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String s = new String(a); |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * 加密后解密 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String JM(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String k = new String(a); |
| | | return k; |
| | | } |
| | | |
| | | |
| | | private static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) |
| | | resultSb.append(byteToHexString(b[i])); |
| | | |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | private static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) |
| | | n += 256; |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigits[d1] + hexDigits[d2]; |
| | | } |
| | | |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (charsetname == null || "".equals(charsetname)) { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | } else { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5", |
| | | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; |
| | | |
| | | public static void main(String args[]) { |
| | | |
| | | logger.debug("MD5后再加密:" + KL(MD5("123456"))); |
| | | logger.debug(MD5("123456")); |
| | | // logger.debug("加密:" + KL(MD5("123456"))); |
| | | // s = KL(s); |
| | | // logger.debug("解密:" + KL("81dc9bdb52d04dc20036dbd8313ed055")); |
| | | // logger.debug("解密:" + JM(KL(s))); |
| | | // logger.debug("解密为MD5后的:" + KL(KL(MD5(s)))); |
| | | // logger.debug(JM("5d62957bb57d3e49dcf48a0df064be4c")); |
| | | // logger.debug(MD5AndKL.KL(MD5AndKL.MD5("admin"+"87654321"))); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed 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 |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * 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. |
| | | */ |
| | | package com.ruoyi.order.util; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.order.util.support.StrKit; |
| | | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import java.lang.reflect.Array; |
| | | import java.math.BigDecimal; |
| | | import java.net.URISyntaxException; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | * 高频方法集合类 |
| | | */ |
| | | public class ToolUtil { |
| | | |
| | | /** |
| | | * 获取随机位数的字符串 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/8/24 14:09 |
| | | */ |
| | | public static String getRandomString(int length) { |
| | | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(base.length()); |
| | | sb.append(base.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static <T> T objFromJson(Object src, Class<T> classOfT) { |
| | | Gson gson = new Gson(); |
| | | return gson.fromJson(gson.toJson(src), classOfT); |
| | | } |
| | | |
| | | /** |
| | | * 获取随机位数数字串 |
| | | */ |
| | | public static String getRandomNumber(int length) { |
| | | String base = "0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(base.length()); |
| | | sb.append(base.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 判断一个对象是否是时间类型 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/4/18 12:55 |
| | | */ |
| | | /* public static String dateType(Object o) { |
| | | if (o instanceof Date) { |
| | | return DateUtils.getDay((Date) o); |
| | | } else { |
| | | return o.toString(); |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * 获取异常的具体信息 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/3/30 9:21 |
| | | * @version 2.0 |
| | | */ |
| | | public static String getExceptionMsg(Exception e) { |
| | | StringWriter sw = new StringWriter(); |
| | | try { |
| | | e.printStackTrace(new PrintWriter(sw)); |
| | | } finally { |
| | | try { |
| | | sw.close(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | return sw.getBuffer().toString().replaceAll("\\$", "T"); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象是否相等。<br> |
| | | * 相同的条件有两个,满足其一即可:<br> |
| | | * 1. obj1 == null && obj2 == null; 2. obj1.equals(obj2) |
| | | * |
| | | * @param obj1 对象1 |
| | | * @param obj2 对象2 |
| | | * @return 是否相等 |
| | | */ |
| | | public static boolean equals(Object obj1, Object obj2) { |
| | | return (obj1 != null) ? (obj1.equals(obj2)) : (obj2 == null); |
| | | } |
| | | |
| | | /** |
| | | * 计算对象长度,如果是字符串调用其length函数,集合类调用其size函数,数组调用其length属性,其他可遍历对象遍历计算长度 |
| | | * |
| | | * @param obj 被计算长度的对象 |
| | | * @return 长度 |
| | | */ |
| | | public static int length(Object obj) { |
| | | if (obj == null) { |
| | | return 0; |
| | | } |
| | | if (obj instanceof CharSequence) { |
| | | return ((CharSequence) obj).length(); |
| | | } |
| | | if (obj instanceof Collection) { |
| | | return ((Collection<?>) obj).size(); |
| | | } |
| | | if (obj instanceof Map) { |
| | | return ((Map<?, ?>) obj).size(); |
| | | } |
| | | |
| | | int count; |
| | | if (obj instanceof Iterator) { |
| | | Iterator<?> iter = (Iterator<?>) obj; |
| | | count = 0; |
| | | while (iter.hasNext()) { |
| | | count++; |
| | | iter.next(); |
| | | } |
| | | return count; |
| | | } |
| | | if (obj instanceof Enumeration) { |
| | | Enumeration<?> enumeration = (Enumeration<?>) obj; |
| | | count = 0; |
| | | while (enumeration.hasMoreElements()) { |
| | | count++; |
| | | enumeration.nextElement(); |
| | | } |
| | | return count; |
| | | } |
| | | if (obj.getClass().isArray() == true) { |
| | | return Array.getLength(obj); |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 对象中是否包含元素 |
| | | * |
| | | * @param obj 对象 |
| | | * @param element 元素 |
| | | * @return 是否包含 |
| | | */ |
| | | public static boolean contains(Object obj, Object element) { |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (obj instanceof String) { |
| | | if (element == null) { |
| | | return false; |
| | | } |
| | | return ((String) obj).contains(element.toString()); |
| | | } |
| | | if (obj instanceof Collection) { |
| | | return ((Collection<?>) obj).contains(element); |
| | | } |
| | | if (obj instanceof Map) { |
| | | return ((Map<?, ?>) obj).values().contains(element); |
| | | } |
| | | |
| | | if (obj instanceof Iterator) { |
| | | Iterator<?> iter = (Iterator<?>) obj; |
| | | while (iter.hasNext()) { |
| | | Object o = iter.next(); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof Enumeration) { |
| | | Enumeration<?> enumeration = (Enumeration<?>) obj; |
| | | while (enumeration.hasMoreElements()) { |
| | | Object o = enumeration.nextElement(); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | if (obj.getClass().isArray() == true) { |
| | | int len = Array.getLength(obj); |
| | | for (int i = 0; i < len; i++) { |
| | | Object o = Array.get(obj, i); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象是否不为空(新增) |
| | | */ |
| | | public static boolean isNotEmpty(Object o) { |
| | | return !isEmpty(o); |
| | | } |
| | | |
| | | /** |
| | | * 对象是否为空 |
| | | */ |
| | | @SuppressWarnings("rawtypes") |
| | | public static boolean isEmpty(Object o) { |
| | | if (o == null) { |
| | | return true; |
| | | } |
| | | if (o instanceof String) { |
| | | if (o.toString().trim().equals("")) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof List) { |
| | | if (((List) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Map) { |
| | | if (((Map) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Set) { |
| | | if (((Set) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Object[]) { |
| | | if (((Object[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof int[]) { |
| | | if (((int[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof long[]) { |
| | | if (((long[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象组中是否存在 Empty Object |
| | | * |
| | | * @param os 对象组 |
| | | * @return |
| | | */ |
| | | public static boolean isOneEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (isEmpty(o)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象组中是否全是 Empty Object |
| | | * |
| | | * @param os |
| | | * @return |
| | | */ |
| | | public static boolean isAllEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (!isEmpty(o)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否为数字 |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static boolean isNum(Object obj) { |
| | | try { |
| | | Integer.parseInt(obj.toString()); |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 如果为空, 则调用默认值 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static Object getValue(Object str, Object defaultValue) { |
| | | if (isEmpty(str)) { |
| | | return defaultValue; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本 |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {} 表示 |
| | | * @param values 参数值 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Object... values) { |
| | | return StrKit.format(template, values); |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本 |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {key} 表示 |
| | | * @param map 参数值对 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Map<?, ?> map) { |
| | | return StrKit.format(template, map); |
| | | } |
| | | |
| | | /** |
| | | * 强转->string,并去掉多余空格 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String toStr(Object str) { |
| | | return toStr(str, ""); |
| | | } |
| | | |
| | | /** |
| | | * 强转->string,并去掉多余空格 |
| | | * |
| | | * @param str |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | public static String toStr(Object str, String defaultValue) { |
| | | if (null == str) { |
| | | return defaultValue; |
| | | } |
| | | return str.toString().trim(); |
| | | } |
| | | |
| | | /** |
| | | * 强转->int |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | // public static int toInt(Object value) { |
| | | // return toInt(value, -1); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->int |
| | | * |
| | | * @param obj |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | // public static int toInt(Object value, int defaultValue) { |
| | | // return Convert.toInt(value, defaultValue); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->long |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | // public static long toLong(Object value) { |
| | | // return toLong(value, -1); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->long |
| | | * |
| | | * @param obj |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | // public static long toLong(Object value, long defaultValue) { |
| | | // return Convert.toLong(value, defaultValue); |
| | | // } |
| | | // |
| | | // public static String encodeUrl(String url) { |
| | | // return URLKit.encode(url, CharsetKit.UTF_8); |
| | | // } |
| | | // |
| | | // public static String decodeUrl(String url) { |
| | | // return URLKit.decode(url, CharsetKit.UTF_8); |
| | | // } |
| | | |
| | | /** |
| | | * map的key转为小写 |
| | | * |
| | | * @param map |
| | | * @return Map<String, Object> |
| | | */ |
| | | public static Map<String, Object> caseInsensitiveMap(Map<String, Object> map) { |
| | | Map<String, Object> tempMap = new HashMap<>(); |
| | | for (String key : map.keySet()) { |
| | | tempMap.put(key.toLowerCase(), map.get(key)); |
| | | } |
| | | return tempMap; |
| | | } |
| | | |
| | | /** |
| | | * 获取map中第一个数据值 |
| | | * |
| | | * @param <K> Key的类型 |
| | | * @param <V> Value的类型 |
| | | * @param map 数据源 |
| | | * @return 返回的值 |
| | | */ |
| | | public static <K, V> V getFirstOrNull(Map<K, V> map) { |
| | | V obj = null; |
| | | for (Entry<K, V> entry : map.entrySet()) { |
| | | obj = entry.getValue(); |
| | | if (obj != null) { |
| | | break; |
| | | } |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(String... strs) { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | return sb; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static void builder(StringBuilder sb, String... strs) { |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffix(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.endsWith(suffix)) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 当前时间 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/7 21:56 |
| | | */ |
| | | public static String currentTime() { |
| | | return DateUtils.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 首字母大写 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/7 22:01 |
| | | */ |
| | | public static String firstLetterToUpper(String val) { |
| | | return StrKit.firstCharToUpperCase(val); |
| | | } |
| | | |
| | | /** |
| | | * 首字母小写 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/7 22:02 |
| | | */ |
| | | public static String firstLetterToLower(String val) { |
| | | return StrKit.firstCharToLowerCase(val); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否是windows操作系统 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 22:34 |
| | | */ |
| | | public static Boolean isWinOs() { |
| | | String os = System.getProperty("os.name"); |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取临时目录 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 22:35 |
| | | */ |
| | | public static String getTempPath() { |
| | | return System.getProperty("java.io.tmpdir"); |
| | | } |
| | | |
| | | /** |
| | | * 把一个数转化为int |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/11/15 下午11:10 |
| | | */ |
| | | public static Integer toInt(Object val) { |
| | | if (val instanceof Double) { |
| | | BigDecimal bigDecimal = new BigDecimal((Double) val); |
| | | return bigDecimal.intValue(); |
| | | } else { |
| | | return Integer.valueOf(val.toString()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取项目路径 |
| | | */ |
| | | public static String getWebRootPath(String filePath) { |
| | | try { |
| | | String path = ToolUtil.class.getClassLoader().getResource("").toURI().getPath(); |
| | | path = path.replace("/WEB-INF/classes/", ""); |
| | | path = path.replace("/target/classes/", ""); |
| | | path = path.replace("file:/", ""); |
| | | if (ToolUtil.isEmpty(filePath)) { |
| | | return path; |
| | | } else { |
| | | return path + "/" + filePath; |
| | | } |
| | | } catch (URISyntaxException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取文件后缀名 不包含点 |
| | | */ |
| | | public static String getFileSuffix(String fileWholeName) { |
| | | if (ToolUtil.isEmpty(fileWholeName)) { |
| | | return "none"; |
| | | } |
| | | int lastIndexOf = fileWholeName.lastIndexOf("."); |
| | | return fileWholeName.substring(lastIndexOf + 1); |
| | | } |
| | | |
| | | /** |
| | | * 逗号拼接字符串 |
| | | */ |
| | | public static String commaSpliceString(String first, String second, Object... param) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | sb.append(first + "," + second); |
| | | if (param != null) { |
| | | for (int i = 0; i < param.length; i++) { |
| | | sb.append("," + param[i]); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * List列表去重 |
| | | */ |
| | | public static List listRemoveDuplicate(List list) { |
| | | HashSet h = new HashSet(list); |
| | | list.clear(); |
| | | list.addAll(h); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * H5页面代码包装(判断加上自适应代码) |
| | | */ |
| | | public static String h5Warpper(String h5Code) { |
| | | String warpper = "<meta name=\"viewport\" content=\"width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no\"/>"; |
| | | // 代码不包含自适应代码,前部追加代码 |
| | | if (!h5Code.contains(warpper)) { |
| | | return warpper + h5Code; |
| | | } |
| | | return h5Code; |
| | | } |
| | | |
| | | /** |
| | | * 字符串Base64位加密 |
| | | */ |
| | | public static String Base64Encode(String src) { |
| | | return new String(Base64.getEncoder().encode(src.getBytes())); |
| | | } |
| | | |
| | | /** |
| | | * 字符串Base64位解密 |
| | | */ |
| | | public static String Base64Decode(String src) { |
| | | return new String(Base64.getDecoder().decode(src.getBytes())); |
| | | } |
| | | |
| | | /** |
| | | * 排序签名:通常需要签名和验签,而签名时,需要对url内容进行排序。 |
| | | */ |
| | | public static String putPairsSequenceAndTogether(Map<String, String> info) { |
| | | List<Entry<String, String>> infoIds = new ArrayList<Entry<String, String>>(info.entrySet()); |
| | | Collections.sort(infoIds, new Comparator<Entry<String, String>>() { |
| | | @Override |
| | | public int compare(Entry<String, String> arg0, Entry<String, String> arg1) { |
| | | // TODO Auto-generated method stub |
| | | return (arg0.getKey()).compareTo(arg1.getKey()); |
| | | } |
| | | }); |
| | | String ret = ""; |
| | | for (Entry<String, String> entry : infoIds) { |
| | | ret += entry.getKey(); |
| | | ret += "="; |
| | | ret += entry.getValue(); |
| | | ret += "&"; |
| | | } |
| | | ret = ret.substring(0, ret.length() - 1); |
| | | return ret; |
| | | } |
| | | |
| | | /** |
| | | * 将Map封装为Url参数串 |
| | | */ |
| | | public static String getUrlParmStr(Map<String, Object> map) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (Entry<String, Object> entry : map.entrySet()) { |
| | | sb.append(entry.getKey()); |
| | | sb.append("="); |
| | | sb.append(entry.getValue()); |
| | | sb.append("&"); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取客户端真实IP地址 |
| | | */ |
| | | public static String getIpAddress(HttpServletRequest request) { |
| | | // 避免反向代理不能获取真实地址, 取X-Forwarded-For中第一个非unknown的有效IP字符串 |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | return ip; |
| | | } |
| | | |
| | | /** |
| | | * 字符串转对象 |
| | | * |
| | | * @param str 字符串 |
| | | * @param classOfT 转换后对象类 |
| | | * @param <T> 转换后对象 |
| | | * @return |
| | | */ |
| | | public static <T> T fromJson(String str, Class<T> classOfT) { |
| | | Gson gson = new Gson(); |
| | | return gson.fromJson(str, classOfT); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| | | import com.alipay.api.request.AlipayTradeAppPayRequest; |
| | | import com.alipay.api.response.AlipayTradeAppPayResponse; |
| | | import com.jpay.alipay.AliPayApi; |
| | | import com.jpay.alipay.AliPayApiConfig; |
| | | import com.jpay.alipay.AliPayApiConfigKit; |
| | | import com.ruoyi.order.util.alipay.config.AlipayConfig; |
| | | |
| | | |
| | |
| | | //实例化客户端 |
| | | private static AlipayClient alipayClient = new DefaultAlipayClient(serverUrl, APP_ID, APP_PRIVATE_KEY, format, charset, ALIPAY_PUBLIC_KEY, signType); |
| | | |
| | | |
| | | private static AliPayApiConfig aliPayApiConfig = null; |
| | | |
| | | static { |
| | | aliPayApiConfig = AliPayApiConfig.New() |
| | | .setAppId(APP_ID) |
| | | .setCharset("UTF-8") |
| | | .setPrivateKey(APP_PRIVATE_KEY) |
| | | .setAlipayPublicKey(ALIPAY_PUBLIC_KEY) |
| | | .setServiceUrl("https://openapi.alipay.com/gateway.do") |
| | | .setSignType("RSA2") |
| | | .build(); |
| | | } |
| | | |
| | | /** |
| | | * @throws AlipayApiException |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | try { |
| | | |
| | | AliPayApiConfigKit.setThreadLocalAppId(APP_ID); |
| | | AliPayApiConfigKit.setThreadLocalAliPayApiConfig(aliPayApiConfig); |
| | | |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(NOTIFY_URL); |
| | | // 这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | String string = response.getBody(); |
| | | String orderInfo = ""; |
| | | orderInfo = AliPayApi.startAppPay(model, NOTIFY_URL); |
| | | |
| | | int one = string.lastIndexOf("&"); |
| | | String s=string.substring(0,(one)); |
| | | |
| | | map.put("orderInfo", s); |
| | | System.out.println(java.net.URLDecoder.decode(s, "UTF-8")); |
| | | System.out.println(java.net.URLDecoder.decode(response.getBody(), "UTF-8")); |
| | | map.put("orderInfo", orderInfo); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
New file |
| | |
| | | package com.ruoyi.order.util.properties; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * jwt相关配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-08-23 9:23 |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = JwtProperties.JWT_PREFIX) |
| | | public class JwtProperties { |
| | | |
| | | public static final String JWT_PREFIX = "jwt"; |
| | | |
| | | private String header = "Authorization"; |
| | | |
| | | private String secret = "defaultSecret"; |
| | | |
| | | private Long expiration = 604800L; |
| | | |
| | | private String authPath = "auth"; |
| | | |
| | | private String md5Key = "randomKey"; |
| | | |
| | | public static String getJwtPrefix() { |
| | | return JWT_PREFIX; |
| | | } |
| | | |
| | | public String getHeader() { |
| | | return header; |
| | | } |
| | | |
| | | public void setHeader(String header) { |
| | | this.header = header; |
| | | } |
| | | |
| | | public String getSecret() { |
| | | return secret; |
| | | } |
| | | |
| | | public void setSecret(String secret) { |
| | | this.secret = secret; |
| | | } |
| | | |
| | | public Long getExpiration() { |
| | | return expiration; |
| | | } |
| | | |
| | | public void setExpiration(Long expiration) { |
| | | this.expiration = expiration; |
| | | } |
| | | |
| | | public String getAuthPath() { |
| | | return authPath; |
| | | } |
| | | |
| | | public void setAuthPath(String authPath) { |
| | | this.authPath = authPath; |
| | | } |
| | | |
| | | public String getMd5Key() { |
| | | return md5Key; |
| | | } |
| | | |
| | | public void setMd5Key(String md5Key) { |
| | | this.md5Key = md5Key; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.properties; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 配置参数 |
| | | * |
| | | * @author: KingKong |
| | | * @create: 2018-12-17 14:36 |
| | | **/ |
| | | @Data |
| | | @Component |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "pay") |
| | | public class PayProperties { |
| | | |
| | | /** |
| | | * 应用私钥 |
| | | */ |
| | | private String aliPrivateKey; |
| | | /** |
| | | * 支付宝公钥(不是应用公钥) |
| | | */ |
| | | private String aliPublicKey; |
| | | private String aliAppId; |
| | | private String aliNotifyUrl; |
| | | private String aliReturnUrl; |
| | | /** |
| | | * 支付宝账号 |
| | | */ |
| | | private String aliSellerId; |
| | | |
| | | |
| | | /** |
| | | * 微信appId |
| | | */ |
| | | private String wxAppId; |
| | | /** |
| | | * 微信服务号ID |
| | | */ |
| | | private String wxServiceAppId; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | private String wxMchId; |
| | | /** |
| | | * 微信key |
| | | */ |
| | | private String wxPayKey; |
| | | /** |
| | | * 支付回调地址 |
| | | */ |
| | | private String wxNotifyUrl; |
| | | /** |
| | | * 支付回显地址 |
| | | */ |
| | | private String wxReturnUrl; |
| | | /** |
| | | * 微信secret |
| | | */ |
| | | private String wxAppSecret; |
| | | /** |
| | | * 微信公众号secret |
| | | */ |
| | | private String wxPublicSecretKey; |
| | | /** |
| | | * 微信证书位置 |
| | | */ |
| | | private String wxCertPath; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.properties; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * 项目相关配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年10月23日16:44:15 |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = RestProperties.REST_PREFIX) |
| | | public class RestProperties { |
| | | |
| | | public static final String REST_PREFIX = "rest"; |
| | | |
| | | private boolean authOpen = true; |
| | | |
| | | private boolean signOpen = true; |
| | | |
| | | private boolean swaggerOpen = true; |
| | | |
| | | private String fileUploadPath; |
| | | |
| | | public boolean isAuthOpen() { |
| | | return authOpen; |
| | | } |
| | | |
| | | public void setAuthOpen(boolean authOpen) { |
| | | this.authOpen = authOpen; |
| | | } |
| | | |
| | | public boolean isSignOpen() { |
| | | return signOpen; |
| | | } |
| | | |
| | | public void setSignOpen(boolean signOpen) { |
| | | this.signOpen = signOpen; |
| | | } |
| | | |
| | | public boolean isSwaggerOpen() { |
| | | return swaggerOpen; |
| | | } |
| | | |
| | | public void setSwaggerOpen(boolean swaggerOpen) { |
| | | this.swaggerOpen = swaggerOpen; |
| | | } |
| | | |
| | | public String getFileUploadPath() { |
| | | return fileUploadPath; |
| | | } |
| | | |
| | | public void setFileUploadPath(String fileUploadPath) { |
| | | this.fileUploadPath = fileUploadPath; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 基本变量类型的枚举 |
| | | * |
| | | * @author xiaoleilu |
| | | */ |
| | | public enum BasicType { |
| | | BYTE, SHORT, INT, INTEGER, LONG, DOUBLE, FLOAT, BOOLEAN, CHAR, CHARACTER, STRING; |
| | | |
| | | /** |
| | | * 原始类型为Key,包装类型为Value,例如: int.class -> Integer.class. |
| | | */ |
| | | public static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = new HashMap<Class<?>, Class<?>>(8); |
| | | |
| | | /** |
| | | * 包装类型为Key,原始类型为Value,例如: Integer.class -> int.class. |
| | | */ |
| | | public static final Map<Class<?>, Class<?>> primitiveWrapperMap = new HashMap<Class<?>, Class<?>>(8); |
| | | |
| | | static { |
| | | wrapperPrimitiveMap.put(Boolean.class, boolean.class); |
| | | wrapperPrimitiveMap.put(Byte.class, byte.class); |
| | | wrapperPrimitiveMap.put(Character.class, char.class); |
| | | wrapperPrimitiveMap.put(Double.class, double.class); |
| | | wrapperPrimitiveMap.put(Float.class, float.class); |
| | | wrapperPrimitiveMap.put(Integer.class, int.class); |
| | | wrapperPrimitiveMap.put(Long.class, long.class); |
| | | wrapperPrimitiveMap.put(Short.class, short.class); |
| | | |
| | | for (Map.Entry<Class<?>, Class<?>> entry : wrapperPrimitiveMap.entrySet()) { |
| | | primitiveWrapperMap.put(entry.getValue(), entry.getKey()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | |
| | | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | * 集合相关工具类,包括数组 |
| | | * |
| | | * @author xiaoleilu |
| | | */ |
| | | public class CollectionKit { |
| | | |
| | | private CollectionKit() { |
| | | // 静态类不可实例化 |
| | | } |
| | | |
| | | /** |
| | | * 以 conjunction 为分隔符将集合转换为字符串 |
| | | * |
| | | * @param <T> 被处理的集合 |
| | | * @param collection 集合 |
| | | * @param conjunction 分隔符 |
| | | * @return 连接后的字符串 |
| | | */ |
| | | public static <T> String join(Iterable<T> collection, String conjunction) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | boolean isFirst = true; |
| | | for (T item : collection) { |
| | | if (isFirst) { |
| | | isFirst = false; |
| | | } else { |
| | | sb.append(conjunction); |
| | | } |
| | | sb.append(item); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 以 conjunction 为分隔符将数组转换为字符串 |
| | | * |
| | | * @param <T> 被处理的集合 |
| | | * @param array 数组 |
| | | * @param conjunction 分隔符 |
| | | * @return 连接后的字符串 |
| | | */ |
| | | public static <T> String join(T[] array, String conjunction) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | boolean isFirst = true; |
| | | for (T item : array) { |
| | | if (isFirst) { |
| | | isFirst = false; |
| | | } else { |
| | | sb.append(conjunction); |
| | | } |
| | | sb.append(item); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将多个集合排序并显示不同的段落(分页) |
| | | * |
| | | * @param pageNo 页码 |
| | | * @param numPerPage 每页的条目数 |
| | | * @param comparator 比较器 |
| | | * @param colls 集合数组 |
| | | * @return 分页后的段落内容 |
| | | */ |
| | | @SafeVarargs |
| | | public static <T> List<T> sortPageAll(int pageNo, int numPerPage, Comparator<T> comparator, Collection<T>... colls) { |
| | | final List<T> result = new ArrayList<T>(); |
| | | for (Collection<T> coll : colls) { |
| | | result.addAll(coll); |
| | | } |
| | | |
| | | Collections.sort(result, comparator); |
| | | |
| | | //第一页且数目少于第一页显示的数目 |
| | | if (pageNo <= 1 && result.size() <= numPerPage) { |
| | | return result; |
| | | } |
| | | |
| | | final int[] startEnd = PageKit.transToStartEnd(pageNo, numPerPage); |
| | | return result.subList(startEnd[0], startEnd[1]); |
| | | } |
| | | |
| | | /** |
| | | * 将多个集合排序并显示不同的段落(分页) |
| | | * @param pageNo 页码 |
| | | * @param numPerPage 每页的条目数 |
| | | * @param comparator 比较器 |
| | | * @param colls 集合数组 |
| | | * @return 分业后的段落内容 |
| | | */ |
| | | // @SafeVarargs |
| | | // public static <T> List<T> sortPageAll2(int pageNo, int numPerPage, Comparator<T> comparator, Collection<T>... colls) { |
| | | // BoundedPriorityQueue<T> queue = new BoundedPriorityQueue<T>(pageNo * numPerPage); |
| | | // for (Collection<T> coll : colls) { |
| | | // queue.addAll(coll); |
| | | // } |
| | | // |
| | | // //第一页且数目少于第一页显示的数目 |
| | | // if(pageNo <=1 && queue.size() <= numPerPage) { |
| | | // return queue.toList(); |
| | | // } |
| | | // |
| | | // final int[] startEnd = PageKit.transToStartEnd(pageNo, numPerPage); |
| | | // return queue.toList().subList(startEnd[0], startEnd[1]); |
| | | // } |
| | | |
| | | /** |
| | | * 将Set排序(根据Entry的值) |
| | | * |
| | | * @param set 被排序的Set |
| | | * @return 排序后的Set |
| | | */ |
| | | public static List<Entry<Long, Long>> sortEntrySetToList(Set<Entry<Long, Long>> set) { |
| | | List<Entry<Long, Long>> list = new LinkedList<Entry<Long, Long>>(set); |
| | | Collections.sort(list, new Comparator<Entry<Long, Long>>() { |
| | | |
| | | @Override |
| | | public int compare(Entry<Long, Long> o1, Entry<Long, Long> o2) { |
| | | if (o1.getValue() > o2.getValue()) { |
| | | return 1; |
| | | } |
| | | if (o1.getValue() < o2.getValue()) { |
| | | return -1; |
| | | } |
| | | return 0; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 切取部分数据 |
| | | * |
| | | * @param <T> 集合元素类型 |
| | | * @param surplusAlaDatas 原数据 |
| | | * @param partSize 每部分数据的长度 |
| | | * @return 切取出的数据或null |
| | | */ |
| | | public static <T> List<T> popPart(Stack<T> surplusAlaDatas, int partSize) { |
| | | if (surplusAlaDatas == null || surplusAlaDatas.size() <= 0) { |
| | | return null; |
| | | } |
| | | |
| | | final List<T> currentAlaDatas = new ArrayList<T>(); |
| | | int size = surplusAlaDatas.size(); |
| | | // 切割 |
| | | if (size > partSize) { |
| | | for (int i = 0; i < partSize; i++) { |
| | | currentAlaDatas.add(surplusAlaDatas.pop()); |
| | | } |
| | | } else { |
| | | for (int i = 0; i < size; i++) { |
| | | currentAlaDatas.add(surplusAlaDatas.pop()); |
| | | } |
| | | } |
| | | return currentAlaDatas; |
| | | } |
| | | |
| | | /** |
| | | * 切取部分数据 |
| | | * |
| | | * @param <T> 集合元素类型 |
| | | * @param surplusAlaDatas 原数据 |
| | | * @param partSize 每部分数据的长度 |
| | | * @return 切取出的数据或null |
| | | */ |
| | | public static <T> List<T> popPart(Deque<T> surplusAlaDatas, int partSize) { |
| | | if (surplusAlaDatas == null || surplusAlaDatas.size() <= 0) { |
| | | return null; |
| | | } |
| | | |
| | | final List<T> currentAlaDatas = new ArrayList<T>(); |
| | | int size = surplusAlaDatas.size(); |
| | | // 切割 |
| | | if (size > partSize) { |
| | | for (int i = 0; i < partSize; i++) { |
| | | currentAlaDatas.add(surplusAlaDatas.pop()); |
| | | } |
| | | } else { |
| | | for (int i = 0; i < size; i++) { |
| | | currentAlaDatas.add(surplusAlaDatas.pop()); |
| | | } |
| | | } |
| | | return currentAlaDatas; |
| | | } |
| | | |
| | | /** |
| | | * 新建一个HashMap |
| | | * |
| | | * @return HashMap对象 |
| | | */ |
| | | public static <T, K> HashMap<T, K> newHashMap() { |
| | | return new HashMap<T, K>(); |
| | | } |
| | | |
| | | /** |
| | | * 新建一个HashMap |
| | | * |
| | | * @param size 初始大小,由于默认负载因子0.75,传入的size会实际初始大小为size / 0.75 |
| | | * @return HashMap对象 |
| | | */ |
| | | public static <T, K> HashMap<T, K> newHashMap(int size) { |
| | | return new HashMap<T, K>((int) (size / 0.75)); |
| | | } |
| | | |
| | | /** |
| | | * 新建一个HashSet |
| | | * |
| | | * @return HashSet对象 |
| | | */ |
| | | public static <T> HashSet<T> newHashSet() { |
| | | return new HashSet<T>(); |
| | | } |
| | | |
| | | /** |
| | | * 新建一个HashSet |
| | | * |
| | | * @return HashSet对象 |
| | | */ |
| | | @SafeVarargs |
| | | public static <T> HashSet<T> newHashSet(T... ts) { |
| | | HashSet<T> set = new HashSet<T>(); |
| | | for (T t : ts) { |
| | | set.add(t); |
| | | } |
| | | return set; |
| | | } |
| | | |
| | | /** |
| | | * 新建一个ArrayList |
| | | * |
| | | * @return ArrayList对象 |
| | | */ |
| | | public static <T> ArrayList<T> newArrayList() { |
| | | return new ArrayList<T>(); |
| | | } |
| | | |
| | | /** |
| | | * 新建一个ArrayList |
| | | * |
| | | * @return ArrayList对象 |
| | | */ |
| | | @SafeVarargs |
| | | public static <T> ArrayList<T> newArrayList(T... values) { |
| | | return new ArrayList<T>(Arrays.asList(values)); |
| | | } |
| | | |
| | | /** |
| | | * 将新元素添加到已有数组中<br/> |
| | | * 添加新元素会生成一个新的数组,不影响原数组 |
| | | * |
| | | * @param buffer 已有数组 |
| | | * @param newElement 新元素 |
| | | * @return 新数组 |
| | | */ |
| | | public static <T> T[] append(T[] buffer, T newElement) { |
| | | T[] t = resize(buffer, buffer.length + 1, newElement.getClass()); |
| | | t[buffer.length] = newElement; |
| | | return t; |
| | | } |
| | | |
| | | /** |
| | | * 生成一个新的重新设置大小的数组 |
| | | * |
| | | * @param buffer 原数组 |
| | | * @param newSize 新的数组大小 |
| | | * @param componentType 数组元素类型 |
| | | * @return 调整后的新数组 |
| | | */ |
| | | public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) { |
| | | T[] newArray = newArray(componentType, newSize); |
| | | System.arraycopy(buffer, 0, newArray, 0, buffer.length >= newSize ? newSize : buffer.length); |
| | | return newArray; |
| | | } |
| | | |
| | | /** |
| | | * 新建一个空数组 |
| | | * |
| | | * @param componentType 元素类型 |
| | | * @param newSize 大小 |
| | | * @return 空数组 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T[] newArray(Class<?> componentType, int newSize) { |
| | | return (T[]) Array.newInstance(componentType, newSize); |
| | | } |
| | | |
| | | /** |
| | | * 生成一个新的重新设置大小的数组<br/> |
| | | * 新数组的类型为原数组的类型 |
| | | * |
| | | * @param buffer 原数组 |
| | | * @param newSize 新的数组大小 |
| | | * @return 调整后的新数组 |
| | | */ |
| | | public static <T> T[] resize(T[] buffer, int newSize) { |
| | | return resize(buffer, newSize, buffer.getClass().getComponentType()); |
| | | } |
| | | |
| | | /** |
| | | * 将多个数组合并在一起<br> |
| | | * 忽略null的数组 |
| | | * |
| | | * @param arrays 数组集合 |
| | | * @return 合并后的数组 |
| | | */ |
| | | @SafeVarargs |
| | | public static <T> T[] addAll(T[]... arrays) { |
| | | if (arrays.length == 1) { |
| | | return arrays[0]; |
| | | } |
| | | |
| | | int length = 0; |
| | | for (T[] array : arrays) { |
| | | if (array == null) { |
| | | continue; |
| | | } |
| | | length += array.length; |
| | | } |
| | | T[] result = newArray(arrays.getClass().getComponentType().getComponentType(), length); |
| | | |
| | | length = 0; |
| | | for (T[] array : arrays) { |
| | | if (array == null) { |
| | | continue; |
| | | } |
| | | System.arraycopy(array, 0, result, length, array.length); |
| | | length += array.length; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 克隆数组 |
| | | * |
| | | * @param array 被克隆的数组 |
| | | * @return 新数组 |
| | | */ |
| | | public static <T> T[] clone(T[] array) { |
| | | if (array == null) { |
| | | return null; |
| | | } |
| | | return array.clone(); |
| | | } |
| | | |
| | | /** |
| | | * 生成一个数字列表<br> |
| | | * 自动判定正序反序 |
| | | * |
| | | * @param excludedEnd 结束的数字(不包含) |
| | | * @return 数字列表 |
| | | */ |
| | | public static int[] range(int excludedEnd) { |
| | | return range(0, excludedEnd, 1); |
| | | } |
| | | |
| | | /** |
| | | * 生成一个数字列表<br> |
| | | * 自动判定正序反序 |
| | | * |
| | | * @param includedStart 开始的数字(包含) |
| | | * @param excludedEnd 结束的数字(不包含) |
| | | * @return 数字列表 |
| | | */ |
| | | public static int[] range(int includedStart, int excludedEnd) { |
| | | return range(includedStart, excludedEnd, 1); |
| | | } |
| | | |
| | | /** |
| | | * 生成一个数字列表<br> |
| | | * 自动判定正序反序 |
| | | * |
| | | * @param includedStart 开始的数字(包含) |
| | | * @param excludedEnd 结束的数字(不包含) |
| | | * @param step 步进 |
| | | * @return 数字列表 |
| | | */ |
| | | public static int[] range(int includedStart, int excludedEnd, int step) { |
| | | if (includedStart > excludedEnd) { |
| | | int tmp = includedStart; |
| | | includedStart = excludedEnd; |
| | | excludedEnd = tmp; |
| | | } |
| | | |
| | | if (step <= 0) { |
| | | step = 1; |
| | | } |
| | | |
| | | int deviation = excludedEnd - includedStart; |
| | | int length = deviation / step; |
| | | if (deviation % step != 0) { |
| | | length += 1; |
| | | } |
| | | int[] range = new int[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | range[i] = includedStart; |
| | | includedStart += step; |
| | | } |
| | | return range; |
| | | } |
| | | |
| | | /** |
| | | * 截取数组的部分 |
| | | * |
| | | * @param list 被截取的数组 |
| | | * @param start 开始位置(包含) |
| | | * @param end 结束位置(不包含) |
| | | * @return 截取后的数组,当开始位置超过最大时,返回null |
| | | */ |
| | | public static <T> List<T> sub(List<T> list, int start, int end) { |
| | | if (list == null || list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | if (start < 0) { |
| | | start = 0; |
| | | } |
| | | if (end < 0) { |
| | | end = 0; |
| | | } |
| | | |
| | | if (start > end) { |
| | | int tmp = start; |
| | | start = end; |
| | | end = tmp; |
| | | } |
| | | |
| | | final int size = list.size(); |
| | | if (end > size) { |
| | | if (start >= size) { |
| | | return null; |
| | | } |
| | | end = size; |
| | | } |
| | | |
| | | return list.subList(start, end); |
| | | } |
| | | |
| | | /** |
| | | * 截取集合的部分 |
| | | * |
| | | * @param list 被截取的数组 |
| | | * @param start 开始位置(包含) |
| | | * @param end 结束位置(不包含) |
| | | * @return 截取后的数组,当开始位置超过最大时,返回null |
| | | */ |
| | | public static <T> List<T> sub(Collection<T> list, int start, int end) { |
| | | if (list == null || list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | return sub(new ArrayList<T>(list), start, end); |
| | | } |
| | | |
| | | /** |
| | | * 数组是否为空 |
| | | * |
| | | * @param array 数组 |
| | | * @return 是否为空 |
| | | */ |
| | | public static <T> boolean isEmpty(T[] array) { |
| | | return array == null || array.length == 0; |
| | | } |
| | | |
| | | /** |
| | | * 数组是否为非空 |
| | | * |
| | | * @param array 数组 |
| | | * @return 是否为非空 |
| | | */ |
| | | public static <T> boolean isNotEmpty(T[] array) { |
| | | return false == isEmpty(array); |
| | | } |
| | | |
| | | /** |
| | | * 集合是否为空 |
| | | * |
| | | * @param collection 集合 |
| | | * @return 是否为空 |
| | | */ |
| | | public static boolean isEmpty(Collection<?> collection) { |
| | | return collection == null || collection.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * 集合是否为非空 |
| | | * |
| | | * @param collection 集合 |
| | | * @return 是否为非空 |
| | | */ |
| | | public static boolean isNotEmpty(Collection<?> collection) { |
| | | return false == isEmpty(collection); |
| | | } |
| | | |
| | | /** |
| | | * Map是否为空 |
| | | * |
| | | * @param map 集合 |
| | | * @return 是否为空 |
| | | */ |
| | | public static boolean isEmpty(Map<?, ?> map) { |
| | | return map == null || map.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * Map是否为非空 |
| | | * |
| | | * @param map 集合 |
| | | * @return 是否为非空 |
| | | */ |
| | | public static <T> boolean isNotEmpty(Map<?, ?> map) { |
| | | return false == isEmpty(map); |
| | | } |
| | | |
| | | /** |
| | | * 映射键值(参考Python的zip()函数)<br> |
| | | * 例如:<br> |
| | | * keys = [a,b,c,d]<br> |
| | | * values = [1,2,3,4]<br> |
| | | * 则得到的Map是 {a=1, b=2, c=3, d=4}<br> |
| | | * 如果两个数组长度不同,则只对应最短部分 |
| | | * |
| | | * @param keys 键列表 |
| | | * @param values 值列表 |
| | | * @return Map |
| | | */ |
| | | public static <T, K> Map<T, K> zip(T[] keys, K[] values) { |
| | | if (isEmpty(keys) || isEmpty(values)) { |
| | | return null; |
| | | } |
| | | |
| | | final int size = Math.min(keys.length, values.length); |
| | | final Map<T, K> map = new HashMap<T, K>((int) (size / 0.75)); |
| | | for (int i = 0; i < size; i++) { |
| | | map.put(keys[i], values[i]); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 映射键值(参考Python的zip()函数)<br> |
| | | * 例如:<br> |
| | | * keys = a,b,c,d<br> |
| | | * values = 1,2,3,4<br> |
| | | * delimiter = , |
| | | * 则得到的Map是 {a=1, b=2, c=3, d=4}<br> |
| | | * 如果两个数组长度不同,则只对应最短部分 |
| | | * |
| | | * @param keys 键列表 |
| | | * @param values 值列表 |
| | | * @return Map |
| | | */ |
| | | public static Map<String, String> zip(String keys, String values, String delimiter) { |
| | | return zip(StrKit.split(keys, delimiter), StrKit.split(values, delimiter)); |
| | | } |
| | | |
| | | /** |
| | | * 映射键值(参考Python的zip()函数)<br> |
| | | * 例如:<br> |
| | | * keys = [a,b,c,d]<br> |
| | | * values = [1,2,3,4]<br> |
| | | * 则得到的Map是 {a=1, b=2, c=3, d=4}<br> |
| | | * 如果两个数组长度不同,则只对应最短部分 |
| | | * |
| | | * @param keys 键列表 |
| | | * @param values 值列表 |
| | | * @return Map |
| | | */ |
| | | public static <T, K> Map<T, K> zip(Collection<T> keys, Collection<K> values) { |
| | | if (isEmpty(keys) || isEmpty(values)) { |
| | | return null; |
| | | } |
| | | |
| | | final List<T> keyList = new ArrayList<T>(keys); |
| | | final List<K> valueList = new ArrayList<K>(values); |
| | | |
| | | final int size = Math.min(keys.size(), values.size()); |
| | | final Map<T, K> map = new HashMap<T, K>((int) (size / 0.75)); |
| | | for (int i = 0; i < size; i++) { |
| | | map.put(keyList.get(i), valueList.get(i)); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 数组中是否包含元素 |
| | | * |
| | | * @param array 数组 |
| | | * @param value 被检查的元素 |
| | | * @return 是否包含 |
| | | */ |
| | | public static <T> boolean contains(T[] array, T value) { |
| | | final Class<?> componetType = array.getClass().getComponentType(); |
| | | boolean isPrimitive = false; |
| | | if (null != componetType) { |
| | | isPrimitive = componetType.isPrimitive(); |
| | | } |
| | | for (T t : array) { |
| | | if (t == value) { |
| | | return true; |
| | | } else if (false == isPrimitive && null != value && value.equals(t)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 将Entry集合转换为HashMap |
| | | * |
| | | * @param entryCollection entry集合 |
| | | * @return Map |
| | | */ |
| | | public static <T, K> HashMap<T, K> toMap(Collection<Entry<T, K>> entryCollection) { |
| | | HashMap<T, K> map = new HashMap<T, K>(); |
| | | for (Entry<T, K> entry : entryCollection) { |
| | | map.put(entry.getKey(), entry.getValue()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 将集合转换为排序后的TreeSet |
| | | * |
| | | * @param collection 集合 |
| | | * @param comparator 比较器 |
| | | * @return treeSet |
| | | */ |
| | | public static <T> TreeSet<T> toTreeSet(Collection<T> collection, Comparator<T> comparator) { |
| | | final TreeSet<T> treeSet = new TreeSet<T>(comparator); |
| | | for (T t : collection) { |
| | | treeSet.add(t); |
| | | } |
| | | return treeSet; |
| | | } |
| | | |
| | | /** |
| | | * 排序集合 |
| | | * |
| | | * @param collection 集合 |
| | | * @param comparator 比较器 |
| | | * @return treeSet |
| | | */ |
| | | public static <T> List<T> sort(Collection<T> collection, Comparator<T> comparator) { |
| | | List<T> list = new ArrayList<T>(collection); |
| | | Collections.sort(list, comparator); |
| | | return list; |
| | | } |
| | | |
| | | //------------------------------------------------------------------- 基本类型的数组转换为包装类型数组 |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Integer[] wrap(int... values) { |
| | | final int length = values.length; |
| | | Integer[] array = new Integer[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Long[] wrap(long... values) { |
| | | final int length = values.length; |
| | | Long[] array = new Long[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Character[] wrap(char... values) { |
| | | final int length = values.length; |
| | | Character[] array = new Character[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Byte[] wrap(byte... values) { |
| | | final int length = values.length; |
| | | Byte[] array = new Byte[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Short[] wrap(short... values) { |
| | | final int length = values.length; |
| | | Short[] array = new Short[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Float[] wrap(float... values) { |
| | | final int length = values.length; |
| | | Float[] array = new Float[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Double[] wrap(double... values) { |
| | | final int length = values.length; |
| | | Double[] array = new Double[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 将基本类型数组包装为包装类型 |
| | | * |
| | | * @param values 基本类型数组 |
| | | * @return 包装类型数组 |
| | | */ |
| | | public static Boolean[] wrap(boolean... values) { |
| | | final int length = values.length; |
| | | Boolean[] array = new Boolean[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | array[i] = values[i]; |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 判定给定对象是否为数组类型 |
| | | * |
| | | * @param obj 对象 |
| | | * @return 是否为数组类型 |
| | | */ |
| | | public static boolean isArray(Object obj) { |
| | | return obj.getClass().isArray(); |
| | | } |
| | | |
| | | /** |
| | | * 数组或集合转String |
| | | * |
| | | * @param obj 集合或数组对象 |
| | | * @return 数组字符串,与集合转字符串格式相同 |
| | | */ |
| | | public static String toString(Object obj) { |
| | | if (null == obj) { |
| | | return null; |
| | | } |
| | | if (isArray(obj)) { |
| | | try { |
| | | return Arrays.deepToString((Object[]) obj); |
| | | } catch (Exception e) { |
| | | final String className = obj.getClass().getComponentType().getName(); |
| | | switch (className) { |
| | | case "long": |
| | | return Arrays.toString((long[]) obj); |
| | | case "int": |
| | | return Arrays.toString((int[]) obj); |
| | | case "short": |
| | | return Arrays.toString((short[]) obj); |
| | | case "char": |
| | | return Arrays.toString((char[]) obj); |
| | | case "byte": |
| | | return Arrays.toString((byte[]) obj); |
| | | case "boolean": |
| | | return Arrays.toString((boolean[]) obj); |
| | | case "float": |
| | | return Arrays.toString((float[]) obj); |
| | | case "double": |
| | | return Arrays.toString((double[]) obj); |
| | | default: |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | return obj.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 封装java.util.Date |
| | | * |
| | | * @author xiaoleilu |
| | | */ |
| | | public class DateTime extends Date { |
| | | private static final long serialVersionUID = -5395712593979185936L; |
| | | |
| | | /** |
| | | * 转换JDK date为 DateTime |
| | | * |
| | | * @param date JDK Date |
| | | * @return DateTime |
| | | */ |
| | | public static DateTime parse(Date date) { |
| | | return new DateTime(date); |
| | | } |
| | | |
| | | /** |
| | | * 当前时间 |
| | | */ |
| | | public DateTime() { |
| | | super(); |
| | | } |
| | | |
| | | /** |
| | | * 给定日期的构造 |
| | | * |
| | | * @param date 日期 |
| | | */ |
| | | public DateTime(Date date) { |
| | | this(date.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 给定日期毫秒数的构造 |
| | | * |
| | | * @param timeMillis 日期毫秒数 |
| | | */ |
| | | public DateTime(long timeMillis) { |
| | | super(timeMillis); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return DateTimeKit.formatDateTime(this); |
| | | } |
| | | |
| | | public String toString(String format) { |
| | | return DateTimeKit.format(this, format); |
| | | } |
| | | |
| | | /** |
| | | * @return 输出精确到毫秒的标准日期形式 |
| | | */ |
| | | public String toMsStr() { |
| | | return DateTimeKit.format(this, DateTimeKit.NORM_DATETIME_MS_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * @return java.util.Date |
| | | */ |
| | | public Date toDate() { |
| | | return new Date(this.getTime()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * 时间工具类 |
| | | * |
| | | * @author xiaoleilu |
| | | */ |
| | | public class DateTimeKit { |
| | | /** |
| | | * 毫秒 |
| | | */ |
| | | public final static long MS = 1; |
| | | /** |
| | | * 每秒钟的毫秒数 |
| | | */ |
| | | public final static long SECOND_MS = MS * 1000; |
| | | /** |
| | | * 每分钟的毫秒数 |
| | | */ |
| | | public final static long MINUTE_MS = SECOND_MS * 60; |
| | | /** |
| | | * 每小时的毫秒数 |
| | | */ |
| | | public final static long HOUR_MS = MINUTE_MS * 60; |
| | | /** |
| | | * 每天的毫秒数 |
| | | */ |
| | | public final static long DAY_MS = HOUR_MS * 24; |
| | | |
| | | /** |
| | | * 标准日期格式 |
| | | */ |
| | | public final static String NORM_DATE_PATTERN = "yyyy-MM-dd"; |
| | | /** |
| | | * 标准时间格式 |
| | | */ |
| | | public final static String NORM_TIME_PATTERN = "HH:mm:ss"; |
| | | /** |
| | | * 标准日期时间格式,精确到分 |
| | | */ |
| | | public final static String NORM_DATETIME_MINUTE_PATTERN = "yyyy-MM-dd HH:mm"; |
| | | /** |
| | | * 标准日期时间格式,精确到秒 |
| | | */ |
| | | public final static String NORM_DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; |
| | | /** |
| | | * 标准日期时间格式,精确到毫秒 |
| | | */ |
| | | public final static String NORM_DATETIME_MS_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS"; |
| | | /** |
| | | * HTTP头中日期时间格式 |
| | | */ |
| | | public final static String HTTP_DATETIME_PATTERN = "EEE, dd MMM yyyy HH:mm:ss z"; |
| | | |
| | | /** |
| | | * 标准日期(不含时间)格式化器 |
| | | */ |
| | | // private final static SimpleDateFormat NORM_DATE_FORMAT = new SimpleDateFormat(NORM_DATE_PATTERN); |
| | | private static ThreadLocal<SimpleDateFormat> NORM_DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() { |
| | | synchronized protected SimpleDateFormat initialValue() { |
| | | return new SimpleDateFormat(NORM_DATE_PATTERN); |
| | | } |
| | | |
| | | ; |
| | | }; |
| | | /** |
| | | * 标准时间格式化器 |
| | | */ |
| | | // private final static SimpleDateFormat NORM_TIME_FORMAT = new SimpleDateFormat(NORM_TIME_PATTERN); |
| | | private static ThreadLocal<SimpleDateFormat> NORM_TIME_FORMAT = new ThreadLocal<SimpleDateFormat>() { |
| | | synchronized protected SimpleDateFormat initialValue() { |
| | | return new SimpleDateFormat(NORM_TIME_PATTERN); |
| | | } |
| | | |
| | | ; |
| | | }; |
| | | /** |
| | | * 标准日期时间格式化器 |
| | | */ |
| | | // private final static SimpleDateFormat NORM_DATETIME_FORMAT = new SimpleDateFormat(NORM_DATETIME_PATTERN); |
| | | private static ThreadLocal<SimpleDateFormat> NORM_DATETIME_FORMAT = new ThreadLocal<SimpleDateFormat>() { |
| | | synchronized protected SimpleDateFormat initialValue() { |
| | | return new SimpleDateFormat(NORM_DATETIME_PATTERN); |
| | | } |
| | | |
| | | ; |
| | | }; |
| | | /** |
| | | * HTTP日期时间格式化器 |
| | | */ |
| | | // private final static SimpleDateFormat HTTP_DATETIME_FORMAT = new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US); |
| | | private static ThreadLocal<SimpleDateFormat> HTTP_DATETIME_FORMAT = new ThreadLocal<SimpleDateFormat>() { |
| | | synchronized protected SimpleDateFormat initialValue() { |
| | | return new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US); |
| | | } |
| | | |
| | | ; |
| | | }; |
| | | |
| | | /** |
| | | * 当前时间,格式 yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @return 当前时间的标准形式字符串 |
| | | */ |
| | | public static String now() { |
| | | return formatDateTime(new DateTime()); |
| | | } |
| | | |
| | | /** |
| | | * 当前时间long |
| | | * |
| | | * @param isNano 是否为高精度时间 |
| | | * @return 时间 |
| | | */ |
| | | public static long current(boolean isNano) { |
| | | return isNano ? System.nanoTime() : System.currentTimeMillis(); |
| | | } |
| | | |
| | | /** |
| | | * 当前日期,格式 yyyy-MM-dd |
| | | * |
| | | * @return 当前日期的标准形式字符串 |
| | | */ |
| | | public static String today() { |
| | | return formatDate(new DateTime()); |
| | | } |
| | | |
| | | /** |
| | | * @return 当前月份 |
| | | */ |
| | | public static int thisMonth() { |
| | | return month(date()); |
| | | } |
| | | |
| | | /** |
| | | * @return 今年 |
| | | */ |
| | | public static int thisYear() { |
| | | return year(date()); |
| | | } |
| | | |
| | | /** |
| | | * @return 当前时间 |
| | | */ |
| | | public static DateTime date() { |
| | | return new DateTime(); |
| | | } |
| | | |
| | | /** |
| | | * Long类型时间转为Date |
| | | * |
| | | * @param date Long类型Date(Unix时间戳) |
| | | * @return 时间对象 |
| | | */ |
| | | public static DateTime date(long date) { |
| | | return new DateTime(date); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Calendar对象 |
| | | * |
| | | * @param date 日期对象 |
| | | * @return Calendar对象 |
| | | */ |
| | | public static Calendar toCalendar(Date date) { |
| | | final Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | return cal; |
| | | } |
| | | |
| | | /** |
| | | * 获得月份,从1月开始计数 |
| | | * |
| | | * @param date 日期 |
| | | * @return 月份 |
| | | */ |
| | | public static int month(Date date) { |
| | | return toCalendar(date).get(Calendar.MONTH) + 1; |
| | | } |
| | | |
| | | /** |
| | | * 获得年 |
| | | * |
| | | * @param date 日期 |
| | | * @return 年 |
| | | */ |
| | | public static int year(Date date) { |
| | | return toCalendar(date).get(Calendar.YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 获得季节 |
| | | * |
| | | * @param date 日期 |
| | | * @return 第几个季节 |
| | | */ |
| | | public static int season(Date date) { |
| | | return toCalendar(date).get(Calendar.MONTH) / 3 + 1; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定日期年份和季节<br> |
| | | * 格式:[20131]表示2013年第一季度 |
| | | * |
| | | * @param date 日期 |
| | | * @return Season ,类似于 20132 |
| | | */ |
| | | public static String yearAndSeason(Date date) { |
| | | return yearAndSeason(toCalendar(date)); |
| | | } |
| | | |
| | | /** |
| | | * 获得指定日期区间内的年份和季节<br> |
| | | * |
| | | * @param startDate 其实日期(包含) |
| | | * @param endDate 结束日期(包含) |
| | | * @return Season列表 ,元素类似于 20132 |
| | | */ |
| | | public static LinkedHashSet<String> yearAndSeasons(Date startDate, Date endDate) { |
| | | final LinkedHashSet<String> seasons = new LinkedHashSet<String>(); |
| | | if (startDate == null || endDate == null) { |
| | | return seasons; |
| | | } |
| | | |
| | | final Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(startDate); |
| | | while (true) { |
| | | // 如果开始时间超出结束时间,让结束时间为开始时间,处理完后结束循环 |
| | | if (startDate.after(endDate)) { |
| | | startDate = endDate; |
| | | } |
| | | |
| | | seasons.add(yearAndSeason(cal)); |
| | | |
| | | if (startDate.equals(endDate)) { |
| | | break; |
| | | } |
| | | |
| | | cal.add(Calendar.MONTH, 3); |
| | | startDate = cal.getTime(); |
| | | } |
| | | |
| | | return seasons; |
| | | } |
| | | |
| | | // ------------------------------------ Format start ---------------------------------------------- |
| | | |
| | | /** |
| | | * 根据特定格式格式化日期 |
| | | * |
| | | * @param date 被格式化的日期 |
| | | * @param format 格式 |
| | | * @return 格式化后的字符串 |
| | | */ |
| | | public static String format(Date date, String format) { |
| | | return new SimpleDateFormat(format).format(date); |
| | | } |
| | | |
| | | /** |
| | | * 格式 yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @param date 被格式化的日期 |
| | | * @return 格式化后的日期 |
| | | */ |
| | | public static String formatDateTime(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | return NORM_DATETIME_FORMAT.get().format(date); |
| | | } |
| | | |
| | | /** |
| | | * 格式 yyyy-MM-dd |
| | | * |
| | | * @param date 被格式化的日期 |
| | | * @return 格式化后的字符串 |
| | | */ |
| | | public static String formatDate(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | return NORM_DATE_FORMAT.get().format(date); |
| | | } |
| | | |
| | | /** |
| | | * 格式化为Http的标准日期格式 |
| | | * |
| | | * @param date 被格式化的日期 |
| | | * @return HTTP标准形式日期字符串 |
| | | */ |
| | | public static String formatHttpDate(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | return HTTP_DATETIME_FORMAT.get().format(date); |
| | | } |
| | | // ------------------------------------ Format end ---------------------------------------------- |
| | | |
| | | // ------------------------------------ Parse start ---------------------------------------------- |
| | | |
| | | /** |
| | | * 构建DateTime对象 |
| | | * |
| | | * @param dateStr Date字符串 |
| | | * @param simpleDateFormat 格式化器 |
| | | * @return DateTime对象 |
| | | */ |
| | | public static DateTime parse(String dateStr, SimpleDateFormat simpleDateFormat) { |
| | | try { |
| | | return new DateTime(simpleDateFormat.parse(dateStr)); |
| | | } catch (Exception e) { |
| | | throw new ServiceException(StrKit.format("Parse [{}] with format [{}] error!", dateStr, simpleDateFormat.toPattern())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将特定格式的日期转换为Date对象 |
| | | * |
| | | * @param dateString 特定格式的日期 |
| | | * @param format 格式,例如yyyy-MM-dd |
| | | * @return 日期对象 |
| | | */ |
| | | public static DateTime parse(String dateString, String format) { |
| | | return parse(dateString, new SimpleDateFormat(format)); |
| | | } |
| | | |
| | | /** |
| | | * 格式yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @param dateString 标准形式的时间字符串 |
| | | * @return 日期对象 |
| | | */ |
| | | public static DateTime parseDateTime(String dateString) { |
| | | return parse(dateString, NORM_DATETIME_FORMAT.get()); |
| | | } |
| | | |
| | | /** |
| | | * 格式yyyy-MM-dd |
| | | * |
| | | * @param dateString 标准形式的日期字符串 |
| | | * @return 日期对象 |
| | | */ |
| | | public static DateTime parseDate(String dateString) { |
| | | return parse(dateString, NORM_DATE_FORMAT.get()); |
| | | } |
| | | |
| | | /** |
| | | * 格式HH:mm:ss |
| | | * |
| | | * @param timeString 标准形式的日期字符串 |
| | | * @return 日期对象 |
| | | */ |
| | | public static DateTime parseTime(String timeString) { |
| | | return parse(timeString, NORM_TIME_FORMAT.get()); |
| | | } |
| | | |
| | | /** |
| | | * 格式:<br> |
| | | * 1、yyyy-MM-dd HH:mm:ss<br> |
| | | * 2、yyyy-MM-dd<br> |
| | | * 3、HH:mm:ss<br> |
| | | * 4、yyyy-MM-dd HH:mm 5、yyyy-MM-dd HH:mm:ss.SSS |
| | | * |
| | | * @param dateStr 日期字符串 |
| | | * @return 日期 |
| | | */ |
| | | public static DateTime parse(String dateStr) { |
| | | if (null == dateStr) { |
| | | return null; |
| | | } |
| | | dateStr = dateStr.trim(); |
| | | int length = dateStr.length(); |
| | | try { |
| | | if (length == NORM_DATETIME_PATTERN.length()) { |
| | | return parseDateTime(dateStr); |
| | | } else if (length == NORM_DATE_PATTERN.length()) { |
| | | return parseDate(dateStr); |
| | | } else if (length == NORM_TIME_PATTERN.length()) { |
| | | return parseTime(dateStr); |
| | | } else if (length == NORM_DATETIME_MINUTE_PATTERN.length()) { |
| | | return parse(dateStr, NORM_DATETIME_MINUTE_PATTERN); |
| | | } else if (length >= NORM_DATETIME_MS_PATTERN.length() - 2) { |
| | | return parse(dateStr, NORM_DATETIME_MS_PATTERN); |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | // 没有更多匹配的时间格式 |
| | | throw new ServiceException(StrKit.format(" [{}] format is not fit for date pattern!", dateStr)); |
| | | } |
| | | // ------------------------------------ Parse end ---------------------------------------------- |
| | | |
| | | // ------------------------------------ Offset start ---------------------------------------------- |
| | | |
| | | /** |
| | | * 获取某天的开始时间 |
| | | * |
| | | * @param date 日期 |
| | | * @return 某天的开始时间 |
| | | */ |
| | | public static DateTime getBeginTimeOfDay(Date date) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | return new DateTime(calendar.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 获取某天的结束时间 |
| | | * |
| | | * @param date 日期 |
| | | * @return 某天的结束时间 |
| | | */ |
| | | public static DateTime getEndTimeOfDay(Date date) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 23); |
| | | calendar.set(Calendar.MINUTE, 59); |
| | | calendar.set(Calendar.SECOND, 59); |
| | | calendar.set(Calendar.MILLISECOND, 999); |
| | | return new DateTime(calendar.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 昨天 |
| | | * |
| | | * @return 昨天 |
| | | */ |
| | | public static DateTime yesterday() { |
| | | return offsiteDay(new DateTime(), -1); |
| | | } |
| | | |
| | | /** |
| | | * 上周 |
| | | * |
| | | * @return 上周 |
| | | */ |
| | | public static DateTime lastWeek() { |
| | | return offsiteWeek(new DateTime(), -1); |
| | | } |
| | | |
| | | /** |
| | | * 上个月 |
| | | * |
| | | * @return 上个月 |
| | | */ |
| | | public static DateTime lastMouth() { |
| | | return offsiteMonth(new DateTime(), -1); |
| | | } |
| | | |
| | | /** |
| | | * 偏移天 |
| | | * |
| | | * @param date 日期 |
| | | * @param offsite 偏移天数,正数向未来偏移,负数向历史偏移 |
| | | * @return 偏移后的日期 |
| | | */ |
| | | public static DateTime offsiteDay(Date date, int offsite) { |
| | | return offsiteDate(date, Calendar.DAY_OF_YEAR, offsite); |
| | | } |
| | | |
| | | /** |
| | | * 偏移周 |
| | | * |
| | | * @param date 日期 |
| | | * @param offsite 偏移周数,正数向未来偏移,负数向历史偏移 |
| | | * @return 偏移后的日期 |
| | | */ |
| | | public static DateTime offsiteWeek(Date date, int offsite) { |
| | | return offsiteDate(date, Calendar.WEEK_OF_YEAR, offsite); |
| | | } |
| | | |
| | | /** |
| | | * 偏移月 |
| | | * |
| | | * @param date 日期 |
| | | * @param offsite 偏移月数,正数向未来偏移,负数向历史偏移 |
| | | * @return 偏移后的日期 |
| | | */ |
| | | public static DateTime offsiteMonth(Date date, int offsite) { |
| | | return offsiteDate(date, Calendar.MONTH, offsite); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定日期偏移指定时间后的时间 |
| | | * |
| | | * @param date 基准日期 |
| | | * @param calendarField 偏移的粒度大小(小时、天、月等)使用Calendar中的常数 |
| | | * @param offsite 偏移量,正数为向后偏移,负数为向前偏移 |
| | | * @return 偏移后的日期 |
| | | */ |
| | | public static DateTime offsiteDate(Date date, int calendarField, int offsite) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.add(calendarField, offsite); |
| | | return new DateTime(cal.getTime()); |
| | | } |
| | | // ------------------------------------ Offset end ---------------------------------------------- |
| | | |
| | | /** |
| | | * 判断两个日期相差的时长<br/> |
| | | * 返回 minuend - subtrahend 的差 |
| | | * |
| | | * @param subtrahend 减数日期 |
| | | * @param minuend 被减数日期 |
| | | * @param diffField 相差的选项:相差的天、小时 |
| | | * @return 日期差 |
| | | */ |
| | | public static long diff(Date subtrahend, Date minuend, long diffField) { |
| | | long diff = minuend.getTime() - subtrahend.getTime(); |
| | | return diff / diffField; |
| | | } |
| | | |
| | | /** |
| | | * 计时,常用于记录某段代码的执行时间,单位:纳秒 |
| | | * |
| | | * @param preTime 之前记录的时间 |
| | | * @return 时间差,纳秒 |
| | | */ |
| | | public static long spendNt(long preTime) { |
| | | return System.nanoTime() - preTime; |
| | | } |
| | | |
| | | /** |
| | | * 计时,常用于记录某段代码的执行时间,单位:毫秒 |
| | | * |
| | | * @param preTime 之前记录的时间 |
| | | * @return 时间差,毫秒 |
| | | */ |
| | | public static long spendMs(long preTime) { |
| | | return System.currentTimeMillis() - preTime; |
| | | } |
| | | |
| | | /** |
| | | * 格式化成yyMMddHHmm后转换为int型 |
| | | * |
| | | * @param date 日期 |
| | | * @return int |
| | | */ |
| | | public static int toIntSecond(Date date) { |
| | | return Integer.parseInt(format(date, "yyMMddHHmm")); |
| | | } |
| | | |
| | | /** |
| | | * 计算指定指定时间区间内的周数 |
| | | * |
| | | * @param start 开始时间 |
| | | * @param end 结束时间 |
| | | * @return 周数 |
| | | */ |
| | | public static int weekCount(Date start, Date end) { |
| | | final Calendar startCalendar = Calendar.getInstance(); |
| | | startCalendar.setTime(start); |
| | | final Calendar endCalendar = Calendar.getInstance(); |
| | | endCalendar.setTime(end); |
| | | |
| | | final int startWeekofYear = startCalendar.get(Calendar.WEEK_OF_YEAR); |
| | | final int endWeekofYear = endCalendar.get(Calendar.WEEK_OF_YEAR); |
| | | |
| | | int count = endWeekofYear - startWeekofYear + 1; |
| | | |
| | | if (Calendar.SUNDAY != startCalendar.get(Calendar.DAY_OF_WEEK)) { |
| | | count--; |
| | | } |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 计时器<br> |
| | | * 计算某个过程话费的时间,精确到毫秒 |
| | | * |
| | | * @return Timer |
| | | */ |
| | | public static Timer timer() { |
| | | return new Timer(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 生日转为年龄,计算法定年龄 |
| | | * |
| | | * @param birthDay 生日,标准日期字符串 |
| | | * @return 年龄 |
| | | * @throws Exception |
| | | */ |
| | | public static int ageOfNow(String birthDay) { |
| | | return ageOfNow(parse(birthDay)); |
| | | } |
| | | |
| | | /** |
| | | * 生日转为年龄,计算法定年龄 |
| | | * |
| | | * @param birthDay 生日 |
| | | * @return 年龄 |
| | | * @throws Exception |
| | | */ |
| | | public static int ageOfNow(Date birthDay) { |
| | | return age(birthDay, date()); |
| | | } |
| | | |
| | | /** |
| | | * 计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄 |
| | | * |
| | | * @param birthDay 生日 |
| | | * @param dateToCompare 需要对比的日期 |
| | | * @return 年龄 |
| | | * @throws Exception |
| | | */ |
| | | public static int age(Date birthDay, Date dateToCompare) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(dateToCompare); |
| | | |
| | | if (cal.before(birthDay)) { |
| | | throw new IllegalArgumentException(StrKit.format("Birthday is after date {}!", formatDate(dateToCompare))); |
| | | } |
| | | |
| | | int year = cal.get(Calendar.YEAR); |
| | | int month = cal.get(Calendar.MONTH); |
| | | int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH); |
| | | |
| | | cal.setTime(birthDay); |
| | | int age = year - cal.get(Calendar.YEAR); |
| | | |
| | | int monthBirth = cal.get(Calendar.MONTH); |
| | | if (month == monthBirth) { |
| | | int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); |
| | | if (dayOfMonth < dayOfMonthBirth) { |
| | | //如果生日在当月,但是未达到生日当天的日期,年龄减一 |
| | | age--; |
| | | } |
| | | } else if (month < monthBirth) { |
| | | //如果当前月份未达到生日的月份,年龄计算减一 |
| | | age--; |
| | | } |
| | | |
| | | return age; |
| | | } |
| | | |
| | | /** |
| | | * 计时器<br> |
| | | * 计算某个过程话费的时间,精确到毫秒 |
| | | * |
| | | * @author Looly |
| | | */ |
| | | public static class Timer { |
| | | private long time; |
| | | private boolean isNano; |
| | | |
| | | public Timer() { |
| | | this(false); |
| | | } |
| | | |
| | | public Timer(boolean isNano) { |
| | | this.isNano = isNano; |
| | | start(); |
| | | } |
| | | |
| | | /** |
| | | * @return 开始计时并返回当前时间 |
| | | */ |
| | | public long start() { |
| | | time = current(isNano); |
| | | return time; |
| | | } |
| | | |
| | | /** |
| | | * @return 重新计时并返回从开始到当前的持续时间 |
| | | */ |
| | | public long durationRestart() { |
| | | long now = current(isNano); |
| | | long d = now - time; |
| | | time = now; |
| | | return d; |
| | | } |
| | | |
| | | /** |
| | | * @return 从开始到当前的持续时间 |
| | | */ |
| | | public long duration() { |
| | | return current(isNano) - time; |
| | | } |
| | | } |
| | | |
| | | // ------------------------------------------------------------------------ Private method start |
| | | |
| | | /** |
| | | * 获得指定日期年份和季节<br> |
| | | * 格式:[20131]表示2013年第一季度 |
| | | * |
| | | * @param cal 日期 |
| | | */ |
| | | private static String yearAndSeason(Calendar cal) { |
| | | return new StringBuilder().append(cal.get(Calendar.YEAR)).append(cal.get(Calendar.MONTH) / 3 + 1).toString(); |
| | | } |
| | | // ------------------------------------------------------------------------ Private method end |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import java.nio.charset.Charset; |
| | | |
| | | /** |
| | | * 十六进制(简写为hex或下标16)在数学中是一种逢16进1的进位制,一般用数字0到9和字母A到F表示(其中:A~F即10~15)。<br> |
| | | * 例如十进制数57,在二进制写作111001,在16进制写作39。<br> |
| | | * 像java,c这样的语言为了区分十六进制和十进制数值,会在十六进制数的前面加上 0x,比如0x20是十进制的32,而不是十进制的20<br> |
| | | * <p> |
| | | * 参考:https://my.oschina.net/xinxingegeya/blog/287476 |
| | | * |
| | | * @author Looly |
| | | */ |
| | | public class HexKit { |
| | | |
| | | /** |
| | | * 用于建立十六进制字符的输出的小写字符数组 |
| | | */ |
| | | private static final char[] DIGITS_LOWER = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
| | | /** |
| | | * 用于建立十六进制字符的输出的大写字符数组 |
| | | */ |
| | | private static final char[] DIGITS_UPPER = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; |
| | | |
| | | //---------------------------------------------------------------------------------------------------- encode |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符数组 |
| | | * |
| | | * @param data byte[] |
| | | * @return 十六进制char[] |
| | | */ |
| | | public static char[] encodeHex(byte[] data) { |
| | | return encodeHex(data, true); |
| | | } |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符数组 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 编码 |
| | | * @return 十六进制char[] |
| | | */ |
| | | public static char[] encodeHex(String str, Charset charset) { |
| | | return encodeHex(StrKit.getBytes(str, charset), true); |
| | | } |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符数组 |
| | | * |
| | | * @param data byte[] |
| | | * @param toLowerCase <code>true</code> 传换成小写格式 , <code>false</code> 传换成大写格式 |
| | | * @return 十六进制char[] |
| | | */ |
| | | public static char[] encodeHex(byte[] data, boolean toLowerCase) { |
| | | return encodeHex(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER); |
| | | } |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符串 |
| | | * |
| | | * @param data byte[] |
| | | * @return 十六进制String |
| | | */ |
| | | public static String encodeHexStr(byte[] data) { |
| | | return encodeHexStr(data, true); |
| | | } |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符串 |
| | | * |
| | | * @param data byte[] |
| | | * @param toLowerCase <code>true</code> 传换成小写格式 , <code>false</code> 传换成大写格式 |
| | | * @return 十六进制String |
| | | */ |
| | | public static String encodeHexStr(byte[] data, boolean toLowerCase) { |
| | | return encodeHexStr(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER); |
| | | } |
| | | |
| | | //---------------------------------------------------------------------------------------------------- decode |
| | | |
| | | /** |
| | | * 将十六进制字符数组转换为字符串 |
| | | * |
| | | * @param hexStr 十六进制String |
| | | * @param charset 编码 |
| | | * @return 字符串 |
| | | */ |
| | | public static String decodeHexStr(String hexStr, Charset charset) { |
| | | if (StrKit.isEmpty(hexStr)) { |
| | | return hexStr; |
| | | } |
| | | return decodeHexStr(hexStr.toCharArray(), charset); |
| | | } |
| | | |
| | | /** |
| | | * 将十六进制字符数组转换为字符串 |
| | | * |
| | | * @param hexData 十六进制char[] |
| | | * @param charset 编码 |
| | | * @return 字符串 |
| | | */ |
| | | public static String decodeHexStr(char[] hexData, Charset charset) { |
| | | return StrKit.str(decodeHex(hexData), charset); |
| | | } |
| | | |
| | | /** |
| | | * 将十六进制字符数组转换为字节数组 |
| | | * |
| | | * @param hexData 十六进制char[] |
| | | * @return byte[] |
| | | * @throws RuntimeException 如果源十六进制字符数组是一个奇怪的长度,将抛出运行时异常 |
| | | */ |
| | | public static byte[] decodeHex(char[] hexData) { |
| | | |
| | | int len = hexData.length; |
| | | |
| | | if ((len & 0x01) != 0) { |
| | | throw new RuntimeException("Odd number of characters."); |
| | | } |
| | | |
| | | byte[] out = new byte[len >> 1]; |
| | | |
| | | // two characters form the hex value. |
| | | for (int i = 0, j = 0; j < len; i++) { |
| | | int f = toDigit(hexData[j], j) << 4; |
| | | j++; |
| | | f = f | toDigit(hexData[j], j); |
| | | j++; |
| | | out[i] = (byte) (f & 0xFF); |
| | | } |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //---------------------------------------------------------------------------------------- Private method start |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符串 |
| | | * |
| | | * @param data byte[] |
| | | * @param toDigits 用于控制输出的char[] |
| | | * @return 十六进制String |
| | | */ |
| | | private static String encodeHexStr(byte[] data, char[] toDigits) { |
| | | return new String(encodeHex(data, toDigits)); |
| | | } |
| | | |
| | | /** |
| | | * 将字节数组转换为十六进制字符数组 |
| | | * |
| | | * @param data byte[] |
| | | * @param toDigits 用于控制输出的char[] |
| | | * @return 十六进制char[] |
| | | */ |
| | | private static char[] encodeHex(byte[] data, char[] toDigits) { |
| | | int l = data.length; |
| | | char[] out = new char[l << 1]; |
| | | // two characters form the hex value. |
| | | for (int i = 0, j = 0; i < l; i++) { |
| | | out[j++] = toDigits[(0xF0 & data[i]) >>> 4]; |
| | | out[j++] = toDigits[0x0F & data[i]]; |
| | | } |
| | | return out; |
| | | } |
| | | |
| | | /** |
| | | * 将十六进制字符转换成一个整数 |
| | | * |
| | | * @param ch 十六进制char |
| | | * @param index 十六进制字符在字符数组中的位置 |
| | | * @return 一个整数 |
| | | * @throws RuntimeException 当ch不是一个合法的十六进制字符时,抛出运行时异常 |
| | | */ |
| | | private static int toDigit(char ch, int index) { |
| | | int digit = Character.digit(ch, 16); |
| | | if (digit == -1) { |
| | | throw new RuntimeException("Illegal hexadecimal character " + ch + " at index " + index); |
| | | } |
| | | return digit; |
| | | } |
| | | //---------------------------------------------------------------------------------------- Private method end |
| | | |
| | | |
| | | /** |
| | | * 2进制转16进制 |
| | | * |
| | | * @param bString 2进制字符串 |
| | | * @return |
| | | */ |
| | | public static String binary2Hex(String bString) { |
| | | if (bString == null || bString.equals("") || bString.length() % 8 != 0) |
| | | return null; |
| | | StringBuffer tmp = new StringBuffer(); |
| | | int iTmp = 0; |
| | | for (int i = 0; i < bString.length(); i += 4) { |
| | | iTmp = 0; |
| | | for (int j = 0; j < 4; j++) { |
| | | iTmp += Integer.parseInt(bString.substring(i + j, i + j + 1)) << (4 - j - 1); |
| | | } |
| | | tmp.append(Integer.toHexString(iTmp)); |
| | | } |
| | | return tmp.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 16进制转2进制 |
| | | * |
| | | * @param hexString |
| | | * @return |
| | | */ |
| | | public static String hex2Binary(String hexString) { |
| | | if (hexString == null || hexString.length() % 2 != 0) |
| | | return null; |
| | | String bString = "", tmp; |
| | | for (int i = 0; i < hexString.length(); i++) { |
| | | tmp = "0000" + Integer.toBinaryString(Integer.parseInt(hexString.substring(i, i + 1), 16)); |
| | | bString += tmp.substring(tmp.length() - 4); |
| | | } |
| | | return bString; |
| | | } |
| | | |
| | | /** |
| | | * 将二进制转换成16进制 |
| | | * |
| | | * @param buf |
| | | * @return |
| | | */ |
| | | public static String binary2Hex(byte buf[]) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < buf.length; i++) { |
| | | String hex = Integer.toHexString(buf[i] & 0xFF); |
| | | if (hex.length() == 1) { |
| | | hex = '0' + hex; |
| | | } |
| | | sb.append(hex.toUpperCase()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将16进制转换为二进制 |
| | | * |
| | | * @param hexStr |
| | | * @return |
| | | */ |
| | | public static byte[] hex2Byte(String hexStr) { |
| | | if (hexStr.length() < 1) |
| | | return null; |
| | | byte[] result = new byte[hexStr.length() / 2]; |
| | | for (int i = 0; i < hexStr.length() / 2; i++) { |
| | | int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); |
| | | int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); |
| | | result[i] = (byte) (high * 16 + low); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed 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 |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * 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. |
| | | */ |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.PrintWriter; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.net.URLEncoder; |
| | | import java.util.Enumeration; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class HttpKit { |
| | | |
| | | public static String getIp() { |
| | | return HttpKit.getRequest().getRemoteHost(); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有请求的值 |
| | | */ |
| | | public static Map<String, String> getRequestParameters() { |
| | | HashMap<String, String> values = new HashMap<>(); |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | Enumeration enums = request.getParameterNames(); |
| | | while (enums.hasMoreElements()) { |
| | | String paramName = (String) enums.nextElement(); |
| | | String paramValue = request.getParameter(paramName); |
| | | values.put(paramName, paramValue); |
| | | } |
| | | return values; |
| | | } |
| | | |
| | | /** |
| | | * 获取 HttpServletRequest |
| | | */ |
| | | public static HttpServletResponse getResponse() { |
| | | HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); |
| | | return response; |
| | | } |
| | | |
| | | /** |
| | | * 获取 包装防Xss Sql注入的 HttpServletRequest |
| | | * |
| | | * @return request |
| | | */ |
| | | public static HttpServletRequest getRequest() { |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | return new WafRequestWrapper(request); |
| | | } |
| | | |
| | | /** |
| | | * 向指定URL发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的URL |
| | | * @param param 请求参数 |
| | | * @return URL 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, Map<String, String> param) { |
| | | String result = ""; |
| | | BufferedReader in = null; |
| | | try { |
| | | StringBuffer query = new StringBuffer(); |
| | | |
| | | for (Map.Entry<String, String> kv : param.entrySet()) { |
| | | query.append(URLEncoder.encode(kv.getKey(), "UTF-8") + "="); |
| | | query.append(URLEncoder.encode(kv.getValue(), "UTF-8") + "&"); |
| | | } |
| | | if (query.lastIndexOf("&") > 0) { |
| | | query.deleteCharAt(query.length() - 1); |
| | | } |
| | | |
| | | String urlNameString = url + "?" + query.toString(); |
| | | URL realUrl = new URL(urlNameString); |
| | | // 打开和URL之间的连接 |
| | | URLConnection connection = realUrl.openConnection(); |
| | | // 设置通用的请求属性 |
| | | connection.setRequestProperty("accept", "*/*"); |
| | | connection.setRequestProperty("connection", "Keep-Alive"); |
| | | connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | // 建立实际的连接 |
| | | connection.connect(); |
| | | // 获取所有响应头字段 |
| | | Map<String, List<String>> map = connection.getHeaderFields(); |
| | | // 遍历所有的响应头字段 |
| | | for (String key : map.keySet()) { |
| | | System.out.println(key + "--->" + map.get(key)); |
| | | } |
| | | // 定义 BufferedReader输入流来读取URL的响应 |
| | | in = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | String line; |
| | | while ((line = in.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("发送GET请求出现异常!" + e); |
| | | e.printStackTrace(); |
| | | } |
| | | // 使用finally块来关闭输入流 |
| | | finally { |
| | | try { |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (Exception e2) { |
| | | e2.printStackTrace(); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送POST方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendPost(String url, Map<String, String> param) { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | String result = ""; |
| | | try { |
| | | String para = ""; |
| | | for (String key : param.keySet()) { |
| | | para += (key + "=" + param.get(key) + "&"); |
| | | } |
| | | if (para.lastIndexOf("&") > 0) { |
| | | para = para.substring(0, para.length() - 1); |
| | | } |
| | | String urlNameString = url + "?" + para; |
| | | URL realUrl = new URL(urlNameString); |
| | | // 打开和URL之间的连接 |
| | | URLConnection conn = realUrl.openConnection(); |
| | | // 设置通用的请求属性 |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | // 发送POST请求必须设置如下两行 |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | // 获取URLConnection对象对应的输出流 |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | // 发送请求参数 |
| | | out.print(param); |
| | | // flush输出流的缓冲 |
| | | out.flush(); |
| | | // 定义BufferedReader输入流来读取URL的响应 |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream())); |
| | | String line; |
| | | while ((line = in.readLine()) != null) { |
| | | result += line; |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("发送 POST 请求出现异常!" + e); |
| | | e.printStackTrace(); |
| | | } |
| | | // 使用finally块来关闭输出流、输入流 |
| | | finally { |
| | | try { |
| | | if (out != null) { |
| | | out.close(); |
| | | } |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (IOException ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | /** |
| | | * 一些通用的函数 |
| | | * |
| | | * @author Looly |
| | | */ |
| | | public class ObjectKit { |
| | | /** |
| | | * 比较两个对象是否相等。<br> |
| | | * 相同的条件有两个,满足其一即可:<br> |
| | | * 1. obj1 == null && obj2 == null; 2. obj1.equals(obj2) |
| | | * |
| | | * @param obj1 对象1 |
| | | * @param obj2 对象2 |
| | | * @return 是否相等 |
| | | */ |
| | | public static boolean equals(Object obj1, Object obj2) { |
| | | return (obj1 != null) ? (obj1.equals(obj2)) : (obj2 == null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | /** |
| | | * 分页工具类 |
| | | * |
| | | * @author xiaoleilu |
| | | */ |
| | | public class PageKit { |
| | | |
| | | /** |
| | | * 将页数和每页条目数转换为开始位置和结束位置<br> |
| | | * 此方法用于不包括结束位置的分页方法<br> |
| | | * 例如:<br> |
| | | * 页码:1,每页10 -> [0, 10]<br> |
| | | * 页码:2,每页10 -> [10, 20]<br> |
| | | * 。。。<br> |
| | | * |
| | | * @param pageNo 页码(从1计数) |
| | | * @param countPerPage 每页条目数 |
| | | * @return 第一个数为开始位置,第二个数为结束位置 |
| | | */ |
| | | public static int[] transToStartEnd(int pageNo, int countPerPage) { |
| | | if (pageNo < 1) { |
| | | pageNo = 1; |
| | | } |
| | | |
| | | if (countPerPage < 1) { |
| | | countPerPage = 0; |
| | | // LogKit.warn("Count per page [" + countPerPage + "] is not valid!"); |
| | | } |
| | | |
| | | int start = (pageNo - 1) * countPerPage; |
| | | int end = start + countPerPage; |
| | | |
| | | return new int[]{start, end}; |
| | | } |
| | | |
| | | /** |
| | | * 根据总数计算总页数 |
| | | * |
| | | * @param totalCount 总数 |
| | | * @param numPerPage 每页数 |
| | | * @return 总页数 |
| | | */ |
| | | public static int totalPage(int totalCount, int numPerPage) { |
| | | if (numPerPage == 0) { |
| | | return 0; |
| | | } |
| | | return totalCount % numPerPage == 0 ? (totalCount / numPerPage) |
| | | : (totalCount / numPerPage + 1); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import java.io.StringReader; |
| | | import java.io.StringWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | * 字符串工具类 |
| | | * |
| | | * @author xiaoleilu |
| | | */ |
| | | public class StrKit { |
| | | |
| | | public static final String SPACE = " "; |
| | | public static final String DOT = "."; |
| | | public static final String SLASH = "/"; |
| | | public static final String BACKSLASH = "\\"; |
| | | public static final String EMPTY = ""; |
| | | public static final String CRLF = "\r\n"; |
| | | public static final String NEWLINE = "\n"; |
| | | public static final String UNDERLINE = "_"; |
| | | public static final String COMMA = ","; |
| | | |
| | | public static final String HTML_NBSP = " "; |
| | | public static final String HTML_AMP = "&"; |
| | | public static final String HTML_QUOTE = """; |
| | | public static final String HTML_LT = "<"; |
| | | public static final String HTML_GT = ">"; |
| | | |
| | | public static final String EMPTY_JSON = "{}"; |
| | | |
| | | |
| | | /** |
| | | * 首字母变小写 |
| | | */ |
| | | public static String firstCharToLowerCase(String str) { |
| | | char firstChar = str.charAt(0); |
| | | if (firstChar >= 'A' && firstChar <= 'Z') { |
| | | char[] arr = str.toCharArray(); |
| | | arr[0] += ('a' - 'A'); |
| | | return new String(arr); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 首字母变大写 |
| | | */ |
| | | public static String firstCharToUpperCase(String str) { |
| | | char firstChar = str.charAt(0); |
| | | if (firstChar >= 'a' && firstChar <= 'z') { |
| | | char[] arr = str.toCharArray(); |
| | | arr[0] -= ('a' - 'A'); |
| | | return new String(arr); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | // ------------------------------------------------------------------------ Blank |
| | | |
| | | /** |
| | | * 字符串是否为空白 空白的定义如下: <br> |
| | | * 1、为null <br> |
| | | * 2、为不可见字符(如空格)<br> |
| | | * 3、""<br> |
| | | * |
| | | * @param str 被检测的字符串 |
| | | * @return 是否为空 |
| | | */ |
| | | public static boolean isBlank(String str) { |
| | | int length; |
| | | if ((str == null) || ((length = str.length()) == 0)) { |
| | | return true; |
| | | } |
| | | for (int i = 0; i < length; i++) { |
| | | // 只要有一个非空字符即为非空字符串 |
| | | if (false == Character.isWhitespace(str.charAt(i))) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 字符串是否为非空白 空白的定义如下: <br> |
| | | * 1、不为null <br> |
| | | * 2、不为不可见字符(如空格)<br> |
| | | * 3、不为""<br> |
| | | * |
| | | * @param str 被检测的字符串 |
| | | * @return 是否为非空 |
| | | */ |
| | | public static boolean notBlank(String str) { |
| | | return false == isBlank(str); |
| | | } |
| | | |
| | | /** |
| | | * 是否包含空字符串 |
| | | * |
| | | * @param strs 字符串列表 |
| | | * @return 是否包含空字符串 |
| | | */ |
| | | public static boolean hasBlank(String... strs) { |
| | | if (CollectionKit.isEmpty(strs)) { |
| | | return true; |
| | | } |
| | | for (String str : strs) { |
| | | if (isBlank(str)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 给定所有字符串是否为空白 |
| | | * |
| | | * @param strs 字符串 |
| | | * @return 所有字符串是否为空白 |
| | | */ |
| | | public static boolean isAllBlank(String... strs) { |
| | | if (CollectionKit.isEmpty(strs)) { |
| | | return true; |
| | | } |
| | | for (String str : strs) { |
| | | if (notBlank(str)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // ------------------------------------------------------------------------ Empty |
| | | |
| | | /** |
| | | * 字符串是否为空,空的定义如下 1、为null <br> |
| | | * 2、为""<br> |
| | | * |
| | | * @param str 被检测的字符串 |
| | | * @return 是否为空 |
| | | */ |
| | | public static boolean isEmpty(String str) { |
| | | return str == null || str.length() == 0; |
| | | } |
| | | |
| | | /** |
| | | * 字符串是否为非空白 空白的定义如下: <br> |
| | | * 1、不为null <br> |
| | | * 2、不为""<br> |
| | | * |
| | | * @param str 被检测的字符串 |
| | | * @return 是否为非空 |
| | | */ |
| | | public static boolean isNotEmpty(String str) { |
| | | return false == isEmpty(str); |
| | | } |
| | | |
| | | /** |
| | | * 当给定字符串为null时,转换为Empty |
| | | * |
| | | * @param str 被转换的字符串 |
| | | * @return 转换后的字符串 |
| | | */ |
| | | public static String nullToEmpty(String str) { |
| | | return nullToDefault(str, EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 如果字符串是<code>null</code>,则返回指定默认字符串,否则返回字符串本身。 |
| | | * |
| | | * <pre> |
| | | * nullToDefault(null, "default") = "default" |
| | | * nullToDefault("", "default") = "" |
| | | * nullToDefault(" ", "default") = " " |
| | | * nullToDefault("bat", "default") = "bat" |
| | | * </pre> |
| | | * |
| | | * @param str 要转换的字符串 |
| | | * @param defaultStr 默认字符串 |
| | | * @return 字符串本身或指定的默认字符串 |
| | | */ |
| | | public static String nullToDefault(String str, String defaultStr) { |
| | | return (str == null) ? defaultStr : str; |
| | | } |
| | | |
| | | /** |
| | | * 当给定字符串为空字符串时,转换为<code>null</code> |
| | | * |
| | | * @param str 被转换的字符串 |
| | | * @return 转换后的字符串 |
| | | */ |
| | | public static String emptyToNull(String str) { |
| | | return isEmpty(str) ? null : str; |
| | | } |
| | | |
| | | /** |
| | | * 是否包含空字符串 |
| | | * |
| | | * @param strs 字符串列表 |
| | | * @return 是否包含空字符串 |
| | | */ |
| | | public static boolean hasEmpty(String... strs) { |
| | | if (CollectionKit.isEmpty(strs)) { |
| | | return true; |
| | | } |
| | | |
| | | for (String str : strs) { |
| | | if (isEmpty(str)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 是否全部为空字符串 |
| | | * |
| | | * @param strs 字符串列表 |
| | | * @return 是否全部为空字符串 |
| | | */ |
| | | public static boolean isAllEmpty(String... strs) { |
| | | if (CollectionKit.isEmpty(strs)) { |
| | | return true; |
| | | } |
| | | |
| | | for (String str : strs) { |
| | | if (isNotEmpty(str)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // ------------------------------------------------------------------------ Trim |
| | | |
| | | /** |
| | | * 除去字符串头尾部的空白,如果字符串是<code>null</code>,依然返回<code>null</code>。 |
| | | * |
| | | * <p> |
| | | * 注意,和<code>String.trim</code>不同,此方法使用<code>Character.isWhitespace</code> 来判定空白, 因而可以除去英文字符集之外的其它空白,如中文空格。 |
| | | * |
| | | * <pre> |
| | | * trim(null) = null |
| | | * trim("") = "" |
| | | * trim(" ") = "" |
| | | * trim("abc") = "abc" |
| | | * trim(" abc ") = "abc" |
| | | * </pre> |
| | | * |
| | | * </p> |
| | | * |
| | | * @param str 要处理的字符串 |
| | | * @return 除去空白的字符串,如果原字串为<code>null</code>,则返回<code>null</code> |
| | | */ |
| | | public static String trim(String str) { |
| | | return (null == str) ? null : trim(str, 0); |
| | | } |
| | | |
| | | /** |
| | | * 给定字符串数组全部做去首尾空格 |
| | | * |
| | | * @param strs 字符串数组 |
| | | */ |
| | | public static void trim(String[] strs) { |
| | | if (null == strs) { |
| | | return; |
| | | } |
| | | String str; |
| | | for (int i = 0; i < strs.length; i++) { |
| | | str = strs[i]; |
| | | if (null != str) { |
| | | strs[i] = str.trim(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 除去字符串头部的空白,如果字符串是<code>null</code>,则返回<code>null</code>。 |
| | | * |
| | | * <p> |
| | | * 注意,和<code>String.trim</code>不同,此方法使用<code>Character.isWhitespace</code> 来判定空白, 因而可以除去英文字符集之外的其它空白,如中文空格。 |
| | | * |
| | | * <pre> |
| | | * trimStart(null) = null |
| | | * trimStart("") = "" |
| | | * trimStart("abc") = "abc" |
| | | * trimStart(" abc") = "abc" |
| | | * trimStart("abc ") = "abc " |
| | | * trimStart(" abc ") = "abc " |
| | | * </pre> |
| | | * |
| | | * </p> |
| | | * |
| | | * @param str 要处理的字符串 |
| | | * @return 除去空白的字符串,如果原字串为<code>null</code>或结果字符串为<code>""</code>,则返回 <code>null</code> |
| | | */ |
| | | public static String trimStart(String str) { |
| | | return trim(str, -1); |
| | | } |
| | | |
| | | /** |
| | | * 除去字符串尾部的空白,如果字符串是<code>null</code>,则返回<code>null</code>。 |
| | | * |
| | | * <p> |
| | | * 注意,和<code>String.trim</code>不同,此方法使用<code>Character.isWhitespace</code> 来判定空白, 因而可以除去英文字符集之外的其它空白,如中文空格。 |
| | | * |
| | | * <pre> |
| | | * trimEnd(null) = null |
| | | * trimEnd("") = "" |
| | | * trimEnd("abc") = "abc" |
| | | * trimEnd(" abc") = " abc" |
| | | * trimEnd("abc ") = "abc" |
| | | * trimEnd(" abc ") = " abc" |
| | | * </pre> |
| | | * |
| | | * </p> |
| | | * |
| | | * @param str 要处理的字符串 |
| | | * @return 除去空白的字符串,如果原字串为<code>null</code>或结果字符串为<code>""</code>,则返回 <code>null</code> |
| | | */ |
| | | public static String trimEnd(String str) { |
| | | return trim(str, 1); |
| | | } |
| | | |
| | | /** |
| | | * 除去字符串头尾部的空白符,如果字符串是<code>null</code>,依然返回<code>null</code>。 |
| | | * |
| | | * @param str 要处理的字符串 |
| | | * @param mode <code>-1</code>表示trimStart,<code>0</code>表示trim全部, <code>1</code>表示trimEnd |
| | | * @return 除去指定字符后的的字符串,如果原字串为<code>null</code>,则返回<code>null</code> |
| | | */ |
| | | public static String trim(String str, int mode) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | int length = str.length(); |
| | | int start = 0; |
| | | int end = length; |
| | | |
| | | // 扫描字符串头部 |
| | | if (mode <= 0) { |
| | | while ((start < end) && (Character.isWhitespace(str.charAt(start)))) { |
| | | start++; |
| | | } |
| | | } |
| | | |
| | | // 扫描字符串尾部 |
| | | if (mode >= 0) { |
| | | while ((start < end) && (Character.isWhitespace(str.charAt(end - 1)))) { |
| | | end--; |
| | | } |
| | | } |
| | | |
| | | if ((start > 0) || (end < length)) { |
| | | return str.substring(start, end); |
| | | } |
| | | |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 是否以指定字符串开头 |
| | | * |
| | | * @param str 被监测字符串 |
| | | * @param prefix 开头字符串 |
| | | * @param isIgnoreCase 是否忽略大小写 |
| | | * @return 是否以指定字符串开头 |
| | | */ |
| | | public static boolean startWith(String str, String prefix, boolean isIgnoreCase) { |
| | | if (isIgnoreCase) { |
| | | return str.toLowerCase().startsWith(prefix.toLowerCase()); |
| | | } else { |
| | | return str.startsWith(prefix); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否以指定字符串结尾 |
| | | * |
| | | * @param str 被监测字符串 |
| | | * @param suffix 结尾字符串 |
| | | * @param isIgnoreCase 是否忽略大小写 |
| | | * @return 是否以指定字符串结尾 |
| | | */ |
| | | public static boolean endWith(String str, String suffix, boolean isIgnoreCase) { |
| | | if (isIgnoreCase) { |
| | | return str.toLowerCase().endsWith(suffix.toLowerCase()); |
| | | } else { |
| | | return str.endsWith(suffix); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否包含特定字符,忽略大小写,如果给定两个参数都为<code>null</code>,返回true |
| | | * |
| | | * @param str 被检测字符串 |
| | | * @param testStr 被测试是否包含的字符串 |
| | | * @return 是否包含 |
| | | */ |
| | | public static boolean containsIgnoreCase(String str, String testStr) { |
| | | if (null == str) { |
| | | //如果被监测字符串和 |
| | | return null == testStr; |
| | | } |
| | | return str.toLowerCase().contains(testStr.toLowerCase()); |
| | | } |
| | | |
| | | /** |
| | | * 获得set或get方法对应的标准属性名<br/> |
| | | * 例如:setName 返回 name |
| | | * |
| | | * @param getOrSetMethodName |
| | | * @return 如果是set或get方法名,返回field, 否则null |
| | | */ |
| | | public static String getGeneralField(String getOrSetMethodName) { |
| | | if (getOrSetMethodName.startsWith("get") || getOrSetMethodName.startsWith("set")) { |
| | | return cutPreAndLowerFirst(getOrSetMethodName, 3); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 生成set方法名<br/> |
| | | * 例如:name 返回 setName |
| | | * |
| | | * @param fieldName 属性名 |
| | | * @return setXxx |
| | | */ |
| | | public static String genSetter(String fieldName) { |
| | | return upperFirstAndAddPre(fieldName, "set"); |
| | | } |
| | | |
| | | /** |
| | | * 生成get方法名 |
| | | * |
| | | * @param fieldName 属性名 |
| | | * @return getXxx |
| | | */ |
| | | public static String genGetter(String fieldName) { |
| | | return upperFirstAndAddPre(fieldName, "get"); |
| | | } |
| | | |
| | | /** |
| | | * 去掉首部指定长度的字符串并将剩余字符串首字母小写<br/> |
| | | * 例如:str=setName, preLength=3 -> return name |
| | | * |
| | | * @param str 被处理的字符串 |
| | | * @param preLength 去掉的长度 |
| | | * @return 处理后的字符串,不符合规范返回null |
| | | */ |
| | | public static String cutPreAndLowerFirst(String str, int preLength) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | if (str.length() > preLength) { |
| | | char first = Character.toLowerCase(str.charAt(preLength)); |
| | | if (str.length() > preLength + 1) { |
| | | return first + str.substring(preLength + 1); |
| | | } |
| | | return String.valueOf(first); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 原字符串首字母大写并在其首部添加指定字符串 例如:str=name, preString=get -> return getName |
| | | * |
| | | * @param str 被处理的字符串 |
| | | * @param preString 添加的首部 |
| | | * @return 处理后的字符串 |
| | | */ |
| | | public static String upperFirstAndAddPre(String str, String preString) { |
| | | if (str == null || preString == null) { |
| | | return null; |
| | | } |
| | | return preString + upperFirst(str); |
| | | } |
| | | |
| | | /** |
| | | * 大写首字母<br> |
| | | * 例如:str = name, return Name |
| | | * |
| | | * @param str 字符串 |
| | | * @return 字符串 |
| | | */ |
| | | public static String upperFirst(String str) { |
| | | return Character.toUpperCase(str.charAt(0)) + str.substring(1); |
| | | } |
| | | |
| | | /** |
| | | * 小写首字母<br> |
| | | * 例如:str = Name, return name |
| | | * |
| | | * @param str 字符串 |
| | | * @return 字符串 |
| | | */ |
| | | public static String lowerFirst(String str) { |
| | | if (isBlank(str)) { |
| | | return str; |
| | | } |
| | | return Character.toLowerCase(str.charAt(0)) + str.substring(1); |
| | | } |
| | | |
| | | /** |
| | | * 去掉指定前缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @return 切掉后的字符串,若前缀不是 preffix, 返回原字符串 |
| | | */ |
| | | public static String removePrefix(String str, String prefix) { |
| | | if (isEmpty(str) || isEmpty(prefix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.startsWith(prefix)) { |
| | | return str.substring(prefix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 忽略大小写去掉指定前缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @return 切掉后的字符串,若前缀不是 prefix, 返回原字符串 |
| | | */ |
| | | public static String removePrefixIgnoreCase(String str, String prefix) { |
| | | if (isEmpty(str) || isEmpty(prefix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.toLowerCase().startsWith(prefix.toLowerCase())) { |
| | | return str.substring(prefix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffix(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.endsWith(suffix)) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 获得字符串对应byte数组 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 编码,如果为<code>null</code>使用系统默认编码 |
| | | * @return bytes |
| | | */ |
| | | public static byte[] getBytes(String str, Charset charset) { |
| | | if (null == str) { |
| | | return null; |
| | | } |
| | | return null == charset ? str.getBytes() : str.getBytes(charset); |
| | | } |
| | | |
| | | /** |
| | | * 忽略大小写去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffixIgnoreCase(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.toLowerCase().endsWith(suffix.toLowerCase())) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 如果给定字符串不是以prefix开头的,在开头补充 prefix |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @return 补充后的字符串 |
| | | */ |
| | | public static String addPrefixIfNot(String str, String prefix) { |
| | | if (isEmpty(str) || isEmpty(prefix)) { |
| | | return str; |
| | | } |
| | | if (false == str.startsWith(prefix)) { |
| | | str = prefix + str; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 如果给定字符串不是以suffix结尾的,在尾部补充 suffix |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 补充后的字符串 |
| | | */ |
| | | public static String addSuffixIfNot(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | if (false == str.endsWith(suffix)) { |
| | | str += suffix; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 清理空白字符 |
| | | * |
| | | * @param str 被清理的字符串 |
| | | * @return 清理后的字符串 |
| | | */ |
| | | public static String cleanBlank(String str) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | return str.replaceAll("\\s*", EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 切分字符串<br> |
| | | * a#b#c -> [a,b,c] <br> |
| | | * a##b#c -> [a,"",b,c] |
| | | * |
| | | * @param str 被切分的字符串 |
| | | * @param separator 分隔符字符 |
| | | * @return 切分后的集合 |
| | | */ |
| | | public static List<String> split(String str, char separator) { |
| | | return split(str, separator, 0); |
| | | } |
| | | |
| | | /** |
| | | * 切分字符串 |
| | | * |
| | | * @param str 被切分的字符串 |
| | | * @param separator 分隔符字符 |
| | | * @param limit 限制分片数 |
| | | * @return 切分后的集合 |
| | | */ |
| | | public static List<String> split(String str, char separator, int limit) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | List<String> list = new ArrayList<String>(limit == 0 ? 16 : limit); |
| | | if (limit == 1) { |
| | | list.add(str); |
| | | return list; |
| | | } |
| | | |
| | | boolean isNotEnd = true; // 未结束切分的标志 |
| | | int strLen = str.length(); |
| | | StringBuilder sb = new StringBuilder(strLen); |
| | | for (int i = 0; i < strLen; i++) { |
| | | char c = str.charAt(i); |
| | | if (isNotEnd && c == separator) { |
| | | list.add(sb.toString()); |
| | | // 清空StringBuilder |
| | | sb.delete(0, sb.length()); |
| | | |
| | | // 当达到切分上限-1的量时,将所剩字符全部作为最后一个串 |
| | | if (limit != 0 && list.size() == limit - 1) { |
| | | isNotEnd = false; |
| | | } |
| | | } else { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | list.add(sb.toString());// 加入尾串 |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 切分字符串<br> |
| | | * from jodd |
| | | * |
| | | * @param str 被切分的字符串 |
| | | * @param delimiter 分隔符 |
| | | * @return 字符串 |
| | | */ |
| | | public static String[] split(String str, String delimiter) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | if (str.trim().length() == 0) { |
| | | return new String[]{str}; |
| | | } |
| | | |
| | | int dellen = delimiter.length(); // del length |
| | | int maxparts = (str.length() / dellen) + 2; // one more for the last |
| | | int[] positions = new int[maxparts]; |
| | | |
| | | int i, j = 0; |
| | | int count = 0; |
| | | positions[0] = -dellen; |
| | | while ((i = str.indexOf(delimiter, j)) != -1) { |
| | | count++; |
| | | positions[count] = i; |
| | | j = i + dellen; |
| | | } |
| | | count++; |
| | | positions[count] = str.length(); |
| | | |
| | | String[] result = new String[count]; |
| | | |
| | | for (i = 0; i < count; i++) { |
| | | result[i] = str.substring(positions[i] + dellen, positions[i + 1]); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 改进JDK subString<br> |
| | | * index从0开始计算,最后一个字符为-1<br> |
| | | * 如果from和to位置一样,返回 "" <br> |
| | | * 如果from或to为负数,则按照length从后向前数位置,如果绝对值大于字符串长度,则from归到0,to归到length<br> |
| | | * 如果经过修正的index中from大于to,则互换from和to |
| | | * example: <br> |
| | | * abcdefgh 2 3 -> c <br> |
| | | * abcdefgh 2 -3 -> cde <br> |
| | | * |
| | | * @param string String |
| | | * @param fromIndex 开始的index(包括) |
| | | * @param toIndex 结束的index(不包括) |
| | | * @return 字串 |
| | | */ |
| | | public static String sub(String string, int fromIndex, int toIndex) { |
| | | int len = string.length(); |
| | | if (fromIndex < 0) { |
| | | fromIndex = len + fromIndex; |
| | | if (fromIndex < 0) { |
| | | fromIndex = 0; |
| | | } |
| | | } else if (fromIndex >= len) { |
| | | fromIndex = len - 1; |
| | | } |
| | | if (toIndex < 0) { |
| | | toIndex = len + toIndex; |
| | | if (toIndex < 0) { |
| | | toIndex = len; |
| | | } |
| | | } else if (toIndex > len) { |
| | | toIndex = len; |
| | | } |
| | | if (toIndex < fromIndex) { |
| | | int tmp = fromIndex; |
| | | fromIndex = toIndex; |
| | | toIndex = tmp; |
| | | } |
| | | if (fromIndex == toIndex) { |
| | | return EMPTY; |
| | | } |
| | | char[] strArray = string.toCharArray(); |
| | | char[] newStrArray = Arrays.copyOfRange(strArray, fromIndex, toIndex); |
| | | return new String(newStrArray); |
| | | } |
| | | |
| | | /** |
| | | * 切割前部分 |
| | | * |
| | | * @param string 字符串 |
| | | * @param toIndex 切割到的位置(不包括) |
| | | * @return 切割后的字符串 |
| | | */ |
| | | public static String subPre(String string, int toIndex) { |
| | | return sub(string, 0, toIndex); |
| | | } |
| | | |
| | | /** |
| | | * 切割后部分 |
| | | * |
| | | * @param string 字符串 |
| | | * @param fromIndex 切割开始的位置(包括) |
| | | * @return 切割后的字符串 |
| | | */ |
| | | public static String subSuf(String string, int fromIndex) { |
| | | if (isEmpty(string)) { |
| | | return null; |
| | | } |
| | | return sub(string, fromIndex, string.length()); |
| | | } |
| | | |
| | | /** |
| | | * 给定字符串是否被字符包围 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 是否包围,空串不包围 |
| | | */ |
| | | public static boolean isSurround(String str, String prefix, String suffix) { |
| | | if (StrKit.isBlank(str)) { |
| | | return false; |
| | | } |
| | | if (str.length() < (prefix.length() + suffix.length())) { |
| | | return false; |
| | | } |
| | | |
| | | return str.startsWith(prefix) && str.endsWith(suffix); |
| | | } |
| | | |
| | | /** |
| | | * 给定字符串是否被字符包围 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 是否包围,空串不包围 |
| | | */ |
| | | public static boolean isSurround(String str, char prefix, char suffix) { |
| | | if (StrKit.isBlank(str)) { |
| | | return false; |
| | | } |
| | | if (str.length() < 2) { |
| | | return false; |
| | | } |
| | | |
| | | return str.charAt(0) == prefix && str.charAt(str.length() - 1) == suffix; |
| | | } |
| | | |
| | | /** |
| | | * 重复某个字符 |
| | | * |
| | | * @param c 被重复的字符 |
| | | * @param count 重复的数目 |
| | | * @return 重复字符字符串 |
| | | */ |
| | | public static String repeat(char c, int count) { |
| | | char[] result = new char[count]; |
| | | for (int i = 0; i < count; i++) { |
| | | result[i] = c; |
| | | } |
| | | return new String(result); |
| | | } |
| | | |
| | | /** |
| | | * 重复某个字符串 |
| | | * |
| | | * @param str 被重复的字符 |
| | | * @param count 重复的数目 |
| | | * @return 重复字符字符串 |
| | | */ |
| | | public static String repeat(String str, int count) { |
| | | |
| | | // 检查 |
| | | final int len = str.length(); |
| | | final long longSize = (long) len * (long) count; |
| | | final int size = (int) longSize; |
| | | if (size != longSize) { |
| | | throw new ArrayIndexOutOfBoundsException("Required String length is too large: " + longSize); |
| | | } |
| | | |
| | | final char[] array = new char[size]; |
| | | str.getChars(0, len, array, 0); |
| | | int n; |
| | | for (n = len; n < size - n; n <<= 1) {// n <<= 1相当于n *2 |
| | | System.arraycopy(array, 0, array, n, n); |
| | | } |
| | | System.arraycopy(array, 0, array, n, size - n); |
| | | return new String(array); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个字符串(大小写敏感)。 |
| | | * |
| | | * <pre> |
| | | * equals(null, null) = true |
| | | * equals(null, "abc") = false |
| | | * equals("abc", null) = false |
| | | * equals("abc", "abc") = true |
| | | * equals("abc", "ABC") = false |
| | | * </pre> |
| | | * |
| | | * @param str1 要比较的字符串1 |
| | | * @param str2 要比较的字符串2 |
| | | * @return 如果两个字符串相同,或者都是<code>null</code>,则返回<code>true</code> |
| | | */ |
| | | public static boolean equals(String str1, String str2) { |
| | | if (str1 == null) { |
| | | return str2 == null; |
| | | } |
| | | |
| | | return str1.equals(str2); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个字符串(大小写不敏感)。 |
| | | * |
| | | * <pre> |
| | | * equalsIgnoreCase(null, null) = true |
| | | * equalsIgnoreCase(null, "abc") = false |
| | | * equalsIgnoreCase("abc", null) = false |
| | | * equalsIgnoreCase("abc", "abc") = true |
| | | * equalsIgnoreCase("abc", "ABC") = true |
| | | * </pre> |
| | | * |
| | | * @param str1 要比较的字符串1 |
| | | * @param str2 要比较的字符串2 |
| | | * @return 如果两个字符串相同,或者都是<code>null</code>,则返回<code>true</code> |
| | | */ |
| | | public static boolean equalsIgnoreCase(String str1, String str2) { |
| | | if (str1 == null) { |
| | | return str2 == null; |
| | | } |
| | | |
| | | return str1.equalsIgnoreCase(str2); |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本, {} 表示占位符<br> |
| | | * 例如:format("aaa {} ccc", "bbb") ----> aaa bbb ccc |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {} 表示 |
| | | * @param values 参数值 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Object... values) { |
| | | if (CollectionKit.isEmpty(values) || isBlank(template)) { |
| | | return template; |
| | | } |
| | | |
| | | final StringBuilder sb = new StringBuilder(); |
| | | final int length = template.length(); |
| | | |
| | | int valueIndex = 0; |
| | | char currentChar; |
| | | for (int i = 0; i < length; i++) { |
| | | if (valueIndex >= values.length) { |
| | | sb.append(sub(template, i, length)); |
| | | break; |
| | | } |
| | | |
| | | currentChar = template.charAt(i); |
| | | if (currentChar == '{') { |
| | | final char nextChar = template.charAt(++i); |
| | | if (nextChar == '}') { |
| | | sb.append(values[valueIndex++]); |
| | | } else { |
| | | sb.append('{').append(nextChar); |
| | | } |
| | | } else { |
| | | sb.append(currentChar); |
| | | } |
| | | |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本,使用 {varName} 占位<br> |
| | | * map = {a: "aValue", b: "bValue"} |
| | | * format("{a} and {b}", map) ----> aValue and bValue |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {key} 表示 |
| | | * @param map 参数值对 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Map<?, ?> map) { |
| | | if (null == map || map.isEmpty()) { |
| | | return template; |
| | | } |
| | | |
| | | for (Entry<?, ?> entry : map.entrySet()) { |
| | | template = template.replace("{" + entry.getKey() + "}", entry.getValue().toString()); |
| | | } |
| | | return template; |
| | | } |
| | | |
| | | /** |
| | | * 编码字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 编码后的字节码 |
| | | */ |
| | | public static byte[] bytes(String str, String charset) { |
| | | return bytes(str, isBlank(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 编码字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 编码后的字节码 |
| | | */ |
| | | public static byte[] bytes(String str, Charset charset) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) { |
| | | return str.getBytes(); |
| | | } |
| | | return str.getBytes(charset); |
| | | } |
| | | |
| | | /** |
| | | * 将byte数组转为字符串 |
| | | * |
| | | * @param bytes byte数组 |
| | | * @param charset 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(byte[] bytes, String charset) { |
| | | return str(bytes, isBlank(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 解码字节码 |
| | | * |
| | | * @param data 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String str(byte[] data, Charset charset) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) { |
| | | return new String(data); |
| | | } |
| | | return new String(data, charset); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, String charset) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | |
| | | return str(data, Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, Charset charset) { |
| | | if (null == charset) { |
| | | charset = Charset.defaultCharset(); |
| | | } |
| | | return charset.decode(data).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转换为byteBuffer |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 编码 |
| | | * @return byteBuffer |
| | | */ |
| | | public static ByteBuffer byteBuffer(String str, String charset) { |
| | | return ByteBuffer.wrap(StrKit.bytes(str, charset)); |
| | | } |
| | | |
| | | /** |
| | | * 以 conjunction 为分隔符将多个对象转换为字符串 |
| | | * |
| | | * @param conjunction 分隔符 |
| | | * @param objs 数组 |
| | | * @return 连接后的字符串 |
| | | */ |
| | | public static String join(String conjunction, Object... objs) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | boolean isFirst = true; |
| | | for (Object item : objs) { |
| | | if (isFirst) { |
| | | isFirst = false; |
| | | } else { |
| | | sb.append(conjunction); |
| | | } |
| | | sb.append(item); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将驼峰式命名的字符串转换为下划线方式。如果转换前的驼峰式命名的字符串为空,则返回空字符串。</br> |
| | | * 例如:HelloWorld->hello_world |
| | | * |
| | | * @param camelCaseStr 转换前的驼峰式命名的字符串 |
| | | * @return 转换后下划线大写方式命名的字符串 |
| | | */ |
| | | public static String toUnderlineCase(String camelCaseStr) { |
| | | if (camelCaseStr == null) { |
| | | return null; |
| | | } |
| | | |
| | | final int length = camelCaseStr.length(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | char c; |
| | | boolean isPreUpperCase = false; |
| | | for (int i = 0; i < length; i++) { |
| | | c = camelCaseStr.charAt(i); |
| | | boolean isNextUpperCase = true; |
| | | if (i < (length - 1)) { |
| | | isNextUpperCase = Character.isUpperCase(camelCaseStr.charAt(i + 1)); |
| | | } |
| | | if (Character.isUpperCase(c)) { |
| | | if (!isPreUpperCase || !isNextUpperCase) { |
| | | if (i > 0) sb.append(UNDERLINE); |
| | | } |
| | | isPreUpperCase = true; |
| | | } else { |
| | | isPreUpperCase = false; |
| | | } |
| | | sb.append(Character.toLowerCase(c)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将下划线方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> |
| | | * 例如:hello_world->HelloWorld |
| | | * |
| | | * @param name 转换前的下划线大写方式命名的字符串 |
| | | * @return 转换后的驼峰式命名的字符串 |
| | | */ |
| | | public static String toCamelCase(String name) { |
| | | if (name == null) { |
| | | return null; |
| | | } |
| | | if (name.contains(UNDERLINE)) { |
| | | name = name.toLowerCase(); |
| | | |
| | | StringBuilder sb = new StringBuilder(name.length()); |
| | | boolean upperCase = false; |
| | | for (int i = 0; i < name.length(); i++) { |
| | | char c = name.charAt(i); |
| | | |
| | | if (c == '_') { |
| | | upperCase = true; |
| | | } else if (upperCase) { |
| | | sb.append(Character.toUpperCase(c)); |
| | | upperCase = false; |
| | | } else { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } else |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * 包装指定字符串 |
| | | * |
| | | * @param str 被包装的字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 包装后的字符串 |
| | | */ |
| | | public static String wrap(String str, String prefix, String suffix) { |
| | | return format("{}{}{}", prefix, str, suffix); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被包装 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefix 前缀 |
| | | * @param suffix 后缀 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, String prefix, String suffix) { |
| | | return str.startsWith(prefix) && str.endsWith(suffix); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被同一字符包装(前后都有这些字符串) |
| | | * |
| | | * @param str 字符串 |
| | | * @param wrapper 包装字符串 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, String wrapper) { |
| | | return isWrap(str, wrapper, wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被同一字符包装(前后都有这些字符串) |
| | | * |
| | | * @param str 字符串 |
| | | * @param wrapper 包装字符 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, char wrapper) { |
| | | return isWrap(str, wrapper, wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 指定字符串是否被包装 |
| | | * |
| | | * @param str 字符串 |
| | | * @param prefixChar 前缀 |
| | | * @param suffixChar 后缀 |
| | | * @return 是否被包装 |
| | | */ |
| | | public static boolean isWrap(String str, char prefixChar, char suffixChar) { |
| | | return str.charAt(0) == prefixChar && str.charAt(str.length() - 1) == suffixChar; |
| | | } |
| | | |
| | | /** |
| | | * 补充字符串以满足最小长度 StrUtil.padPre("1", 3, '0');//"001" |
| | | * |
| | | * @param str 字符串 |
| | | * @param minLength 最小长度 |
| | | * @param padChar 补充的字符 |
| | | * @return 补充后的字符串 |
| | | */ |
| | | public static String padPre(String str, int minLength, char padChar) { |
| | | if (str.length() >= minLength) { |
| | | return str; |
| | | } |
| | | StringBuilder sb = new StringBuilder(minLength); |
| | | for (int i = str.length(); i < minLength; i++) { |
| | | sb.append(padChar); |
| | | } |
| | | sb.append(str); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 补充字符串以满足最小长度 StrUtil.padEnd("1", 3, '0');//"100" |
| | | * |
| | | * @param str 字符串 |
| | | * @param minLength 最小长度 |
| | | * @param padChar 补充的字符 |
| | | * @return 补充后的字符串 |
| | | */ |
| | | public static String padEnd(String str, int minLength, char padChar) { |
| | | if (str.length() >= minLength) { |
| | | return str; |
| | | } |
| | | StringBuilder sb = new StringBuilder(minLength); |
| | | sb.append(str); |
| | | for (int i = str.length(); i < minLength; i++) { |
| | | sb.append(padChar); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder() { |
| | | return new StringBuilder(); |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(int capacity) { |
| | | return new StringBuilder(capacity); |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(String... strs) { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | return sb; |
| | | } |
| | | |
| | | /** |
| | | * 获得StringReader |
| | | * |
| | | * @param str 字符串 |
| | | * @return StringReader |
| | | */ |
| | | public static StringReader getReader(String str) { |
| | | return new StringReader(str); |
| | | } |
| | | |
| | | /** |
| | | * 获得StringWriter |
| | | * |
| | | * @return StringWriter |
| | | */ |
| | | public static StringWriter getWriter() { |
| | | return new StringWriter(); |
| | | } |
| | | |
| | | /** |
| | | * 编码字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 编码后的字节码 |
| | | */ |
| | | public static byte[] encode(String str, String charset) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (isBlank(charset)) { |
| | | return str.getBytes(); |
| | | } |
| | | try { |
| | | return str.getBytes(charset); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(format("Charset [{}] unsupported!", charset)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解码字节码 |
| | | * |
| | | * @param data 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String decode(byte[] data, String charset) { |
| | | if (data == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (isBlank(charset)) { |
| | | return new String(data); |
| | | } |
| | | try { |
| | | return new String(data, charset); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(format("Charset [{}] unsupported!", charset)); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2011-2014, hubin (jobob@qq.com). |
| | | * <p> |
| | | * Licensed 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 |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * 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. |
| | | */ |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * Web防火墙工具类 |
| | | * <p> |
| | | * @author hubin |
| | | * @Date 2014-5-8 |
| | | */ |
| | | public class WafKit { |
| | | |
| | | /** |
| | | * @Description 过滤XSS脚本内容 |
| | | * @param value |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | public static String stripXSS(String value) { |
| | | String rlt = null; |
| | | |
| | | if (null != value) { |
| | | // NOTE: It's highly recommended to use the ESAPI library and uncomment the following line to |
| | | // avoid encoded attacks. |
| | | // value = ESAPI.encoder().canonicalize(value); |
| | | |
| | | // Avoid null characters |
| | | rlt = value.replaceAll("", ""); |
| | | |
| | | // Avoid anything between script tags |
| | | Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid anything in a src='...' type of expression |
| | | /*scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll("");*/ |
| | | |
| | | // Remove any lonesome </script> tag |
| | | scriptPattern = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Remove any lonesome <script ...> tag |
| | | scriptPattern = Pattern.compile("<script(.*?)>", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid eval(...) expressions |
| | | scriptPattern = Pattern.compile("eval\\((.*?)\\)", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid expression(...) expressions |
| | | scriptPattern = Pattern.compile("expression\\((.*?)\\)", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid javascript:... expressions |
| | | scriptPattern = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid vbscript:... expressions |
| | | scriptPattern = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | |
| | | // Avoid onload= expressions |
| | | scriptPattern = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE |
| | | | Pattern.MULTILINE | Pattern.DOTALL); |
| | | rlt = scriptPattern.matcher(rlt).replaceAll(""); |
| | | } |
| | | |
| | | return rlt; |
| | | } |
| | | |
| | | /** |
| | | * @Description 过滤SQL注入内容 |
| | | * @param value |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | public static String stripSqlInjection(String value) { |
| | | return (null == value) ? null : value.replaceAll("('.+--)|(--)|(%7C)", ""); //value.replaceAll("('.+--)|(--)|(\\|)|(%7C)", ""); |
| | | } |
| | | |
| | | /** |
| | | * @Description 过滤SQL/XSS注入内容 |
| | | * @param value |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | public static String stripSqlXSS(String value) { |
| | | return stripXSS(stripSqlInjection(value)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2011-2014, hubin (jobob@qq.com). |
| | | * <p> |
| | | * Licensed 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 |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * 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. |
| | | */ |
| | | package com.ruoyi.order.util.support; |
| | | |
| | | import javax.servlet.http.Cookie; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Request请求过滤包装 |
| | | * <p> |
| | | * @author hubin |
| | | * @Date 2014-5-8 |
| | | */ |
| | | public class WafRequestWrapper extends HttpServletRequestWrapper { |
| | | |
| | | private boolean filterXSS = true; |
| | | |
| | | private boolean filterSQL = true; |
| | | |
| | | |
| | | public WafRequestWrapper(HttpServletRequest request, boolean filterXSS, boolean filterSQL) { |
| | | super(request); |
| | | this.filterXSS = filterXSS; |
| | | this.filterSQL = filterSQL; |
| | | } |
| | | |
| | | |
| | | public WafRequestWrapper(HttpServletRequest request) { |
| | | this(request, true, true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 数组参数过滤 |
| | | * @param parameter |
| | | * 过滤参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String[] getParameterValues(String parameter) { |
| | | String[] values = super.getParameterValues(parameter); |
| | | if (values == null) { |
| | | return null; |
| | | } |
| | | |
| | | int count = values.length; |
| | | String[] encodedValues = new String[count]; |
| | | for (int i = 0; i < count; i++) { |
| | | encodedValues[i] = filterParamString(values[i]); |
| | | } |
| | | |
| | | return encodedValues; |
| | | } |
| | | |
| | | @Override |
| | | @SuppressWarnings({"rawtypes", "unchecked"}) |
| | | public Map getParameterMap() { |
| | | Map<String, String[]> primary = super.getParameterMap(); |
| | | Map<String, String[]> result = new HashMap<String, String[]>(primary.size()); |
| | | for (Map.Entry<String, String[]> entry : primary.entrySet()) { |
| | | result.put(entry.getKey(), filterEntryString(entry.getValue())); |
| | | } |
| | | return result; |
| | | |
| | | } |
| | | |
| | | protected String[] filterEntryString(String[] rawValue) { |
| | | for (int i = 0; i < rawValue.length; i++) { |
| | | rawValue[i] = filterParamString(rawValue[i]); |
| | | } |
| | | return rawValue; |
| | | } |
| | | |
| | | /** |
| | | * @Description 参数过滤 |
| | | * @param parameter |
| | | * 过滤参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getParameter(String parameter) { |
| | | return filterParamString(super.getParameter(parameter)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 请求头过滤 |
| | | * @param name |
| | | * 过滤内容 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getHeader(String name) { |
| | | return filterParamString(super.getHeader(name)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description Cookie内容过滤 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Cookie[] getCookies() { |
| | | Cookie[] existingCookies = super.getCookies(); |
| | | if (existingCookies != null) { |
| | | for (int i = 0; i < existingCookies.length; ++i) { |
| | | Cookie cookie = existingCookies[i]; |
| | | cookie.setValue(filterParamString(cookie.getValue())); |
| | | } |
| | | } |
| | | return existingCookies; |
| | | } |
| | | |
| | | /** |
| | | * @Description 过滤字符串内容 |
| | | * @param rawValue |
| | | * 待处理内容 |
| | | * @return |
| | | */ |
| | | protected String filterParamString(String rawValue) { |
| | | if (null == rawValue) { |
| | | return null; |
| | | } |
| | | String tmpStr = rawValue; |
| | | if (this.filterXSS) { |
| | | tmpStr = WafKit.stripXSS(rawValue); |
| | | } |
| | | if (this.filterSQL) { |
| | | tmpStr = WafKit.stripSqlInjection(tmpStr); |
| | | } |
| | | return tmpStr; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //HTTPS证书密码,默认密码等于商户号MCHID |
| | | private static String certPassword_2 = GmchID; |
| | | private static String certPassword_2 = mchID; |
| | | |
| | | //是否使用异步线程的方式来上报API测速,默认为异步模式 |
| | | private static boolean useThreadToDoReport = true; |
| | |
| | | Configure.useThreadToDoReport = useThreadToDoReport; |
| | | } |
| | | |
| | | public static String HttpsRequestClassName = "com.tencent.common.HttpsRequest"; |
| | | public static String HttpsRequestClassName = "com.ruoyi.order.util.tencent.common.HttpsRequest"; |
| | | |
| | | public static String HttpsRequestClassName_2 = "com.tencent.common.HttpsRequest_2"; |
| | | public static String HttpsRequestClassName_2 = "com.ruoyi.order.util.tencent.common.HttpsRequest_2"; |
| | | |
| | | public static void setKey(String key) { |
| | | Configure.key = key; |
| | |
| | | -----BEGIN CERTIFICATE----- |
| | | MIIEbzCCA9igAwIBAgIEAapJajANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC |
| | | Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV |
| | | BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf |
| | | MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xODAyMDIxMTA3NDRa |
| | | Fw0yODAxMzExMTA3NDRaMIGeMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk |
| | | b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE |
| | | CxMFTU1QYXkxMzAxBgNVBAMUKuaIkOmDvemprOWPr+aXtuWwmue9kee7nOenkeaK |
| | | gOaciemZkOWFrOWPuDERMA8GA1UEBBMIOTM1NTUzMzUwggEiMA0GCSqGSIb3DQEB |
| | | AQUAA4IBDwAwggEKAoIBAQDF+apUVzPxdAF2FA8r2kg6aPeLynMRsUE17eW+wPZS |
| | | q8mVMrwACzYePbL5003/snEsEU936qnEiu8t5J6w+74dc3mQMr88FW29jD9MQOYR |
| | | yOeWz+LVKFXqA7sm9Aj+7hFrcjxdjl2FvKoITTSXNbtM71FrhsGXsnW/1Zjl3sSy |
| | | cu2qBq40QNqpefzz2gJ+vbtROy+ZynK7QaSwOtiFZuIbPgYv6W18wmigss6JuVkM |
| | | MZUquK4yDIPhwJ4Dk4lLXak1qqNfplfVKQtOo+MHdfIHnG9Z9q+R4iEvAGF4oxaR |
| | | zeKFk+zir8E8xEngmnH0ESue7fn9qh6q0mO7xTaYaG0HAgMBAAGjggFGMIIBQjAJ |
| | | BgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh0iQ0VTLUNBIEdlbmVyYXRlIENlcnRp |
| | | ZmljYXRlIjAdBgNVHQ4EFgQUYkOGN8XaKFwFtBCoEBKwGCnBbtYwgb8GA1UdIwSB |
| | | tzCBtIAUPgUm9iJitBVbiM1kfrDUYqflhnShgZCkgY0wgYoxCzAJBgNVBAYTAkNO |
| | | MRIwEAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQK |
| | | EwdUZW5jZW50MQwwCgYDVQQLEwNXWEcxEzARBgNVBAMTCk1tcGF5bWNoQ0ExHzAd |
| | | BgkqhkiG9w0BCQEWEG1tcGF5bWNoQHRlbmNlbnSCCQC7VJcrvADoVzAOBgNVHQ8B |
| | | Af8EBAMCBsAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQAD |
| | | gYEARXIWwdW50A3JM8BIC94argtpvZXqTj5hWeheeJSDBxNVFv/WzdahqZx7Yokn |
| | | DP/Ac6dekFfvvXR6ujwevEUTFbpSac1h7k7u/URmwH/R2URTevPTrMeg5D+gLeYP |
| | | nEJ+GhyRRAFOoGbN1SoK4f1j6pExpl2GaQ0PVNv7NRVW1tI= |
| | | MIIENDCCAxygAwIBAgIUGVH+OUAuVOxChlw+8HWJAdKov00wDQYJKoZIhvcNAQEL |
| | | BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT |
| | | FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg |
| | | Q0EwHhcNMjQwNjIwMDIxODAwWhcNMjkwNjE5MDIxODAwWjCBjTETMBEGA1UEAwwK |
| | | MTIyMDU0MDAwMTEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTkwNwYDVQQL |
| | | DDDlm5vlt53kuK3lm73nmb3phZLkuqflk4HkuqTmmJPkuK3lv4PmnInpmZDlhazl |
| | | j7gxCzAJBgNVBAYTAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcN |
| | | AQEBBQADggEPADCCAQoCggEBALTOOuM7h0rT5KwRRWc2nerxGCWZNz3UT7gRZEW/ |
| | | IHCVULYU1MtqRSvrVen0PVhDT8Bkt5tQdrv7RLRm2w8mhM/DIPi+EaTaGQmt911G |
| | | Va02fcRRHUWT4skNN1NiNIZIz3XGTCSGIFrYREAZ0PLewE7dwmfsPC64wXRWRnv0 |
| | | G+1bdRNYeI5n4BdVbCaDWCJ8YiYNR8rusa1CazFGwp1y5XEBidsO+C0QvsNqv0RS |
| | | OgnO/izbqubnqyaTdsYT5o+W8cePD14Vml8nLJvPruoV8Mw3MJei+Xj5L4Qm3mNU |
| | | tqORU7Ghk7l0nrGhgH+xxqeZuQ3rmi+1DYW5rWeCmBvL+b8CAwEAAaOBuTCBtjAJ |
| | | BgNVHRMEAjAAMAsGA1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGE |
| | | aHR0cDovL2V2Y2EuaXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0 |
| | | MjIwRTUwREJDMDRCMDZBRDM5NzU0OTg0NkMwMUMzRThFQkQyJnNnPUhBQ0M0NzFC |
| | | NjU0MjJFMTJCMjdBOUQzM0E4N0FEMUNERjU5MjZFMTQwMzcxMA0GCSqGSIb3DQEB |
| | | CwUAA4IBAQCcL4hdeAsHMbE5A9AXgNL+LjFJwtCUEdR/fnalqOh8TtHkySfrntTs |
| | | SvSka+OBWlaSe/6TOBUJy4gY1V2ESHb0JMhbFim5OXPBqXUDshJwDFF3hlpCLrmQ |
| | | Y8ABrEik3nmx+y4DPmDj+38FTHJUIzzlChR5QWKilBgU2yqJBYrwK8pwoELUMiAv |
| | | 58pUIBxpiaFqW146vKUDhV+xKI0mHMeGlA5UNkCG/JQLHAdrUXyi8RT3Yl/kvHqW |
| | | EK/pUiThB/WFCLMGKvF4ahoHZFWuCm/BhCHDpdSh661Ivf9RqsvnPffBUjJ+ZIIk |
| | | metUnaCMi8qNzcV7ohlfeXfjikzEVf+O |
| | | -----END CERTIFICATE----- |
| | |
| | | -----BEGIN PRIVATE KEY----- |
| | | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDF+apUVzPxdAF2 |
| | | FA8r2kg6aPeLynMRsUE17eW+wPZSq8mVMrwACzYePbL5003/snEsEU936qnEiu8t |
| | | 5J6w+74dc3mQMr88FW29jD9MQOYRyOeWz+LVKFXqA7sm9Aj+7hFrcjxdjl2FvKoI |
| | | TTSXNbtM71FrhsGXsnW/1Zjl3sSycu2qBq40QNqpefzz2gJ+vbtROy+ZynK7QaSw |
| | | OtiFZuIbPgYv6W18wmigss6JuVkMMZUquK4yDIPhwJ4Dk4lLXak1qqNfplfVKQtO |
| | | o+MHdfIHnG9Z9q+R4iEvAGF4oxaRzeKFk+zir8E8xEngmnH0ESue7fn9qh6q0mO7 |
| | | xTaYaG0HAgMBAAECggEBAL1yjrYqxIAX3JYb1/DE7z1F2S0iTD7v+lEbGDEUAiNW |
| | | VI67gAAiumTx8eTzeb5oCbh70CoWmuKDeSHXlqwSGvmf2QJOLYXXk65BGQllSURX |
| | | lpZQ1OXZtW08qMk72afqNS02oeF9LK2fvq43A053koaqtKVKzNLXaaprQecm599C |
| | | P+BdahdKk6SE39cOB9fMfX1s5BZRJUhIKNBmcEBsgo9xtKTvgvbgBkSvFBd2ycMo |
| | | 5KRUbquytqIfwDJTETn7FZqh86+BgLOsWEQZ+1ByEJkFNdOGfjz0HVxNMY60j42D |
| | | u9fsIMFup+a/oP190atMSt+GE6ZjgQit/LsF7BrPaiECgYEA7uUDZIpQ1j07MZP+ |
| | | CFMGIE8aTlhvbWho67HCCLDAAv2ZdOSusV66iMzEfDkfOcj9fp8OlfbK2ocUCkS5 |
| | | 5hQAuAk4O8KTmbGgf71gyFZzddZkilc1UAgHVMj9wVp2PfLmpb6iFhazd4enwTPs |
| | | TKxogxfXWRQKQqkCnunOSS7m7V8CgYEA1CaXqMWm2v52FHN8dl8AnH6YjwOQpNXI |
| | | qNOyA8Af03dEQ5w/sNlusiF73/FIgErb0be4rgIvJOW0ziBU9RKn/vB5wl4IpJjM |
| | | JuL3hh7RlAbfSWaqaKCZKIDolS2vtvwKp9mZgmxWgvKx3Q/L8I1MXPIZTTRpGwIe |
| | | HyBxYBTSeVkCgYEAuRHbzgDFXSN0fxUKYMKI5XDCjV0/fX+8gJNmITtklSyHvKII |
| | | n8omMiKIOUA7a5XEpFpuf0kAn8izgrz5Uz+9ytUBpnI3zIJqN2ur1af7rJdZrj6f |
| | | Q4/ktg87XpZJMfbCLjb/9KLDh98k26zw6/lIwf4vS4gV5sxuBlRVBib6qXsCgYA9 |
| | | 2f6PWwi5gkSk08KutCX2ekY6M9zg4d89sXKN+16MBZKmb5B2G/5U+sQl1y+/D5Ql |
| | | AX5bZRGfnUTob661QLov7qZhD49PhajHkZZ+yM9ra9F/keoO1PuyPlsQ2yAGplbo |
| | | 9tz1lGZoiR9oBun7eQaRdpf/1U7ra+OiSZAkZg2zCQKBgQCl+bszQ202CkLchQ1R |
| | | Mu2svFFi+BeVvtA8yp4Il3bznxkgBZJ1/4gB+u84f9ybfpKHok7+f+iHVGJSNiay |
| | | Uw5ouE6oNEJODsvWDDliCjrckGUBDmJ8XOHEkm3MPOmEov8UJ6twev/QWhEfEUZk |
| | | fclCYjgt3YJ3XW9hXgORWhJj9g== |
| | | MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC0zjrjO4dK0+Ss |
| | | EUVnNp3q8RglmTc91E+4EWRFvyBwlVC2FNTLakUr61Xp9D1YQ0/AZLebUHa7+0S0 |
| | | ZtsPJoTPwyD4vhGk2hkJrfddRlWtNn3EUR1Fk+LJDTdTYjSGSM91xkwkhiBa2ERA |
| | | GdDy3sBO3cJn7DwuuMF0VkZ79BvtW3UTWHiOZ+AXVWwmg1gifGImDUfK7rGtQmsx |
| | | RsKdcuVxAYnbDvgtEL7Dar9EUjoJzv4s26rm56smk3bGE+aPlvHHjw9eFZpfJyyb |
| | | z67qFfDMNzCXovl4+S+EJt5jVLajkVOxoZO5dJ6xoYB/scanmbkN65ovtQ2Fua1n |
| | | gpgby/m/AgMBAAECggEAL3RlblikdNZSkXri/WkPX6exz8R8BEViOwyNheTZLdNy |
| | | 4KdtBoq45wMYhJQvOahJGVUV/7TJxSL48GSCoGJav3EWiVLRrLP1mF3Jq/iW6iSA |
| | | M/OaPDXJcz19xOvkn04i7WWDfJ6bhVx35V8hQW2HieuYZ9BQJ28kj1VJoKT8Y3qJ |
| | | N93e2q+fcAnB8tqkgcHlaeEItoUwS3QEhLng1EOyE2s/XBVKM+AV7XSJhbDSJ9s3 |
| | | trUghmRSjJ/GhvQEOjq8LOHeDR0azOqgmIkg7viKUyTl7lBuIN9ZPgSGQbv4XNcP |
| | | oGbF3dokrjPBsQar5+O9QDvGk3pJXo6PIXRVIq7BsQKBgQDsrOl2Snnt5FtTfNNd |
| | | n+ajsV8+S0HoimV7g05gxGvSc6po3vuBPZKWRsjtXNaSRKdXFvF1v8uAnNlQk0b+ |
| | | wjyUn0r9x6KF8tj+s4qjyzwkg0Vy1A9/goDKD93HG1C9aieulrBepEmzkfiiD5W2 |
| | | hJzphvBf+lTUNcJXOllxiDQzyQKBgQDDkYDXuMwlMV3fBv5+wNGsuADSVal/1Bz6 |
| | | Q91NUnqTMFbOAgEvJy4e/5gle6MCBkqmD08rYcQAQbB1Tgr23CWoXbWn2GSlChoY |
| | | ugDEz/q+heLjFkZU/T/xpTGtFpnfSUlP+7oXlyeEaXUMYnEW/UPI70AQPC3sDsuS |
| | | H9VtBFE1RwKBgQCjsqEzqSWWbhjgsPi8zAlJdTgsLP9kKL0yZcqDUbhF8qyOJpSM |
| | | epr2B/WXf1wGBSg9K2hNCiBmT5ZbjdJQCOa/4UGMMFVwEl0WJfahfcOWeZlCZ/xk |
| | | NE6B8+Fwgqsgp9jUf/NzMmyroC35YZAqkqS5PRTrPYkI0jod/QS6avu4SQKBgGpe |
| | | 89NhwjfgmAw8w6OxwNnO4zOEQEM03eYJj48E84KnYi9+y6IYD2/w2ZJZoxnwzh1w |
| | | akFQVclF8XJ8Vl5a82iWP73hZyyVSAh28wAZl2qVbAjUDsEfVe5bSZ+5kUvvkp6c |
| | | bmVyY54TtgRcbuJwMrRR3Wh3MwsYKQV7pxw6ouj1AoGANuZe1rxkCGZbUTrhtuma |
| | | ZxI0NTZjEBVL69m9nlGggEq8tn2j18gaXWq0aEkqIo4/AEHWDyageBAFixTfq+qe |
| | | vDHlzeSaTD3I2NCNk0+W6QWU8duel6byeoLyb5fhVeRxddg6ZuzjC5pSC9XVIxDR |
| | | wwFKsfxWpJ2tHMOiif2plww= |
| | | -----END PRIVATE KEY----- |
| | |
| | | -----BEGIN CERTIFICATE----- |
| | | MIIEbDCCA9WgAwIBAgIEAV66BDANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC |
| | | Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV |
| | | BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf |
| | | MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xNzA2MjkwNjQwMzha |
| | | Fw0yNzA2MjcwNjQwMzhaMIGbMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk |
| | | b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE |
| | | CxMFTU1QYXkxMDAuBgNVBAMUJ+WTiOWwlOa7qOWQjeeahOe9kee7nOenkeaKgOac |
| | | iemZkOWFrOWPuDERMA8GA1UEBBMIMzE4OTQ3MDYwggEiMA0GCSqGSIb3DQEBAQUA |
| | | A4IBDwAwggEKAoIBAQDJS/abCCpwvnppCU0TxW84PF2cqpUF3Ip9KmQytNCPRZPK |
| | | q299efclcWOYozB7zSY4OsZ9UyAod1+HsFEjyJBTWyJfakNewiF6AIsydZtFZ65t |
| | | 8ReQ66VTebB1imEq/OrQMXphBwJ1TSH5Jk2pW7JA9U5LqZ3apgDa9PrFHY4dhnkf |
| | | IxQI6Xn0Y7fUJsGszP+5ETbtlLW5PZQiE2H8T3xCwH3mnmg/rppTZaBVIE/7SskW |
| | | iEVPd8g/fec8xDAoAulv1FsBdrPGXyWiFkpcTdrQKHaMa0J7AtMfSnMb1Z/pAIQp |
| | | DxCjCJRM0gfvZNOj2nyqbZD3JJAP8LFnTrasdb/NAgMBAAGjggFGMIIBQjAJBgNV |
| | | HRMEAjAAMCwGCWCGSAGG+EIBDQQfFh0iQ0VTLUNBIEdlbmVyYXRlIENlcnRpZmlj |
| | | YXRlIjAdBgNVHQ4EFgQUBMf3KHk8wfRKtAdcnz+VCFwDdeYwgb8GA1UdIwSBtzCB |
| | | tIAUPgUm9iJitBVbiM1kfrDUYqflhnShgZCkgY0wgYoxCzAJBgNVBAYTAkNOMRIw |
| | | EAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdU |
| | | ZW5jZW50MQwwCgYDVQQLEwNXWEcxEzARBgNVBAMTCk1tcGF5bWNoQ0ExHzAdBgkq |
| | | hkiG9w0BCQEWEG1tcGF5bWNoQHRlbmNlbnSCCQC7VJcrvADoVzAOBgNVHQ8BAf8E |
| | | BAMCBsAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEA |
| | | EFcsWO+7E4v7NNdprZYbYASr4e4Uw+EO+RLbkuFUQhHTGMW/biFlYounarNncTFs |
| | | SylXIkCylTRxSZmLNhr8D9/TJ1c9Vrbp8SqlgS5DlhLU3PGjmY7Yl+Zth06v6kv+ |
| | | 0GqwKCljlN+DQNq2wxL7z3S/XDZGTb8tAhLtOKyPkpg= |
| | | MIIENDCCAxygAwIBAgIUGVH+OUAuVOxChlw+8HWJAdKov00wDQYJKoZIhvcNAQEL |
| | | BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT |
| | | FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg |
| | | Q0EwHhcNMjQwNjIwMDIxODAwWhcNMjkwNjE5MDIxODAwWjCBjTETMBEGA1UEAwwK |
| | | MTIyMDU0MDAwMTEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTkwNwYDVQQL |
| | | DDDlm5vlt53kuK3lm73nmb3phZLkuqflk4HkuqTmmJPkuK3lv4PmnInpmZDlhazl |
| | | j7gxCzAJBgNVBAYTAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcN |
| | | AQEBBQADggEPADCCAQoCggEBALTOOuM7h0rT5KwRRWc2nerxGCWZNz3UT7gRZEW/ |
| | | IHCVULYU1MtqRSvrVen0PVhDT8Bkt5tQdrv7RLRm2w8mhM/DIPi+EaTaGQmt911G |
| | | Va02fcRRHUWT4skNN1NiNIZIz3XGTCSGIFrYREAZ0PLewE7dwmfsPC64wXRWRnv0 |
| | | G+1bdRNYeI5n4BdVbCaDWCJ8YiYNR8rusa1CazFGwp1y5XEBidsO+C0QvsNqv0RS |
| | | OgnO/izbqubnqyaTdsYT5o+W8cePD14Vml8nLJvPruoV8Mw3MJei+Xj5L4Qm3mNU |
| | | tqORU7Ghk7l0nrGhgH+xxqeZuQ3rmi+1DYW5rWeCmBvL+b8CAwEAAaOBuTCBtjAJ |
| | | BgNVHRMEAjAAMAsGA1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGE |
| | | aHR0cDovL2V2Y2EuaXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0 |
| | | MjIwRTUwREJDMDRCMDZBRDM5NzU0OTg0NkMwMUMzRThFQkQyJnNnPUhBQ0M0NzFC |
| | | NjU0MjJFMTJCMjdBOUQzM0E4N0FEMUNERjU5MjZFMTQwMzcxMA0GCSqGSIb3DQEB |
| | | CwUAA4IBAQCcL4hdeAsHMbE5A9AXgNL+LjFJwtCUEdR/fnalqOh8TtHkySfrntTs |
| | | SvSka+OBWlaSe/6TOBUJy4gY1V2ESHb0JMhbFim5OXPBqXUDshJwDFF3hlpCLrmQ |
| | | Y8ABrEik3nmx+y4DPmDj+38FTHJUIzzlChR5QWKilBgU2yqJBYrwK8pwoELUMiAv |
| | | 58pUIBxpiaFqW146vKUDhV+xKI0mHMeGlA5UNkCG/JQLHAdrUXyi8RT3Yl/kvHqW |
| | | EK/pUiThB/WFCLMGKvF4ahoHZFWuCm/BhCHDpdSh661Ivf9RqsvnPffBUjJ+ZIIk |
| | | metUnaCMi8qNzcV7ohlfeXfjikzEVf+O |
| | | -----END CERTIFICATE----- |
| | |
| | | -----BEGIN PRIVATE KEY----- |
| | | MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQDJS/abCCpwvnpp |
| | | CU0TxW84PF2cqpUF3Ip9KmQytNCPRZPKq299efclcWOYozB7zSY4OsZ9UyAod1+H |
| | | sFEjyJBTWyJfakNewiF6AIsydZtFZ65t8ReQ66VTebB1imEq/OrQMXphBwJ1TSH5 |
| | | Jk2pW7JA9U5LqZ3apgDa9PrFHY4dhnkfIxQI6Xn0Y7fUJsGszP+5ETbtlLW5PZQi |
| | | E2H8T3xCwH3mnmg/rppTZaBVIE/7SskWiEVPd8g/fec8xDAoAulv1FsBdrPGXyWi |
| | | FkpcTdrQKHaMa0J7AtMfSnMb1Z/pAIQpDxCjCJRM0gfvZNOj2nyqbZD3JJAP8LFn |
| | | Trasdb/NAgMBAAECggEAPP5pgNxej78HtF//HOiMJMwVyWzeruH+jKKVrc+gCmmY |
| | | uKZtp+WW/592AEAiZsDovc0Ba+QOMHTLW4APdfpF0RwiNCsssr+8CQ21H9sG62bZ |
| | | MbMF4wGkHMEYuOTvQGlWdTMo09Gd6xEuJCJ5EcIZJxmtWbvRevkl9TKZ8bRc5ZDZ |
| | | 2s/8cgzps9lbnkbTZ9TAF7n7XOlPy4YqIBKW33RCHUtQCfCDERLaBRAG6SbNUsBQ |
| | | SUYq6PsroFtqgwXxbygVsXfNBBfXZ8nfyqupvkOto+2NJjDr6cm5cT+bMyStcNdN |
| | | UAssNUbw7DjcQ+0esS0Z9K7Tah5kmLzzGcDnyNoLgQKBgQDtLeEzRWU9QIksvzUb |
| | | tIAwz/yLTVAQ74/ke6VP4pAWkLdgcVWxY+HOfXyNTWC3MZ2BSyj3oTaahgCQAVb3 |
| | | dXmRDWjRWggUcTLNWgZCcjPw4oshdzVPz1t5WR9/9c+UDqSFSrBGVJ5cVLNpDxSk |
| | | 1KYX7gNdu+h8RTKpKxyOleJaEQKBgQDZRShPjZYvcLNv79y3cT8RHX8qi2akd7by |
| | | X6VwxoFeZ5TeK51fdZjUSyU5/8Jmq9m+K3W7edYrzAOiLYYSCNAVQEoxqGacPla2 |
| | | OlpiSPbtafoIy0ovsJvV6DAZwwtF0cowvdNnXvPsYlKlAKCXnRxf+Ap9/XYArBD6 |
| | | dTpcj1Ht/QKBgQDHhCK/GI9TeWhrZeVtCugTJ8MQA9doh72JvKGRk8sV0GMSFAS8 |
| | | FoOrSlBuJTtIn8oZK3qo5MqkLjlm6lmYDRBYfuk/wvatC5RqvmIpnxwmdMwJONh1 |
| | | 7L7MU7Z10/fsWmz3W57xatlUXkQWCoOZLPETjDr0rM+jSiqVuBhrsZYZoQKBgGN8 |
| | | mFW9Fm0IpRF3etCAyYkTwZwAkvJyYtIe28mFC83njjIhNIF2fpGPCy/AngqXXDAJ |
| | | BHLg+iG53FwRjleJs4ZXluGgI8Qdg2UT2TkyAed6ZGRMed7WdrT/Ca9yMSI6SuQA |
| | | t+GYiAbQitlFLUPfTBPhpyRDwBnUsD2PGjcx5SkdAn8KkFSMExG4y4eZD+UxLXsj |
| | | /QfQj0eUyzu5XyvPXLD9XV1YL3pX7+DxvU98ogFH4QBh2KtDbe2RldyiH8toSP0F |
| | | kXoj4/CtUp8EDBpeLgbdxCYvKW+Lz9oyPNouhkV7m0KRrHV/3CPOeHqkh0dNdW6f |
| | | RKW9WsNAtAS2ncev7Mjj |
| | | MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC0zjrjO4dK0+Ss |
| | | EUVnNp3q8RglmTc91E+4EWRFvyBwlVC2FNTLakUr61Xp9D1YQ0/AZLebUHa7+0S0 |
| | | ZtsPJoTPwyD4vhGk2hkJrfddRlWtNn3EUR1Fk+LJDTdTYjSGSM91xkwkhiBa2ERA |
| | | GdDy3sBO3cJn7DwuuMF0VkZ79BvtW3UTWHiOZ+AXVWwmg1gifGImDUfK7rGtQmsx |
| | | RsKdcuVxAYnbDvgtEL7Dar9EUjoJzv4s26rm56smk3bGE+aPlvHHjw9eFZpfJyyb |
| | | z67qFfDMNzCXovl4+S+EJt5jVLajkVOxoZO5dJ6xoYB/scanmbkN65ovtQ2Fua1n |
| | | gpgby/m/AgMBAAECggEAL3RlblikdNZSkXri/WkPX6exz8R8BEViOwyNheTZLdNy |
| | | 4KdtBoq45wMYhJQvOahJGVUV/7TJxSL48GSCoGJav3EWiVLRrLP1mF3Jq/iW6iSA |
| | | M/OaPDXJcz19xOvkn04i7WWDfJ6bhVx35V8hQW2HieuYZ9BQJ28kj1VJoKT8Y3qJ |
| | | N93e2q+fcAnB8tqkgcHlaeEItoUwS3QEhLng1EOyE2s/XBVKM+AV7XSJhbDSJ9s3 |
| | | trUghmRSjJ/GhvQEOjq8LOHeDR0azOqgmIkg7viKUyTl7lBuIN9ZPgSGQbv4XNcP |
| | | oGbF3dokrjPBsQar5+O9QDvGk3pJXo6PIXRVIq7BsQKBgQDsrOl2Snnt5FtTfNNd |
| | | n+ajsV8+S0HoimV7g05gxGvSc6po3vuBPZKWRsjtXNaSRKdXFvF1v8uAnNlQk0b+ |
| | | wjyUn0r9x6KF8tj+s4qjyzwkg0Vy1A9/goDKD93HG1C9aieulrBepEmzkfiiD5W2 |
| | | hJzphvBf+lTUNcJXOllxiDQzyQKBgQDDkYDXuMwlMV3fBv5+wNGsuADSVal/1Bz6 |
| | | Q91NUnqTMFbOAgEvJy4e/5gle6MCBkqmD08rYcQAQbB1Tgr23CWoXbWn2GSlChoY |
| | | ugDEz/q+heLjFkZU/T/xpTGtFpnfSUlP+7oXlyeEaXUMYnEW/UPI70AQPC3sDsuS |
| | | H9VtBFE1RwKBgQCjsqEzqSWWbhjgsPi8zAlJdTgsLP9kKL0yZcqDUbhF8qyOJpSM |
| | | epr2B/WXf1wGBSg9K2hNCiBmT5ZbjdJQCOa/4UGMMFVwEl0WJfahfcOWeZlCZ/xk |
| | | NE6B8+Fwgqsgp9jUf/NzMmyroC35YZAqkqS5PRTrPYkI0jod/QS6avu4SQKBgGpe |
| | | 89NhwjfgmAw8w6OxwNnO4zOEQEM03eYJj48E84KnYi9+y6IYD2/w2ZJZoxnwzh1w |
| | | akFQVclF8XJ8Vl5a82iWP73hZyyVSAh28wAZl2qVbAjUDsEfVe5bSZ+5kUvvkp6c |
| | | bmVyY54TtgRcbuJwMrRR3Wh3MwsYKQV7pxw6ouj1AoGANuZe1rxkCGZbUTrhtuma |
| | | ZxI0NTZjEBVL69m9nlGggEq8tn2j18gaXWq0aEkqIo4/AEHWDyageBAFixTfq+qe |
| | | vDHlzeSaTD3I2NCNk0+W6QWU8duel6byeoLyb5fhVeRxddg6ZuzjC5pSC9XVIxDR |
| | | wwFKsfxWpJ2tHMOiif2plww= |
| | | -----END PRIVATE KEY----- |
| | |
| | | private String re_user_name;// 收款用户姓名 可选 马花花 String 收款用户真实姓名。 如果check_name设置为FORCE_CHECK或OPTION_CHECK,则必填用户真实姓名 |
| | | private Integer amount;// 金额 是 10099 int 企业付款金额,单位为分 |
| | | private String desc;// 企业付款描述信息 是 理赔 String 企业付款操作说明信息。必填。 |
| | | private String spbill_create_ip = "127.0.0.1";// Ip地址 是 192.168.0.1 String(32) 调用接口的机器Ip地址 |
| | | private String spbill_create_ip = "192.168.110.188";// Ip地址 是 192.168.0.1 String(32) 调用接口的机器Ip地址 |
| | | |
| | | *//** |
| | | * 企业向用户付款 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public Map<String,Object> toMap(){ |
| | | Map<String,Object> map = new HashMap<String, Object>(); |
| | | Field[] fields = this.getClass().getDeclaredFields(); |
| | |
| | | } |
| | | |
| | | private static final String REPORT_URL = "http://report.mch.weixin.qq.com/wxpay/report/default"; |
| | | // private static final String REPORT_URL = "http://127.0.0.1:5000/test"; |
| | | // private static final String REPORT_URL = "http://192.168.110.188:5000/test"; |
| | | |
| | | |
| | | private static final int DEFAULT_CONNECT_TIMEOUT_MS = 6*1000; |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class KuaiDiCode { |
| | | private String comCode; |
| | | private String id; |
| | | private Integer noCount; |
| | | private String noPre; |
| | | private LocalDateTime startTime; |
| | | } |
| | |
| | | ali_public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlW2RMACojdqTa8H+j6411Lm5UipGXXbQiswq50rUflwjTj843zNVaVpk8uJmbdmtUBJlmblgBS/a31O4L4LrHB8WxJ+w0f9DBNTq9T6b80MiAVnU/3gXK365DmbzPWS5pR9wEgJVHnfOFUbsB5AVFHV0m9hUZcPv7xveuEp3BEoD5smaDJByR+KgFw0Q0JgINhhE6bsEa3UgJ198af269LtQ5HJl1TWLI8aeqW14HrxyADIt49NB9KZ8MOdKP+66HWcrXlipKFHtccy3dff72DqPmFdESoXfLXKZyhU5w9v4Q5F6UoAGTPwl9KQwikTobNeJ/7su7X3AB6+C14J4sQIDAQAB |
| | | |
| | | # 支付宝回调地址 |
| | | notify_url = http://116.63.172.131:8088/order/forepart/paylog/alipay/notify |
| | | notify_url = http://10.136.177.152:9000/order/forepart/paylog/alipay/notify |
| | | # 签约的appid |
| | | app_id = 2021004150664294 |
| | | |
| | |
| | | # 微信开发平台(应用APPID) |
| | | #以前的wx74f8aea529dc99d7 |
| | | |
| | | appID = wx24b9abadcc524e29 |
| | | appID = wx69e3ac6e13a889b7 |
| | | |
| | | # 微信支付分配的商户号ID(微信支付商户号) |
| | | mchID = 1600685974 |
| | | mchID = 1220540001 |
| | | |
| | | # 小程序的商户号 |
| | | XmchID = 1600685974 |
| | | XmchID = 1220540001 |
| | | |
| | | # 应用对应的密钥(商户平台开发设置) |
| | | key = E10ADC3949BA59ABBE56E057F20F883E |
| | | key = 1PJiendxfSBX9Wrx9mQzNeiXacYwWXFY |
| | | |
| | | # 微信回调地址 |
| | | wx_notify_url = http://116.63.172.131:8088/order/forepart/paylog/wxpay/notify |
| | | wx_notify_url = http://10.136.177.152:9000/order/forepart/paylog/wxpay/notify |
| | | |
| | | |
| | | # 小程序的APPID |
| | | XappID = wx742b6a65ca132418 |
| | | XappID =wx69e3ac6e13a889b7 |
| | | |
| | | |
| | |
| | | SELECT ifnull(count(1), 0) FROM t_order o |
| | | WHERE |
| | | o.goods_sku_id = #{id} |
| | | AND o.order_from=2 |
| | | AND o.del_flag=0 |
| | | AND o.order_status IN (2 |
| | | , 3 |
| | | , 4) |
| | |
| | | |
| | | |
| | | |
| | | <select id="getSeckillMembers1" resultType="com.ruoyi.system.api.domain.dto.MemberOrderDTO"> |
| | | SELECT ifnull(SUM(o.goods_quantity), 0) FROM t_order o LEFT |
| | | |
| | | <select id="getGoodsGroupPurchase" resultType="java.lang.Integer"> |
| | | SELECT ifnull(SUM(o.goods_quantity), 0) FROM t_order o |
| | | WHERE |
| | | o.goods_sku_id = #{goodsSkuId} |
| | | AND o.order_status IN (2 |
| | | , 3) |
| | | AND o.order_from=3 |
| | | AND o.del_flag=0 |
| | | AND o.order_status IN (2,3,4) |
| | | and o.member_id =#{memberId} |
| | | </select> |
| | | |
| | | |
| | | <select id="getOrderByGroupPurchaseId" resultType="com.ruoyi.system.api.domain.Order" |
| | | parameterType="java.lang.Long"> |
| | |
| | | t_order o |
| | | <where> |
| | | o.order_status = 2 |
| | | AND o.del_flag=0 |
| | | AND o.order_from = 3 |
| | | AND o.goods_sku_id = #{id} |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="getOrderByGroupPurchaseId" resultType="com.ruoyi.system.api.domain.Order"> |
| | | SELECT |
| | | o.* |
| | | FROM |
| | | t_order o |
| | | <where> |
| | | o.goods_sku_id = #{goodsSkuId} |
| | | AND o.order_status = 2 |
| | | AND o.order_from = 3 |
| | | AND o.member_id=#{memberId} |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | AND o.sku_name LIKE CONCAT('%',#{skuName},'%') |
| | | </if> |
| | | AND o.order_from = 3 |
| | | AND o.del_flag=0 |
| | | AND o.member_id=#{memberId} |
| | | </where> |
| | | </select> |
| | |
| | | AND o.sku_name LIKE CONCAT('%',#{skuName},'%') |
| | | </if> |
| | | AND o.order_from = 3 |
| | | AND o.del_flag=0 |
| | | AND o.member_id=#{memberId} |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="getOrderByGroupPurchaseMemberId" resultType="com.ruoyi.system.api.domain.vo.OrderVO"> |
| | | <select id="getOrderByGroupPurchaseMemberId" resultType="com.ruoyi.system.api.domain.Order"> |
| | | SELECT |
| | | o.* |
| | | FROM |
| | |
| | | o.goods_sku_id = #{goodsSkuId} |
| | | AND o.order_status = 2 or o.order_status =1 |
| | | AND o.order_from = 3 |
| | | AND o.del_flag=0 |
| | | AND o.member_id=#{memberId} |
| | | </where> |
| | | </select> |
| | |
| | | o.order_no, |
| | | o.member_id, |
| | | CASE |
| | | WHEN o.order_from = 4 THEN 2 -- 当order_from为拍卖订单时,orderType赋值为2 |
| | | ELSE 1 -- 其他情况下,orderType赋值为1 |
| | | WHEN o.order_from = 4 THEN 2 |
| | | ELSE 1 |
| | | END AS orderType, |
| | | o.order_from |
| | | FROM |
| | |
| | | <if test="query.status != null"> |
| | | AND torr.status = #{query.status} |
| | | </if> |
| | | <if test="query.orderType != null and query.orderType== 1"> |
| | | <if |
| | | test="query.orderType != null and @com.ruoyi.common.core.enums.OrderTypeEnum@isMallOrder(query.orderType)"> |
| | | AND o.order_from in (1,2,3) |
| | | </if> |
| | | <if test="query.orderType != null and query.orderType== 2"> |
| | | <if |
| | | test="query.orderType != null and @com.ruoyi.common.core.enums.OrderTypeEnum@isAuctionOrder(query.orderType)"> |
| | | AND o.order_from = 4 |
| | | </if> |
| | | </where> |
| | |
| | | o.member_id, |
| | | o.order_time, |
| | | o.pay_time, |
| | | o.paymemt_method, |
| | | o.payment_method, |
| | | o.price, |
| | | o.points, |
| | | o.total_amount, |
| | | o.discount_money, |
| | | CASE |
| | | WHEN o.order_from = 4 THEN 2 -- 当order_from为拍卖订单时,orderType赋值为2 |
| | | ELSE 1 -- 其他情况下,orderType赋值为1 |
| | | WHEN o.order_from = 4 THEN 2 |
| | | ELSE 1 |
| | | END AS orderType, |
| | | o.order_from |
| | | FROM t_order_return_request torr |
| | |
| | | return R.ok(iCouponMemberService.getCouponMemberl(couponMemberDTO)); |
| | | } |
| | | |
| | | @PostMapping("/updCouponMember") |
| | | @ApiOperation(value = "用户端-获取用户下单获取优惠卷") |
| | | public R<List<CouponMember>> updCouponMember1(@RequestBody CouponMemberDTO couponMemberDTO) { |
| | | return R.ok(iCouponMemberService.updCouponMember1(couponMemberDTO)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.promotion.controller.management.vo.MgtCouponVO; |
| | | import com.ruoyi.promotion.service.ICouponService; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.ModifyGroup; |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.Date; |
| | |
| | | */ |
| | | @ApiOperation("编辑优惠券") |
| | | @PutMapping("/update") |
| | | public R<?> updateCoupon(@Validated(ModifyGroup.class) @RequestBody MgtCouponDTO dto) { |
| | | public R<?> updateCoupon(@Validated(UpdateGroup.class) @RequestBody MgtCouponDTO dto) { |
| | | couponService.updateCoupon(dto); |
| | | return R.ok(); |
| | | } |
| | |
| | | /** |
| | | * 上架/下架 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | * @param dto 管理后台-优惠券上架下架数据传输对象 |
| | | */ |
| | | @ApiOperation("上架/下架") |
| | | @PutMapping("/upd-status") |
| | |
| | | import com.ruoyi.common.core.enums.CouponTypeEnum; |
| | | import com.ruoyi.common.core.enums.DistributionMethodEnum; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.ModifyGroup; |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | |
| | | private static final long serialVersionUID = 471073836029292058L; |
| | | |
| | | @ApiModelProperty(value = "优惠券id", notes = "添加不传,更新必传") |
| | | @NotNull(message = "优惠券id不能为空", groups = {ModifyGroup.class}) |
| | | @NotNull(message = "优惠券id不能为空", groups = {UpdateGroup.class}) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotBlank(message = "优惠券名称不能为空", groups = {InsertGroup.class, ModifyGroup.class}) |
| | | @NotBlank(message = "优惠券名称不能为空", groups = {InsertGroup.class, UpdateGroup.class}) |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型 1=满减券 2=代金券 3=折扣券") |
| | |
| | | private BigDecimal maxDiscount; |
| | | |
| | | @ApiModelProperty(value = "优惠券说明") |
| | | @NotBlank(message = "优惠券说明不能为空", groups = {InsertGroup.class, ModifyGroup.class}) |
| | | @NotBlank(message = "优惠券说明不能为空", groups = {InsertGroup.class, UpdateGroup.class}) |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "有效期起") |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.enums.CouponTypeEnum; |
| | | import com.ruoyi.common.core.enums.DistributionMethodEnum; |
| | | import com.ruoyi.common.core.enums.ListingStatusEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.math.BigDecimal; |
| | |
| | | private CouponTypeEnum couponType; |
| | | |
| | | @ApiModelProperty(value = "状态 0=已上架 1=已下架") |
| | | private Integer couponStatus; |
| | | private ListingStatusEnum couponStatus; |
| | | |
| | | @ApiModelProperty(value = "满减金额,例如:满100元") |
| | | private BigDecimal fullReductionAmount; |
| | |
| | | |
| | | List<CouponMember> getCouponMemberl(@RequestBody CouponMemberDTO couponMemberDTO); |
| | | |
| | | List<CouponMember> updCouponMember1(@RequestBody CouponMemberDTO couponMemberDTO); |
| | | |
| | | } |
| | |
| | | */ |
| | | void updateCoupon(MgtCouponDTO dto); |
| | | |
| | | /** |
| | | * 上架/下架 |
| | | * |
| | | * @param dto 管理后台-优惠券上架下架数据传输对象 |
| | | */ |
| | | void updStatus(MgtCouponUpdDTO dto); |
| | | |
| | | /** |
| | |
| | | List<CouponMember> page1 = this.list(wrapper1); |
| | | return page1; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponMember> updCouponMember1(CouponMemberDTO couponMemberDTO) { |
| | | LambdaQueryWrapper<CouponMember> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(CouponMember::getCouponStatus, CouponUseEnum.UNUSED); |
| | | wrapper.eq(CouponMember::getDelFlag,0); |
| | | List<CouponMember> couponMemberList=this.list(wrapper); |
| | | /* for (CouponMember couponMember:couponMemberList){ |
| | | if(LocalDateTime.now().isAfter(couponMember.getEndDate())){ |
| | | couponMember.setCouponStatus(0); |
| | | this.updateById(couponMember); |
| | | } |
| | | }*/ |
| | | LambdaQueryWrapper<CouponMember> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(CouponMember::getCouponStatus, |
| | | CouponUseEnum.getEnumByCode(couponMemberDTO.getCouponStatus())); |
| | | wrapper1.eq(CouponMember::getMemberId,couponMemberDTO.getMemberId()); |
| | | wrapper1.eq(CouponMember::getDelFlag,0); |
| | | List<CouponMember> page1 = this.list(wrapper1); |
| | | return page1; |
| | | } |
| | | } |
| | |
| | | query.getCouponType()) |
| | | .eq(StringUtils.isNotNull(query.getDistributionMethod()), |
| | | Coupon::getDistributionMethod, query.getDistributionMethod()) |
| | | .orderByDesc(Coupon::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | |
| | | this.updateById(coupon); |
| | | } |
| | | |
| | | /** |
| | | * 上架/下架 |
| | | * |
| | | * @param dto 管理后台-优惠券上架下架数据传输对象 |
| | | */ |
| | | @Override |
| | | public void updStatus(MgtCouponUpdDTO dto) { |
| | | this.lambdaUpdate() |
| | | .set(Coupon::getCouponStatus, dto.getCouponStatus()) |
| | | .eq(Coupon::getId, dto.getId()); |
| | | .eq(Coupon::getId, dto.getId()).update(); |
| | | } |
| | | |
| | | /** |
| | |
| | | PromotionBanner::getListingStatus, query.getListingStatus()) |
| | | .like(StringUtils.isNotBlank(query.getBannerName()), PromotionBanner::getBannerName, |
| | | query.getBannerName()) |
| | | .orderByDesc(PromotionBanner::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | |
| | | Page<PromotionVideo> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(query.getVideoName()), PromotionVideo::getVideoName, |
| | | query.getVideoName()) |
| | | .orderByDesc(PromotionVideo::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | |
| | | .eq(StringUtils.isNotNull(query.getReplyStatus()), |
| | | PromotionWishList::getReplyStatus, query.getReplyStatus()) |
| | | .in(StringUtils.isNotEmpty(memberIdSet), PromotionWishList::getMemberId, |
| | | memberIdSet).page(page); |
| | | memberIdSet).orderByDesc(PromotionWishList::getCreateTime).page(page); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | | } |
| | |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 689e0f09-d102-460c-ac5c-5ea50a3174be |
| | | ip: 192.168.110.188 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8858 |
| | |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.system.domain.Agreement; |
| | | import com.ruoyi.system.domain.dto.AgreementDTO; |
| | | import com.ruoyi.system.service.IAgreementService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/agreement") |
| | | |
| | | @Api(tags = "系统管理相关接口") |
| | | public class AgreementController { |
| | | @Resource |
| | | private IAgreementService iAgreementService; |
| | | @RequestMapping("/getAgreement") |
| | | @ResponseBody |
| | | |
| | | @RequestMapping(value = "/getAgreement/{agreementType}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取用户协议/隐私协议") |
| | | public R<Agreement> getAgreement(@PathVariable("agreementType") Integer agreementType) { |
| | | return R.ok(iAgreementService.getAgreement(agreementType)); |
| | | } |
| | | |
| | | /** |
| | | * 管理后台-获取协议列表 |
| | | * |
| | | * @return List<AgreementDTO> |
| | | */ |
| | | @ApiOperation("管理后台-获取协议列表") |
| | | @GetMapping("/list") |
| | | public R<List<AgreementDTO>> getAgreementList() { |
| | | List<Agreement> list = iAgreementService.lambdaQuery().last("limit 2").list(); |
| | | return R.ok(BeanUtils.copyList(list, AgreementDTO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 保存协议 |
| | | * |
| | | * @param dto 协议对象 |
| | | */ |
| | | @ApiOperation(value = "管理后台-保存用户协议", notes = "接收一个包含多个AgreementDTO的列表") |
| | | @PostMapping("/save") |
| | | public R<?> saveAgreement(@Validated @RequestBody AgreementDTO dto) { |
| | | iAgreementService.saveAgreement(dto); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.domain.dto.PointsConfigDTO; |
| | | import com.ruoyi.system.domain.vo.CustomConfigVO; |
| | | import com.ruoyi.system.service.ICustomConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | */ |
| | | @ApiOperation("获取积分设置") |
| | | @GetMapping("/points") |
| | | public R<List<CustomConfigVO>> getPointsConfig() { |
| | | public R<PointsConfigDTO> getPointsConfig() { |
| | | return R.ok(iCustomConfigService.getPointsConfig()); |
| | | } |
| | | /** |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 售后设置 |
| | | * |
| | | * @param dto 售后设置对象 |
| | | */ |
| | | @ApiOperation(value = "售后设置") |
| | | @PostMapping("/save-after-sale-setting") |
| | | public R<?> saveAfterSaleSetting(@Validated @RequestBody MgtAfterSaleSettingDTO dto) { |
| | | iCustomConfigService.saveAfterSaleSetting(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取售后设置 |
| | | * |
| | | * @return List<CustomConfigVO> |
| | | */ |
| | | @ApiOperation("获取售后设置") |
| | | @GetMapping("/get-after-sale-setting") |
| | | public R<MgtAfterSaleSettingDTO> getAfterSaleSetting() { |
| | | return R.ok(iCustomConfigService.getAfterSaleSetting()); |
| | | } |
| | | |
| | | /** |
| | | * 获取客服电话 |
| | | * |
| | | * @return 客服电话 |
| | | */ |
| | | @ApiOperation("获取客服电话") |
| | | @GetMapping("/service-phone") |
| | | public R<String> servicePhone() { |
| | | return R.ok(iCustomConfigService.getServicePhone()); |
| | | } |
| | | |
| | | /** |
| | | * 保存客服电话 |
| | | * |
| | | * @param phone 客服电话 |
| | | */ |
| | | @ApiOperation("保存客服电话") |
| | | @PostMapping("/save-service-phone") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "phone", value = "客服电话", example = "18888888888", required = true)}) |
| | | public R<?> servicePhone(@RequestParam(value = "phone", required = true) String phone) { |
| | | iCustomConfigService.updateServicePhone(phone); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除客户电话 |
| | | * |
| | | * @param phone 客服电话 |
| | | */ |
| | | @ApiOperation("删除客服电话") |
| | | @PostMapping("/delete-service-phone") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "phone", value = "客服电话", example = "18888888888", required = true)}) |
| | | public R<?> deleteServicePhone(@RequestParam(value = "phone", required = true) String phone) { |
| | | iCustomConfigService.deleteServicePhone(phone); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.management.relation.Role; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.domain.SysMenus; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.domain.dto.RoleAddDto; |
| | | import com.ruoyi.system.domain.dto.RoleUpdateDto; |
| | | import com.ruoyi.system.domain.vo.RoleInfoVo; |
| | | import com.ruoyi.system.mapper.SysMenuMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysMenus; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.domain.dto.RoleAddDto; |
| | | import com.ruoyi.system.domain.dto.RoleQuery; |
| | | import com.ruoyi.system.domain.dto.RoleUpdateDto; |
| | | import com.ruoyi.system.domain.vo.RoleInfoVo; |
| | | import com.ruoyi.system.mapper.SysMenuMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.seata.common.util.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 角色信息 |
| | |
| | | @Resource |
| | | private SysMenuMapper menuMapper; |
| | | |
| | | @ApiOperation("获取所有角色信息根据公司id") |
| | | // @ApiOperation("获取所有角色信息根据公司id") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(Integer companyId) |
| | | { |
| | | SysRole role = new SysRole(); |
| | | role.setCompanyId(companyId); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("获取所有角色信息根据公司id--分页") |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Integer companyId,int pageNumber,int pageSize) |
| | | @ApiOperation("获取角色列表") |
| | | @PostMapping("/listPage") |
| | | public AjaxResult listPage(@Validated @RequestBody RoleQuery query) |
| | | { |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, new LambdaQueryWrapper<SysRole>().eq(SysRole::getCompanyId, companyId).ne(SysRole::getRoleId,20)); |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, |
| | | new LambdaQueryWrapper<SysRole>().ne(SysRole::getRoleId, 20) |
| | | .like(StringUtils.isNotBlank(query.getRoleName()), SysRole::getRoleName, |
| | | query.getRoleName()).eq(SysRole::getDelFlag, "0")); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("角色启用停用") |
| | | // @ApiOperation("角色启用停用") |
| | | @GetMapping("/roleStart") |
| | | public AjaxResult roleStart(Long roleId) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation("添加角色") |
| | | @PostMapping("/roleAdd") |
| | | public AjaxResult roleAdd(@Validated @RequestBody RoleAddDto dto) |
| | |
| | | SysRole role = new SysRole(); |
| | | role.setRoleName(dto.getRoleName()); |
| | | long count = roleService.count(Wrappers.lambdaQuery(SysRole.class) |
| | | .eq(SysRole::getRoleName,dto.getRoleName()) |
| | | .eq(SysRole::getCompanyId,dto.getCompanyId())); |
| | | .eq(SysRole::getRoleName, dto.getRoleName())); |
| | | if(count>0){ |
| | | return AjaxResult.error("角色已存在,请重新输入"); |
| | | } |
| | |
| | | if(CollectionUtils.isEmpty(menuIds1)){ |
| | | return AjaxResult.error("菜单id不能为空"); |
| | | } |
| | | role.setMenuIds(dto.getMenuIds().toArray((new Long[dto.getMenuIds().size()]))); |
| | | role.setMenuIds(dto.getMenuIds().toArray(new Long[0])); |
| | | // 添加角色 |
| | | role.setCompanyId(dto.getCompanyId()); |
| | | role.setCarDataAuth(dto.getCarDataAuth()); |
| | | role.setCarTrainOperAuth(dto.getCarTrainOperAuth()); |
| | | role.setContractDataAuth(dto.getContractDataAuth()); |
| | | role.setCreateBy(SecurityUtils.getUsername()); |
| | | role.setCreateTime(new Date()); |
| | | roleService.insertRole(role); |
| | |
| | | |
| | | |
| | | @ApiOperation("角色详情") |
| | | @GetMapping("/roleInfo") |
| | | public AjaxResult roleInfo( @RequestParam Long id) |
| | | @GetMapping("/roleInfo/{id}") |
| | | public AjaxResult roleInfo( |
| | | @ApiParam(value = "角色id", name = "id", required = true) @PathVariable("id") Long id) |
| | | { |
| | | SysRole role = roleService.selectRoleById(id); |
| | | RoleInfoVo roleInfoVo = new RoleInfoVo(); |
| | | roleInfoVo.setRoleId(role.getRoleId()); |
| | | roleInfoVo.setCarDataAuth(role.getCarDataAuth()); |
| | | roleInfoVo.setCarTrainOperAuth(role.getCarTrainOperAuth()); |
| | | roleInfoVo.setContractDataAuth(role.getContractDataAuth()); |
| | | roleInfoVo.setRoleName(role.getRoleName()); |
| | | // 获取当前角色的菜单id |
| | | List<Long> menusId = sysRoleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, id)).stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList()); |
| | |
| | | public AjaxResult roleInfoFromUserId( @RequestParam Long userId) |
| | | { |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | if (Objects.isNull(one)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | Long id =one.getRoleId(); |
| | | // 获取当前角色的菜单id |
| | | List<Long> menusId = sysRoleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, id)).stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList()); |
| | | if(menusId.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | if(id!=1){ |
| | | menusId = menusId.stream().filter(e->e!=1074 && e!=1075 && e!=1193 && e!=1194).collect(Collectors.toList()); |
| | | } |
| | | //获取当前的权限菜单 |
| | | List<SysMenus> all = menuMapper.getAllInIds(menusId); |
| | | List<SysMenus> allUser = menuMapper.getAllInIds(menusId); |
| | | // 查询所有权限菜单 |
| | | List<SysMenus> all = menuMapper.getAll(); |
| | | // 创建一个Map来存储all集合中的menuId |
| | | Map<Long, Boolean> menuIdExistMap = allUser.stream() |
| | | .collect(Collectors.toMap(SysMenus::getMenuId, aMenu -> true, |
| | | (oldValue, newValue) -> oldValue)); |
| | | |
| | | // 遍历allUser集合,根据menuIdExistMap来设置isHave值 |
| | | for (SysMenus allMenu : all) { |
| | | allMenu.setIsHave(menuIdExistMap.containsKey(allMenu.getMenuId()) ? 1 : 2); |
| | | } |
| | | |
| | | // 第三级 |
| | | List<SysMenus> s3 = all.stream().filter(e -> e.getMenuType().equals("F")).collect(Collectors.toList()); |
| | | // 第二级 |
| | |
| | | return AjaxResult.success(s1); |
| | | } |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("编辑角色") |
| | | @PostMapping("/roleUpdate") |
| | | public AjaxResult roleUpdate(@Validated @RequestBody RoleUpdateDto dto) |
| | |
| | | SysRole role = new SysRole(); |
| | | role.setRoleName(dto.getRoleName()); |
| | | SysRole one = roleService.getOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getRoleId, dto.getRoleId())); |
| | | List<SysRole> sysRoles = roleService.isExitUpdate(dto.getRoleName(),dto.getRoleId(),one.getCompanyId()); |
| | | List<SysRole> sysRoles = roleService.isExitUpdate(dto.getRoleName(), dto.getRoleId()); |
| | | if(sysRoles.size()>0){ |
| | | return AjaxResult.error("角色已存在,请重新输入"); |
| | | } |
| | | // 编辑角色 |
| | | role.setCarDataAuth(dto.getCarDataAuth()); |
| | | role.setCarTrainOperAuth(dto.getCarTrainOperAuth()); |
| | | role.setContractDataAuth(dto.getContractDataAuth()); |
| | | role.setUpdateBy(SecurityUtils.getUsername()); |
| | | role.setUpdateTime(new Date()); |
| | | role.setRoleId(dto.getRoleId()); |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation("删除角色") |
| | | @DeleteMapping("/del/{id}") |
| | | public AjaxResult removeRole( |
| | | @ApiParam(name = "id", value = "角色ID", required = true) @PathVariable Long id) { |
| | | roleService.removeRole(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:role:export") |
| | | @PostMapping("/export") |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.domain.dto.ResetPwdDTO; |
| | | import com.ruoyi.system.domain.dto.SupplierDTO; |
| | | import com.ruoyi.system.domain.dto.SupplierQuery; |
| | | import com.ruoyi.system.domain.dto.SysUserDTO; |
| | | import com.ruoyi.system.domain.dto.SysUserQuery; |
| | | import com.ruoyi.system.domain.vo.SupplierVO; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation("管理员列表") |
| | | public AjaxResult list(String phonenumber, int pageNumber, int pageSize) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, phonenumber); |
| | | @PostMapping("/list") |
| | | @ApiOperation("账号管理列表") |
| | | public AjaxResult list(@Validated @RequestBody SysUserQuery query) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, query.getNickName(), |
| | | query.getPhonenumber(), query.getStatus()); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @Log(title = "账号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ApiOperation("添加管理员") |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) { |
| | | @ApiOperation("添加账号") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@Validated(InsertGroup.class) @RequestBody SysUserDTO dto) { |
| | | SysUser user = BeanUtils.copyBean(dto, SysUser.class); |
| | | user.setUserId(null); |
| | | user.setUserType(dto.getIsAuctioneer() == 1 ? "04" : "00"); |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | return error("手机号已开通账号"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword("123456")); |
| | | user.setRoleType(1); |
| | | int i = userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(1l); |
| | | sysUserRole.setRoleId(dto.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | int i1 = userRoleService.insertSysUserRole(sysUserRole); |
| | | return AjaxResult.success(i1); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @ApiOperation("管理员详情") |
| | | @GetMapping(value = {"/", "/{userId}"}) |
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | @ApiOperation("账号详情") |
| | | @GetMapping("/{userId}") |
| | | public AjaxResult getInfo( |
| | | @ApiParam(value = "用户ID", required = true) @PathVariable(value = "userId", required = true) Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @Log(title = "账号管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | @ApiOperation("编辑管理员") |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | |
| | | @ApiOperation("编辑账号") |
| | | public AjaxResult edit(@Validated(UpdateGroup.class) @RequestBody SysUserDTO dto) { |
| | | SysUser user = BeanUtils.copyBean(dto, SysUser.class); |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | Integer data = admin.getData(); |
| | | if(data == null || data != 1){ |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getUserId())); |
| | | one.setRoleId(user.getRoleId()); |
| | | one.setRoleId(dto.getRoleId()); |
| | | sysUserRoleService.updateSysUserRole(one); |
| | | } |
| | | userService.checkUserAllowed(user); |
| | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @Log(title = "账号管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation("删除管理员") |
| | | @ApiOperation("删除账号") |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |
| | |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | | @PostMapping("/shopUserStart") |
| | | @ApiOperation("账号管理--停用/启用") |
| | | public AjaxResult shopUserStart(Long userId) { |
| | | @PostMapping("/updStatus/{userId}") |
| | | @ApiOperation("账号管理--冻结/解冻") |
| | | public AjaxResult updStatus( |
| | | @ApiParam(value = "账号ID", required = true) @PathVariable("userId") Long userId) { |
| | | if (userId == null) { |
| | | return AjaxResult.error("userId不能为空"); |
| | | } |
| | |
| | | if (StringUtils.isNull(sysUser)) { |
| | | return R.fail("用户名或密码错误"); |
| | | } |
| | | LoginUser sysUserVo = new LoginUser(); |
| | | sysUserVo.setSysUser(sysUser); |
| | | if (sysUser.getUserType().equals("00")) { |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(sysUser); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(sysUser); |
| | | LoginUser sysUserVo = new LoginUser(); |
| | | sysUserVo.setSysUser(sysUser); |
| | | sysUserVo.setRoles(roles); |
| | | sysUserVo.setPermissions(permissions); |
| | | |
| | | } |
| | | return R.ok(sysUserVo); |
| | | } |
| | | |
| | |
| | | * 重置密码 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @ApiOperation("重置密码") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody ResetPwdDTO dto) { |
| | | SysUser user = userService.lambdaQuery().eq(SysUser::getUserId, dto.getUserId()) |
| | | .in(SysUser::getUserType, "00", "01").one(); |
| | | if (StringUtils.isNull(user)) { |
| | | throw new ServiceException("账号不存在"); |
| | | } |
| | | |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
| | |
| | | return R.ok(user); |
| | | } |
| | | |
| | | // @PostMapping("/queryUserByPhone1") |
| | | // public R<SysUser> queryUserByPhone1(@RequestBody String phone){ |
| | | // SysUser user = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | | // .eq(SysUser::getPhonenumber, phone) |
| | | // .eq(SysUser::get, phone) |
| | | // .last("LIMIT 1")); |
| | | // return R.ok(user); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 通过账号查询用户 |
New file |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | | import com.ruoyi.system.api.domain.WebsocketMessageDTO; |
| | | import com.ruoyi.system.websocket.WebSocketUsers; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | | @RequestMapping("/websocket") |
| | | public class WebSocketController { |
| | | |
| | | @GetMapping("/push") |
| | | public R<?> push() { |
| | | WebSocketUsers.sendMessageToUsersByText("长江长江,我是黄河!"); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/push/{type}/{msg}") |
| | | public R<?> push(@PathVariable("type") Integer type, @PathVariable("msg") String msg) { |
| | | WebSocketUsers.sendMessageToUsersByType(type, msg); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping("/push-by-client-type") |
| | | public R<?> pushByClientType(@RequestBody WebsocketMessageDTO dto) { |
| | | WebSocketUsers.sendMessageToUsersByType(dto.getClientType().getCode(), dto.getMessage()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @GetMapping("/push-all/{message}") |
| | | public R<?> pushAll(@PathVariable("message") String message) { |
| | | WebSocketUsers.sendMessageToUsersByText(message); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "协议类型 1=用户协议 2=隐私协议") |
| | | @TableField(value = "agreement_type") |
| | | private Integer agreementType; |
| | | |
| | | @ApiModelProperty(value = "协议内容") |
| | | @TableField(value = "agreement_content") |
| | | private String agreementContent; |
| | | |
| | | @ApiModelProperty(value = "创建者") |
| | | @TableField(value = "create_by") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField(value = "create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "更新者") |
| | | @TableField(value = "update_by") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @TableField(value = "update_time") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "删除标志(0代表存在 1代表删除)") |
| | | @TableField(value = "del_flag") |
| | | private Integer delFlag; |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/18 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "协议对象") |
| | | public class AgreementDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 7144114465287126540L; |
| | | |
| | | @ApiModelProperty(value = "协议id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "协议类型 1=用户协议 2=隐私协议") |
| | | @NotNull(message = "协议类型不能为空") |
| | | private Integer agreementType; |
| | | |
| | | @ApiModelProperty(value = "协议内容") |
| | | @NotBlank(message = "协议内容不能为空") |
| | | private String agreementContent; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("重置密码") |
| | | public class ResetPwdDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -4349599620340762098L; |
| | | |
| | | @ApiModelProperty(value = "账号id") |
| | | @NotNull(message = "账号ID不能为空") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "新密码") |
| | | @NotBlank(message = "新密码不能为空") |
| | | private String password; |
| | | } |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class RoleAddDto { |
| | | @ApiModel("角色添加数据传输对象") |
| | | public class RoleAddDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 5748474501961956215L; |
| | | |
| | | @ApiModelProperty("角色名称") |
| | | @NotBlank(message = "角色名称不能为空") |
| | | private String roleName; |
| | | @ApiModelProperty("车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carDataAuth; |
| | | @ApiModelProperty("车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carTrainOperAuth; |
| | | @ApiModelProperty("合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限") |
| | | private Integer contractDataAuth; |
| | | @ApiModelProperty("公司id") |
| | | @NotNull(message = "公司id不能为空") |
| | | private Integer companyId; |
| | | |
| | | @ApiModelProperty("菜单id") |
| | | @NotNull(message = "菜单id不能为空") |
| | | @NotEmpty(message = "菜单id不能为空") |
| | | private List<Long> menuIds; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel("角色查询") |
| | | public class RoleQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = 6935257450787285105L; |
| | | |
| | | @ApiModelProperty("角色名称") |
| | | private String roleName; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class RoleUpdateDto { |
| | | public class RoleUpdateDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 8640434597899168206L; |
| | | |
| | | @ApiModelProperty("角色id") |
| | | @NotNull(message = "角色id不能为空") |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty("角色名称") |
| | | @NotBlank(message = "角色名称不能为空") |
| | | private String roleName; |
| | | @ApiModelProperty("车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carDataAuth; |
| | | @ApiModelProperty("车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carTrainOperAuth; |
| | | @ApiModelProperty("合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限") |
| | | private Integer contractDataAuth; |
| | | |
| | | @ApiModelProperty("菜单id") |
| | | @NotEmpty(message = "菜单id不能为空") |
| | | private List<Long> menuIds; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 用户对象 sys_user |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class SysUserDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ApiModelProperty(value = "账号id", notes = "添加不传") |
| | | @NotNull(message = "账号ID不能为空", groups = {UpdateGroup.class}) |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ApiModelProperty(value = "员工姓名") |
| | | @NotBlank(message = "员工姓名不能为空") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | @NotBlank(message = "联系电话不能为空") |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "所属角色") |
| | | @NotNull(message = "角色id不能为空") |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty(value = "是否为拍卖师 1=否 2=是") |
| | | @NotNull(message = "是否为拍卖师不能为空") |
| | | private Integer isAuctioneer; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("用户查询条件") |
| | | public class SysUserQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = -5515862189079789834L; |
| | | @ApiModelProperty("员工姓名") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty("联系电话") |
| | | private String phonenumber; |
| | | |
| | | @ApiModelProperty("状态 0:正常 1:冻结") |
| | | private Integer status; |
| | | } |
| | |
| | | //自动结束团购任务 |
| | | autoEndGroupPurchase(id); |
| | | } else if (DelayTaskEnum.AUCTION_GOODS_START_TASK.getCode().equals(operation)) { |
| | | // 自动开始团购任务 |
| | | // 自动开始拍卖商品任务 |
| | | autoStartAuctionGoods(id); |
| | | } else if (DelayTaskEnum.AUCTION_GOODS_END_TASK.getCode().equals(operation)) { |
| | | // 自动结束团购任务 |
| | | // 自动结束拍卖商品任务 |
| | | autoEndAuctionGoods(id); |
| | | }else if(DelayTaskEnum.ORDER_AUTOMATIC_CANCEL.getCode().equals(operation)){ |
| | | //自动取消订单 |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public int deleteRoleByIds(Long[] roleIds); |
| | | |
| | | List<SysRole> isExitUpdate(@Param("roleName") String roleName, @Param("roleId") Long roleId, @Param("companyId") Integer companyId); |
| | | List<SysRole> isExitUpdate(@Param("roleName") String roleName, @Param("roleId") Long roleId); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * 用户表 数据层 |
| | |
| | | */ |
| | | public SysUser checkEmailUnique(String email); |
| | | |
| | | PageInfo<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("phonenumber") String phonenumber); |
| | | PageInfo<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, |
| | | @Param("nickName") String nickName, @Param("phonenumber") String phonenumber, |
| | | @Param("status") Integer status); |
| | | |
| | | PageInfo<SysUser> getAllList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("ids") List<Integer> collect); |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.domain.Agreement; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import com.ruoyi.system.domain.dto.AgreementDTO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | Agreement getAgreement(Integer agreementType); |
| | | |
| | | /** |
| | | * 保存协议 |
| | | * |
| | | * @param dto 协议对象 |
| | | */ |
| | | void saveAgreement(AgreementDTO dto); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.domain.dto.PointsConfigDTO; |
| | | import com.ruoyi.system.domain.vo.CustomConfigVO; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * |
| | | * @return List<CustomConfig> |
| | | */ |
| | | List<CustomConfigVO> getPointsConfig(); |
| | | PointsConfigDTO getPointsConfig(); |
| | | |
| | | /** |
| | | * 获取订单说明设置 |
| | |
| | | */ |
| | | void saveOrderDescription(String description); |
| | | |
| | | /** |
| | | * 售后设置 |
| | | * |
| | | * @param dto 售后设置对象 |
| | | */ |
| | | void saveAfterSaleSetting(MgtAfterSaleSettingDTO dto); |
| | | |
| | | /** |
| | | * 获取售后设置 |
| | | * |
| | | * @return List<CustomConfigVO> |
| | | */ |
| | | MgtAfterSaleSettingDTO getAfterSaleSetting(); |
| | | |
| | | /** |
| | | * 保存客服电话 |
| | | * |
| | | * @param phone 客服电话 |
| | | */ |
| | | void updateServicePhone(String phone); |
| | | |
| | | /** |
| | | * 获取客服电话 |
| | | * |
| | | * @return 客服电话 |
| | | */ |
| | | String getServicePhone(); |
| | | |
| | | /** |
| | | * 删除客户电话 |
| | | * |
| | | * @param phone 客服电话 |
| | | */ |
| | | void deleteServicePhone(String phone); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 角色业务层 |
| | |
| | | */ |
| | | public int insertAuthUsers(Long roleId, Long[] userIds); |
| | | |
| | | List<SysRole> isExitUpdate(String roleName, Long roleId,Integer companyId); |
| | | List<SysRole> isExitUpdate(String roleName, Long roleId); |
| | | |
| | | void removeRole(Long id); |
| | | } |
| | |
| | | */ |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber); |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String nickname, String phonenumber, |
| | | Integer status); |
| | | |
| | | |
| | | PageInfo<SysUser> getAllList(PageInfo<SysUser> pageInfo, List<Integer> collect); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.domain.Agreement; |
| | | import com.ruoyi.system.domain.dto.AgreementDTO; |
| | | import com.ruoyi.system.mapper.AgreementMapper; |
| | | import com.ruoyi.system.service.IAgreementService; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Optional; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | wrapper.eq(Agreement::getDelFlag,0); |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 保存协议 |
| | | * |
| | | * @param dto 协议对象 |
| | | */ |
| | | @Override |
| | | public void saveAgreement(AgreementDTO dto) { |
| | | Optional<Agreement> agreementOpt = this.lambdaQuery() |
| | | .eq(Agreement::getAgreementType, dto.getAgreementType()).oneOpt(); |
| | | Agreement agreement; |
| | | if (agreementOpt.isPresent()) { |
| | | agreement = agreementOpt.get(); |
| | | agreement.setAgreementType(dto.getAgreementType()); |
| | | agreement.setAgreementContent(dto.getAgreementContent()); |
| | | agreement.setUpdateBy(SecurityUtils.getUsername()); |
| | | agreement.setUpdateTime(LocalDateTime.now()); |
| | | this.updateById(agreement); |
| | | } else { |
| | | agreement = BeanUtils.copyBean(dto, Agreement.class); |
| | | agreement.setCreateBy(SecurityUtils.getUsername()); |
| | | agreement.setCreateTime(LocalDateTime.now()); |
| | | this.save(agreement); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.system.api.constants.ConfigEnum; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.domain.dto.PointsConfigDTO; |
| | | import com.ruoyi.system.domain.vo.CustomConfigVO; |
| | | import com.ruoyi.system.mapper.CustomConfigMapper; |
| | | import com.ruoyi.system.service.ICustomConfigService; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | private Optional<CustomConfig> getCustomConfigByKey(String key) { |
| | | return this.lambdaQuery() |
| | | .eq(CustomConfig::getConfigType, key) |
| | | .eq(CustomConfig::getConfigKey, key) |
| | | .eq(CustomConfig::getDelFlag, 0).oneOpt(); |
| | | } |
| | | |
| | |
| | | * @return List<CustomConfigVO> |
| | | */ |
| | | @Override |
| | | public List<CustomConfigVO> getPointsConfig() { |
| | | public PointsConfigDTO getPointsConfig() { |
| | | PointsConfigDTO dto = new PointsConfigDTO(); |
| | | List<CustomConfig> list = this.lambdaQuery() |
| | | .in(CustomConfig::getConfigType, ConfigEnum.MEMBER_POINTS_MONEY.getKey(), |
| | | .in(CustomConfig::getConfigKey, ConfigEnum.MEMBER_POINTS_MONEY.getKey(), |
| | | ConfigEnum.MEMBER_POINTS_POINTS.getKey()) |
| | | .eq(CustomConfig::getDelFlag, 0).list(); |
| | | return BeanUtils.copyList(list, CustomConfigVO.class); |
| | | for (CustomConfig customConfig : list) { |
| | | if (ConfigEnum.MEMBER_POINTS_MONEY.getKey().equals(customConfig.getConfigKey())) { |
| | | dto.setConsumeAmount( |
| | | BigDecimal.valueOf(Double.parseDouble(customConfig.getConfigValue()))); |
| | | } |
| | | if (ConfigEnum.MEMBER_POINTS_POINTS.getKey().equals(customConfig.getConfigKey())) { |
| | | dto.setPoints(Integer.parseInt(customConfig.getConfigValue())); |
| | | } |
| | | } |
| | | return dto; |
| | | } |
| | | |
| | | /** |
| | |
| | | this.saveOrUpdate(orderDescription); |
| | | } |
| | | |
| | | /** |
| | | * 售后设置 |
| | | * |
| | | * @param dto 售后设置对象 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
| | | public void saveAfterSaleSetting(MgtAfterSaleSettingDTO dto) { |
| | |
| | | } |
| | | |
| | | private void handleConfigSetting(String value, ConfigEnum configEnum) { |
| | | Optional<CustomConfig> receiverNameConfigOptional = getCustomConfigByKey( |
| | | ConfigEnum.RETURN_ADDRESS_USER_NAME.getKey()); |
| | | CustomConfig receiverNameConfig = receiverNameConfigOptional.orElseGet(() -> { |
| | | Optional<CustomConfig> configSettingOptional = getCustomConfigByKey(configEnum.getKey()); |
| | | CustomConfig configSetting = configSettingOptional.orElseGet(() -> { |
| | | CustomConfig config = new CustomConfig(); |
| | | config.setConfigKey(ConfigEnum.RETURN_ADDRESS_USER_NAME.getKey()); |
| | | config.setConfigType(ConfigEnum.RETURN_ADDRESS_USER_NAME.getKeyType()); |
| | | config.setConfigName(ConfigEnum.RETURN_ADDRESS_USER_NAME.getKeyName()); |
| | | config.setConfigKey(configEnum.getKey()); |
| | | config.setConfigType(configEnum.getKeyType()); |
| | | config.setConfigName(configEnum.getKeyName()); |
| | | return config; |
| | | }); |
| | | receiverNameConfig.setConfigValue(value); |
| | | this.saveOrUpdate(receiverNameConfig); |
| | | configSetting.setConfigValue(value); |
| | | this.saveOrUpdate(configSetting); |
| | | } |
| | | |
| | | /** |
| | | * 获取售后设置 |
| | | * |
| | | * @return List<CustomConfigVO> |
| | | */ |
| | | @Override |
| | | public MgtAfterSaleSettingDTO getAfterSaleSetting() { |
| | | MgtAfterSaleSettingDTO dto = new MgtAfterSaleSettingDTO(); |
| | | List<CustomConfig> list = this.lambdaQuery() |
| | | .in(CustomConfig::getConfigKey, ConfigEnum.RETURN_ADDRESS_USER_NAME, |
| | | ConfigEnum.RETURN_ADDRESS_USER_PHONE, |
| | | ConfigEnum.RETURN_ADDRESS_USER_ADDRESS, ConfigEnum.RETURN_CYCLE) |
| | | .eq(CustomConfig::getDelFlag, 0).list(); |
| | | for (CustomConfig customConfig : list) { |
| | | if (ConfigEnum.RETURN_ADDRESS_USER_NAME.getKey().equals(customConfig.getConfigKey())) { |
| | | dto.setReceiverName(customConfig.getConfigValue()); |
| | | } |
| | | if (ConfigEnum.RETURN_ADDRESS_USER_PHONE.getKey().equals(customConfig.getConfigKey())) { |
| | | dto.setReceiverPhone(customConfig.getConfigValue()); |
| | | } |
| | | if (ConfigEnum.RETURN_ADDRESS_USER_ADDRESS.getKey() |
| | | .equals(customConfig.getConfigKey())) { |
| | | dto.setReceiverAddress(customConfig.getConfigValue()); |
| | | } |
| | | if (ConfigEnum.RETURN_CYCLE.getKey().equals(customConfig.getConfigKey())) { |
| | | dto.setReturnCycle(Integer.parseInt(customConfig.getConfigValue())); |
| | | } |
| | | } |
| | | return dto; |
| | | } |
| | | |
| | | /** |
| | | * 保存客服电话 |
| | | * |
| | | * @param phone 客服电话 |
| | | */ |
| | | @Override |
| | | public void updateServicePhone(String phone) { |
| | | Optional<CustomConfig> customConfigByKey = getCustomConfigByKey( |
| | | ConfigEnum.PLATFORM_SERVICE_PHONE.getKey()); |
| | | if (customConfigByKey.isPresent()) { |
| | | CustomConfig customConfig = customConfigByKey.get(); |
| | | String[] split = customConfig.getConfigValue().split(","); |
| | | if (split.length > 1) { |
| | | throw new ServiceException("客户电话最多配置两个"); |
| | | } |
| | | boolean flag = Arrays.asList(split).contains(phone); |
| | | if (flag) { |
| | | throw new ServiceException("客户电话已存在"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(customConfig.getConfigValue())) { |
| | | customConfig.setConfigValue(phone); |
| | | } else { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.append(customConfig.getConfigValue()); |
| | | stringBuilder.append(","); |
| | | stringBuilder.append(phone); |
| | | customConfig.setConfigValue(stringBuilder.toString()); |
| | | } |
| | | customConfig.setUpdateTime(LocalDateTime.now()); |
| | | this.updateById(customConfig); |
| | | } else { |
| | | CustomConfig config = new CustomConfig(); |
| | | config.setConfigKey(ConfigEnum.PLATFORM_SERVICE_PHONE.getKey()); |
| | | config.setConfigType(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyType()); |
| | | config.setConfigName(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyName()); |
| | | config.setConfigValue(phone); |
| | | config.setCreateTime(LocalDateTime.now()); |
| | | this.save(config); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取客服电话 |
| | | * |
| | | * @return 客服电话 |
| | | */ |
| | | @Override |
| | | public String getServicePhone() { |
| | | Optional<CustomConfig> customConfigByKey = getCustomConfigByKey( |
| | | ConfigEnum.PLATFORM_SERVICE_PHONE.getKey()); |
| | | return customConfigByKey.map(CustomConfig::getConfigValue).orElse(null); |
| | | } |
| | | |
| | | /** |
| | | * 删除客户电话 |
| | | * |
| | | * @param phone 客服电话 |
| | | */ |
| | | @Override |
| | | public void deleteServicePhone(String phone) { |
| | | Optional<CustomConfig> customConfigByKey = getCustomConfigByKey( |
| | | ConfigEnum.PLATFORM_SERVICE_PHONE.getKey()); |
| | | if (customConfigByKey.isPresent()) { |
| | | CustomConfig customConfig = customConfigByKey.get(); |
| | | String configValue = customConfig.getConfigValue(); |
| | | if (StringUtils.isNotBlank(configValue)) { |
| | | String[] split = configValue.split(","); |
| | | // 判断当前phone是否存在 |
| | | boolean flag = Arrays.asList(split).contains(phone); |
| | | if (flag) { |
| | | // 删除 split 中与phone相同的元素 |
| | | configValue = Arrays.stream(split).filter(s -> !s.equals(phone)) |
| | | .collect(Collectors.joining(",")); |
| | | customConfig.setConfigValue(configValue); |
| | | this.updateById(customConfig); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.domain.SysRoleDept; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.mapper.SysRoleDeptMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.SpringUtils; |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysRoleDept; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.mapper.SysRoleDeptMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 角色 业务层处理 |
| | |
| | | // 修改角色信息 |
| | | // roleMapper.updateRole(role); |
| | | // 删除角色与菜单关联 |
| | | // roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); |
| | | roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); |
| | | return roleMapper.updateRole(role); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SysRole> isExitUpdate(String roleName, Long roleId,Integer companyId) { |
| | | return roleMapper.isExitUpdate(roleName,roleId,companyId); |
| | | public List<SysRole> isExitUpdate(String roleName, Long roleId) { |
| | | return roleMapper.isExitUpdate(roleName, roleId); |
| | | } |
| | | |
| | | @Override |
| | | public void removeRole(Long id) { |
| | | SysRole sysRole = baseMapper.selectRoleById(id); |
| | | Long count = userRoleMapper.selectCount( |
| | | Wrappers.lambdaQuery(SysUserRole.class).eq(SysUserRole::getRoleId, id)); |
| | | if (count > 0) { |
| | | throw new ServiceException("角色已绑定账号,不能删除"); |
| | | } |
| | | if (StringUtils.isNull(sysRole)) { |
| | | throw new ServiceException("角色不存在"); |
| | | } |
| | | sysRole.setDelFlag("2"); |
| | | this.updateRole(sysRole); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.validation.Validator; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber) { |
| | | return this.baseMapper.getList(pageInfo,phonenumber); |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String nickName, |
| | | String phonenumber, Integer status) { |
| | | return this.baseMapper.getList(pageInfo, nickName, phonenumber, status); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Page<SysUser> page = this.lambdaQuery() |
| | | .select(SysUser::getUserId, SysUser::getNickName, SysUser::getPhonenumber) |
| | | .like(StringUtils.isNotBlank(query.getNickName() |
| | | ), SysUser::getNickName, query.getNickName()).eq(SysUser::getUserType, "03") |
| | | .eq(SysUser::getDelFlag, "0") |
| | | ), SysUser::getNickName, query.getNickName()).eq(SysUser::getUserType, "04") |
| | | .eq(SysUser::getDelFlag, "0").orderByDesc(SysUser::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | |
| | | if (StringUtils.isNull(dto.getUserId())) { |
| | | user.setUserName(dto.getPhonenumber()); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | user.setUserType("03"); |
| | | user.setUserType("04"); |
| | | user.setCreateTime(new Date()); |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | this.save(user); |
| | | } else { |
| | | // 编辑 |
| | |
| | | user.setNickName(dto.getNickName()); |
| | | user.setPhonenumber(dto.getPhonenumber()); |
| | | user.setUserName(dto.getPhonenumber()); |
| | | user.setUpdateTime(new Date()); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | if (StringUtils.isNotBlank(dto.getPassword())) { |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | } |
| | |
| | | package com.ruoyi.system.websocket; |
| | | |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import java.util.concurrent.Semaphore; |
| | | import javax.websocket.OnClose; |
| | | import javax.websocket.OnError; |
| | |
| | | session.close(); |
| | | } else { |
| | | WebSocketUsers.put(session.getId(), session, clientType); |
| | | LOGGER.info("\n 建立连接 - {}", session); |
| | | |
| | | if (clientType == 1) { |
| | | LOGGER.info("\n 用户端建立连接 - {}", session); |
| | | WebSocketUsers.sendMessageToUserByText(session, "用户端连接成功"); |
| | | } else if (clientType == 2) { |
| | | LOGGER.info("\n 拍卖师端建立连接 - {}", session); |
| | | WebSocketUsers.sendMessageToUserByText(session, "拍卖师端连接成功"); |
| | | } |
| | | LOGGER.info("\n 当前人数 - {}", WebSocketUsers.getUsers().size()); |
| | | WebSocketUsers.sendMessageToUserByText(session, "连接成功"); |
| | | } |
| | | } |
| | | |
File was renamed from ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/util/WebSocketUsers.java |
| | |
| | | package com.ruoyi.system.api.util; |
| | | package com.ruoyi.system.websocket; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collection; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据客户端类型发送消息 |
| | | * |
| | | * @param clientType 1=会员小程序 2=拍卖师小程序 |
| | | * @param message 发送的消息 |
| | | */ |
| | | public static void sendMessageToUsersByType(Integer clientType, String message) { |
| | | for (Map.Entry<String, Session> entry : USERS.entrySet()) { |
| | | String key = entry.getKey(); |
| | |
| | | update_time updateTime, |
| | | remark |
| | | from sys_menu |
| | | order by create_time desc |
| | | order by create_time asc |
| | | </select> |
| | | <select id="getAllInIds" resultType="com.ruoyi.system.domain.SysMenus"> |
| | | select menu_id menuId, |
| | |
| | | |
| | | <sql id="selectRoleVo"> |
| | | select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, |
| | | r.status, r.del_flag, r.create_time, r.remark ,r.carDataAuth,r.carTrainOperAuth,r.contractDataAuth |
| | | r.status, |
| | | r.del_flag, |
| | | r.create_time, |
| | | r.remark |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | |
| | | where r.role_key=#{roleKey} and r.del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="isExitUpdate" resultType="com.ruoyi.system.api.domain.SysRole"> |
| | | select role_name romeName from sys_role where role_name=#{roleName} and companyId =#{companyId} and role_id != #{roleId} |
| | | select role_name romeName |
| | | from sys_role |
| | | where role_name = #{roleName} |
| | | and role_id != #{roleId} |
| | | </select> |
| | | |
| | | <insert id="insertRole" parameterType="com.ruoyi.system.api.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId"> |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="carDataAuth != null and carDataAuth != ''">carDataAuth,</if> |
| | | <if test="carTrainOperAuth != null and carTrainOperAuth != ''">carTrainOperAuth,</if> |
| | | <if test="contractDataAuth != null and contractDataAuth != ''">contractDataAuth,</if> |
| | | <if test="companyId != null and companyId != ''">companyId,</if> |
| | | create_time |
| | | )values( |
| | | <if test="roleId != null and roleId != 0">#{roleId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="carDataAuth != null and carDataAuth != ''">#{carDataAuth},</if> |
| | | <if test="carTrainOperAuth != null and carTrainOperAuth != ''">#{carTrainOperAuth},</if> |
| | | <if test="contractDataAuth != null and contractDataAuth != ''">#{contractDataAuth},</if> |
| | | <if test="companyId != null and companyId != ''">#{companyId},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="carDataAuth != null and carDataAuth != ''">carDataAuth = #{carDataAuth},</if> |
| | | <if test="carTrainOperAuth != null and carTrainOperAuth != ''">carTrainOperAuth = #{carTrainOperAuth},</if> |
| | | <if test="contractDataAuth != null and contractDataAuth != ''">contractDataAuth = #{contractDataAuth},</if> |
| | | <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where role_id = #{roleId} |
| | |
| | | <result property="remark" column="remark" /> |
| | | <result property="roleType" column="roleType" /> |
| | | <result property="objectId" column="objectId" /> |
| | | <result property="userType" column="user_type"/> |
| | | <association property="dept" column="dept_id" javaType="com.ruoyi.system.api.domain.SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
| | | </resultMap> |
| | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
| | | r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId |
| | | r.role_id, |
| | | r.role_name, |
| | | r.role_key, |
| | | r.role_sort, |
| | | r.data_scope, |
| | | r.status as role_status, |
| | | u.roleType as roleType, |
| | | u.objectId AS objectId, |
| | | u.user_type |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | |
| | | </select> |
| | | |
| | | <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 |
| | | select user_id, phonenumber |
| | | from sys_user |
| | | where phonenumber = #{phonenumber} |
| | | and del_flag = '0' |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,nick_name nickName,login_date loginDate,create_time createTime,user_id userId from sys_user where 1=1 |
| | | <if test="phonenumber !=null and phonenumber !=''"> |
| | | and phonenumber like concat("%", #{phonenumber},"%") |
| | | select su.user_id userId,su.nick_name nickName,su.phonenumber,su.status,sr.role_name |
| | | roleName,sr.role_id roleId,case su.user_type when '01' then 2 |
| | | else 1 end as isAuctioneer |
| | | from |
| | | sys_user su left join sys_user_role sur on su.user_id = sur.user_id left join sys_role sr on |
| | | sr.role_id |
| | | = sur.role_id where 1=1 |
| | | <if test="nickName !=null and nickName !=''"> |
| | | and su.nick_name like concat("%", #{nickName},"%") |
| | | </if> |
| | | and del_flag = '0' and roleType =1 |
| | | order by create_time desc |
| | | <if test="phonenumber !=null and phonenumber !=''"> |
| | | and su.phonenumber like concat("%", #{phonenumber},"%") |
| | | </if> |
| | | <if test="status !=null and status !=''"> |
| | | and su.status = #{status} |
| | | </if> |
| | | and su.del_flag = '0' and su.user_type in('00','01') |
| | | order by su.create_time desc |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,user_id userId,nick_name userName ,create_time createTime ,login_date loginDate from sys_user where roleType=3 and user_id in |
| | |
| | | <if test="roleType != null and roleType != ''">roleType,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="objectId != null and objectId != ''">objectId,</if> |
| | | <if test="userType != null and userType != ''">user_type,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="roleType != null and roleType != ''">#{roleType},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="objectId != null and objectId != ''">#{objectId},</if> |
| | | <if test="userType != null and userType != ''">#{userType},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="userType != null and userType != ''">user_type = #{userType},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where user_id = #{userId} |