shudonghui 1 سال پیش
والد
کامیت
982c504b61

+ 5 - 4
sop-business/src/main/java/com/qmth/sop/business/bean/result/TBDelayWarnResult.java

@@ -6,6 +6,7 @@ import com.qmth.sop.business.entity.TBDelayWarn;
 import com.qmth.sop.common.base.BaseEntity;
 import com.qmth.sop.common.enums.DelayWarnStatusEnum;
 import com.qmth.sop.common.enums.DelayWarnTypeEnum;
+import com.qmth.sop.common.enums.ProductTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -16,7 +17,7 @@ import java.io.Serializable;
  * 延期预警跟进表
  * </p>
  *
- * @author wangliang
+ * @author dhshu
  * @since 2023-08-01
  */
 @ApiModel(value = "TBDelayWarnResult对象", description = "延期预警查询")
@@ -36,7 +37,7 @@ public class TBDelayWarnResult extends TBDelayWarn implements Serializable {
     private String custom;
 
     @ApiModelProperty(value = "客户类型")
-    private String customType;
+    private ProductTypeEnum customType;
 
     @ApiModelProperty(value = "项目名称")
     private String crmName;
@@ -65,11 +66,11 @@ public class TBDelayWarnResult extends TBDelayWarn implements Serializable {
         this.custom = custom;
     }
 
-    public String getCustomType() {
+    public ProductTypeEnum getCustomType() {
         return customType;
     }
 
-    public void setCustomType(String customType) {
+    public void setCustomType(ProductTypeEnum customType) {
         this.customType = customType;
     }
 

+ 91 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/TBViolationResult.java

@@ -0,0 +1,91 @@
+package com.qmth.sop.business.bean.result;
+
+import com.qmth.sop.business.entity.TBDelayWarn;
+import com.qmth.sop.business.entity.TBViolation;
+import com.qmth.sop.common.enums.ProductTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 延期预警跟进表
+ * </p>
+ *
+ * @author dhshu
+ * @since 2023-08-01
+ */
+@ApiModel(value = "TBViolationResult对象", description = "延期预警查询")
+public class TBViolationResult extends TBViolation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+
+
+    @ApiModelProperty(value = "服务单元")
+    private String service;
+
+    @ApiModelProperty(value = "负责人")
+    private String userName;
+
+    @ApiModelProperty(value = "客户名称")
+    private String custom;
+
+    @ApiModelProperty(value = "客户类型")
+    private ProductTypeEnum customType;
+
+    @ApiModelProperty(value = "项目名称")
+    private String crmName;
+
+    @ApiModelProperty(value = "登记人")
+    private String createName;
+
+    public String getService() {
+        return service;
+    }
+
+    public void setService(String service) {
+        this.service = service;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getCustom() {
+        return custom;
+    }
+
+    public void setCustom(String custom) {
+        this.custom = custom;
+    }
+
+    public ProductTypeEnum getCustomType() {
+        return customType;
+    }
+
+    public void setCustomType(ProductTypeEnum customType) {
+        this.customType = customType;
+    }
+
+    public String getCrmName() {
+        return crmName;
+    }
+
+    public void setCrmName(String crmName) {
+        this.crmName = crmName;
+    }
+
+    public String getCreateName() {
+        return createName;
+    }
+
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+}

+ 20 - 8
sop-business/src/main/java/com/qmth/sop/business/mapper/TBViolationMapper.java

@@ -1,16 +1,28 @@
 package com.qmth.sop.business.mapper;
 
-import com.qmth.sop.business.entity.TBViolation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.result.TBViolationResult;
+import com.qmth.sop.business.entity.TBViolation;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Param;
+import java.util.Map;
 
 /**
- * <p>
- * sop违规登记表 Mapper 接口
- * </p>
- *
- * @author wangliang
- * @since 2023-08-01
+ * sop违规登记表 Mapper 接口.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
 public interface TBViolationMapper extends BaseMapper<TBViolation> {
 
-}
+	/**
+	 * 查询列表
+	 * @param iPage
+	 * @return
+	 */
+    IPage<TBViolationResult> query(IPage<Map> iPage, @Param("serviceId")  Long serviceId, @Param("type")  String type, @Param("status")  String status, @Param("userId")  Long userId, @Param("custom")  String custom, @Param("sopNo")  String sopNo, @Param("createId")  Long createId, @Param("startTime")  Long startTime, @Param("endTime")  Long endTime, @Param("id")  Long id);
+}

+ 27 - 7
sop-business/src/main/java/com/qmth/sop/business/service/TBViolationDetailService.java

@@ -1,16 +1,36 @@
 package com.qmth.sop.business.service;
 
-import com.qmth.sop.business.entity.TBViolationDetail;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.TBViolationDetail;
+import java.util.Map;
 
 /**
- * <p>
  * 违规明细表 服务类
- * </p>
  *
- * @author wangliang
- * @since 2023-08-01
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
-public interface TBViolationDetailService extends IService<TBViolationDetail> {
+public interface TBViolationDetailService extends IService<TBViolationDetail>{
+
+
+    /**
+    * 新增修改违规明细表
+    *
+    * @param tBViolationDetail
+    */
+    Boolean saveTBViolationDetail(TBViolationDetail tBViolationDetail);
+
+
+    /**
+    * 删除违规明细表
+    *
+    * @param id
+    */
+    Boolean delete(Long id);
+
 
-}
+}

