The following issues were found

litemall-admin-api/src/test/java/org/linlinjava/litemall/admin/BcryptTest.java
3 issues
System.out.println is used
Design

Line: 21

                      BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        encodedPassword = bCryptPasswordEncoder.encode(rawPassword);

        System.out.println("rawPassword=" + rawPassword + " encodedPassword=" + encodedPassword);

        Assert.assertTrue(bCryptPasswordEncoder.matches(rawPassword, encodedPassword));
    }
}

            

Reported by PMD.

The initializer for variable 'encodedPassword' is never used (overwritten on line 19)
Design

Line: 17

                  @Test
    public void test() {
        String rawPassword = "aaaaaa";
        String encodedPassword = "";
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        encodedPassword = bCryptPasswordEncoder.encode(rawPassword);

        System.out.println("rawPassword=" + rawPassword + " encodedPassword=" + encodedPassword);


            

Reported by PMD.

Found 'DD'-anomaly for variable 'encodedPassword' (lines '17'-'19').
Error

Line: 17

                  @Test
    public void test() {
        String rawPassword = "aaaaaa";
        String encodedPassword = "";
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        encodedPassword = bCryptPasswordEncoder.encode(rawPassword);

        System.out.println("rawPassword=" + rawPassword + " encodedPassword=" + encodedPassword);


            

Reported by PMD.

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

Line: 18

              @Service
public class LitemallLogService {
    @Resource
    private LitemallLogMapper logMapper;

    public void deleteById(Integer id) {
        logMapper.logicalDeleteByPrimaryKey(id);
    }


            

Reported by PMD.

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

Line: 37

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

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


            

Reported by PMD.

Avoid unused imports such as 'org.linlinjava.litemall.db.domain.LitemallAd'
Design

Line: 5

              
import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallLogMapper;
import org.linlinjava.litemall.db.domain.LitemallAd;
import org.linlinjava.litemall.db.domain.LitemallLog;
import org.linlinjava.litemall.db.domain.LitemallLogExample;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;


            

Reported by PMD.

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

Line: 15

               * 腾讯云短信服务
 */
public class TencentSmsSender implements SmsSender {
    private final Log logger = LogFactory.getLog(TencentSmsSender.class);

    private SmsSingleSender sender;
    private String sign;

    public SmsSingleSender getSender() {

            

Reported by PMD.

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

Line: 15

               * 腾讯云短信服务
 */
public class TencentSmsSender implements SmsSender {
    private final Log logger = LogFactory.getLog(TencentSmsSender.class);

    private SmsSingleSender sender;
    private String sign;

    public SmsSingleSender getSender() {

            

Reported by PMD.

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

Line: 18

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

    private SmsSingleSender sender;
    private String sign;

    public SmsSingleSender getSender() {
        return sender;
    }


            

Reported by PMD.

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

Line: 20

              public class AsyncTest {

    @Autowired
    AsyncTask task;

    @Test
    public void test() {
        task.asyncMethod();
        task.nonasyncMethod();

            

Reported by PMD.

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

Line: 23

                  AsyncTask task;

    @Test
    public void test() {
        task.asyncMethod();
        task.nonasyncMethod();
    }
}

            

Reported by PMD.

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

Line: 7

              import org.junit.runner.RunWith;
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;

/**
 * 异步测试

            

Reported by PMD.

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

Line: 8

              import java.util.List;
import java.util.Map;

public class StatVo {
    private String[] columns = new String[0];
    private List<Map> rows = new ArrayList<>();

    public String[] getColumns() {
        return columns;

            

Reported by PMD.

The user-supplied array 'columns' is stored directly.
Design

Line: 16

                      return columns;
    }

    public void setColumns(String[] columns) {
        this.columns = columns;
    }

    public List<Map> getRows() {
        return rows;

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 16

                      return columns;
    }

    public void setColumns(String[] columns) {
        this.columns = columns;
    }

    public List<Map> getRows() {
        return rows;

            

Reported by PMD.

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

Line: 24

              @RequestMapping("/wx/user")
@Validated
public class WxUserController {
    private final Log logger = LogFactory.getLog(WxUserController.class);

    @Autowired
    private LitemallOrderService orderService;

    /**

            

Reported by PMD.

Avoid unused private fields such as 'logger'.
Design

Line: 24

              @RequestMapping("/wx/user")
@Validated
public class WxUserController {
    private final Log logger = LogFactory.getLog(WxUserController.class);

    @Autowired
    private LitemallOrderService orderService;

    /**

            

Reported by PMD.

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

Line: 27

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

    @Autowired
    private LitemallOrderService orderService;

    /**
     * 用户个人页面数据
     * <p>
     * 目前是用户订单统计信息

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/service/LogHelper.java
3 issues
This class has too many methods, consider refactoring it.
Design

Line: 26

               * 当然可能很多操作是不需要记录到数据库的,例如编辑商品、编辑广告品之类。
 */
@Component
public class LogHelper {
    public static final  Integer LOG_TYPE_GENERAL = 0;
    public static final  Integer LOG_TYPE_AUTH = 1;
    public static final  Integer LOG_TYPE_ORDER = 2;
    public static final  Integer LOG_TYPE_OTHER = 3;


            

Reported by PMD.

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

Line: 33

                  public static final  Integer LOG_TYPE_OTHER = 3;

    @Autowired
    private LitemallLogService logService;

    public void logGeneralSucceed(String action) {
        logAdmin(LOG_TYPE_GENERAL, action, true, "", "");
    }


            

Reported by PMD.

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

Line: 91

                      if (currentUser != null) {
            LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal();
            if (admin != null) {
                log.setAdmin(admin.getUsername());
            } else {
                log.setAdmin("匿名用户");
            }
        } else {
            log.setAdmin("匿名用户");

            

Reported by PMD.

litemall-db/src/main/java/org/linlinjava/litemall/db/dao/LitemallSearchHistoryMapper.java
2 issues
This class has too many methods, consider refactoring it.
Design

Line: 8

              import org.linlinjava.litemall.db.domain.LitemallSearchHistory;
import org.linlinjava.litemall.db.domain.LitemallSearchHistoryExample;

public interface LitemallSearchHistoryMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_search_history
     *
     * @mbg.generated

            

Reported by PMD.

The String literal 'example' appears 5 times in this file; the first occurrence is on line 63
Error

Line: 63

                   *
     * @mbg.generated
     */
    LitemallSearchHistory selectOneByExampleSelective(@Param("example") LitemallSearchHistoryExample example, @Param("selective") LitemallSearchHistory.Column ... selective);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_search_history
     *

            

Reported by PMD.

litemall-db/src/main/java/org/linlinjava/litemall/db/dao/LitemallRegionMapper.java
2 issues
This class has too many methods, consider refactoring it.
Design

Line: 8

              import org.linlinjava.litemall.db.domain.LitemallRegion;
import org.linlinjava.litemall.db.domain.LitemallRegionExample;

public interface LitemallRegionMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_region
     *
     * @mbg.generated

            

Reported by PMD.

The String literal 'example' appears 4 times in this file; the first occurrence is on line 63
Error

Line: 63

                   *
     * @mbg.generated
     */
    LitemallRegion selectOneByExampleSelective(@Param("example") LitemallRegionExample example, @Param("selective") LitemallRegion.Column ... selective);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_region
     *

            

Reported by PMD.

litemall-db/src/main/java/org/linlinjava/litemall/db/dao/LitemallPermissionMapper.java
2 issues
This class has too many methods, consider refactoring it.
Design

Line: 8

              import org.linlinjava.litemall.db.domain.LitemallPermission;
import org.linlinjava.litemall.db.domain.LitemallPermissionExample;

public interface LitemallPermissionMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_permission
     *
     * @mbg.generated

            

Reported by PMD.

The String literal 'example' appears 5 times in this file; the first occurrence is on line 63
Error

Line: 63

                   *
     * @mbg.generated
     */
    LitemallPermission selectOneByExampleSelective(@Param("example") LitemallPermissionExample example, @Param("selective") LitemallPermission.Column ... selective);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_permission
     *

            

Reported by PMD.