From 4dfe83675fc23f4514b6c3cf44fcc84c7e0b52a8 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Wed, 21 Apr 2021 10:03:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/score_shop' into score_shop

---
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java |  141 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 137 insertions(+), 4 deletions(-)

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 a86a59e..146f3e4 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
@@ -22,9 +22,16 @@
 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;
@@ -63,6 +70,17 @@
 	
 	@Autowired
 	private ActivitySignRecordDao activitySignRecordDao;
+	
+    @Autowired
+    ShopDeliveryInfoDao shopDeliveryInfoDao;
+
+    @Autowired
+    private ShopLogisticsInfoDao shopLogisticsInfoDao;
+    @Autowired
+    private ShopReceiveAddressDao shopReceiveAddressDao;
+
+    @Autowired
+    private WxShopLogisticsQueryService wxShopLogisticsQueryService;
 	
 	@ApiOperation(value = "获取签到基本信息", notes = "")
 	@ApiResponses({
@@ -140,6 +158,56 @@
         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
@@ -263,7 +331,8 @@
         	activitySignReceiveRecord.setUpdateBy(user.getVipName());
         	activitySignReceiveRecord.setUpdateTime(new Date());
         	activitySignReceiveRecordDao.insert(activitySignReceiveRecord);
-        	
+
+            signSuccessVo.setScoreCnt(activitySignAwardSetNormal.getScoreCnt());
         	signSuccessVo.setNormalAwardName(activitySignAwardSetNormal.getAwardName());
         	signSuccessVo.setNormalAwardImg(activitySignAwardSetNormal.getIntroduceImg());
         }
@@ -416,7 +485,7 @@
         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;
     }
     
@@ -440,11 +509,11 @@
     }
     
     /**
-     * 物流配送确认
+     * 物流配送信息查看
      *
      * @return
      */
-    @ApiOperation(value = "物流配送确认", notes = "")
+    @ApiOperation(value = "物流配送信息查看", notes = "")
     @PostMapping(value = "/logisticsInsure")
     @ApiResponses({
             @ApiResponse(code = 200, message = "ok", response = SeeAwardTextVo.class)
@@ -454,9 +523,73 @@
         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, "收货成功!");
+    }
     
     
     

--
Gitblit v1.9.1