The following issues were found
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCatalogController.java
11 issues
Line: 28
@RequestMapping("/wx/catalog")
@Validated
public class WxCatalogController {
private final Log logger = LogFactory.getLog(WxCatalogController.class);
@Autowired
private LitemallCategoryService categoryService;
@GetMapping("/getfirstcategory")
Reported by PMD.
Line: 28
@RequestMapping("/wx/catalog")
@Validated
public class WxCatalogController {
private final Log logger = LogFactory.getLog(WxCatalogController.class);
@Autowired
private LitemallCategoryService categoryService;
@GetMapping("/getfirstcategory")
Reported by PMD.
Line: 31
private final Log logger = LogFactory.getLog(WxCatalogController.class);
@Autowired
private LitemallCategoryService categoryService;
@GetMapping("/getfirstcategory")
public Object getFirstCategory() {
// 所有一级分类目录
List<LitemallCategory> l1CatList = categoryService.queryL1();
Reported by PMD.
Line: 66
if (id != null) {
currentCategory = categoryService.findById(id);
} else {
if (l1CatList.size() > 0) {
currentCategory = l1CatList.get(0);
}
}
// 当前一级分类目录对应的二级分类目录
Reported by PMD.
Line: 109
}
// 当前一级分类目录
LitemallCategory currentCategory = l1CatList.get(0);
// 当前一级分类目录对应的二级分类目录
List<LitemallCategory> currentSubCategory = null;
if (null != currentCategory) {
currentSubCategory = categoryService.queryByPid(currentCategory.getId());
Reported by PMD.
Line: 141
if(currentCategory == null){
return ResponseUtil.badArgumentValue();
}
List<LitemallCategory> currentSubCategory = categoryService.queryByPid(currentCategory.getId());
Map<String, Object> data = new HashMap<String, Object>();
data.put("currentCategory", currentCategory);
data.put("currentSubCategory", currentSubCategory);
return ResponseUtil.ok(data);
Reported by PMD.
Line: 13
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
Reported by PMD.
Line: 62
List<LitemallCategory> l1CatList = categoryService.queryL1();
// 当前一级分类目录
LitemallCategory currentCategory = null;
if (id != null) {
currentCategory = categoryService.findById(id);
} else {
if (l1CatList.size() > 0) {
currentCategory = l1CatList.get(0);
Reported by PMD.
Line: 62
List<LitemallCategory> l1CatList = categoryService.queryL1();
// 当前一级分类目录
LitemallCategory currentCategory = null;
if (id != null) {
currentCategory = categoryService.findById(id);
} else {
if (l1CatList.size() > 0) {
currentCategory = l1CatList.get(0);
Reported by PMD.
Line: 72
}
// 当前一级分类目录对应的二级分类目录
List<LitemallCategory> currentSubCategory = null;
if (null != currentCategory) {
currentSubCategory = categoryService.queryByPid(currentCategory.getId());
}
Map<String, Object> data = new HashMap<String, Object>();
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/util/JacksonUtil.java
11 issues
Line: 14
import java.util.List;
import java.util.Map;
public class JacksonUtil {
private static final Log logger = LogFactory.getLog(JacksonUtil.class);
public static String parseString(String body, String field) {
ObjectMapper mapper = new ObjectMapper();
Reported by PMD.
Line: 14
import java.util.List;
import java.util.Map;
public class JacksonUtil {
private static final Log logger = LogFactory.getLog(JacksonUtil.class);
public static String parseString(String body, String field) {
ObjectMapper mapper = new ObjectMapper();
Reported by PMD.
Line: 16
public class JacksonUtil {
private static final Log logger = LogFactory.getLog(JacksonUtil.class);
public static String parseString(String body, String field) {
ObjectMapper mapper = new ObjectMapper();
JsonNode node;
try {
Reported by PMD.
Line: 25
node = mapper.readTree(body);
JsonNode leaf = node.get(field);
if (leaf != null)
return leaf.asText();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return null;
}
Reported by PMD.
Line: 56
node = mapper.readTree(body);
JsonNode leaf = node.get(field);
if (leaf != null)
return leaf.asInt();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return null;
}
Reported by PMD.
Line: 87
node = mapper.readTree(body);
JsonNode leaf = node.get(field);
if (leaf != null)
return leaf.asBoolean();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return null;
}
Reported by PMD.
Line: 101
node = mapper.readTree(body);
JsonNode leaf = node.get(field);
if (leaf != null) {
Integer value = leaf.asInt();
return value.shortValue();
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
Reported by PMD.
Line: 102
JsonNode leaf = node.get(field);
if (leaf != null) {
Integer value = leaf.asInt();
return value.shortValue();
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return null;
Reported by PMD.
Line: 117
node = mapper.readTree(body);
JsonNode leaf = node.get(field);
if (leaf != null) {
Integer value = leaf.asInt();
return value.byteValue();
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
Reported by PMD.
Line: 118
JsonNode leaf = node.get(field);
if (leaf != null) {
Integer value = leaf.asInt();
return value.byteValue();
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return null;
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/notify/NotifyService.java
11 issues
Line: 15
* 商城通知服务类
*/
public class NotifyService {
private MailSender mailSender;
private String sendFrom;
private String sendTo;
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
Reported by PMD.
Line: 16
*/
public class NotifyService {
private MailSender mailSender;
private String sendFrom;
private String sendTo;
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
Reported by PMD.
Line: 17
public class NotifyService {
private MailSender mailSender;
private String sendFrom;
private String sendTo;
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
private List<Map<String, String>> wxTemplate = new ArrayList<>();
Reported by PMD.
Line: 19
private String sendFrom;
private String sendTo;
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
private List<Map<String, String>> wxTemplate = new ArrayList<>();
public boolean isMailEnable() {
Reported by PMD.
Line: 20
private String sendTo;
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
private List<Map<String, String>> wxTemplate = new ArrayList<>();
public boolean isMailEnable() {
return mailSender != null;
Reported by PMD.
Line: 22
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
private List<Map<String, String>> wxTemplate = new ArrayList<>();
public boolean isMailEnable() {
return mailSender != null;
}
Reported by PMD.
Line: 22
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
private List<Map<String, String>> wxTemplate = new ArrayList<>();
public boolean isMailEnable() {
return mailSender != null;
}
Reported by PMD.
Line: 22
private SmsSender smsSender;
private List<Map<String, String>> smsTemplate = new ArrayList<>();
private List<Map<String, String>> wxTemplate = new ArrayList<>();
public boolean isMailEnable() {
return mailSender != null;
}
Reported by PMD.
Line: 106
for (Map<String, String> item : values) {
String notifyTypeStr = notifyType.getType();
if (item.get("name").equals(notifyTypeStr))
return item.get("templateId");
}
return null;
}
Reported by PMD.
Line: 54
* @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值
*/
@Async
public void notifySmsTemplate(String phoneNumber, NotifyType notifyType, String[] params) {
if (smsSender == null) {
return;
}
String templateIdStr = getTemplateId(notifyType, smsTemplate);
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGoodsSpecificationService.java
10 issues
Line: 18
@Service
public class LitemallGoodsSpecificationService {
@Resource
private LitemallGoodsSpecificationMapper goodsSpecificationMapper;
public List<LitemallGoodsSpecification> queryByGid(Integer id) {
LitemallGoodsSpecificationExample example = new LitemallGoodsSpecificationExample();
example.or().andGoodsIdEqualTo(id).andDeletedEqualTo(false);
return goodsSpecificationMapper.selectByExample(example);
Reported by PMD.
Line: 22
public List<LitemallGoodsSpecification> queryByGid(Integer id) {
LitemallGoodsSpecificationExample example = new LitemallGoodsSpecificationExample();
example.or().andGoodsIdEqualTo(id).andDeletedEqualTo(false);
return goodsSpecificationMapper.selectByExample(example);
}
public LitemallGoodsSpecification findById(Integer id) {
return goodsSpecificationMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 22
public List<LitemallGoodsSpecification> queryByGid(Integer id) {
LitemallGoodsSpecificationExample example = new LitemallGoodsSpecificationExample();
example.or().andGoodsIdEqualTo(id).andDeletedEqualTo(false);
return goodsSpecificationMapper.selectByExample(example);
}
public LitemallGoodsSpecification findById(Integer id) {
return goodsSpecificationMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 32
public void deleteByGid(Integer gid) {
LitemallGoodsSpecificationExample example = new LitemallGoodsSpecificationExample();
example.or().andGoodsIdEqualTo(gid);
goodsSpecificationMapper.logicalDeleteByExample(example);
}
public void add(LitemallGoodsSpecification goodsSpecification) {
goodsSpecification.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 67
String specification = goodsSpecification.getSpecification();
VO goodsSpecificationVo = map.get(specification);
if (goodsSpecificationVo == null) {
goodsSpecificationVo = new VO();
goodsSpecificationVo.setName(specification);
List<LitemallGoodsSpecification> valueList = new ArrayList<>();
valueList.add(goodsSpecification);
goodsSpecificationVo.setValueList(valueList);
map.put(specification, goodsSpecificationVo);
Reported by PMD.
Line: 69
if (goodsSpecificationVo == null) {
goodsSpecificationVo = new VO();
goodsSpecificationVo.setName(specification);
List<LitemallGoodsSpecification> valueList = new ArrayList<>();
valueList.add(goodsSpecification);
goodsSpecificationVo.setValueList(valueList);
map.put(specification, goodsSpecificationVo);
specificationVoList.add(goodsSpecificationVo);
} else {
Reported by PMD.
Line: 70
goodsSpecificationVo = new VO();
goodsSpecificationVo.setName(specification);
List<LitemallGoodsSpecification> valueList = new ArrayList<>();
valueList.add(goodsSpecification);
goodsSpecificationVo.setValueList(valueList);
map.put(specification, goodsSpecificationVo);
specificationVoList.add(goodsSpecificationVo);
} else {
List<LitemallGoodsSpecification> valueList = goodsSpecificationVo.getValueList();
Reported by PMD.
Line: 76
specificationVoList.add(goodsSpecificationVo);
} else {
List<LitemallGoodsSpecification> valueList = goodsSpecificationVo.getValueList();
valueList.add(goodsSpecification);
}
}
return specificationVoList;
}
Reported by PMD.
Line: 88
goodsSpecificationMapper.updateByPrimaryKeySelective(specification);
}
private class VO {
private String name;
private List<LitemallGoodsSpecification> valueList;
public String getName() {
return name;
Reported by PMD.
Line: 60
public Object getSpecificationVoList(Integer id) {
List<LitemallGoodsSpecification> goodsSpecificationList = queryByGid(id);
Map<String, VO> map = new HashMap<>();
List<VO> specificationVoList = new ArrayList<>();
for (LitemallGoodsSpecification goodsSpecification : goodsSpecificationList) {
String specification = goodsSpecification.getSpecification();
VO goodsSpecificationVo = map.get(specification);
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminOrderController.java
10 issues
Line: 26
@RequestMapping("/admin/order")
@Validated
public class AdminOrderController {
private final Log logger = LogFactory.getLog(AdminOrderController.class);
@Autowired
private AdminOrderService adminOrderService;
@Autowired
private ExpressService expressService;
Reported by PMD.
Line: 26
@RequestMapping("/admin/order")
@Validated
public class AdminOrderController {
private final Log logger = LogFactory.getLog(AdminOrderController.class);
@Autowired
private AdminOrderService adminOrderService;
@Autowired
private ExpressService expressService;
Reported by PMD.
Line: 29
private final Log logger = LogFactory.getLog(AdminOrderController.class);
@Autowired
private AdminOrderService adminOrderService;
@Autowired
private ExpressService expressService;
/**
* 查询订单
Reported by PMD.
Line: 31
@Autowired
private AdminOrderService adminOrderService;
@Autowired
private ExpressService expressService;
/**
* 查询订单
*
* @param orderSn
Reported by PMD.
Line: 45
* @return
*/
@RequiresPermissions("admin:order:list")
@RequiresPermissionsDesc(menu = {"商场管理", "订单管理"}, button = "查询")
@GetMapping("/list")
public Object list(String nickname, String consignee, String orderSn,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime start,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime end,
@RequestParam(required = false) List<Short> orderStatusArray,
Reported by PMD.
Line: 45
* @return
*/
@RequiresPermissions("admin:order:list")
@RequiresPermissionsDesc(menu = {"商场管理", "订单管理"}, button = "查询")
@GetMapping("/list")
public Object list(String nickname, String consignee, String orderSn,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime start,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime end,
@RequestParam(required = false) List<Short> orderStatusArray,
Reported by PMD.
Line: 47
@RequiresPermissions("admin:order:list")
@RequiresPermissionsDesc(menu = {"商场管理", "订单管理"}, button = "查询")
@GetMapping("/list")
public Object list(String nickname, String consignee, String orderSn,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime start,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime end,
@RequestParam(required = false) List<Short> orderStatusArray,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
Reported by PMD.
Line: 47
@RequiresPermissions("admin:order:list")
@RequiresPermissionsDesc(menu = {"商场管理", "订单管理"}, button = "查询")
@GetMapping("/list")
public Object list(String nickname, String consignee, String orderSn,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime start,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime end,
@RequestParam(required = false) List<Short> orderStatusArray,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
Reported by PMD.
Line: 9
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.litemall.admin.service.AdminOrderService;
import org.linlinjava.litemall.core.express.ExpressService;
import org.linlinjava.litemall.core.notify.NotifyService;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
Reported by PMD.
Line: 16
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/task/TaskService.java
10 issues
Line: 10
@Component
public class TaskService {
private TaskService taskService;
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Reported by PMD.
Line: 10
@Component
public class TaskService {
private TaskService taskService;
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Reported by PMD.
Line: 10
@Component
public class TaskService {
private TaskService taskService;
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Reported by PMD.
Line: 10
@Component
public class TaskService {
private TaskService taskService;
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Reported by PMD.
Line: 11
@Component
public class TaskService {
private TaskService taskService;
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Reported by PMD.
Line: 11
@Component
public class TaskService {
private TaskService taskService;
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Reported by PMD.
Line: 14
private DelayQueue<Task> delayQueue = new DelayQueue<Task>();
@PostConstruct
private void init() {
taskService = this;
Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override
public void run() {
Reported by PMD.
Line: 23
while (true) {
try {
Task task = delayQueue.take();
task.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Reported by PMD.
Line: 24
try {
Task task = delayQueue.take();
task.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
Reported by PMD.
Line: 25
Task task = delayQueue.take();
task.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/dto/GoodsAllinone.java
10 issues
Line: 8
import org.linlinjava.litemall.db.domain.LitemallGoodsProduct;
import org.linlinjava.litemall.db.domain.LitemallGoodsSpecification;
public class GoodsAllinone {
LitemallGoods goods;
LitemallGoodsSpecification[] specifications;
LitemallGoodsAttribute[] attributes;
LitemallGoodsProduct[] products;
Reported by PMD.
Line: 23
}
public LitemallGoodsProduct[] getProducts() {
return products;
}
public void setProducts(LitemallGoodsProduct[] products) {
this.products = products;
}
Reported by PMD.
Line: 26
return products;
}
public void setProducts(LitemallGoodsProduct[] products) {
this.products = products;
}
public LitemallGoodsSpecification[] getSpecifications() {
return specifications;
Reported by PMD.
Line: 31
}
public LitemallGoodsSpecification[] getSpecifications() {
return specifications;
}
public void setSpecifications(LitemallGoodsSpecification[] specifications) {
this.specifications = specifications;
}
Reported by PMD.
Line: 34
return specifications;
}
public void setSpecifications(LitemallGoodsSpecification[] specifications) {
this.specifications = specifications;
}
public LitemallGoodsAttribute[] getAttributes() {
return attributes;
Reported by PMD.
Line: 39
}
public LitemallGoodsAttribute[] getAttributes() {
return attributes;
}
public void setAttributes(LitemallGoodsAttribute[] attributes) {
this.attributes = attributes;
}
Reported by PMD.
Line: 42
return attributes;
}
public void setAttributes(LitemallGoodsAttribute[] attributes) {
this.attributes = attributes;
}
}
Reported by PMD.
Line: 26
return products;
}
public void setProducts(LitemallGoodsProduct[] products) {
this.products = products;
}
public LitemallGoodsSpecification[] getSpecifications() {
return specifications;
Reported by PMD.
Line: 34
return specifications;
}
public void setSpecifications(LitemallGoodsSpecification[] specifications) {
this.specifications = specifications;
}
public LitemallGoodsAttribute[] getAttributes() {
return attributes;
Reported by PMD.
Line: 42
return attributes;
}
public void setAttributes(LitemallGoodsAttribute[] attributes) {
this.attributes = attributes;
}
}
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/task/TaskStartupRunner.java
9 issues
Line: 22
public class TaskStartupRunner implements ApplicationRunner {
@Autowired
private LitemallOrderService orderService;
@Autowired
private TaskService taskService;
@Override
public void run(ApplicationArguments args) throws Exception {
Reported by PMD.
Line: 24
@Autowired
private LitemallOrderService orderService;
@Autowired
private TaskService taskService;
@Override
public void run(ApplicationArguments args) throws Exception {
List<LitemallOrder> orderList = orderService.queryUnpaid(SystemConfig.getOrderUnpaid());
for(LitemallOrder order : orderList){
Reported by PMD.
Line: 32
for(LitemallOrder order : orderList){
LocalDateTime add = order.getAddTime();
LocalDateTime now = LocalDateTime.now();
LocalDateTime expire = add.plusMinutes(SystemConfig.getOrderUnpaid());
if(expire.isBefore(now)) {
// 已经过期,则加入延迟队列
taskService.addTask(new OrderUnpaidTask(order.getId(), 0));
}
else{
Reported by PMD.
Line: 33
LocalDateTime add = order.getAddTime();
LocalDateTime now = LocalDateTime.now();
LocalDateTime expire = add.plusMinutes(SystemConfig.getOrderUnpaid());
if(expire.isBefore(now)) {
// 已经过期,则加入延迟队列
taskService.addTask(new OrderUnpaidTask(order.getId(), 0));
}
else{
// 还没过期,则加入延迟队列
Reported by PMD.
Line: 35
LocalDateTime expire = add.plusMinutes(SystemConfig.getOrderUnpaid());
if(expire.isBefore(now)) {
// 已经过期,则加入延迟队列
taskService.addTask(new OrderUnpaidTask(order.getId(), 0));
}
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new OrderUnpaidTask(order.getId(), delay));
Reported by PMD.
Line: 39
}
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new OrderUnpaidTask(order.getId(), delay));
}
}
}
}
Reported by PMD.
Line: 40
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new OrderUnpaidTask(order.getId(), delay));
}
}
}
}
Reported by PMD.
Line: 3
package org.linlinjava.litemall.wx.task;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.litemall.core.system.SystemConfig;
import org.linlinjava.litemall.core.task.TaskService;
import org.linlinjava.litemall.db.domain.LitemallOrder;
import org.linlinjava.litemall.db.service.LitemallOrderService;
import org.springframework.beans.factory.annotation.Autowired;
Reported by PMD.
Line: 4
package org.linlinjava.litemall.wx.task;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.litemall.core.system.SystemConfig;
import org.linlinjava.litemall.core.task.TaskService;
import org.linlinjava.litemall.db.domain.LitemallOrder;
import org.linlinjava.litemall.db.service.LitemallOrderService;
import org.springframework.beans.factory.annotation.Autowired;
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/CaptchaCodeManager.java
9 issues
Line: 13
/**
* 缓存系统中的验证码
*/
public class CaptchaCodeManager {
private static ConcurrentHashMap<String, CaptchaItem> captchaCodeCache = new ConcurrentHashMap<>();
/**
* 添加到缓存
*
Reported by PMD.
Line: 27
//已经发过验证码且验证码还未过期
if (captchaCodeCache.get(phoneNumber) != null) {
if (captchaCodeCache.get(phoneNumber).getExpireTime().isAfter(LocalDateTime.now())) {
return false;
} else {
//存在但是已过期,删掉
captchaCodeCache.remove(phoneNumber);
}
Reported by PMD.
Line: 27
//已经发过验证码且验证码还未过期
if (captchaCodeCache.get(phoneNumber) != null) {
if (captchaCodeCache.get(phoneNumber).getExpireTime().isAfter(LocalDateTime.now())) {
return false;
} else {
//存在但是已过期,删掉
captchaCodeCache.remove(phoneNumber);
}
Reported by PMD.
Line: 39
captchaItem.setPhoneNumber(phoneNumber);
captchaItem.setCode(code);
// 有效期为1分钟
captchaItem.setExpireTime(LocalDateTime.now().plusMinutes(1));
captchaCodeCache.put(phoneNumber, captchaItem);
return true;
}
Reported by PMD.
Line: 58
return null;
//有电话记录但是已经过期
if (captchaCodeCache.get(phoneNumber).getExpireTime().isBefore(LocalDateTime.now())) {
return null;
}
return captchaCodeCache.get(phoneNumber).getCode();
}
Reported by PMD.
Line: 58
return null;
//有电话记录但是已经过期
if (captchaCodeCache.get(phoneNumber).getExpireTime().isBefore(LocalDateTime.now())) {
return null;
}
return captchaCodeCache.get(phoneNumber).getCode();
}
Reported by PMD.
Line: 62
return null;
}
return captchaCodeCache.get(phoneNumber).getCode();
}
}
Reported by PMD.
Line: 6
import org.linlinjava.litemall.wx.dto.CaptchaItem;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 缓存系统中的验证码
Reported by PMD.
Line: 7
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 缓存系统中的验证码
*/
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallRoleService.java
9 issues
Line: 19
@Service
public class LitemallRoleService {
@Resource
private LitemallRoleMapper roleMapper;
public Set<String> queryByIds(Integer[] roleIds) {
Set<String> roles = new HashSet<String>();
if(roleIds.length == 0){
Reported by PMD.
Line: 29
}
LitemallRoleExample example = new LitemallRoleExample();
example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
List<LitemallRole> roleList = roleMapper.selectByExample(example);
for(LitemallRole role : roleList){
roles.add(role.getName());
}
Reported by PMD.
Line: 29
}
LitemallRoleExample example = new LitemallRoleExample();
example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
List<LitemallRole> roleList = roleMapper.selectByExample(example);
for(LitemallRole role : roleList){
roles.add(role.getName());
}
Reported by PMD.
Line: 29
}
LitemallRoleExample example = new LitemallRoleExample();
example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
List<LitemallRole> roleList = roleMapper.selectByExample(example);
for(LitemallRole role : roleList){
roles.add(role.getName());
}
Reported by PMD.
Line: 47
if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%");
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
Reported by PMD.
Line: 78
public boolean checkExist(String name) {
LitemallRoleExample example = new LitemallRoleExample();
example.or().andNameEqualTo(name).andDeletedEqualTo(false);
return roleMapper.countByExample(example) != 0;
}
public List<LitemallRole> queryAll() {
LitemallRoleExample example = new LitemallRoleExample();
Reported by PMD.
Line: 78
public boolean checkExist(String name) {
LitemallRoleExample example = new LitemallRoleExample();
example.or().andNameEqualTo(name).andDeletedEqualTo(false);
return roleMapper.countByExample(example) != 0;
}
public List<LitemallRole> queryAll() {
LitemallRoleExample example = new LitemallRoleExample();
Reported by PMD.
Line: 84
public List<LitemallRole> queryAll() {
LitemallRoleExample example = new LitemallRoleExample();
example.or().andDeletedEqualTo(false);
return roleMapper.selectByExample(example);
}
}
Reported by PMD.
Line: 22
private LitemallRoleMapper roleMapper;
public Set<String> queryByIds(Integer[] roleIds) {
Set<String> roles = new HashSet<String>();
if(roleIds.length == 0){
return roles;
}
Reported by PMD.