给日志、菜单等页面优化接口
This commit is contained in:
parent
a73a8d2db2
commit
db090f8dd5
@ -49,7 +49,6 @@ public class DepotController extends BaseController {
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "根据id获取信息")
|
||||
public String getList(@RequestParam("id") Long id,
|
||||
|
||||
@ -2,9 +2,13 @@ package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.base.BaseController;
|
||||
import com.jsh.erp.base.TableDataInfo;
|
||||
import com.jsh.erp.datasource.entities.InOutItem;
|
||||
import com.jsh.erp.service.inOutItem.InOutItemService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
@ -18,6 +22,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
|
||||
|
||||
/**
|
||||
* @author jishenghua jshERP 2018年12月25日14:38:08
|
||||
@ -25,12 +30,83 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
@RestController
|
||||
@RequestMapping(value = "/inOutItem")
|
||||
@Api(tags = {"收支项目"})
|
||||
public class InOutItemController {
|
||||
public class InOutItemController extends BaseController {
|
||||
private Logger logger = LoggerFactory.getLogger(InOutItemController.class);
|
||||
|
||||
@Resource
|
||||
private InOutItemService inOutItemService;
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "根据id获取信息")
|
||||
public String getList(@RequestParam("id") Long id,
|
||||
HttpServletRequest request) throws Exception {
|
||||
InOutItem inOutItem = inOutItemService.getInOutItem(id);
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
if(inOutItem != null) {
|
||||
objectMap.put("info", inOutItem);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@ApiOperation(value = "获取信息列表")
|
||||
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||
HttpServletRequest request)throws Exception {
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
List<InOutItem> list = inOutItemService.select(name, type, remark);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/add")
|
||||
@ApiOperation(value = "新增")
|
||||
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int insert = inOutItemService.insertInOutItem(obj, request);
|
||||
return returnStr(objectMap, insert);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/update")
|
||||
@ApiOperation(value = "修改")
|
||||
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int update = inOutItemService.updateInOutItem(obj, request);
|
||||
return returnStr(objectMap, update);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int delete = inOutItemService.deleteInOutItem(id, request);
|
||||
return returnStr(objectMap, delete);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int delete = inOutItemService.batchDeleteInOutItem(ids, request);
|
||||
return returnStr(objectMap, delete);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/checkIsNameExist")
|
||||
@ApiOperation(value = "检查名称是否存在")
|
||||
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int exist = inOutItemService.checkIsNameExist(id, name);
|
||||
if(exist > 0) {
|
||||
objectMap.put("status", true);
|
||||
} else {
|
||||
objectMap.put("status", false);
|
||||
}
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找收支项目信息-下拉框
|
||||
* @param request
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.base.BaseController;
|
||||
import com.jsh.erp.base.TableDataInfo;
|
||||
import com.jsh.erp.datasource.entities.Log;
|
||||
import com.jsh.erp.datasource.vo.LogVo4List;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
|
||||
|
||||
/**
|
||||
* @author ji sheng hua 752*718*920
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/log")
|
||||
@Api(tags = {"日志管理"})
|
||||
public class LogController extends BaseController {
|
||||
private Logger logger = LoggerFactory.getLogger(LogController.class);
|
||||
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "根据id获取信息")
|
||||
public String getList(@RequestParam("id") Long id,
|
||||
HttpServletRequest request) throws Exception {
|
||||
Log log = logService.getLog(id);
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
if(log != null) {
|
||||
objectMap.put("info", log);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@ApiOperation(value = "获取信息列表")
|
||||
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||
HttpServletRequest request)throws Exception {
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
String userInfo = StringUtil.getInfo(search, "userInfo");
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
String tenantLoginName = StringUtil.getInfo(search, "tenantLoginName");
|
||||
String tenantType = StringUtil.getInfo(search, "tenantType");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
List<LogVo4List> list = logService.select(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/add")
|
||||
@ApiOperation(value = "新增")
|
||||
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
int insert = logService.insertLog(obj, request);
|
||||
return returnStr(objectMap, insert);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/update")
|
||||
@ApiOperation(value = "修改")
|
||||
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int update = logService.updateLog(obj, request);
|
||||
return returnStr(objectMap, update);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int delete = logService.deleteLog(id, request);
|
||||
return returnStr(objectMap, delete);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int delete = logService.batchDeleteLog(ids, request);
|
||||
return returnStr(objectMap, delete);
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,15 @@
|
||||
package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.base.BaseController;
|
||||
import com.jsh.erp.base.TableDataInfo;
|
||||
import com.jsh.erp.datasource.entities.Msg;
|
||||
import com.jsh.erp.datasource.entities.MsgEx;
|
||||
import com.jsh.erp.service.msg.MsgService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
@ -17,18 +22,90 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
|
||||
|
||||
/**
|
||||
* @author ji sheng hua jshERP
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/msg")
|
||||
@Api(tags = {"消息管理"})
|
||||
public class MsgController {
|
||||
public class MsgController extends BaseController {
|
||||
private Logger logger = LoggerFactory.getLogger(MsgController.class);
|
||||
|
||||
@Resource
|
||||
private MsgService msgService;
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "根据id获取信息")
|
||||
public String getList(@RequestParam("id") Long id,
|
||||
HttpServletRequest request) throws Exception {
|
||||
Msg msg = msgService.getMsg(id);
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
if(msg != null) {
|
||||
objectMap.put("info", msg);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@ApiOperation(value = "获取信息列表")
|
||||
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||
HttpServletRequest request)throws Exception {
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
List<MsgEx> list = msgService.select(name);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/add")
|
||||
@ApiOperation(value = "新增")
|
||||
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int insert = msgService.insertMsg(obj, request);
|
||||
return returnStr(objectMap, insert);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/update")
|
||||
@ApiOperation(value = "修改")
|
||||
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int update = msgService.updateMsg(obj, request);
|
||||
return returnStr(objectMap, update);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int delete = msgService.deleteMsg(id, request);
|
||||
return returnStr(objectMap, delete);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
@ApiOperation(value = "批量删除")
|
||||
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int delete = msgService.batchDeleteMsg(ids, request);
|
||||
return returnStr(objectMap, delete);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/checkIsNameExist")
|
||||
@ApiOperation(value = "检查名称是否存在")
|
||||
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int exist = msgService.checkIsNameExist(id, name);
|
||||
if(exist > 0) {
|
||||
objectMap.put("status", true);
|
||||
} else {
|
||||
objectMap.put("status", false);
|
||||
}
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态查询消息
|
||||
* @param status
|
||||
|
||||
@ -10,13 +10,6 @@ import java.util.List;
|
||||
public interface InOutItemMapperEx {
|
||||
|
||||
List<InOutItem> selectByConditionInOutItem(
|
||||
@Param("name") String name,
|
||||
@Param("type") String type,
|
||||
@Param("remark") String remark,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
Long countsByInOutItem(
|
||||
@Param("name") String name,
|
||||
@Param("type") String type,
|
||||
@Param("remark") String remark);
|
||||
|
||||
@ -10,18 +10,6 @@ import java.util.List;
|
||||
public interface LogMapperEx {
|
||||
|
||||
List<LogVo4List> selectByConditionLog(
|
||||
@Param("operation") String operation,
|
||||
@Param("userInfo") String userInfo,
|
||||
@Param("clientIp") String clientIp,
|
||||
@Param("tenantLoginName") String tenantLoginName,
|
||||
@Param("tenantType") String tenantType,
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("content") String content,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
Long countsByLog(
|
||||
@Param("operation") String operation,
|
||||
@Param("userInfo") String userInfo,
|
||||
@Param("clientIp") String clientIp,
|
||||
|
||||
@ -9,12 +9,6 @@ import java.util.List;
|
||||
public interface MsgMapperEx {
|
||||
|
||||
List<MsgEx> selectByConditionMsg(
|
||||
@Param("userId") Long userId,
|
||||
@Param("name") String name,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
Long countsByMsg(
|
||||
@Param("userId") Long userId,
|
||||
@Param("name") String name);
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -94,6 +95,7 @@ public class DepotService {
|
||||
public List<DepotEx> select(String name, Integer type, String remark)throws Exception {
|
||||
List<DepotEx> list=null;
|
||||
try{
|
||||
PageUtils.startPage();
|
||||
list=depotMapperEx.selectByConditionDepot(name, type, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
|
||||
@ -12,6 +12,7 @@ import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -81,6 +82,7 @@ public class FunctionService {
|
||||
List<FunctionEx> list=null;
|
||||
try{
|
||||
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||
PageUtils.startPage();
|
||||
list = functionMapperEx.selectByConditionFunction(name, type);
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
package com.jsh.erp.service.inOutItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "inOutItem_component")
|
||||
@InOutItemResource
|
||||
public class InOutItemComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private InOutItemService inOutItemService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return inOutItemService.getInOutItem(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getFunctionsList(map);
|
||||
}
|
||||
|
||||
private List<?> getFunctionsList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String order = QueryUtils.order(map);
|
||||
return inOutItemService.select(name, type, remark, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
return inOutItemService.countInOutItem(name, type, remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return inOutItemService.insertInOutItem(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return inOutItemService.updateInOutItem(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return inOutItemService.deleteInOutItem(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return inOutItemService.batchDeleteInOutItem(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return inOutItemService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.inOutItem;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "inOutItem")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface InOutItemResource {
|
||||
}
|
||||
@ -14,6 +14,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -79,26 +80,17 @@ public class InOutItemService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<InOutItem> select(String name, String type, String remark, int offset, int rows)throws Exception {
|
||||
public List<InOutItem> select(String name, String type, String remark)throws Exception {
|
||||
List<InOutItem> list=null;
|
||||
try{
|
||||
list=inOutItemMapperEx.selectByConditionInOutItem(name, type, remark, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list=inOutItemMapperEx.selectByConditionInOutItem(name, type, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countInOutItem(String name, String type, String remark)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=inOutItemMapperEx.countsByInOutItem(name, type, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertInOutItem(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
InOutItem inOutItem = JSONObject.parseObject(obj.toJSONString(), InOutItem.class);
|
||||
|
||||
@ -1,85 +0,0 @@
|
||||
package com.jsh.erp.service.log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "log_component")
|
||||
@LogResource
|
||||
public class LogComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return logService.getLog(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getLogList(map);
|
||||
}
|
||||
|
||||
private List<?> getLogList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
String userInfo = StringUtil.getInfo(search, "userInfo");
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
String tenantLoginName = StringUtil.getInfo(search, "tenantLoginName");
|
||||
String tenantType = StringUtil.getInfo(search, "tenantType");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
return logService.select(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content,
|
||||
QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
String userInfo = StringUtil.getInfo(search, "userInfo");
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
String tenantLoginName = StringUtil.getInfo(search, "tenantLoginName");
|
||||
String tenantType = StringUtil.getInfo(search, "tenantType");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
return logService.countLog(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return logService.insertLog(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return logService.updateLog(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return logService.deleteLog(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return logService.batchDeleteLog(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.log;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "log")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface LogResource {
|
||||
}
|
||||
@ -2,17 +2,15 @@ package com.jsh.erp.service.log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Log;
|
||||
import com.jsh.erp.datasource.entities.LogExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.LogMapper;
|
||||
import com.jsh.erp.datasource.mappers.LogMapperEx;
|
||||
import com.jsh.erp.datasource.vo.LogVo4List;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.redis.RedisService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
@ -64,13 +62,14 @@ public class LogService {
|
||||
}
|
||||
|
||||
public List<LogVo4List> select(String operation, String userInfo, String clientIp, String tenantLoginName, String tenantType,
|
||||
String beginTime, String endTime, String content, int offset, int rows)throws Exception {
|
||||
String beginTime, String endTime, String content)throws Exception {
|
||||
List<LogVo4List> list=null;
|
||||
try{
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
PageUtils.startPage();
|
||||
list=logMapperEx.selectByConditionLog(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime,
|
||||
content, offset, rows);
|
||||
content);
|
||||
if (null != list) {
|
||||
for (LogVo4List log : list) {
|
||||
log.setCreateTimeStr(Tools.getCenternTime(log.getCreateTime()));
|
||||
@ -82,19 +81,6 @@ public class LogService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countLog(String operation, String userInfo, String clientIp, String tenantLoginName, String tenantType,
|
||||
String beginTime, String endTime, String content)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
result=logMapperEx.countsByLog(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertLog(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
Log log = JSONObject.parseObject(obj.toJSONString(), Log.class);
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
package com.jsh.erp.service.msg;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "msg_component")
|
||||
@MsgResource
|
||||
public class MsgComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MsgService msgService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return msgService.getMsg(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMsgList(map);
|
||||
}
|
||||
|
||||
private List<?> getMsgList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String order = QueryUtils.order(map);
|
||||
String filter = QueryUtils.filter(map);
|
||||
return msgService.select(name, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
return msgService.countMsg(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return msgService.insertMsg(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return msgService.updateMsg(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return msgService.deleteMsg(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return msgService.batchDeleteMsg(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return msgService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.msg;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2019-9-7 22:52:35
|
||||
*/
|
||||
@ResourceInfo(value = "msg")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MsgResource {
|
||||
}
|
||||
@ -14,6 +14,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotHead.DepotHeadService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
@ -77,12 +78,13 @@ public class MsgService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MsgEx> select(String name, int offset, int rows)throws Exception {
|
||||
public List<MsgEx> select(String name)throws Exception {
|
||||
List<MsgEx> list=null;
|
||||
try{
|
||||
User userInfo = userService.getCurrentUser();
|
||||
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
|
||||
list = msgMapperEx.selectByConditionMsg(userInfo.getId(), name, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = msgMapperEx.selectByConditionMsg(userInfo.getId(), name);
|
||||
if (null != list) {
|
||||
for (MsgEx msgEx : list) {
|
||||
if (msgEx.getCreateTime() != null) {
|
||||
@ -100,22 +102,6 @@ public class MsgService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countMsg(String name)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
User userInfo = userService.getCurrentUser();
|
||||
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
|
||||
result = msgMapperEx.countsByMsg(userInfo.getId(), name);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMsg(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Msg msg = JSONObject.parseObject(obj.toJSONString(), Msg.class);
|
||||
|
||||
@ -15,6 +15,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -86,6 +87,7 @@ public class PersonService {
|
||||
public List<Person> select(String name, String type)throws Exception {
|
||||
List<Person> list=null;
|
||||
try{
|
||||
PageUtils.startPage();
|
||||
list=personMapperEx.selectByConditionPerson(name, type);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
|
||||
@ -18,28 +18,8 @@
|
||||
</if>
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
order by sort asc, id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
<select id="countsByInOutItem" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM jsh_in_out_item
|
||||
WHERE 1=1
|
||||
<if test="name != null">
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and name like #{bindName}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and type=#{type}
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
<bind name="bindRemark" value="'%'+remark+'%'"/>
|
||||
and remark like #{bindRemark}
|
||||
</if>
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<update id="batchDeleteInOutItemByIds">
|
||||
update jsh_in_out_item
|
||||
set delete_flag='1'
|
||||
|
||||
@ -41,45 +41,6 @@
|
||||
and l.content like #{bindContent}
|
||||
</if>
|
||||
order by l.create_time desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
<select id="countsByLog" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM jsh_log l
|
||||
left join jsh_user u on l.user_id = u.id
|
||||
left join jsh_tenant t on l.tenant_id=t.tenant_id
|
||||
WHERE 1=1
|
||||
<if test="operation != null">
|
||||
<bind name="bindOperation" value="'%'+operation+'%'"/>
|
||||
and l.operation like #{bindOperation}
|
||||
</if>
|
||||
<if test="userInfo != null">
|
||||
<bind name="bindUserInfo" value="'%'+userInfo+'%'"/>
|
||||
and (u.username like #{bindUserInfo} or u.login_name like #{bindUserInfo})
|
||||
</if>
|
||||
<if test="clientIp != null">
|
||||
<bind name="bindClientIp" value="'%'+clientIp+'%'"/>
|
||||
and l.client_ip like #{bindClientIp}
|
||||
</if>
|
||||
<if test="tenantLoginName != null">
|
||||
and t.login_name = #{tenantLoginName}
|
||||
</if>
|
||||
<if test="tenantType != null">
|
||||
and t.type = #{tenantType}
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and l.create_time >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and l.create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="content != null">
|
||||
<bind name="bindContent" value="'%'+content+'%'"/>
|
||||
and l.content like #{bindContent}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCountByIpAndDate" resultType="java.lang.Long">
|
||||
|
||||
@ -16,24 +16,6 @@
|
||||
and msg_title like #{bindName}
|
||||
</if>
|
||||
order by create_time desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countsByMsg" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM jsh_msg
|
||||
WHERE 1=1
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and msg_title like #{bindName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="batchDeleteMsgByIds">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user