Commit d4718040 authored by shiyu's avatar shiyu

签到需要发布一个商品

parent d6ee16bd
...@@ -15,7 +15,9 @@ import com.wwdz.ch.core.util.CacheUtil; ...@@ -15,7 +15,9 @@ import com.wwdz.ch.core.util.CacheUtil;
import com.wwdz.ch.core.util.MediaUtil; import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.core.util.PriceUtil; import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.SwitchDao; import com.wwdz.ch.db.dao.SwitchDao;
import com.wwdz.ch.db.dao.UserSignInDao;
import com.wwdz.ch.db.dao.distribution.*; import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.UserSignIn;
import com.wwdz.ch.db.domain.distribution.*; import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.AuctionConfigRequestDto; import com.wwdz.ch.db.dto.request.distribution.AuctionConfigRequestDto;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto; import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
...@@ -94,6 +96,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService { ...@@ -94,6 +96,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
@Autowired @Autowired
SendMsgService sendMsgService; SendMsgService sendMsgService;
@Autowired
UserSignInDao userSignInDao;
@Override @Override
@Transactional @Transactional
public Result create(SupplierItemRequestDto dto) { public Result create(SupplierItemRequestDto dto) {
...@@ -612,6 +617,13 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService { ...@@ -612,6 +617,13 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
String url = wxAppletApi.getUrlLink("/pages/saleSelf/index","userId=" + oldItem.getCreatorId() + "&shareRecordId="); String url = wxAppletApi.getUrlLink("/pages/saleSelf/index","userId=" + oldItem.getCreatorId() + "&shareRecordId=");
String msg = "您发布的" + oldItem.getName() + ",内容涉嫌违反平台规定,已被平台下架,请前往"+ url + "查看"; String msg = "您发布的" + oldItem.getName() + ",内容涉嫌违反平台规定,已被平台下架,请前往"+ url + "查看";
aliSmsSender.sendSms(oldItem.getCreatorId(), msg); aliSmsSender.sendSms(oldItem.getCreatorId(), msg);
//如果用户今天签到了,则取消签到记录
UserSignIn todaySignIn = userSignInDao.findTodayRecord(oldItem.getCreatorId());
if (todaySignIn != null) {
UserSignIn updateDto = new UserSignIn();
updateDto.setId(todaySignIn.getId());
// updateDto.set
}
return Result.success(); return Result.success();
} catch (Exception e) { } catch (Exception e) {
logger.error("违规下架失败 error : {}", e); logger.error("违规下架失败 error : {}", e);
......
...@@ -168,7 +168,6 @@ public class DateTimeUtil { ...@@ -168,7 +168,6 @@ public class DateTimeUtil {
System.out.println(datesList); System.out.println(datesList);
int year = 2024; // 示例年份 int year = 2024; // 示例年份
int month = 10; // 示例月份 int month = 10; // 示例月份
// 调用方法并输出结果
int dayOfWeekInt = getFirstDayOfMonth(year, month); int dayOfWeekInt = getFirstDayOfMonth(year, month);
System.out.println(year + "年 " + month + "月的一号是: " + dayOfWeekInt); System.out.println(year + "年 " + month + "月的一号是: " + dayOfWeekInt);
...@@ -177,5 +176,14 @@ public class DateTimeUtil { ...@@ -177,5 +176,14 @@ public class DateTimeUtil {
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
System.out.println(today.getYear()+ "-" + today.getMonthValue()); System.out.println(today.getYear()+ "-" + today.getMonthValue());
LocalDateTime startOfDay = today.atTime(LocalTime.MIN);
Date startDate = Date.from(startOfDay.atZone(java.time.ZoneId.systemDefault()).toInstant());
LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
Date endDate = Date.from(endOfDay.atZone(java.time.ZoneId.systemDefault()).toInstant());
System.out.println(startDate);
System.out.println(endDate);
} }
} }
...@@ -150,4 +150,11 @@ public interface SupplierItemDao { ...@@ -150,4 +150,11 @@ public interface SupplierItemDao {
*/ */
List<SupplierItem> findListByPage(SupplierItemRequestDto dto); List<SupplierItem> findListByPage(SupplierItemRequestDto dto);
/**
* 某个时间段是否发布过商品
* @param dto
* @return
*/
boolean isUploadItem(SupplierItemRequestDto dto);
} }
package com.wwdz.ch.db.domain; package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import com.xxdxxs.entity.Entity; import com.xxdxxs.entity.Entity;
import lombok.Data; import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/11/22 * @date 2024/12/12
*/ */
@Data @Data
public class UserSignIn implements Entity { public class UserSignIn implements Entity {
...@@ -42,6 +44,11 @@ public class UserSignIn implements Entity { ...@@ -42,6 +44,11 @@ public class UserSignIn implements Entity {
*/ */
private Integer consecutiveDays; private Integer consecutiveDays;
/**
* 总连续天数
*/
private Integer totalConsecutiveDays;
/** /**
* 是否有奖励 * 是否有奖励
*/ */
...@@ -57,6 +64,11 @@ public class UserSignIn implements Entity { ...@@ -57,6 +64,11 @@ public class UserSignIn implements Entity {
*/ */
private Boolean isGet; private Boolean isGet;
/**
* 是否有效
*/
private Boolean isValid;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
...@@ -71,9 +83,11 @@ public class UserSignIn implements Entity { ...@@ -71,9 +83,11 @@ public class UserSignIn implements Entity {
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", signInDate=").append(signInDate); sb.append(", signInDate=").append(signInDate);
sb.append(", consecutiveDays=").append(consecutiveDays); sb.append(", consecutiveDays=").append(consecutiveDays);
sb.append(", totalConsecutiveDays=").append(totalConsecutiveDays);
sb.append(", isReward=").append(isReward); sb.append(", isReward=").append(isReward);
sb.append(", rewardLevel=").append(rewardLevel); sb.append(", rewardLevel=").append(rewardLevel);
sb.append(", isGet=").append(isGet); sb.append(", isGet=").append(isGet);
sb.append(", isValid=").append(isValid);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -97,9 +111,11 @@ public class UserSignIn implements Entity { ...@@ -97,9 +111,11 @@ public class UserSignIn implements Entity {
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getSignInDate() == null ? other.getSignInDate() == null : this.getSignInDate().equals(other.getSignInDate())) && (this.getSignInDate() == null ? other.getSignInDate() == null : this.getSignInDate().equals(other.getSignInDate()))
&& (this.getConsecutiveDays() == null ? other.getConsecutiveDays() == null : this.getConsecutiveDays().equals(other.getConsecutiveDays())) && (this.getConsecutiveDays() == null ? other.getConsecutiveDays() == null : this.getConsecutiveDays().equals(other.getConsecutiveDays()))
&& (this.getTotalConsecutiveDays() == null ? other.getTotalConsecutiveDays() == null : this.getTotalConsecutiveDays().equals(other.getTotalConsecutiveDays()))
&& (this.getIsReward() == null ? other.getIsReward() == null : this.getIsReward().equals(other.getIsReward())) && (this.getIsReward() == null ? other.getIsReward() == null : this.getIsReward().equals(other.getIsReward()))
&& (this.getRewardLevel() == null ? other.getRewardLevel() == null : this.getRewardLevel().equals(other.getRewardLevel())) && (this.getRewardLevel() == null ? other.getRewardLevel() == null : this.getRewardLevel().equals(other.getRewardLevel()))
&& (this.getIsGet() == null ? other.getIsGet() == null : this.getIsGet().equals(other.getIsGet())); && (this.getIsGet() == null ? other.getIsGet() == null : this.getIsGet().equals(other.getIsGet()))
&& (this.getIsValid() == null ? other.getIsValid() == null : this.getIsValid().equals(other.getIsValid()));
} }
@Override @Override
...@@ -112,9 +128,11 @@ public class UserSignIn implements Entity { ...@@ -112,9 +128,11 @@ public class UserSignIn implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getSignInDate() == null) ? 0 : getSignInDate().hashCode()); result = prime * result + ((getSignInDate() == null) ? 0 : getSignInDate().hashCode());
result = prime * result + ((getConsecutiveDays() == null) ? 0 : getConsecutiveDays().hashCode()); result = prime * result + ((getConsecutiveDays() == null) ? 0 : getConsecutiveDays().hashCode());
result = prime * result + ((getTotalConsecutiveDays() == null) ? 0 : getTotalConsecutiveDays().hashCode());
result = prime * result + ((getIsReward() == null) ? 0 : getIsReward().hashCode()); result = prime * result + ((getIsReward() == null) ? 0 : getIsReward().hashCode());
result = prime * result + ((getRewardLevel() == null) ? 0 : getRewardLevel().hashCode()); result = prime * result + ((getRewardLevel() == null) ? 0 : getRewardLevel().hashCode());
result = prime * result + ((getIsGet() == null) ? 0 : getIsGet().hashCode()); result = prime * result + ((getIsGet() == null) ? 0 : getIsGet().hashCode());
result = prime * result + ((getIsValid() == null) ? 0 : getIsValid().hashCode());
return result; return result;
} }
...@@ -132,9 +150,11 @@ public class UserSignIn implements Entity { ...@@ -132,9 +150,11 @@ public class UserSignIn implements Entity {
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
signInDate("sign_in_date", "signInDate", "VARCHAR", false), signInDate("sign_in_date", "signInDate", "VARCHAR", false),
consecutiveDays("consecutive_days", "consecutiveDays", "INTEGER", false), consecutiveDays("consecutive_days", "consecutiveDays", "INTEGER", false),
totalConsecutiveDays("total_consecutive_days", "totalConsecutiveDays", "INTEGER", false),
isReward("is_reward", "isReward", "BIT", false), isReward("is_reward", "isReward", "BIT", false),
rewardLevel("reward_level", "rewardLevel", "INTEGER", false), rewardLevel("reward_level", "rewardLevel", "INTEGER", false),
isGet("is_get", "isGet", "BIT", false); isGet("is_get", "isGet", "BIT", false),
isValid("is_valid", "isValid", "BIT", false);
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
......
...@@ -950,6 +950,138 @@ public class UserSignInExample { ...@@ -950,6 +950,138 @@ public class UserSignInExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTotalConsecutiveDaysIsNull() {
addCriterion("total_consecutive_days is null");
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysIsNotNull() {
addCriterion("total_consecutive_days is not null");
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysEqualTo(Integer value) {
addCriterion("total_consecutive_days =", value, "totalConsecutiveDays");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalConsecutiveDaysEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("total_consecutive_days = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysNotEqualTo(Integer value) {
addCriterion("total_consecutive_days <>", value, "totalConsecutiveDays");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalConsecutiveDaysNotEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("total_consecutive_days <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysGreaterThan(Integer value) {
addCriterion("total_consecutive_days >", value, "totalConsecutiveDays");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalConsecutiveDaysGreaterThanColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("total_consecutive_days > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysGreaterThanOrEqualTo(Integer value) {
addCriterion("total_consecutive_days >=", value, "totalConsecutiveDays");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalConsecutiveDaysGreaterThanOrEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("total_consecutive_days >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysLessThan(Integer value) {
addCriterion("total_consecutive_days <", value, "totalConsecutiveDays");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalConsecutiveDaysLessThanColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("total_consecutive_days < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysLessThanOrEqualTo(Integer value) {
addCriterion("total_consecutive_days <=", value, "totalConsecutiveDays");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalConsecutiveDaysLessThanOrEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("total_consecutive_days <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysIn(List<Integer> values) {
addCriterion("total_consecutive_days in", values, "totalConsecutiveDays");
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysNotIn(List<Integer> values) {
addCriterion("total_consecutive_days not in", values, "totalConsecutiveDays");
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysBetween(Integer value1, Integer value2) {
addCriterion("total_consecutive_days between", value1, value2, "totalConsecutiveDays");
return (Criteria) this;
}
public Criteria andTotalConsecutiveDaysNotBetween(Integer value1, Integer value2) {
addCriterion("total_consecutive_days not between", value1, value2, "totalConsecutiveDays");
return (Criteria) this;
}
public Criteria andIsRewardIsNull() { public Criteria andIsRewardIsNull() {
addCriterion("is_reward is null"); addCriterion("is_reward is null");
return (Criteria) this; return (Criteria) this;
...@@ -1345,6 +1477,138 @@ public class UserSignInExample { ...@@ -1345,6 +1477,138 @@ public class UserSignInExample {
addCriterion("is_get not between", value1, value2, "isGet"); addCriterion("is_get not between", value1, value2, "isGet");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsValidIsNull() {
addCriterion("is_valid is null");
return (Criteria) this;
}
public Criteria andIsValidIsNotNull() {
addCriterion("is_valid is not null");
return (Criteria) this;
}
public Criteria andIsValidEqualTo(Boolean value) {
addCriterion("is_valid =", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("is_valid = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidNotEqualTo(Boolean value) {
addCriterion("is_valid <>", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidNotEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("is_valid <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidGreaterThan(Boolean value) {
addCriterion("is_valid >", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidGreaterThanColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("is_valid > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_valid >=", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidGreaterThanOrEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("is_valid >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidLessThan(Boolean value) {
addCriterion("is_valid <", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidLessThanColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("is_valid < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidLessThanOrEqualTo(Boolean value) {
addCriterion("is_valid <=", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_sign_in
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidLessThanOrEqualToColumn(UserSignIn.Column column) {
addCriterion(new StringBuilder("is_valid <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidIn(List<Boolean> values) {
addCriterion("is_valid in", values, "isValid");
return (Criteria) this;
}
public Criteria andIsValidNotIn(List<Boolean> values) {
addCriterion("is_valid not in", values, "isValid");
return (Criteria) this;
}
public Criteria andIsValidBetween(Boolean value1, Boolean value2) {
addCriterion("is_valid between", value1, value2, "isValid");
return (Criteria) this;
}
public Criteria andIsValidNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_valid not between", value1, value2, "isValid");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -20,6 +20,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -20,6 +20,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
@Override @Override
public boolean insert(UserSignIn userSignin) { public boolean insert(UserSignIn userSignin) {
userSignin.setIsValid(true);
return userSignInMapper.insert(userSignin) > 0; return userSignInMapper.insert(userSignin) > 0;
} }
...@@ -28,6 +29,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -28,6 +29,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
UserSignInExample example = new UserSignInExample(); UserSignInExample example = new UserSignInExample();
UserSignInExample.Criteria criteria = example.createCriteria(); UserSignInExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
criteria.andIsValidEqualTo(true);
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
return userSignInMapper.selectOneByExample(example); return userSignInMapper.selectOneByExample(example);
} }
...@@ -39,6 +41,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -39,6 +41,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
criteria.andUserIdEqualTo(dto.getUserId()); criteria.andUserIdEqualTo(dto.getUserId());
JdbcHelper.ifPresent(dto.getStartQueryTime(), criteria :: andCreateTimeGreaterThanOrEqualTo); JdbcHelper.ifPresent(dto.getStartQueryTime(), criteria :: andCreateTimeGreaterThanOrEqualTo);
JdbcHelper.ifPresent(dto.getEndQueryTime(), criteria :: andCreateTimeLessThanOrEqualTo); JdbcHelper.ifPresent(dto.getEndQueryTime(), criteria :: andCreateTimeLessThanOrEqualTo);
criteria.andIsValidEqualTo(true);
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
return userSignInMapper.selectByExample(example); return userSignInMapper.selectByExample(example);
} }
...@@ -51,6 +54,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -51,6 +54,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
UserSignInExample.Criteria criteria = example.createCriteria(); UserSignInExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
criteria.andSignInDateEqualTo(yesterdayString); criteria.andSignInDateEqualTo(yesterdayString);
criteria.andIsValidEqualTo(true);
return userSignInMapper.selectOneByExample(example); return userSignInMapper.selectOneByExample(example);
} }
...@@ -62,6 +66,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -62,6 +66,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
UserSignInExample.Criteria criteria = example.createCriteria(); UserSignInExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
criteria.andSignInDateEqualTo(todayString); criteria.andSignInDateEqualTo(todayString);
criteria.andIsValidEqualTo(true);
return userSignInMapper.selectOneByExample(example); return userSignInMapper.selectOneByExample(example);
} }
...@@ -71,6 +76,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -71,6 +76,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
UserSignInExample.Criteria criteria = example.createCriteria(); UserSignInExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
criteria.andSignInDateEqualTo(date); criteria.andSignInDateEqualTo(date);
criteria.andIsValidEqualTo(true);
return userSignInMapper.countByExample(example) > 0; return userSignInMapper.countByExample(example) > 0;
} }
...@@ -81,6 +87,7 @@ public class UserSignInDaoImpl implements UserSignInDao { ...@@ -81,6 +87,7 @@ public class UserSignInDaoImpl implements UserSignInDao {
UserSignInExample.Criteria criteria = example.createCriteria(); UserSignInExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
criteria.andSignInDateEqualTo(date); criteria.andSignInDateEqualTo(date);
criteria.andIsValidEqualTo(true);
return userSignInMapper.selectOneByExample(example); return userSignInMapper.selectOneByExample(example);
} }
......
...@@ -335,4 +335,15 @@ public class SupplierItemDaoImpl implements SupplierItemDao { ...@@ -335,4 +335,15 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
return supplierItemMapper.selectByExampleWithBLOBs(example); return supplierItemMapper.selectByExampleWithBLOBs(example);
} }
@Override
public boolean isUploadItem(SupplierItemRequestDto dto) {
SupplierItemExample example = new SupplierItemExample();
SupplierItemExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getStartCreateTime(), criteria::andCreateTimeGreaterThanOrEqualTo);
JdbcHelper.ifPresent(dto.getEndCreateTime(), criteria::andCreateTimeLessThanOrEqualTo);
criteria.andIsDeletedEqualTo(false);
criteria.andStockGreaterThan(0);
return supplierItemMapper.countByExample(example) > 0;
}
} }
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="sign_in_date" jdbcType="VARCHAR" property="signInDate" /> <result column="sign_in_date" jdbcType="VARCHAR" property="signInDate" />
<result column="consecutive_days" jdbcType="INTEGER" property="consecutiveDays" /> <result column="consecutive_days" jdbcType="INTEGER" property="consecutiveDays" />
<result column="total_consecutive_days" jdbcType="INTEGER" property="totalConsecutiveDays" />
<result column="is_reward" jdbcType="BIT" property="isReward" /> <result column="is_reward" jdbcType="BIT" property="isReward" />
<result column="reward_level" jdbcType="INTEGER" property="rewardLevel" /> <result column="reward_level" jdbcType="INTEGER" property="rewardLevel" />
<result column="is_get" jdbcType="BIT" property="isGet" /> <result column="is_get" jdbcType="BIT" property="isGet" />
<result column="is_valid" jdbcType="BIT" property="isValid" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -71,8 +73,8 @@ ...@@ -71,8 +73,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, create_time, update_time, sign_in_date, consecutive_days, is_reward, id, user_id, create_time, update_time, sign_in_date, consecutive_days, total_consecutive_days,
reward_level, is_get is_reward, reward_level, is_get, is_valid
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserSignInExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserSignInExample" resultMap="BaseResultMap">
select select
...@@ -107,8 +109,8 @@ ...@@ -107,8 +109,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, create_time, update_time, sign_in_date, consecutive_days, is_reward, id, user_id, create_time, update_time, sign_in_date, consecutive_days, total_consecutive_days,
reward_level, is_get is_reward, reward_level, is_get, is_valid
</otherwise> </otherwise>
</choose> </choose>
from user_sign_in from user_sign_in
...@@ -139,8 +141,8 @@ ...@@ -139,8 +141,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, create_time, update_time, sign_in_date, consecutive_days, is_reward, id, user_id, create_time, update_time, sign_in_date, consecutive_days, total_consecutive_days,
reward_level, is_get is_reward, reward_level, is_get, is_valid
</otherwise> </otherwise>
</choose> </choose>
from user_sign_in from user_sign_in
...@@ -161,11 +163,13 @@ ...@@ -161,11 +163,13 @@
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into user_sign_in (user_id, create_time, update_time, insert into user_sign_in (user_id, create_time, update_time,
sign_in_date, consecutive_days, is_reward, sign_in_date, consecutive_days, total_consecutive_days,
reward_level, is_get) is_reward, reward_level, is_get,
is_valid)
values (#{userId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, values (#{userId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{signInDate,jdbcType=VARCHAR}, #{consecutiveDays,jdbcType=INTEGER}, #{isReward,jdbcType=BIT}, #{signInDate,jdbcType=VARCHAR}, #{consecutiveDays,jdbcType=INTEGER}, #{totalConsecutiveDays,jdbcType=INTEGER},
#{rewardLevel,jdbcType=INTEGER}, #{isGet,jdbcType=BIT}) #{isReward,jdbcType=BIT}, #{rewardLevel,jdbcType=INTEGER}, #{isGet,jdbcType=BIT},
#{isValid,jdbcType=BIT})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.UserSignIn"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.UserSignIn">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -188,6 +192,9 @@ ...@@ -188,6 +192,9 @@
<if test="consecutiveDays != null"> <if test="consecutiveDays != null">
consecutive_days, consecutive_days,
</if> </if>
<if test="totalConsecutiveDays != null">
total_consecutive_days,
</if>
<if test="isReward != null"> <if test="isReward != null">
is_reward, is_reward,
</if> </if>
...@@ -197,6 +204,9 @@ ...@@ -197,6 +204,9 @@
<if test="isGet != null"> <if test="isGet != null">
is_get, is_get,
</if> </if>
<if test="isValid != null">
is_valid,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
...@@ -214,6 +224,9 @@ ...@@ -214,6 +224,9 @@
<if test="consecutiveDays != null"> <if test="consecutiveDays != null">
#{consecutiveDays,jdbcType=INTEGER}, #{consecutiveDays,jdbcType=INTEGER},
</if> </if>
<if test="totalConsecutiveDays != null">
#{totalConsecutiveDays,jdbcType=INTEGER},
</if>
<if test="isReward != null"> <if test="isReward != null">
#{isReward,jdbcType=BIT}, #{isReward,jdbcType=BIT},
</if> </if>
...@@ -223,6 +236,9 @@ ...@@ -223,6 +236,9 @@
<if test="isGet != null"> <if test="isGet != null">
#{isGet,jdbcType=BIT}, #{isGet,jdbcType=BIT},
</if> </if>
<if test="isValid != null">
#{isValid,jdbcType=BIT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.UserSignInExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.UserSignInExample" resultType="java.lang.Long">
...@@ -252,6 +268,9 @@ ...@@ -252,6 +268,9 @@
<if test="record.consecutiveDays != null"> <if test="record.consecutiveDays != null">
consecutive_days = #{record.consecutiveDays,jdbcType=INTEGER}, consecutive_days = #{record.consecutiveDays,jdbcType=INTEGER},
</if> </if>
<if test="record.totalConsecutiveDays != null">
total_consecutive_days = #{record.totalConsecutiveDays,jdbcType=INTEGER},
</if>
<if test="record.isReward != null"> <if test="record.isReward != null">
is_reward = #{record.isReward,jdbcType=BIT}, is_reward = #{record.isReward,jdbcType=BIT},
</if> </if>
...@@ -261,6 +280,9 @@ ...@@ -261,6 +280,9 @@
<if test="record.isGet != null"> <if test="record.isGet != null">
is_get = #{record.isGet,jdbcType=BIT}, is_get = #{record.isGet,jdbcType=BIT},
</if> </if>
<if test="record.isValid != null">
is_valid = #{record.isValid,jdbcType=BIT},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -274,9 +296,11 @@ ...@@ -274,9 +296,11 @@
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
sign_in_date = #{record.signInDate,jdbcType=VARCHAR}, sign_in_date = #{record.signInDate,jdbcType=VARCHAR},
consecutive_days = #{record.consecutiveDays,jdbcType=INTEGER}, consecutive_days = #{record.consecutiveDays,jdbcType=INTEGER},
total_consecutive_days = #{record.totalConsecutiveDays,jdbcType=INTEGER},
is_reward = #{record.isReward,jdbcType=BIT}, is_reward = #{record.isReward,jdbcType=BIT},
reward_level = #{record.rewardLevel,jdbcType=INTEGER}, reward_level = #{record.rewardLevel,jdbcType=INTEGER},
is_get = #{record.isGet,jdbcType=BIT} is_get = #{record.isGet,jdbcType=BIT},
is_valid = #{record.isValid,jdbcType=BIT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -299,6 +323,9 @@ ...@@ -299,6 +323,9 @@
<if test="consecutiveDays != null"> <if test="consecutiveDays != null">
consecutive_days = #{consecutiveDays,jdbcType=INTEGER}, consecutive_days = #{consecutiveDays,jdbcType=INTEGER},
</if> </if>
<if test="totalConsecutiveDays != null">
total_consecutive_days = #{totalConsecutiveDays,jdbcType=INTEGER},
</if>
<if test="isReward != null"> <if test="isReward != null">
is_reward = #{isReward,jdbcType=BIT}, is_reward = #{isReward,jdbcType=BIT},
</if> </if>
...@@ -308,6 +335,9 @@ ...@@ -308,6 +335,9 @@
<if test="isGet != null"> <if test="isGet != null">
is_get = #{isGet,jdbcType=BIT}, is_get = #{isGet,jdbcType=BIT},
</if> </if>
<if test="isValid != null">
is_valid = #{isValid,jdbcType=BIT},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -318,9 +348,11 @@ ...@@ -318,9 +348,11 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
sign_in_date = #{signInDate,jdbcType=VARCHAR}, sign_in_date = #{signInDate,jdbcType=VARCHAR},
consecutive_days = #{consecutiveDays,jdbcType=INTEGER}, consecutive_days = #{consecutiveDays,jdbcType=INTEGER},
total_consecutive_days = #{totalConsecutiveDays,jdbcType=INTEGER},
is_reward = #{isReward,jdbcType=BIT}, is_reward = #{isReward,jdbcType=BIT},
reward_level = #{rewardLevel,jdbcType=INTEGER}, reward_level = #{rewardLevel,jdbcType=INTEGER},
is_get = #{isGet,jdbcType=BIT} is_get = #{isGet,jdbcType=BIT},
is_valid = #{isValid,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.UserSignInExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.UserSignInExample" resultMap="BaseResultMap">
...@@ -356,8 +388,8 @@ ...@@ -356,8 +388,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, create_time, update_time, sign_in_date, consecutive_days, is_reward, id, user_id, create_time, update_time, sign_in_date, consecutive_days, total_consecutive_days,
reward_level, is_get is_reward, reward_level, is_get, is_valid
</otherwise> </otherwise>
</choose> </choose>
from user_sign_in from user_sign_in
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="category" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="user_sign_in" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" /> <generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table> </table>
......
...@@ -20,6 +20,7 @@ import com.wwdz.ch.db.domain.UserSignIn; ...@@ -20,6 +20,7 @@ import com.wwdz.ch.db.domain.UserSignIn;
import com.wwdz.ch.db.domain.distribution.DistributionOrder; import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.SupplierItem; import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.UserSignInRequestDto; import com.wwdz.ch.db.dto.request.UserSignInRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.entity.vo.SignInRewardVo; import com.wwdz.ch.wx.entity.vo.SignInRewardVo;
import com.wwdz.ch.wx.service.UserSigninService; import com.wwdz.ch.wx.service.UserSigninService;
import com.xxdxxs.utils.DateUtils; import com.xxdxxs.utils.DateUtils;
...@@ -32,9 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -32,9 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.time.DayOfWeek; import java.time.DayOfWeek;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
...@@ -387,6 +389,19 @@ public class UserSigninServiceImpl implements UserSigninService { ...@@ -387,6 +389,19 @@ public class UserSigninServiceImpl implements UserSigninService {
resultMap.put("calendar", calendar); resultMap.put("calendar", calendar);
//签到进度 //签到进度
resultMap.put("rate", (int)Math.ceil((Double.valueOf(resultMap.get("consecutiveDays").toString()) / 21) * 100)); resultMap.put("rate", (int)Math.ceil((Double.valueOf(resultMap.get("consecutiveDays").toString()) / 21) * 100));
//查询用户当天有没有发布过商品
SupplierItemRequestDto supplierItemRequestDto = new SupplierItemRequestDto();
LocalDateTime startOfDay = today.atTime(LocalTime.MIN);
Date startDate = Date.from(startOfDay.atZone(java.time.ZoneId.systemDefault()).toInstant());
LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
Date endDate = Date.from(endOfDay.atZone(java.time.ZoneId.systemDefault()).toInstant());
supplierItemRequestDto.setStartCreateTime(startDate);
supplierItemRequestDto.setEndCreateTime(endDate);
if (supplierItemDao.isUploadItem(supplierItemRequestDto)) {
resultMap.put("todayIsUpload", true);
} else {
resultMap.put("todayIsUpload", false);
}
return Result.success(resultMap); return Result.success(resultMap);
} catch (Exception e) { } catch (Exception e) {
logger.error("查询签到记录失败 error : {}", e); logger.error("查询签到记录失败 error : {}", e);
......
...@@ -77,7 +77,7 @@ public class SignInNoticeJob { ...@@ -77,7 +77,7 @@ public class SignInNoticeJob {
/** /**
* 每天下午两点执行一次 * 每天下午两点执行一次
*/ */
@Scheduled(cron = "0 0 14 * * ?") @Scheduled(cron = "0 20 11 * * ?")
public void execute() { public void execute() {
/* if ("dev".equals(env)) { /* if ("dev".equals(env)) {
logger.info(">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行发送签到提醒通知定时作业<<<<<<<<<<<<<<<<<<<<<"); logger.info(">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行发送签到提醒通知定时作业<<<<<<<<<<<<<<<<<<<<<");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment