|
@@ -0,0 +1,212 @@
|
|
|
+/**
|
|
|
+# __----~~~~~~~~~~~------___
|
|
|
+# . . ~~//====...... __--~ ~~
|
|
|
+# -. \_|// |||\\ ~~~~~~::::... /~
|
|
|
+# ___-==_ _-~o~ \/ ||| \\ _/~~-
|
|
|
+# __---~~~.==~||\=_ -_--~/_-~|- |\\ \\ _/~
|
|
|
+# _-~~ .=~ | \\-_ '-~7 /- / || \ /
|
|
|
+# .~ .~ | \\ -_ / /- / || \ /
|
|
|
+# / ____ / | \\ ~-_/ /|- _/ .|| \ /
|
|
|
+# |~~ ~~|--~~~~--_ \ ~==-/ | \~--===~~ .\
|
|
|
+# ' ~-| /| |-~\~~ __--~~
|
|
|
+# |-~~-_/ | | ~\_ _-~ /\
|
|
|
+# / \ \__ \/~ \__
|
|
|
+# _--~ _/ | .-~~____--~-/ ~~==.
|
|
|
+# ((->/~ '.|||' -_| ~~-/ , . _||
|
|
|
+# -_ ~\ ~~---l__i__i__i--~~_/
|
|
|
+# _-~-__ ~) \--______________--~~
|
|
|
+# //.-~~~-~_--~- |-------~~~~~~~~
|
|
|
+# //.-~~~--\
|
|
|
+# 神兽保佑
|
|
|
+# 永无BUG!
|
|
|
+*/
|
|
|
+package com.customs.cq.datacenter.business.service;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.customs.cq.datacenter.common.*;
|
|
|
+import com.customs.cq.datacenter.common.enums.EYesOrNo;
|
|
|
+import com.customs.cq.datacenter.common.model.Tuple;
|
|
|
+import com.customs.cq.datacenter.common.utils.*;
|
|
|
+import com.customs.cq.datacenter.common.core.service.BasicService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+import com.customs.cq.datacenter.business.mapper.impl.CheckFormGridCycleMapperImpl;
|
|
|
+import com.customs.cq.datacenter.business.entity.request.checkformgridcycle.ReqCreateCheckFormGridCycle;
|
|
|
+import com.customs.cq.datacenter.business.entity.request.checkformgridcycle.ReqModifyCheckFormGridCycle;
|
|
|
+import com.customs.cq.datacenter.business.entity.search.SearchCheckFormGridCycle;
|
|
|
+import com.customs.cq.datacenter.business.domain.CheckFormGridCyclePO;
|
|
|
+import com.customs.cq.datacenter.business.domain.vo.CheckFormGridCycleVO;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 检查表-网格-频率设置
|
|
|
+ * @author lin.liu
|
|
|
+ * @description 检查表-网格-频率设置
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class CheckFormGridCycleService extends BasicService {
|
|
|
+ @Autowired
|
|
|
+ private CheckFormGridCycleMapperImpl dao;
|
|
|
+
|
|
|
+ public ExecutedResult<Long> create(ReqCreateCheckFormGridCycle request) {
|
|
|
+ // 转换po
|
|
|
+ CheckFormGridCyclePO item = CopierUtil.mapTo(request, CheckFormGridCyclePO.class);
|
|
|
+ // 设置主键
|
|
|
+ item.setId(SnowFlakeUtil.getId());
|
|
|
+ // 设置状态
|
|
|
+ //item.setStatus(EState.NORMAL.getValue());
|
|
|
+ // 设置记录创建时间
|
|
|
+ item.setCreateTime(LocalDateTimeUtil.nowTimeStamp());
|
|
|
+ // 是否删除(逻辑删除)初始值
|
|
|
+ item.setIsDelete(EYesOrNo.NO.getValue());
|
|
|
+
|
|
|
+ int result = this.dao.insert(item);
|
|
|
+ if (result != 1) {
|
|
|
+ return ExecutedResult.failed("创建[检查表-网格-频率设置]失败。");
|
|
|
+ }
|
|
|
+ return ExecutedResult.success(item.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ public ExecutedResult<String> modify(ReqModifyCheckFormGridCycle request) {
|
|
|
+ // 验证记录是否存在
|
|
|
+ ExecutedResult<CheckFormGridCyclePO> checkExists = this.check4Id(request.getId());
|
|
|
+ if (checkExists.isFailed()) {
|
|
|
+ return ExecutedResult.failed(checkExists.getMsg());
|
|
|
+ }
|
|
|
+ // 转换po
|
|
|
+ CheckFormGridCyclePO item = CopierUtil.mapTo(request, CheckFormGridCyclePO.class);
|
|
|
+
|
|
|
+ int result = this.dao.updateById(item);
|
|
|
+ if (result != 1) {
|
|
|
+ return ExecutedResult.failed("编辑[检查表-网格-频率设置]失败。");
|
|
|
+ }
|
|
|
+ return ExecutedResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ public ExecutedResult<CheckFormGridCycleVO> get(Long id) {
|
|
|
+ CheckFormGridCycleVO result = new CheckFormGridCycleVO();
|
|
|
+
|
|
|
+ CheckFormGridCyclePO find = dao.selectById(id);
|
|
|
+ if (null != find) {
|
|
|
+ result = CopierUtil.mapTo(find, CheckFormGridCycleVO.class);
|
|
|
+ }
|
|
|
+ return ExecutedResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+// public ExecutedResult<String> stop(Long id) {
|
|
|
+// // 验证记录是否存在
|
|
|
+// ExecutedResult<CheckFormGridCyclePO> checkExists = this.check4Id(id);
|
|
|
+// if (checkExists.isFailed()) {
|
|
|
+// return ExecutedResult.failed(checkExists.getMsg());
|
|
|
+// }
|
|
|
+// CheckFormGridCyclePO item = new CheckFormGridCyclePO();
|
|
|
+// item.setId(id);
|
|
|
+// item.setStatus(EState.DISABLED.getValue());
|
|
|
+//
|
|
|
+// int result = this.dao.updateById(item);
|
|
|
+// if (result != 1) {
|
|
|
+// return ExecutedResult.failed("停用[检查表-网格-频率设置]失败。");
|
|
|
+// }
|
|
|
+// return ExecutedResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// public ExecutedResult<String> enable(Long id) {
|
|
|
+// // 验证记录是否存在
|
|
|
+// ExecutedResult<CheckFormGridCyclePO> checkExists = this.check4Id(id);
|
|
|
+// if (checkExists.isFailed()) {
|
|
|
+// return ExecutedResult.failed(checkExists.getMsg());
|
|
|
+// }
|
|
|
+// CheckFormGridCyclePO item = new CheckFormGridCyclePO();
|
|
|
+// item.setId(id);
|
|
|
+// item.setStatus(EState.NORMAL.getValue());
|
|
|
+//
|
|
|
+// int result = this.dao.updateById(item);
|
|
|
+// if (result != 1) {
|
|
|
+// return ExecutedResult.failed("启用[检查表-网格-频率设置]失败。");
|
|
|
+// }
|
|
|
+// return ExecutedResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// public ExecutedResult<String> setSort(ReqSetSort request) {
|
|
|
+// // 验证记录是否存在
|
|
|
+// ExecutedResult<CheckFormGridCyclePO> checkExists = this.check4Id(request.getId());
|
|
|
+// if (checkExists.isFailed()) {
|
|
|
+// return ExecutedResult.failed(checkExists.getMsg());
|
|
|
+// }
|
|
|
+// CheckFormGridCyclePO item = new CheckFormGridCyclePO();
|
|
|
+// item.setId(request.getId());
|
|
|
+// item.setSort(request.getSort());
|
|
|
+//
|
|
|
+// int result = this.dao.updateById(item);
|
|
|
+// if (result != 1) {
|
|
|
+// return ExecutedResult.failed("设置[检查表-网格-频率设置]排序值失败。");
|
|
|
+// }
|
|
|
+// return ExecutedResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// public ExecutedResult<String> remove(Long id) {
|
|
|
+// // 验证记录是否存在
|
|
|
+// ExecutedResult<CheckFormGridCyclePO> checkExists = this.check4Id(request.getId());
|
|
|
+// if (checkExists.isFailed()) {
|
|
|
+// return ExecutedResult.failed(checkExists.getMsg());
|
|
|
+// }
|
|
|
+// CheckFormGridCyclePO item = new CheckFormGridCyclePO();
|
|
|
+// item.setId(request.getId());
|
|
|
+// item.setIsDelete(EYesOrNo.Yes.getValue());
|
|
|
+//
|
|
|
+// int result = this.dao.updateById(item);
|
|
|
+// if (result != 1) {
|
|
|
+// return ExecutedResult.failed("设置[检查表-网格-频率设置]排序值失败。");
|
|
|
+// }
|
|
|
+// return ExecutedResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// public ExecutedResult<String> removeList(List<Long> ids) {
|
|
|
+// Boolean result = this.dao.removeByListId(ids);
|
|
|
+// if (BooleanUtils.isFalse(result)) {
|
|
|
+// return ExecutedResult.failed("删除[检查表-网格-频率设置]失败。");
|
|
|
+// }
|
|
|
+// return ExecutedResult.success();
|
|
|
+// }
|
|
|
+
|
|
|
+ public ExecutedResult<List<CheckFormGridCycleVO>> getList(List<Long> listId) {
|
|
|
+ List<CheckFormGridCycleVO> result = new ArrayList<>();
|
|
|
+
|
|
|
+ List<CheckFormGridCyclePO> list = this.dao.selectBatchIds(listId);
|
|
|
+ if (ListUtil.isNotNullOrEmpty(list)) {
|
|
|
+ result = CopierUtil.mapTo(list, CheckFormGridCycleVO.class);
|
|
|
+ }
|
|
|
+ return ExecutedResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ExecutedResult<PagerResult<CheckFormGridCycleVO>> search(SearchCheckFormGridCycle search) {
|
|
|
+ // 处理创建时间范围-查询参数
|
|
|
+ Tuple<String, String> createTimeRange = ParameterUtil.getTimeRange(search.getCreateTimeRange());
|
|
|
+ if (StringUtil.isNotNullOrEmpty(createTimeRange.getItem1())) {
|
|
|
+ search.setCreateTimeStart(LocalDateTimeUtil.getTimeStamp(createTimeRange.getItem1()).getTime());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotNullOrEmpty(createTimeRange.getItem2())) {
|
|
|
+ search.setCreateTimeEnd(LocalDateTimeUtil.getTimeStamp(createTimeRange.getItem2()).getTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<CheckFormGridCyclePO> pageList = dao.search(search);
|
|
|
+ List<CheckFormGridCycleVO> listVo = new ArrayList<>();
|
|
|
+ List<CheckFormGridCyclePO> list = pageList.getRecords();
|
|
|
+ if (ListUtil.isNotNullOrEmpty(list)) {
|
|
|
+ // 转换vo
|
|
|
+ listVo = CopierUtil.mapTo(list, CheckFormGridCycleVO.class);
|
|
|
+ }
|
|
|
+ PagerResult<CheckFormGridCycleVO> result = new PagerResult<>(pageList.getSize(), pageList.getCurrent(), pageList.getTotal(), listVo);
|
|
|
+ return ExecutedResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected ExecutedResult<CheckFormGridCyclePO> check4Id(Long id) {
|
|
|
+ CheckFormGridCyclePO exists = dao.selectById(id);
|
|
|
+ if (Objects.isNull(exists)) {
|
|
|
+ return ExecutedResult.failed("[检查表-网格-频率设置]不存在:" + id);
|
|
|
+ }
|
|
|
+ return ExecutedResult.success(exists);
|
|
|
+ }
|
|
|
+}
|