From db090f8dd508c3520016fbd593f0a0e87f126f4c Mon Sep 17 00:00:00 2001 From: jishenghua <752718920@qq.com> Date: Sun, 23 Feb 2025 09:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E6=97=A5=E5=BF=97=E3=80=81=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=AD=89=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsh/erp/controller/DepotController.java | 1 - .../erp/controller/InOutItemController.java | 78 +++++++++++++- .../com/jsh/erp/controller/LogController.java | 101 ++++++++++++++++++ .../com/jsh/erp/controller/MsgController.java | 79 +++++++++++++- .../datasource/mappers/InOutItemMapperEx.java | 7 -- .../erp/datasource/mappers/LogMapperEx.java | 12 --- .../erp/datasource/mappers/MsgMapperEx.java | 6 -- .../jsh/erp/service/depot/DepotService.java | 2 + .../service/functions/FunctionService.java | 2 + .../service/inOutItem/InOutItemComponent.java | 75 ------------- .../service/inOutItem/InOutItemResource.java | 15 --- .../service/inOutItem/InOutItemService.java | 16 +-- .../com/jsh/erp/service/log/LogComponent.java | 85 --------------- .../com/jsh/erp/service/log/LogResource.java | 15 --- .../com/jsh/erp/service/log/LogService.java | 22 +--- .../com/jsh/erp/service/msg/MsgComponent.java | 72 ------------- .../com/jsh/erp/service/msg/MsgResource.java | 15 --- .../com/jsh/erp/service/msg/MsgService.java | 22 +--- .../jsh/erp/service/person/PersonService.java | 2 + .../mapper_xml/InOutItemMapperEx.xml | 22 +--- .../main/resources/mapper_xml/LogMapperEx.xml | 39 ------- .../main/resources/mapper_xml/MsgMapperEx.xml | 18 ---- 22 files changed, 275 insertions(+), 431 deletions(-) create mode 100644 jshERP-boot/src/main/java/com/jsh/erp/controller/LogController.java delete mode 100644 jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java delete mode 100644 jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemResource.java delete mode 100644 jshERP-boot/src/main/java/com/jsh/erp/service/log/LogComponent.java delete mode 100644 jshERP-boot/src/main/java/com/jsh/erp/service/log/LogResource.java delete mode 100644 jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgComponent.java delete mode 100644 jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgResource.java diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java index 1d712c77c..d531a1507 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java @@ -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, diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/InOutItemController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/InOutItemController.java index f50ccf6cb..aa5ff5701 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/InOutItemController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/InOutItemController.java @@ -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 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 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 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 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 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 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 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 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/LogController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/LogController.java new file mode 100644 index 000000000..5e71ac06c --- /dev/null +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/LogController.java @@ -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 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 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 objectMap = new HashMap(); + 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 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 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 objectMap = new HashMap<>(); + int delete = logService.batchDeleteLog(ids, request); + return returnStr(objectMap, delete); + } +} \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/MsgController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/MsgController.java index d7c5cfc5b..b4670a066 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/MsgController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/MsgController.java @@ -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 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 list = msgService.select(name); + return getDataTable(list); + } + + @PostMapping(value = "/add") + @ApiOperation(value = "新增") + public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception { + Map 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 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 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 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 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 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/InOutItemMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/InOutItemMapperEx.java index 903aa40af..e3ab38b8a 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/InOutItemMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/InOutItemMapperEx.java @@ -10,13 +10,6 @@ import java.util.List; public interface InOutItemMapperEx { List 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); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/LogMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/LogMapperEx.java index 01b7eaa87..ae093fbd1 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/LogMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/LogMapperEx.java @@ -10,18 +10,6 @@ import java.util.List; public interface LogMapperEx { List 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, diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MsgMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MsgMapperEx.java index 869e5eaa6..597c48aeb 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MsgMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MsgMapperEx.java @@ -9,12 +9,6 @@ import java.util.List; public interface MsgMapperEx { List 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); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/depot/DepotService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/depot/DepotService.java index 9846eafa5..24e62a622 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/depot/DepotService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/depot/DepotService.java @@ -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 select(String name, Integer type, String remark)throws Exception { List list=null; try{ + PageUtils.startPage(); list=depotMapperEx.selectByConditionDepot(name, type, remark); }catch(Exception e){ JshException.readFail(logger, e); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/functions/FunctionService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/functions/FunctionService.java index dc59f3f24..2d958c324 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/functions/FunctionService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/functions/FunctionService.java @@ -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 list=null; try{ if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) { + PageUtils.startPage(); list = functionMapperEx.selectByConditionFunction(name, type); } }catch(Exception e){ diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java b/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java deleted file mode 100644 index 1aa752c04..000000000 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java +++ /dev/null @@ -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 map)throws Exception { - return getFunctionsList(map); - } - - private List getFunctionsList(Map 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 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); - } - -} diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemResource.java b/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemResource.java deleted file mode 100644 index fdaba3744..000000000 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemResource.java +++ /dev/null @@ -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 { -} diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java index 9024bdc4b..b9f9b169b 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java @@ -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 select(String name, String type, String remark, int offset, int rows)throws Exception { + public List select(String name, String type, String remark)throws Exception { List 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); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogComponent.java b/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogComponent.java deleted file mode 100644 index 78b90e468..000000000 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogComponent.java +++ /dev/null @@ -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 map)throws Exception { - return getLogList(map); - } - - private List getLogList(Map 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 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; - } - -} diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogResource.java b/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogResource.java deleted file mode 100644 index 61775eb33..000000000 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogResource.java +++ /dev/null @@ -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 { -} diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogService.java index 6693f5ab9..e96eaed12 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/log/LogService.java @@ -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 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 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); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgComponent.java b/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgComponent.java deleted file mode 100644 index f39d280e1..000000000 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgComponent.java +++ /dev/null @@ -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 map)throws Exception { - return getMsgList(map); - } - - private List getMsgList(Map 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 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); - } - -} diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgResource.java b/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgResource.java deleted file mode 100644 index 2f5aba741..000000000 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgResource.java +++ /dev/null @@ -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 { -} diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java index bbf5134b0..0632d927a 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java @@ -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 select(String name, int offset, int rows)throws Exception { + public List select(String name)throws Exception { List 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); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/person/PersonService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/person/PersonService.java index 0cc57d91b..143bcc788 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/person/PersonService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/person/PersonService.java @@ -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 select(String name, String type)throws Exception { List list=null; try{ + PageUtils.startPage(); list=personMapperEx.selectByConditionPerson(name, type); }catch(Exception e){ JshException.readFail(logger, e); diff --git a/jshERP-boot/src/main/resources/mapper_xml/InOutItemMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/InOutItemMapperEx.xml index 21e3b029e..9605d9669 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/InOutItemMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/InOutItemMapperEx.xml @@ -18,28 +18,8 @@ and ifnull(delete_flag,'0') !='1' order by sort asc, id desc - - limit #{offset},#{rows} - - - + update jsh_in_out_item set delete_flag='1' diff --git a/jshERP-boot/src/main/resources/mapper_xml/LogMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/LogMapperEx.xml index b97529449..cf9561cc3 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/LogMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/LogMapperEx.xml @@ -41,45 +41,6 @@ and l.content like #{bindContent} order by l.create_time desc - - limit #{offset},#{rows} - - - - -