The following issues were found
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxTopicController.java
6 issues
Line: 34
@RequestMapping("/wx/topic")
@Validated
public class WxTopicController {
private final Log logger = LogFactory.getLog(WxTopicController.class);
@Autowired
private LitemallTopicService topicService;
@Autowired
private LitemallGoodsService goodsService;
Reported by PMD.
Line: 34
@RequestMapping("/wx/topic")
@Validated
public class WxTopicController {
private final Log logger = LogFactory.getLog(WxTopicController.class);
@Autowired
private LitemallTopicService topicService;
@Autowired
private LitemallGoodsService goodsService;
Reported by PMD.
Line: 37
private final Log logger = LogFactory.getLog(WxTopicController.class);
@Autowired
private LitemallTopicService topicService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallCollectService collectService;
Reported by PMD.
Line: 39
@Autowired
private LitemallTopicService topicService;
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallCollectService collectService;
/**
* 专题列表
Reported by PMD.
Line: 41
@Autowired
private LitemallGoodsService goodsService;
@Autowired
private LitemallCollectService collectService;
/**
* 专题列表
*
* @param page 分页页数
Reported by PMD.
Line: 76
}
// 用户收藏
int userHasCollect = 0;
if (userId != null) {
userHasCollect = collectService.count(userId, (byte)1, id);
}
Map<String, Object> entity = new HashMap<String, Object>();
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/task/AdminTaskStartupRunner.java
6 issues
Line: 20
public class AdminTaskStartupRunner implements ApplicationRunner {
@Autowired
private LitemallGrouponRulesService rulesService;
@Autowired
private TaskService taskService;
@Override
public void run(ApplicationArguments args) throws Exception {
Reported by PMD.
Line: 22
@Autowired
private LitemallGrouponRulesService rulesService;
@Autowired
private TaskService taskService;
@Override
public void run(ApplicationArguments args) throws Exception {
List<LitemallGrouponRules> grouponRulesList = rulesService.queryByStatus(GrouponConstant.RULE_STATUS_ON);
for(LitemallGrouponRules grouponRules : grouponRulesList){
Reported by PMD.
Line: 30
for(LitemallGrouponRules grouponRules : grouponRulesList){
LocalDateTime now = LocalDateTime.now();
LocalDateTime expire = grouponRules.getExpireTime();
if(expire.isBefore(now)) {
// 已经过期,则加入延迟队列
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), 0));
}
else{
// 还没过期,则加入延迟队列
Reported by PMD.
Line: 32
LocalDateTime expire = grouponRules.getExpireTime();
if(expire.isBefore(now)) {
// 已经过期,则加入延迟队列
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), 0));
}
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), delay));
Reported by PMD.
Line: 36
}
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), delay));
}
}
}
}
Reported by PMD.
Line: 37
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), delay));
}
}
}
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallSearchHistoryService.java
6 issues
Line: 17
@Service
public class LitemallSearchHistoryService {
@Resource
private LitemallSearchHistoryMapper searchHistoryMapper;
public void save(LitemallSearchHistory searchHistory) {
searchHistory.setAddTime(LocalDateTime.now());
searchHistory.setUpdateTime(LocalDateTime.now());
searchHistoryMapper.insertSelective(searchHistory);
Reported by PMD.
Line: 27
public List<LitemallSearchHistory> queryByUid(int uid) {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
example.or().andUserIdEqualTo(uid).andDeletedEqualTo(false);
example.setDistinct(true);
return searchHistoryMapper.selectByExampleSelective(example, LitemallSearchHistory.Column.keyword);
}
public void deleteByUid(int uid) {
Reported by PMD.
Line: 27
public List<LitemallSearchHistory> queryByUid(int uid) {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
example.or().andUserIdEqualTo(uid).andDeletedEqualTo(false);
example.setDistinct(true);
return searchHistoryMapper.selectByExampleSelective(example, LitemallSearchHistory.Column.keyword);
}
public void deleteByUid(int uid) {
Reported by PMD.
Line: 34
public void deleteByUid(int uid) {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
example.or().andUserIdEqualTo(uid);
searchHistoryMapper.logicalDeleteByExample(example);
}
public List<LitemallSearchHistory> querySelective(String userId, String keyword, Integer page, Integer size, String sort, String order) {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
Reported by PMD.
Line: 38
searchHistoryMapper.logicalDeleteByExample(example);
}
public List<LitemallSearchHistory> querySelective(String userId, String keyword, Integer page, Integer size, String sort, String order) {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
LitemallSearchHistoryExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId));
Reported by PMD.
Line: 48
if (!StringUtils.isEmpty(keyword)) {
criteria.andKeywordLike("%" + keyword + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallStorageService.java
6 issues
Line: 17
@Service
public class LitemallStorageService {
@Autowired
private LitemallStorageMapper storageMapper;
public void deleteByKey(String key) {
LitemallStorageExample example = new LitemallStorageExample();
example.or().andKeyEqualTo(key);
storageMapper.logicalDeleteByExample(example);
Reported by PMD.
Line: 21
public void deleteByKey(String key) {
LitemallStorageExample example = new LitemallStorageExample();
example.or().andKeyEqualTo(key);
storageMapper.logicalDeleteByExample(example);
}
public void add(LitemallStorage storageInfo) {
storageInfo.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 33
public LitemallStorage findByKey(String key) {
LitemallStorageExample example = new LitemallStorageExample();
example.or().andKeyEqualTo(key).andDeletedEqualTo(false);
return storageMapper.selectOneByExample(example);
}
public int update(LitemallStorage storageInfo) {
storageInfo.setUpdateTime(LocalDateTime.now());
Reported by PMD.
Line: 33
public LitemallStorage findByKey(String key) {
LitemallStorageExample example = new LitemallStorageExample();
example.or().andKeyEqualTo(key).andDeletedEqualTo(false);
return storageMapper.selectOneByExample(example);
}
public int update(LitemallStorage storageInfo) {
storageInfo.setUpdateTime(LocalDateTime.now());
Reported by PMD.
Line: 46
return storageMapper.selectByPrimaryKey(id);
}
public List<LitemallStorage> querySelective(String key, String name, Integer page, Integer limit, String sort, String order) {
LitemallStorageExample example = new LitemallStorageExample();
LitemallStorageExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(key)) {
criteria.andKeyEqualTo(key);
Reported by PMD.
Line: 56
if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
litemall-wx-api/src/test/java/org/linlinjava/litemall/wx/BigDecimalTest.java
6 issues
Line: 19
BigDecimal c = a.subtract(b);
BigDecimal d = c.max(new BigDecimal(0));
System.out.println(c);
System.out.println(d);
}
}
Reported by PMD.
Line: 20
BigDecimal d = c.max(new BigDecimal(0));
System.out.println(c);
System.out.println(d);
}
}
Reported by PMD.
Line: 13
public class BigDecimalTest {
@Test
public void test() {
BigDecimal a = new BigDecimal(0);
BigDecimal b = new BigDecimal(1);
BigDecimal c = a.subtract(b);
BigDecimal d = c.max(new BigDecimal(0));
Reported by PMD.
Line: 14
@Test
public void test() {
BigDecimal a = new BigDecimal(0);
BigDecimal b = new BigDecimal(1);
BigDecimal c = a.subtract(b);
BigDecimal d = c.max(new BigDecimal(0));
System.out.println(c);
Reported by PMD.
Line: 15
@Test
public void test() {
BigDecimal a = new BigDecimal(0);
BigDecimal b = new BigDecimal(1);
BigDecimal c = a.subtract(b);
BigDecimal d = c.max(new BigDecimal(0));
System.out.println(c);
System.out.println(d);
Reported by PMD.
Line: 17
BigDecimal a = new BigDecimal(0);
BigDecimal b = new BigDecimal(1);
BigDecimal c = a.subtract(b);
BigDecimal d = c.max(new BigDecimal(0));
System.out.println(c);
System.out.println(d);
}
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallAdminService.java
6 issues
Line: 17
@Service
public class LitemallAdminService {
private final Column[] result = new Column[]{Column.id, Column.username, Column.avatar, Column.roleIds};
@Resource
private LitemallAdminMapper adminMapper;
public List<LitemallAdmin> findAdmin(String username) {
LitemallAdminExample example = new LitemallAdminExample();
Reported by PMD.
Line: 19
public class LitemallAdminService {
private final Column[] result = new Column[]{Column.id, Column.username, Column.avatar, Column.roleIds};
@Resource
private LitemallAdminMapper adminMapper;
public List<LitemallAdmin> findAdmin(String username) {
LitemallAdminExample example = new LitemallAdminExample();
example.or().andUsernameEqualTo(username).andDeletedEqualTo(false);
return adminMapper.selectByExample(example);
Reported by PMD.
Line: 23
public List<LitemallAdmin> findAdmin(String username) {
LitemallAdminExample example = new LitemallAdminExample();
example.or().andUsernameEqualTo(username).andDeletedEqualTo(false);
return adminMapper.selectByExample(example);
}
public LitemallAdmin findAdmin(Integer id) {
return adminMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 23
public List<LitemallAdmin> findAdmin(String username) {
LitemallAdminExample example = new LitemallAdminExample();
example.or().andUsernameEqualTo(username).andDeletedEqualTo(false);
return adminMapper.selectByExample(example);
}
public LitemallAdmin findAdmin(Integer id) {
return adminMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 38
if (!StringUtils.isEmpty(username)) {
criteria.andUsernameLike("%" + username + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
Line: 69
public List<LitemallAdmin> all() {
LitemallAdminExample example = new LitemallAdminExample();
example.or().andDeletedEqualTo(false);
return adminMapper.selectByExample(example);
}
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/QiniuStorage.java
6 issues
Line: 21
public class QiniuStorage implements Storage {
private final Log logger = LogFactory.getLog(QiniuStorage.class);
private String endpoint;
private String accessKey;
private String secretKey;
private String bucketName;
Reported by PMD.
Line: 21
public class QiniuStorage implements Storage {
private final Log logger = LogFactory.getLog(QiniuStorage.class);
private String endpoint;
private String accessKey;
private String secretKey;
private String bucketName;
Reported by PMD.
Line: 27
private String accessKey;
private String secretKey;
private String bucketName;
private Auth auth;
private UploadManager uploadManager;
private BucketManager bucketManager;
public String getEndpoint() {
return endpoint;
Reported by PMD.
Line: 28
private String secretKey;
private String bucketName;
private Auth auth;
private UploadManager uploadManager;
private BucketManager bucketManager;
public String getEndpoint() {
return endpoint;
}
Reported by PMD.
Line: 29
private String bucketName;
private Auth auth;
private UploadManager uploadManager;
private BucketManager bucketManager;
public String getEndpoint() {
return endpoint;
}
Reported by PMD.
Line: 117
}
try {
bucketManager.delete(bucketName, keyName);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
@Override
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java
6 issues
Line: 22
@RequestMapping("/admin/goods")
@Validated
public class AdminGoodsController {
private final Log logger = LogFactory.getLog(AdminGoodsController.class);
@Autowired
private AdminGoodsService adminGoodsService;
/**
Reported by PMD.
Line: 22
@RequestMapping("/admin/goods")
@Validated
public class AdminGoodsController {
private final Log logger = LogFactory.getLog(AdminGoodsController.class);
@Autowired
private AdminGoodsService adminGoodsService;
/**
Reported by PMD.
Line: 25
private final Log logger = LogFactory.getLog(AdminGoodsController.class);
@Autowired
private AdminGoodsService adminGoodsService;
/**
* 查询商品
*
* @param goodsId
Reported by PMD.
Line: 40
* @return
*/
@RequiresPermissions("admin:goods:list")
@RequiresPermissionsDesc(menu = {"商品管理", "商品管理"}, button = "查询")
@GetMapping("/list")
public Object list(Integer goodsId, String goodsSn, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 42
@RequiresPermissions("admin:goods:list")
@RequiresPermissionsDesc(menu = {"商品管理", "商品管理"}, button = "查询")
@GetMapping("/list")
public Object list(Integer goodsId, String goodsSn, String name,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
return adminGoodsService.list(goodsId, goodsSn, name, page, limit, sort, order);
Reported by PMD.
Line: 14
import org.linlinjava.litemall.db.domain.LitemallGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
@RestController
@RequestMapping("/admin/goods")
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminIssueController.java
6 issues
Line: 24
@RequestMapping("/admin/issue")
@Validated
public class AdminIssueController {
private final Log logger = LogFactory.getLog(AdminIssueController.class);
@Autowired
private LitemallIssueService issueService;
@RequiresPermissions("admin:issue:list")
Reported by PMD.
Line: 24
@RequestMapping("/admin/issue")
@Validated
public class AdminIssueController {
private final Log logger = LogFactory.getLog(AdminIssueController.class);
@Autowired
private LitemallIssueService issueService;
@RequiresPermissions("admin:issue:list")
Reported by PMD.
Line: 27
private final Log logger = LogFactory.getLog(AdminIssueController.class);
@Autowired
private LitemallIssueService issueService;
@RequiresPermissions("admin:issue:list")
@RequiresPermissionsDesc(menu = {"商场管理", "通用问题"}, button = "查询")
@GetMapping("/list")
public Object list(String question,
Reported by PMD.
Line: 30
private LitemallIssueService issueService;
@RequiresPermissions("admin:issue:list")
@RequiresPermissionsDesc(menu = {"商场管理", "通用问题"}, button = "查询")
@GetMapping("/list")
public Object list(String question,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 30
private LitemallIssueService issueService;
@RequiresPermissions("admin:issue:list")
@RequiresPermissionsDesc(menu = {"商场管理", "通用问题"}, button = "查询")
@GetMapping("/list")
public Object list(String question,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
Reported by PMD.
Line: 15
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/CouponAssignService.java
6 issues
Line: 17
public class CouponAssignService {
@Autowired
private LitemallCouponUserService couponUserService;
@Autowired
private LitemallCouponService couponService;
/**
* 分发注册优惠券
Reported by PMD.
Line: 19
@Autowired
private LitemallCouponUserService couponUserService;
@Autowired
private LitemallCouponService couponService;
/**
* 分发注册优惠券
*
* @param userId
Reported by PMD.
Line: 39
Short limit = coupon.getLimit();
while(limit > 0){
LitemallCouponUser couponUser = new LitemallCouponUser();
couponUser.setCouponId(couponId);
couponUser.setUserId(userId);
Short timeType = coupon.getTimeType();
if (timeType.equals(CouponConstant.TIME_TYPE_TIME)) {
couponUser.setStartTime(coupon.getStartTime());
Reported by PMD.
Line: 43
couponUser.setCouponId(couponId);
couponUser.setUserId(userId);
Short timeType = coupon.getTimeType();
if (timeType.equals(CouponConstant.TIME_TYPE_TIME)) {
couponUser.setStartTime(coupon.getStartTime());
couponUser.setEndTime(coupon.getEndTime());
}
else{
LocalDateTime now = LocalDateTime.now();
Reported by PMD.
Line: 50
else{
LocalDateTime now = LocalDateTime.now();
couponUser.setStartTime(now);
couponUser.setEndTime(now.plusDays(coupon.getDays()));
}
couponUserService.add(couponUser);
limit--;
}
Reported by PMD.
Line: 9
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class CouponAssignService {
Reported by PMD.