Commit 5d9252ac authored by shiyu's avatar shiyu

商品即将截拍订阅消息

parent a91945ea
...@@ -78,4 +78,10 @@ public interface CommConsts { ...@@ -78,4 +78,10 @@ public interface CommConsts {
* 消息跳转专场页面 * 消息跳转专场页面
*/ */
public final static String SPECIAL_PERFORMANCE_URL = "/pages/saleSpecialList/index"; public final static String SPECIAL_PERFORMANCE_URL = "/pages/saleSpecialList/index";
/**
* 消息跳转专场拍品详情
*/
public final static String ITEM_OF_SPECIAL_PERFORMANCE_URL = "/pages/saleAuctionDetail/index";
} }
...@@ -11,6 +11,7 @@ public class DisposableSubscribeRecordEnum { ...@@ -11,6 +11,7 @@ public class DisposableSubscribeRecordEnum {
public enum TypeEnum { public enum TypeEnum {
PRE_START(1, "AzJht7hkLJHSCN7trT3zsV3TaOE0Xk8faqm2sTf3Pm4", "拍卖开始通知"), PRE_START(1, "AzJht7hkLJHSCN7trT3zsV3TaOE0Xk8faqm2sTf3Pm4", "拍卖开始通知"),
PRE_END(2, "G-GwA4yn63RJ6IysFotHB4anctNqbOy5qrz_R6vBJkM", "即将结束"), PRE_END(2, "G-GwA4yn63RJ6IysFotHB4anctNqbOy5qrz_R6vBJkM", "即将结束"),
ITEM_PRE_END(3, "G-XhEvunfXdO0j5JSpCVKKYlLuQbF7Yux8QfVEz5_L9xQ", "拍品即将结束"),
; ;
......
package com.wwdz.ch.core.consts;
public class UserAccountEnum {
/**
* 账户明细类型
*/
public enum TypeEnum {
ORDER(1, "订单收入"),
INTRODUCE(2, "介绍费收入"),
CANCEL_ORDER(3, "取消订单"),
CANCEL_INTRODUCE(4, "无效介绍费"),
;
private int code;
private String des;
TypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (UserAccountEnum.TypeEnum typeEnum : UserAccountEnum.TypeEnum.values()) {
if (code == typeEnum.getCode()) {
return typeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 资金类型
*/
public enum FundTypeEnum {
OUT(-1, "支出"),
INCOME(1, "收入"),
;
private int code;
private String des;
FundTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (UserAccountEnum.FundTypeEnum fundTypeEnum : UserAccountEnum.FundTypeEnum.values()) {
if (code == fundTypeEnum.getCode()) {
return fundTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 资金类型
*/
public enum StateEnum {
NOT_VALID(-1, "无效"),
WAIT_VALID(1, "待入账"),
VALID(10, "有效"),
;
private int code;
private String des;
StateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (UserAccountEnum.StateEnum stateEnum : UserAccountEnum.StateEnum.values()) {
if (code == stateEnum.getCode()) {
return stateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
}
...@@ -699,6 +699,53 @@ public class SendMsgServiceImpl implements SendMsgService { ...@@ -699,6 +699,53 @@ public class SendMsgServiceImpl implements SendMsgService {
} }
@Override
public Result sendItemOfSpecialPerformanceEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = wxAppletApi.getAppletAccessToken();
String url = SEND_SUBSCRIBE_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "G-XhEvunfXdO0j5JSpCVKKYlLuQbF7Yux8QfVEz5_L9xQ");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(CommConsts.ITEM_OF_SPECIAL_PERFORMANCE_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
map.put("page", stringBuffer.toString());
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing2", new HashMap() {{
put("value", auctionOfferNoticeMsg.getItemName());
}});
paramMap.put("amount4", new HashMap() {{
put("value", auctionOfferNoticeMsg.getCurrentPrice());
}});
paramMap.put("phrase5", new HashMap() {{
put("value", "即将结束");
}});
paramMap.put("thing6", new HashMap() {{
put("value", auctionOfferNoticeMsg.getSpecialPerformanceTitle());
}});
paramMap.put("thing7", new HashMap() {{
put("value", "拍品即将截拍,点击查看");
}});
map.put("data", paramMap);
logger.info("============ 专场商品即将结束订阅消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送专场商品即将结束订阅消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送专场商品即将结束订阅消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed(responseStr);
}
logger.info("============= 发送专场商品即将结束订阅消息成功 ===========");
return Result.success();
}
@Override @Override
public Result followNoticeMsg(FollowFansMsg followFansMsg) { public Result followNoticeMsg(FollowFansMsg followFansMsg) {
try { try {
......
...@@ -87,5 +87,12 @@ public interface SendMsgService { ...@@ -87,5 +87,12 @@ public interface SendMsgService {
Result sendSpecialPerformanceEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg); Result sendSpecialPerformanceEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 发送专场商品即将截拍通知
* @param auctionOfferNoticeMsg
* @return
*/
Result sendItemOfSpecialPerformanceEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
} }
...@@ -88,6 +88,15 @@ public interface AuctionConfigDao { ...@@ -88,6 +88,15 @@ public interface AuctionConfigDao {
*/ */
List<AuctionConfig> findAbortEndList(); List<AuctionConfig> findAbortEndList();
/**
* 查询即将截拍的拍卖商品
* @param
* @return
*/
List<AuctionConfig> findAbortEndList(AuctionConfigRequestDto dto);
/** /**
* 更新截拍时间 * 更新截拍时间
* @param itemId * @param itemId
......
...@@ -11,6 +11,8 @@ public interface SpecialPerformanceConfigDao { ...@@ -11,6 +11,8 @@ public interface SpecialPerformanceConfigDao {
List<SpecialPerformanceConfig> findAllItem(int specialPerformanceId); List<SpecialPerformanceConfig> findAllItem(int specialPerformanceId);
SpecialPerformanceConfig findById(int specialPerformanceId, long itemId);
boolean insert(SpecialPerformanceConfig specialPerformanceConfig); boolean insert(SpecialPerformanceConfig specialPerformanceConfig);
boolean update(SpecialPerformanceConfig specialPerformanceConfig); boolean update(SpecialPerformanceConfig specialPerformanceConfig);
......
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.UserAccountDetail;
public interface UserAccountDetailDao {
boolean insert(UserAccountDetail userAccountDetail);
boolean update(UserAccountDetail userAccountDetail);
}
...@@ -56,6 +56,16 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity { ...@@ -56,6 +56,16 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity {
*/ */
private Date realEndTime; private Date realEndTime;
/**
* 截拍时间范围查询
*/
private Date queryStartRealEndTime;
/**
* 截拍时间范围查询
*/
private Date queryEndRealEndTime;
/** /**
* 创建时间 * 创建时间
*/ */
......
package com.wwdz.ch.db.dto.request.distribution;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class UserAccountDetailRequestDto extends BaseRequestDto implements Entity {
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 订单id
*/
private String orderId;
/**
* 收入或支出的类型
*/
private Integer type;
/**
* 资金类型1收入-1支出
*/
private Integer fundType;
/**
* 状态
*/
private Integer state;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
...@@ -151,6 +151,16 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao { ...@@ -151,6 +151,16 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
return auctionConfigMapper.selectByExample(example); return auctionConfigMapper.selectByExample(example);
} }
@Override
public List<AuctionConfig> findAbortEndList(AuctionConfigRequestDto dto) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andRealEndTimeGreaterThanOrEqualTo(dto.getQueryStartRealEndTime());
criteria.andRealEndTimeLessThanOrEqualTo(dto.getQueryEndRealEndTime());
criteria.andIsValidEqualTo(true);
return auctionConfigMapper.selectByExample(example);
}
@Override @Override
public int setEnd(long itemId) { public int setEnd(long itemId) {
AuctionConfigExample example = new AuctionConfigExample(); AuctionConfigExample example = new AuctionConfigExample();
......
...@@ -50,9 +50,20 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig ...@@ -50,9 +50,20 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria(); SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId); criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId);
criteria.andStateEqualTo(1); criteria.andStateEqualTo(1);
example.setOrderByClause("lot asc");
return specialPerformanceConfigMapper.selectByExampleSelective(example); return specialPerformanceConfigMapper.selectByExampleSelective(example);
} }
@Override
public SpecialPerformanceConfig findById(int specialPerformanceId, long itemId) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId);
criteria.andItemIdEqualTo(itemId);
criteria.andStateEqualTo(1);
return specialPerformanceConfigMapper.selectOneByExample(example);
}
@Override @Override
public boolean insert(SpecialPerformanceConfig specialPerformanceConfig) { public boolean insert(SpecialPerformanceConfig specialPerformanceConfig) {
specialPerformanceConfig.setCreateTime(new Date()); specialPerformanceConfig.setCreateTime(new Date());
......
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.UserAccountDetailDao;
import com.wwdz.ch.db.domain.distribution.UserAccountDetail;
import com.wwdz.ch.db.domain.distribution.UserAccountDetailExample;
import com.wwdz.ch.db.mapper.distribution.UserAccountDetailMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
@Repository
public class UserAccountDetailDaoImpl implements UserAccountDetailDao {
@Autowired
UserAccountDetailMapper userAccountDetailMapper;
@Override
public boolean insert(UserAccountDetail userAccountDetail) {
userAccountDetail.setCreateTime(new Date());
userAccountDetail.setUpdateTime(new Date());
return userAccountDetailMapper.insert(userAccountDetail) > 0;
}
@Override
public boolean update(UserAccountDetail userAccountDetail) {
UserAccountDetailExample example = new UserAccountDetailExample();
UserAccountDetailExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(userAccountDetail.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(userAccountDetail.getOrderId(), criteria::andOrderIdEqualTo);
userAccountDetail.setUpdateTime(new Date());
return userAccountDetailMapper.updateByExampleSelective(userAccountDetail, example) > 0;
}
}
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.UserAccountDetail;
import com.wwdz.ch.db.domain.distribution.UserAccountDetailExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserAccountDetailMapper {
long countByExample(UserAccountDetailExample example);
int deleteByExample(UserAccountDetailExample example);
int deleteByPrimaryKey(Long id);
int insert(UserAccountDetail record);
int insertSelective(UserAccountDetail record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account_detail
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountDetail selectOneByExample(UserAccountDetailExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account_detail
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountDetail selectOneByExampleSelective(@Param("example") UserAccountDetailExample example, @Param("selective") UserAccountDetail.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account_detail
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<UserAccountDetail> selectByExampleSelective(@Param("example") UserAccountDetailExample example, @Param("selective") UserAccountDetail.Column ... selective);
List<UserAccountDetail> selectByExample(UserAccountDetailExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_account_detail
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountDetail selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") UserAccountDetail.Column ... selective);
UserAccountDetail selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UserAccountDetail record, @Param("example") UserAccountDetailExample example);
int updateByExample(@Param("record") UserAccountDetail record, @Param("example") UserAccountDetailExample example);
int updateByPrimaryKeySelective(UserAccountDetail record);
int updateByPrimaryKey(UserAccountDetail record);
}
\ No newline at end of file
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="special_performance_item_follow" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="user_account_detail" 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>
......
...@@ -158,4 +158,9 @@ public class AuctionDetailVo implements Entity { ...@@ -158,4 +158,9 @@ public class AuctionDetailVo implements Entity {
*/ */
private Long followRecordId; private Long followRecordId;
/**
* 是否订阅了该商品的截拍消息
*/
private Boolean isSubscribed;
} }
...@@ -140,6 +140,9 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -140,6 +140,9 @@ public class SupplierItemServiceImpl implements SupplierItemService {
@Autowired @Autowired
SpecialPerformanceItemFollowDao specialPerformanceItemFollowDao; SpecialPerformanceItemFollowDao specialPerformanceItemFollowDao;
@Autowired
DisposableSubscribeRecordDao disposableSubscribeRecordDao;
@Override @Override
public Result findList(SupplierItemRequestDto dto) { public Result findList(SupplierItemRequestDto dto) {
...@@ -565,6 +568,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -565,6 +568,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
SpecialPerformanceConfig specialPerformanceConfig = specialPerformanceConfigList.get(0); SpecialPerformanceConfig specialPerformanceConfig = specialPerformanceConfigList.get(0);
auctionDetailVo.setSpecialPerformanceId(specialPerformanceConfig.getSpecialPerformanceId()); auctionDetailVo.setSpecialPerformanceId(specialPerformanceConfig.getSpecialPerformanceId());
auctionDetailVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(specialPerformanceConfig.getCurrentPrice())); auctionDetailVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(specialPerformanceConfig.getCurrentPrice()));
auctionDetailVo.setIsSubscribed(disposableSubscribeRecordDao.isSubscribed(dto.getUserId(), specialPerformanceConfig.getSpecialPerformanceId(), DisposableSubscribeRecordEnum.TypeEnum.ITEM_PRE_END.getType()));
//查询用户是否关注该商品 //查询用户是否关注该商品
SpecialPerformanceItemFollowRequestDto specialPerformanceItemFollowRequestDto = new SpecialPerformanceItemFollowRequestDto(); SpecialPerformanceItemFollowRequestDto specialPerformanceItemFollowRequestDto = new SpecialPerformanceItemFollowRequestDto();
specialPerformanceItemFollowRequestDto.setSpecialPerformanceId(specialPerformanceConfig.getSpecialPerformanceId()); specialPerformanceItemFollowRequestDto.setSpecialPerformanceId(specialPerformanceConfig.getSpecialPerformanceId());
......
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