From c9904c055a2a2e643418d66957012d951ff47827 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 19 Apr 2021 17:58:38 +0800
Subject: [PATCH] 20210419 签到

---
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/SignAwardListVo.java                 |    2 
 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-writeoff-info.html  |    2 
 zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml         |    2 
 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         |    9 --
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java  |   68 ++++++++++++++++++++--
 zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java   |    1 
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ActivitySignRecordVo.java            |   23 +------
 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign-logistics-info.html |    2 
 zq-erp/src/main/resources/templates/views/admin/activity/activity-sign.html                |    9 --
 zq-erp/src/main/java/com/matrix/system/activity/entity/ActivitySignReceiveRecord.java      |    6 +
 11 files changed, 76 insertions(+), 50 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/activity/entity/ActivitySignReceiveRecord.java b/zq-erp/src/main/java/com/matrix/system/activity/entity/ActivitySignReceiveRecord.java
index f59cb27..ab7a432 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/entity/ActivitySignReceiveRecord.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/entity/ActivitySignReceiveRecord.java
@@ -51,7 +51,7 @@
 	private Long  awardId;
 	
 	/**
-	 * 是否已领取(1:待领取2:已领取)
+	 * 是否已领取(1:待领取2:已领取 3:待配送 4:待收货)
 	 */
 
 
@@ -59,7 +59,9 @@
 
 	public static final int STATE_ING = 1;
 	public static final int STATE_DONE = 2;
-	
+	public static final int STATE_THREE = 3;
+	public static final int STATE_FOUR = 4;
+
 	/**
 	 * 核销码
 	 */
diff --git a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
index aed8a95..a19d69a 100644
--- a/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
+++ b/zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignAwardSetService.java
@@ -237,6 +237,7 @@
 					activitySignAwardSetUpdate.setUpdateBy(user.getSuName());
 					activitySignAwardSetUpdate.setCompanyId(companyId);
 					activitySignAwardSetUpdate.setActivityId(actId);
+					activitySignAwardSetUpdate.setAwardState(ActivitySignAwardSet.AWARDSTATE_WORK);
 					activitySignAwardSetDao.insert(activitySignAwardSetUpdate);
 				}else {
 					activitySignAwardSetDao.updateById(activitySignAwardSetUpdate);
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 e784058..3774bde 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
@@ -278,7 +278,7 @@
 	        activitySignWriteoffDao.updateById(activitySignWriteoff);
 	        //更新领取记录
 	        ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId);
-	        activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE);
+	        activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_THREE);
 	        activitySignReceiveRecord.setConsignee(logisticsSubmitDto.getShr());
 	        activitySignReceiveRecord.setConsigneeAddress(logisticsSubmitDto.getShdz());
 	        activitySignReceiveRecord.setConsigneePhone(logisticsSubmitDto.getLxdh());
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 c172110..eeaf92a 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
@@ -1,7 +1,7 @@
 package com.matrix.system.shopXcx.api.action;
 
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
@@ -35,6 +35,9 @@
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -102,12 +105,27 @@
         }
         /**
          * 默认获取当前月份
-         *      已经签到的日期
+         *      获取当前月份的天数
          */
-        List<ActivitySignRecordVo> activitySignRecordVos = activitySignRecordDao.selectRecordByMonth(actId,userId,DateUtil.date());
-        if(CollUtil.isNotEmpty(activitySignRecordVos)){
-            signBasicInfoVo.setActivitySignRecords(activitySignRecordVos);
+        List<ActivitySignRecordVo> activitySignRecordVos = new ArrayList<>();
+        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 date = DateUtil.parse(monthFullDay);
+            ActivitySignRecord activitySignRecordDone = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,date);
+            if(ObjectUtil.isNotEmpty(activitySignRecordDone)){
+                activitySignRecordVo.setState(1);
+            }else{
+                activitySignRecordVo.setState(2);
+            }
+            activitySignRecordVos.add(activitySignRecordVo);
         }
+        signBasicInfoVo.setActivitySignRecords(activitySignRecordVos);
+
         //累计签到日期
         int cumulativeDay = getCumulativeDay(actId, userId, DateUtil.date(), 0);
         signBasicInfoVo.setActAumulativeDay(cumulativeDay);
@@ -115,8 +133,42 @@
         ajaxResult.setData(signBasicInfoVo);
         return ajaxResult;
     }
-	
-	/**
+    /**
+     *  java 获取 获取某年某月 所有日期(yyyy-mm-dd格式字符串)
+     * @param year
+     * @param month
+     * @return
+     */
+    public List<String> getMonthFullDay(int year , int month){
+        SimpleDateFormat dateFormatYYYYMMDD = new SimpleDateFormat("yyyy-MM-dd");
+        List<String> fullDayList = new ArrayList<>(32);
+        // 获得当前日期对象
+        Calendar cal = Calendar.getInstance();
+        cal.clear();// 清除信息
+        cal.set(Calendar.YEAR, year);
+        // 1月从0开始
+        cal.set(Calendar.MONTH, month-1 );
+        // 当月1号
+        cal.set(Calendar.DAY_OF_MONTH,1);
+        int count = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+        for (int j = 1; j <= count ; j++) {
+            fullDayList.add(dateFormatYYYYMMDD.format(cal.getTime()));
+            cal.add(Calendar.DAY_OF_MONTH,1);
+        }
+        return fullDayList;
+    }
+
+    /**
+     * 获取当月的 天数
+     * */
+    public static int getCurrentMonthDay(Date date) {
+        Date beginOfMonth = DateUtil.beginOfMonth(date);
+        Date endOfMonth = DateUtil.endOfMonth(date);
+        long betweenDay = DateUtil.between(beginOfMonth, endOfMonth, DateUnit.DAY);
+        return Integer.parseInt(String.valueOf(betweenDay))+1;
+    }
+
+    /**
      * 点击签到
      *
      */
