lidongdong
2023-08-30 cbe3888bb6b1012273f16409f988114abd4542c5
新增小程序商家购买下单接口    小程序积分兑换记录列表修改
9个文件已修改
340 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/pom.xml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/XmostBeautifulApi.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/VolunteerCreditsExchangeVO.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerIntegralMerchantApi.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/VolunteerCreditsExchange.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerCreditsExchangeService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerCreditsExchangeMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/pom.xml
@@ -76,17 +76,17 @@
    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources/lib</directory>
                <targetPath>/BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <targetPath>BOOT-INF/classes/</targetPath>
            </resource>
<!--            <resource>-->
<!--                <directory>${project.basedir}/src/main/resources/lib</directory>-->
<!--                <targetPath>/BOOT-INF/lib/</targetPath>-->
<!--                <includes>-->
<!--                    <include>**/*.jar</include>-->
<!--                </includes>-->
<!--            </resource>-->
<!--            <resource>-->
<!--                <directory>src/main/resources</directory>-->
<!--                <targetPath>BOOT-INF/classes/</targetPath>-->
<!--            </resource>-->
        </resources>
        <plugins>
            <plugin>
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/XmostBeautifulApi.java
@@ -129,7 +129,7 @@
        {
            item.setCommunityId(userInfoVO.getCommunityId()+"");
        }
        item.setOrderType("1");
        item.setUserId(userInfoVO.getUserId()+"");
        item.setNeedScore(userInfoVO.getLoveIntegral());
        return communityService.insertData(item);
@@ -143,6 +143,7 @@
    @PostMapping("/order/update")
    public R update(@RequestBody VolunteerCreditsExchangeVO item)
    {
        item.setOrderType("1");
        return communityService.update(item);
    }
@@ -208,5 +209,130 @@
        return communityService.volunteerTypeGetList(pageNum,pageSize,"2");
    }
    /***********************************************************************************************************
     *
     *
     *                   订单兑换
     *
     *
     ***********************************************************************************************************/
    /**
     * 分页查询
     * @param
     * @return
     */
    @GetMapping("/order/getList")
    public R orderMerchantGetList(@RequestParam("pageNum") int pageNum,
                     @RequestParam("pageSize")  int pageSize,
                     @RequestParam(value = "goodsId", required = false) String goodsId,
                     @RequestParam(value = "orderNumber", required = false) String orderNumber,
                     @RequestParam(value = "goodsName", required = false) String goodsName,
                     @RequestParam(value = "condition", required = false) String condition,
                     @RequestParam(value = "userName", required = false) String userName,
                     @RequestParam(value = "communityId", required = false) String communityId,
                     @RequestParam(value = "communityId", required = false) String orderType)
    {
        if(StringUtils.isEmpty(communityId))
        {
            communityId=getCommunityId()+"";
        }
        return communityService.getList(pageNum,pageSize,goodsId,orderNumber,goodsName,
                condition,userName,communityId,getUserId()+"",orderType);
    }
    /**
     * 查询详情
     * @param id
     * @return
     */
    @GetMapping("/order/getData")
    public R orderMerchantGetData(@RequestParam("id") String id)
    {
        if(StringUtils.isEmpty(id))
        {
            return R.fail("订单id不能为空");
        }
        return communityService.getData(id);
    }
    /**
     * 新增
     * @param
     * @return
     */
    @PostMapping("/order/insertData")
    public R orderMerchantInsertData(@RequestBody VolunteerCreditsExchangeVO item)
    {
        LoginUserInfoVO userInfoVO= getLoginUserInfo();
        if(StringUtils.isEmpty(item.getCommunityId()))
        {
            item.setCommunityId(userInfoVO.getCommunityId()+"");
        }
        item.setOrderType("2");
        item.setUserId(userInfoVO.getUserId()+"");
        item.setNeedScore(userInfoVO.getLoveIntegral());
        return communityService.insertData(item);
    }
    /**
     * 新增用户购买商家商品记录
     * @param
     * @return
     */
    @PostMapping("/order/insertMerchantData")
    public R insertMerchantData(@RequestBody VolunteerCreditsExchangeVO item)
    {
        if(StringUtils.isEmpty(item.getPalyIntegral()))
        {
            return R.fail("请输入兑换积分");
        }
        LoginUserInfoVO userInfoVO= getLoginUserInfo();
        if(StringUtils.isEmpty(item.getCommunityId()))
        {
            item.setCommunityId(userInfoVO.getCommunityId()+"");
        }
        item.setOrderType("2");
        item.setUserId(userInfoVO.getUserId()+"");
        item.setNeedScore(userInfoVO.getLoveIntegral());
        return communityService.insertMerchantData(item);
    }
    /**
     * 更新
     * @param item
     * @return
     */
    @PostMapping("/order/update")
    public R orderMerchantUpdate(@RequestBody VolunteerCreditsExchangeVO item)
    {
        item.setOrderType("2");
        return communityService.update(item);
    }
    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/order/delete")
    public R orderMerchantDelete(@RequestParam("id") String id)
    {
        if(StringUtils.isEmpty(id))
        {
            return R.fail("订单id不能为空");
        }
        return communityService.delete(id);
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/VolunteerCreditsExchangeVO.java
@@ -82,4 +82,17 @@
    @ApiModelProperty(value = "1 社区兑换订单     2商家商品购买订单")
    private String orderType;
    /**
     * 商品数量
     */
    @ApiModelProperty(value = "实际支付积分")
    private String palyIntegral;
    /**
     * 商品数量
     */
    @ApiModelProperty(value = "商家id")
    private String merchantId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -11541,7 +11541,7 @@
                     @RequestParam(value = "userName", required = false) String userName,
                     @RequestParam(value = "communityId", required = false) String communityId,
                     @RequestParam(value = "userId", required = false) String userId,
                     @RequestParam(value = "orderType", required = true) String orderType);
                     @RequestParam(value = "orderType", required = false) String orderType);
    /**
     * 查询详情
@@ -11560,6 +11560,14 @@
    public R insertData(@RequestBody VolunteerCreditsExchangeVO item);
    /**
     * 新增用户购买商家商品记录
     * @param
     * @return
     */
    @PostMapping("/order/insertMerchantData")
    public R insertMerchantData(@RequestBody VolunteerCreditsExchangeVO item);
    /**
     * 更新
     * @param item
     * @return
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerIntegralMerchantApi.java
@@ -216,7 +216,7 @@
                     @RequestParam(value = "userName", required = false) String userName,
                     @RequestParam(value = "communityId", required = false) String communityId,
                     @RequestParam(value = "userId", required = false) String userId,
                     @RequestParam(value = "orderType", required = true) String orderType)
                     @RequestParam(value = "orderType", required = false) String orderType)
    {
        return vceService.getList(pageNum,pageSize,goodsId,orderNumber,goodsName,
                condition,userName,communityId,userId,orderType);
@@ -256,6 +256,24 @@
    }
    /**
     * 新增用户购买商家商品记录
     * @param
     * @return
     */
    @PostMapping("/order/insertMerchantData")
    public R insertMerchantData(@RequestBody VolunteerCreditsExchangeVO item)
    {
        LoginUserInfoVO userInfoVO= getLoginUserInfo();
        if(StringUtils.isEmpty(item.getCommunityId()))
        {
            item.setCommunityId(userInfoVO.getCommunityId()+"");
        }
        item.setUserId(userInfoVO.getUserId()+"");
        return vceService.insertMerchantData(item);
    }
    /**
     * 更新
     * @param item
     * @return
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/VolunteerCreditsExchange.java
@@ -113,5 +113,21 @@
    @ApiModelProperty(value = "1 社区兑换订单     2商家商品购买订单")
    private String orderType;
    /**
     * 商品数量
     */
    @ApiModelProperty(value = "实际支付积分")
    private String palyIntegral;
    /**
     * 商品数量
     */
    @ApiModelProperty(value = "商家id")
    private String merchantId;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerCreditsExchangeService.java
