Commit 05d6f362 authored by shiyu's avatar shiyu

拍卖专场1

parent 0c6738fe
......@@ -151,6 +151,11 @@ public class SupplierItemVo implements Entity {
*/
private Date realEndTime;
/**
* 出价记录
*/
private Long offerNum;
/**
* 起拍价
* 单位元 需要转为分
......
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.SpecialPerformanceConfig;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto;
import java.util.List;
public interface SpecialPerformanceConfigDao {
List<SpecialPerformanceConfig> findList(SpecialPerformanceConfigRequestDto dto);
List<SpecialPerformanceConfig> findAllItem(int specialPerformanceId);
boolean insert(SpecialPerformanceConfig specialPerformanceConfig);
boolean update(SpecialPerformanceConfig specialPerformanceConfig);
long countViewNum(int specialPerformanceId);
}
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.SpecialPerformance;
public interface SpecialPerformanceDao {
SpecialPerformance findByType(int type);
SpecialPerformance findById(int id);
boolean update(SpecialPerformance specialPerformance);
}
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/05/29
* @date 2024/05/31
*/
@Data
public class SpecialPerformance implements Entity {
......@@ -31,6 +31,16 @@ public class SpecialPerformance implements Entity {
*/
private Date updateTime;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 专场类型1拍卖
*/
......@@ -53,6 +63,8 @@ public class SpecialPerformance implements Entity {
sb.append(", title=").append(title);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", type=").append(type);
sb.append(", state=").append(state);
sb.append(", serialVersionUID=").append(serialVersionUID);
......@@ -76,6 +88,8 @@ public class SpecialPerformance implements Entity {
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
}
......@@ -88,6 +102,8 @@ public class SpecialPerformance implements Entity {
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
return result;
......@@ -105,6 +121,8 @@ public class SpecialPerformance implements Entity {
title("title", "title", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
startTime("start_time", "startTime", "TIMESTAMP", false),
endTime("end_time", "endTime", "TIMESTAMP", false),
type("type", "type", "INTEGER", true),
state("state", "state", "INTEGER", true);
......
......@@ -5,6 +5,7 @@ import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class AuctionRecordRequestDto extends BaseRequestDto implements Entity {
......@@ -16,6 +17,12 @@ public class AuctionRecordRequestDto extends BaseRequestDto implements Entity {
*/
private Long itemId;
/**
* 商品id
*/
private List<Long> itemIdList;
/**
* 用户id
*/
......
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 SpecialPerformanceConfigRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 专场id
*/
private Integer specialPerformanceId;
/**
* 商品id
*/
private Long itemId;
/**
* 创建时间
*/
private Date createTime;
/**
* 浏览次数
*/
private Integer viewNum;
/**
* 状态
*/
private Integer state;
}
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 SpecialPerformanceRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 专场id
*/
private Integer specialPerformanceId;
/**
* 专场名称
*/
private String title;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 专场类型1拍卖
*/
private Integer type;
/**
* 状态
*/
private Integer state;
}
......@@ -98,6 +98,7 @@ public class AuctionRecordDaoImpl implements AuctionRecordDao {
public long count(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemIdList(), criteria::andItemIdIn);
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
......
package com.wwdz.ch.db.impl.distribution;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.distribution.SpecialPerformanceConfigDao;
import com.wwdz.ch.db.domain.distribution.SpecialPerformanceConfig;
import com.wwdz.ch.db.domain.distribution.SpecialPerformanceConfigExample;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto;
import com.wwdz.ch.db.mapper.distribution.SpecialPerformanceConfigMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfigDao {
@Autowired
SpecialPerformanceConfigMapper specialPerformanceConfigMapper;
@Override
public List<SpecialPerformanceConfig> findList(SpecialPerformanceConfigRequestDto dto) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getSpecialPerformanceId(), criteria::andSpecialPerformanceIdEqualTo);
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
PageHelper.startPage(dto.getPage(), dto.getLimit());
return specialPerformanceConfigMapper.selectByExample(example);
}
@Override
public List<SpecialPerformanceConfig> findAllItem(int specialPerformanceId) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId);
return specialPerformanceConfigMapper.selectByExampleSelective(example, SpecialPerformanceConfig.Column.itemId);
}
@Override
public boolean insert(SpecialPerformanceConfig specialPerformanceConfig) {
return specialPerformanceConfigMapper.insert(specialPerformanceConfig) > 0;
}
@Override
public boolean update(SpecialPerformanceConfig specialPerformanceConfig) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceConfig.getSpecialPerformanceId());
return specialPerformanceConfigMapper.updateByExampleSelective(specialPerformanceConfig, example) > 0;
}
@Override
public long countViewNum(int specialPerformanceId) {
return specialPerformanceConfigMapper.countViewNum(specialPerformanceId);
}
}
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.SpecialPerformanceDao;
import com.wwdz.ch.db.domain.distribution.SpecialPerformance;
import com.wwdz.ch.db.domain.distribution.SpecialPerformanceExample;
import com.wwdz.ch.db.mapper.distribution.SpecialPerformanceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class SpecialPerformanceDaoImpl implements SpecialPerformanceDao {
@Autowired
SpecialPerformanceMapper specialPerformanceMapper;
@Override
public SpecialPerformance findByType(int type) {
SpecialPerformanceExample example = new SpecialPerformanceExample();
SpecialPerformanceExample.Criteria criteria = example.createCriteria();
criteria.andTypeEqualTo(type);
return specialPerformanceMapper.selectOneByExample(example);
}
@Override
public SpecialPerformance findById(int id) {
SpecialPerformanceExample example = new SpecialPerformanceExample();
SpecialPerformanceExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(id);
return specialPerformanceMapper.selectOneByExample(example);
}
@Override
public boolean update(SpecialPerformance specialPerformance) {
return specialPerformanceMapper.updateByPrimaryKeySelective(specialPerformance) > 0;
}
}
......@@ -66,4 +66,11 @@ public interface SpecialPerformanceConfigMapper {
int updateByPrimaryKeySelective(SpecialPerformanceConfig record);
int updateByPrimaryKey(SpecialPerformanceConfig record);
/**
* 统计专场总围观数
* @param specialPerformanceId
* @return
*/
long countViewNum(@Param("specialPerformanceId")Integer specialPerformanceId);
}
\ No newline at end of file
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="special_performance_config" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="special_performance" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -46,10 +46,10 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
"/wx/distributionOrder/refund",
"/wx/supplierItem/findItemsOfCurrentDistributor", "/wx/selfPage/updateSwitch", "/wx/supplierItem/findHomePage"
//下列路径上线注释
/*, "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**",
,"/wx/specialPerformance/**"
, "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**",
"/wx/shareRecord/**","/wx/collectionBook/**", "/wx/collectedRecord/**", "/wx/collectionItemsRelation/**","/wx/collectionShareRecord/**"
,"/wx/logistics/**","/wx/follow/**"*/
,"/wx/logistics/**","/wx/follow/**"
// , "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**"
/* "/wx/officialAccount/**",
......
package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
public class SpecialPerformanceVo implements Entity {
/**
* 专场总围观次数
*/
private Long totalViewNum;
/**
* 总商品数
*/
private Long totalItemNum;
/**
* 开始时间
*/
private Date startTime;
/**
* 截止日期
*/
private Date endTime;
/**
* 状态
*/
private Integer state;
private String stateName;
/**
* 专场标题
*/
private String title;
private List<Map<String, Object>> itemList;
}
......@@ -23,6 +23,7 @@ import com.wwdz.ch.wx.service.distribution.AuctionRecordService;
import com.wwdz.ch.core.service.SendMsgService;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
......@@ -88,6 +89,9 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
@Autowired
WxAppletApi wxAppletApi;
@Autowired
SpecialPerformanceConfigDao specialPerformanceConfigDao;
@Override
@Transactional
......@@ -109,11 +113,17 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
return Result.failed("该商品已截拍");
}
String shareRecordId = dto.getShareRecordId();
DistributorShareRecord distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
DistributorShareRecord distributorShareRecord = new DistributorShareRecord();
//拍卖专场进入的用户出价时没有分享记录的id,默认系统账号为分销商
if (StringUtils.isEmpty(shareRecordId)) {
distributorShareRecord.setDistributorId(CommConsts.SYSTEM_ACCOUNT);
} else {
distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
if (distributorShareRecord == null || !distributorShareRecord.getEnabled()) {
logger.info("======== 拍卖出价,对应分享id = {}, 无效 ========", shareRecordId);
return Result.failed("该商品分享链接已失效");
}
}
SupplierItem supplierItem = supplierItemDao.findById(itemId);
//查询当前最新的价格
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(itemId);
......@@ -168,7 +178,8 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
logger.info("商品id:{}, 用户id:{}, 本次出价时间: {}, 原先截拍时间为:{}, 延长截拍时间为{}", itemId, dto.getUserId(), now, endTime, newRealEndTime);
}
//发送消息通知对应的分销商有用户出价
//发送消息通知对应的分销商有用户出价, 排除分销商id为系统默认账号的情况
if (distributorShareRecord.getDistributorId().longValue() != CommConsts.SYSTEM_ACCOUNT) {
String openId = sendMsgService.getOpenIdByUserId(distributorShareRecord.getDistributorId());
if (com.xxdxxs.utils.StringUtils.hasLength(openId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
......@@ -189,6 +200,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
"元,请前往"+ url + "查看";
aliSmsSender.sendSms(distributorShareRecord.getDistributorId(), msg);
}
}
return Result.success();
} else {
return Result.failed("出价者较多,请刷新出价记录");
......
package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto;
public interface SpecialPerformanceService {
/**
* 查询专场信息
* @return
*/
Result findInfo(SpecialPerformanceRequestDto dto);
/**
* 查询专场商品列表
* @param dto
* @return
*/
Result findItemList(SpecialPerformanceRequestDto dto);
}
package com.wwdz.ch.wx.web.distribution;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.service.distribution.SpecialPerformanceService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/specialPerformance")
public class SpecialPerformanceController {
private static final Logger logger = LoggerFactory.getLogger(SpecialPerformanceController.class);
@Autowired
SpecialPerformanceService specialPerformanceService;
@ApiOperation(value = "查询专场信息")
@PostMapping("/findInfo")
public Result findInfo(@RequestBody SpecialPerformanceRequestDto dto) {
logger.info("查询专场信息,请求参数:{}", JSON.toJSONString(dto));
if (dto.getType() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return specialPerformanceService.findInfo(dto);
}
@ApiOperation(value = "查询专场商品列表")
@PostMapping("/findItemList")
public Result findItemList(@RequestBody SpecialPerformanceRequestDto dto) {
logger.info("查询专场商品列表,请求参数:{}", JSON.toJSONString(dto));
if (dto.getSpecialPerformanceId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return specialPerformanceService.findItemList(dto);
}
}
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