+ 40 - 7
sop-business/src/main/java/com/qmth/sop/business/service/TBViolationService.java

@@ -1,16 +1,49 @@
 package com.qmth.sop.business.service;
 
-import com.qmth.sop.business.entity.TBViolation;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.result.TBViolationResult;
+import com.qmth.sop.business.entity.TBViolation;
+import com.qmth.sop.common.enums.ViolationStatusEnum;
+import com.qmth.sop.common.enums.ViolationTypeEnum;
+
+import java.util.Map;
 
 /**
- * <p>
  * sop违规登记表 服务类
- * </p>
  *
- * @author wangliang
- * @since 2023-08-01
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
-public interface TBViolationService extends IService<TBViolation> {
+public interface TBViolationService extends IService<TBViolation>{
+
+    /**
+    * 查询列表
+    *
+    * @param iPage
+    * @return
+    */
+    IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type, ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime, Long endTime, Long id);
+
+    /**
+    * 新增修改sop违规登记表
+    *
+    * @param tBViolation
+    */
+    Boolean saveTBViolation(TBViolation tBViolation);
+
+
+    /**
+    * 删除sop违规登记表
+    *
+    * @param id
+    */
+    Boolean delete(Long id);
+
+
 
-}
+}

+ 2 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDelayWarnDetailServiceImpl.java

@@ -43,9 +43,9 @@ public class TBDelayWarnDetailServiceImpl extends ServiceImpl<TBDelayWarnDetailM
 		@Transactional
 		public Boolean saveTBDelayWarnDetail(TBDelayWarnDetail tBDelayWarnDetail) {
 			try {
-				//SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+				SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
 				if (Objects.isNull(tBDelayWarnDetail.getId())) {// 新增
-					tBDelayWarnDetail.setCreateId(1l);
+					tBDelayWarnDetail.setCreateId(sysUser.getId());
 					tBDelayWarnDetail.setCreateTime(System.currentTimeMillis());
 				} else { // 修改
 					//tBDelayWarnDetail.updateInfo(sysUser.getId());

+ 67 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBViolationDetailServiceImpl.java

@@ -1,20 +1,79 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.api.exception.ApiException;
 import com.qmth.sop.business.entity.TBViolationDetail;
+import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.mapper.TBViolationDetailMapper;
 import com.qmth.sop.business.service.TBViolationDetailService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.FieldUniqueEnum;
+import com.qmth.sop.common.util.ResultUtil;
+import com.qmth.sop.common.util.ServletUtil;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
 
 /**
- * <p>
- * 违规明细表 服务实现类
- * </p>
+ * 违规明细表 服务实现.
  *
- * @author wangliang
- * @since 2023-08-01
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
 @Service
-public class TBViolationDetailServiceImpl extends ServiceImpl<TBViolationDetailMapper, TBViolationDetail> implements TBViolationDetailService {
+public class TBViolationDetailServiceImpl extends ServiceImpl<TBViolationDetailMapper, TBViolationDetail> implements TBViolationDetailService{
+
+
+		/**
+		* 新增修改违规明细表
+		*
+		* @param tBViolationDetail
+		*/
+		@Override
+		@Transactional
+		public Boolean saveTBViolationDetail(TBViolationDetail tBViolationDetail) {
+			try {
+				SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+				if (Objects.isNull(tBViolationDetail.getId())) {// 新增
+					tBViolationDetail.setCreateId(sysUser.getId());
+					tBViolationDetail.setCreateTime(System.currentTimeMillis());
+				} else { // 修改
+//					tBViolationDetail.updateInfo(sysUser.getId());
+				}
+				return saveOrUpdate(tBViolationDetail);
+			} catch (Exception e) {
+				if (e instanceof DuplicateKeyException) {
+				String errorColumn = e.getCause().toString();
+				String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+				throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+				} else if (e instanceof ApiException) {
+				ResultUtil.error((ApiException) e, e.getMessage());
+				} else {
+				ResultUtil.error(e.getMessage());
+				}
+			}
+			return null;
+
+		}
+
+		/**
+		* 删除违规明细表
+		*
+		* @param id
+		*/
+		@Override
+		@Transactional
+		public Boolean delete(Long id) {
+			return this.removeById(id);
+		}
 
-}
+}

+ 79 - 7
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBViolationServiceImpl.java

@@ -1,20 +1,92 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.bean.result.TBViolationResult;
+import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.entity.TBViolation;
 import com.qmth.sop.business.mapper.TBViolationMapper;
 import com.qmth.sop.business.service.TBViolationService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.FieldUniqueEnum;
+import com.qmth.sop.common.enums.ViolationStatusEnum;
+import com.qmth.sop.common.enums.ViolationTypeEnum;
+import com.qmth.sop.common.util.ResultUtil;
+import com.qmth.sop.common.util.ServletUtil;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
+import java.util.Objects;
 
 /**
- * <p>
- * sop违规登记表 服务实现类
- * </p>
+ * sop违规登记表 服务实现.
  *
- * @author wangliang
- * @since 2023-08-01
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
 @Service
 public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBViolation> implements TBViolationService {
 
-}
+
+    /**
+     * 查询列表
+     *
+     * @param iPage
+     * @return
+     */
+
+
+    @Override
+    public IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type, ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime, Long endTime, Long id) {
+        return this.baseMapper.query(iPage,serviceId,Objects.nonNull(type)?type.name():null,Objects.nonNull(status)?status.name():null,userId,custom,sopNo,createId,startTime,endTime,id);
+    }
+
+    /**
+     * 新增修改sop违规登记表
+     *
+     * @param tBViolation
+     */
+    @Override
+    @Transactional
+    public Boolean saveTBViolation(TBViolation tBViolation) {
+        try {
+            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+            if (Objects.isNull(tBViolation.getId())) {// 新增
+                tBViolation.insertInfo(sysUser.getId());
+            } else { // 修改
+                tBViolation.updateInfo(sysUser.getId());
+            }
+            return saveOrUpdate(tBViolation);
+        } catch (Exception e) {
+            if (e instanceof DuplicateKeyException) {
+                String errorColumn = e.getCause().toString();
+                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+                throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+            } else if (e instanceof ApiException) {
+                ResultUtil.error((ApiException) e, e.getMessage());
+            } else {
+                ResultUtil.error(e.getMessage());
+            }
+        }
+        return null;
+
+    }
+
+    /**
+     * 删除sop违规登记表
+     *
+     * @param id
+     */
+    @Override
+    @Transactional
+    public Boolean delete(Long id) {
+        return this.removeById(id);
+    }
+
+}

+ 25 - 11
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -103,15 +103,29 @@ UPDATE `sys_privilege` SET `name` = '通知公告', `url` = 'notice', `type` = '
 
 ------------------------------
 -----2023.8.9延期预警
-INSERT INTO `sop_db`.`sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1013, '延期预警关闭', '/api/admin/tb/delay/warn/close', 'URL', 47, 1, 'AUTH', NULL, 1, 1, 0);
-INSERT INTO `sop_db`.`sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1014, '延期预警跟进', '/api/admin/tb/delay/warn/get', 'URL', 47, 2, 'AUTH', NULL, 1, 1, 0);
-INSERT INTO `sop_db`.`sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1015, '延期预警查询', '/api/admin/tb/delay/warn/query', 'URL', 47, 3, 'AUTH', NULL, 1, 1, 0);
-INSERT INTO `sop_db`.`sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1016, '延期预警重启', '/api/admin/tb/delay/warn/restart', 'URL', 47, 4, 'AUTH', NULL, 1, 1, 0);
-INSERT INTO `sop_db`.`sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1017, '延期预警跟进', '/api/admin/tb/delay/warn/detail/list', 'URL', 47, 5, 'AUTH', NULL, 1, 1, 0);
-INSERT INTO `sop_db`.`sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1018, '延期预警跟进', '/api/admin/tb/delay/warn/detail/save', 'URL', 47, 6, 'AUTH', NULL, 1, 1, 0);
-UPDATE `sop_db`.`sys_privilege` SET `name` = '列表', `url` = 'List', `type` = 'LIST', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = '1015', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 197;
-UPDATE `sop_db`.`sys_privilege` SET `name` = '查询条件', `url` = 'Condition', `type` = 'CONDITION', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 198;
-UPDATE `sop_db`.`sys_privilege` SET `name` = '查询', `url` = 'Select', `type` = 'BUTTON', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = '1015', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 199;
-UPDATE `sop_db`.`sys_privilege` SET `name` = '跟进', `url` = 'Follow', `type` = 'LINK', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = '1014,1017,1018', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 200;
-UPDATE `sop_db`.`sys_privilege` SET `name` = '关闭', `url` = 'Close', `type` = 'LINK', `parent_id` = 47, `sequence` = 2, `property` = 'AUTH', `related` = '1013', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 201;
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1013, '延期预警关闭', '/api/admin/tb/delay/warn/close', 'URL', 47, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1014, '延期预警跟进', '/api/admin/tb/delay/warn/get', 'URL', 47, 2, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1015, '延期预警查询', '/api/admin/tb/delay/warn/query', 'URL', 47, 3, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1016, '延期预警重启', '/api/admin/tb/delay/warn/restart', 'URL', 47, 4, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1017, '延期预警跟进', '/api/admin/tb/delay/warn/detail/list', 'URL', 47, 5, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1018, '延期预警跟进', '/api/admin/tb/delay/warn/detail/save', 'URL', 47, 6, 'AUTH', NULL, 1, 1, 0);
+UPDATE `sys_privilege` SET `name` = '列表', `url` = 'List', `type` = 'LIST', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = '1015', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 197;
+UPDATE `sys_privilege` SET `name` = '查询条件', `url` = 'Condition', `type` = 'CONDITION', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 198;
+UPDATE `sys_privilege` SET `name` = '查询', `url` = 'Select', `type` = 'BUTTON', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = '1015', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 199;
+UPDATE `sys_privilege` SET `name` = '跟进', `url` = 'Follow', `type` = 'LINK', `parent_id` = 47, `sequence` = 1, `property` = 'AUTH', `related` = '1014,1017,1018', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 200;
+UPDATE `sys_privilege` SET `name` = '关闭', `url` = 'Close', `type` = 'LINK', `parent_id` = 47, `sequence` = 2, `property` = 'AUTH', `related` = '1013', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 201;
+-------------------------------
+---2023.8.9 违规登记
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1019, '违规登记跟进', '/api/admin/tb/violation/detail/query', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1020, '违规登记跟进', '/api/admin/tb/violation/detail/save', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1021, '违规登记关闭', '/api/admin/tb/violation/close', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1022, '违规登记跟进', '/api/admin/tb/violation/get', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1023, '违规登记查询', '/api/admin/tb/violation/query', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1024, '违规登记重启', '/api/admin/tb/violation/restart', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1025, '违规登记保存', '/api/admin/tb/violation/save', 'URL', 48, 1, 'AUTH', NULL, 1, 1, 0);
+UPDATE `sys_privilege` SET `name` = '查询', `url` = 'Select', `type` = 'BUTTON', `parent_id` = 48, `sequence` = 1, `property` = 'AUTH', `related` = '1023', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 205;
+UPDATE `sys_privilege` SET `name` = '跟进', `url` = 'Follow', `type` = 'LINK', `parent_id` = 48, `sequence` = 1, `property` = 'AUTH', `related` = '1019,1020,1022', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 206;
+UPDATE `sys_privilege` SET `name` = '关闭', `url` = 'Close', `type` = 'LINK', `parent_id` = 48, `sequence` = 2, `property` = 'AUTH', `related` = '1021', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 207;
+UPDATE `sys_privilege` SET `name` = '重启', `url` = 'Restart', `type` = 'LINK', `parent_id` = 48, `sequence` = 3, `property` = 'AUTH', `related` = '1024', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 208;
+
 -------------------------------

