From 70bf66a2817cd51877820ae1ec4c39647c5196e7 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期四, 14 十二月 2023 14:00:17 +0800 Subject: [PATCH] 海康接口对接开发 --- server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java | 26 + server/dmvisit_service/src/main/java/com/doumee/dao/business/model/UserAction.java | 66 ++++ db/business.user_action.permissions.sql | 6 server/dmvisit_admin/src/main/java/com/doumee/api/UserActionController.java | 90 ++++++ src/main/java/com/doumee/dao/business/model/UserAction.java | 66 ++++ server/db/business.user_action.permissions.sql | 6 server/dmvisit_service/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java | 139 +++++++++ src/main/java/com/doumee/dao/business/UserActionMapper.java | 12 coderd.json | 12 server/dmvisit_service/src/main/java/com/doumee/service/business/UserActionService.java | 97 ++++++ server/dmvisit_service/src/main/java/com/doumee/dao/business/CarEventMapper.java | 3 src/main/java/com/doumee/api/business/UserActionController.java | 90 ++++++ server/dmvisit_service/src/main/java/com/doumee/dao/business/UserActionMapper.java | 12 src/main/java/com/doumee/service/business/UserActionService.java | 97 ++++++ src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java | 139 +++++++++ 15 files changed, 859 insertions(+), 2 deletions(-) diff --git a/coderd.json b/coderd.json index 9e26dfe..93bc26c 100644 --- a/coderd.json +++ b/coderd.json @@ -1 +1,11 @@ -{} \ No newline at end of file +{ + "project": 6594, + "template": { + "alias": "eva", + "command": "interface", + "versionNo": "v2.2.7", + "option": { + "resources": "user_action" + } + } +} \ No newline at end of file diff --git a/db/business.user_action.permissions.sql b/db/business.user_action.permissions.sql new file mode 100644 index 0000000..1121907 --- /dev/null +++ b/db/business.user_action.permissions.sql @@ -0,0 +1,6 @@ +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:create', '鏂板缓浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:delete', '鍒犻櫎浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:update', '淇敼浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:query', '鏌ヨ浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:exportExcel', '瀵煎嚭浜哄憳鎿嶄綔璁板綍鏃ュ織(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); + diff --git a/server/db/business.user_action.permissions.sql b/server/db/business.user_action.permissions.sql new file mode 100644 index 0000000..1121907 --- /dev/null +++ b/server/db/business.user_action.permissions.sql @@ -0,0 +1,6 @@ +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:create', '鏂板缓浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:delete', '鍒犻櫎浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:update', '淇敼浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:query', '鏌ヨ浜哄憳鎿嶄綔璁板綍鏃ュ織', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); +INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:useraction:exportExcel', '瀵煎嚭浜哄憳鎿嶄綔璁板綍鏃ュ織(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); + diff --git a/server/dmvisit_admin/src/main/java/com/doumee/api/UserActionController.java b/server/dmvisit_admin/src/main/java/com/doumee/api/UserActionController.java new file mode 100644 index 0000000..f063a5a --- /dev/null +++ b/server/dmvisit_admin/src/main/java/com/doumee/api/UserActionController.java @@ -0,0 +1,90 @@ +package com.doumee.api; + +import com.doumee.api.BaseController; +import com.doumee.core.annotation.excel.ExcelExporter; +import com.doumee.core.annotation.pr.PreventRepeat; +import com.doumee.core.model.ApiResponse; +import com.doumee.core.model.PageWrap; +import com.doumee.core.model.PageData; +import com.doumee.dao.business.model.UserAction; +import com.doumee.service.business.UserActionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author 姹熻箘韫� + * @date 2023/12/14 13:57 + */ +@Api(tags = "浜哄憳鎿嶄綔璁板綍鏃ュ織") +@RestController +@RequestMapping("/business/userAction") +public class UserActionController extends BaseController { + + @Autowired + private UserActionService userActionService; + + @PreventRepeat + @ApiOperation("鏂板缓") + @PostMapping("/create") + @RequiresPermissions("business:useraction:create") + public ApiResponse create(@RequestBody UserAction userAction) { + return ApiResponse.success(userActionService.create(userAction)); + } + + @ApiOperation("鏍规嵁ID鍒犻櫎") + @GetMapping("/delete/{id}") + @RequiresPermissions("business:useraction:delete") + public ApiResponse deleteById(@PathVariable Integer id) { + userActionService.deleteById(id); + return ApiResponse.success(null); + } + + @ApiOperation("鎵归噺鍒犻櫎") + @GetMapping("/delete/batch") + @RequiresPermissions("business:useraction:delete") + public ApiResponse deleteByIdInBatch(@RequestParam String ids) { + String [] idArray = ids.split(","); + List<Integer> idList = new ArrayList<>(); + for (String id : idArray) { + idList.add(Integer.valueOf(id)); + } + userActionService.deleteByIdInBatch(idList); + return ApiResponse.success(null); + } + + @ApiOperation("鏍规嵁ID淇敼") + @PostMapping("/updateById") + @RequiresPermissions("business:useraction:update") + public ApiResponse updateById(@RequestBody UserAction userAction) { + userActionService.updateById(userAction); + return ApiResponse.success(null); + } + + @ApiOperation("鍒嗛〉鏌ヨ") + @PostMapping("/page") + @RequiresPermissions("business:useraction:query") + public ApiResponse<PageData<UserAction>> findPage (@RequestBody PageWrap<UserAction> pageWrap) { + return ApiResponse.success(userActionService.findPage(pageWrap)); + } + + @ApiOperation("瀵煎嚭Excel") + @PostMapping("/exportExcel") + @RequiresPermissions("business:useraction:exportExcel") + public void exportExcel (@RequestBody PageWrap<UserAction> pageWrap, HttpServletResponse response) { + ExcelExporter.build(UserAction.class).export(userActionService.findPage(pageWrap).getRecords(), "浜哄憳鎿嶄綔璁板綍鏃ュ織", response); + } + + @ApiOperation("鏍规嵁ID鏌ヨ") + @GetMapping("/{id}") + @RequiresPermissions("business:useraction:query") + public ApiResponse findById(@PathVariable Integer id) { + return ApiResponse.success(userActionService.findById(id)); + } +} diff --git a/server/dmvisit_service/src/main/java/com/doumee/dao/business/CarEventMapper.java b/server/dmvisit_service/src/main/java/com/doumee/dao/business/CarEventMapper.java index f3f07e0..f502dbe 100644 --- a/server/dmvisit_service/src/main/java/com/doumee/dao/business/CarEventMapper.java +++ b/server/dmvisit_service/src/main/java/com/doumee/dao/business/CarEventMapper.java @@ -3,10 +3,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.doumee.dao.business.model.CarEvent; +import java.util.List; + /** * @author 姹熻箘韫� * @date 2023/11/30 15:33 */ public interface CarEventMapper extends BaseMapper<CarEvent> { + void insertBatchSomeColumn(List<CarEvent> list); } diff --git a/server/dmvisit_service/src/main/java/com/doumee/dao/business/UserActionMapper.java b/server/dmvisit_service/src/main/java/com/doumee/dao/business/UserActionMapper.java new file mode 100644 index 0000000..f5d61e0 --- /dev/null +++ b/server/dmvisit_service/src/main/java/com/doumee/dao/business/UserActionMapper.java @@ -0,0 +1,12 @@ +package com.doumee.dao.business; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.doumee.dao.business.model.UserAction; + +/** + * @author 姹熻箘韫� + * @date 2023/12/14 13:57 + */ +public interface UserActionMapper extends BaseMapper<UserAction> { + +} diff --git a/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/UserAction.java b/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/UserAction.java new file mode 100644 index 0000000..b322539 --- /dev/null +++ b/server/dmvisit_service/src/main/java/com/doumee/dao/business/model/UserAction.java @@ -0,0 +1,66 @@ +package com.doumee.dao.business.model; + +import com.doumee.core.annotation.excel.ExcelColumn; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; + +/** + * 浜哄憳鎿嶄綔璁板綍鏃ュ織 + * @author 姹熻箘韫� + * @date 2023/12/14 13:57 + */ +@Data +@ApiModel("浜哄憳鎿嶄綔璁板綍鏃ュ織") +@TableName("`user_action`") +public class UserAction { + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "涓婚敭", example = "1") + @ExcelColumn(name="涓婚敭") + private Integer id; + + @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1") + @ExcelColumn(name="鍒涘缓浜虹紪鐮�") + private Integer creator; + + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + @ExcelColumn(name="鍒涘缓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createDate; + + @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1") + @ExcelColumn(name="鏇存柊浜虹紪鐮�") + private Integer editor; + + @ApiModelProperty(value = "鏇存柊鏃堕棿") + @ExcelColumn(name="鏇存柊鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date editDate; + + @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "1") + @ExcelColumn(name="鏄惁鍒犻櫎0鍚� 1鏄�") + private Integer isdeleted; + + @ApiModelProperty(value = "澶囨敞") + @ExcelColumn(name="澶囨敞") + private String remark; + + @ApiModelProperty(value = "绫诲瀷 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎", example = "1") + @ExcelColumn(name="绫诲瀷 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎") + private Integer type; + + @ApiModelProperty(value = "浜哄憳鎿嶄綔璁板綍鏃ュ織") + @ExcelColumn(name="浜哄憳鎿嶄綔璁板綍鏃ュ織") + private String memberId; + + @ApiModelProperty(value = "鎿嶄綔鍓嶇姸鎬� 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎", example = "1") + @ExcelColumn(name="鎿嶄綔鍓嶇姸鎬� 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎") + private Integer beforeStatus; + +} diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/UserActionService.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/UserActionService.java new file mode 100644 index 0000000..c2dc56f --- /dev/null +++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/UserActionService.java @@ -0,0 +1,97 @@ +package com.doumee.service.business; + +import com.doumee.core.model.PageData; +import com.doumee.core.model.PageWrap; +import com.doumee.dao.business.model.UserAction; +import java.util.List; + +/** + * 浜哄憳鎿嶄綔璁板綍鏃ュ織Service瀹氫箟 + * @author 姹熻箘韫� + * @date 2023/12/14 13:57 + */ +public interface UserActionService { + + /** + * 鍒涘缓 + * + * @param userAction 瀹炰綋瀵硅薄 + * @return Integer + */ + Integer create(UserAction userAction); + + /** + * 涓婚敭鍒犻櫎 + * + * @param id 涓婚敭 + */ + void deleteById(Integer id); + + /** + * 鍒犻櫎 + * + * @param userAction 瀹炰綋瀵硅薄 + */ + void delete(UserAction userAction); + + /** + * 鎵归噺涓婚敭鍒犻櫎 + * + * @param ids 涓婚敭闆� + */ + void deleteByIdInBatch(List<Integer> ids); + + /** + * 涓婚敭鏇存柊 + * + * @param userAction 瀹炰綋瀵硅薄 + */ + void updateById(UserAction userAction); + + /** + * 鎵归噺涓婚敭鏇存柊 + * + * @param userActions 瀹炰綋闆� + */ + void updateByIdInBatch(List<UserAction> userActions); + + /** + * 涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return UserAction + */ + UserAction findById(Integer id); + + /** + * 鏉′欢鏌ヨ鍗曟潯璁板綍 + * + * @param userAction 瀹炰綋瀵硅薄 + * @return UserAction + */ + UserAction findOne(UserAction userAction); + + /** + * 鏉′欢鏌ヨ + * + * @param userAction 瀹炰綋瀵硅薄 + * @return List<UserAction> + */ + List<UserAction> findList(UserAction userAction); + + /** + * 鍒嗛〉鏌ヨ + * + * @param pageWrap 鍒嗛〉瀵硅薄 + * @return PageData<UserAction> + */ + PageData<UserAction> findPage(PageWrap<UserAction> pageWrap); + + /** + * 鏉′欢缁熻 + * + * @param userAction 瀹炰綋瀵硅薄 + * @return long + */ + long count(UserAction userAction); +} diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java new file mode 100644 index 0000000..9069152 --- /dev/null +++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java @@ -0,0 +1,139 @@ +package com.doumee.service.business.impl; + +import com.doumee.core.model.PageData; +import com.doumee.core.model.PageWrap; +import com.doumee.core.utils.Utils; +import com.doumee.dao.business.UserActionMapper; +import com.doumee.dao.business.model.UserAction; +import com.doumee.service.business.UserActionService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * 浜哄憳鎿嶄綔璁板綍鏃ュ織Service瀹炵幇 + * @author 姹熻箘韫� + * @date 2023/12/14 13:57 + */ +@Service +public class UserActionServiceImpl implements UserActionService { + + @Autowired + private UserActionMapper userActionMapper; + + @Override + public Integer create(UserAction userAction) { + userActionMapper.insert(userAction); + return userAction.getId(); + } + + @Override + public void deleteById(Integer id) { + userActionMapper.deleteById(id); + } + + @Override + public void delete(UserAction userAction) { + UpdateWrapper<UserAction> deleteWrapper = new UpdateWrapper<>(userAction); + userActionMapper.delete(deleteWrapper); + } + + @Override + public void deleteByIdInBatch(List<Integer> ids) { + if (CollectionUtils.isEmpty(ids)) { + return; + } + userActionMapper.deleteBatchIds(ids); + } + + @Override + public void updateById(UserAction userAction) { + userActionMapper.updateById(userAction); + } + + @Override + public void updateByIdInBatch(List<UserAction> userActions) { + if (CollectionUtils.isEmpty(userActions)) { + return; + } + for (UserAction userAction: userActions) { + this.updateById(userAction); + } + } + + @Override + public UserAction findById(Integer id) { + return userActionMapper.selectById(id); + } + + @Override + public UserAction findOne(UserAction userAction) { + QueryWrapper<UserAction> wrapper = new QueryWrapper<>(userAction); + return userActionMapper.selectOne(wrapper); + } + + @Override + public List<UserAction> findList(UserAction userAction) { + QueryWrapper<UserAction> wrapper = new QueryWrapper<>(userAction); + return userActionMapper.selectList(wrapper); + } + + @Override + public PageData<UserAction> findPage(PageWrap<UserAction> pageWrap) { + IPage<UserAction> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); + QueryWrapper<UserAction> queryWrapper = new QueryWrapper<>(); + Utils.MP.blankToNull(pageWrap.getModel()); + if (pageWrap.getModel().getId() != null) { + queryWrapper.lambda().eq(UserAction::getId, pageWrap.getModel().getId()); + } + if (pageWrap.getModel().getCreator() != null) { + queryWrapper.lambda().eq(UserAction::getCreator, pageWrap.getModel().getCreator()); + } + if (pageWrap.getModel().getCreateDate() != null) { + queryWrapper.lambda().ge(UserAction::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); + queryWrapper.lambda().le(UserAction::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); + } + if (pageWrap.getModel().getEditor() != null) { + queryWrapper.lambda().eq(UserAction::getEditor, pageWrap.getModel().getEditor()); + } + if (pageWrap.getModel().getEditDate() != null) { + queryWrapper.lambda().ge(UserAction::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); + queryWrapper.lambda().le(UserAction::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); + } + if (pageWrap.getModel().getIsdeleted() != null) { + queryWrapper.lambda().eq(UserAction::getIsdeleted, pageWrap.getModel().getIsdeleted()); + } + if (pageWrap.getModel().getRemark() != null) { + queryWrapper.lambda().eq(UserAction::getRemark, pageWrap.getModel().getRemark()); + } + if (pageWrap.getModel().getType() != null) { + queryWrapper.lambda().eq(UserAction::getType, pageWrap.getModel().getType()); + } + if (pageWrap.getModel().getMemberId() != null) { + queryWrapper.lambda().eq(UserAction::getMemberId, pageWrap.getModel().getMemberId()); + } + if (pageWrap.getModel().getBeforeStatus() != null) { + queryWrapper.lambda().eq(UserAction::getBeforeStatus, pageWrap.getModel().getBeforeStatus()); + } + for(PageWrap.SortData sortData: pageWrap.getSorts()) { + if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { + queryWrapper.orderByDesc(sortData.getProperty()); + } else { + queryWrapper.orderByAsc(sortData.getProperty()); + } + } + return PageData.from(userActionMapper.selectPage(page, queryWrapper)); + } + + @Override + public long count(UserAction userAction) { + QueryWrapper<UserAction> wrapper = new QueryWrapper<>(userAction); + return userActionMapper.selectCount(wrapper); + } +} diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java index 2ca62e8..5f9b1fa 100644 --- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java +++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java @@ -8,6 +8,7 @@ import com.doumee.core.haikang.model.param.request.event.acs.EventAcsInfoRequest; import com.doumee.core.haikang.model.param.request.event.acs.EventAcsRequest; import com.doumee.core.haikang.model.param.request.event.acs.EventDeviceDataRequest; +import com.doumee.core.haikang.model.param.request.event.parks.EventParkInfoRequest; import com.doumee.core.haikang.model.param.request.event.parks.EventParkRequest; import com.doumee.core.haikang.model.param.request.event.visit.EventVisitDataRequest; import com.doumee.core.haikang.model.param.request.event.visit.EventVisitInfoRequest; @@ -399,7 +400,23 @@ String result = null; log.info("銆愭捣搴峰仠杞﹀満浜嬩欢鎺ㄩ�併��========寮�濮�=========锛歕n"+JSONObject.toJSONString(param)); try { - + if(param == null || param.getParams() == null || param.getParams().getEvents()==null){ + return null; + } + //闂ㄧ浜嬩欢闆嗗悎 + List<EventParkInfoRequest> events = param.getParams().getEvents(); + List<CarEvent> list = new ArrayList<>(); + for(EventParkInfoRequest request : events){ + if(request.getData() ==null ||StringUtils.isBlank(request.getData().getPlateNo())){ + continue; + } + //灏佽浜嬩欢淇℃伅琛ㄥ璞� + list.add(getParkEventModelByRequest(request)); + } + if(list.size()>0){ + //鎻掑叆闂ㄧ璁板綍 + carEventMapper.insertBatchSomeColumn(list); + } log.error("銆愭捣搴峰仠杞﹀満浜嬩欢鎺ㄩ�併��========鎴愬姛======="); }catch (Exception e){ @@ -409,6 +426,13 @@ return null; } + private CarEvent getParkEventModelByRequest(EventParkInfoRequest request) { + CarEvent event = new CarEvent(); + + return event; + + } + private void saveInterfaceLog(Object param, String path,String result) { InterfaceLog hkMonitoryLogDO=new InterfaceLog(); hkMonitoryLogDO.setType(1); diff --git a/src/main/java/com/doumee/api/business/UserActionController.java b/src/main/java/com/doumee/api/business/UserActionController.java new file mode 100644 index 0000000..da861e5 --- /dev/null +++ b/src/main/java/com/doumee/api/business/UserActionController.java @@ -0,0 +1,90 @@ +package com.doumee.api.business; + +import com.doumee.api.BaseController; +import com.doumee.core.annotation.excel.ExcelExporter; +import com.doumee.core.annotation.pr.PreventRepeat; +import com.doumee.core.model.ApiResponse; +import com.doumee.core.model.PageWrap; +import com.doumee.core.model.PageData; +import com.doumee.dao.business.model.UserAction; +import com.doumee.service.business.UserActionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author 姹熻箘韫� + * @date 2023/12/14 13:55 + */ +@Api(tags = "浜哄憳鎿嶄綔璁板綍鏃ュ織") +@RestController +@RequestMapping("/business/userAction") +public class UserActionController extends BaseController { + + @Autowired + private UserActionService userActionService; + + @PreventRepeat + @ApiOperation("鏂板缓") + @PostMapping("/create") + @RequiresPermissions("business:useraction:create") + public ApiResponse create(@RequestBody UserAction userAction) { + return ApiResponse.success(userActionService.create(userAction)); + } + + @ApiOperation("鏍规嵁ID鍒犻櫎") + @GetMapping("/delete/{id}") + @RequiresPermissions("business:useraction:delete") + public ApiResponse deleteById(@PathVariable Integer id) { + userActionService.deleteById(id); + return ApiResponse.success(null); + } + + @ApiOperation("鎵归噺鍒犻櫎") + @GetMapping("/delete/batch") + @RequiresPermissions("business:useraction:delete") + public ApiResponse deleteByIdInBatch(@RequestParam String ids) { + String [] idArray = ids.split(","); + List<Integer> idList = new ArrayList<>(); + for (String id : idArray) { + idList.add(Integer.valueOf(id)); + } + userActionService.deleteByIdInBatch(idList); + return ApiResponse.success(null); + } + + @ApiOperation("鏍规嵁ID淇敼") + @PostMapping("/updateById") + @RequiresPermissions("business:useraction:update") + public ApiResponse updateById(@RequestBody UserAction userAction) { + userActionService.updateById(userAction); + return ApiResponse.success(null); + } + + @ApiOperation("鍒嗛〉鏌ヨ") + @PostMapping("/page") + @RequiresPermissions("business:useraction:query") + public ApiResponse<PageData<UserAction>> findPage (@RequestBody PageWrap<UserAction> pageWrap) { + return ApiResponse.success(userActionService.findPage(pageWrap)); + } + + @ApiOperation("瀵煎嚭Excel") + @PostMapping("/exportExcel") + @RequiresPermissions("business:useraction:exportExcel") + public void exportExcel (@RequestBody PageWrap<UserAction> pageWrap, HttpServletResponse response) { + ExcelExporter.build(UserAction.class).export(userActionService.findPage(pageWrap).getRecords(), "浜哄憳鎿嶄綔璁板綍鏃ュ織", response); + } + + @ApiOperation("鏍规嵁ID鏌ヨ") + @GetMapping("/{id}") + @RequiresPermissions("business:useraction:query") + public ApiResponse findById(@PathVariable Integer id) { + return ApiResponse.success(userActionService.findById(id)); + } +} diff --git a/src/main/java/com/doumee/dao/business/UserActionMapper.java b/src/main/java/com/doumee/dao/business/UserActionMapper.java new file mode 100644 index 0000000..0345734 --- /dev/null +++ b/src/main/java/com/doumee/dao/business/UserActionMapper.java @@ -0,0 +1,12 @@ +package com.doumee.dao.business; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.doumee.dao.business.model.UserAction; + +/** + * @author 姹熻箘韫� + * @date 2023/12/14 13:55 + */ +public interface UserActionMapper extends BaseMapper<UserAction> { + +} diff --git a/src/main/java/com/doumee/dao/business/model/UserAction.java b/src/main/java/com/doumee/dao/business/model/UserAction.java new file mode 100644 index 0000000..cbb4fc1 --- /dev/null +++ b/src/main/java/com/doumee/dao/business/model/UserAction.java @@ -0,0 +1,66 @@ +package com.doumee.dao.business.model; + +import com.doumee.core.annotation.excel.ExcelColumn; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; + +/** + * 浜哄憳鎿嶄綔璁板綍鏃ュ織 + * @author 姹熻箘韫� + * @date 2023/12/14 13:55 + */ +@Data +@ApiModel("浜哄憳鎿嶄綔璁板綍鏃ュ織") +@TableName("`user_action`") +public class UserAction { + + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "涓婚敭", example = "1") + @ExcelColumn(name="涓婚敭") + private Integer id; + + @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1") + @ExcelColumn(name="鍒涘缓浜虹紪鐮�") + private Integer creator; + + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + @ExcelColumn(name="鍒涘缓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createDate; + + @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1") + @ExcelColumn(name="鏇存柊浜虹紪鐮�") + private Integer editor; + + @ApiModelProperty(value = "鏇存柊鏃堕棿") + @ExcelColumn(name="鏇存柊鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date editDate; + + @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "1") + @ExcelColumn(name="鏄惁鍒犻櫎0鍚� 1鏄�") + private Integer isdeleted; + + @ApiModelProperty(value = "澶囨敞") + @ExcelColumn(name="澶囨敞") + private String remark; + + @ApiModelProperty(value = "绫诲瀷 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎", example = "1") + @ExcelColumn(name="绫诲瀷 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎") + private Integer type; + + @ApiModelProperty(value = "浜哄憳鎿嶄綔璁板綍鏃ュ織") + @ExcelColumn(name="浜哄憳鎿嶄綔璁板綍鏃ュ織") + private String memberId; + + @ApiModelProperty(value = "鎿嶄綔鍓嶇姸鎬� 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎", example = "1") + @ExcelColumn(name="鎿嶄綔鍓嶇姸鎬� 0瑙e喕 1鍐荤粨 2鎷夐粦 3鎭㈠ 4璁句负鎷滆浜� 5鍙栨秷鎷滆浜� 6璁句负楂樼骇瀹℃壒浜� 7鍙栨秷楂樼骇瀹℃壒浜� 8鎵嬪姩绂诲満 9鍒犻櫎") + private Integer beforeStatus; + +} diff --git a/src/main/java/com/doumee/service/business/UserActionService.java b/src/main/java/com/doumee/service/business/UserActionService.java new file mode 100644 index 0000000..355ee27 --- /dev/null +++ b/src/main/java/com/doumee/service/business/UserActionService.java @@ -0,0 +1,97 @@ +package com.doumee.service.business; + +import com.doumee.core.model.PageData; +import com.doumee.core.model.PageWrap; +import com.doumee.dao.business.model.UserAction; +import java.util.List; + +/** + * 浜哄憳鎿嶄綔璁板綍鏃ュ織Service瀹氫箟 + * @author 姹熻箘韫� + * @date 2023/12/14 13:55 + */ +public interface UserActionService { + + /** + * 鍒涘缓 + * + * @param userAction 瀹炰綋瀵硅薄 + * @return Integer + */ + Integer create(UserAction userAction); + + /** + * 涓婚敭鍒犻櫎 + * + * @param id 涓婚敭 + */ + void deleteById(Integer id); + + /** + * 鍒犻櫎 + * + * @param userAction 瀹炰綋瀵硅薄 + */ + void delete(UserAction userAction); + + /** + * 鎵归噺涓婚敭鍒犻櫎 + * + * @param ids 涓婚敭闆� + */ + void deleteByIdInBatch(List<Integer> ids); + + /** + * 涓婚敭鏇存柊 + * + * @param userAction 瀹炰綋瀵硅薄 + */ + void updateById(UserAction userAction); + + /** + * 鎵归噺涓婚敭鏇存柊 + * + * @param userActions 瀹炰綋闆� + */ + void updateByIdInBatch(List<UserAction> userActions); + + /** + * 涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return UserAction + */ + UserAction findById(Integer id); + + /** + * 鏉′欢鏌ヨ鍗曟潯璁板綍 + * + * @param userAction 瀹炰綋瀵硅薄 + * @return UserAction + */ + UserAction findOne(UserAction userAction); + + /** + * 鏉′欢鏌ヨ + * + * @param userAction 瀹炰綋瀵硅薄 + * @return List<UserAction> + */ + List<UserAction> findList(UserAction userAction); + + /** + * 鍒嗛〉鏌ヨ + * + * @param pageWrap 鍒嗛〉瀵硅薄 + * @return PageData<UserAction> + */ + PageData<UserAction> findPage(PageWrap<UserAction> pageWrap); + + /** + * 鏉′欢缁熻 + * + * @param userAction 瀹炰綋瀵硅薄 + * @return long + */ + long count(UserAction userAction); +} diff --git a/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java b/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java new file mode 100644 index 0000000..fc2e4af --- /dev/null +++ b/src/main/java/com/doumee/service/business/impl/UserActionServiceImpl.java @@ -0,0 +1,139 @@ +package com.doumee.service.business.impl; + +import com.doumee.core.model.PageData; +import com.doumee.core.model.PageWrap; +import com.doumee.core.utils.Utils; +import com.doumee.dao.business.UserActionMapper; +import com.doumee.dao.business.model.UserAction; +import com.doumee.service.business.UserActionService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * 浜哄憳鎿嶄綔璁板綍鏃ュ織Service瀹炵幇 + * @author 姹熻箘韫� + * @date 2023/12/14 13:55 + */ +@Service +public class UserActionServiceImpl implements UserActionService { + + @Autowired + private UserActionMapper userActionMapper; + + @Override + public Integer create(UserAction userAction) { + userActionMapper.insert(userAction); + return userAction.getId(); + } + + @Override + public void deleteById(Integer id) { + userActionMapper.deleteById(id); + } + + @Override + public void delete(UserAction userAction) { + UpdateWrapper<UserAction> deleteWrapper = new UpdateWrapper<>(userAction); + userActionMapper.delete(deleteWrapper); + } + + @Override + public void deleteByIdInBatch(List<Integer> ids) { + if (CollectionUtils.isEmpty(ids)) { + return; + } + userActionMapper.deleteBatchIds(ids); + } + + @Override + public void updateById(UserAction userAction) { + userActionMapper.updateById(userAction); + } + + @Override + public void updateByIdInBatch(List<UserAction> userActions) { + if (CollectionUtils.isEmpty(userActions)) { + return; + } + for (UserAction userAction: userActions) { + this.updateById(userAction); + } + } + + @Override + public UserAction findById(Integer id) { + return userActionMapper.selectById(id); + } + + @Override + public UserAction findOne(UserAction userAction) { + QueryWrapper<UserAction> wrapper = new QueryWrapper<>(userAction); + return userActionMapper.selectOne(wrapper); + } + + @Override + public List<UserAction> findList(UserAction userAction) { + QueryWrapper<UserAction> wrapper = new QueryWrapper<>(userAction); + return userActionMapper.selectList(wrapper); + } + + @Override + public PageData<UserAction> findPage(PageWrap<UserAction> pageWrap) { + IPage<UserAction> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); + QueryWrapper<UserAction> queryWrapper = new QueryWrapper<>(); + Utils.MP.blankToNull(pageWrap.getModel()); + if (pageWrap.getModel().getId() != null) { + queryWrapper.lambda().eq(UserAction::getId, pageWrap.getModel().getId()); + } + if (pageWrap.getModel().getCreator() != null) { + queryWrapper.lambda().eq(UserAction::getCreator, pageWrap.getModel().getCreator()); + } + if (pageWrap.getModel().getCreateDate() != null) { + queryWrapper.lambda().ge(UserAction::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); + queryWrapper.lambda().le(UserAction::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); + } + if (pageWrap.getModel().getEditor() != null) { + queryWrapper.lambda().eq(UserAction::getEditor, pageWrap.getModel().getEditor()); + } + if (pageWrap.getModel().getEditDate() != null) { + queryWrapper.lambda().ge(UserAction::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); + queryWrapper.lambda().le(UserAction::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); + } + if (pageWrap.getModel().getIsdeleted() != null) { + queryWrapper.lambda().eq(UserAction::getIsdeleted, pageWrap.getModel().getIsdeleted()); + } + if (pageWrap.getModel().getRemark() != null) { + queryWrapper.lambda().eq(UserAction::getRemark, pageWrap.getModel().getRemark()); + } + if (pageWrap.getModel().getType() != null) { + queryWrapper.lambda().eq(UserAction::getType, pageWrap.getModel().getType()); + } + if (pageWrap.getModel().getMemberId() != null) { + queryWrapper.lambda().eq(UserAction::getMemberId, pageWrap.getModel().getMemberId()); + } + if (pageWrap.getModel().getBeforeStatus() != null) { + queryWrapper.lambda().eq(UserAction::getBeforeStatus, pageWrap.getModel().getBeforeStatus()); + } + for(PageWrap.SortData sortData: pageWrap.getSorts()) { + if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { + queryWrapper.orderByDesc(sortData.getProperty()); + } else { + queryWrapper.orderByAsc(sortData.getProperty()); + } + } + return PageData.from(userActionMapper.selectPage(page, queryWrapper)); + } + + @Override + public long count(UserAction userAction) { + QueryWrapper<UserAction> wrapper = new QueryWrapper<>(userAction); + return userActionMapper.selectCount(wrapper); + } +} -- Gitblit v1.9.3