|
@@ -3,9 +3,9 @@ package com.example.nngkxxdp.service.impl;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileTypeUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
-import com.example.nngkxxdp.dao.YxnnDao;
|
|
|
+import com.example.nngkxxdp.dao.YxnaDao;
|
|
|
import com.example.nngkxxdp.entity.ImpressionNanan;
|
|
|
-import com.example.nngkxxdp.service.YxnnService;
|
|
|
+import com.example.nngkxxdp.service.YxnaService;
|
|
|
import com.example.nngkxxdp.util.Blank;
|
|
|
import com.example.nngkxxdp.util.ConstStr;
|
|
|
import com.example.nngkxxdp.util.ConstantUtil;
|
|
@@ -29,7 +29,7 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional
|
|
|
-public class YxnnServiceImpl implements YxnnService {
|
|
|
+public class YxnaServiceImpl implements YxnaService {
|
|
|
|
|
|
@Value("${file.location}")
|
|
|
private String location;
|
|
@@ -37,14 +37,14 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
@Autowired
|
|
|
- private YxnnDao yxnnDao;
|
|
|
+ private YxnaDao yxnaDao;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getDocumentPageFront(int page, int limit, String pictureType, String examineState) {
|
|
|
int startRows = (page - 1) * limit;
|
|
|
- int count = yxnnDao.getDocumentCountFront(pictureType, examineState);
|
|
|
+ int count = yxnaDao.getDocumentCountFront(pictureType, examineState);
|
|
|
if (count > 0) {
|
|
|
- List<Map<String, Object>> mapList = yxnnDao.getDocumentPageFront(startRows, limit, pictureType, examineState);
|
|
|
+ List<Map<String, Object>> mapList = yxnaDao.getDocumentPageFront(startRows, limit, pictureType, examineState);
|
|
|
for (Map<String, Object> map : mapList) {
|
|
|
if ((int) map.get("isPublic") == ConstantUtil.IS_NOT_PUBLIC) {
|
|
|
String uploaderPhone = map.get("uploaderPhone").toString();
|
|
@@ -62,9 +62,9 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
@Override
|
|
|
public Map<String, Object> getDocumentPage(int page, int limit, String pictureType, String examineState, String uploaderPhone, String pictureTitle, String pictureAuthor) {
|
|
|
int startRows = (page - 1) * limit;
|
|
|
- int count = yxnnDao.getDocumentCount(pictureType, examineState, uploaderPhone, pictureTitle, pictureAuthor);
|
|
|
+ int count = yxnaDao.getDocumentCount(pictureType, examineState, uploaderPhone, pictureTitle, pictureAuthor);
|
|
|
if (count > 0) {
|
|
|
- return SendUtil.layuiTable(count, yxnnDao.getDocumentPage(startRows, limit, pictureType, examineState, uploaderPhone, pictureTitle, pictureAuthor));
|
|
|
+ return SendUtil.layuiTable(count, yxnaDao.getDocumentPage(startRows, limit, pictureType, examineState, uploaderPhone, pictureTitle, pictureAuthor));
|
|
|
}
|
|
|
return SendUtil.layuiTable(0, null);
|
|
|
}
|
|
@@ -113,7 +113,7 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
impressionNanan.setUrlAddress(newName);
|
|
|
impressionNanan.setUploadTime(DateUtil.parse(sdf.format(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
|
|
impressionNanan.setUpdateTime(DateUtil.parse(sdf.format(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
|
|
- if (yxnnDao.saveDocumetIn(impressionNanan) <= 0) {
|
|
|
+ if (yxnaDao.saveDocumetIn(impressionNanan) <= 0) {
|
|
|
return SendUtil.send(false, ConstStr.ADD_FAILED, "");
|
|
|
}
|
|
|
return SendUtil.send(true, ConstStr.ADD_SUCCESS, "");
|
|
@@ -121,7 +121,7 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
|
|
|
@Override
|
|
|
public ImpressionNanan getDocumentByIdFront(Integer id) {
|
|
|
- ImpressionNanan impressionNanan = yxnnDao.getDocumentById(id);
|
|
|
+ ImpressionNanan impressionNanan = yxnaDao.getDocumentById(id);
|
|
|
if (impressionNanan.getIsPublic() == ConstantUtil.IS_NOT_PUBLIC) {
|
|
|
String uploaderPhone = impressionNanan.getUploaderPhone();
|
|
|
impressionNanan.setUploaderPhone(uploaderPhone.substring(0, 1) + "*********" + uploaderPhone.substring(10, 11));
|
|
@@ -134,13 +134,13 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
|
|
|
@Override
|
|
|
public ImpressionNanan getDocumentById(Integer id) {
|
|
|
- return yxnnDao.getDocumentById(id);
|
|
|
+ return yxnaDao.getDocumentById(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> deleteDocumentById(Integer id) {
|
|
|
//通过id查询单个的信息
|
|
|
- ImpressionNanan impressionNanan = yxnnDao.getDocumentById(id);
|
|
|
+ ImpressionNanan impressionNanan = yxnaDao.getDocumentById(id);
|
|
|
if (Blank.isNotEmpty(impressionNanan.getUrlAddress())) {
|
|
|
File file = new File(location + impressionNanan.getUrlAddress());
|
|
|
//删出对应的文件,以及对应的文件信息
|
|
@@ -148,7 +148,7 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
file.delete();
|
|
|
}
|
|
|
}
|
|
|
- if (yxnnDao.deleteDocumentById(id) <= 0) {
|
|
|
+ if (yxnaDao.deleteDocumentById(id) <= 0) {
|
|
|
return SendUtil.send(false, ConstStr.DELETEUSER_FAILED, "");
|
|
|
}
|
|
|
return SendUtil.send(true, ConstStr.DELETEUSER_SUCCESS, "");
|
|
@@ -196,7 +196,7 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
impressionNanan.setUrlAddress(newName);
|
|
|
}
|
|
|
impressionNanan.setUpdateTime(DateUtil.parse(sdf.format(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
|
|
- if (yxnnDao.updateDocumentById(impressionNanan) <= 0) {
|
|
|
+ if (yxnaDao.updateDocumentById(impressionNanan) <= 0) {
|
|
|
return SendUtil.send(false, ConstStr.UPDATEUSER_FAILED, "");
|
|
|
}
|
|
|
return SendUtil.send(true, ConstStr.UPDATEUSER_SUCCESS, "");
|
|
@@ -226,7 +226,7 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
return SendUtil.send(false, ConstStr.ADD_FAILED, "图片描述长度不能大于200");
|
|
|
}
|
|
|
impressionNanan.setUpdateTime(DateUtil.parse(sdf.format(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
|
|
- if (yxnnDao.updateDocumentById(impressionNanan) <= 0) {
|
|
|
+ if (yxnaDao.updateDocumentById(impressionNanan) <= 0) {
|
|
|
return SendUtil.send(false, ConstStr.UPDATEUSER_FAILED, "");
|
|
|
}
|
|
|
return SendUtil.send(true, ConstStr.UPDATEUSER_SUCCESS, "");
|
|
@@ -279,7 +279,7 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
return SendUtil.send(false, ConstStr.ADD_FAILED, "图片描述长度不能大于200");
|
|
|
}
|
|
|
impressionNanan.setUploadTime(DateUtil.parse(sdf.format(new Date()), "yyyy-MM-dd HH:mm:ss"));
|
|
|
- if (yxnnDao.saveDocumetIn(impressionNanan) <= 0) {
|
|
|
+ if (yxnaDao.saveDocumetIn(impressionNanan) <= 0) {
|
|
|
return SendUtil.send(false, ConstStr.ADD_FAILED, "");
|
|
|
}
|
|
|
return SendUtil.send(true, ConstStr.ADD_SUCCESS, "");
|
|
@@ -288,9 +288,9 @@ public class YxnnServiceImpl implements YxnnService {
|
|
|
@Override
|
|
|
public Map<String, Object> getImpressionPage(int page, int limit) {
|
|
|
int startRows = (page - 1) * limit;
|
|
|
- int count = yxnnDao.getImpressionCount();
|
|
|
+ int count = yxnaDao.getImpressionCount();
|
|
|
if (count > 0) {
|
|
|
- return SendUtil.layuiTable(count, yxnnDao.getImpressionPage(startRows, limit));
|
|
|
+ return SendUtil.layuiTable(count, yxnaDao.getImpressionPage(startRows, limit));
|
|
|
}
|
|
|
return SendUtil.layuiTable(0, null);
|
|
|
}
|