@@ -38,6 +38,14 @@
     */
    R insertData(VolunteerCreditsExchangeVO item);
    /**
     * 积分购买商家商品
     * @param item
     * @return
     */
    R insertMerchantData(VolunteerCreditsExchangeVO item);
    /**
     * 更新
     * @param item
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java
@@ -6,19 +6,14 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.VolunteerCreditsExchangeVO;
import com.panzhihua.common.model.vos.community.VolunteerIntegralMerchantVO;
import com.panzhihua.common.model.vos.community.VolunteerTypeVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.VolunteerCreditsExchangeDao;
import com.panzhihua.service_community.dao.VolunteerTypeDao;
import com.panzhihua.service_community.entity.VolunteerActivity;
import com.panzhihua.service_community.entity.VolunteerCreditsExchange;
import com.panzhihua.service_community.entity.VolunteerIntegralMerchant;
import com.panzhihua.service_community.entity.VolunteerType;
import com.panzhihua.service_community.service.VolunteerCreditsExchangeService;
import com.panzhihua.service_community.service.VolunteerIntegralMerchantService;
import com.panzhihua.service_community.service.VolunteerTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -65,9 +60,30 @@
        }
        VolunteerIntegralMerchant goods=goodsService.queryById(item.getGoodsId());
        LoginUserInfoVO loginUserInfoVOR=userService.getUserInfoByUserId(item.getUserId()).getData();
        if(goods==null)
        {
            return R.fail("商品不存在");
        }
        int integral=0;
        if(!StringUtils.isEmpty(loginUserInfoVOR.getLoveIntegral()))
        {
            integral=Integer.valueOf(loginUserInfoVOR.getLoveIntegral());
        }
        if(integral<Integer.valueOf(goods.getIntegral()))
        {
            return R.fail("剩余积分不足!无法下单兑换");
        }
        item.setNeedScore(goods.getIntegral());
        if(StringUtils.isEmpty(item.getUserId()))
        {
            return R.fail("兑换用户id不能为空");
        }
        if(StringUtils.isEmpty(goods.getGoodNum()))
@@ -91,7 +107,52 @@
        }
        int num1=integral-Integer.valueOf(goods.getIntegral());
        loginUserInfoVOR.setLoveIntegral(num1+"");
        userService.putUser(loginUserInfoVOR);
        item.setPalyIntegral(goods.getIntegral());
        //设置订单号
        item.setOrderNumber(Snowflake.getId()+"");
        int num= baseMapper.insertData(item);
        if(num>0)
        {
            return R.ok();
        }
        return R.fail("操作失败");
    }
    @Override
    public R insertMerchantData(VolunteerCreditsExchangeVO item)
    {
        if (item==null)
        {
            return R.fail("参数不能为空");
        }
        if(StringUtils.isEmpty(item.getGoodsId()))
        {
            return R.fail("商品id不能为空");
        }
        if(StringUtils.isEmpty(item.getMerchantId()))
        {
            return R.fail("商家id不能为空");
        }
        VolunteerIntegralMerchant goods=goodsService.queryById(item.getGoodsId());
        LoginUserInfoVO loginUserInfoVOR=userService.getUserInfoByUserId(item.getUserId()).getData();
        if(goods==null)
        {
            return R.fail("商品不存在");
        }
        if(StringUtils.isEmpty(item.getPalyIntegral()))
        {
            return R.fail("支付积分不能为空");
        }
        int integral=0;
        if(!StringUtils.isEmpty(loginUserInfoVOR.getLoveIntegral()))
@@ -99,9 +160,9 @@
            integral=Integer.valueOf(loginUserInfoVOR.getLoveIntegral());
        }
        if(integral<Integer.valueOf(goods.getIntegral()))
        if(integral<Integer.valueOf(item.getPalyIntegral()))
        {
            return R.fail("剩余积分不足!无法下单兑换");
            return R.fail("剩余积分不足!无法支付");
        }
        item.setNeedScore(goods.getIntegral());
@@ -111,10 +172,32 @@
            return R.fail("兑换用户id不能为空");
        }
        int num1=integral-Integer.valueOf(goods.getIntegral());
        if(StringUtils.isEmpty(goods.getGoodNum()))
        {
            return R.fail("商品库存不足");
        }
        else
        {
            int goodNum=Integer.valueOf(goods.getGoodNum());
            if(goodNum<=0)
            {
                return R.fail("商品库存不足");
            }
            goodNum--;
            VolunteerIntegralMerchantVO vo=new VolunteerIntegralMerchantVO();
            vo.setId(goods.getId());
            vo.setGoodNum(goodNum+"");
            goodsService.updateById(vo);
        }
        int num1=integral-Integer.valueOf(item.getPalyIntegral());
        loginUserInfoVOR.setLoveIntegral(num1+"");
        userService.putUser(loginUserInfoVOR);
        item.setCondition("3");
        //设置订单号
        item.setOrderNumber(Snowflake.getId()+"");
        int num= baseMapper.insertData(item);
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerCreditsExchangeMapper.xml
@@ -16,6 +16,8 @@
        <result property="condition" column="condition" />
        <result property="disposeTime" column="dispose_time" />
        <result property="orderType" column="order_type" />
        <result property="palyIntegral" column="paly_integral" />
        <result property="merchantId" column="merchant_id" />
    </resultMap>
@@ -35,6 +37,8 @@
            vce.dispose_time,
            vce.community_id,
            vce.order_type,
            vce.paly_integral,
            vce.merchant_id,
            vce.update_time
        from volunteer_credits_exchange as vce
        where vce.id=#{id}
@@ -57,6 +61,8 @@
            vce.dispose_time,
            vce.community_id,
            vce.order_type,
            vce.paly_integral,
            vce.merchant_id,
            vce.update_time
        from volunteer_credits_exchange as vce
        <where>
@@ -125,6 +131,12 @@
            <if test="item.orderType != null">
                order_type,
            </if>
            <if test="item.palyIntegral != null">
                paly_integral,
            </if>
            <if test="item.merchantId != null">
                merchant_id,
            </if>
            creation_time
        </trim>
        values
@@ -161,6 +173,12 @@
            </if>
            <if test="item.orderType != null">
                #{item.orderType},
            </if>
            <if test="item.palyIntegral != null">
                #{item.palyIntegral},
            </if>
            <if test="item.merchantId != null">
                #{item.merchantId},
            </if>
            sysdate()
        </trim>
@@ -202,6 +220,12 @@
            <if test="item.orderType != null">
                order_type=#{item.orderType},
            </if>
            <if test="item.palyIntegral != null">
                paly_integral=#{item.palyIntegral},
            </if>
            <if test="item.merchantId != null">
                merchant_id=#{item.merchantId},
            </if>
            update_time=sysdate()
        </set>
        where id = #{item.id}