@@ -385,7 +437,7 @@
      *
      * @return
      */
-    @ApiOperation(value = "查看劵码", notes = "")
+    @ApiOperation(value = "物流配送确认", notes = "")
     @PostMapping(value = "/logisticsInsure")
     @ApiResponses({
             @ApiResponse(code = 200, message = "ok", response = SeeAwardTextVo.class)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ActivitySignRecordVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ActivitySignRecordVo.java
index 3a64229..5a903a2 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ActivitySignRecordVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/ActivitySignRecordVo.java
@@ -4,20 +4,12 @@
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.Date;
-
 @Data
 @ApiModel(value = "ActivitySignRecordVo", description = "签到明细")
 public class ActivitySignRecordVo {
-    /**
-     * userId
-     */
 
-
-
-    @ApiModelProperty(value ="userId")
-    private Long  userId;
-
+    @ApiModelProperty(value ="签到状态 1:已签到 2:未签到")
+    private int state;
     /**
      * 签到时间
      */
@@ -25,16 +17,7 @@
 
 
     @ApiModelProperty(value ="签到时间")
-    private Date  signTime;
-
-    /**
-     * 累计签到天数
-     */
-
-
-
-    @ApiModelProperty(value ="累计签到天数")
-    private Integer  cumulativeDay;
+    private String  signTime;
 
     /**
      * 活动主表ID
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/SignAwardListVo.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/SignAwardListVo.java
index b445647..1b29b4e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/SignAwardListVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/SignAwardListVo.java
@@ -27,7 +27,7 @@
 	@ApiModelProperty(value ="数量")
 	private int  total;
 	
-	@ApiModelProperty(value ="是否已领取(1:待领取2:已领取)")
+	@ApiModelProperty(value ="是否已领取(1:待领取2:已领取 3:待配送 4:待收货)")
 	private Integer  state;
 	
 	@ApiModelProperty(value ="领取时间")
diff --git a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml
index 4892c5c..bedd3e1 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignReceiveRecordDao.xml
@@ -86,7 +86,6 @@
 		LEFT JOIN activity_sign_award_set b ON a.award_id = b.id
 		where
 		      b.award_type = 1
-		  	and a.state = 1
 		  	and a.company_id = #{companyId}
 			and a.user_id = #{userId}
 
@@ -107,7 +106,6 @@
 		LEFT JOIN activity_sign_award_set b ON a.award_id = b.id
 		WHERE
 		b.award_type = 1
-		AND a.state = 1
 		and a.company_id = #{record.companyId}
 		and a.user_id = #{record.userId}
 		<if test="record.sort !=null">
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 a57d98d..b9767fc 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
@@ -49,7 +49,7 @@
                         <el-row style="display:flex;">
                             <el-col>
                                 <el-form-item label="奖品图片:" :label-width="formLabelWidth">
-                                    {{formSelect.jptp}}
+                                    <img :src="formSelect.jptp" style="max-width: 200px;">
                                 </el-form-item>
                             </el-col>
                             <el-col>
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 f69911a..562f32d 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
@@ -417,13 +417,8 @@
                                                                           stripe:true
                                                                           style="width: 100%">
                                                                     <el-table-column
-                                                                            prop="cname"
-                                                                            label="优惠券名称"
-                                                                            show-overflow-tooltip>
-                                                                    </el-table-column>
-                                                                    <el-table-column
-                                                                            prop="endTime"
-                                                                            label="截止日期"
+                                                                            prop="name"
+                                                                            label="名称"
                                                                             show-overflow-tooltip>
                                                                     </el-table-column>
                                                                     <el-table-column
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 26b52d1..eeb3d40 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
@@ -31,7 +31,7 @@
                 <el-row style="display:flex;">
                     <el-col :span="6">
                         <el-form-item label="奖品图片:" :label-width="formLabelWidth">
-                            {{formSelect.jptp}}
+                            <img :src="formSelect.jptp" style="max-width: 200px;">
                         </el-form-item>
                     </el-col>
                     <el-col :span="6">
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 a2e4ff2..d888c57 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
@@ -423,13 +423,8 @@
                                                                               stripe:true
                                                                               style="width: 100%">
                                                                         <el-table-column
-                                                                                prop="cname"
-                                                                                label="优惠券名称"
-                                                                                show-overflow-tooltip>
-                                                                        </el-table-column>
-                                                                        <el-table-column
-                                                                                prop="endTime"
-                                                                                label="截止日期"
+                                                                                prop="name"
+                                                                                label="名称"
                                                                                 show-overflow-tooltip>
                                                                         </el-table-column>
                                                                         <el-table-column

--
Gitblit v1.9.1