添加用户
This commit is contained in:
@@ -15,11 +15,13 @@ public enum AlgorithmResponseEnum {
|
||||
* A00500 ~ A01550 用于终端模块的枚举
|
||||
*/
|
||||
CS_DEVICE_COMMON_ERROR("A00500","治理终端模块异常"),
|
||||
PROJECT_COMMON_ERROR("A00500","同一用户下项目名不能相同"),
|
||||
PROJECT_COMMON_ERROR("A00500","项目名不能相同"),
|
||||
DICT_DATA_ERROR("A00501","暂无此字典表类型"),
|
||||
NDID_ERROR("A00502","存在相同的ndid"),
|
||||
DATA_ERROR("A00503","存在相同的数据"),
|
||||
LINE_DATA_ERROR ("A00504","设备下监测点数据缺失"),
|
||||
ENGINEERING_DATA_ERROR ("A00505","工程数据数据缺失"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,9 +47,9 @@ public class CsDevModelAddParm {
|
||||
* 版本日期
|
||||
*/
|
||||
@ApiModelProperty(value = "版本日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime versionDate;
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date versionDate;
|
||||
|
||||
/**
|
||||
* 装置模板文件路径
|
||||
|
||||
@@ -35,8 +35,8 @@ public class AppProjectPO extends BaseEntity {
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
@TableField(value = "engineering_id")
|
||||
private String engineeringId;
|
||||
// @TableField(value = "engineering_id")
|
||||
// private String engineeringId;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -55,7 +56,7 @@ public class CsDevModelPO extends BaseEntity {
|
||||
* 版本日期
|
||||
*/
|
||||
@TableField(value = "version_date")
|
||||
private LocalDateTime versionDate;
|
||||
private Date versionDate;
|
||||
|
||||
/**
|
||||
* 装置模板文件路径
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/3 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "cs_project_equipment")
|
||||
public class CsProjectEquipmentPO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@TableField(value = "project_id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@TableField(value = "equipment_id")
|
||||
private String equipmentId;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
||||
//package com.njcn.csdevice.pojo.po;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.annotation.TableField;
|
||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
||||
//import com.baomidou.mybatisplus.annotation.TableName;
|
||||
//import com.njcn.db.bo.BaseEntity;
|
||||
//import lombok.Data;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * Description:
|
||||
// * 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
// * Date: 2023/4/3 10:24【需求编号】
|
||||
// *
|
||||
// * @author clam
|
||||
// * @version V1.0.0
|
||||
// */
|
||||
//@Data
|
||||
//@TableName(value = "cs_project_equipment")
|
||||
//public class CsProjectEquipmentPO extends BaseEntity {
|
||||
// /**
|
||||
// * id
|
||||
// */
|
||||
// @TableId(value = "id")
|
||||
// private String id;
|
||||
//
|
||||
// /**
|
||||
// * 项目Id
|
||||
// */
|
||||
// @TableField(value = "project_id")
|
||||
// private String projectId;
|
||||
//
|
||||
// /**
|
||||
// * 设备id
|
||||
// */
|
||||
// @TableField(value = "equipment_id")
|
||||
// private String equipmentId;
|
||||
//
|
||||
// /**
|
||||
// * 状态(0:删除 1:正常)
|
||||
// */
|
||||
// @TableField(value = "status")
|
||||
// private Integer status;
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -59,7 +59,7 @@ public class EngineeringController extends BaseController {
|
||||
@PostMapping("/auditEngineering")
|
||||
@ApiOperation("修改/删除工程")
|
||||
@ApiImplicitParam(name = "csEngineeringAuditParm", value = "修改项目参数", required = true)
|
||||
public HttpResult<Boolean> auditAppProject(@Validated @RequestBody CsEngineeringAuditParm csEngineeringAuditParm){
|
||||
public HttpResult<Boolean> auditEngineering(@Validated @RequestBody CsEngineeringAuditParm csEngineeringAuditParm){
|
||||
String methodDescribe = getMethodDescribe("auditEngineering");
|
||||
|
||||
Boolean flag = csEngineeringService.auditEngineering(csEngineeringAuditParm);
|
||||
|
||||
@@ -18,47 +18,47 @@ import org.apache.ibatis.annotations.Select;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppProjectMapper extends BaseMapper<AppProjectPO> {
|
||||
@Select (
|
||||
{"<script>",
|
||||
"SELECT\n" +
|
||||
"\ta.id id,\n" +
|
||||
"\ta.`name` name,\n" +
|
||||
// "\ta.user_id user_id,\n" +
|
||||
// "\t\"username\" user_name,\n" +
|
||||
"\ta.area area,\n" +
|
||||
// "\tb.file_path topologyDiagramPath,\n" +
|
||||
// "\ta.lng lng,\n" +
|
||||
// "\ta.lat lat,\n" +
|
||||
"\tc.name engineering_name,\n" +
|
||||
"\ta.description description,\n"+
|
||||
"\ta.engineering_id engineering_id,\n" +
|
||||
"\ta.`status` STATUS,\n" +
|
||||
"\ta.create_by create_by,\n" +
|
||||
"\ta.create_time create_time,\n" +
|
||||
"\ta.update_by update_by,\n" +
|
||||
"\ta.update_time update_time\n" +
|
||||
"FROM\n" +
|
||||
"\tcs_project a\n" +
|
||||
" LEFT JOIN cs_engineering c on a.engineering_id=c.id \n" +
|
||||
"WHERE\n" +
|
||||
"\t1 = 1 AND a.status=\"1\"\n" ,
|
||||
"<when test='temp.projectId!=null and temp.projectId!=\"\"'>",
|
||||
"AND a.id = #{temp.projectId} "+
|
||||
"</when>",
|
||||
"<when test='temp.engineeringId!=null and temp.engineeringId!=\"\"'>",
|
||||
"AND a.engineering_id = #{temp.engineeringId} "+
|
||||
"</when>",
|
||||
"<when test='temp.endTime!=null and temp.endTime!=\"\"'>",
|
||||
"AND a.create_time <= #{temp.endTime}" +
|
||||
"</when>",
|
||||
"<when test='temp.startTime!=null and temp.startTime!=\"\"'>",
|
||||
"AND a.create_time >= #{temp.startTime}" +
|
||||
"</when>",
|
||||
"<when test='temp.searchValue!=null and temp.searchValue!=\"\"'>",
|
||||
"AND a.`name` like concat('%',#{temp.searchValue},'%')",
|
||||
"</when>",
|
||||
" order by a.create_time desc",
|
||||
"</script>"}
|
||||
)
|
||||
// @Select (
|
||||
// {"<script>",
|
||||
// "SELECT\n" +
|
||||
// "\ta.id id,\n" +
|
||||
// "\ta.`name` name,\n" +
|
||||
//// "\ta.user_id user_id,\n" +
|
||||
//// "\t\"username\" user_name,\n" +
|
||||
// "\ta.area area,\n" +
|
||||
//// "\tb.file_path topologyDiagramPath,\n" +
|
||||
//// "\ta.lng lng,\n" +
|
||||
//// "\ta.lat lat,\n" +
|
||||
// "\tc.name engineering_name,\n" +
|
||||
// "\ta.description description,\n"+
|
||||
// "\ta.engineering_id engineering_id,\n" +
|
||||
// "\ta.`status` STATUS,\n" +
|
||||
// "\ta.create_by create_by,\n" +
|
||||
// "\ta.create_time create_time,\n" +
|
||||
// "\ta.update_by update_by,\n" +
|
||||
// "\ta.update_time update_time\n" +
|
||||
// "FROM\n" +
|
||||
// "\tcs_project a\n" +
|
||||
// " LEFT JOIN cs_engineering c on a.engineering_id=c.id \n" +
|
||||
// "WHERE\n" +
|
||||
// "\t1 = 1 AND a.status=\"1\"\n" ,
|
||||
// "<when test='temp.projectId!=null and temp.projectId!=\"\"'>",
|
||||
// "AND a.id = #{temp.projectId} "+
|
||||
// "</when>",
|
||||
// "<when test='temp.engineeringId!=null and temp.engineeringId!=\"\"'>",
|
||||
// "AND a.engineering_id = #{temp.engineeringId} "+
|
||||
// "</when>",
|
||||
// "<when test='temp.endTime!=null and temp.endTime!=\"\"'>",
|
||||
// "AND a.create_time <= #{temp.endTime}" +
|
||||
// "</when>",
|
||||
// "<when test='temp.startTime!=null and temp.startTime!=\"\"'>",
|
||||
// "AND a.create_time >= #{temp.startTime}" +
|
||||
// "</when>",
|
||||
// "<when test='temp.searchValue!=null and temp.searchValue!=\"\"'>",
|
||||
// "AND a.`name` like concat('%',#{temp.searchValue},'%')",
|
||||
// "</when>",
|
||||
// " order by a.create_time desc",
|
||||
// "</script>"}
|
||||
// )
|
||||
Page<AppProjectVO> getPageVo(Page<AppProjectVO> returnpage, @Param("temp")AppProjectQueryParm appProjectQueryParm);
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsProjectEquipmentPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/3 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsProjectEquipmentMapper extends BaseMapper<CsProjectEquipmentPO> {
|
||||
}
|
||||
//package com.njcn.csdevice.mapper;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
//import com.njcn.csdevice.pojo.po.CsProjectEquipmentPO;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * Description:
|
||||
// * 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
// * Date: 2023/4/3 10:24【需求编号】
|
||||
// *
|
||||
// * @author clam
|
||||
// * @version V1.0.0
|
||||
// */
|
||||
//public interface CsProjectEquipmentMapper extends BaseMapper<CsProjectEquipmentPO> {
|
||||
//}
|
||||
@@ -21,4 +21,25 @@
|
||||
id, `name`, user_id, area_id, lng, lat, `status`, create_by, create_time, update_by,
|
||||
update_time
|
||||
</sql>
|
||||
|
||||
<select id="getPageVo" resultType="com.njcn.csdevice.pojo.vo.AppProjectVO">
|
||||
select a.*,b.id as engineering_id,b.`Name` as engineering_name from cs_project a LEFT JOIN cs_ledger b on a.id = b.id where 1=1
|
||||
and a.status ="1"
|
||||
<if test="temp!=null and temp.projectId != null and temp.projectId !=''">
|
||||
AND a.id = #{temp.projectId}
|
||||
</if>
|
||||
<if test="temp!=null and temp.engineeringId != null and temp.engineeringId !=''">
|
||||
AND b.id = #{temp.engineeringId}
|
||||
</if>
|
||||
<if test="temp!=null and temp.endTime != null and temp.endTime !=''">
|
||||
AND a.create_time <= #{temp.endTime}"
|
||||
</if>
|
||||
<if test="temp!=null and temp.startTime != null and temp.startTime !=''">
|
||||
AND a.create_time >= #{temp.startTime}
|
||||
</if>
|
||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||
AND a.`name` like concat('%',#{temp.searchValue},'%')
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -32,25 +32,31 @@
|
||||
</sql>
|
||||
<select id="queryProjectEquipmentVO" resultType="com.njcn.csdevice.pojo.vo.ProjectEquipmentVO">
|
||||
SELECT
|
||||
a.engineering_id engineeringId,
|
||||
d.name engineeringName,
|
||||
a.id projectId,
|
||||
a.name projectName,
|
||||
b.id equipmentId,
|
||||
b.name equipmentName,
|
||||
a.id engineeringId,
|
||||
a.name engineeringName,
|
||||
b.id projectId,
|
||||
b.name projectName,
|
||||
c.id equipmentId,
|
||||
c.name equipmentName,
|
||||
c.create_time createTime
|
||||
FROM cs_project a,
|
||||
cs_equipment_delivery b,
|
||||
cs_project_equipment c,
|
||||
cs_engineering d
|
||||
WHERE a.id = c.project_id
|
||||
AND b.id = c.equipment_id
|
||||
and a.engineering_id =d.id
|
||||
FROM
|
||||
(select * from cs_ledger where LEVEL = 0 ) a,
|
||||
(select * from cs_ledger where LEVEL = 1 ) b,
|
||||
(select * from cs_ledger where LEVEL = 2 ) d,
|
||||
cs_equipment_delivery c
|
||||
WHERE
|
||||
a.LEVEL = 0
|
||||
AND b.LEVEL = 1
|
||||
AND a.id = b.pid
|
||||
AND b.id = d.pid
|
||||
AND c.id =d.id
|
||||
<if test="projectEquipmentQueryParm!=null and projectEquipmentQueryParm.projectType != null and projectEquipmentQueryParm.projectType !=''">
|
||||
AND a.project_type = #{projectEquipmentQueryParm.projectType}
|
||||
AND c.project_type = #{projectEquipmentQueryParm.projectType}
|
||||
</if>
|
||||
<if test="projectEquipmentQueryParm!=null and projectEquipmentQueryParm.projectId != null and projectEquipmentQueryParm.projectId !=''">
|
||||
AND a.id = #{projectEquipmentQueryParm.projectId}
|
||||
AND b.id = #{projectEquipmentQueryParm.projectId}
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?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.csdevice.mapper.CsProjectEquipmentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.csdevice.pojo.po.CsProjectEquipmentPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table `cs_project_equipment`-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="equipment_id" jdbcType="VARCHAR" property="equipmentId" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, project_id, equipment_id, `status`, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -1,27 +1,27 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsProjectEquipmentPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/3 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsProjectEquipmentService extends IService<CsProjectEquipmentPO>{
|
||||
|
||||
/**
|
||||
* 根据项目获取装置
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
List<CsProjectEquipmentPO> getDeviceByProject(List<String> list);
|
||||
|
||||
}
|
||||
//package com.njcn.csdevice.service;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.extension.service.IService;
|
||||
//import com.njcn.csdevice.pojo.po.CsProjectEquipmentPO;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * Description:
|
||||
// * 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
// * Date: 2023/4/3 10:24【需求编号】
|
||||
// *
|
||||
// * @author clam
|
||||
// * @version V1.0.0
|
||||
// */
|
||||
//public interface CsProjectEquipmentService extends IService<CsProjectEquipmentPO>{
|
||||
//
|
||||
// /**
|
||||
// * 根据项目获取装置
|
||||
// * @param list
|
||||
// * @return
|
||||
// */
|
||||
// List<CsProjectEquipmentPO> getDeviceByProject(List<String> list);
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,24 +1,33 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.AppProjectVO;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.csdevice.service.AppProjectService;
|
||||
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import kotlin.jvm.Throws;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.bytebuddy.implementation.bytecode.Throw;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -35,8 +44,7 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
|
||||
private final AppProjectMapper appProjectMapper;
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -46,6 +54,10 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
// if (result) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
// }
|
||||
|
||||
if(checkName(appProjectAddOrAuditParm.getName(),"")){
|
||||
throw new BusinessException(AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
}
|
||||
BeanUtils.copyProperties (appProjectAddOrAuditParm, appProjectPO);
|
||||
appProjectPO.setStatus ("1");
|
||||
boolean save = this.save (appProjectPO);
|
||||
@@ -57,14 +69,27 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
appTopologyDiagramAddParm.setFile (appProjectAddOrAuditParm.getFiles ( )[i]);
|
||||
appTopologyDiagramService.addAppTopologyDiagram (appTopologyDiagramAddParm);
|
||||
}
|
||||
CsLedger csLedger = csLedgerMapper.selectById(appProjectAddOrAuditParm.getEngineeringId());
|
||||
Optional.ofNullable(csLedger).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ENGINEERING_DATA_ERROR));
|
||||
CsLedger csLedger1 = new CsLedger();
|
||||
csLedger1.setId(appProjectPO.getId());
|
||||
csLedger1.setPid(appProjectAddOrAuditParm.getEngineeringId());
|
||||
csLedger1.setPids(csLedger.getPids()+ ","+appProjectAddOrAuditParm.getEngineeringId());
|
||||
csLedger1.setLevel(1);
|
||||
csLedger1.setName(appProjectPO.getName());
|
||||
csLedger1.setState(1);
|
||||
csLedger1.setSort(0);
|
||||
csLedgerMapper.insert(csLedger1);
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
private Boolean checkName(String userId, String name) {
|
||||
private Boolean checkName( String name,String id) {
|
||||
QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
|
||||
queryWrapper.select ("1").
|
||||
eq ("status", "1").
|
||||
eq ("user_id", userId).
|
||||
ne(StringUtils.isNotBlank(id),"id",id).
|
||||
// eq ("user_id", userId).
|
||||
eq ("name", name);
|
||||
Integer integer = appProjectMapper.selectCount (queryWrapper);
|
||||
return integer > 0 ? true : false;
|
||||
@@ -85,6 +110,9 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
// throw new BusinessException (AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
// }
|
||||
// }
|
||||
if(checkName(appProjectAuditParm.getName(),appProjectAuditParm.getId())){
|
||||
throw new BusinessException(AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties (appProjectAuditParm, appProjectPO);
|
||||
UpdateWrapper<AppProjectPO> updateWrapper = new UpdateWrapper ( );
|
||||
@@ -95,6 +123,18 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
// if (result) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
// }
|
||||
|
||||
CsLedger csLedger1 = new CsLedger();
|
||||
csLedger1.setId(appProjectAuditParm.getId());
|
||||
if(Objects.equals("0",appProjectAuditParm.getStatus())){
|
||||
|
||||
csLedger1.setState(0);
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(appProjectAuditParm.getName())){
|
||||
csLedger1.setName(appProjectAuditParm.getName());
|
||||
}
|
||||
csLedgerMapper.updateById(csLedger1);
|
||||
return i == 1 ? true : false;
|
||||
}
|
||||
|
||||
@@ -138,6 +178,10 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
|
||||
@Override
|
||||
public List<AppProjectPO> getProjectByEngineering(List<String> list) {
|
||||
return this.lambdaQuery().in(AppProjectPO::getEngineeringId,list).list();
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
||||
csLedgerQueryWrapper.lambda().in(CsLedger::getPid, list).eq(CsLedger::getState,1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect = csLedgers.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
return this.lambdaQuery().in(AppProjectPO::getId,collect).list();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryPageParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import com.njcn.csdevice.service.CsEngineeringService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
@@ -23,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -41,6 +44,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
|
||||
private final AreaFeignClient areaFeignClient;
|
||||
private final RedisUtil redisUtil;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -49,6 +53,16 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
BeanUtils.copyProperties (csEngineeringAddParm, csEngineeringPO);
|
||||
csEngineeringPO.setStatus ("1");
|
||||
boolean save = this.save (csEngineeringPO);
|
||||
CsLedger csLedger1 = new CsLedger();
|
||||
csLedger1.setId(csEngineeringPO.getId());
|
||||
csLedger1.setPid("0");
|
||||
csLedger1.setPids("0");
|
||||
csLedger1.setLevel(0);
|
||||
csLedger1.setName(csEngineeringPO.getName());
|
||||
csLedger1.setState(1);
|
||||
csLedger1.setSort(0);
|
||||
csLedgerMapper.insert(csLedger1);
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
@@ -59,6 +73,18 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
CsEngineeringPO csEngineeringPO = new CsEngineeringPO ();
|
||||
BeanUtils.copyProperties (csEngineeringAuditParm, csEngineeringPO);
|
||||
boolean b = this.updateById (csEngineeringPO);
|
||||
CsLedger csLedger1 = new CsLedger();
|
||||
csLedger1.setId(csEngineeringAuditParm.getId());
|
||||
if(Objects.equals("0",csEngineeringAuditParm.getStatus())){
|
||||
|
||||
csLedger1.setState(0);
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
||||
csLedger1.setName(csEngineeringAuditParm.getName());
|
||||
}
|
||||
csLedgerMapper.updateById(csLedger1);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -70,7 +96,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
eq (StringUtils.isNotBlank (csEngineeringQueryParm.getProvince ()),"province",csEngineeringQueryParm.getProvince ()).
|
||||
eq (StringUtils.isNotBlank (csEngineeringQueryParm.getCity ()),"city",csEngineeringQueryParm.getCity ()).
|
||||
eq ("status","1" ).
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryParm.getName ()),"name",csEngineeringQueryParm.getName ());
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryParm.getName ()),"name",csEngineeringQueryParm.getName ()).orderByDesc("create_time");
|
||||
List<CsEngineeringPO> csEngineeringPOS = this.getBaseMapper ( ).selectList (queryWrapper);
|
||||
csEngineeringVOList = csEngineeringPOS.stream ().map (temp->{
|
||||
CsEngineeringVO vo = new CsEngineeringVO();
|
||||
@@ -93,7 +119,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getProvince ()),"province",csEngineeringQueryPageParm.getProvince ()).
|
||||
eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getCity ()),"city",csEngineeringQueryPageParm.getCity ()).
|
||||
eq ("status","1" ).
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryPageParm.getName ()),"name",csEngineeringQueryPageParm.getName ());
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryPageParm.getName ()),"name",csEngineeringQueryPageParm.getName ()).orderByDesc("create_time");
|
||||
Page<CsEngineeringPO> csEngineeringPOPage = this.getBaseMapper ( ).selectPage (tempPage, queryWrapper);
|
||||
List<CsEngineeringVO> collect = csEngineeringPOPage.getRecords ( ).stream ( ).map (temp -> {
|
||||
CsEngineeringVO vo = new CsEngineeringVO ( );
|
||||
|
||||
@@ -8,19 +8,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -32,7 +36,9 @@ import java.util.Objects;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -46,6 +52,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPO);
|
||||
csEquipmentDeliveryPO.setStatus ("1");
|
||||
boolean save = this.save (csEquipmentDeliveryPO);
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsProjectEquipmentMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsProjectEquipmentPO;
|
||||
import com.njcn.csdevice.service.CsProjectEquipmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/3 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class CsProjectEquipmentServiceImpl extends ServiceImpl<CsProjectEquipmentMapper, CsProjectEquipmentPO> implements CsProjectEquipmentService {
|
||||
|
||||
@Override
|
||||
public List<CsProjectEquipmentPO> getDeviceByProject(List<String> list) {
|
||||
return this.lambdaQuery().in(CsProjectEquipmentPO::getProjectId,list).list();
|
||||
}
|
||||
}
|
||||
//package com.njcn.csdevice.service.impl;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
//import com.njcn.csdevice.mapper.CsProjectEquipmentMapper;
|
||||
//import com.njcn.csdevice.pojo.po.CsProjectEquipmentPO;
|
||||
//import com.njcn.csdevice.service.CsProjectEquipmentService;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * Description:
|
||||
// * 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
// * Date: 2023/4/3 10:24【需求编号】
|
||||
// *
|
||||
// * @author clam
|
||||
// * @version V1.0.0
|
||||
// */
|
||||
//@Service
|
||||
//public class CsProjectEquipmentServiceImpl extends ServiceImpl<CsProjectEquipmentMapper, CsProjectEquipmentPO> implements CsProjectEquipmentService {
|
||||
//
|
||||
// @Override
|
||||
// public List<CsProjectEquipmentPO> getDeviceByProject(List<String> list) {
|
||||
// return this.lambdaQuery().in(CsProjectEquipmentPO::getProjectId,list).list();
|
||||
// }
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user