| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.goods.ScanHistoryV2Mapper;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.goods.ScanHistoryV2;
|
| | |
| | | private ScanHistoryV2Mapper scanHistoryV2Mapper;
|
| | |
|
| | | @Override
|
| | | public void addScanHistory(Long uid, String device, TaoBaoGoodsBrief goods)
|
| | | public void addVIPScanHistory(Long uid, String device, VIPGoodsInfo goods)
|
| | | throws CommonGoodsException, ScanHistoryException {
|
| | |
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | throw new ScanHistoryException(1, "设备或用户信息缺失");
|
| | |
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goods);
|
| | | addScanHistory(commonGoods, device, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSuningScanHistory(Long uid, String device, SuningGoodsInfo suningGoods)
|
| | | throws CommonGoodsException, ScanHistoryException {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | throw new ScanHistoryException(1, "设备或用户信息缺失");
|
| | | |
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goods);
|
| | |
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(suningGoods);
|
| | | addScanHistory(commonGoods, device, uid);
|
| | | }
|
| | |
|
| | | private void addScanHistory(CommonGoods commonGoods, String device, Long uid)
|
| | | throws CommonGoodsException, ScanHistoryException {
|
| | | commonGoods = commonGoodsService.addOrUpdateCommonGoods(commonGoods);
|
| | | if (commonGoods == null)
|
| | | throw new CommonGoodsException(2, "商品信息不完整");
|
| | | |
| | |
|
| | | // 添加浏览记录
|
| | | ScanHistoryV2 scanHistoryV2 = new ScanHistoryV2();
|
| | | scanHistoryV2.setCommonGoods(commonGoods);
|
| | | scanHistoryV2.setCreateTime(new Date());
|
| | | scanHistoryV2.setDevice(device);
|
| | | |
| | |
|
| | | if (uid != null)
|
| | | scanHistoryV2.setUserInfo(new UserInfo(uid));
|
| | | |
| | |
|
| | | scanHistoryV2.setUpdateTime(new Date());
|
| | | scanHistoryV2Mapper.insertSelective(scanHistoryV2);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void addJDScanHistory(Long uid, String device, JDGoods goods) throws CommonGoodsException, ScanHistoryException {
|
| | | public void addScanHistory(Long uid, String device, TaoBaoGoodsBrief goods)
|
| | | throws CommonGoodsException, ScanHistoryException {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | throw new ScanHistoryException(1, "设备或用户信息缺失");
|
| | | |
| | |
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goods);
|
| | | commonGoods = commonGoodsService.addOrUpdateCommonGoods(commonGoods);
|
| | | if (commonGoods == null)
|
| | | throw new CommonGoodsException(2, "商品信息不完整");
|
| | | |
| | |
|
| | | // 添加浏览记录
|
| | | ScanHistoryV2 scanHistoryV2 = new ScanHistoryV2();
|
| | | scanHistoryV2.setCommonGoods(commonGoods);
|
| | | scanHistoryV2.setCreateTime(new Date());
|
| | | scanHistoryV2.setDevice(device);
|
| | | |
| | |
|
| | | if (uid != null)
|
| | | scanHistoryV2.setUserInfo(new UserInfo(uid));
|
| | | |
| | |
|
| | | scanHistoryV2.setUpdateTime(new Date());
|
| | | scanHistoryV2Mapper.insertSelective(scanHistoryV2);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addPDDScanHistory(Long uid, String device, PDDGoodsDetail pddGoods) throws CommonGoodsException, ScanHistoryException {
|
| | | public void addJDScanHistory(Long uid, String device, JDGoods goods)
|
| | | throws CommonGoodsException, ScanHistoryException {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | throw new ScanHistoryException(1, "设备或用户信息缺失");
|
| | | |
| | | CommonGoods commonGoods = CommonGoodsFactory.create(pddGoods);
|
| | | commonGoods = commonGoodsService.addOrUpdateCommonGoods(commonGoods);
|
| | | if (commonGoods == null)
|
| | | throw new CommonGoodsException(2, "商品信息不完整");
|
| | | |
| | | // 添加浏览记录
|
| | | ScanHistoryV2 scanHistoryV2 = new ScanHistoryV2();
|
| | | scanHistoryV2.setCommonGoods(commonGoods);
|
| | | scanHistoryV2.setCreateTime(new Date());
|
| | | scanHistoryV2.setDevice(device);
|
| | | |
| | | if (uid != null)
|
| | | scanHistoryV2.setUserInfo(new UserInfo(uid));
|
| | | |
| | | scanHistoryV2.setUpdateTime(new Date());
|
| | | scanHistoryV2Mapper.insertSelective(scanHistoryV2);
|
| | |
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(goods);
|
| | | addScanHistory(commonGoods, device, uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void addPDDScanHistory(Long uid, String device, PDDGoodsDetail pddGoods)
|
| | | throws CommonGoodsException, ScanHistoryException {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | throw new ScanHistoryException(1, "设备或用户信息缺失");
|
| | |
|
| | | CommonGoods commonGoods = CommonGoodsFactory.create(pddGoods);
|
| | | addScanHistory(commonGoods, device, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addScanHistory(ScanHistoryV2 history) throws CommonGoodsException, ScanHistoryException {
|
| | | if (history == null)
|
| | |
| | | Integer source, boolean notBackSuVip) {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | return null;
|
| | | return scanHistoryV2Mapper.selectByDeviceOrUid(uid, device, (page - 1) * pageSize, pageSize, source, notBackSuVip);
|
| | | return scanHistoryV2Mapper.selectByDeviceOrUid(uid, device, (page - 1) * pageSize, pageSize, source,
|
| | | notBackSuVip);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | public void deleteByAuctionIdAndDeviceOrUid(Long uid, String device, Long auctionId) {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device))
|
| | | return;
|
| | | List<ScanHistoryV2> list = scanHistoryV2Mapper.selectByDeviceOrUidAndGoodsIdAndGoodsType(uid, device, auctionId);
|
| | | List<ScanHistoryV2> list = scanHistoryV2Mapper.selectByDeviceOrUidAndGoodsIdAndGoodsType(uid, device,
|
| | | auctionId);
|
| | | if (list != null)
|
| | | for (ScanHistoryV2 sv : list)
|
| | | scanHistoryV2Mapper.deleteByPrimaryKey(sv.getId());
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void deleteByCommonIdAndDeviceOrUid(Long uid, String device, Long commonId) {
|
| | | if (uid == null && StringUtil.isNullOrEmpty(device)) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<ScanHistoryV2> list = scanHistoryV2Mapper.getByCommonGoodsId(uid, device, commonId);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (ScanHistoryV2 sv : list) {
|