| | |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | 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.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.vo.SalesOrderVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @Autowired |
| | | private ActivitySignRecordDao activitySignRecordDao; |
| | | |
| | | @Autowired |
| | | ShopDeliveryInfoDao shopDeliveryInfoDao; |
| | | |
| | | @Autowired |
| | | private ShopLogisticsInfoDao shopLogisticsInfoDao; |
| | | @Autowired |
| | | private ShopReceiveAddressDao shopReceiveAddressDao; |
| | | |
| | | @Autowired |
| | | private WxShopLogisticsQueryService wxShopLogisticsQueryService; |
| | | |
| | | @ApiOperation(value = "获取签到基本信息", notes = "") |
| | | @ApiResponses({ |
| | |
| | | * 获取当前月份的天数 |
| | | */ |
| | | List<ActivitySignRecordVo> activitySignRecordVos = new ArrayList<>(); |
| | | //获取当前月的第一天是星期几 |
| | | DateTime dateTime = DateUtil.beginOfMonth(DateUtil.date()); |
| | | int i = DateUtil.dayOfWeek(dateTime); |
| | | for(int j = 1;j<i;j++){ |
| | | ActivitySignRecordVo activitySignRecordVoNull = new ActivitySignRecordVo(); |
| | | activitySignRecordVos.add(activitySignRecordVoNull); |
| | | } |
| | | List<String> monthFullDays = getMonthFullDay(DateUtil.year(DateUtil.date()), DateUtil.month(DateUtil.date()) + 1); |
| | | for(String monthFullDay : monthFullDays){ |
| | | ActivitySignRecordVo activitySignRecordVo = new ActivitySignRecordVo(); |
| | |
| | | ajaxResult.setData(signBasicInfoVo); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * 查看历史签到记录 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "查看历史签到记录", notes = "") |
| | | @GetMapping(value = "getSignRecord/{actId}/{month}") |
| | | @ResponseBody |
| | | public AjaxResult getSignRecord(@PathVariable("actId") long actId,@PathVariable("month") String dateStr) { |
| | | //获取登录人信息 |
| | | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | Long companyId = loginUser.getCompanyId(); |
| | | Long userId = loginUser.getId(); |
| | | Date date = DateUtil.parse(dateStr); |
| | | /** |
| | | * 默认获取当前月份 |
| | | * 获取当前月份的天数 |
| | | */ |
| | | List<ActivitySignRecordVo> activitySignRecordVos = new ArrayList<>(); |
| | | //获取当前月的第一天是星期几 |
| | | DateTime dateTime = DateUtil.beginOfMonth(date); |
| | | int i = DateUtil.dayOfWeek(dateTime); |
| | | for(int j = 1;j<i;j++){ |
| | | ActivitySignRecordVo activitySignRecordVoNull = new ActivitySignRecordVo(); |
| | | activitySignRecordVos.add(activitySignRecordVoNull); |
| | | } |
| | | List<String> monthFullDays = getMonthFullDay(DateUtil.year(DateUtil.date()), DateUtil.month(DateUtil.date()) + 1); |
| | | for(String monthFullDay : monthFullDays){ |
| | | ActivitySignRecordVo activitySignRecordVo = new ActivitySignRecordVo(); |
| | | activitySignRecordVo.setSignTime(monthFullDay); |
| | | activitySignRecordVo.setActivityId(actId); |
| | | activitySignRecordVo.setCompanyId(companyId); |
| | | //对应日期是否已签到 |
| | | Date dateSign = DateUtil.parse(monthFullDay); |
| | | ActivitySignRecord activitySignRecordDone = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,dateSign); |
| | | if(ObjectUtil.isNotEmpty(activitySignRecordDone)){ |
| | | activitySignRecordVo.setState(1); |
| | | }else{ |
| | | activitySignRecordVo.setState(2); |
| | | } |
| | | activitySignRecordVos.add(activitySignRecordVo); |
| | | } |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | ajaxResult = AjaxResult.buildSuccessInstance(""); |
| | | ajaxResult.setData(activitySignRecordVos); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * java 获取 获取某年某月 所有日期(yyyy-mm-dd格式字符串) |
| | | * @param year |
| | |
| | | activitySignReceiveRecord.setUpdateBy(user.getVipName()); |
| | | activitySignReceiveRecord.setUpdateTime(new Date()); |
| | | activitySignReceiveRecordDao.insert(activitySignReceiveRecord); |
| | | |
| | | |
| | | signSuccessVo.setScoreCnt(activitySignAwardSetNormal.getScoreCnt()); |
| | | signSuccessVo.setNormalAwardName(activitySignAwardSetNormal.getAwardName()); |
| | | signSuccessVo.setNormalAwardImg(activitySignAwardSetNormal.getIntroduceImg()); |
| | | } |
| | |
| | | signAwardDto.setUserId(loginUser.getId()); |
| | | signAwardDto.setCompanyId(loginUser.getCompanyId()); |
| | | IPage<SignAwardListVo> signAwardListVos = activitySignReceiveRecordDao.selectSignAwardList(page,signAwardDto); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(signAwardListVos.getRecords()); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(signAwardListVos); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 物流配送确认 |
| | | * 物流配送信息查看 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "物流配送确认", notes = "") |
| | | @ApiOperation(value = "物流配送信息查看", notes = "") |
| | | @PostMapping(value = "/logisticsInsure") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SeeAwardTextVo.class) |
| | |
| | | seeAwardTextDto.setUserId(loginUser.getId()); |
| | | seeAwardTextDto.setCompanyId(loginUser.getCompanyId()); |
| | | SeeAwardTextVo seeAwardTextVO = activitySignReceiveRecordDao.selectSeeAwardTextVOById(seeAwardTextDto); |
| | | if(ObjectUtil.isEmpty(seeAwardTextVO)){ |
| | | return AjaxResult.buildFailInstance("奖品无法查看物流配送信息"); |
| | | } |
| | | long receiveId = seeAwardTextVO.getId(); |
| | | |
| | | //获取核销记录的ID |
| | | ActivitySignWriteoff activitySignWriteoff = activitySignWriteoffDao.selectActivitySignWriteoffByUserIDAndReceiveId(loginUser.getId(),receiveId); |
| | | if(ObjectUtil.isNotEmpty(activitySignWriteoff)){ |
| | | Integer logisticsId = activitySignWriteoff.getLogisticsId(); |
| | | ShopDeliveryInfo shopDeliveryInfo = shopDeliveryInfoDao.selectById(logisticsId); |
| | | if(ObjectUtil.isNotEmpty(shopDeliveryInfo)){ |
| | | //查看物流信息 |
| | | wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo); |
| | | List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); |
| | | seeAwardTextVO.setShopLogisticsInfos(shopLogisticsInfos); |
| | | } |
| | | } |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(seeAwardTextVO); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 物流配送收货地址保存 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "物流配送收货地址保存", notes = "") |
| | | @GetMapping(value = "logisticsInsureAddress/{addressId}/{receiveId}") |
| | | @ResponseBody |
| | | public AjaxResult logisticsInsureAddress(@PathVariable("addressId") int addressId,@PathVariable("receiveId") long receiveId) { |
| | | ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(addressId); |
| | | if(ObjectUtil.isEmpty(shopReceiveAddress)){ |
| | | return AjaxResult.buildFailInstance("收货地址无效"); |
| | | } |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | //该奖品不是待领取状态 |
| | | if (ActivitySignReceiveRecord.STATE_ING != activitySignReceiveRecord.getState()) { |
| | | return AjaxResult.buildFailInstance("该奖品不是待领取状态"); |
| | | } |
| | | activitySignReceiveRecord.setConsigneeAddress(shopReceiveAddress.getAddrRegion()+"-"+shopReceiveAddress.getAddrDetailaddr()+"-"+shopReceiveAddress.getDormitory()); |
| | | activitySignReceiveRecord.setConsignee(shopReceiveAddress.getAddrLiaisonman()); |
| | | activitySignReceiveRecord.setConsigneePhone(shopReceiveAddress.getAddrTelephone()); |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_THREE); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "设置成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 物流配送确认收货 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "物流配送确认收货", notes = "") |
| | | @GetMapping(value = "logisticsInsureById/{receiveId}") |
| | | @ResponseBody |
| | | public AjaxResult logisticsInsureById(@PathVariable("receiveId") long receiveId) { |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | //如果不是待收货状态 |
| | | if (ActivitySignReceiveRecord.STATE_FOUR != activitySignReceiveRecord.getState()) { |
| | | return AjaxResult.buildFailInstance("该奖品不是待收货状态"); |
| | | } |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "收货成功!"); |
| | | } |
| | | |
| | | |
| | | |