+ 56 - 1
sop-business/src/main/resources/mapper/TBViolationMapper.xml

@@ -2,4 +2,59 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.TBViolationMapper">
 
-</mapper>
+    <select id="query" resultType="com.qmth.sop.business.bean.result.TBViolationResult">
+        SELECT
+        a.*,
+        s.NAME service,
+        u.real_name user_name,
+        sc.NAME custom,
+        sc.type custom_type,
+        c.NAME crm_name,
+        cu.real_name create_name
+        FROM
+        t_b_violation a
+        LEFT JOIN sys_user u ON u.id = a.user_id
+        LEFT JOIN sys_user cu ON cu.id = a.create_id
+        LEFT JOIN t_b_crm c ON c.crm_no = a.crm_no
+        LEFT JOIN sys_custom sc ON sc.id = c.custom_id
+        LEFT JOIN t_b_service s ON s.id = a.service_id
+        <where>
+            <if test="id != null and id != ''">
+                and a.id = #{id}
+            </if>
+            <if test="userId != null and userId != ''">
+                and a.user_id = #{userId}
+            </if>
+            <if test="createId != null and createId != ''">
+                and a.create_id = #{createId}
+            </if>
+            <if test="type != null and type != ''">
+                and a.type = #{type}
+            </if>
+            <if test="status != null and status != ''">
+                and a.status = #{status}
+            </if>
+            <if test="serviceId != null and serviceId != ''">
+                and a.service_id = #{serviceId}
+            </if>
+            <if test="custom != null and custom != ''">
+                and sc.name like concat('%', #{custom} , '%')
+            </if>
+            <if test="sopNo != null and sopNo != ''">
+                and a.sop_no like concat('%', #{sopNo} , '%')
+            </if>
+            <if test="startTime != null and startTime != '' ">
+                <![CDATA[
+               and a.warn_time >= #{startTime}
+               ]]>
+            </if>
+            <if test="endTime != null and endTime != ''">
+                <![CDATA[
+                and a.warn_time <= #{endTime}
+                ]]>
+            </if>
+        </where>
+
+        ORDER BY a.create_time DESC
+    </select>
+</mapper>

+ 2 - 0
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -140,6 +140,8 @@ public class SystemConstant {
     public static final String PREFIX_URL_ROLE = "/admin/role";
     public static final String PREFIX_URL_DELAY_WARN = "/admin/tb/delay/warn";
     public static final String PREFIX_URL_DELAY_WARN_DETAIL = "/admin/tb/delay/warn/detail";
+    public static final String PREFIX_URL_VIOLATION = "/admin/tb/violation";
+    public static final String PREFIX_URL_VIOLATION_DETAIL = "/admin/tb/violation/detail";
 
     /**
      * 缓存配置

+ 2 - 2
sop-server/src/main/java/com/qmth/sop/server/api/TBDelayWarnDetailController.java

@@ -35,7 +35,7 @@ public class TBDelayWarnDetailController {
     @Resource
     TBDelayWarnDetailService tBDelayWarnDetailService;
 
-    @Aac(auth = BOOL.FALSE)
+   
     @ApiOperation(value = "延期预警明细表查询接口")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "延期预警明细表查询结果", response = TBDelayWarnDetail.class)})
@@ -44,7 +44,7 @@ public class TBDelayWarnDetailController {
         return ResultUtil.ok(resultIPage);
     }
 
-    @Aac(auth = BOOL.FALSE)
+   
     @ApiOperation(value = "延期预警明细表新增修改接口")
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})

+ 100 - 11
sop-server/src/main/java/com/qmth/sop/server/api/TBViolationController.java

@@ -1,20 +1,109 @@
 package com.qmth.sop.server.api;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.annotation.BOOL;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.bean.result.TBViolationResult;
+import com.qmth.sop.business.entity.TBViolation;
+import com.qmth.sop.business.service.TBViolationService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ViolationStatusEnum;
+import com.qmth.sop.common.enums.ViolationTypeEnum;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
 
 /**
- * <p>
- * sop违规登记表 前端控制器
- * </p>
- *
- * @author wangliang
- * @since 2023-08-01
+ * sop违规登记表 控制器
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
+@Api(tags = "sop违规登记表 Controller")
 @RestController
-@RequestMapping("/t-bviolation")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX+SystemConstant.PREFIX_URL_VIOLATION)
+@Validated
 public class TBViolationController {
 
-}
+
+    @Resource
+    TBViolationService tBViolationService;
+
+   
+    @ApiOperation(value = "sop违规登记表查询接口")
+    @RequestMapping(value = "/query", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "sop违规登记表查询结果", response = TBViolationResult.class)})
+    public Result query(
+                @ApiParam(value = "服务单元", required = false) @RequestParam(required = false) Long serviceId,
+                @ApiParam(value = "违规类型", required = false) @RequestParam(required = false) ViolationTypeEnum type,
+                @ApiParam(value = "跟进状态", required = false) @RequestParam(required = false) ViolationStatusEnum status,
+                @ApiParam(value = "节点负责人", required = false) @RequestParam(required = false) Long userId,
+                @ApiParam(value = "客户名称(模糊查询)", required = false) @RequestParam(required = false) String custom,
+                @ApiParam(value = "SOP流水号(模糊查询)", required = false) @RequestParam(required = false) String sopNo,
+                @ApiParam(value = "登记人", required = false) @RequestParam(required = false) Long createId,
+                @ApiParam(value = "登记时间开始", required = false) @RequestParam(required = false) Long startTime,
+                @ApiParam(value = "登记时间结束", required = false) @RequestParam(required = false) Long endTime,
+                @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        IPage<TBViolationResult> resultIPage = tBViolationService.query(new Page<>(pageNumber, pageSize),serviceId,type,status,userId,custom,sopNo,createId,startTime,endTime,null);
+
+        return ResultUtil.ok(resultIPage);
+    }
+
+
+
+   
+    @ApiOperation(value = "sop违规登记表新增修改接口")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result save(@ApiParam(value = "sop违规登记表信息", required = true) @RequestBody(required = true) TBViolation tBViolation) {
+        return ResultUtil.ok(tBViolationService.saveTBViolation(tBViolation));
+    }
+
+
+    //关闭违规登记
+   
+    @ApiOperation(value = "关闭违规登记")
+    @RequestMapping(value = "/close", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "关闭成功")})
+    public Result close(@ApiParam(value = "违规登记id", required = true) @RequestParam(required = true) long id) {
+        TBViolation  tBViolation = tBViolationService.getById(id);
+        tBViolation.setStatus(ViolationStatusEnum.CLOSE);
+        return ResultUtil.ok(tBViolationService.saveTBViolation(tBViolation));
+    }
+
+    //重启违规登记
+   
+    @ApiOperation(value = "重启违规登记")
+    @RequestMapping(value = "/restart", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "重启成功")})
+    public Result restart(@ApiParam(value = "违规登记id", required = true) @RequestParam(required = true) long id) {
+        TBViolation  tBViolation = tBViolationService.getById(id);
+        tBViolation.setStatus(ViolationStatusEnum.RESTART);
+        return ResultUtil.ok(tBViolationService.saveTBViolation(tBViolation));
+    }
+
+
+
+   
+    @ApiOperation(value = "sop违规登记表获取单个接口")
+    @RequestMapping(value = "/get", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "sop违规登记表信息", response = TBViolationResult.class)})
+    public Result get(@ApiParam(value = "sop违规登记表id", required = true) @RequestParam long id) {
+        IPage<TBViolationResult> resultIPage = tBViolationService.query(new Page<>(1, 1),null,null,null,null,null,null,null,null,null,null);
+        return ResultUtil.ok(resultIPage.getRecords().get(0));
+    }
+
+
+}

+ 57 - 12
sop-server/src/main/java/com/qmth/sop/server/api/TBViolationDetailController.java

@@ -1,20 +1,65 @@
 package com.qmth.sop.server.api;
 
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.annotation.BOOL;
+import com.qmth.sop.business.bean.result.EditResult;
+import com.qmth.sop.business.entity.TBDelayWarnDetail;
+import com.qmth.sop.business.entity.TBViolationDetail;
+import com.qmth.sop.business.service.TBViolationDetailService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.util.CollectionUtils; 
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.util.List;
+import java.util.Objects;
 
 /**
- * <p>
- * 违规明细表 前端控制器
- * </p>
- *
- * @author wangliang
- * @since 2023-08-01
+ * 违规明细表 控制器
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-09 10:33:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
  */
+@Api(tags = "违规明细表 Controller")
 @RestController
-@RequestMapping("/t-bviolation-detail")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX+SystemConstant.PREFIX_URL_VIOLATION_DETAIL)
+@Validated
 public class TBViolationDetailController {
 
-}
+
+    @Resource
+    TBViolationDetailService tBViolationDetailService;
+
+   
+    @ApiOperation(value = "违规明细表查询接口")
+    @RequestMapping(value = "/query", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "违规明细表查询结果", response = TBViolationDetail.class)})
+    public Result query(@ApiParam(value = "sop违规登记表id", required = true) @RequestParam long id) {
+
+        List<TBViolationDetail> resultIPage = tBViolationDetailService.list(new QueryWrapper<TBViolationDetail>().lambda().eq(TBViolationDetail::getViolationId, id).orderByDesc(TBViolationDetail::getCreateTime));
+        return ResultUtil.ok(resultIPage);
+    }
+
+   
+    @ApiOperation(value = "违规明细表新增修改接口")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result save(@ApiParam(value = "违规明细表信息", required = true) @RequestBody(required = true) TBViolationDetail tBViolationDetail) {
+        return ResultUtil.ok(tBViolationDetailService.saveTBViolationDetail(tBViolationDetail));
+    }
+
+
+
+}