shudonghui 1 gadu atpakaļ
vecāks
revīzija
5bc217b0df

+ 3 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBViolationMapper.java

@@ -24,5 +24,7 @@ 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);
+    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);
+
+	TBViolationResult getByCode(@Param("code")  String code);
 }

+ 3 - 2
sop-business/src/main/java/com/qmth/sop/business/service/TBViolationService.java

@@ -27,7 +27,7 @@ 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);
+    IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type, ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime, Long endTime);
 
     /**
     * 新增修改sop违规登记表
@@ -45,5 +45,6 @@ public interface TBViolationService extends IService<TBViolation>{
     Boolean delete(Long id);
 
 
-    TBViolationResult get(long id);
+
+    TBViolationResult getByCode(String code);
 }

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

@@ -59,8 +59,8 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
 
 
     @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);
+    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) {
+        return this.baseMapper.query(iPage, serviceId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(status) ? status.name() : null, userId, custom, sopNo, createId, startTime, endTime);
     }
 
     /**
@@ -74,10 +74,10 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
         try {
              SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             if (Objects.isNull(tBViolation.getId())) {// 新增
-                tBViolation.setCode(sequenceService.createCode("violationFlow"));
+                tBViolation.setCode(sequenceService.createCode("violationWarn"));
                 tBViolation.insertInfo(sysUser.getId());
                 saveOrUpdate(tBViolation);
-                TBViolationResult tbViolationResult = get(tBViolation.getId());
+                TBViolationResult tbViolationResult = getByCode(tBViolation.getCode());
 
 //                String content = MessageEnum.NOTICE_OF_VIOLATION_REMIND.getTemplate();
 //                content = content.replaceAll("\\$\\{userName\\}", tbViolationResult.getUserName());
@@ -130,11 +130,11 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
         return this.removeById(id);
     }
 
+
     @Override
-    public TBViolationResult get(long id) {
-        IPage<TBViolationResult> resultIPage = this.query(new Page<>(1, 1), null, null, null, null, null, null, null, null, null,id);
-        TBViolationResult tbViolationResult = resultIPage.getRecords().get(0);
-        List<TBViolationDetail> TBViolationDetails = tbViolationDetailService.list(new QueryWrapper<TBViolationDetail>().lambda().eq(TBViolationDetail::getViolationId, id).orderByDesc(TBViolationDetail::getCreateTime));
+    public TBViolationResult getByCode(String code) {
+        TBViolationResult tbViolationResult = this.baseMapper.getByCode(code);
+        List<TBViolationDetail> TBViolationDetails = tbViolationDetailService.list(new QueryWrapper<TBViolationDetail>().lambda().eq(TBViolationDetail::getViolationId, tbViolationResult.getId()).orderByDesc(TBViolationDetail::getCreateTime));
         tbViolationResult.setTbViolationDetails(TBViolationDetails);
         return tbViolationResult;
     }

+ 4 - 1
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -231,4 +231,7 @@ VALUES
 ---20023.8.24
 ALTER TABLE `t_b_violation`
     ADD COLUMN `code` varchar(200) CHARACTER SET utf8mb4 NOT NULL COMMENT '编号' AFTER `sop_no`;
-INSERT INTO `sequence` (`name`, `current_value`, `increment`) VALUES ('violationWarn', 0, 1);
+INSERT INTO `sequence` (`name`, `current_value`, `increment`) VALUES ('violationWarn', 0, 1);
+UPDATE sys_config
+SET org_id=NULL, config_key='sms.violation.remind.code', config_name='违规提醒通知', config_value='SMS_462760649', remark=NULL, enable=1, sort=1, create_id=1, create_time=NULL, update_id=NULL, update_time=NULL
+WHERE id=31;

+ 1 - 3
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -739,6 +739,4 @@ WHERE id=25;
 UPDATE sys_config
 SET org_id=NULL, config_key='sms.flow.project.exchange.finish.code', config_name='系统计划变更审核通知', config_value='SMS_462680680', remark=NULL, enable=1, sort=1, create_id=1, create_time=NULL, update_id=NULL, update_time=NULL
 WHERE id=28;
-UPDATE sys_config
-SET org_id=NULL, config_key='sms.violation.remind.code', config_name='违规提醒通知', config_value='SMS_462805303', remark=NULL, enable=1, sort=1, create_id=1, create_time=NULL, update_id=NULL, update_time=NULL
-WHERE id=31;
+UPDATE sys_config

+ 26 - 3
sop-business/src/main/resources/mapper/TBViolationMapper.xml

@@ -20,9 +20,6 @@
         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>
@@ -58,4 +55,30 @@
 
         ORDER BY a.create_time DESC
     </select>
+
+    <select id="getByCode" resultType="com.qmth.sop.business.bean.result.TBViolationResult">
+        SELECT
+        a.*,
+        s.NAME service,
+        u.real_name user_name,
+        u.mobile_number,
+        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="code != null and code != ''">
+                and a.code = #{code}
+            </if>
+        </where>
+
+        ORDER BY a.create_time DESC
+    </select>
 </mapper>

+ 10 - 5
sop-server/src/main/java/com/qmth/sop/server/api/TBViolationController.java

@@ -55,12 +55,12 @@ public class TBViolationController {
             @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);
+        IPage<TBViolationResult> resultIPage = tBViolationService.query(new Page<>(pageNumber, pageSize), serviceId, type, status, userId, custom, sopNo, createId, startTime, endTime);
 
         return ResultUtil.ok(resultIPage);
     }
 
-
+//    @Aac(auth=false)
     @ApiOperation(value = "sop违规登记表新增修改接口")
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
@@ -95,12 +95,17 @@ public class TBViolationController {
     }
 
 
+
+    //根据code的获取详细信息
     @ApiOperation(value = "sop违规登记表获取单个接口")
-    @RequestMapping(value = "/get", method = RequestMethod.GET)
+    @RequestMapping(value = "/getByCode", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "sop违规登记表信息", response = TBViolationResult.class)})
-    public Result get(@ApiParam(value = "sop违规登记表id", required = true) @RequestParam long id) {
-        return ResultUtil.ok(tBViolationService.get(id));
+    public Result getByCode(@ApiParam(value = "sop违规登记表code", required = true) @RequestParam String code) {
+        return ResultUtil.ok(tBViolationService.getByCode(code));
     }
 
 
+
+
+
 }