The following issues were found

litemall-db/src/test/java/org/linlinjava/litemall/db/StockTest.java
4 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 17

              @SpringBootTest
public class StockTest {
    @Autowired
    private GoodsProductMapper goodsProductMapper;

    @Test
    public void testReduceStock() {
        Integer id = 1;
        Short num = 10;

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 20

                  private GoodsProductMapper goodsProductMapper;

    @Test
    public void testReduceStock() {
        Integer id = 1;
        Short num = 10;
        goodsProductMapper.reduceStock(id, num);
    }


            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 27

                  }

    @Test
    public void testAddStock() {
        Integer id = 1;
        Short num = 10;
        goodsProductMapper.addStock(id, num);
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.springframework.test.context.junit4.SpringJUnit4ClassRunner'
Design

Line: 8

              import org.linlinjava.litemall.db.dao.GoodsProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

@WebAppConfiguration
@RunWith(SpringRunner.class)

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAddressController.java
4 issues
Logger should be defined private static final and have the correct class
Error

Line: 26

              @RequestMapping("/admin/address")
@Validated
public class AdminAddressController {
    private final Log logger = LogFactory.getLog(AdminAddressController.class);

    @Autowired
    private LitemallAddressService addressService;
    @Autowired
    private LitemallRegionService regionService;

            

Reported by PMD.

Avoid unused private fields such as 'logger'.
Design

Line: 26

              @RequestMapping("/admin/address")
@Validated
public class AdminAddressController {
    private final Log logger = LogFactory.getLog(AdminAddressController.class);

    @Autowired
    private LitemallAddressService addressService;
    @Autowired
    private LitemallRegionService regionService;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 29

                  private final Log logger = LogFactory.getLog(AdminAddressController.class);

    @Autowired
    private LitemallAddressService addressService;
    @Autowired
    private LitemallRegionService regionService;

    @RequiresPermissions("admin:address:list")
    @RequiresPermissionsDesc(menu = {"用户管理", "收货地址"}, button = "查询")

            

Reported by PMD.

Avoid unused private fields such as 'regionService'.
Design

Line: 31

                  @Autowired
    private LitemallAddressService addressService;
    @Autowired
    private LitemallRegionService regionService;

    @RequiresPermissions("admin:address:list")
    @RequiresPermissionsDesc(menu = {"用户管理", "收货地址"}, button = "查询")
    @GetMapping("/list")
    public Object list(Integer userId, String name,

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/job/CouponJob.java
4 issues
Logger should be defined private static final and have the correct class
Error

Line: 22

               */
@Component
public class CouponJob {
    private final Log logger = LogFactory.getLog(CouponJob.class);

    @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 22

               */
@Component
public class CouponJob {
    private final Log logger = LogFactory.getLog(CouponJob.class);

    @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 25

                  private final Log logger = LogFactory.getLog(CouponJob.class);

    @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

    /**
     * 每隔一个小时检查

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 27

                  @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

    /**
     * 每隔一个小时检查
     * TODO
     * 注意,因为是相隔一个小时检查,因此导致优惠券真正超时时间可能比设定时间延迟1个小时

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/vo/CatVo.java
4 issues
The class 'CatVo' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=6, WMC=6)
Design

Line: 5

              
import java.util.List;

public class CatVo {
    private Integer value = null;
    private String label = null;
    private List children = null;

    public Integer getValue() {

            

Reported by PMD.

Avoid using redundant field initializer for 'value'
Performance

Line: 6

              import java.util.List;

public class CatVo {
    private Integer value = null;
    private String label = null;
    private List children = null;

    public Integer getValue() {
        return value;

            

Reported by PMD.

Avoid using redundant field initializer for 'label'
Performance

Line: 7

              
public class CatVo {
    private Integer value = null;
    private String label = null;
    private List children = null;

    public Integer getValue() {
        return value;
    }

            

Reported by PMD.

Avoid using redundant field initializer for 'children'
Performance

Line: 8

              public class CatVo {
    private Integer value = null;
    private String label = null;
    private List children = null;

    public Integer getValue() {
        return value;
    }


            

Reported by PMD.

litemall-core/src/test/java/org/linlinjava/litemall/core/MailTest.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 35

              public class MailTest {

    @Autowired
    private NotifyService notifyService;

    @Test
    public void testMail() {
        notifyService.notifyMail("订单信息", "订单1111111已付款,请发货");
    }

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 38

                  private NotifyService notifyService;

    @Test
    public void testMail() {
        notifyService.notifyMail("订单信息", "订单1111111已付款,请发货");
    }

    @Configuration
    @Import(Application.class)

            

Reported by PMD.

Avoid unused imports such as 'org.springframework.test.context.junit4.SpringJUnit4ClassRunner'
Design

Line: 13

              import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.concurrent.Executor;


            

Reported by PMD.

litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/UserInfoService.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 13

              @Service
public class UserInfoService {
    @Autowired
    private LitemallUserService userService;


    public UserInfo getInfo(Integer userId) {
        LitemallUser user = userService.findById(userId);
        Assert.state(user != null, "用户不存在");

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 20

                      LitemallUser user = userService.findById(userId);
        Assert.state(user != null, "用户不存在");
        UserInfo userInfo = new UserInfo();
        userInfo.setNickName(user.getNickname());
        userInfo.setAvatarUrl(user.getAvatar());
        return userInfo;
    }
}

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 21

                      Assert.state(user != null, "用户不存在");
        UserInfo userInfo = new UserInfo();
        userInfo.setNickName(user.getNickname());
        userInfo.setAvatarUrl(user.getAvatar());
        return userInfo;
    }
}

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminFeedbackController.java
3 issues
Avoid unused private fields such as 'logger'.
Design

Line: 29

              @RequestMapping("/admin/feedback")
@Validated
public class AdminFeedbackController {
    private final Log logger = LogFactory.getLog(AdminFeedbackController.class);

    @Autowired
    private LitemallFeedbackService feedbackService;

    @RequiresPermissions("admin:feedback:list")

            

Reported by PMD.

Logger should be defined private static final and have the correct class
Error

Line: 29

              @RequestMapping("/admin/feedback")
@Validated
public class AdminFeedbackController {
    private final Log logger = LogFactory.getLog(AdminFeedbackController.class);

    @Autowired
    private LitemallFeedbackService feedbackService;

    @RequiresPermissions("admin:feedback:list")

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 32

                  private final Log logger = LogFactory.getLog(AdminFeedbackController.class);

    @Autowired
    private LitemallFeedbackService feedbackService;

    @RequiresPermissions("admin:feedback:list")
    @RequiresPermissionsDesc(menu = {"用户管理", "意见反馈"}, button = "查询")
    @GetMapping("/list")
    public Object list(Integer userId, String username,

            

Reported by PMD.

litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallAdService.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 17

              @Service
public class LitemallAdService {
    @Resource
    private LitemallAdMapper adMapper;

    public List<LitemallAd> queryIndex() {
        LitemallAdExample example = new LitemallAdExample();
        example.or().andPositionEqualTo((byte) 1).andDeletedEqualTo(false).andEnabledEqualTo(true);
        return adMapper.selectByExample(example);

            

Reported by PMD.

Rather than using a lot of String arguments, consider using a container object for those values.
Design

Line: 25

                      return adMapper.selectByExample(example);
    }

    public List<LitemallAd> querySelective(String name, String content, Integer page, Integer limit, String sort, String order) {
        LitemallAdExample example = new LitemallAdExample();
        LitemallAdExample.Criteria criteria = example.createCriteria();

        if (!StringUtils.isEmpty(name)) {
            criteria.andNameLike("%" + name + "%");

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 35

                      if (!StringUtils.isEmpty(content)) {
            criteria.andContentLike("%" + content + "%");
        }
        criteria.andDeletedEqualTo(false);

        if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
            example.setOrderByClause(sort + " " + order);
        }


            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminLogController.java
3 issues
Avoid unused private fields such as 'logger'.
Design

Line: 25

              @RequestMapping("/admin/log")
@Validated
public class AdminLogController {
    private final Log logger = LogFactory.getLog(AdminLogController.class);

    @Autowired
    private LitemallLogService logService;

    @RequiresPermissions("admin:log:list")

            

Reported by PMD.

Logger should be defined private static final and have the correct class
Error

Line: 25

              @RequestMapping("/admin/log")
@Validated
public class AdminLogController {
    private final Log logger = LogFactory.getLog(AdminLogController.class);

    @Autowired
    private LitemallLogService logService;

    @RequiresPermissions("admin:log:list")

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 28

                  private final Log logger = LogFactory.getLog(AdminLogController.class);

    @Autowired
    private LitemallLogService logService;

    @RequiresPermissions("admin:log:list")
    @RequiresPermissionsDesc(menu = {"系统管理", "操作日志"}, button = "查询")
    @GetMapping("/list")
    public Object list(String name,

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminStatController.java
3 issues
Logger should be defined private static final and have the correct class
Error

Line: 23

              @RequestMapping("/admin/stat")
@Validated
public class AdminStatController {
    private final Log logger = LogFactory.getLog(AdminStatController.class);

    @Autowired
    private StatService statService;

    @RequiresPermissions("admin:stat:user")

            

Reported by PMD.

Avoid unused private fields such as 'logger'.
Design

Line: 23

              @RequestMapping("/admin/stat")
@Validated
public class AdminStatController {
    private final Log logger = LogFactory.getLog(AdminStatController.class);

    @Autowired
    private StatService statService;

    @RequiresPermissions("admin:stat:user")

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 26

                  private final Log logger = LogFactory.getLog(AdminStatController.class);

    @Autowired
    private StatService statService;

    @RequiresPermissions("admin:stat:user")
    @RequiresPermissionsDesc(menu = {"统计管理", "用户统计"}, button = "查询")
    @GetMapping("/user")
    public Object statUser() {

            

Reported by PMD.