The following issues were found
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallRegion.java
29 issues
Line: 6
import java.util.ArrayList;
import java.util.Arrays;
public class LitemallRegion {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_region.id
*
Reported by PMD.
Line: 180
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
Reported by PMD.
Line: 181
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
Reported by PMD.
Line: 181
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
Reported by PMD.
Line: 182
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
Reported by PMD.
Line: 182
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
Reported by PMD.
Line: 183
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
sb.append(", code=").append(code);
Reported by PMD.
Line: 184
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
sb.append(", code=").append(code);
sb.append("]");
Reported by PMD.
Line: 185
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
sb.append(", code=").append(code);
sb.append("]");
return sb.toString();
Reported by PMD.
Line: 186
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", pid=").append(pid);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
sb.append(", code=").append(code);
sb.append("]");
return sb.toString();
}
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/config/StorageAutoConfiguration.java
29 issues
Line: 32
} else if (active.equals("qiniu")) {
storageService.setStorage(qiniuStorage());
} else {
throw new RuntimeException("当前存储模式 " + active + " 不支持");
}
return storageService;
}
Reported by PMD.
Line: 12
@EnableConfigurationProperties(StorageProperties.class)
public class StorageAutoConfiguration {
private final StorageProperties properties;
public StorageAutoConfiguration(StorageProperties properties) {
this.properties = properties;
}
Reported by PMD.
Line: 23
StorageService storageService = new StorageService();
String active = this.properties.getActive();
storageService.setActive(active);
if (active.equals("local")) {
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
Reported by PMD.
Line: 23
StorageService storageService = new StorageService();
String active = this.properties.getActive();
storageService.setActive(active);
if (active.equals("local")) {
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
Reported by PMD.
Line: 23
StorageService storageService = new StorageService();
String active = this.properties.getActive();
storageService.setActive(active);
if (active.equals("local")) {
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
Reported by PMD.
Line: 25
storageService.setActive(active);
if (active.equals("local")) {
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
} else if (active.equals("qiniu")) {
storageService.setStorage(qiniuStorage());
Reported by PMD.
Line: 25
storageService.setActive(active);
if (active.equals("local")) {
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
} else if (active.equals("qiniu")) {
storageService.setStorage(qiniuStorage());
Reported by PMD.
Line: 25
storageService.setActive(active);
if (active.equals("local")) {
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
} else if (active.equals("qiniu")) {
storageService.setStorage(qiniuStorage());
Reported by PMD.
Line: 27
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
} else if (active.equals("qiniu")) {
storageService.setStorage(qiniuStorage());
} else {
throw new RuntimeException("当前存储模式 " + active + " 不支持");
Reported by PMD.
Line: 27
storageService.setStorage(localStorage());
} else if (active.equals("aliyun")) {
storageService.setStorage(aliyunStorage());
} else if (active.equals("tencent")) {
storageService.setStorage(tencentStorage());
} else if (active.equals("qiniu")) {
storageService.setStorage(qiniuStorage());
} else {
throw new RuntimeException("当前存储模式 " + active + " 不支持");
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallAftersaleService.java
26 issues
Line: 18
import java.util.Random;
@Service
public class LitemallAftersaleService {
@Resource
private LitemallAftersaleMapper aftersaleMapper;
public LitemallAftersale findById(Integer id) {
return aftersaleMapper.selectByPrimaryKey(id);
Reported by PMD.
Line: 20
@Service
public class LitemallAftersaleService {
@Resource
private LitemallAftersaleMapper aftersaleMapper;
public LitemallAftersale findById(Integer id) {
return aftersaleMapper.selectByPrimaryKey(id);
}
Reported by PMD.
Line: 28
public LitemallAftersale findById(Integer userId, Integer id) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
example.or().andIdEqualTo(id).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return aftersaleMapper.selectOneByExample(example);
}
public List<LitemallAftersale> queryList(Integer userId, Short status, Integer page, Integer limit, String sort, String order) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
Reported by PMD.
Line: 28
public LitemallAftersale findById(Integer userId, Integer id) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
example.or().andIdEqualTo(id).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return aftersaleMapper.selectOneByExample(example);
}
public List<LitemallAftersale> queryList(Integer userId, Short status, Integer page, Integer limit, String sort, String order) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
Reported by PMD.
Line: 28
public LitemallAftersale findById(Integer userId, Integer id) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
example.or().andIdEqualTo(id).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return aftersaleMapper.selectOneByExample(example);
}
public List<LitemallAftersale> queryList(Integer userId, Short status, Integer page, Integer limit, String sort, String order) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
Reported by PMD.
Line: 35
public List<LitemallAftersale> queryList(Integer userId, Short status, Integer page, Integer limit, String sort, String order) {
LitemallAftersaleExample example = new LitemallAftersaleExample();
LitemallAftersaleExample.Criteria criteria = example.or();
criteria.andUserIdEqualTo(userId);
if (status != null) {
criteria.andStatusEqualTo(status);
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
Reported by PMD.
Line: 39
if (status != null) {
criteria.andStatusEqualTo(status);
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
else{
example.setOrderByClause(LitemallAftersale.Column.addTime.desc());
Reported by PMD.
Line: 44
example.setOrderByClause(sort + " " + order);
}
else{
example.setOrderByClause(LitemallAftersale.Column.addTime.desc());
}
PageHelper.startPage(page, limit);
return aftersaleMapper.selectByExample(example);
}
Reported by PMD.
Line: 63
if (status != null) {
criteria.andStatusEqualTo(status);
}
criteria.andDeletedEqualTo(false);
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
else{
example.setOrderByClause(LitemallAftersale.Column.addTime.desc());
Reported by PMD.
Line: 68
example.setOrderByClause(sort + " " + order);
}
else{
example.setOrderByClause(LitemallAftersale.Column.addTime.desc());
}
PageHelper.startPage(page, limit);
return aftersaleMapper.selectByExample(example);
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCartService.java
26 issues
Line: 16
import java.util.List;
@Service
public class LitemallCartService {
@Resource
private LitemallCartMapper cartMapper;
public LitemallCart queryExist(Integer goodsId, Integer productId, Integer userId) {
LitemallCartExample example = new LitemallCartExample();
Reported by PMD.
Line: 18
@Service
public class LitemallCartService {
@Resource
private LitemallCartMapper cartMapper;
public LitemallCart queryExist(Integer goodsId, Integer productId, Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andGoodsIdEqualTo(goodsId).andProductIdEqualTo(productId).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectOneByExample(example);
Reported by PMD.
Line: 22
public LitemallCart queryExist(Integer goodsId, Integer productId, Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andGoodsIdEqualTo(goodsId).andProductIdEqualTo(productId).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectOneByExample(example);
}
public void add(LitemallCart cart) {
cart.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 22
public LitemallCart queryExist(Integer goodsId, Integer productId, Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andGoodsIdEqualTo(goodsId).andProductIdEqualTo(productId).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectOneByExample(example);
}
public void add(LitemallCart cart) {
cart.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 22
public LitemallCart queryExist(Integer goodsId, Integer productId, Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andGoodsIdEqualTo(goodsId).andProductIdEqualTo(productId).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectOneByExample(example);
}
public void add(LitemallCart cart) {
cart.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 22
public LitemallCart queryExist(Integer goodsId, Integer productId, Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andGoodsIdEqualTo(goodsId).andProductIdEqualTo(productId).andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectOneByExample(example);
}
public void add(LitemallCart cart) {
cart.setAddTime(LocalDateTime.now());
Reported by PMD.
Line: 39
public List<LitemallCart> queryByUid(int userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectByExample(example);
}
public List<LitemallCart> queryByUidAndChecked(Integer userId) {
Reported by PMD.
Line: 39
public List<LitemallCart> queryByUid(int userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
return cartMapper.selectByExample(example);
}
public List<LitemallCart> queryByUidAndChecked(Integer userId) {
Reported by PMD.
Line: 46
public List<LitemallCart> queryByUidAndChecked(Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andUserIdEqualTo(userId).andCheckedEqualTo(true).andDeletedEqualTo(false);
return cartMapper.selectByExample(example);
}
public int delete(List<Integer> productIdList, int userId) {
LitemallCartExample example = new LitemallCartExample();
Reported by PMD.
Line: 46
public List<LitemallCart> queryByUidAndChecked(Integer userId) {
LitemallCartExample example = new LitemallCartExample();
example.or().andUserIdEqualTo(userId).andCheckedEqualTo(true).andDeletedEqualTo(false);
return cartMapper.selectByExample(example);
}
public int delete(List<Integer> productIdList, int userId) {
LitemallCartExample example = new LitemallCartExample();
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/util/DbUtil.java
25 issues
Line: 17
Process child = rt.exec(command);
InputStream inputStream = child.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
}
outputStreamWriter.flush();
Reported by PMD.
Line: 37
String command = "mysql -u" + user + " -p" + password + " --default-character-set=utf8 " + db;
Process child = rt.exec(command);
OutputStream outputStream = child.getOutputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
}
Reported by PMD.
Line: 8
import java.text.SimpleDateFormat;
import java.util.Date;
public class DbUtil {
public static void backup(File file, String user, String password, String db) {
try {
Runtime rt = Runtime.getRuntime();
String command = "mysqldump -u" + user + " -p" + password + " --set-charset=utf8 " + db;
Reported by PMD.
Line: 14
try {
Runtime rt = Runtime.getRuntime();
String command = "mysqldump -u" + user + " -p" + password + " --set-charset=utf8 " + db;
Process child = rt.exec(command);
InputStream inputStream = child.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
Reported by PMD.
Line: 15
Runtime rt = Runtime.getRuntime();
String command = "mysqldump -u" + user + " -p" + password + " --set-charset=utf8 " + db;
Process child = rt.exec(command);
InputStream inputStream = child.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
Reported by PMD.
Line: 15
Runtime rt = Runtime.getRuntime();
String command = "mysqldump -u" + user + " -p" + password + " --set-charset=utf8 " + db;
Process child = rt.exec(command);
InputStream inputStream = child.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
Reported by PMD.
Line: 16
String command = "mysqldump -u" + user + " -p" + password + " --set-charset=utf8 " + db;
Process child = rt.exec(command);
InputStream inputStream = child.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
}
Reported by PMD.
Line: 17
Process child = rt.exec(command);
InputStream inputStream = child.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
}
outputStreamWriter.flush();
Reported by PMD.
Line: 19
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter( new FileOutputStream(file), StandardCharsets.UTF_8);
String str;
while ((str = bufferedReader.readLine()) != null) {
outputStreamWriter.write(str + "\r\n");
}
outputStreamWriter.flush();
inputStream.close();
bufferedReader.close();
Reported by PMD.
Line: 23
outputStreamWriter.write(str + "\r\n");
}
outputStreamWriter.flush();
inputStream.close();
bufferedReader.close();
outputStreamWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallCommentService.java
25 issues
Line: 35
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
PageHelper.startPage(offset, limit);
return commentMapper.selectByExample(example);
}
Reported by PMD.
Line: 48
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
return (int) commentMapper.countByExample(example);
}
public int save(LitemallComment comment) {
Reported by PMD.
Line: 17
@Service
public class LitemallCommentService {
@Resource
private LitemallCommentMapper commentMapper;
public List<LitemallComment> queryGoodsByGid(Integer id, int offset, int limit) {
LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc());
example.or().andValueIdEqualTo(id).andTypeEqualTo((byte) 0).andDeletedEqualTo(false);
Reported by PMD.
Line: 21
public List<LitemallComment> queryGoodsByGid(Integer id, int offset, int limit) {
LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc());
example.or().andValueIdEqualTo(id).andTypeEqualTo((byte) 0).andDeletedEqualTo(false);
PageHelper.startPage(offset, limit);
return commentMapper.selectByExample(example);
}
Reported by PMD.
Line: 29
public List<LitemallComment> query(Byte type, Integer valueId, Integer showType, Integer offset, Integer limit) {
LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc());
if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
Reported by PMD.
Line: 31
LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc());
if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
Reported by PMD.
Line: 31
LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc());
if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
Reported by PMD.
Line: 31
LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc());
if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
Reported by PMD.
Line: 32
example.setOrderByClause(LitemallComment.Column.addTime.desc());
if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
PageHelper.startPage(offset, limit);
Reported by PMD.
Line: 33
if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} else if (showType == 1) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} else {
throw new RuntimeException("showType不支持");
}
PageHelper.startPage(offset, limit);
return commentMapper.selectByExample(example);
Reported by PMD.
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminProfileController.java
24 issues
Line: 38
@RequestMapping("/admin/profile")
@Validated
public class AdminProfileController {
private final Log logger = LogFactory.getLog(AdminProfileController.class);
@Autowired
private LitemallAdminService adminService;
@Autowired
private LitemallNoticeService noticeService;
Reported by PMD.
Line: 38
@RequestMapping("/admin/profile")
@Validated
public class AdminProfileController {
private final Log logger = LogFactory.getLog(AdminProfileController.class);
@Autowired
private LitemallAdminService adminService;
@Autowired
private LitemallNoticeService noticeService;
Reported by PMD.
Line: 41
private final Log logger = LogFactory.getLog(AdminProfileController.class);
@Autowired
private LitemallAdminService adminService;
@Autowired
private LitemallNoticeService noticeService;
@Autowired
private LitemallNoticeAdminService noticeAdminService;
Reported by PMD.
Line: 43
@Autowired
private LitemallAdminService adminService;
@Autowired
private LitemallNoticeService noticeService;
@Autowired
private LitemallNoticeAdminService noticeAdminService;
@RequiresAuthentication
@PostMapping("/password")
Reported by PMD.
Line: 45
@Autowired
private LitemallNoticeService noticeService;
@Autowired
private LitemallNoticeAdminService noticeAdminService;
@RequiresAuthentication
@PostMapping("/password")
public Object create(@RequestBody String body) {
String oldPassword = JacksonUtil.parseString(body, "oldPassword");
Reported by PMD.
Line: 60
}
Subject currentUser = SecurityUtils.getSubject();
LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal();
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
if (!encoder.matches(oldPassword, admin.getPassword())) {
return ResponseUtil.fail(ADMIN_INVALID_ACCOUNT, "账号密码不对");
}
Reported by PMD.
Line: 63
LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal();
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
if (!encoder.matches(oldPassword, admin.getPassword())) {
return ResponseUtil.fail(ADMIN_INVALID_ACCOUNT, "账号密码不对");
}
String encodedNewPassword = encoder.encode(newPassword);
admin.setPassword(encodedNewPassword);
Reported by PMD.
Line: 68
}
String encodedNewPassword = encoder.encode(newPassword);
admin.setPassword(encodedNewPassword);
adminService.updateById(admin);
return ResponseUtil.ok();
}
Reported by PMD.
Line: 76
private Integer getAdminId(){
Subject currentUser = SecurityUtils.getSubject();
LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal();
return admin.getId();
}
@RequiresAuthentication
@GetMapping("/nnotice")
Reported by PMD.
Line: 77
private Integer getAdminId(){
Subject currentUser = SecurityUtils.getSubject();
LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal();
return admin.getId();
}
@RequiresAuthentication
@GetMapping("/nnotice")
public Object nNotice() {
Reported by PMD.
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAftersaleController.java
24 issues
Line: 37
@RequestMapping("/wx/aftersale")
@Validated
public class WxAftersaleController {
private final Log logger = LogFactory.getLog(WxAftersaleController.class);
@Autowired
private LitemallAftersaleService aftersaleService;
@Autowired
private LitemallOrderService orderService;
Reported by PMD.
Line: 37
@RequestMapping("/wx/aftersale")
@Validated
public class WxAftersaleController {
private final Log logger = LogFactory.getLog(WxAftersaleController.class);
@Autowired
private LitemallAftersaleService aftersaleService;
@Autowired
private LitemallOrderService orderService;
Reported by PMD.
Line: 40
private final Log logger = LogFactory.getLog(WxAftersaleController.class);
@Autowired
private LitemallAftersaleService aftersaleService;
@Autowired
private LitemallOrderService orderService;
@Autowired
private LitemallOrderGoodsService orderGoodsService;
Reported by PMD.
Line: 42
@Autowired
private LitemallAftersaleService aftersaleService;
@Autowired
private LitemallOrderService orderService;
@Autowired
private LitemallOrderGoodsService orderGoodsService;
/**
* 售后列表
Reported by PMD.
Line: 44
@Autowired
private LitemallOrderService orderService;
@Autowired
private LitemallOrderGoodsService orderGoodsService;
/**
* 售后列表
*
* @param userId 用户ID
Reported by PMD.
Line: 70
List<LitemallAftersale> aftersaleList = aftersaleService.queryList(userId, status, page, limit, sort, order);
List<Map<String, Object>> aftersaleVoList = new ArrayList<>(aftersaleList.size());
for (LitemallAftersale aftersale : aftersaleList) {
List<LitemallOrderGoods> orderGoodsList = orderGoodsService.queryByOid(aftersale.getOrderId());
Map<String, Object> aftersaleVo = new HashMap<>();
aftersaleVo.put("aftersale", aftersale);
Reported by PMD.
Line: 74
for (LitemallAftersale aftersale : aftersaleList) {
List<LitemallOrderGoods> orderGoodsList = orderGoodsService.queryByOid(aftersale.getOrderId());
Map<String, Object> aftersaleVo = new HashMap<>();
aftersaleVo.put("aftersale", aftersale);
aftersaleVo.put("goodsList", orderGoodsList);
aftersaleVoList.add(aftersaleVo);
}
Reported by PMD.
Line: 118
* @return 操作结果
*/
@PostMapping("submit")
public Object submit(@LoginUser Integer userId, @RequestBody LitemallAftersale aftersale) {
if (userId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(aftersale);
if (error != null) {
Reported by PMD.
Line: 118
* @return 操作结果
*/
@PostMapping("submit")
public Object submit(@LoginUser Integer userId, @RequestBody LitemallAftersale aftersale) {
if (userId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(aftersale);
if (error != null) {
Reported by PMD.
Line: 140
if(!OrderUtil.isConfirmStatus(order) && !OrderUtil.isAutoConfirmStatus(order)){
return ResponseUtil.fail(WxResponseCode.AFTERSALE_UNALLOWED, "不能申请售后");
}
BigDecimal amount = order.getActualPrice().subtract(order.getFreightPrice());
if(aftersale.getAmount().compareTo(amount) > 0){
return ResponseUtil.fail(WxResponseCode.AFTERSALE_INVALID_AMOUNT, "退款金额不正确");
}
Short afterStatus = order.getAftersaleStatus();
if(afterStatus.equals(AftersaleConstant.STATUS_RECEPT) || afterStatus.equals(AftersaleConstant.STATUS_REFUND)){
Reported by PMD.
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallTopicService.java
23 issues
Line: 19
@Service
public class LitemallTopicService {
@Resource
private LitemallTopicMapper topicMapper;
private Column[] columns = new Column[]{Column.id, Column.title, Column.subtitle, Column.price, Column.picUrl, Column.readCount};
public List<LitemallTopic> queryList(int offset, int limit) {
return queryList(offset, limit, "add_time", "desc");
}
Reported by PMD.
Line: 20
public class LitemallTopicService {
@Resource
private LitemallTopicMapper topicMapper;
private Column[] columns = new Column[]{Column.id, Column.title, Column.subtitle, Column.price, Column.picUrl, Column.readCount};
public List<LitemallTopic> queryList(int offset, int limit) {
return queryList(offset, limit, "add_time", "desc");
}
Reported by PMD.
Line: 20
public class LitemallTopicService {
@Resource
private LitemallTopicMapper topicMapper;
private Column[] columns = new Column[]{Column.id, Column.title, Column.subtitle, Column.price, Column.picUrl, Column.readCount};
public List<LitemallTopic> queryList(int offset, int limit) {
return queryList(offset, limit, "add_time", "desc");
}
Reported by PMD.
Line: 28
public List<LitemallTopic> queryList(int offset, int limit, String sort, String order) {
LitemallTopicExample example = new LitemallTopicExample();
example.or().andDeletedEqualTo(false);
example.setOrderByClause(sort + " " + order);
PageHelper.startPage(offset, limit);
return topicMapper.selectByExampleSelective(example, columns);
}
Reported by PMD.
Line: 36
public int queryTotal() {
LitemallTopicExample example = new LitemallTopicExample();
example.or().andDeletedEqualTo(false);
return (int) topicMapper.countByExample(example);
}
public LitemallTopic findById(Integer id) {
LitemallTopicExample example = new LitemallTopicExample();
Reported by PMD.
Line: 42
public LitemallTopic findById(Integer id) {
LitemallTopicExample example = new LitemallTopicExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
return topicMapper.selectOneByExampleWithBLOBs(example);
}
public List<LitemallTopic> queryRelatedList(Integer id, int offset, int limit) {
LitemallTopicExample example = new LitemallTopicExample();
Reported by PMD.
Line: 42
public LitemallTopic findById(Integer id) {
LitemallTopicExample example = new LitemallTopicExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
return topicMapper.selectOneByExampleWithBLOBs(example);
}
public List<LitemallTopic> queryRelatedList(Integer id, int offset, int limit) {
LitemallTopicExample example = new LitemallTopicExample();
Reported by PMD.
Line: 48
public List<LitemallTopic> queryRelatedList(Integer id, int offset, int limit) {
LitemallTopicExample example = new LitemallTopicExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
List<LitemallTopic> topics = topicMapper.selectByExample(example);
if (topics.size() == 0) {
return queryList(offset, limit, "add_time", "desc");
}
LitemallTopic topic = topics.get(0);
Reported by PMD.
Line: 48
public List<LitemallTopic> queryRelatedList(Integer id, int offset, int limit) {
LitemallTopicExample example = new LitemallTopicExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
List<LitemallTopic> topics = topicMapper.selectByExample(example);
if (topics.size() == 0) {
return queryList(offset, limit, "add_time", "desc");
}
LitemallTopic topic = topics.get(0);
Reported by PMD.
Line: 50
LitemallTopicExample example = new LitemallTopicExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
List<LitemallTopic> topics = topicMapper.selectByExample(example);
if (topics.size() == 0) {
return queryList(offset, limit, "add_time", "desc");
}
LitemallTopic topic = topics.get(0);
example = new LitemallTopicExample();
Reported by PMD.
litemall-core/src/main/java/org/linlinjava/litemall/core/util/HttpUtil.java
22 issues
Line: 19
*
* @return 远程资源的响应结果
*/
public class HttpUtil {
private static final Log logger = LogFactory.getLog(HttpUtil.class);
/**
* 向指定 URL 发送POST方法的请求
Reported by PMD.
Line: 19
*
* @return 远程资源的响应结果
*/
public class HttpUtil {
private static final Log logger = LogFactory.getLog(HttpUtil.class);
/**
* 向指定 URL 发送POST方法的请求
Reported by PMD.
Line: 19
*
* @return 远程资源的响应结果
*/
public class HttpUtil {
private static final Log logger = LogFactory.getLog(HttpUtil.class);
/**
* 向指定 URL 发送POST方法的请求
Reported by PMD.
Line: 21
*/
public class HttpUtil {
private static final Log logger = LogFactory.getLog(HttpUtil.class);
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
Reported by PMD.
Line: 35
OutputStreamWriter out = null;
BufferedReader in = null;
StringBuilder result = new StringBuilder();
try {
URL realUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
Reported by PMD.
Line: 39
URL realUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// POST方法
conn.setRequestMethod("POST");
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
Reported by PMD.
Line: 40
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// POST方法
conn.setRequestMethod("POST");
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
Reported by PMD.
Line: 42
conn.setDoOutput(true);
conn.setDoInput(true);
// POST方法
conn.setRequestMethod("POST");
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
Reported by PMD.
Line: 44
// POST方法
conn.setRequestMethod("POST");
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();
Reported by PMD.
Line: 45
conn.setRequestMethod("POST");
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();
// 获取URLConnection对象对应的输出流
Reported by PMD.