springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/XmostBeautifulApi.java
@@ -272,7 +272,16 @@ } /** * 社区取消订单 * @param id * @return */ @GetMapping("/order/communityCancellation") public R communityCancellation(@RequestParam("id") String id) { return communityService.communityCancellation(id); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/VolunteerCreditsExchangeVO.java
@@ -95,4 +95,11 @@ @ApiModelProperty(value = "商家id") private String merchantId; /** * 商品购买数量 */ @ApiModelProperty(value = "商品购买数量") private String palyNum; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/VolunteerIntegralRecordVO.java
@@ -41,4 +41,8 @@ @ApiModelProperty(value = "用户id") private String userId; @ApiModelProperty(value = "社区id") private String communityId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -11416,7 +11416,7 @@ * @param grantIntegral * @return */ @PostMapping("/grantIntegral") @PostMapping("/VolunteerActivitiesPeople/grantIntegral") public R grantIntegral(@RequestBody GrantIntegral grantIntegral); /************************************************************************************************************** @@ -11644,4 +11644,13 @@ @GetMapping("/VolunteerMerchant/isMerchant") public R isMerchant(@RequestParam("userId") String userId); /** * 社区取消订单 * @param id * @return */ @GetMapping("/VolunteerIntegralMerchant/order/communityCancellation") public R communityCancellation(@RequestParam("id") String id); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerActivitiesPeopleApi.java
@@ -105,9 +105,9 @@ return R.fail("参数不能为空"); } if(StringUtils.isEmpty(grantIntegral.getUserId())) if(StringUtils.isEmpty(grantIntegral.getActivityId())) { return R.fail("用户id不能为空"); return R.fail("活动id不能为空"); } if(grantIntegral.getPeopleAndGranList()==null || grantIntegral.getPeopleAndGranList().size()<=0 ) springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerIntegralMerchantApi.java
@@ -296,4 +296,21 @@ } /** * 社区取消订单 * @param id * @return */ @GetMapping("/order/communityCancellation") public R communityCancellation(@RequestParam("id") String id) { if(StringUtils.isEmpty(id)) { return R.fail("订单id不能为空"); } return vceService.communityCancellation(id); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/VolunteerIntegralRecordDao.java
@@ -30,7 +30,8 @@ * @return */ IPage<VolunteerIntegralRecord> getList(Page page, @Param("userId") String userId); @Param("userId") String userId, @Param("communityId") String communityId); /** * 新增 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/VolunteerCreditsExchange.java
@@ -125,6 +125,12 @@ @ApiModelProperty(value = "商家id") private String merchantId; /** * 商品购买数量 */ @ApiModelProperty(value = "商品购买数量") private String palyNum; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/VolunteerIntegralRecord.java
@@ -41,6 +41,7 @@ @ApiModelProperty(value = "用户id") private String userId; @ApiModelProperty(value = "社区id") private String communityId; } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerCreditsExchangeService.java
@@ -67,4 +67,14 @@ */ R conditionData(String id); /** * 社区取消订单 * @param id 订单iD * @return */ R communityCancellation(String id); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerActivitiesPeopleServiceImpl.java
@@ -61,12 +61,18 @@ } @Override public R grantIntegral(GrantIntegral grantIntegral) { public R grantIntegral(GrantIntegral grantIntegral) { for (GrantIntegral item: grantIntegral.getPeopleAndGranList() ) { if(StringUtils.isEmpty(grantIntegral.getId())) { return R.fail("奖励发放id不能为空!"); } if(StringUtils.isEmpty(grantIntegral.getGrantIntegral())) { return R.fail("奖励发放积分不能为空!"); } VolunteerActivitiesPeopleVO vla=new VolunteerActivitiesPeopleVO(); @@ -75,10 +81,10 @@ vla.setIssueStatus("1"); baseMapper.vapUpdate(vla); //用户新增积分 LoginUserInfoVO sysUser=userService.getUserInfoByUserId(item.getUserId()).getData(); int grant=0; if(!StringUtils.isNotEmpty(sysUser.getLoveIntegral())) if(!StringUtils.isEmpty(sysUser.getLoveIntegral())) { grant=Integer.valueOf(sysUser.getLoveIntegral()); } @@ -92,15 +98,15 @@ volunteerIntegralRecordVO.setVolunteerId(item.getVolunteerId()); volunteerIntegralRecordVO.setUserId(item.getUserId()); volunteerIntegralRecordVO.setIType("1"); volunteerIntegralRecordVO.setCommunityId(item.getCommunityId()); volunteerIntegralRecordService.insertVolunteer(volunteerIntegralRecordVO); } VolunteerActivityVO activityVO=new VolunteerActivityVO(); activityVO.setId(grantIntegral.getActivityId()); activityVO.setAwardState("1"); volunteerActivityService.updateById(activityVO); // VolunteerActivityVO activityVO=new VolunteerActivityVO(); // activityVO.setId(grantIntegral.getActivityId()); // activityVO.setAwardState("1"); // volunteerActivityService.updateById(activityVO); return R.ok(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java
@@ -6,6 +6,7 @@ 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.VolunteerIntegralRecordVO; import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.common.utlis.StringUtils; @@ -14,6 +15,7 @@ import com.panzhihua.service_community.entity.VolunteerIntegralMerchant; import com.panzhihua.service_community.service.VolunteerCreditsExchangeService; import com.panzhihua.service_community.service.VolunteerIntegralMerchantService; import com.panzhihua.service_community.service.VolunteerIntegralRecordService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -30,6 +32,10 @@ @Resource private UserService userService; @Resource private VolunteerIntegralRecordService virService; @Override public R getList(int pageNum, int pageSize, String goodsId, String orderNumber, @@ -107,6 +113,15 @@ } //增加积分明细记录 VolunteerIntegralRecordVO virvo=new VolunteerIntegralRecordVO(); virvo.setUserId(loginUserInfoVOR.getUserId()+""); virvo.setIType("2"); virvo.setIntegral(item.getPalyIntegral()); virvo.setCommunityId(item.getCommunityId()); virService.insertVolunteer(virvo); int num1=integral-Integer.valueOf(goods.getIntegral()); loginUserInfoVOR.setLoveIntegral(num1+""); userService.putUser(loginUserInfoVOR); @@ -171,6 +186,15 @@ { return R.fail("兑换用户id不能为空"); } //增加积分明细记录 VolunteerIntegralRecordVO virvo=new VolunteerIntegralRecordVO(); virvo.setUserId(loginUserInfoVOR.getUserId()+""); virvo.setIType("3"); virvo.setIntegral(item.getPalyIntegral()); virvo.setCommunityId(item.getCommunityId()); virService.insertVolunteer(virvo); int num1=integral-Integer.valueOf(item.getPalyIntegral()); loginUserInfoVOR.setLoveIntegral(num1+""); @@ -248,4 +272,59 @@ } return R.fail("操作失败"); } /** * 社区订单取消 * @param id 订单iD * @return */ @Override public R communityCancellation(String id) { if(StringUtils.isEmpty(id)) { return R.fail("订单id不能为空"); } //查询订单 VolunteerCreditsExchange vce=baseMapper.getData(id); if(StringUtils.equals("0",vce.getCondition())) { //修改订单状态为取消 VolunteerCreditsExchangeVO volunteerCreditsExchangeVO=new VolunteerCreditsExchangeVO(); volunteerCreditsExchangeVO.setId(id); volunteerCreditsExchangeVO.setCondition("2"); baseMapper.update(volunteerCreditsExchangeVO); //查询用户详情 LoginUserInfoVO loginUserInfoVOR=userService.getUserInfoByUserId(vce.getUserId()).getData(); int integral=0; if(!StringUtils.isEmpty(loginUserInfoVOR.getLoveIntegral())) { integral=Integer.valueOf(loginUserInfoVOR.getLoveIntegral()); } integral=integral+Integer.valueOf(vce.getPalyIntegral()); loginUserInfoVOR.setLoveIntegral(integral+""); userService.putUser(loginUserInfoVOR); //更新商品库存 VolunteerIntegralMerchant goods=goodsService.queryById(vce.getGoodsId()); VolunteerIntegralMerchantVO vimvo=new VolunteerIntegralMerchantVO(); int goodNum=Integer.valueOf(goods.getGoodNum()); goodNum++; vimvo.setId(goods.getId()); vimvo.setGoodNum(goodNum+""); goodsService.updateById(vimvo); //增加积分明细记录 VolunteerIntegralRecordVO virvo=new VolunteerIntegralRecordVO(); virvo.setUserId(loginUserInfoVOR.getUserId()+""); virvo.setIType("4"); virvo.setIntegral(vce.getPalyIntegral()); virvo.setCommunityId(vce.getCommunityId()); virService.insertVolunteer(virvo); } return R.fail("订单不是未核销订单"); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerIntegralRecordServiceImpl.java
@@ -27,7 +27,7 @@ public R getList(int pageNum, int pageSize, String userId) { Page page = new Page<VolunteerIntegralRecord>(pageNum,pageSize); return R.ok(baseMapper.getList(page,userId)); return R.ok(baseMapper.getList(page,userId,null)); } @Override springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerCreditsExchangeMapper.xml
@@ -18,6 +18,7 @@ <result property="orderType" column="order_type" /> <result property="palyIntegral" column="paly_integral" /> <result property="merchantId" column="merchant_id" /> <result property="palyNum" column="paly_num" /> </resultMap> @@ -39,6 +40,7 @@ vce.order_type, vce.paly_integral, vce.merchant_id, vce.paly_num, vce.update_time from volunteer_credits_exchange as vce where vce.id=#{id} @@ -63,6 +65,7 @@ vce.order_type, vce.paly_integral, vce.merchant_id, vce.paly_num, vce.update_time from volunteer_credits_exchange as vce <where> @@ -137,6 +140,9 @@ <if test="item.merchantId != null"> merchant_id, </if> <if test="item.palyNum != null"> paly_num, </if> creation_time </trim> values @@ -179,6 +185,9 @@ </if> <if test="item.merchantId != null"> #{item.merchantId}, </if> <if test="item.paly_num != null"> #{item.palyNum}, </if> sysdate() </trim> @@ -226,6 +235,9 @@ <if test="item.merchantId != null"> merchant_id=#{item.merchantId}, </if> <if test="item.palyNum != null"> paly_num=#{item.palyNum}, </if> update_time=sysdate() </set> where id = #{item.id} springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerIntegralRecordMapper.xml
@@ -10,6 +10,7 @@ <result property="volunteerId" column="volunteer_id" /> <result property="updateTime" column="update_time" /> <result property="userId" column="user_id" /> <result property="communityId" column="community_id" /> </resultMap> @@ -22,6 +23,7 @@ integral, update_time, user_id, community_id, volunteer_id from volunteer_integral_record where id= #{id} @@ -36,11 +38,15 @@ update_time, integral, user_id, community_id, volunteer_id from volunteer_integral_record <where> <if test="userId!=null"> user_id=#{userId} </if> <if test="communityId!=null"> community_id=#{communityId} </if> </where> order by creation_time desc @@ -52,14 +58,17 @@ <if test="volunteerIntegralRecordVO.id != null"> id, </if> <if test="volunteerIntegralRecordVO.id != null"> <if test="volunteerIntegralRecordVO.iType != null"> i_type, </if> <if test="volunteerIntegralRecordVO.id != null"> <if test="volunteerIntegralRecordVO.integral != null"> integral, </if> <if test="volunteerIntegralRecordVO.id != null"> <if test="volunteerIntegralRecordVO.volunteerId != null"> volunteer_id, </if> <if test="volunteerIntegralRecordVO.communityId != null"> community_id, </if> creation_time </trim> @@ -76,6 +85,9 @@ </if> <if test="volunteerIntegralRecordVO.volunteerId != null"> #{volunteerIntegralRecordVO.volunteerId}, </if> <if test="volunteerIntegralRecordVO.communityId != null"> #{volunteerIntegralRecordVO.communityId}, </if> sysdate() </trim> @@ -96,6 +108,9 @@ <if test="volunteerIntegralRecordVO.volunteerId != null"> volunteer_id=#{volunteerIntegralRecordVO.volunteerId}, </if> <if test="volunteerIntegralRecordVO.communityId != null"> community_id=#{volunteerIntegralRecordVO.communityId}, </if> update_time=sysdate() </set> where id = #{volunteerIntegralRecordVO.id}