暂降治理一期工作内容
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package com.njcn.advance.controller.govern.voltage;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgEventParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgEventVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgEventService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@Api(tags = "暂降治理暂降数据控制器")
|
||||
@RequestMapping("/voltage/sgEvent")
|
||||
@RequiredArgsConstructor
|
||||
public class SgEventController extends BaseController {
|
||||
|
||||
private final ISgEventService sgEventService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询指定生产线的暂降数据")
|
||||
@ApiImplicitParam(name = "sgEventParamQueryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<SgEventVO>> list(@RequestBody SgEventParam.SgEventParamQueryParam sgEventParamQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sgEventParamQueryParam);
|
||||
Page<SgEventVO> result = sgEventService.sgEventList(sgEventParamQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.njcn.advance.controller.govern.voltage;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.IncomingLineParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.IncomingLineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@Api(tags = "暂降治理业务进线控制器")
|
||||
@RestController
|
||||
@RequestMapping("/sgIncomingLine")
|
||||
@RequiredArgsConstructor
|
||||
public class SgIncomingLineController extends BaseController {
|
||||
|
||||
private final ISgIncomingLineService sgIncomingLineService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询用户的进线数据")
|
||||
public HttpResult<List<IncomingLineVO>> list(String userId) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, userId);
|
||||
List<IncomingLineVO> result = sgIncomingLineService.incomingLineList(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增业务用户的进线")
|
||||
@ApiImplicitParam(name = "incomingLineParam", value = "进线数据", required = true)
|
||||
public HttpResult<String> add(@RequestBody @Validated IncomingLineParam incomingLineParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},进线数据为:{}", methodDescribe, incomingLineParam);
|
||||
String lineId = sgIncomingLineService.addIncomingLine(incomingLineParam);
|
||||
if (StrUtil.isNotBlank(lineId)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineId, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新业务用户的进线数据")
|
||||
@ApiImplicitParam(name = "updateParam", value = "进线数据", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated IncomingLineParam.IncomingLineUpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},进线数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = sgIncomingLineService.updateIncomingLine(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除业务用户的进线")
|
||||
@ApiImplicitParam(name = "ids", value = "进线索引", required = true, dataTypeClass = List.class)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},进线ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = sgIncomingLineService.deleteIncomingLineData(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.njcn.advance.controller.govern.voltage;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgUserService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.param.DictDataParam;
|
||||
import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 暂降治理业务用户控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@Api(tags = "暂降治理业务用户控制器")
|
||||
@RequestMapping("/sgUser")
|
||||
@RequiredArgsConstructor
|
||||
public class SgUserController extends BaseController {
|
||||
|
||||
private final ISgUserService sgUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询用户数据")
|
||||
@ApiImplicitParam(name = "sgUserQueryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<SgUserVO>> list(@RequestBody SgUserParam.SgUserQueryParam sgUserQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sgUserQueryParam);
|
||||
Page<SgUserVO> result = sgUserService.sgUserList(sgUserQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增业务用户")
|
||||
@ApiImplicitParam(name = "sgUserParam", value = "用户数据", required = true)
|
||||
public HttpResult<String> add(@RequestBody @Validated SgUserParam sgUserParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, sgUserParam);
|
||||
String userId = sgUserService.addUserInfo(sgUserParam);
|
||||
if (StrUtil.isNotBlank(userId)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userId, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新业务用户")
|
||||
@ApiImplicitParam(name = "updateParam", value = "用户数据", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated SgUserParam.SgUserUpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = sgUserService.updateSgUser(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除业务用户")
|
||||
@ApiImplicitParam(name = "ids", value = "用户索引", required = true, dataTypeClass = List.class)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},业务用户ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = sgUserService.deleteSgUserData(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.advance.mapper.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgEvent;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
public interface SgEventMapper extends BaseMapper<SgEvent> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.advance.mapper.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.IncomingLineVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
public interface SgIncomingLineMapper extends BaseMapper<SgIncomingLine> {
|
||||
|
||||
List<IncomingLineVO> queryLineByUserId(@Param("userId")String userId);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.advance.mapper.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
public interface SgUserMapper extends BaseMapper<SgUser> {
|
||||
|
||||
Page<SgUserVO> page(@Param("page")Page<SgUserVO> objectPage, @Param("ew") QueryWrapper<SgUserVO> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.govern.voltage.SgEventMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.govern.voltage.SgIncomingLineMapper">
|
||||
|
||||
<select id="queryLineByUserId" resultType="IncomingLineVO">
|
||||
SELECT
|
||||
sg_incoming_line.*,
|
||||
pq_line.NAME lineName
|
||||
FROM
|
||||
sg_incoming_line sg_incoming_line,
|
||||
pq_line pq_line
|
||||
WHERE
|
||||
sg_incoming_line.line_id = pq_line.id
|
||||
AND sg_incoming_line.state = 1
|
||||
AND sg_incoming_line.user_id = #{userId}
|
||||
ORDER BY sg_incoming_line.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.govern.voltage.SgUserMapper">
|
||||
|
||||
|
||||
<!--获取字典分页列表-->
|
||||
<select id="page" resultType="SgUserVO">
|
||||
SELECT sg_user.*
|
||||
FROM sg_user sg_user
|
||||
WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.advance.service.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgEventParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgEvent;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgEventVO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
public interface ISgEventService extends IService<SgEvent> {
|
||||
|
||||
Page<SgEventVO> sgEventList(SgEventParam.SgEventParamQueryParam sgEventParamQueryParam);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.advance.service.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.IncomingLineParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.IncomingLineVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
public interface ISgIncomingLineService extends IService<SgIncomingLine> {
|
||||
|
||||
List<IncomingLineVO> incomingLineList(String userId);
|
||||
|
||||
String addIncomingLine(IncomingLineParam incomingLineParam);
|
||||
|
||||
boolean updateIncomingLine(IncomingLineParam.IncomingLineUpdateParam updateParam);
|
||||
|
||||
boolean deleteIncomingLineData(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.advance.service.govern.voltage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
public interface ISgUserService extends IService<SgUser> {
|
||||
|
||||
Page<SgUserVO> sgUserList(SgUserParam.SgUserQueryParam sgUserQueryParam);
|
||||
|
||||
String addUserInfo(SgUserParam sgUserParam);
|
||||
|
||||
boolean updateSgUser(SgUserParam.SgUserUpdateParam updateParam);
|
||||
|
||||
boolean deleteSgUserData(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.advance.service.govern.voltage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgEventMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgEventParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgEvent;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgEventVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgEventService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Service
|
||||
public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> implements ISgEventService {
|
||||
|
||||
/**
|
||||
* 根据查询条件返回分页的暂降数据
|
||||
* @param sgEventParamQueryParam 查询条件
|
||||
*/
|
||||
@Override
|
||||
public Page<SgEventVO> sgEventList(SgEventParam.SgEventParamQueryParam sgEventParamQueryParam) {
|
||||
//暂降数据实际跟进线耦合的,需要根据所传的生产线获取进线id
|
||||
String productId = sgEventParamQueryParam.getProductId();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.njcn.advance.service.govern.voltage.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgIncomingLineMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.IncomingLineParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.IncomingLineVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Service
|
||||
public class SgIncomingLineServiceImpl extends ServiceImpl<SgIncomingLineMapper, SgIncomingLine> implements ISgIncomingLineService {
|
||||
|
||||
/**
|
||||
* 根据用户id查询进线数据
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
public List<IncomingLineVO> incomingLineList(String userId) {
|
||||
if(StrUtil.isBlank(userId)){
|
||||
throw new BusinessException(AdvanceResponseEnum.SG_USER_ID_MISS);
|
||||
}
|
||||
return this.baseMapper.queryLineByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务用户的进线数据
|
||||
*
|
||||
* @param incomingLineParam 业务用户数据
|
||||
*/
|
||||
@Override
|
||||
public String addIncomingLine(IncomingLineParam incomingLineParam) {
|
||||
checkIncomingLineName(incomingLineParam, false);
|
||||
SgIncomingLine sgIncomingLine = new SgIncomingLine();
|
||||
BeanUtil.copyProperties(incomingLineParam, sgIncomingLine);
|
||||
//默认为正常状态
|
||||
sgIncomingLine.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.save(sgIncomingLine);
|
||||
return sgIncomingLine.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务用户的进线数据
|
||||
*
|
||||
* @param updateParam 业务用户数据
|
||||
*/
|
||||
@Override
|
||||
public boolean updateIncomingLine(IncomingLineParam.IncomingLineUpdateParam updateParam) {
|
||||
checkIncomingLineName(updateParam, true);
|
||||
SgIncomingLine sgIncomingLine = new SgIncomingLine();
|
||||
BeanUtil.copyProperties(updateParam, sgIncomingLine);
|
||||
return this.updateById(sgIncomingLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除进线数据
|
||||
* @param ids 进线id
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteIncomingLineData(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(SgIncomingLine::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(SgIncomingLine::getId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验进线名称是否有重复的
|
||||
* @param incomingLineParam 进线数据
|
||||
* @param isExcludeSelf 是否排除自己
|
||||
*/
|
||||
private void checkIncomingLineName(IncomingLineParam incomingLineParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<SgIncomingLine> sgUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sgUserLambdaQueryWrapper
|
||||
.eq(SgIncomingLine::getName, incomingLineParam.getName())
|
||||
.eq(SgIncomingLine::getUserId, incomingLineParam.getUserId())
|
||||
.eq(SgIncomingLine::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (incomingLineParam instanceof IncomingLineParam.IncomingLineUpdateParam) {
|
||||
sgUserLambdaQueryWrapper.ne(SgIncomingLine::getId, ((IncomingLineParam.IncomingLineUpdateParam) incomingLineParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(sgUserLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(AdvanceResponseEnum.SG_USER_NAME_REPEAT);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.njcn.advance.service.govern.voltage.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgUserMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgUserService;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-02-29
|
||||
*/
|
||||
@Service
|
||||
public class SgUserServiceImpl extends ServiceImpl<SgUserMapper, SgUser> implements ISgUserService {
|
||||
|
||||
@Override
|
||||
public Page<SgUserVO> sgUserList(SgUserParam.SgUserQueryParam sgUserQueryParam) {
|
||||
QueryWrapper<SgUserVO> queryWrapper = new QueryWrapper<>();
|
||||
//关键字查询,仅支持用户名、行业模糊查询
|
||||
if (StrUtil.isNotBlank(sgUserQueryParam.getSearchValue())) {
|
||||
queryWrapper
|
||||
.and(param -> param
|
||||
.like("sg_user.user_name", sgUserQueryParam.getSearchValue())
|
||||
.or()
|
||||
.like("sg_user.industry", sgUserQueryParam.getSearchValue()));
|
||||
}
|
||||
|
||||
//addr可能是个集合,多选N个区域查询
|
||||
if (CollectionUtil.isNotEmpty(sgUserQueryParam.getAddrStrOption())) {
|
||||
queryWrapper.in("sg_user.addr", sgUserQueryParam.getAddrStrOption());
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(sgUserQueryParam.getSortBy(), sgUserQueryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, sgUserQueryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(sgUserQueryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据createTime更新时间排序
|
||||
queryWrapper.orderByDesc("sg_user.create_time");
|
||||
}
|
||||
queryWrapper.eq("sg_user.state", DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(sgUserQueryParam), PageFactory.getPageSize(sgUserQueryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务用户数据
|
||||
*
|
||||
* @param sgUserParam 业务用户数据
|
||||
*/
|
||||
@Override
|
||||
public String addUserInfo(SgUserParam sgUserParam) {
|
||||
checkSgUserName(sgUserParam, false);
|
||||
SgUser sgUser = new SgUser();
|
||||
BeanUtil.copyProperties(sgUserParam, sgUser);
|
||||
//默认为正常状态
|
||||
sgUser.setState(DataStateEnum.ENABLE.getCode());
|
||||
sgUser.setAddr(sgUserParam.getAddrStrOption());
|
||||
this.save(sgUser);
|
||||
return sgUser.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新业务用户数据
|
||||
*
|
||||
* @param updateParam 待更新的业务用户数据
|
||||
*/
|
||||
@Override
|
||||
public boolean updateSgUser(SgUserParam.SgUserUpdateParam updateParam) {
|
||||
checkSgUserName(updateParam, true);
|
||||
SgUser sgUser = new SgUser();
|
||||
BeanUtil.copyProperties(updateParam, sgUser);
|
||||
return this.updateById(sgUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除所有指定的业务用户
|
||||
*
|
||||
* @param ids 用户id集合
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteSgUserData(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(SgUser::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(SgUser::getId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的业务用户
|
||||
*/
|
||||
private void checkSgUserName(SgUserParam sgUserParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<SgUser> sgUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sgUserLambdaQueryWrapper
|
||||
.eq(SgUser::getUserName, sgUserParam.getUserName())
|
||||
.eq(SgUser::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (sgUserParam instanceof SgUserParam.SgUserUpdateParam) {
|
||||
sgUserLambdaQueryWrapper.ne(SgUser::getId, ((SgUserParam.SgUserUpdateParam) sgUserParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(sgUserLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(AdvanceResponseEnum.SG_USER_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user