From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java | 194 ++++++++++++++++++++++++------------------------ 1 files changed, 97 insertions(+), 97 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java index 08a64fd..4da18c2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java @@ -1,97 +1,97 @@ -package com.yeshi.fanli.service.impl.brand; - -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.yeshi.fanli.dao.mybatis.brand.BrandInfoRecordMapper; -import com.yeshi.fanli.entity.brand.BrandInfo; -import com.yeshi.fanli.entity.brand.BrandInfoRecord; -import com.yeshi.fanli.service.inter.brand.BrandInfoRecordService; -import com.yeshi.fanli.util.StringUtil; - -@Service -public class BrandInfoRecordServiceImpl implements BrandInfoRecordService { - - @Resource - private BrandInfoRecordMapper brandInfoRecordMapper; - - - @Override - @Transactional - public void deleteRecord(List<Long> list, Long uid, String device) { - if (list == null || list.size() == 0) - return; - - if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) - return; - - // 浼樺厛鐢ㄦ埛涓轰富 - if (uid != null && uid > 0) - device = null; - - for (long brandId: list) { - brandInfoRecordMapper.updateState(brandId, uid, device); - } - } - - @Async() - @Override - public void addRecord(Long brandId, Long uid, String device) { - if (brandId == null || brandId == 0) - return; - - if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) - return; - - // 浼樺厛鐢ㄦ埛涓轰富 - if (uid != null && uid > 0) - device = null; - - BrandInfoRecord record = brandInfoRecordMapper.getRecord(brandId, uid, device); - if (record != null) { - BrandInfoRecord update = new BrandInfoRecord(); - update.setState(0); - update.setId(record.getId()); - update.setUpdateTime(new Date()); - brandInfoRecordMapper.updateByPrimaryKeySelective(update); - } else { - record = new BrandInfoRecord(); - record.setUid(uid); - record.setDevice(device); - record.setBrandInfo(new BrandInfo(brandId)); - record.setCreateTime(new Date()); - record.setUpdateTime(new Date()); - brandInfoRecordMapper.insertSelective(record); - } - } - - @Override - public List<BrandInfoRecord> listRecord(long start, int count, Long uid, String device) { - if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) - return null; - - // 浼樺厛鐢ㄦ埛涓轰富 - if (uid != null && uid > 0) - device = null; - - return brandInfoRecordMapper.listRecord(start, count, uid, device); - } - - @Override - public long countRecord(Long uid, String device) { - if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) - return 0; - - // 浼樺厛鐢ㄦ埛涓轰富 - if (uid != null && uid > 0) - device = null; - return brandInfoRecordMapper.countRecord(uid, device); - } - -} +package com.yeshi.fanli.service.impl.brand; + +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.yeshi.fanli.dao.mybatis.brand.BrandInfoRecordMapper; +import com.yeshi.fanli.entity.brand.BrandInfo; +import com.yeshi.fanli.entity.brand.BrandInfoRecord; +import com.yeshi.fanli.service.inter.brand.BrandInfoRecordService; +import com.yeshi.fanli.util.StringUtil; + +@Service +public class BrandInfoRecordServiceImpl implements BrandInfoRecordService { + + @Resource + private BrandInfoRecordMapper brandInfoRecordMapper; + + + @Override + @Transactional + public void deleteRecord(List<String> list, Long uid, String device) { + if (list == null || list.size() == 0) + return; + + if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) + return; + + // 浼樺厛鐢ㄦ埛涓轰富 + if (uid != null && uid > 0) + device = null; + + for (String brandId: list) { + brandInfoRecordMapper.updateState(Long.parseLong(brandId), uid, device); + } + } + + @Async() + @Override + public void addRecord(Long brandId, Long uid, String device) { + if (brandId == null || brandId == 0) + return; + + if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) + return; + + // 浼樺厛鐢ㄦ埛涓轰富 + if (uid != null && uid > 0) + device = null; + + BrandInfoRecord record = brandInfoRecordMapper.getRecord(brandId, uid, device); + if (record != null) { + BrandInfoRecord update = new BrandInfoRecord(); + update.setState(0); + update.setId(record.getId()); + update.setUpdateTime(new Date()); + brandInfoRecordMapper.updateByPrimaryKeySelective(update); + } else { + record = new BrandInfoRecord(); + record.setUid(uid); + record.setDevice(device); + record.setBrandInfo(new BrandInfo(brandId)); + record.setCreateTime(new Date()); + record.setUpdateTime(new Date()); + brandInfoRecordMapper.insertSelective(record); + } + } + + @Override + public List<BrandInfoRecord> listRecord(long start, int count, Long uid, String device) { + if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) + return null; + + // 浼樺厛鐢ㄦ埛涓轰富 + if (uid != null && uid > 0) + device = null; + + return brandInfoRecordMapper.listRecord(start, count, uid, device); + } + + @Override + public long countRecord(Long uid, String device) { + if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device)) + return 0; + + // 浼樺厛鐢ㄦ埛涓轰富 + if (uid != null && uid > 0) + device = null; + return brandInfoRecordMapper.countRecord(uid, device); + } + +} -- Gitblit v1.8.0