Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
79个文件已修改
2个文件已删除
17个文件已添加
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class AppUserInfoDto { |
| | | @ApiModelProperty("1是0否") |
| | | private Integer isVip; |
| | | @ApiModelProperty("vip结束时间") |
| | | private LocalDateTime vipExpireTime; |
| | | @ApiModelProperty("当天是否签到") |
| | | private Integer isSign; |
| | | @ApiModelProperty("当前积分") |
| | | private Integer points; |
| | | @ApiModelProperty("当前优惠卷数量") |
| | | private Integer couponNum; |
| | | @ApiModelProperty("当前绑定的车辆") |
| | | private List<TAppUserCar> userCars; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class InfoCouponDto { |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @TableField("name") |
| | | private String name; |
| | | @ApiModelProperty(value = "优惠方式(1=满减,2=抵扣)") |
| | | @TableField("preferential_mode") |
| | | private Integer preferentialMode; |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | @TableField("discount_amount") |
| | | private BigDecimal discountAmount; |
| | | @ApiModelProperty(value = "满减条件为0时无条件") |
| | | @TableField("meet_the_conditions") |
| | | private BigDecimal meetTheConditions; |
| | | |
| | | @ApiModelProperty(value = "折扣") |
| | | @TableField("discount") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | private LocalDateTime startTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SendCouponDto { |
| | | private Integer id; |
| | | private Integer number; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "UpdatePhoneDTO对象",description = "更换手机号DTO") |
| | | public class UpdatePhoneDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @NotBlank(message = "手机号不能为空") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "验证码") |
| | | @NotBlank(message = "验证码不能为空") |
| | | private String code; |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUser> selectByPhone(String phone) { |
| | | return R.fail("通过手机号查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> getUserByIds(List<Long> appUserIds) { |
| | | return R.fail("根据用户id查询用户信息失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-user-address/getAppUserAddressById") |
| | | R<TAppUserAddress> getAppUserAddressById(Long id); |
| | | @PostMapping("/t-app-user-address/getAppUserAddressById/{id}") |
| | | R<TAppUserAddress> getAppUserAddressById(@PathVariable("id") Long id); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user/user/getUserById") |
| | | R<TAppUser> getUserById(Long id); |
| | | @PostMapping(value = "/t-app-user/user/getUserById/{id}") |
| | | R<TAppUser> getUserById(@PathVariable("id") Long id); |
| | | |
| | | |
| | | |
| | | @PostMapping("/t-app-user/") |
| | | R updateAppUser(TAppUser appUser); |
| | | @PostMapping("/t-app-user/user/updateAppUser") |
| | | R updateAppUser(@RequestBody TAppUser appUser); |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-app-user/user/selectByPhone") |
| | | R<TAppUser> selectByPhone(@RequestParam("phone") String phone); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-user-integral-change/addAppUserIntegralChange") |
| | | R addAppUserIntegralChange(TAppUserIntegralChange appUserIntegralChange); |
| | | R addAppUserIntegralChange(@RequestBody TAppUserIntegralChange appUserIntegralChange); |
| | | } |
| | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "获得方式(1=积分兑换,2=现金购买)") |
| | | @TableField("ways_to_obtain") |
| | |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "当前领取优惠卷的json记录") |
| | | @TableField("coupon_json") |
| | | private String couponJson; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | @TableField("charge_num") |
| | | private Integer chargeNum; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "购买时折扣金额") |
| | | @TableField("discount_money") |
| | | private BigDecimal discountMoney; |
| | | |
| | | @ApiModelProperty(value = "该会员记录应赠送的充电次数") |
| | | @TableField("send_charge_num") |
| | | private Integer sendChargeNum; |
| | | |
| | | @ApiModelProperty(value = "会员id") |
| | | @TableField("vip_id") |
| | | private Integer vipId; |
| | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "已赠送的月份") |
| | | @TableField("send_month") |
| | | private Integer sendMonth; |
| | | |
| | | |
| | | @ApiModelProperty(value = "要赠送的优惠卷") |
| | | @TableField("coupon_ids") |
| | | private String couponIds; |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-gun/getAllName") |
| | | R<String> getAllName(Integer id); |
| | | @PostMapping("/t-charging-gun/getAllName/{id}") |
| | | R<String> getAllName(@PathVariable("id") Integer id); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-gun/getChargingGunById") |
| | | R<TChargingGun> getChargingGunById(Integer id); |
| | | @PostMapping("/t-charging-gun/getChargingGunById/{id}") |
| | | R<TChargingGun> getChargingGunById(@PathVariable("id") Integer id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty(value = "监控链接") |
| | | @TableField("url_link") |
| | | private String urlLink; |
| | | @ApiModelProperty(value = "状态 1=正常 0=离线") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "故障时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("faultTime") |
| | | private LocalDateTime faultTime; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "计费策略明细集合") |
| | | private List<TAccountingStrategyDetail> accountingStrategyDetailList; |
| | | |
| | | @ApiModelProperty(value = "一級审核人员") |
| | | private String firstUserName; |
| | | |
| | | @ApiModelProperty(value = "二級审核人员") |
| | | private String twoUserName; |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | 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.RequestParam; |
| | | |
| | |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-order-accounting-strategy/getTotalElectricQuantity") |
| | | R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | @PostMapping("/t-charging-order-accounting-strategy/getTotalElectricQuantity/{days}") |
| | | R<List<List<Map<String, Object>>>> getTotalElectricQuantity(@PathVariable("days") Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param days |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-order-getDailyChargingDegree-strategy/getUtilizationTrend") |
| | | R<List<Double>> getDailyChargingDegree(Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | @PostMapping("/t-charging-order-getDailyChargingDegree-strategy/getUtilizationTrend/{days}") |
| | | R<List<Double>> getDailyChargingDegree(@PathVariable("days") Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class NoticeQueryDto extends BasePage { |
| | | private String content; |
| | | @ApiModelProperty("0未开始1已开始2已结束") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.dto; |
| | | |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VipCouponDto { |
| | | private TCoupon tCoupon; |
| | | private Integer num; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.License; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | @Data |
| | | public class VipInfoDto { |
| | | |
| | | @ApiModelProperty("月卡价格") |
| | | private BigDecimal monthlyCard; |
| | | @ApiModelProperty("季卡价格") |
| | | private BigDecimal seasonCard; |
| | | @ApiModelProperty("年卡价格") |
| | | private BigDecimal annualCard; |
| | | @ApiModelProperty("最高抵扣价格") |
| | | private BigDecimal maximumDeduction; |
| | | @ApiModelProperty("抵扣次数") |
| | | private Integer discountTimes; |
| | | |
| | | @ApiModelProperty(value = "双倍积分开关(0=否,1=是)") |
| | | private Integer doubleIntegration; |
| | | |
| | | @ApiModelProperty(value = "商城专享价开关(0=否,1=是)") |
| | | private Integer mallExclusivePrice; |
| | | @ApiModelProperty(value = "可赠送的优惠卷列表") |
| | | |
| | | private List<VipCouponDto> vipCouponDtos; |
| | | |
| | | @ApiModelProperty(value = "最高总折扣") |
| | | private BigDecimal totalDiscount; |
| | | } |
| | |
| | | return new CouponClient() { |
| | | |
| | | @Override |
| | | public R<TCoupon> getCouponById(Integer id) { |
| | | public R<TCoupon> getCouponById1(Integer id) { |
| | | return R.fail("根据id获取优惠券信息失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | |
| | | import com.ruoyi.account.api.vo.CouponListVOVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import org.slf4j.Logger; |
| | |
| | | |
| | | @Override |
| | | public OtherClient create(Throwable throwable) { |
| | | log.error("商品调用失败:{}", throwable.getMessage()); |
| | | log.error("单位用失败:{}", throwable.getMessage()); |
| | | return new OtherClient() { |
| | | |
| | | @Override |
| | |
| | | public R<List<CouponListVOVO>> getCouponInfoByCouponIds(List<CouponListVOVO> list) { |
| | | return R.fail("我的优惠券列表获取信息:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TCoupon> getCouponById(Integer id) { |
| | | return R.fail("查询优惠卷:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.slf4j.Logger; |
| | |
| | | return R.fail("获取最高抵扣、最低起步价,最高折扣的会员失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | @Override |
| | | public R<TVip> getInfo(Integer type) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<TVip> getInfo1(Integer id) { |
| | |
| | | import com.ruoyi.other.api.factory.CouponFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-coupon/getCouponById") |
| | | R<TCoupon> getCouponById(Integer id); |
| | | @PostMapping("/t-coupon/getCouponById1/{id}") |
| | | R<TCoupon> getCouponById1(@PathVariable("id") Integer id); |
| | | } |
| | |
| | | import com.ruoyi.other.api.factory.GoodsFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-goods/getGoodsById") |
| | | R<TGoods> getGoodsById(Integer id); |
| | | @PostMapping("/t-goods/getGoodsById/{id}") |
| | | R<TGoods> getGoodsById(@PathVariable("id") Integer id); |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.factory.OtherFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | R<List<CouponListVOVO>> getCouponInfoByCouponIds(@RequestBody List<CouponListVOVO> list); |
| | | |
| | | |
| | | @PostMapping(value = "/t-coupon/getCouponById") |
| | | R<TCoupon> getCouponById(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-role-site/addRoleSite") |
| | | R addRoleSite(List<TRoleSite> roleSites); |
| | | R addRoleSite(@RequestBody List<TRoleSite> roleSites); |
| | | |
| | | /** |
| | | * 删除角色站点数据 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/t-role-site/delRoleSite") |
| | | R delRoleSite(Long roleId); |
| | | @DeleteMapping("/t-role-site/delRoleSite/{roleId}") |
| | | R delRoleSite(@PathVariable("roleId") Long roleId); |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-evaluation-tag/getListByIds") |
| | | R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds); |
| | | R<List<TEvaluationTag>> getListByIds(@RequestBody List<Integer> tagIds); |
| | | } |
| | |
| | | import com.ruoyi.other.api.factory.UserSiteFallbackFactory; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-user-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(Long userId); |
| | | @PostMapping("/t-user-site/getSiteIds/{userId}") |
| | | R<List<Integer>> getSiteIds(@PathVariable("userId") Long userId); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param userSite |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-user-site/getSiteIds") |
| | | R addUserSite(List<TUserSite> userSite); |
| | | @PostMapping("/t-user-site/addUserSite") |
| | | R addUserSite(@RequestBody List<TUserSite> userSite); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/t-user-site/delUserSite") |
| | | R delUserSite(Long userId); |
| | | @DeleteMapping("/t-user-site/delUserSite/{userId}") |
| | | R delUserSite(@PathVariable("userId") Long userId); |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.factory.VipFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | */ |
| | | @PostMapping("/vip/getInfo1") |
| | | public R<TVip> getInfo1(@RequestParam("id") Integer id); |
| | | @PostMapping(value = "/vip/getInfo") |
| | | R<TVip> getInfo(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public R addSysUser(SysUser user) { |
| | | return R.fail("添加用户失败:" + cause.getMessage()); |
| | | throw new RuntimeException("添加用户失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R resetPassword(SysUser user) { |
| | | return R.fail("重置用户密码失败:" + cause.getMessage()); |
| | | throw new RuntimeException("重置用户密码失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | * @param user |
| | | */ |
| | | @PostMapping("/user/addSysUser") |
| | | R addSysUser(SysUser user); |
| | | R addSysUser(@RequestBody SysUser user); |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/user/resetPassword") |
| | | R resetPassword(SysUser user); |
| | | R resetPassword(@RequestBody SysUser user); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户选择列表Query") |
| | | public class ChangeUserQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String nickName; |
| | | |
| | | } |
| | |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | <version>3.6.2</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | 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.feignClient.SysUserClient; |
| | |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * token 控制 |
| | |
| | | private SysLoginService sysLoginService; |
| | | @Resource |
| | | private SysUserClient userClient; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | sysLoginService.register(registerBody.getUsername(), registerBody.getPassword(), request); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"更换手机号获取验证码"}) |
| | | @GetMapping("getCode") |
| | | public AjaxResult getCode(@RequestParam("phone") String phone) |
| | | { |
| | | TAppUser appUser = appUserClient.selectByPhone(phone).getData(); |
| | | if (Objects.nonNull(appUser)){ |
| | | return AjaxResult.error("该手机号已绑定账号"); |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+Constants.APPLET,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public static final String DATE_FORMATTER_TIME = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String DATE_FORMATTER_DATE = "yyyy-MM-dd"; |
| | | |
| | | /** |
| | | * 后缀 |
| | | */ |
| | | public static final String APPLET = "_applet"; |
| | | /** |
| | | * 定时任务违规的字符 |
| | | */ |
New file |
| | |
| | | package com.ruoyi.common.core.constant; |
| | | |
| | | /** |
| | | * 短信常量 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class MsgConstants |
| | | { |
| | | /** 短信发送地址 */ |
| | | public static final String SEND_URL = "http://112.35.1.155:1992/sms/tmpsubmit"; |
| | | /** 更换手机号短信验证码 TEMPLATE_ID */ |
| | | public static final String CODE_TEMPLATE_ID = "5bf3949463e54c03a25c6fce3ad48139"; |
| | | |
| | | /** 停车占位提醒 TEMPLATE_ID */ |
| | | public static final String STOP_TEMPLATE_ID = "4940ce98a3f94f67aa9f5cd2d4e05cbd"; |
| | | |
| | | /** 充电结束 TEMPLATE_ID */ |
| | | public static final String CHARGE_TEMPLATE_ID = "47b2eb376cfa436faae041a6f2f22688"; |
| | | |
| | | /** 桩故障(自动/手动) TEMPLATE_ID */ |
| | | public static final String FAULT_TEMPLATE_ID = "37956469a14a47e484a747a1e7e462de"; |
| | | /** 更换手机号短信验证码 AP_ID */ |
| | | public static final String CODE_AP_ID = "GH123"; |
| | | |
| | | /** 停车占位提醒 AP_ID */ |
| | | public static final String STOP_AP_ID = "TC123"; |
| | | |
| | | /** 充电结束 AP_ID */ |
| | | public static final String CHARGE_AP_ID = "CD123"; |
| | | |
| | | /** 桩故障(自动/手动) AP_ID */ |
| | | public static final String FAULT_AP_ID = "GZ123"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | | import java.net.*; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | /** |
| | | * 通用http发送方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url) |
| | | { |
| | | return sendGet(url, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, String param) |
| | | { |
| | | return sendGet(url, param, Constants.UTF8); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @param contentType 编码类型 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, String param, String contentType) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | BufferedReader in = null; |
| | | try |
| | | { |
| | | String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; |
| | | log.info("sendGet - {}", urlNameString); |
| | | URL realUrl = new URL(urlNameString); |
| | | 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(); |
| | | in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送POST方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendPost(String url, String param) |
| | | { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | StringBuilder result = new StringBuilder(); |
| | | try |
| | | { |
| | | log.info("sendPost - {}", url); |
| | | URL realUrl = new 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)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("contentType", "utf-8"); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | out.print(param); |
| | | out.flush(); |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (out != null) |
| | | { |
| | | out.close(); |
| | | } |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (IOException ex) |
| | | { |
| | | log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static String sendSSLPost(String url, String param) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | String urlNameString = url + "?" + param; |
| | | try |
| | | { |
| | | log.info("sendSSLPost - {}", urlNameString); |
| | | SSLContext sc = SSLContext.getInstance("SSL"); |
| | | sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
| | | URL console = new URL(urlNameString); |
| | | HttpsURLConnection conn = (HttpsURLConnection) console.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)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("contentType", "utf-8"); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | |
| | | conn.setSSLSocketFactory(sc.getSocketFactory()); |
| | | conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); |
| | | conn.connect(); |
| | | InputStream is = conn.getInputStream(); |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(is)); |
| | | String ret = ""; |
| | | while ((ret = br.readLine()) != null) |
| | | { |
| | | if (ret != null && !"".equals(ret.trim())) |
| | | { |
| | | result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); |
| | | } |
| | | } |
| | | log.info("recv - {}", result); |
| | | conn.disconnect(); |
| | | br.close(); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static String post(String strURL, String params) { |
| | | String result = ""; |
| | | BufferedReader reader = null; |
| | | try { |
| | | URL url = new URL(strURL);// 创建连接 |
| | | HttpURLConnection connection = (HttpURLConnection) url |
| | | .openConnection(); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setUseCaches(false); |
| | | connection.setInstanceFollowRedirects(true); |
| | | connection.setRequestMethod("POST"); // 设置请求方式 |
| | | connection.setRequestProperty("Accept", "application/json"); // 设置接收数据的格式 |
| | | connection.setRequestProperty("Content-Type", "application/json"); // 设置发送数据的格式 |
| | | connection.connect(); |
| | | if (params != null && !StringUtils.isEmpty(params)) { |
| | | byte[] writebytes = params.getBytes(); |
| | | // 设置文件长度 |
| | | // connection.setRequestProperty("Content-Length", String.valueOf(writebytes.length)); |
| | | OutputStream outwritestream = connection.getOutputStream(); |
| | | outwritestream.write(params.getBytes()); |
| | | outwritestream.flush(); |
| | | outwritestream.close(); |
| | | // Log.d("hlhupload", "doJsonPost: conn"+connection.getResponseCode()); |
| | | } |
| | | if (connection.getResponseCode() == 200) { |
| | | log.info("<<<<<<<<<<<<<请求响应:{}", connection.getResponseMessage()); |
| | | reader = new BufferedReader( |
| | | new InputStreamReader(connection.getInputStream())); |
| | | result = reader.readLine(); |
| | | log.info("<<<<<<<<<<<<<请求响应:{}", result); |
| | | } else { |
| | | throw new ServiceException(connection.getResponseMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException("http的post请求异常!" + e.getMessage()); |
| | | } finally { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private static class TrustAnyTrustManager implements X509TrustManager |
| | | { |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[] {}; |
| | | } |
| | | } |
| | | |
| | | private static class TrustAnyHostnameVerifier implements HostnameVerifier |
| | | { |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | public class MD5Util { |
| | | |
| | | /** |
| | | * 给指定字符串按照md5算法去加密 |
| | | * |
| | | * @param psd 需要加密的密码 加盐处理 |
| | | * |
| | | * @return md5后的字符串 |
| | | */ |
| | | public static String encoder(String psd) { |
| | | try { |
| | | //加盐处理 |
| | | psd = psd + "mobilesafe"; |
| | | //1,指定加密算法类型 |
| | | MessageDigest digest = MessageDigest.getInstance("MD5"); |
| | | //2,将需要加密的字符串中转换成byte类型的数组,然后进行随机哈希过程 |
| | | byte[] bs = digest.digest(psd.getBytes()); |
| | | // System.out.println(bs.length); |
| | | //3,循环遍历bs,然后让其生成32位字符串,固定写法 |
| | | //4,拼接字符串过程 |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (byte b : bs) { |
| | | int i = b & 0xff; |
| | | //int类型的i需要转换成16机制字符 |
| | | String hexString = Integer.toHexString(i); |
| | | // System.out.println(hexString); |
| | | if (hexString.length() < 2) { |
| | | hexString = "0" + hexString; |
| | | } |
| | | stringBuffer.append(hexString); |
| | | } |
| | | //5,打印测试 |
| | | System.out.println(stringBuffer.toString()); |
| | | return stringBuffer.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * MD5加密字符串 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5(String str) { |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | md.update(str.getBytes()); |
| | | byte b[] = md.digest(); |
| | | int i; |
| | | StringBuffer buf = new StringBuffer(""); |
| | | for (int offset = 0; offset < b.length; offset++) { |
| | | i = b[offset]; |
| | | if (i < 0) |
| | | i += 256; |
| | | if (i < 16) |
| | | buf.append("0"); |
| | | buf.append(Integer.toHexString(i)); |
| | | } |
| | | //32位加密(小写) |
| | | return buf.toString(); |
| | | //32位加密(大写) |
| | | //return buf.toString().toUpperCase(); |
| | | // 16位的加密(小写) |
| | | //return buf.toString().substring(8, 24); |
| | | // 16位的加密(大写) |
| | | //return buf.toString().substring(8, 24).toUpperCase(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.req.SubmitTempletReq; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | |
| | | import java.util.concurrent.ThreadLocalRandom; |
| | | |
| | | public class MsgUtil { |
| | | |
| | | public final static String ecName= "四川明星新能源科技有限公司"; |
| | | public final static String secretKey= "MX_xny2023?9"; |
| | | public final static String sign= "1PUAVuY2b"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 更换手机号:【签名】验证码:XXX,用于更换手机号。请勿转发。 |
| | | * @param phone 手机号 |
| | | * @param code 验证码 |
| | | * @return |
| | | */ |
| | | public static String codeMsg(String phone,String code){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | String[] paramss = {code}; |
| | | submitReq.setApId(MsgConstants.CODE_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | submitReq.setTemplateId(MsgConstants.CODE_TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 停车占位提醒:车辆已在3小时前完成充电,请及时取车,避免长时间占用充电资源。 |
| | | * @param phone 手机号 |
| | | * @return |
| | | */ |
| | | public static String stopMsg(String phone){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | submitReq.setTemplateId(MsgConstants.STOP_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.STOP_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 充电结束:车辆充电结束,请及时取车。 |
| | | * @param phone 手机号 |
| | | * @return |
| | | */ |
| | | public static String chargeStopMsg(String phone){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | submitReq.setTemplateId(MsgConstants.CHARGE_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.CHARGE_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 桩故障(自动/手动):检测到【电站1】【编号】号桩设备离线,请及时查看处理! |
| | | * @param phone 手机号 |
| | | * @param site 站点名称 |
| | | * @param chargeGun 桩编号 |
| | | * @return |
| | | */ |
| | | public static String faultMsg(String phone,String site,String chargeGun){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | if(site.length()<=10){ |
| | | String[] paramss = {site,chargeGun}; |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | }else{ |
| | | String work1 = site.substring(0,10); |
| | | String[] paramss = {work1,chargeGun}; |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | } |
| | | submitReq.setTemplateId(MsgConstants.FAULT_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.FAULT_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | /** |
| | | * 生成验证码 |
| | | * @return |
| | | */ |
| | | public static String createCode(){ |
| | | return String.valueOf(ThreadLocalRandom.current().nextInt(100000, 999999)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils.req; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class SubmitTempletReq implements Serializable { |
| | | |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String ecName; |
| | | /** |
| | | * 接口账号用户名 |
| | | */ |
| | | private String apId; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String secretKey; |
| | | /** |
| | | * 模板ID。在云MAS平台创建模板,路径:『短信』→『模板短信』→『模板管理』,创建后提交审核,审核通过将获得模板ID。 |
| | | */ |
| | | private String templateId; |
| | | /** |
| | | * 收信手机号码。英文逗号分隔,每批次限5000个号码,例:“13800138000,13800138001,13800138002”。 |
| | | */ |
| | | private String mobiles; |
| | | /** |
| | | * 模板变量。格式:[“param1”,“param2”],无变量模板填[""] |
| | | */ |
| | | private String params; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 扩展码。依据开户时申请的服务代码匹配类型而定,如为精确匹配,此项填写空字符串("");如为模糊匹配,此项可填写空字符串或自定义的扩展码,注:服务代码加扩展码总长度不能超过20位。 |
| | | */ |
| | | private String addSerial; |
| | | /** |
| | | * 参数校验序列,生成方法:将ecName、apId、secretKey、templateId、mobiles、params、sign、addSerial按序拼接(无间隔符),通过MD5(32位小写)计算出的值。 |
| | | */ |
| | | private String mac; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.web.domain; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class BaseDelete { |
| | | |
| | | @ApiModelProperty(value = "id集合") |
| | | private List<Integer> ids; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.query.ChangeUserQuery; |
| | | import com.ruoyi.system.domain.dto.IndexDto; |
| | | import com.ruoyi.system.domain.vo.UserRoleVO; |
| | | import com.ruoyi.system.api.model.*; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取用户选择列表 |
| | | */ |
| | | @PostMapping("/getChangeUserList") |
| | | @ApiOperation(value = "获取用户选择列表", tags = {"管理后台-获取用户选择列表"}) |
| | | public AjaxResult<PageInfo<SysUser>> getChangeUserList(@RequestBody ChangeUserQuery query) { |
| | | return AjaxResult.success(userService.getChangeUserList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.query.ChangeUserQuery; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | |
| | | List<Long> getSysUserFromPhone(@Param("phoneNumber") String phoneNumber); |
| | | |
| | | void deleteSysUser(@Param("userIds") ArrayList<Integer> userIds); |
| | | |
| | | /** |
| | | * 获取用户选择列表 |
| | | * @param pageInfo |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<SysUser> getChangeUserList(@Param("pageInfo")PageInfo<SysUser> pageInfo,@Param("query") ChangeUserQuery query); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.query.ChangeUserQuery; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | |
| | | /** |
| | |
| | | |
| | | void deleteSysUser(ArrayList<Integer> userIds); |
| | | |
| | | /** |
| | | * 获取用户选择列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<SysUser> getChangeUserList(ChangeUserQuery query); |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.query.ChangeUserQuery; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.domain.SysUserPost; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | |
| | | this.baseMapper.deleteSysUser(userIds); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getChangeUserList(ChangeUserQuery query) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | List<SysUser> list = this.baseMapper.getChangeUserList(pageInfo, query); |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | } |
| | |
| | | <select id="getSysUserFromPhone" resultType="java.lang.Long"> |
| | | select user_id from sys_user where phonenumber =#{phoneNumber} |
| | | </select> |
| | | <select id="getChangeUserList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select |
| | | user_id AS userId, |
| | | nick_name AS nickName, |
| | | create_time AS createTime, |
| | | remark AS remark |
| | | from sys_user |
| | | <where> |
| | | <if test="query.nickName != null and query.nickName != ''"> |
| | | AND nick_name LIKE concat('%',#{query.nickName},'%') |
| | | </if> |
| | | AND del_flag = '0' |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | <insert id="insertUser" parameterType="com.ruoyi.system.api.domain.SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | <insert id="insertUser" parameterType="com.ruoyi.system.api.domain.SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into sys_user( |
| | | <if test="userId != null and userId != 0">user_id,</if> |
| | | <if test="deptId != null and deptId != 0">dept_id,</if> |
| | |
| | | * 支付宝配置 |
| | | */ |
| | | public static final String GRANT_TYPE = "authorization_code"; |
| | | |
| | | /** |
| | | * 获取token接口地址 |
| | | */ |
| | | public static final String LOGIN_SERVER_URL = "https://openapi.alipay.com/gateway.do"; |
| | | } |
| | |
| | | package com.ruoyi.account.ali.tools; |
| | | |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.AlipayConfig; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.request.AlipaySystemOauthTokenRequest; |
| | | import com.alipay.api.request.AlipayUserUserinfoShareRequest; |
| | | import com.alipay.api.response.AlipaySystemOauthTokenResponse; |
| | | import com.alipay.api.response.AlipayUserUserinfoShareResponse; |
| | | import com.ruoyi.account.ali.Constant.AliConstant; |
| | | import com.ruoyi.account.ali.model.AliProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | @Slf4j |
| | | public class AliAppletTools { |
| | | |
| | | private static final String SERVER_URL = "https://openapi.alipay.com/gateway.do"; |
| | | |
| | | //设置连接池中的最大可缓存的空闲连接数 |
| | | private static final Integer MaxIdleConnections = 5; |
| | | //连接超时,单位:毫秒,默认3000 |
| | | private static final Integer ConnectTimeout = 3000; |
| | | //读取超时,单位:毫秒,默认15000 |
| | | private static final Integer ReadTimeout = 15000; |
| | | //空闲连接存活时间,单位:毫秒,默认10000L |
| | | private static final Long KeepAliveDuration = 10000L; |
| | | private AliProperties aliProperties; |
| | | |
| | | public AliAppletTools(AliProperties aliProperties) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 支付宝小程序授权登录接口 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public AlipaySystemOauthTokenResponse login(String code) { |
| | | try { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(new AliAppletTools(aliProperties).getAlipayConfig(AliConstant.LOGIN_SERVER_URL)); |
| | | // 构造请求参数以调用接口 |
| | | AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest(); |
| | | // 设置授权码 |
| | | request.setCode(code); |
| | | // 设置授权方式 |
| | | request.setGrantType(AliConstant.GRANT_TYPE); |
| | | return alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 支付宝小程序授权获取手机号 |
| | | * @return |
| | | */ |
| | | public AlipayUserUserinfoShareResponse getUserInfo(String accessToken) { |
| | | try { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(new AliAppletTools(aliProperties).getAlipayConfig(AliConstant.LOGIN_SERVER_URL)); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.user.userinfo.share |
| | | AlipayUserUserinfoShareRequest request = new AlipayUserUserinfoShareRequest(); |
| | | //授权类接口执行API调用时需要带上accessToken |
| | | return alipayClient.execute(request,accessToken); |
| | | } catch (AlipayApiException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化支付宝配置 |
| | | * @return |
| | | */ |
| | | public AlipayConfig getAlipayConfig() { |
| | | public AlipayConfig getAlipayConfig(String serverUrl) { |
| | | AlipayConfig alipayConfig = new AlipayConfig(); |
| | | alipayConfig.setServerUrl(SERVER_URL); |
| | | alipayConfig.setServerUrl(serverUrl); |
| | | alipayConfig.setAppId(aliProperties.getAppId()); |
| | | alipayConfig.setPrivateKey(aliProperties.getPrivateKey()); |
| | | alipayConfig.setAlipayPublicKey(aliProperties.getAlipayPublicKey()); |
| | | alipayConfig.setMaxIdleConnections(MaxIdleConnections); |
| | | alipayConfig.setConnectTimeout(ConnectTimeout); |
| | | alipayConfig.setReadTimeout(ReadTimeout); |
| | | alipayConfig.setKeepAliveDuration(KeepAliveDuration); |
| | | return alipayConfig; |
| | | } |
| | | |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | // 获取登录信息 |
| | | // LoginUser loginUser = tokenService.getLoginUser(); |
| | | // String userName = loginUser.getUsername(); |
| | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | // this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | // 获取登录信息 |
| | | // LoginUser loginUser = tokenService.getLoginUser(); |
| | | // System.err.println(loginUser); |
| | |
| | | import com.alipay.api.diagnosis.DiagnosisUtils; |
| | | import com.alipay.api.request.AlipaySystemOauthTokenRequest; |
| | | import com.alipay.api.response.AlipaySystemOauthTokenResponse; |
| | | import com.alipay.api.response.AlipayUserUserinfoShareResponse; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.ali.Constant.AliConstant; |
| | |
| | | private AliProperties aliProperties; |
| | | @Autowired |
| | | private TAppUserService appUserService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @ApiOperation(value = "通过code获得openid",tags = {"支付宝小程序登录"}) |
| | | @GetMapping("/openIdByJsCode") |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestParam(name = "code")@ApiParam(value = "code", required = true) String code) throws AlipayApiException { |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestParam(name = "code")@ApiParam(value = "code", required = true) String code){ |
| | | log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", code); |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(new AliAppletTools(aliProperties).getAlipayConfig()); |
| | | // 构造请求参数以调用接口 |
| | | AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest(); |
| | | // 设置授权码 |
| | | request.setCode(code); |
| | | // 设置授权方式 |
| | | request.setGrantType(AliConstant.GRANT_TYPE); |
| | | AlipaySystemOauthTokenResponse response = alipayClient.execute(request); |
| | | TAppUser appUser = null; |
| | | // 登录 |
| | | AlipaySystemOauthTokenResponse response = new AliAppletTools(aliProperties).login(code); |
| | | if (response.isSuccess()) { |
| | | String openId = response.getOpenId(); |
| | | appUser = appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class).eq(TAppUser::getAliOpenid, openId).last("limit 1")); |
| | | if (Objects.isNull(appUser)) { |
| | | appUser = new TAppUser(); |
| | | appUser.setWxOpenid(openId); |
| | | appUserService.save(appUser); |
| | | } |
| | | log.info("支付宝小程序登录调用成功"); |
| | | // 获取用户信息 |
| | | AlipayUserUserinfoShareResponse userInfo = new AliAppletTools(aliProperties).getUserInfo(response.getAccessToken()); |
| | | log.info("获取支付宝用户信息:{}", userInfo); |
| | | // 用户信息封装 |
| | | return AjaxResult.ok(appUserService.aliLogin(response,userInfo)); |
| | | } else { |
| | | String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response); |
| | | log.warn("诊断结果:{}",diagnosisUrl); |
| | | throw new ServiceException("支付宝小程序登录失败"); |
| | | } |
| | | LoginUserApplet loginUserApplet = new LoginUserApplet(); |
| | | if(ObjectUtils.isNotNull(appUser)){ |
| | | loginUserApplet.setUserId(appUser.getId()); |
| | | } |
| | | HashMap<String, Object> tokenInfos = new HashMap<>(); |
| | | tokenInfos.put("token",tokenService.createTokenApplet(loginUserApplet)); |
| | | tokenInfos.put("info",loginUserApplet); |
| | | return AjaxResult.ok(tokenInfos); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.vo.SiteInfoVO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | |
| | | public class TAppCouponController { |
| | | @Autowired |
| | | private TAppCouponService tAppCouponService; |
| | | @Autowired |
| | | private OtherClient otherClient; |
| | | |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | |
| | | * @return 优惠券ids 查询每个优惠券的发放数量 |
| | | */ |
| | | @PostMapping("/getCountByCouponIds") |
| | | public R<List<Integer>> getCountByCouponIds(String couponIds) { |
| | | public R<List<Integer>> getCountByCouponIds(@RequestParam("couponIds") String couponIds) { |
| | | // 最终结果 和优惠券id一一对应 |
| | | List<Integer> res = new ArrayList<>(); |
| | | String[] split = couponIds.split(","); |
| | |
| | | import com.ruoyi.account.service.TAppUserAddressService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public class TAppUserAddressController { |
| | | |
| | | private final TAppUserAddressService appUserAddressService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TAppUserAddressController(TAppUserAddressService appUserAddressService) { |
| | | public TAppUserAddressController(TAppUserAddressService appUserAddressService, TokenService tokenService) { |
| | | this.appUserAddressService = appUserAddressService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户地址列表") |
| | | @GetMapping(value = "/queryAddress") |
| | | public AjaxResult<List<TAppUserAddress>> queryAddress() { |
| | | // TODO 用户id |
| | | return AjaxResult.ok(appUserAddressService.list(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, null))); |
| | | // 用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | return AjaxResult.ok(appUserAddressService.list(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId))); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "添加用户地址") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TAppUserAddress dto) { |
| | | // TODO 用户id |
| | | // 用户id |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | // 修改用户默认地址 |
| | | appUserAddressService.updateDefaultAddress(dto.getDefaultAddress(),dto.getAppUserId()); |
| | | return AjaxResult.ok(appUserAddressService.save(dto)); |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | |
| | | import com.ruoyi.account.wx.body.resq.Code2SessionResqBody; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.tools.WxAppletTools; |
| | | import com.ruoyi.account.util.GiveVipUtil; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.weaver.loadtime.Aj; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | @Autowired |
| | | private WeixinProperties wxConfig; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | |
| | | @Resource |
| | | private TAppUserSignService signService; |
| | | @Resource |
| | | private TAppCouponService appCouponService; |
| | | @Resource |
| | | private TAppUserCarService carService; |
| | | |
| | | |
| | | @ApiOperation(value = "查询当前用户是否为会员 0否1是", tags = {"小程序--查询当前用户是否为会员"}) |
| | | @PostMapping(value = "/getUserInfo") |
| | |
| | | return AjaxResult.ok(0); |
| | | } |
| | | } |
| | | @ApiOperation(value = "通过code获得openid, 1 --->对应的appid:wx4c405fa42539fc21 2---->对应的appid:wx02d9f6c92e6d3c86") |
| | | @GetMapping("openId-by-jscode2session/{code}") |
| | | public AjaxResult<Map<String, Object>> jscode2session(@PathVariable String code) { |
| | | log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", code); |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(code)); |
| | | String openid = body.getOpenid(); |
| | | String sessionKey = body.getSessionKey(); |
| | | TAppUser appUser = appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class).eq(TAppUser::getWxOpenid, openid).last("limit 1")); |
| | | if (Objects.isNull(appUser)) { |
| | | appUser = new TAppUser(); |
| | | appUser.setWxOpenid(openid); |
| | | appUserService.save(appUser); |
| | | } |
| | | // 提前对sessionKey进行删除 |
| | | log.info("换取sessionKey:{}", sessionKey); |
| | | // 将sessionKey进行存储,后续获取信息需要 |
| | | redisService.setCacheObject(openid, sessionKey); |
| | | LoginUserApplet loginUserApplet = new LoginUserApplet(); |
| | | if(ObjectUtils.isNotNull(appUser)){ |
| | | loginUserApplet.setUserId(appUser.getId()); |
| | | } |
| | | HashMap<String, Object> tokenInfos = new HashMap<>(); |
| | | tokenInfos.put("token",tokenService.createTokenApplet(loginUserApplet)); |
| | | tokenInfos.put("info",loginUserApplet); |
| | | return AjaxResult.ok(tokenInfos); |
| | | } |
| | | |
| | | @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"}) |
| | | @PostMapping(value = "/user/getUserIdsByPhone") |
| | | public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone) { |
| | | return R.ok(appUserService.list(new QueryWrapper<TAppUser>().like("phone",phone)).stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | } |
| | | @Resource |
| | | private GiveVipUtil giveVipUtil; |
| | | @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/page") |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | |
| | | return R.ok(data); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "单位下拉框", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/select") |
| | | public R<List<TCompany>> unitSelect() { |
| | | UnitListQueryDto unitListQueryDto = new UnitListQueryDto(); |
| | | unitListQueryDto.setPageCurr(1); |
| | | unitListQueryDto.setPageSize(9999); |
| | | //拿到单位列表 |
| | | R<Page<TCompany>> pageR = otherClient.queryUnitPage(unitListQueryDto); |
| | | |
| | | return R.ok(pageR.getData().getRecords()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "单位管理添加或编辑", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/addOrUpdate") |
| | | public R add(@RequestBody TCompany tCompany) { |
| | |
| | | otherClient.unitAddorUpadate(tCompany); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "单位管理删除", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/delete/{id}") |
| | | public R add(@PathVariable Integer id) { |
| | | otherClient.unitDelete(id); |
| | | @DeleteMapping(value = "/unit/delete") |
| | | public R add(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | otherClient.unitDelete(Integer.valueOf(s)); |
| | | } |
| | | return R.ok(); |
| | | |
| | | } |
| | |
| | | return R.ok(userDetailDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"用户管理-用户列表"}) |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表","小程序-个人中心"}) |
| | | @PostMapping(value = "/user/points/page") |
| | | public R<Page<TAppUserIntegralChange>> pointsDetail(@RequestBody PointsQueryDto pointsQueryDto) { |
| | | List<Integer> types = new ArrayList<>(); |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"用户管理-用户列表"}) |
| | | @ApiOperation(value = "冻结解冻用户", tags = {"后台-用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/status/change") |
| | | public R pointsDetail(@RequestBody UserChangeDto userChangeDto) { |
| | | TAppUser appUser = appUserService.getById(userChangeDto.getUserId()); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "个人中心信息", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/info") |
| | | public R<AppUserInfoDto> info() { |
| | | Long userId = 1L; |
| | | TAppUser byId = appUserService.getById(userId); |
| | | AppUserInfoDto appUserInfoDto = new AppUserInfoDto(); |
| | | |
| | | //判断会员 |
| | | if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){ |
| | | appUserInfoDto.setIsVip(0); |
| | | }else { |
| | | appUserInfoDto.setIsVip(1); |
| | | appUserInfoDto.setVipExpireTime(byId.getVipEndTime()); |
| | | } |
| | | //判断当天是否签到 |
| | | Long count = signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).count(); |
| | | appUserInfoDto.setIsSign(count>0?1:0); |
| | | //获取当前拥有的优惠卷数量 |
| | | Long coupons = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).eq(TAppCoupon::getStatus, 1).count(); |
| | | appUserInfoDto.setCouponNum(Math.toIntExact(coupons)); |
| | | //当前绑定的车辆 |
| | | List<TAppUserCar> list = carService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).list(); |
| | | appUserInfoDto.setUserCars(list); |
| | | return R.ok(appUserInfoDto); |
| | | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/coupon") |
| | | public R<List<InfoCouponDto>> userCoupon(@RequestParam("type") Integer type) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | List<InfoCouponDto> couponDtos = new ArrayList<>(); |
| | | List<TAppCoupon> list = appCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, type).list(); |
| | | for (TAppCoupon tAppCoupon : list) { |
| | | TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon,infoCouponDto); |
| | | couponDtos.add(infoCouponDto); |
| | | |
| | | } |
| | | |
| | | |
| | | return R.ok(couponDtos); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "赠送会员", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/give/vip") |
| | | public R giveVip(@RequestBody GiveVipDto giveVipDto) { |
| | | TAppUser nowUser = appUserService.getById(giveVipDto.getUserId()); |
| | | |
| | | |
| | | //如果vipEndTime为空或已过期,直接增加 |
| | | if (nowUser.getVipEndTime()==null||nowUser.getVipEndTime().isBefore(LocalDateTime.now())) { |
| | | if (giveVipDto.getType() == 1) { |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusDays(31)); |
| | | //直接增加vipDetail |
| | | } else if (giveVipDto.getType() == 2) { |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusDays(93)); |
| | | } else if (giveVipDto.getType() == 3) { |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusDays(365)); |
| | | } |
| | | //直接赠送优惠卷 |
| | | }else { |
| | | if (giveVipDto.getType() == 1) { |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(31)); |
| | | //如果有这个类型的vip,累加,没有的话,从entTime新增 |
| | | } else if (giveVipDto.getType() == 2) { |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(93)); |
| | | } else if (giveVipDto.getType() == 3) { |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(365)); |
| | | } |
| | | int plusDay = 0; |
| | | if (giveVipDto.getType() == 1) { |
| | | plusDay = 1; |
| | | } else if (giveVipDto.getType() == 2) { |
| | | plusDay = 3; |
| | | } else if (giveVipDto.getType() == 3) { |
| | | plusDay = 12; |
| | | } |
| | | //增加vipDetail |
| | | giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay); |
| | | |
| | | |
| | | |
| | | appUserService.updateById(nowUser); |
| | | //执行一次赠送优惠卷的定时任务 |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | | public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.APPLET); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | | if(!code.equals(dto.getCode())){ |
| | | return AjaxResult.error("验证码错误!"); |
| | | } |
| | | // 获取当前用户信息 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserService.getById(userId); |
| | | appUser.setPhone(dto.getPhone()); |
| | | appUserService.updateById(appUser); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok(appUserService.list(Wrappers.<TAppUser>lambdaQuery().in(TAppUser::getId,appUserIds))); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取用户 |
| | | * @param id |
| | |
| | | TAppUser appUser = appUserService.getById(id); |
| | | return R.ok(appUser); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * @param appUser |
| | |
| | | appUserService.updateById(appUser); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/selectByPhone") |
| | | public R<TAppUser> selectByPhone(@RequestParam("phone") String phone){ |
| | | return R.ok(appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone,phone) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | |
| | | // @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | // @PostMapping(value = "/user/sign") |
| | | // public R sign() { |
| | | // |
| | | // } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "标签删除", tags = {"用户管理-用户标签管理"}) |
| | | @PostMapping(value = "/tags/delete/{id}") |
| | | public R delete(@PathVariable Integer id) { |
| | | @DeleteMapping(value = "/tags/delete") |
| | | public R delete(@PathVariable String ids) { |
| | | //拿到单位列表 |
| | | otherClient.deleteTag(id); |
| | | String[] split = ids.split(","); |
| | | for (String id : split) { |
| | | otherClient.deleteTag(Integer.valueOf(id)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | } |
| | | AppletUserDecodeData appletUserDecodeData = WxUtils.encryptedData(data.getEncryptedData(), sessionKey, data.getIv()); |
| | | appletUserDecodeData.setOpenId(openid); |
| | | return AjaxResult.ok(appUserService.login(appletUserDecodeData)); |
| | | return AjaxResult.ok(appUserService.wxLogin(appletUserDecodeData)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.alipay.api.response.AlipaySystemOauthTokenResponse; |
| | | import com.alipay.api.response.AlipayUserUserinfoShareResponse; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.wx.pojo.AppletUserDecodeData; |
| | |
| | | * @param appletUserDecodeData |
| | | * @return |
| | | */ |
| | | Map<String, Object> login(AppletUserDecodeData appletUserDecodeData); |
| | | Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData); |
| | | |
| | | /** |
| | | * 支付宝小程序登录用户封装 |
| | | * @param userInfo |
| | | * @return |
| | | */ |
| | | Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response,AlipayUserUserinfoShareResponse userInfo); |
| | | |
| | | /** |
| | | * 封装用户信息和token |
| | | * @param appUser |
| | | * @return |
| | | */ |
| | | Map<String, Object> getUserInfo(TAppUser appUser); |
| | | } |
| | |
| | | */ |
| | | public interface TAppUserVipDetailService extends IService<TAppUserVipDetail> { |
| | | |
| | | void giveVipCoupun(Long appUserId, Integer vipId,Long recordId,Integer monthNum); |
| | | } |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.alipay.api.response.AlipaySystemOauthTokenResponse; |
| | | import com.alipay.api.response.AlipayUserUserinfoShareResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Override |
| | | public Map<String, Object> login(AppletUserDecodeData appletUserDecodeData) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户 |
| | | public Map<String, Object> wxLogin(AppletUserDecodeData appletUserDecodeData) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户,包含支付宝用户 |
| | | TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) |
| | | .isNull(TAppUser::getWxOpenid) |
| | | .last("LIMIT 1")); |
| | | LambdaQueryWrapper<TAppUser> wrapper = Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getWxOpenid, appletUserDecodeData.getOpenId()); |
| | | if(Objects.isNull(appUser)){ |
| | | // 先使用openId和当前手机号进行查询 |
| | | wrapper.eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) |
| | | .last("LIMIT 1"); |
| | | appUser = this.getOne(wrapper); |
| | | appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getWxOpenid, appletUserDecodeData.getOpenId()) |
| | | .eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(appUser)){ |
| | | appUser = new TAppUser(); |
| | | appUser.setPhone(appletUserDecodeData.getPhoneNumber()); |
| | | } |
| | | }else { |
| | | wrapper.last("LIMIT 1"); |
| | | // 删除小程序原有授权用户 |
| | | this.remove(wrapper); |
| | | } |
| | | appUser.setAvatar(appletUserDecodeData.getAvatarUrl()); |
| | | appUser.setCity(appletUserDecodeData.getCity()); |
| | |
| | | appUser.setProvince(appletUserDecodeData.getProvince()); |
| | | appUser.setWxOpenid(appletUserDecodeData.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | | return this.getUserInfo(appUser); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> aliLogin(AlipaySystemOauthTokenResponse response, AlipayUserUserinfoShareResponse userInfo) { |
| | | // 通过手机号查询用户,是否已存在手动导入用户,包含微信用户 |
| | | TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone, userInfo.getMobile()) |
| | | .isNull(TAppUser::getAliOpenid) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(appUser)){ |
| | | // 先使用openId和当前手机号进行查询 |
| | | appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getAliOpenid, response.getOpenId()) |
| | | .eq(TAppUser::getPhone, userInfo.getMobile()) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(appUser)){ |
| | | appUser = new TAppUser(); |
| | | appUser.setPhone(userInfo.getMobile()); |
| | | } |
| | | } |
| | | appUser.setAvatar(userInfo.getAvatar()); |
| | | appUser.setCity(userInfo.getCity()); |
| | | appUser.setName(userInfo.getNickName()); |
| | | appUser.setProvince(userInfo.getProvince()); |
| | | appUser.setAliOpenid(response.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | | return this.getUserInfo(appUser); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getUserInfo(TAppUser appUser) { |
| | | LoginUserApplet loginUserApplet = new LoginUserApplet(); |
| | | if(ObjectUtils.isNotNull(appUser)){ |
| | | loginUserApplet.setUserId(appUser.getId()); |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendCouponDto; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.mapper.TAppUserVipDetailMapper; |
| | | |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService { |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private TAppCouponService appCouponService; |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void giveVipCoupun(Long appUserId, Integer vipId,Long recordId,Integer monthNum) { |
| | | //如果不包含,则更新sendNum,并且赠送优惠卷 |
| | | TAppUserVipDetail byId = tAppUserVipDetailService.getById(recordId); |
| | | if (byId.getStartTime().plusMonths(byId.getSendMonth()).toLocalDate().compareTo(LocalDate.now())==0&&LocalDate.now().isBefore(byId.getEndTime().toLocalDate())){ |
| | | byId.setSendMonth(byId.getSendMonth()+1); |
| | | //给这个用户发放对应vip的优惠卷以及充电次数加满 |
| | | List<SendCouponDto> javaList = JSON.parseArray(byId.getCouponIds()).toJavaList(SendCouponDto.class); |
| | | for (SendCouponDto sendCouponDto : javaList) { |
| | | Integer number = sendCouponDto.getNumber(); |
| | | for (Integer i = 0; i < number; i++) { |
| | | R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId()); |
| | | TCoupon coupon = couponById.getData(); |
| | | //将该优惠卷添加到用户优惠卷中 |
| | | TAppCoupon tAppCoupon = new TAppCoupon(); |
| | | tAppCoupon.setAppUserId(appUserId); |
| | | tAppCoupon.setCouponId(sendCouponDto.getId()); |
| | | if (coupon.getValidityPeriodMode() == 1) { |
| | | tAppCoupon.setEndTime(coupon.getEndTime()); |
| | | } else { |
| | | tAppCoupon.setEndTime(LocalDateTime.now().plusDays(coupon.getDays())); |
| | | } |
| | | tAppCoupon.setWaysToObtain(4); |
| | | tAppCoupon.setStatus(1); |
| | | tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); |
| | | appCouponService.save(tAppCoupon); |
| | | } |
| | | } |
| | | |
| | | } |
| | | byId.setChargeNum(byId.getSendChargeNum()); |
| | | tAppUserVipDetailService.updateById(byId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.task; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 定时任务工具类 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void sendVipCoupon(){ |
| | | try { |
| | | //首先获取当前的月份,用int类型标识 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | int monthNum = currentDate.getMonthValue(); |
| | | //获取在当前时间内生效的vipDetail |
| | | List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery() |
| | | .ge(TAppUserVipDetail::getStartTime, currentDate) |
| | | .le(TAppUserVipDetail::getEndTime, currentDate) |
| | | .orderByDesc(TAppUserVipDetail::getStartTime).list(); |
| | | //判断sendNum是否包括当前月份 |
| | | for (TAppUserVipDetail recentDetail : recentDetails) { |
| | | |
| | | //赠送优惠卷 |
| | | tAppUserVipDetailService.giveVipCoupun(recentDetail.getAppUserId(), recentDetail.getVipId(),recentDetail.getId(),monthNum); |
| | | |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.ruoyi.account.api.dto.SendCouponDto; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class GiveVipUtil { |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private TAppCouponService appCouponService; |
| | | public void sendVip(TAppUser nowUser,Integer vipId,Integer plusDay){ |
| | | if (nowUser.getVipEndTime()==null||nowUser.getVipEndTime().isBefore(LocalDateTime.now())) { |
| | | |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusMonths(plusDay)); |
| | | |
| | | //直接再detail里新增数据,因为不是续费 |
| | | TAppUserVipDetail tAppUserVipDetail = new TAppUserVipDetail(); |
| | | tAppUserVipDetail.setAppUserId(nowUser.getId()); |
| | | tAppUserVipDetail.setStartTime(LocalDateTime.now()); |
| | | tAppUserVipDetail.setEndTime(LocalDateTime.now().plusMonths(plusDay).minusDays(1)); |
| | | tAppUserVipDetail.setVipId(vipId); |
| | | |
| | | R<TVip> info = vipClient.getInfo(vipId); |
| | | TVip vip = info.getData(); |
| | | List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class); |
| | | |
| | | tAppUserVipDetail.setCouponIds(vip.getCoupon()); |
| | | tAppUserVipDetail.setSendChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail.setChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail.setDiscountMoney(vip.getMaximumDeduction()); |
| | | tAppUserVipDetail.setSendMonth(1); |
| | | tAppUserVipDetailService.save(tAppUserVipDetail); |
| | | //直接赠送优惠卷 |
| | | for (SendCouponDto sendCouponDto : javaList) { |
| | | Integer number = sendCouponDto.getNumber(); |
| | | for (Integer i = 0; i < number; i++) { |
| | | |
| | | |
| | | R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId()); |
| | | TCoupon coupon = couponById.getData(); |
| | | //将该优惠卷添加到用户优惠卷中 |
| | | TAppCoupon tAppCoupon = new TAppCoupon(); |
| | | tAppCoupon.setAppUserId(nowUser.getId()); |
| | | tAppCoupon.setCouponId(Integer.valueOf(sendCouponDto.getId())); |
| | | if (coupon.getValidityPeriodMode() == 1) { |
| | | tAppCoupon.setEndTime(coupon.getEndTime()); |
| | | } else { |
| | | tAppCoupon.setEndTime(LocalDateTime.now().plusDays(coupon.getDays())); |
| | | } |
| | | tAppCoupon.setWaysToObtain(4); |
| | | tAppCoupon.setStatus(1); |
| | | tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); |
| | | appCouponService.save(tAppCoupon); |
| | | } |
| | | } |
| | | |
| | | |
| | | }else { |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay)); |
| | | //获取detail里结束时间大于当前时间的数据,并将enttime延长 |
| | | TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | |
| | | // TAppUserVipDetail newAppUser = new TAppUserVipDetail(); |
| | | // newAppUser.setAppUserId(nowUser.getId()); |
| | | // newAppUser.setStartTime(tAppUserVipDetail.getEndTime()); |
| | | tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | // newAppUser.setVipId(vipId); |
| | | tAppUserVipDetailService.updateById(tAppUserVipDetail); |
| | | // tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusDays(plusDay)); |
| | | // tAppUserVipDetailService.updateById(tAppUserVipDetail); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.account.service.TAppUserIntegralChangeService; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Component |
| | | public class PointDetailUtil { |
| | | @Resource |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | public void addDetail(Integer old,Integer now,Integer type,Long userId,String extension,String code){ |
| | | |
| | | TAppUserIntegralChange tAppUserIntegralChange= new TAppUserIntegralChange(); |
| | | tAppUserIntegralChange.setCode(code); |
| | | tAppUserIntegralChange.setAppUserId(userId); |
| | | tAppUserIntegralChange.setChangeType(type); |
| | | tAppUserIntegralChange.setHistoricalIntegral(old); |
| | | tAppUserIntegralChange.setCurrentIntegral(now); |
| | | tAppUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | tAppUserIntegralChange.setExtension(extension); |
| | | appUserIntegralChangeService.save(tAppUserIntegralChange); |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | private RestTemplate wxRestTemplate; |
| | | private WxCacheTemplate<String> wxCacheTemplate; |
| | | |
| | | public WxAppletTools(RestTemplate wxRestTemplate, WeixinProperties wxConfig, WxCaffineCache wxCacheTemplate) { |
| | | this.wxRestTemplate = wxRestTemplate; |
| | | this.wxCacheTemplate = wxCacheTemplate; |
| | | this.wxConfig = wxConfig; |
| | | } |
| | | |
| | | public WxAppletTools(RestTemplate wxRestTemplate, WeixinProperties wxConfig) { |
| | | this.wxRestTemplate = wxRestTemplate; |
| | | this.wxConfig = wxConfig; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | @Autowired |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TAccountingStrategy> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(accountingStrategyService.getById(id)); |
| | | public AjaxResult<TAccountingStrategyVO> getDetailById(@RequestParam("id") Integer id) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); |
| | | TAccountingStrategyVO accountingStrategyVO = new TAccountingStrategyVO(); |
| | | BeanUtils.copyProperties(accountingStrategy,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | String firstUserName = sysUserClient.getSysUser(accountingStrategy.getFirstUserId()).getData().getNickName(); |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | return AjaxResult.ok(accountingStrategyVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "批量删除计费策略") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .in(TAccountingStrategyDetail::getAccountingStrategyId, ids)); |
| | | return AjaxResult.ok(accountingStrategyService.removeByIds(ids)); |
| | | .in(TAccountingStrategyDetail::getAccountingStrategyId, Arrays.asList(split))); |
| | | return AjaxResult.success(accountingStrategyService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return AjaxResult.ok(accountingStrategyService.pageList(query)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingQuery; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingRemarkDto; |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | | import com.ruoyi.chargingPile.api.vo.TCarportVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.service.TApplyChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class TApplyChargingPileController { |
| | | |
| | | private final TApplyChargingPileService applyChargingPileService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService) { |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService) { |
| | | this.applyChargingPileService = applyChargingPileService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(tags = {"小程序-建桩申请"},value = "建桩申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPile dto) { |
| | | // TODO 用户id |
| | | dto.setAppUserId(null); |
| | | // 用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | dto.setAppUserId(userId); |
| | | return AjaxResult.ok(applyChargingPileService.save(dto)); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "列表") |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Page<TApplyChargingPile>> page(ApplyChargingQuery applyChargingQuery) { |
| | | // TODO 用户id |
| | | Page<TApplyChargingPile> page = applyChargingPileService.lambdaQuery() |
| | | .like(applyChargingQuery.getName() != null && !applyChargingQuery.getName().equals(""), TApplyChargingPile::getAgentPhone, applyChargingQuery.getName()) |
| | | .page(Page.of(applyChargingQuery.getPageCurr(), applyChargingQuery.getPageSize())); |
| | |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "批量删除车库") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 刪除车道信息 |
| | | vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class) |
| | | .in(TVehicleRamp::getCarportId, ids)); |
| | | return AjaxResult.ok(carportService.removeByIds(ids)); |
| | | .in(TVehicleRamp::getCarportId, Arrays.asList(split))); |
| | | return AjaxResult.ok(carportService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "批量删除充电枪") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | return AjaxResult.ok(chargingGunService.removeByIds(ids)); |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | return AjaxResult.ok(chargingGunService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO; |
| | | import com.ruoyi.chargingPile.service.TMonitoringEquipmentService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除监控", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "批量删除监控") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | return AjaxResult.ok(monitoringEquipmentService.removeByIds(ids)); |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | return AjaxResult.ok(monitoringEquipmentService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "批量删除停车场") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 刪除车道信息 |
| | | vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class) |
| | | .in(TVehicleRamp::getParkingLotId, ids)); |
| | | .in(TVehicleRamp::getParkingLotId, Arrays.asList(split))); |
| | | // 删除车库信息 |
| | | carportService.remove(Wrappers.lambdaQuery(TCarport.class) |
| | | .in(TCarport::getParkingLotId, ids)); |
| | | return AjaxResult.ok(parkingLotService.removeByIds(ids)); |
| | | .in(TCarport::getParkingLotId, Arrays.asList(split))); |
| | | return AjaxResult.ok(parkingLotService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.chargingPile.api.model.TVehicleRamp; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "批量删除车道") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | return AjaxResult.ok(vehicleRampService.removeByIds(ids)); |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | return AjaxResult.ok(vehicleRampService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | /** |
| | |
| | | user.setRoleId(partner.getRoleId().longValue()); |
| | | user.setRoleType(2); |
| | | user.setObjectId(partner.getId()); |
| | | R r = sysUserClient.addSysUser(user); |
| | | if(200 != r.getCode()){ |
| | | throw new RuntimeException(r.getMsg()); |
| | | } |
| | | sysUserClient.addSysUser(user); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public PageInfo<SiteVO> pageList(SiteQuery query) { |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | PageInfo<SiteVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | list.forEach(item -> { |
| | | item.setVipElectrovalence(vip.getDiscount().multiply(item.getElectrovalence())); |
| | | }); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyMapper; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | |
| | | private TAccountingStrategyMapper accountingStrategyMapper; |
| | | @Autowired |
| | | private VipClient vipClient; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId) { |
| | | return this.baseMapper.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | // 获取当前时间段的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategy.getDiscount()); |
| | | // 获取后一次的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategy.getDiscount()); |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | | list.add(accountingStrategyDetailNext); |
| | | return list; |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO; |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext; |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | // 获取当前时间段的计费策略明细 |
| | | accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | // 获取后一次的计费策略明细 |
| | | accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | }else { |
| | | // 获取当前时间段的计费策略明细 |
| | | accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | // 获取后一次的计费策略明细 |
| | | accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | } |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | | list.add(accountingStrategyDetailNext); |
| | | return list; |
| | | } |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | |
| | | private TParkingLotService parkingLotService; |
| | | @Override |
| | | public PageInfo<TMonitoringEquipmentVO> pageList(TMonitoringEquipmentQuery query) { |
| | | |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | // 查询管理站点下的停车场 |
| | | List<TParkingLotVO> parkingLotVOS = parkingLotService.getList(null); |
| | | if(CollectionUtils.isEmpty(parkingLotVOS)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | List<Integer> parkingLotIds = parkingLotVOS.stream().map(TParkingLotVO::getId).collect(Collectors.toList()); |
| | | |
| | | PageInfo<TMonitoringEquipmentVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TMonitoringEquipmentVO> list = this.baseMapper.pageList(query,pageInfo,parkingLotIds); |
| | | for (TMonitoringEquipmentVO monitoringEquipmentVO : list) { |
| | | Integer siteId = parkingLotVOS.stream().filter(park->park.getId().equals(monitoringEquipmentVO.getParkingLotId())).findFirst().get().getSiteId(); |
| | | monitoringEquipmentVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_MONITOR)); |
| | | TParkingLotVO tParkingLotVO = parkingLotVOS.stream().filter(park -> monitoringEquipmentVO.getParkingLotId().equals(park.getId())).findFirst().get(); |
| | | if(null != tParkingLotVO){ |
| | | Integer siteId = tParkingLotVO.getSiteId(); |
| | | monitoringEquipmentVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_MONITOR)); |
| | | } |
| | | |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | FROM t_accounting_strategy |
| | | <where> |
| | | <if test="query.name != null and query.name != ''"> |
| | | AND `name` LIKE concat('%',#{query.name}, '%') |
| | | AND `name` LIKE concat('%',#{query.name}, '%') |
| | | </if> |
| | | AND site_id IS NULL |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | |
| | | <result column="parking_lot_id" property="parkingLotId" /> |
| | | <result column="location" property="location" /> |
| | | <result column="url_link" property="urlLink" /> |
| | | <result column="status" property="status" /> |
| | | <result column="faultTime" property="faultTime" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, `name`, code, parking_lot_id, location, url_link, create_time, del_flag |
| | | id, `name`, code, parking_lot_id, location, url_link,status,faultTime, create_time, del_flag |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO"> |
| | | SELECT |
| | | tme.id, tme.`name`, tme.code, tme.parking_lot_id, tme.location, tme.url_link, tme.create_time, tme.del_flag, tpl.name AS parkingLotName |
| | | tme.id, tme.`name`, tme.code, tme.parking_lot_id, tme.location, tme.url_link,tme.status,tme.faultTime, tme.create_time, tme.del_flag, tpl.name AS parkingLotName |
| | | FROM t_monitoring_equipment tme |
| | | LEFT JOIN t_parking_lot tpl ON tme.parking_lot_id = tpl.id |
| | | <where> |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | } |
| | |
| | | @GetMapping(value = "/addOrderAppeal") |
| | | @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"}) |
| | | public AjaxResult addOrderAppeal(@RequestBody TOrderAppeal orderAppeal){ |
| | | Long appUserId = tokenService.getLoginUser().getUserid(); |
| | | Long appUserId = tokenService.getLoginUserApplet().getUserId(); |
| | | orderAppeal.setAppUserId(appUserId); |
| | | orderAppeal.setStatus(1); |
| | | orderAppealService.save(orderAppeal); |
| | |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getMyChargingOrderList(GetMyChargingOrderList query) { |
| | | Long appUserId = tokenService.getLoginUser().getUserid(); |
| | | Long appUserId = tokenService.getLoginUserApplet().getUserId(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | int size = this.baseMapper.getMyChargingOrderList(appUserId, 1, null, null).size(); |
| | | map.put("number", size); |
| | |
| | | */ |
| | | @Override |
| | | public List<MyExchangeOrderList> getMyExchangeOrder(GetMyExchangeOrder query) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | Long userid = tokenService.getLoginUserApplet().getUserId(); |
| | | LambdaQueryWrapper<TExchangeOrder> wrapper = new LambdaQueryWrapper<TExchangeOrder>().eq(TExchangeOrder::getDelFlag, 0).eq(TExchangeOrder::getAppUserId, userid); |
| | | if(query.getStatus() == 0){ |
| | | wrapper.ne(TExchangeOrder::getStatus, 4); |
| | |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById(tExchangeOrder.getGoodsId()).getData(); |
| | | TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getGoodsId()).getData(); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById(exchangeOrder.getGoodsId()).getData(); |
| | | TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getGoodsId()).getData(); |
| | | info.setCouponType(coupon.getType()); |
| | | info.setDays(coupon.getDays()); |
| | | info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | |
| | | } |
| | | orderEvaluate = new TOrderEvaluate(); |
| | | BeanUtils.copyProperties(query, orderEvaluate); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | Long userid = tokenService.getLoginUserApplet().getUserId(); |
| | | orderEvaluate.setAppUserId(userid); |
| | | if(query.getOrderType() == 1){ |
| | | TChargingOrder chargingOrder = chargingOrderService.getById(query.getOrderId()); |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | } |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动查看详情") |
| | | @ApiOperation(tags = {"管理后台-活动管理","小程序-个人中心-活动列表"},value = "活动查看详情") |
| | | public AjaxResult<TActivity> getInfo(Integer id) { |
| | | return AjaxResult.ok(activityService.getById(id)); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动列表分页查询") |
| | | @ApiOperation(tags = {"管理后台-活动管理","小程序-个人中心-活动列表"},value = "活动列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TActivity>> pageList(@RequestBody AdvertisingDTO dto) { |
| | | return AjaxResult.ok(activityService.pageList(dto)); |
| | |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-广告管理"},value = "广告列表查询") |
| | | @PostMapping(value = "/list") |
| | | @GetMapping(value = "/list") |
| | | public AjaxResult<List<TAdvertising>> list() { |
| | | return AjaxResult.ok(advertisingService.list(Wrappers.lambdaQuery(TAdvertising.class) |
| | | .eq(TAdvertising::getStatus, AdvertisingStatusEnum.YES.getCode()))); |
| | |
| | | .like(unitListQueryDto.getCompanyName() != null && unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | |
| | | } |
| | | |
| | | //单位添加 |
| | |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/delete") |
| | | public R<TCompany> delete(@RequestParam("id") Integer id) { |
| | | return R.ok(companyService.getById(id)); |
| | | public R delete(@RequestParam("id") Integer id) { |
| | | return R.ok(companyService.removeById(id)); |
| | | } |
| | | } |
| | | |
| | |
| | | return AjaxResult.ok(tCouponService.pageList(dto)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 小程序远程调用 获取优惠券信息 |
| | | */ |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getCouponById/{id}") |
| | | public R<TCoupon> getCouponById(@PathVariable Integer id){ |
| | | @PostMapping(value = "/getCouponById1/{id}") |
| | | public R<TCoupon> getCouponById1(@PathVariable(value = "id") Integer id){ |
| | | TCoupon coupon = tCouponService.getById(id); |
| | | return R.ok(coupon); |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.service.TEnterpriseUserApplicationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | public class TEnterpriseUserApplicationController { |
| | | |
| | | private final TEnterpriseUserApplicationService enterpriseUserApplicationService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TEnterpriseUserApplicationController(TEnterpriseUserApplicationService enterpriseUserApplicationService) { |
| | | public TEnterpriseUserApplicationController(TEnterpriseUserApplicationService enterpriseUserApplicationService, TokenService tokenService) { |
| | | this.enterpriseUserApplicationService = enterpriseUserApplicationService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(tags = {"小程序-计费策略"},value = "添加集团用户申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { |
| | | // TODO 用户id |
| | | // 用户id |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表") |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Boolean> page(@RequestBody TEnterpriseUserApplication dto) { |
| | | // TODO 用户id |
| | | // 用户id |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @PostMapping("/getTagList") |
| | | public R<List<TEvaluationTagVO>> getTagList() { |
| | | return R.ok(evaluationTagService.getTagList()); |
| | | public R<List<TEvaluationTagVO>> getTagList(@RequestParam("type") Integer type) { |
| | | return R.ok(evaluationTagService.getTagList(type)); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.service.THtmlService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-html") |
| | | public class THtmlController { |
| | | @Resource |
| | | private THtmlService htmlService; |
| | | @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | public AjaxResult saveOrUpdate(@RequestBody THtml tHtml) { |
| | | htmlService.saveOrUpdate(tHtml); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "查询") |
| | | @PostMapping(value = "/selectByType/{type}") |
| | | public AjaxResult selectByType(@PathVariable Integer type) { |
| | | THtml one = htmlService.lambdaQuery().eq(THtml::getType, type).last("limit 1").one(); |
| | | return AjaxResult.success(one); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.dto.NoticeQueryDto; |
| | | import com.ruoyi.other.mapper.SysNoticeMapper; |
| | | import com.ruoyi.other.service.TNoticeService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-notice") |
| | | public class TNoticeController { |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | public AjaxResult saveOrUpdate(@RequestBody TNotice notice) { |
| | | noticeService.saveOrUpdate(notice); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "删除") |
| | | @PostMapping(value = "/deleteById/{id}") |
| | | public AjaxResult deleteById(@PathVariable Integer id) { |
| | | noticeService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<Page<TNotice>> authPageList(@RequestBody NoticeQueryDto query) { |
| | | if (query.getStatus()==0){ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .le(TNotice::getStartTime, LocalDateTime.now()) |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .page(Page.of(query.getPageCurr(),query.getPageSize()))); |
| | | }else if (query.getStatus()==1){ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .ge(TNotice::getStartTime, LocalDateTime.now()).le(TNotice::getEndTime,LocalDateTime.now()) |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .page(Page.of(query.getPageCurr(),query.getPageSize()))); |
| | | }else if (query.getStatus()==2){ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .ge(TNotice::getEndTime, LocalDateTime.now()) |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .page(Page.of(query.getPageCurr(),query.getPageSize()))); |
| | | }else{ |
| | | return AjaxResult.success(noticeService.lambdaQuery() |
| | | .like(query.getContent()!=null&&query.getContent()!="",TNotice::getContent,query.getContent()) |
| | | .page(Page.of(query.getPageCurr(),query.getPageSize()))); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | /** |
| | | * 查看系统设置 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-系统设置"},value = "联系客服") |
| | | @ApiOperation(tags = {"小程序-系统设置","后台-内容设置"},value = "联系客服,查询设置") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TSystemConfiguration> getDetailById(@RequestParam(name = "type")@ApiParam(value = "1=客服信息,2=系统设置") Integer type) { |
| | | return AjaxResult.ok(systemConfigurationService.getOne(Wrappers.lambdaQuery(TSystemConfiguration.class) |
| | | .eq(TSystemConfiguration::getType, type))); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-内容设置"},value = "客户信息,系统内容设置") |
| | | @GetMapping(value = "/save") |
| | | public AjaxResult getDetailById(@RequestBody TSystemConfiguration systemConfiguration) { |
| | | systemConfigurationService.saveOrUpdate(systemConfiguration); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.dto.SendCouponDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.dto.VipCouponDto; |
| | | import com.ruoyi.other.api.dto.VipInfoDto; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | public class TVipController { |
| | | @Autowired |
| | | private TVipService vipService; |
| | | @Resource |
| | | private TCouponService couponService; |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | public AjaxResult saveVip(@RequestBody TVip dto) { |
| | |
| | | return AjaxResult.ok(vipService.getById(id)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getById") |
| | | @ApiOperation(value = "通过id查会员") |
| | | public R<TVip> getById(Integer id) { |
| | | return R.ok(vipService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 远程调用 |
| | | * @param id |
| | |
| | | }) |
| | | public AjaxResult<PageInfo<TVip>> pageList(Integer pageCurr,Integer pageSize) { |
| | | return AjaxResult.ok(vipService.pageList(pageCurr,pageSize)); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"会员下拉框"},value = "会员列表分页查询") |
| | | @PostMapping(value = "/select") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pageCurr", value = "分页参数,当前页码", required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "分页参数,每页数量",required = true) |
| | | }) |
| | | public AjaxResult<List<TVip>> select() { |
| | | return AjaxResult.ok(vipService.list()); |
| | | } |
| | | |
| | | //获取会员Map |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"}) |
| | | @PostMapping("/vipInfo") |
| | | public AjaxResult vipInfo() { |
| | | List<VipInfoDto> vipInfoDtos = new ArrayList<>(); |
| | | List<TVip> vips = vipService.lambdaQuery().eq(TVip::getReveal, 1).list(); |
| | | for (TVip vip : vips) { |
| | | VipInfoDto vipInfoDto = new VipInfoDto(); |
| | | vipInfoDto.setMonthlyCard(vip.getMonthlyCardReveal()==1?vip.getMonthlyCard():null); |
| | | vipInfoDto.setSeasonCard(vip.getSeasonCardReveal()==1?vip.getSeasonCard():null); |
| | | vipInfoDto.setAnnualCard(vip.getAnnualCardReveal()==1?vip.getAnnualCard():null); |
| | | vipInfoDto.setMaximumDeduction(vip.getMaximumDeduction()); |
| | | vipInfoDto.setDiscountTimes(vip.getDiscountTimes()); |
| | | vipInfoDto.setDoubleIntegration(vip.getDoubleIntegration()); |
| | | vipInfoDto.setMallExclusivePrice(vip.getMallExclusivePrice()); |
| | | List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class); |
| | | List<VipCouponDto> vipCouponDtos = new ArrayList<>(); |
| | | if (!javaList.isEmpty()){ |
| | | for (SendCouponDto sendCouponDto : javaList) { |
| | | VipCouponDto vipCouponDto = new VipCouponDto(); |
| | | TCoupon byId = couponService.getById(sendCouponDto.getId()); |
| | | vipCouponDto.setNum(sendCouponDto.getNumber()); |
| | | vipCouponDto.setTCoupon(byId); |
| | | vipCouponDtos.add(vipCouponDto); |
| | | } |
| | | } |
| | | |
| | | vipInfoDto.setVipCouponDtos(vipCouponDtos); |
| | | |
| | | //计算总折扣 |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | total = total.add(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes()))); |
| | | for (VipCouponDto vipCouponDto : vipCouponDtos) { |
| | | TCoupon tCoupon = vipCouponDto.getTCoupon(); |
| | | total.add(tCoupon.getDiscount()); |
| | | } |
| | | vipInfoDto.setTotalDiscount(total); |
| | | vipInfoDtos.add(vipInfoDto); |
| | | } |
| | | return AjaxResult.success(vipInfoDtos); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * 获取评价标签列表 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getTagList(); |
| | | List<TEvaluationTagVO> getTagList(Integer type); |
| | | |
| | | |
| | | /** |
| | |
| | | * 查询标签列表 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getTagList(); |
| | | List<TEvaluationTagVO> getTagList(Integer type); |
| | | |
| | | |
| | | /** |
| | |
| | | public class TEvaluationTagServiceImpl extends ServiceImpl<TEvaluationTagMapper, TEvaluationTag> implements TEvaluationTagService { |
| | | |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagList() { |
| | | return this.baseMapper.getTagList(); |
| | | public List<TEvaluationTagVO> getTagList(Integer type) { |
| | | return this.baseMapper.getTagList(type); |
| | | } |
| | | |
| | | |
| | |
| | | </sql> |
| | | <select id="getTagList" resultType="com.ruoyi.other.api.vo.TEvaluationTagVO"> |
| | | select <include refid="Base_Column_List"></include> |
| | | from t_evaluation_tag where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} ORDER BY `type` |
| | | from t_evaluation_tag where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | ORDER BY `type` |
| | | </select> |
| | | |
| | | |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | } |