From 440287b640ec282b2bcd3f34e617ee0c62117c3d Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 22 Apr 2021 14:26:05 +0800 Subject: [PATCH] 20210422 签到 --- zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff-info.html | 3 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff.html | 32 +++++----- zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignWriteoffService.java | 2 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html | 4 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java | 107 ++++++++++++++++++++++++++++++++--- zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-logistics-info.html | 7 +- zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html | 4 7 files changed, 124 insertions(+), 35 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignWriteoffService.java b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignWriteoffService.java index ebd77b1..b6d7560 100644 --- a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignWriteoffService.java +++ b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignWriteoffService.java @@ -25,6 +25,7 @@ import com.matrix.system.activity.vo.ZjrVo; import com.matrix.system.common.bean.SysUsers; import com.matrix.system.common.bean.SystemDictionary; +import com.matrix.system.common.constance.AppConstance; import com.matrix.system.common.dao.SystemDictionaryDao; import com.matrix.system.hive.action.util.QueryUtil; import com.matrix.system.hive.dao.SysVipInfoDao; @@ -222,6 +223,7 @@ shopDeliveryInfo.setLogisticsCompany(systemDictionary.getName()); shopDeliveryInfo.setLogisticsCompanyCode(systemDictionary.getCode()); shopDeliveryInfo.setDeliveryWay("物流配送"); + shopDeliveryInfo.setLogisticsStatus(AppConstance.LOGISTICS_STATUS_OF_RECEIVE); shopDeliveryInfo.setWaybillNo(logisticsSubmitDto.getKddh()); shopDeliveryInfo.setUpdateBy(sysUsers.getSuName()); diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java index a54a119..58a824d 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java @@ -20,19 +20,17 @@ import com.matrix.system.activity.entity.ActivitySignReceiveRecord; import com.matrix.system.activity.entity.ActivitySignRecord; import com.matrix.system.activity.entity.ActivitySignWriteoff; +import com.matrix.system.common.constance.AppConstance; import com.matrix.system.hive.bean.SysVipInfo; +import com.matrix.system.score.entity.ScoreVipDetail; +import com.matrix.system.score.service.ScoreVipDetailService; import com.matrix.system.shopXcx.api.dto.SeeAwardTextDto; import com.matrix.system.shopXcx.api.dto.SignAwardDto; import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; +import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil; import com.matrix.system.shopXcx.api.vo.*; -import com.matrix.system.shopXcx.bean.ShopActivities; -import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; -import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; -import com.matrix.system.shopXcx.bean.ShopReceiveAddress; -import com.matrix.system.shopXcx.dao.ShopActivitiesDao; -import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; -import com.matrix.system.shopXcx.dao.ShopLogisticsInfoDao; -import com.matrix.system.shopXcx.dao.ShopReceiveAddressDao; +import com.matrix.system.shopXcx.bean.*; +import com.matrix.system.shopXcx.dao.*; import com.matrix.system.shopXcx.vo.SalesOrderVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -82,6 +80,14 @@ @Autowired private WxShopLogisticsQueryService wxShopLogisticsQueryService; + @Autowired + private ScoreVipDetailService scoreVipDetailService; + @Autowired + private ShopCouponDao shopCouponDao; + @Autowired + private WxShopCouponUtil wxShopCouponUtil; + @Autowired + private ShopCouponRecordDao shopCouponRecordDao; @ApiOperation(value = "获取签到基本信息", notes = "") @ApiResponses({ @@ -339,6 +345,48 @@ signSuccessVo.setAwardName(activitySignAwardSetNormal.getAwardName()); signSuccessVo.setAwardImg(activitySignAwardSetNormal.getIntroduceImg()); signSuccessVos.add(signSuccessVo); + + //日常奖励积分,对应用户积分加减 + int awardType = activitySignAwardSetNormal.getAwardType(); + if(ActivitySignAwardSet.AWARDTYPE_SCORE == awardType){ + int scoreCnt = activitySignAwardSetNormal.getScoreCnt(); + if(scoreCnt > 0){ + scoreVipDetailService.addScore(userId,null,null,scoreCnt, + activitySignReceiveRecord.getId(), ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,""); + } + } + //获取优惠券 + if(ActivitySignAwardSet.AWARDTYPE_COUPON == awardType){ + //获取优惠券 + int couponId = Integer.parseInt(activitySignAwardSetNormal.getCouponId()); + ShopCoupon shopCoupon = shopCouponDao.selectById(couponId); + // 如果没有找到该优惠券 + if (shopCoupon == null) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "没有找到该优惠券!"); + } + // 如果优惠券有数量限制并且已经领完 + if (shopCoupon.getMaxQuantity() >= 0 && (shopCoupon.getMaxQuantity() <= shopCoupon.getQuantityReceive())) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券已领完!"); + } + boolean newPeople = wxShopCouponUtil.verifyIsNewPeople(userId); + // 如果改券是新人专属且当前用户不是新人 + if (AppConstance.COUPON_GET_LIMT_NEW.equals(shopCoupon.getGetLimit()) && !newPeople) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "该优惠券为新人专享优惠券!"); + } + ShopCouponRecord insertRecord = new ShopCouponRecord(); + insertRecord.setCreateBy(AppConstance.SYSTEM_USER); + insertRecord.setUpdateBy(AppConstance.SYSTEM_USER); + insertRecord.setCId(couponId); + insertRecord.setUserId(userId); + insertRecord.setIsUsing(2); + int i = shopCouponRecordDao.insert(insertRecord); + // 如果插入领取记录表失败 + if (i < 0) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券领取失败!"); + } + shopCoupon.setQuantityReceive(shopCoupon.getQuantityReceive() + 1); + shopCouponDao.updateByModel(shopCoupon); + } } //获取当前累计天数 int cumulativeDay = getCumulativeDay(actId, userId, date, 0); @@ -425,8 +473,48 @@ //3:优惠券 if(ActivitySignAwardSet.AWARDTYPE_COUPON == activitySignAwardSetCumulativeDay.getAwardType()) { signSuccessVo.setCouponName(activitySignAwardSetCumulativeDay.getCouponName()); + //获取优惠券 + int couponId = Integer.parseInt(activitySignAwardSetCumulativeDay.getCouponId()); + ShopCoupon shopCoupon = shopCouponDao.selectById(couponId); + // 如果没有找到该优惠券 + if (shopCoupon == null) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "没有找到该优惠券!"); + } + // 如果优惠券有数量限制并且已经领完 + if (shopCoupon.getMaxQuantity() >= 0 && (shopCoupon.getMaxQuantity() <= shopCoupon.getQuantityReceive())) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券已领完!"); + } + boolean newPeople = wxShopCouponUtil.verifyIsNewPeople(userId); + // 如果改券是新人专属且当前用户不是新人 + if (AppConstance.COUPON_GET_LIMT_NEW.equals(shopCoupon.getGetLimit()) && !newPeople) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "该优惠券为新人专享优惠券!"); + } + ShopCouponRecord insertRecord = new ShopCouponRecord(); + insertRecord.setCreateBy(AppConstance.SYSTEM_USER); + insertRecord.setUpdateBy(AppConstance.SYSTEM_USER); + insertRecord.setCId(couponId); + insertRecord.setUserId(userId); + insertRecord.setIsUsing(2); + int i = shopCouponRecordDao.insert(insertRecord); + // 如果插入领取记录表失败 + if (i < 0) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "优惠券领取失败!"); + } + shopCoupon.setQuantityReceive(shopCoupon.getQuantityReceive() + 1); + shopCouponDao.updateByModel(shopCoupon); } activitySignReceiveRecordDao.insert(activitySignReceiveRecord); + //累计奖励积分,对应用户积分加减 + if(ActivitySignAwardSet.AWARDTYPE_SCORE == activitySignAwardSetCumulativeDay.getAwardType()) { + int awardType = activitySignAwardSetCumulativeDay.getAwardType(); + if(ActivitySignAwardSet.AWARDTYPE_SCORE == awardType){ + int scoreCnt = activitySignAwardSetCumulativeDay.getScoreCnt(); + if(scoreCnt > 0){ + scoreVipDetailService.addScore(userId,null,null,scoreCnt, + activitySignReceiveRecord.getId(), ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,""); + } + } + } //生成核销记录 if(ActivitySignAwardSet.AWARDTYPE_CUSTOMIZE == activitySignAwardSetCumulativeDay.getAwardType()) { ActivitySignWriteoff activitySignWriteoff = new ActivitySignWriteoff(); @@ -476,7 +564,8 @@ DateTime offsetDay = DateUtil.offsetDay(date, -i); return getCumulativeDay(actId,userId,offsetDay,i); } - + + /** * 获取累计的签到奖品 * diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-logistics-info.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-logistics-info.html index 87cd06e..46fa5e1 100644 --- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-logistics-info.html +++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-logistics-info.html @@ -136,7 +136,7 @@ </el-col> </el-row> <el-row style="padding: 10px"> - <el-col class="col-sm-10" > + <el-col class="col-sm-10" v-show='false'> <el-form-item label="快递公司编码:"> <el-input v-model="ruleForm.kdgs" :disabled="(formSelect.state == 3 ? true:false)"></el-input> </el-form-item> @@ -256,7 +256,7 @@ mounted: function () { }, methods: { - //加载分类 + //加载 loadInfo() { let _this = this; //加载配置 @@ -320,8 +320,7 @@ message: data.info, type: 'success', }); - parent.layer.close(parent.layer.getFrameIndex(window.name)); - parent.location.reload(); + _this.loadInfo(); } }); }, diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html index c2b1b1c..09be132 100644 --- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html +++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-update.html @@ -527,9 +527,9 @@ <el-form-item label="字体大小" style="padding: 10px"> <el-input-number v-model="typographyNum" :min="10" :max="20" label="描述文字"></el-input-number> </el-form-item> - <el-form-item label="字体透明度" style="padding: 10px"> + <!--<el-form-item label="字体透明度" style="padding: 10px"> <el-input-number v-model="typographyLight" :min="1" :max="100" label="描述文字">%</el-input-number> - </el-form-item> + </el-form-item>--> </div> </el-tab-pane> </el-tabs> diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff-info.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff-info.html index eeb3d40..07d826c 100644 --- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff-info.html +++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff-info.html @@ -177,8 +177,7 @@ message: data.info, type: 'success', }); - parent.layer.close(parent.layer.getFrameIndex(window.name)); - parent.location.reload(); + _this.loadInfo(); } }); }, diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff.html index d368dd8..6b8aec3 100644 --- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff.html +++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff.html @@ -60,21 +60,9 @@ stripe:true @sort-change="sortChange"> <el-table-column - prop="writeoffTime" - label="核销时间" + prop="receiveName" + label="中奖者" show-overflow-tooltip> - </el-table-column> - <el-table-column - prop="writeoffUser" - label="核销员" - show-overflow-tooltip> - </el-table-column> - <el-table-column - label="兑奖码" - show-overflow-tooltip> - <template slot-scope="scope"> - <span v-if="scope.row.state == 3">{{scope.row.writeoffCode}}</span> - </template> </el-table-column> <el-table-column prop="actName" @@ -109,11 +97,23 @@ </template> </el-table-column> <el-table-column - prop="receiveName" - label="中奖者" + prop="writeoffTime" + label="核销时间" show-overflow-tooltip> </el-table-column> <el-table-column + prop="writeoffUser" + label="核销员" + show-overflow-tooltip> + </el-table-column> + <el-table-column + label="兑奖码" + show-overflow-tooltip> + <template slot-scope="scope"> + <span v-if="scope.row.state == 3">{{scope.row.writeoffCode}}</span> + </template> + </el-table-column> + <el-table-column prop="receiveAddress" label="收货地址" show-overflow-tooltip> diff --git a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html index 4c80c88..db15444 100644 --- a/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html +++ b/zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html @@ -533,9 +533,9 @@ <el-form-item label="字体大小" style="padding: 10px"> <el-input-number v-model="typographyNum" :min="10" :max="20" label="描述文字"></el-input-number> </el-form-item> - <el-form-item label="字体透明度" style="padding: 10px"> + <!--<el-form-item label="字体透明度" style="padding: 10px"> <el-input-number v-model="typographyLight" :min="1" :max="100" label="描述文字">%</el-input-number> - </el-form-item> + </el-form-item>--> </div> </el-tab-pane> </el-tabs> -- Gitblit v1.9.1