Commit d06208d6 authored by wanglong's avatar wanglong

添加监理巡检

parent 934262dc
package com.yeejoin.amos.boot.module.ugp.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* Dto
*
* @author duanwei
* @date 2022-11-03
*/
@Data
public class InspectionDto extends BaseDto {
private static final long serialVersionUID = 1L;
/**
* 项目id
*/
private Long projectId;
@ApiModelProperty(value = "焊口编码")
/**
* 焊口编码
*/
private String code;
@ApiModelProperty(value = "图片地址")
/**
* 图片地址
*/
private String image;
private String status;
}
package com.yeejoin.amos.boot.module.ugp.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @author duanwei
* @date 2022-11-03
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value = "TzUgpInspection对象", description = "")
@TableName("tz_ugp_inspection")
public class Inspection extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "项目id")
private Long projectId;
@ApiModelProperty(value = "焊口编码")
private String code;
@ApiModelProperty(value = "图片地址")
private String image;
@ApiModelProperty(value = "检验状态")
private String status;
}
package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.yeejoin.amos.boot.module.ugp.api.entity.Inspection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper 接口
*
* @author duanwei
* @date 2022-11-03
*/
public interface InspectionMapper extends BaseMapper<Inspection> {
}
package com.yeejoin.amos.boot.module.ugp.api.service;
/**
* 服务类
*
* @author duanwei
* @date 2022-11-03
*/
public interface InspectionService {
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
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.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.ugp.api.entity.Inspection;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.InspectionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
/**
* @author duanwei
* @date 2022-11-03
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/tz-ugp-inspection")
public class InspectionController {
@Autowired
InspectionServiceImpl iTzUgpInspectionServiceImpl;
/**
* 新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveTzUgpInspection(HttpServletRequest request, @RequestBody Inspection tzUgpInspection) {
return iTzUgpInspectionServiceImpl.save(tzUgpInspection);
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
return iTzUgpInspectionServiceImpl.removeById(id);
}
/**
* 修改
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdTzUgpInspection(HttpServletRequest request, @RequestBody Inspection tzUgpInspection) {
return iTzUgpInspectionServiceImpl.updateById(tzUgpInspection);
}
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Inspection selectById(HttpServletRequest request, @PathVariable Long id) {
return iTzUgpInspectionServiceImpl.getById(id);
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<Inspection> listPage(String pageNum, String pageSize,
Inspection tzUgpInspection) {
Page<Inspection> pageBean;
QueryWrapper<Inspection> tzUgpInspectionQueryWrapper = new QueryWrapper<>();
Class<? extends Inspection> aClass = tzUgpInspection.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(tzUgpInspection);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(tzUgpInspection);
tzUgpInspectionQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(tzUgpInspection);
tzUgpInspectionQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(tzUgpInspection);
tzUgpInspectionQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(tzUgpInspection);
tzUgpInspectionQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<Inspection> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iTzUgpInspectionServiceImpl.page(pageBean, tzUgpInspectionQueryWrapper);
return page;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "", notes = "")
@GetMapping("/saveInfo")
public ResponseModel<String> saveInfo(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(iTzUgpInspectionServiceImpl.saveInfo(jsonObject));
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.Enum.IntelligentInspectionEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.InspectionDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Inspection;
import com.yeejoin.amos.boot.module.ugp.api.mapper.InspectionMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class InspectionServiceImpl extends BaseService<InspectionDto, Inspection, InspectionMapper> {
public String saveInfo(JSONObject jsonObject) {
Inspection inspection = new Inspection();
inspection.setProjectId(Long.valueOf(jsonObject.getString("projectId")));
inspection.setCode(jsonObject.getString("code"));
inspection.setStatus(IntelligentInspectionEnum.getStatusByNameMap.get(jsonObject.getString("status")));
inspection.setImage(jsonObject.getString("image"));
this.save(inspection);
return "ok";
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectMaterialDto;
......@@ -197,10 +198,12 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
* @param 资源
* @return
*/
private final String 是否删除="0";
private List<ProjectResource> getProjectResources(String projectId, ProjectResourceEnum 资源) {
LambdaQueryWrapper<ProjectResource> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(ProjectResource::getProjectId,projectId);
wrapper.eq(ProjectResource::getType, 资源.getCode());
wrapper.eq(BaseEntity::getIsDelete,是否删除);
List<ProjectResource> projectResources = projectResourceMapper.selectList(wrapper);
return projectResources;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment