优化删除日志功能

This commit is contained in:
季圣华
2020-06-10 00:34:26 +08:00
parent 5168a11b1e
commit 753c865deb
18 changed files with 295 additions and 70 deletions

View File

@@ -20,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -52,6 +53,19 @@ public class DepotService {
return result;
}
public List<Depot> getDepotListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Depot> list = new ArrayList<>();
try{
DepotExample example = new DepotExample();
example.createCriteria().andIdIn(idList);
list = depotMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Depot> getDepot()throws Exception {
DepotExample example = new DepotExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -195,8 +209,13 @@ public class DepotService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIds(String ids)throws Exception {
logService.insertLog("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
StringBuffer sb = new StringBuffer();
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Depot> list = getDepotListByIds(ids);
for(Depot depot: list){
sb.append("[").append(depot.getName()).append("]");
}
logService.insertLog("仓库", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");