3 文件已重命名
21个文件已修改
7个文件已添加
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | import com.ruoyi.system.api.factory.RemoteUserFallbackFactory; |
| | | import com.ruoyi.system.api.model.AppMiniLoginDto; |
| | | import com.ruoyi.system.api.model.AppMiniLoginVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(contextId = "remoteMemberService", value = ServiceNameConstants.MEMBER_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) |
| | | public interface RemoteMemberService { |
| | |
| | | * @param appMiniLoginDto |
| | | * @return |
| | | */ |
| | | @PostMapping("/user/miniLogin") |
| | | @PostMapping("/member/miniLogin") |
| | | public R<AppMiniLoginVo> miniLogin(@RequestBody AppMiniLoginDto appMiniLoginDto); |
| | | |
| | | |
| | | @PostMapping("/member/listVoUserCouponByUserId") |
| | | public R<List<AppUserCouponVo>> listVoUserCouponByUserId(@RequestBody Long userId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname AppUserCouponVo |
| | | * @description: TODO |
| | | * @date 2023 2023/5/2 21:53 |
| | | */ |
| | | @Data |
| | | public class AppUserCouponVo { |
| | | |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long userCouponId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty("优惠券类型1.满减2.折扣3.代金4.商品") |
| | | private Integer couponType; |
| | | |
| | | @ApiModelProperty("优惠券名称") |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty("门槛金额") |
| | | private BigDecimal moneyThreshold; |
| | | |
| | | @ApiModelProperty("折扣金额") |
| | | private BigDecimal discountMoney; |
| | | |
| | | @ApiModelProperty("折扣百分比") |
| | | private BigDecimal discountPercent; |
| | | |
| | | @ApiModelProperty("有效开始时间") |
| | | private Date validStartTime; |
| | | |
| | | @ApiModelProperty("使用有效期") |
| | | private Date deadlineTime; |
| | | |
| | | @ApiModelProperty("关联商品ids") |
| | | private String relGoodsIds; |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysFile; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | import com.ruoyi.system.api.model.AppMiniLoginDto; |
| | | import com.ruoyi.system.api.model.AppMiniLoginVo; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 会员服务 |
| | |
| | | { |
| | | return R.fail("登录用户失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<AppUserCouponVo>> listVoUserCouponByUserId(Long userId) { |
| | | return R.fail("获取用户优惠券失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common-swagger</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 阿里云OBS --> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.15.1</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | package com.ruoyi.file.controller; |
| | | |
| | | import com.ruoyi.file.utils.OBSUploadUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 文件上传请求 |
| | | */ |
| | | @PostMapping("uploadOSS") |
| | | public R<String> uploadOSS(MultipartFile file) |
| | | { |
| | | try |
| | | { |
| | | // 上传并返回访问地址 |
| | | String url = OBSUploadUtils.uploadFile(file); |
| | | return R.ok(url); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("上传文件失败", e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.file.utils; |
| | | |
| | | import com.aliyun.oss.ClientException; |
| | | import com.aliyun.oss.OSS; |
| | | import com.aliyun.oss.OSSClientBuilder; |
| | | import com.aliyun.oss.OSSException; |
| | | import com.aliyun.oss.model.PutObjectRequest; |
| | | import com.aliyun.oss.model.PutObjectResult; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname OBSUploadUtils |
| | | * @description: TODO |
| | | * @date 2023 2023/5/1 15:40 |
| | | */ |
| | | public class OBSUploadUtils { |
| | | |
| | | |
| | | protected static OSS createOss(){ |
| | | // Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。 |
| | | String endpoint = "https://oss-cn-beijing.aliyuncs.com"; |
| | | // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。 |
| | | String accessKeyId = "LTAI5tAfKFuhyKFH12CTkXFj"; |
| | | String accessKeySecret = "tIBRuonHuQQPdcYrmlCdXlexOSwVXe"; |
| | | // 填写Bucket名称,例如examplebucket。 |
| | | String bucketName = "hongruitang"; |
| | | OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); |
| | | return ossClient; |
| | | } |
| | | |
| | | public static String uploadFile (MultipartFile file) throws Exception { |
| | | |
| | | // 填写Object完整路径,完整路径中不能包含Bucket名称,例如exampledir/exampleobject.txt。 |
| | | String bucketName = "hongruitang"; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 获取当前年 |
| | | String year = String.valueOf(calendar.get(Calendar.YEAR)); |
| | | // 获取当前月 |
| | | String month = String.valueOf(calendar.get(Calendar.MONTH) + 1); |
| | | // 获取当前日 |
| | | String day = String.valueOf(calendar.get(Calendar.DATE)); |
| | | String filePath = year+"/"+month+"/"+day+"/"; |
| | | String uuid = IdUtils.fastSimpleUUID(); |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = createOss(); |
| | | PutObjectResult result = null; |
| | | try { |
| | | String fileName = FileUploadUtils.extractFilename(file); |
| | | String objectName = filePath + uuid; |
| | | InputStream inputStream = file.getInputStream(); |
| | | // 创建PutObjectRequest对象。 |
| | | PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, inputStream); |
| | | // 设置该属性可以返回response。如果不设置,则返回的response为空。 |
| | | putObjectRequest.setProcess("true"); |
| | | // 创建PutObject请求。 |
| | | result = ossClient.putObject(putObjectRequest); |
| | | // 如果上传成功,则返回200。 |
| | | System.out.println(result.getResponse().getStatusCode()); |
| | | return result.getResponse().getUri(); |
| | | } catch (OSSException oe) { |
| | | System.out.println("Caught an OSSException, which means your request made it to OSS, " |
| | | + "but was rejected with an error response for some reason."); |
| | | System.out.println("Error Message:" + oe.getErrorMessage()); |
| | | System.out.println("Error Code:" + oe.getErrorCode()); |
| | | System.out.println("Request ID:" + oe.getRequestId()); |
| | | System.out.println("Host ID:" + oe.getHostId()); |
| | | } catch (ClientException ce) { |
| | | System.out.println("Caught an ClientException, which means the client encountered " |
| | | + "a serious internal problem while trying to communicate with OSS, " |
| | | + "such as not being able to access the network."); |
| | | System.out.println("Error Message:" + ce.getMessage()); |
| | | } finally { |
| | | if (ossClient != null) { |
| | | ossClient.shutdown(); |
| | | } |
| | | return result.getResponse().getErrorResponseAsString(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <version>2.3</version> |
| | | </dependency> |
| | | |
| | | <!-- 小程序统一服务 --> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-miniapp</artifactId> |
| | | <version>4.1.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
File was renamed from ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/RuoYiSystemApplication.java |
| | |
| | | @EnableCustomSwagger2 |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | public class RuoYiSystemApplication |
| | | public class RuoYiMemberApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | SpringApplication.run(RuoYiSystemApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | SpringApplication.run(RuoYiMemberApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 会员模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | | import com.ruoyi.member.service.member.MemberService; |
| | | import com.ruoyi.member.service.member.UserCouponService; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | import com.ruoyi.system.api.model.AppMiniLoginDto; |
| | | import com.ruoyi.system.api.model.AppMiniLoginVo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/member") |
| | |
| | | |
| | | @Autowired |
| | | private MemberService memberService; |
| | | |
| | | @Autowired |
| | | private UserCouponService userCouponService; |
| | | |
| | | /** |
| | | * @description: getMember |
| | |
| | | } |
| | | return R.ok(appMiniLoginVo); |
| | | } |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 1:45 |
| | | * @version 1.0 |
| | | */ |
| | | @PostMapping("/listVoUserCouponByUserId") |
| | | public R<List<AppUserCouponVo>> listVoUserCouponByUserId(@RequestBody Long userId){ |
| | | List<AppUserCouponVo> appUserCouponVoList = userCouponService.listVoUserCouponByUserId(userId); |
| | | return R.ok(appUserCouponVoList); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 折扣金额 |
| | | */ |
| | | @TableField("dicount_money") |
| | | private BigDecimal dicountMoney; |
| | | @TableField("discount_money") |
| | | private BigDecimal discountMoney; |
| | | /** |
| | | * 折扣百分比 |
| | | */ |
| | | @TableField("discout_percent") |
| | | private BigDecimal discoutPercent; |
| | | @TableField("discount_percent") |
| | | private BigDecimal discountPercent; |
| | | /** |
| | | * 使用范围1.全场2.指定商品 |
| | | */ |
| | |
| | | @TableField("deadline_time") |
| | | private Date deadlineTime; |
| | | |
| | | @TableField("rel_goods_ids") |
| | | private String relGoodsIds; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | |
| | | import com.ruoyi.member.domain.pojo.member.UserCoupon; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface UserCouponMapper extends BaseMapper<UserCoupon> { |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 1:47 |
| | | * @version 1.0 |
| | | */ |
| | | List<AppUserCouponVo> listVoUserCouponByUserId(Long userId); |
| | | } |
| | |
| | | import com.ruoyi.member.mapper.member.UserCouponMapper; |
| | | import com.ruoyi.member.service.member.UserCouponService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class UserCouponServiceImpl extends ServiceImpl<UserCouponMapper, UserCoupon> implements UserCouponService { |
| | | |
| | | @Resource |
| | | private UserCouponMapper userCouponMapper; |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 1:47 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public List<AppUserCouponVo> listVoUserCouponByUserId(Long userId){ |
| | | List<AppUserCouponVo> appUserCouponVoList = userCouponMapper.listVoUserCouponByUserId(userId); |
| | | return appUserCouponVoList; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.member.domain.pojo.member.UserCoupon; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface UserCouponService extends IService<UserCoupon> { |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 1:47 |
| | | * @version 1.0 |
| | | */ |
| | | List<AppUserCouponVo> listVoUserCouponByUserId(Long userId); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.member.mapper.member.MemberMapper"> |
| | | |
| | | <resultMap type="Member" id="MemberResult"> |
| | | <resultMap type="com.ruoyi.system.api.domain.poji.member.Member" id="MemberResult"> |
| | | <result property="userId" column="user_id" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="memberId" column="member_id" /> |
| | |
| | | select user_id, del_flag, member_id, member_no, wx_openid, mini_openid, wx_unionid, realtion_shop_id, real_name, mobile, gender, referrer, customer_source, level, birthday, create_time, update_time, update_user_id from t_member |
| | | </sql> |
| | | |
| | | <select id="selectMemberList" parameterType="Member" resultMap="MemberResult"> |
| | | <select id="selectMemberList" parameterType="com.ruoyi.system.api.domain.poji.member.Member" resultMap="MemberResult"> |
| | | <include refid="selectMemberVo"/> |
| | | <where> |
| | | <if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if> |
| | |
| | | where user_id = #{userId} |
| | | </select> |
| | | |
| | | <insert id="insertMember" parameterType="Member"> |
| | | <insert id="insertMember" parameterType="com.ruoyi.system.api.domain.poji.member.Member"> |
| | | insert into t_member |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="userId != null">user_id,</if> |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateMember" parameterType="Member"> |
| | | <update id="updateMember" parameterType="com.ruoyi.system.api.domain.poji.member.Member"> |
| | | update t_member |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | |
| | | </delete> |
| | | |
| | | |
| | | <select id="getOneByMiniOpenid" parameterType="Member"> |
| | | <select id="getOneByMiniOpenid" parameterType="com.ruoyi.system.api.domain.poji.member.Member"> |
| | | SELECT * FROM t_member WHERE mini_openid = #{miniOpenid} |
| | | </select> |
| | | |
| | |
| | | <result property="sendTimeType" column="send_time_type" /> |
| | | <result property="sendTime" column="send_time" /> |
| | | <result property="moneyThreshold" column="money_threshold" /> |
| | | <result property="dicountMoney" column="dicount_money" /> |
| | | <result property="discoutPercent" column="discout_percent" /> |
| | | <result property="discountMoney" column="discount_money" /> |
| | | <result property="discountPercent" column="discount_percent" /> |
| | | <result property="useScope" column="use_scope" /> |
| | | <result property="validTimeType" column="valid_time_type" /> |
| | | <result property="validStartTime" column="valid_start_time" /> |
| | |
| | | <result property="receiveTime" column="receive_time" /> |
| | | <result property="userTime" column="user_time" /> |
| | | <result property="deadlineTime" column="deadline_time" /> |
| | | <result property="relGoodsIds" column="rel_goods_ids" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserCouponVo"> |
| | | select id, del_flag, coupon_id, user_id, coupon_type, coupon_status, coupon_name, send_type, send_time_type, send_time, money_threshold, dicount_money, discout_percent, use_scope, valid_time_type, valid_start_time, valid_end_time, valid_day, receive_time, user_time, deadline_time from t_user_coupon |
| | | select id, del_flag, coupon_id, user_id, coupon_type, coupon_status, coupon_name, send_type, send_time_type, send_time, money_threshold, discount_money, discount_percent, use_scope, valid_time_type, valid_start_time, valid_end_time, valid_day, receive_time, user_time, deadline_time, rel_goods_ids from t_user_coupon |
| | | </sql> |
| | | |
| | | <select id="selectUserCouponList" parameterType="UserCoupon" resultMap="UserCouponResult"> |
| | |
| | | <if test="sendTimeType != null "> and send_time_type = #{sendTimeType}</if> |
| | | <if test="sendTime != null "> and send_time = #{sendTime}</if> |
| | | <if test="moneyThreshold != null "> and money_threshold = #{moneyThreshold}</if> |
| | | <if test="dicountMoney != null "> and dicount_money = #{dicountMoney}</if> |
| | | <if test="discoutPercent != null "> and discout_percent = #{discoutPercent}</if> |
| | | <if test="discountMoney != null "> and discount_money = #{discountMoney}</if> |
| | | <if test="discountPercent != null "> and discount_percent = #{discountPercent}</if> |
| | | <if test="useScope != null "> and use_scope = #{useScope}</if> |
| | | <if test="validTimeType != null "> and valid_time_type = #{validTimeType}</if> |
| | | <if test="validStartTime != null "> and valid_start_time = #{validStartTime}</if> |
| | |
| | | <if test="receiveTime != null "> and receive_time = #{receiveTime}</if> |
| | | <if test="userTime != null "> and user_time = #{userTime}</if> |
| | | <if test="deadlineTime != null "> and deadline_time = #{deadlineTime}</if> |
| | | <if test="relGoodsIds != null "> and rel_goods_ids = #{relGoodsIds}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <if test="sendTimeType != null">send_time_type,</if> |
| | | <if test="sendTime != null">send_time,</if> |
| | | <if test="moneyThreshold != null">money_threshold,</if> |
| | | <if test="dicountMoney != null">dicount_money,</if> |
| | | <if test="discoutPercent != null">discout_percent,</if> |
| | | <if test="discountMoney != null">discount_money,</if> |
| | | <if test="discountPercent != null">discount_percent,</if> |
| | | <if test="useScope != null">use_scope,</if> |
| | | <if test="validTimeType != null">valid_time_type,</if> |
| | | <if test="validStartTime != null">valid_start_time,</if> |
| | |
| | | <if test="receiveTime != null">receive_time,</if> |
| | | <if test="userTime != null">user_time,</if> |
| | | <if test="deadlineTime != null">deadline_time,</if> |
| | | <if test="relGoodsIds != null ">rel_goods_ids,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | |
| | | <if test="sendTimeType != null">#{sendTimeType},</if> |
| | | <if test="sendTime != null">#{sendTime},</if> |
| | | <if test="moneyThreshold != null">#{moneyThreshold},</if> |
| | | <if test="dicountMoney != null">#{dicountMoney},</if> |
| | | <if test="discoutPercent != null">#{discoutPercent},</if> |
| | | <if test="discountMoney != null">#{discountMoney},</if> |
| | | <if test="discountPercent != null">#{discountPercent},</if> |
| | | <if test="useScope != null">#{useScope},</if> |
| | | <if test="validTimeType != null">#{validTimeType},</if> |
| | | <if test="validStartTime != null">#{validStartTime},</if> |
| | |
| | | <if test="receiveTime != null">#{receiveTime},</if> |
| | | <if test="userTime != null">#{userTime},</if> |
| | | <if test="deadlineTime != null">#{deadlineTime},</if> |
| | | <if test="relGoodsIds != null ">#{relGoodsIds},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="sendTimeType != null">send_time_type = #{sendTimeType},</if> |
| | | <if test="sendTime != null">send_time = #{sendTime},</if> |
| | | <if test="moneyThreshold != null">money_threshold = #{moneyThreshold},</if> |
| | | <if test="dicountMoney != null">dicount_money = #{dicountMoney},</if> |
| | | <if test="discoutPercent != null">discout_percent = #{discoutPercent},</if> |
| | | <if test="discountMoney != null">discount_money = #{discountMoney},</if> |
| | | <if test="discountPercent != null">discount_percent = #{discountPercent},</if> |
| | | <if test="useScope != null">use_scope = #{useScope},</if> |
| | | <if test="validTimeType != null">valid_time_type = #{validTimeType},</if> |
| | | <if test="validStartTime != null">valid_start_time = #{validStartTime},</if> |
| | |
| | | <if test="receiveTime != null">receive_time = #{receiveTime},</if> |
| | | <if test="userTime != null">user_time = #{userTime},</if> |
| | | <if test="deadlineTime != null">deadline_time = #{deadlineTime},</if> |
| | | <if test="relGoodsIds != null "> and rel_goods_ids = #{relGoodsIds},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="listVoUserCouponByUserId" resultType="com.ruoyi.system.api.domain.vo.AppUserCouponVo"> |
| | | SELECT |
| | | tuc.id userCouponId, |
| | | tuc.coupon_type couponType, |
| | | tuc.coupon_name couponName, |
| | | tuc.money_threshold moneyThreshold, |
| | | tuc.discount_money discountMoney, |
| | | tuc.discount_percent discountPercent, |
| | | tuc.valid_start_time validStartTime, |
| | | tuc.deadline_time deadlineTime, |
| | | tuc.rel_goods_ids relGoodsIds |
| | | FROM t_user_coupon tuc |
| | | WHERE tuc.del_flag = 1 AND tuc.coupon_status = 1 AND tuc.coupon_type IN (1,2,3) |
| | | ORDER BY tuc.receive_time |
| | | </select> |
| | | |
| | | </mapper> |
File was renamed from ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/RuoYiSystemApplication.java |
| | |
| | | @EnableCustomSwagger2 |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | public class RuoYiSystemApplication |
| | | public class RuoYiOrderApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | SpringApplication.run(RuoYiSystemApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | SpringApplication.run(RuoYiOrderApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 订单模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | |
| | | package com.ruoyi.order.controller.miniapp; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.domain.dto.AppBaseBathDto; |
| | | import com.ruoyi.order.domain.dto.AppGoodsInfoGetDto; |
| | |
| | | */ |
| | | @Api(value = "小程序商品相关接口", tags = "小程序商品相关接口", description = "小程序商品相关接口") |
| | | @RestController |
| | | @RequestMapping("/app/home") |
| | | public class AppGoodsController { |
| | | @RequestMapping("/app/goods") |
| | | public class AppGoodsController extends BaseController { |
| | | |
| | | @Autowired |
| | | private GoodsService goodsService; |
| | |
| | | shoppingCartService.deleteShoppingCart(appBaseBathDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.domain.dto.AppPageDto; |
| | | import com.ruoyi.order.domain.dto.AppSearchGoodsPageDto; |
| | |
| | | @Api(value = "小程序首页相关接口", tags = "小程序首页相关接口", description = "小程序首页相关接口") |
| | | @RestController |
| | | @RequestMapping("/app/home") |
| | | public class AppHomeController { |
| | | public class AppHomeController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
New file |
| | |
| | | package com.ruoyi.order.controller.miniapp; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.domain.dto.AppBuyGoodsDto; |
| | | import com.ruoyi.order.domain.dto.AppSureOrderDto; |
| | | import com.ruoyi.order.domain.vo.AppSureOrderVo; |
| | | import com.ruoyi.order.service.order.OrderService; |
| | | import com.ruoyi.system.api.RemoteMemberService; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname AppOrderController |
| | | * @description: TODO |
| | | * @date 2023 2023/5/2 20:47 |
| | | */ |
| | | @Api(value = "小程序订单相关接口", tags = "小程序订单相关接口", description = "小程序订单相关接口") |
| | | @RestController |
| | | @RequestMapping("/app/order") |
| | | public class AppOrderController extends BaseController { |
| | | |
| | | @Autowired |
| | | private RemoteMemberService memberService; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | |
| | | @RequestMapping(value = "/buyGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "购买商品") |
| | | public R<AppSureOrderVo> buyGoods(@RequestBody AppSureOrderDto appSureOrderDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if(userId!=null){ |
| | | Member member = memberService.getMember(userId).getData(); |
| | | appSureOrderDto.setUserId(userId); |
| | | if(member!=null&&member.getRealtionShopId()!=null){ |
| | | appSureOrderDto.setShopId(member.getRealtionShopId()); |
| | | } |
| | | } |
| | | AppSureOrderVo appSureOrderVo = orderService.buyGoods(appSureOrderDto); |
| | | return R.ok(appSureOrderVo); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname AppBuyNowDto |
| | | * @description: TODO |
| | | * @date 2023 2023/5/2 20:52 |
| | | */ |
| | | |
| | | @Data |
| | | public class AppBuyGoodsDto extends AppBaseDto{ |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty(value = "购买数量") |
| | | private Integer buyNum; |
| | | |
| | | @ApiModelProperty(value = "用户优惠券id") |
| | | private Long userCouponId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname AppShoppingcartDto |
| | | * @description: TODO |
| | | * @date 2023 2023/5/2 20:54 |
| | | */ |
| | | @Data |
| | | public class AppSureOrderDto extends AppBaseDto{ |
| | | |
| | | @ApiModelProperty(value = "shopId",hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(value = "购物车列表") |
| | | List<AppBuyGoodsDto> appBuyGoodsDtoList; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.domain.vo; |
| | | |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname AppSureOrderGoodsVo |
| | | * @description: TODO |
| | | * @date 2023 2023/5/2 21:07 |
| | | */ |
| | | @Data |
| | | public class AppSureOrderGoodsVo { |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品简介") |
| | | private String goodsIntroduction; |
| | | |
| | | @ApiModelProperty(value = "商品类型1周期2服务3体验4单品") |
| | | private Integer goodsType; |
| | | |
| | | @ApiModelProperty(value = "商品图片") |
| | | private String goodsPicture; |
| | | |
| | | @ApiModelProperty(value = "购买数量") |
| | | private Integer buyNum; |
| | | |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long userCouponId; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | private BigDecimal goodsPrice; |
| | | |
| | | @ApiModelProperty(value = "商品总价") |
| | | private BigDecimal goodsTotalPrice; |
| | | |
| | | @ApiModelProperty(value = "商品订金") |
| | | private BigDecimal goodsDeposit; |
| | | |
| | | @ApiModelProperty(value = "是否计算优惠券0否1是") |
| | | private Integer useCoupon; |
| | | |
| | | @ApiModelProperty(value = "优惠券抵扣") |
| | | private BigDecimal couponDiscount; |
| | | |
| | | @ApiModelProperty(value = "商品实际价格") |
| | | private BigDecimal goodsRealPrice; |
| | | |
| | | @ApiModelProperty(value = "优惠券列表") |
| | | private List<AppUserCouponVo> appUserCouponVoList; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @version 1.0 |
| | | * @classname AppSureOrderVo |
| | | * @description: TODO |
| | | * @date 2023 2023/5/2 20:57 |
| | | */ |
| | | @Data |
| | | public class AppSureOrderVo { |
| | | |
| | | |
| | | @ApiModelProperty(value = "商品总价") |
| | | private BigDecimal orderGoodsMoney; |
| | | |
| | | @ApiModelProperty(value = "优惠券抵扣") |
| | | private BigDecimal couponDiscount; |
| | | |
| | | @ApiModelProperty(value = "订单支付订金") |
| | | private BigDecimal orderPayDeposit; |
| | | |
| | | @ApiModelProperty(value = "订单支付金额") |
| | | private BigDecimal orderPayMoney; |
| | | |
| | | @ApiModelProperty(value = "订单商品列表") |
| | | List<AppSureOrderGoodsVo> appSureOrderGoodsVoList; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.order.domain.pojo.goods.GoodsFile; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 商品图片 服务类 |
| | |
| | | */ |
| | | public interface GoodsFileService extends IService<GoodsFile> { |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 2:15 |
| | | * @version 1.0 |
| | | */ |
| | | GoodsFile getGoodsPicture(String goodsId); |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 2:06 |
| | | * @version 1.0 |
| | | */ |
| | | List<GoodsFile> listByGoodsId(String goodsId); |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl.goods; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.ruoyi.order.domain.pojo.goods.GoodsFile; |
| | | import com.ruoyi.order.domain.pojo.order.ShoppingCart; |
| | | import com.ruoyi.order.mapper.goods.GoodsFileMapper; |
| | | import com.ruoyi.order.service.goods.GoodsFileService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class GoodsFileServiceImpl extends ServiceImpl<GoodsFileMapper, GoodsFile> implements GoodsFileService { |
| | | |
| | | @Resource |
| | | private GoodsFileMapper goodsFileMapper; |
| | | |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 2:14 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public GoodsFile getGoodsPicture(String goodsId){ |
| | | LambdaQueryWrapper<GoodsFile> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(GoodsFile::getDelFlag, 0).eq(GoodsFile::getGoodsId, goodsId).eq(GoodsFile::getFileType,1); |
| | | GoodsFile goodsFile = this.getOne(queryWrapper); |
| | | return goodsFile; |
| | | } |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | | * @date 2023/5/3 2:05 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public List<GoodsFile> listByGoodsId(String goodsId){ |
| | | LambdaQueryWrapper<GoodsFile> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(GoodsFile::getDelFlag, 0).eq(GoodsFile::getGoodsId, goodsId); |
| | | List<GoodsFile> goodsFileList = this.list(queryWrapper); |
| | | return goodsFileList; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.order.domain.dto.AppSearchGoodsPageDto; |
| | | import com.ruoyi.order.domain.dto.AppShopGoodsPageDto; |
| | | import com.ruoyi.order.domain.pojo.goods.Goods; |
| | | import com.ruoyi.order.domain.pojo.goods.GoodsFile; |
| | | import com.ruoyi.order.domain.pojo.goods.ShopGoods; |
| | | import com.ruoyi.order.domain.vo.AppGoodsInfoVo; |
| | | import com.ruoyi.order.domain.vo.AppSimpleActivityGoodsVo; |
| | | import com.ruoyi.order.domain.vo.AppSimpleGoodsVo; |
| | | import com.ruoyi.order.mapper.goods.GoodsMapper; |
| | | import com.ruoyi.order.service.activity.ActivityGoodsService; |
| | | import com.ruoyi.order.service.goods.GoodsFileService; |
| | | import com.ruoyi.order.service.goods.GoodsService; |
| | | import com.ruoyi.order.service.goods.ShopGoodsService; |
| | | import com.ruoyi.system.api.RemoteActivityService; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.StringJoiner; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private ShopGoodsService shopGoodsService; |
| | | |
| | | @Resource |
| | | private GoodsFileService goodsFileService; |
| | | |
| | | /** |
| | | * 获取推荐商品列表 |
| | |
| | | }else{ |
| | | appGoodsInfoVo.setActivityFlag(0); |
| | | } |
| | | //商品图片 |
| | | List<GoodsFile> goodsFileList = goodsFileService.listByGoodsId(goods.getGoodsId()); |
| | | StringJoiner bannerSJ = new StringJoiner(","); |
| | | if(goodsFileList!=null&&!goodsFileList.isEmpty()){ |
| | | for(GoodsFile goodsFile : goodsFileList){ |
| | | if(goodsFile.getFileType()==2){ |
| | | appGoodsInfoVo.setGoodsVideo(goodsFile.getFileUrl()); |
| | | }else if(goodsFile.getFileType()==3){ |
| | | bannerSJ.add(goodsFile.getFileUrl()); |
| | | } |
| | | } |
| | | if(bannerSJ!=null&&bannerSJ.length()>0){ |
| | | appGoodsInfoVo.setGoodsBanners(bannerSJ.toString()); |
| | | } |
| | | } |
| | | return appGoodsInfoVo; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.order.domain.dto.AppBuyGoodsDto; |
| | | import com.ruoyi.order.domain.dto.AppSureOrderDto; |
| | | import com.ruoyi.order.domain.pojo.goods.Goods; |
| | | import com.ruoyi.order.domain.pojo.goods.GoodsFile; |
| | | import com.ruoyi.order.domain.pojo.goods.ShopGoods; |
| | | import com.ruoyi.order.domain.pojo.order.Order; |
| | | import com.ruoyi.order.domain.vo.AppSureOrderGoodsVo; |
| | | import com.ruoyi.order.domain.vo.AppSureOrderVo; |
| | | import com.ruoyi.order.service.goods.GoodsFileService; |
| | | import com.ruoyi.order.service.goods.ShopGoodsService; |
| | | import com.ruoyi.system.api.RemoteMemberService; |
| | | import com.ruoyi.system.api.domain.vo.AppUserCouponVo; |
| | | import com.ruoyi.order.mapper.order.OrderMapper; |
| | | import com.ruoyi.order.service.goods.GoodsService; |
| | | import com.ruoyi.order.service.order.OrderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { |
| | | |
| | | @Resource |
| | | private OrderMapper orderMapper; |
| | | |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | |
| | | @Resource |
| | | private ShopGoodsService shopGoodsService; |
| | | |
| | | @Autowired |
| | | private RemoteMemberService remoteMemberService; |
| | | |
| | | @Autowired |
| | | private GoodsFileService goodsFileService; |
| | | /** |
| | | * @description: buyGoods |
| | | * @param: appSureOrderDto |
| | | * @return: AppSureOrderVo |
| | | * @author jqs34 |
| | | * @date: 2023/5/3 0:07 |
| | | */ |
| | | @Override |
| | | public AppSureOrderVo buyGoods(AppSureOrderDto appSureOrderDto){ |
| | | Long userId = appSureOrderDto.getUserId(); |
| | | AppSureOrderVo appSureOrderVo = new AppSureOrderVo(); |
| | | List<AppSureOrderGoodsVo> appSureOrderGoodsVoList = new ArrayList<>(); |
| | | AppSureOrderGoodsVo appSureOrderGoodsVo; |
| | | List<AppBuyGoodsDto> appBuyGoodsDtoList = appSureOrderDto.getAppBuyGoodsDtoList(); |
| | | String goodsId; |
| | | Integer buyNum; |
| | | BigDecimal buyNumBig; |
| | | Long userCouponId; |
| | | Goods goods; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | | BigDecimal goodsRealPrice; |
| | | List<AppUserCouponVo> appUserCouponVoList = remoteMemberService.listVoUserCouponByUserId(userId).getData(); |
| | | List<AppUserCouponVo> appGoodsUserCouponVoList; |
| | | Map<Long,AppUserCouponVo> appUserCouponVoMap = appUserCouponVoList.stream().collect(Collectors.toMap(AppUserCouponVo::getUserCouponId, Function.identity())); |
| | | AppUserCouponVo appUserCouponVo; |
| | | Integer couponType; |
| | | BigDecimal moneyThreshold; |
| | | BigDecimal discountMoney = new BigDecimal("0.00"); |
| | | BigDecimal discountPercent; |
| | | BigDecimal goodsDeposit; |
| | | GoodsFile goodsFile; |
| | | Integer useCoupon; |
| | | BigDecimal orderGoodsMoney = new BigDecimal("0.00"); |
| | | BigDecimal couponDiscount = new BigDecimal("0.00"); |
| | | BigDecimal orderPayDeposit = new BigDecimal("0.00"); |
| | | BigDecimal orderPayMoney = new BigDecimal("0.00"); |
| | | for(AppBuyGoodsDto appBuyGoodsDto : appBuyGoodsDtoList){ |
| | | appSureOrderGoodsVo = new AppSureOrderGoodsVo(); |
| | | useCoupon = 0; |
| | | goodsId = appBuyGoodsDto.getGoodsId(); |
| | | buyNum = appBuyGoodsDto.getBuyNum(); |
| | | userCouponId = appBuyGoodsDto.getUserCouponId(); |
| | | goods = goodsService.getById(goodsId); |
| | | appSureOrderGoodsVo.setGoodsId(goodsId); |
| | | appSureOrderGoodsVo.setGoodsName(goods.getGoodsName()); |
| | | appSureOrderGoodsVo.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | appSureOrderGoodsVo.setGoodsType(goods.getGoodsType()); |
| | | //商品图片 |
| | | goodsFile = goodsFileService.getGoodsPicture(goodsId); |
| | | appSureOrderGoodsVo.setGoodsPicture(goodsFile.getFileUrl()); |
| | | buyNum = appBuyGoodsDto.getBuyNum(); |
| | | appSureOrderGoodsVo.setBuyNum(buyNum); |
| | | goodsPrice = goods.getSalesPrice(); |
| | | //商户定制价格 |
| | | ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(appSureOrderDto.getShopId(),goods.getGoodsId()); |
| | | if(shopGoods!=null){ |
| | | goodsPrice = shopGoods.getSalesPrice(); |
| | | } |
| | | appSureOrderGoodsVo.setGoodsPrice(goodsPrice); |
| | | buyNumBig = BigDecimal.valueOf(buyNum); |
| | | goodsTotalPrice = goodsPrice.multiply(buyNumBig); |
| | | goodsRealPrice = goodsTotalPrice; |
| | | if(userCouponId!=null){ |
| | | appUserCouponVo = appUserCouponVoMap.get(userCouponId); |
| | | if(StringUtils.isBlank(appUserCouponVo.getRelGoodsIds()) || appUserCouponVo.getRelGoodsIds().contains(goodsId)){ |
| | | couponType = appUserCouponVo.getCouponType(); |
| | | if(couponType == 1 && appUserCouponVo.getMoneyThreshold()!=null && appUserCouponVo.getDiscountMoney()!=null){ |
| | | moneyThreshold = appUserCouponVo.getMoneyThreshold(); |
| | | if(goodsTotalPrice.compareTo(moneyThreshold)>=0){ |
| | | discountMoney = appUserCouponVo.getDiscountMoney(); |
| | | goodsRealPrice = goodsTotalPrice.subtract(discountMoney); |
| | | useCoupon = 1; |
| | | } |
| | | }else if(couponType == 2 && appUserCouponVo.getDiscountPercent()!=null){ |
| | | discountPercent = appUserCouponVo.getDiscountPercent(); |
| | | goodsRealPrice = goodsTotalPrice.multiply(discountPercent).divide(BigDecimal.TEN).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | discountMoney = goodsRealPrice.subtract(goodsTotalPrice); |
| | | useCoupon = 1; |
| | | }else if(couponType == 3 && appUserCouponVo.getDiscountMoney()!=null){ |
| | | discountMoney = appUserCouponVo.getDiscountMoney(); |
| | | goodsRealPrice = goodsTotalPrice.subtract(discountMoney); |
| | | useCoupon = 1; |
| | | } |
| | | } |
| | | } |
| | | appSureOrderGoodsVo.setUseCoupon(useCoupon); |
| | | appSureOrderGoodsVo.setGoodsTotalPrice(goodsTotalPrice); |
| | | appSureOrderGoodsVo.setCouponDiscount(discountMoney); |
| | | appSureOrderGoodsVo.setGoodsRealPrice(goodsRealPrice); |
| | | goodsDeposit = goods.getSubscription(); |
| | | if(goodsDeposit == null){ |
| | | goodsDeposit = new BigDecimal("0.00"); |
| | | } |
| | | appSureOrderGoodsVo.setGoodsDeposit(goodsDeposit); |
| | | orderGoodsMoney = orderGoodsMoney.add(goodsTotalPrice); |
| | | couponDiscount = couponDiscount.add(discountMoney); |
| | | orderPayDeposit = orderPayDeposit.add(goodsDeposit); |
| | | orderPayMoney = orderPayMoney.add(goodsRealPrice); |
| | | //商品关联优惠券 |
| | | appGoodsUserCouponVoList = new ArrayList<>(); |
| | | if(appUserCouponVoList!=null && !appUserCouponVoList.isEmpty()){ |
| | | for(AppUserCouponVo entity : appUserCouponVoList){ |
| | | if(StringUtils.isBlank(entity.getRelGoodsIds())){ |
| | | appGoodsUserCouponVoList.add(entity); |
| | | }else if(entity.getRelGoodsIds().contains(goodsId)){ |
| | | appGoodsUserCouponVoList.add(entity); |
| | | } |
| | | } |
| | | appSureOrderGoodsVo.setAppUserCouponVoList(appGoodsUserCouponVoList); |
| | | } |
| | | appSureOrderGoodsVoList.add(appSureOrderGoodsVo); |
| | | } |
| | | appSureOrderVo.setOrderGoodsMoney(orderGoodsMoney); |
| | | appSureOrderVo.setCouponDiscount(couponDiscount); |
| | | appSureOrderVo.setOrderPayDeposit(orderPayDeposit); |
| | | appSureOrderVo.setOrderPayMoney(orderPayMoney); |
| | | appSureOrderVo.setAppSureOrderGoodsVoList(appSureOrderGoodsVoList); |
| | | return appSureOrderVo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.order; |
| | | |
| | | import com.ruoyi.order.domain.dto.AppSureOrderDto; |
| | | import com.ruoyi.order.domain.pojo.order.Order; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.domain.vo.AppSureOrderVo; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface OrderService extends IService<Order> { |
| | | |
| | | /** |
| | | * @description: buyGoods |
| | | * @param: appSureOrderDto |
| | | * @return: AppSureOrderVo |
| | | * @author jqs34 |
| | | * @date: 2023/5/3 0:31 |
| | | */ |
| | | AppSureOrderVo buyGoods(AppSureOrderDto appSureOrderDto); |
| | | } |
File was renamed from ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/RuoYiSystemApplication.java |
| | |
| | | @EnableCustomSwagger2 |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | public class RuoYiSystemApplication |
| | | public class RuoYiShopApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | SpringApplication.run(RuoYiSystemApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | SpringApplication.run(RuoYiShopApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 商户模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | |
| | | /** |
| | | * 折扣金额 |
| | | */ |
| | | @TableField("dicount_money") |
| | | private BigDecimal dicountMoney; |
| | | @TableField("discount_money") |
| | | private BigDecimal discountMoney; |
| | | /** |
| | | * 折扣百分比 |
| | | */ |
| | | @TableField("discout_percent") |
| | | private BigDecimal discoutPercent; |
| | | @TableField("discount_percent") |
| | | private BigDecimal discountPercent; |
| | | /** |
| | | * 使用范围1.全场2.指定商品 |
| | | */ |
| | |
| | | <result property="sendTimeType" column="send_time_type" /> |
| | | <result property="sendTime" column="send_time" /> |
| | | <result property="moneyThreshold" column="money_threshold" /> |
| | | <result property="dicountMoney" column="dicount_money" /> |
| | | <result property="discoutPercent" column="discout_percent" /> |
| | | <result property="discountMoney" column="discount_money" /> |
| | | <result property="discountPercent" column="discount_percent" /> |
| | | <result property="useScope" column="use_scope" /> |
| | | <result property="validTimeType" column="valid_time_type" /> |
| | | <result property="validStartTime" column="valid_start_time" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectCouponVo"> |
| | | select coupon_id, del_flag, coupon_type, coupon_status, coupon_name, send_type, send_time_type, send_time, money_threshold, dicount_money, discout_percent, use_scope, valid_time_type, valid_start_time, valid_end_time, valid_day, create_time, create_user_id, update_time, update_user_id from t_coupon |
| | | select coupon_id, del_flag, coupon_type, coupon_status, coupon_name, send_type, send_time_type, send_time, money_threshold, discount_money, discount_percent, use_scope, valid_time_type, valid_start_time, valid_end_time, valid_day, create_time, create_user_id, update_time, update_user_id from t_coupon |
| | | </sql> |
| | | |
| | | <select id="selectCouponList" parameterType="Coupon" resultMap="CouponResult"> |
| | |
| | | <if test="sendTimeType != null "> and send_time_type = #{sendTimeType}</if> |
| | | <if test="sendTime != null "> and send_time = #{sendTime}</if> |
| | | <if test="moneyThreshold != null "> and money_threshold = #{moneyThreshold}</if> |
| | | <if test="dicountMoney != null "> and dicount_money = #{dicountMoney}</if> |
| | | <if test="discoutPercent != null "> and discout_percent = #{discoutPercent}</if> |
| | | <if test="discountMoney != null "> and discount_money = #{discountMoney}</if> |
| | | <if test="discountPercent != null "> and discount_percent = #{discountPercent}</if> |
| | | <if test="useScope != null "> and use_scope = #{useScope}</if> |
| | | <if test="validTimeType != null "> and valid_time_type = #{validTimeType}</if> |
| | | <if test="validStartTime != null "> and valid_start_time = #{validStartTime}</if> |
| | |
| | | <if test="sendTimeType != null">send_time_type,</if> |
| | | <if test="sendTime != null">send_time,</if> |
| | | <if test="moneyThreshold != null">money_threshold,</if> |
| | | <if test="dicountMoney != null">dicount_money,</if> |
| | | <if test="discoutPercent != null">discout_percent,</if> |
| | | <if test="discountMoney != null">discount_money,</if> |
| | | <if test="discountPercent != null">discount_percent,</if> |
| | | <if test="useScope != null">use_scope,</if> |
| | | <if test="validTimeType != null">valid_time_type,</if> |
| | | <if test="validStartTime != null">valid_start_time,</if> |
| | |
| | | <if test="sendTimeType != null">#{sendTimeType},</if> |
| | | <if test="sendTime != null">#{sendTime},</if> |
| | | <if test="moneyThreshold != null">#{moneyThreshold},</if> |
| | | <if test="dicountMoney != null">#{dicountMoney},</if> |
| | | <if test="discoutPercent != null">#{discoutPercent},</if> |
| | | <if test="discountMoney != null">#{discountMoney},</if> |
| | | <if test="discountPercent != null">#{discountPercent},</if> |
| | | <if test="useScope != null">#{useScope},</if> |
| | | <if test="validTimeType != null">#{validTimeType},</if> |
| | | <if test="validStartTime != null">#{validStartTime},</if> |
| | |
| | | <if test="sendTimeType != null">send_time_type = #{sendTimeType},</if> |
| | | <if test="sendTime != null">send_time = #{sendTime},</if> |
| | | <if test="moneyThreshold != null">money_threshold = #{moneyThreshold},</if> |
| | | <if test="dicountMoney != null">dicount_money = #{dicountMoney},</if> |
| | | <if test="discoutPercent != null">discout_percent = #{discoutPercent},</if> |
| | | <if test="discountMoney != null">discount_money = #{discountMoney},</if> |
| | | <if test="discountPercent != null">discount_percent = #{discountPercent},</if> |
| | | <if test="useScope != null">use_scope = #{useScope},</if> |
| | | <if test="validTimeType != null">valid_time_type = #{validTimeType},</if> |
| | | <if test="validStartTime != null">valid_start_time = #{validStartTime},</if> |