The following issues were found
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallSystemExample.java
34 issues
Line: 247
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
Reported by PMD.
Line: 254
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
Reported by PMD.
Line: 261
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
Reported by PMD.
Line: 1
package org.linlinjava.litemall.db.domain;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class LitemallSystemExample {
/**
* This field was generated by MyBatis Generator.
Reported by PMD.
Line: 7
import java.util.ArrayList;
import java.util.List;
public class LitemallSystemExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_system
*
* @mbg.generated
Reported by PMD.
Line: 30
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_system
*
Reported by PMD.
Line: 151
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
Reported by PMD.
Line: 176
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
Reported by PMD.
Line: 225
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
Line: 225
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallPermissionExample.java
34 issues
Line: 247
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
Reported by PMD.
Line: 254
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
Reported by PMD.
Line: 261
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
Reported by PMD.
Line: 1
package org.linlinjava.litemall.db.domain;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class LitemallPermissionExample {
/**
* This field was generated by MyBatis Generator.
Reported by PMD.
Line: 7
import java.util.ArrayList;
import java.util.List;
public class LitemallPermissionExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_permission
*
* @mbg.generated
Reported by PMD.
Line: 30
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_permission
*
Reported by PMD.
Line: 151
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
Reported by PMD.
Line: 176
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
Reported by PMD.
Line: 225
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
Line: 225
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallFootprintExample.java
34 issues
Line: 247
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
Reported by PMD.
Line: 254
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
Reported by PMD.
Line: 261
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
Reported by PMD.
Line: 1
package org.linlinjava.litemall.db.domain;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class LitemallFootprintExample {
/**
* This field was generated by MyBatis Generator.
Reported by PMD.
Line: 7
import java.util.ArrayList;
import java.util.List;
public class LitemallFootprintExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_footprint
*
* @mbg.generated
Reported by PMD.
Line: 30
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_footprint
*
Reported by PMD.
Line: 151
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
Reported by PMD.
Line: 176
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
Reported by PMD.
Line: 225
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
Line: 225
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java
33 issues
Line: 16
import java.util.List;
@Service
public class LitemallGrouponService {
@Resource
private LitemallGrouponMapper mapper;
/**
* 获取用户发起的团购记录
Reported by PMD.
Line: 18
@Service
public class LitemallGrouponService {
@Resource
private LitemallGrouponMapper mapper;
/**
* 获取用户发起的团购记录
*
* @param userId
Reported by PMD.
Line: 28
*/
public List<LitemallGroupon> queryMyGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 28
*/
public List<LitemallGroupon> queryMyGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 28
*/
public List<LitemallGroupon> queryMyGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 28
*/
public List<LitemallGroupon> queryMyGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 28
*/
public List<LitemallGroupon> queryMyGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 41
*/
public List<LitemallGroupon> queryMyJoinGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andGrouponIdNotEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 41
*/
public List<LitemallGroupon> queryMyJoinGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andGrouponIdNotEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
Line: 41
*/
public List<LitemallGroupon> queryMyJoinGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andGrouponIdNotEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
/**
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/CouponVerifyService.java
32 issues
Line: 15
import java.util.*;
@Service
public class CouponVerifyService {
@Autowired
private LitemallCouponUserService couponUserService;
@Autowired
private LitemallCouponService couponService;
Reported by PMD.
Line: 15
import java.util.*;
@Service
public class CouponVerifyService {
@Autowired
private LitemallCouponUserService couponUserService;
@Autowired
private LitemallCouponService couponService;
Reported by PMD.
Line: 18
public class CouponVerifyService {
@Autowired
private LitemallCouponUserService couponUserService;
@Autowired
private LitemallCouponService couponService;
@Autowired
private LitemallGoodsService goodsService;
Reported by PMD.
Line: 20
@Autowired
private LitemallCouponUserService couponUserService;
@Autowired
private LitemallCouponService couponService;
@Autowired
private LitemallGoodsService goodsService;
/**
* 检测优惠券是否适合
Reported by PMD.
Line: 22
@Autowired
private LitemallCouponService couponService;
@Autowired
private LitemallGoodsService goodsService;
/**
* 检测优惠券是否适合
*
* @param userId
Reported by PMD.
Line: 32
* @param checkedGoodsPrice
* @return
*/
public LitemallCoupon checkCoupon(Integer userId, Integer couponId, Integer userCouponId, BigDecimal checkedGoodsPrice, List<LitemallCart> cartList) {
LitemallCoupon coupon = couponService.findById(couponId);
if (coupon == null || coupon.getDeleted()) {
return null;
}
Reported by PMD.
Line: 32
* @param checkedGoodsPrice
* @return
*/
public LitemallCoupon checkCoupon(Integer userId, Integer couponId, Integer userCouponId, BigDecimal checkedGoodsPrice, List<LitemallCart> cartList) {
LitemallCoupon coupon = couponService.findById(couponId);
if (coupon == null || coupon.getDeleted()) {
return null;
}
Reported by PMD.
Line: 32
* @param checkedGoodsPrice
* @return
*/
public LitemallCoupon checkCoupon(Integer userId, Integer couponId, Integer userCouponId, BigDecimal checkedGoodsPrice, List<LitemallCart> cartList) {
LitemallCoupon coupon = couponService.findById(couponId);
if (coupon == null || coupon.getDeleted()) {
return null;
}
Reported by PMD.
Line: 32
* @param checkedGoodsPrice
* @return
*/
public LitemallCoupon checkCoupon(Integer userId, Integer couponId, Integer userCouponId, BigDecimal checkedGoodsPrice, List<LitemallCart> cartList) {
LitemallCoupon coupon = couponService.findById(couponId);
if (coupon == null || coupon.getDeleted()) {
return null;
}
Reported by PMD.
Line: 34
*/
public LitemallCoupon checkCoupon(Integer userId, Integer couponId, Integer userCouponId, BigDecimal checkedGoodsPrice, List<LitemallCart> cartList) {
LitemallCoupon coupon = couponService.findById(couponId);
if (coupon == null || coupon.getDeleted()) {
return null;
}
LitemallCouponUser couponUser = couponUserService.findById(userCouponId);
if (couponUser == null) {
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCouponService.java
32 issues
Line: 86
example.or().andCodeEqualTo(code).andTypeEqualTo(CouponConstant.TYPE_CODE).andStatusEqualTo(CouponConstant.STATUS_NORMAL).andDeletedEqualTo(false);
List<LitemallCoupon> couponList = couponMapper.selectByExample(example);
if(couponList.size() > 1){
throw new RuntimeException("");
}
else if(couponList.size() == 0){
return null;
}
else {
Reported by PMD.
Line: 19
import java.util.stream.Collectors;
@Service
public class LitemallCouponService {
@Resource
private LitemallCouponMapper couponMapper;
@Resource
private LitemallCouponUserMapper couponUserMapper;
Reported by PMD.
Line: 21
@Service
public class LitemallCouponService {
@Resource
private LitemallCouponMapper couponMapper;
@Resource
private LitemallCouponUserMapper couponUserMapper;
private Column[] result = new Column[]{Column.id, Column.name, Column.desc, Column.tag,
Column.days, Column.startTime, Column.endTime,
Reported by PMD.
Line: 23
@Resource
private LitemallCouponMapper couponMapper;
@Resource
private LitemallCouponUserMapper couponUserMapper;
private Column[] result = new Column[]{Column.id, Column.name, Column.desc, Column.tag,
Column.days, Column.startTime, Column.endTime,
Column.discount, Column.min};
Reported by PMD.
Line: 25
@Resource
private LitemallCouponUserMapper couponUserMapper;
private Column[] result = new Column[]{Column.id, Column.name, Column.desc, Column.tag,
Column.days, Column.startTime, Column.endTime,
Column.discount, Column.min};
/**
* 查询,空参数
Reported by PMD.
Line: 25
@Resource
private LitemallCouponUserMapper couponUserMapper;
private Column[] result = new Column[]{Column.id, Column.name, Column.desc, Column.tag,
Column.days, Column.startTime, Column.endTime,
Column.discount, Column.min};
/**
* 查询,空参数
Reported by PMD.
Line: 53
* @return
*/
public List<LitemallCoupon> queryList(LitemallCouponExample.Criteria criteria, int offset, int limit, String sort, String order) {
criteria.andTypeEqualTo(CouponConstant.TYPE_COMMON).andStatusEqualTo(CouponConstant.STATUS_NORMAL).andDeletedEqualTo(false);
criteria.example().setOrderByClause(sort + " " + order);
PageHelper.startPage(offset, limit);
return couponMapper.selectByExampleSelective(criteria.example(), result);
}
Reported by PMD.
Line: 53
* @return
*/
public List<LitemallCoupon> queryList(LitemallCouponExample.Criteria criteria, int offset, int limit, String sort, String order) {
criteria.andTypeEqualTo(CouponConstant.TYPE_COMMON).andStatusEqualTo(CouponConstant.STATUS_NORMAL).andDeletedEqualTo(false);
criteria.example().setOrderByClause(sort + " " + order);
PageHelper.startPage(offset, limit);
return couponMapper.selectByExampleSelective(criteria.example(), result);
}
Reported by PMD.
Line: 54
*/
public List<LitemallCoupon> queryList(LitemallCouponExample.Criteria criteria, int offset, int limit, String sort, String order) {
criteria.andTypeEqualTo(CouponConstant.TYPE_COMMON).andStatusEqualTo(CouponConstant.STATUS_NORMAL).andDeletedEqualTo(false);
criteria.example().setOrderByClause(sort + " " + order);
PageHelper.startPage(offset, limit);
return couponMapper.selectByExampleSelective(criteria.example(), result);
}
public List<LitemallCoupon> queryAvailableList(Integer userId, int offset, int limit) {
Reported by PMD.
Line: 64
// 过滤掉登录账号已经领取过的coupon
LitemallCouponExample.Criteria c = LitemallCouponExample.newAndCreateCriteria();
List<LitemallCouponUser> used = couponUserMapper.selectByExample(
LitemallCouponUserExample.newAndCreateCriteria().andUserIdEqualTo(userId).example()
);
if(used!=null && !used.isEmpty()){
c.andIdNotIn(used.stream().map(LitemallCouponUser::getCouponId).collect(Collectors.toList()));
}
return queryList(c, offset, limit, "add_time", "desc");
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallRegionExample.java
31 issues
Line: 246
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
Reported by PMD.
Line: 253
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
Reported by PMD.
Line: 260
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
Reported by PMD.
Line: 1
package org.linlinjava.litemall.db.domain;
import java.util.ArrayList;
import java.util.List;
public class LitemallRegionExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_region
Reported by PMD.
Line: 6
import java.util.ArrayList;
import java.util.List;
public class LitemallRegionExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table litemall_region
*
* @mbg.generated
Reported by PMD.
Line: 29
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_region
*
Reported by PMD.
Line: 150
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
Reported by PMD.
Line: 175
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
Reported by PMD.
Line: 224
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
Line: 224
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/qcode/QCodeService.java
30 issues
Line: 36
//创建该商品的二维码
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit("groupon," + groupon.getId(), "pages" +
"/index/index");
FileInputStream inputStream = new FileInputStream(file);
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName);
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(imageData);
//存储分享图
LitemallStorage storageInfo = storageService.store(inputStream2, imageData.length, "image/jpeg",
Reported by PMD.
Line: 71
try {
//创建该商品的二维码
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit("goods," + goodId, "pages/index/index");
FileInputStream inputStream = new FileInputStream(file);
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName);
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(imageData);
//存储分享图
LitemallStorage litemallStorage = storageService.store(inputStream2, imageData.length, "image/jpeg",
Reported by PMD.
Line: 23
@Service
public class QCodeService {
private final Log logger = LogFactory.getLog(QCodeService.class);
@Autowired
WxMaService wxMaService;
@Autowired
private StorageService storageService;
Reported by PMD.
Line: 23
@Service
public class QCodeService {
private final Log logger = LogFactory.getLog(QCodeService.class);
@Autowired
WxMaService wxMaService;
@Autowired
private StorageService storageService;
Reported by PMD.
Line: 25
public class QCodeService {
private final Log logger = LogFactory.getLog(QCodeService.class);
@Autowired
WxMaService wxMaService;
@Autowired
private StorageService storageService;
Reported by PMD.
Line: 28
WxMaService wxMaService;
@Autowired
private StorageService storageService;
public String createGrouponShareImage(String goodName, String goodPicUrl, LitemallGroupon groupon) {
try {
//创建该商品的二维码
Reported by PMD.
Line: 34
public String createGrouponShareImage(String goodName, String goodPicUrl, LitemallGroupon groupon) {
try {
//创建该商品的二维码
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit("groupon," + groupon.getId(), "pages" +
"/index/index");
FileInputStream inputStream = new FileInputStream(file);
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName);
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(imageData);
Reported by PMD.
Line: 36
//创建该商品的二维码
File file = wxMaService.getQrcodeService().createWxaCodeUnlimit("groupon," + groupon.getId(), "pages" +
"/index/index");
FileInputStream inputStream = new FileInputStream(file);
//将商品图片,商品名字,商城名字画到模版图中
byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName);
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(imageData);
//存储分享图
LitemallStorage storageInfo = storageService.store(inputStream2, imageData.length, "image/jpeg",
Reported by PMD.
Line: 42
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(imageData);
//存储分享图
LitemallStorage storageInfo = storageService.store(inputStream2, imageData.length, "image/jpeg",
getKeyName(groupon.getId().toString()));
return storageInfo.getUrl();
} catch (WxErrorException e) {
logger.error(e.getMessage(), e);
} catch (FileNotFoundException e) {
Reported by PMD.
Line: 44
LitemallStorage storageInfo = storageService.store(inputStream2, imageData.length, "image/jpeg",
getKeyName(groupon.getId().toString()));
return storageInfo.getUrl();
} catch (WxErrorException e) {
logger.error(e.getMessage(), e);
} catch (FileNotFoundException e) {
logger.error(e.getMessage(), e);
} catch (IOException e) {
Reported by PMD.
litemall-core/src/test/java/org/linlinjava/litemall/core/TaskTest.java
30 issues
Line: 46
public void run() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("task id=" + this.getId() + " at time=" + now);
}
}
@Test
Reported by PMD.
Line: 55
public void test() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("start at time=" + now);
taskService.addTask(new DemoTask("3", 1000));
taskService.addTask(new DemoTask("2", 2000));
taskService.addTask(new DemoTask("1", 3000));
Reported by PMD.
Line: 76
public void test1() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("start at time=" + now);
taskService.addTask(new DemoTask("3", 0));
taskService.addTask(new DemoTask("2", 0));
taskService.addTask(new DemoTask("1", 0));
Reported by PMD.
Line: 97
public void test2() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("start at time=" + now);
taskService.addTask(new DemoTask("1", 0));
taskService.addTask(new DemoTask("2", 1200));
taskService.addTask(new DemoTask("3", 5200));
Reported by PMD.
Line: 33
@RunWith(SpringRunner.class)
@SpringBootTest
public class TaskTest {
private final Log logger = LogFactory.getLog(TaskTest.class);
@Autowired
private TaskService taskService;
private class DemoTask extends Task {
Reported by PMD.
Line: 33
@RunWith(SpringRunner.class)
@SpringBootTest
public class TaskTest {
private final Log logger = LogFactory.getLog(TaskTest.class);
@Autowired
private TaskService taskService;
private class DemoTask extends Task {
Reported by PMD.
Line: 35
public class TaskTest {
private final Log logger = LogFactory.getLog(TaskTest.class);
@Autowired
private TaskService taskService;
private class DemoTask extends Task {
DemoTask(String id, long delayInMilliseconds){
super(id, delayInMilliseconds);
Reported by PMD.
Line: 44
}
@Override
public void run() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("task id=" + this.getId() + " at time=" + now);
}
}
Reported by PMD.
Line: 45
@Override
public void run() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("task id=" + this.getId() + " at time=" + now);
}
}
Reported by PMD.
Line: 52
}
@Test
public void test() {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String now = df.format(LocalDateTime.now());
System.out.println("start at time=" + now);
taskService.addTask(new DemoTask("3", 1000));
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxStorageController.java
30 issues
Line: 30
@RequestMapping("/wx/storage")
@Validated
public class WxStorageController {
private final Log logger = LogFactory.getLog(WxStorageController.class);
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
Reported by PMD.
Line: 30
@RequestMapping("/wx/storage")
@Validated
public class WxStorageController {
private final Log logger = LogFactory.getLog(WxStorageController.class);
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
Reported by PMD.
Line: 33
private final Log logger = LogFactory.getLog(WxStorageController.class);
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
private String generateKey(String originalFilename) {
int index = originalFilename.lastIndexOf('.');
Reported by PMD.
Line: 35
@Autowired
private StorageService storageService;
@Autowired
private LitemallStorageService litemallStorageService;
private String generateKey(String originalFilename) {
int index = originalFilename.lastIndexOf('.');
String suffix = originalFilename.substring(index);
Reported by PMD.
Line: 37
@Autowired
private LitemallStorageService litemallStorageService;
private String generateKey(String originalFilename) {
int index = originalFilename.lastIndexOf('.');
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
Reported by PMD.
Line: 41
int index = originalFilename.lastIndexOf('.');
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = litemallStorageService.findByKey(key);
Reported by PMD.
Line: 42
String suffix = originalFilename.substring(index);
String key = null;
LitemallStorage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = litemallStorageService.findByKey(key);
}
Reported by PMD.
Line: 70
public ResponseEntity<Resource> fetch(@PathVariable String key) {
LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
if (key == null) {
return ResponseEntity.notFound().build();
}
if (key.contains("../")) {
return ResponseEntity.badRequest().build();
}
String type = litemallStorage.getType();
Reported by PMD.
Line: 73
return ResponseEntity.notFound().build();
}
if (key.contains("../")) {
return ResponseEntity.badRequest().build();
}
String type = litemallStorage.getType();
MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.loadAsResource(key);
Reported by PMD.
Line: 75
if (key.contains("../")) {
return ResponseEntity.badRequest().build();
}
String type = litemallStorage.getType();
MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.loadAsResource(key);
if (file == null) {
return ResponseEntity.notFound().build();
Reported by PMD.