MARK FOR PULL
This commit is contained in:
parent
ab35b10130
commit
b515eacbab
@ -160,4 +160,10 @@ public class SysUserController {
|
|||||||
|
|
||||||
ExcelUtils.exportExcelToTarget(response, null, list, SysUserExcel.class);
|
ExcelUtils.exportExcelToTarget(response, null, list, SysUserExcel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "list")
|
||||||
|
@ApiOperation(value = "获取用户列表")
|
||||||
|
@LogOperation("获取用户列表")
|
||||||
|
public List<SysUserDTO> list(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
|
return sysUserService.list(params); }
|
||||||
}
|
}
|
||||||
|
@ -144,4 +144,12 @@ public class MachineController {
|
|||||||
return new Result().ok(true);
|
return new Result().ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "list")
|
||||||
|
@ApiOperation(value = "获取机台列表")
|
||||||
|
@LogOperation("获取机台列表")
|
||||||
|
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
|
||||||
|
public List<MachineDTO> list(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
|
return machineService.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -129,4 +129,11 @@ public class ProductController {
|
|||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "list")
|
||||||
|
@ApiOperation(value = "获取产品列表")
|
||||||
|
@LogOperation("获取产品列表")
|
||||||
|
public List<ProductDTO> list() {
|
||||||
|
return productService.list();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -114,4 +114,11 @@ public class ShiftController {
|
|||||||
ExcelUtils.exportExcelToTarget(response, null, list, ShiftExcel.class);
|
ExcelUtils.exportExcelToTarget(response, null, list, ShiftExcel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "list")
|
||||||
|
@ApiOperation(value = "获取班次列表")
|
||||||
|
@LogOperation("获取班次列表")
|
||||||
|
public List<ShiftDTO> list() {
|
||||||
|
return shiftService.list();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.cnbm.basic.controller;
|
package com.cnbm.basic.controller;
|
||||||
|
|
||||||
import com.cnbm.admin.annotation.LogOperation;
|
import com.cnbm.admin.annotation.LogOperation;
|
||||||
|
import com.cnbm.basic.dto.ShiftDTO;
|
||||||
import com.cnbm.common.constant.Constant;
|
import com.cnbm.common.constant.Constant;
|
||||||
import com.cnbm.common.page.PageData;
|
import com.cnbm.common.page.PageData;
|
||||||
import com.cnbm.common.utils.ExcelUtils;
|
import com.cnbm.common.utils.ExcelUtils;
|
||||||
@ -114,4 +115,9 @@ public class TeamController {
|
|||||||
ExcelUtils.exportExcelToTarget(response, null, list, TeamExcel.class);
|
ExcelUtils.exportExcelToTarget(response, null, list, TeamExcel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "list")
|
||||||
|
@ApiOperation(value = "获取班组列表")
|
||||||
|
@LogOperation("获取班组列表")
|
||||||
|
public List<TeamDTO> list() { return teamService.list(); }
|
||||||
|
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import com.cnbm.basic.entity.Product;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,4 +19,5 @@ import java.util.Map;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface ProductMapper extends BaseDao<Product> {
|
public interface ProductMapper extends BaseDao<Product> {
|
||||||
// IPage<ProductDTO> page(Map<String, Object> params);
|
// IPage<ProductDTO> page(Map<String, Object> params);
|
||||||
|
List<ProductDTO> list();
|
||||||
}
|
}
|
@ -1,9 +1,12 @@
|
|||||||
package com.cnbm.basic.mapper;
|
package com.cnbm.basic.mapper;
|
||||||
|
|
||||||
|
import com.cnbm.basic.dto.ShiftDTO;
|
||||||
import com.cnbm.common.dao.BaseDao;
|
import com.cnbm.common.dao.BaseDao;
|
||||||
import com.cnbm.basic.entity.Shift;
|
import com.cnbm.basic.entity.Shift;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班次 表
|
* 班次 表
|
||||||
*
|
*
|
||||||
@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface ShiftMapper extends BaseDao<Shift> {
|
public interface ShiftMapper extends BaseDao<Shift> {
|
||||||
|
|
||||||
|
List<ShiftDTO> list();
|
||||||
}
|
}
|
@ -1,9 +1,12 @@
|
|||||||
package com.cnbm.basic.mapper;
|
package com.cnbm.basic.mapper;
|
||||||
|
|
||||||
|
import com.cnbm.basic.dto.TeamDTO;
|
||||||
import com.cnbm.common.dao.BaseDao;
|
import com.cnbm.common.dao.BaseDao;
|
||||||
import com.cnbm.basic.entity.Team;
|
import com.cnbm.basic.entity.Team;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班组 表
|
* 班组 表
|
||||||
*
|
*
|
||||||
@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface TeamMapper extends BaseDao<Team> {
|
public interface TeamMapper extends BaseDao<Team> {
|
||||||
|
|
||||||
|
List<TeamDTO> list();
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import com.cnbm.basic.dto.ProductDTO;
|
|||||||
import com.cnbm.basic.entity.Product;
|
import com.cnbm.basic.entity.Product;
|
||||||
import com.cnbm.common.vo.IdVo;
|
import com.cnbm.common.vo.IdVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,4 +28,6 @@ public interface IProductService extends CrudService<Product, ProductDTO> {
|
|||||||
|
|
||||||
boolean changeStatus(Long id);
|
boolean changeStatus(Long id);
|
||||||
|
|
||||||
|
List<ProductDTO> list();
|
||||||
|
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ import com.cnbm.common.service.CrudService;
|
|||||||
import com.cnbm.basic.dto.ShiftDTO;
|
import com.cnbm.basic.dto.ShiftDTO;
|
||||||
import com.cnbm.basic.entity.Shift;
|
import com.cnbm.basic.entity.Shift;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,4 +24,6 @@ public interface IShiftService extends CrudService<Shift, ShiftDTO> {
|
|||||||
void update(ShiftDTO dto);
|
void update(ShiftDTO dto);
|
||||||
|
|
||||||
void delete(Long[] ids);
|
void delete(Long[] ids);
|
||||||
|
|
||||||
|
List<ShiftDTO> list();
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ import com.cnbm.common.service.CrudService;
|
|||||||
import com.cnbm.basic.dto.TeamDTO;
|
import com.cnbm.basic.dto.TeamDTO;
|
||||||
import com.cnbm.basic.entity.Team;
|
import com.cnbm.basic.entity.Team;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,4 +24,6 @@ public interface ITeamService extends CrudService<Team, TeamDTO> {
|
|||||||
void update(TeamDTO dto);
|
void update(TeamDTO dto);
|
||||||
|
|
||||||
void delete(Long[] ids);
|
void delete(Long[] ids);
|
||||||
|
|
||||||
|
List<TeamDTO> list();
|
||||||
}
|
}
|
@ -125,4 +125,11 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
|
|||||||
deleteBatchIds(Arrays.asList(ids));
|
deleteBatchIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public List<ProductDTO> list() {
|
||||||
|
List<ProductDTO> list = mapper.list();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -10,10 +10,12 @@ import com.cnbm.basic.entity.Shift;
|
|||||||
import com.cnbm.basic.service.IShiftService;
|
import com.cnbm.basic.service.IShiftService;
|
||||||
import com.cnbm.common.utils.ConvertUtils;
|
import com.cnbm.common.utils.ConvertUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,6 +27,9 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftDTO> implements IShiftService {
|
public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftDTO> implements IShiftService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ShiftMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<Shift> getWrapper(Map<String, Object> params){
|
public QueryWrapper<Shift> getWrapper(Map<String, Object> params){
|
||||||
String id = (String)params.get("id");
|
String id = (String)params.get("id");
|
||||||
@ -72,4 +77,11 @@ public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftD
|
|||||||
deleteBatchIds(Arrays.asList(ids));
|
deleteBatchIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public List<ShiftDTO> list() {
|
||||||
|
List<ShiftDTO> list = mapper.list();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,8 +2,6 @@ package com.cnbm.basic.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.cnbm.basic.dto.ProductTypeDTO;
|
|
||||||
import com.cnbm.basic.entity.ProductType;
|
|
||||||
import com.cnbm.common.page.PageData;
|
import com.cnbm.common.page.PageData;
|
||||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||||
import com.cnbm.basic.dto.TeamDTO;
|
import com.cnbm.basic.dto.TeamDTO;
|
||||||
@ -12,11 +10,13 @@ import com.cnbm.basic.entity.Team;
|
|||||||
import com.cnbm.basic.service.ITeamService;
|
import com.cnbm.basic.service.ITeamService;
|
||||||
import com.cnbm.common.utils.ConvertUtils;
|
import com.cnbm.common.utils.ConvertUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,6 +28,9 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO> implements ITeamService {
|
public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO> implements ITeamService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TeamMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<Team> getWrapper(Map<String, Object> params){
|
public QueryWrapper<Team> getWrapper(Map<String, Object> params){
|
||||||
String id = (String)params.get("id");
|
String id = (String)params.get("id");
|
||||||
@ -74,4 +77,11 @@ public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO>
|
|||||||
deleteBatchIds(Arrays.asList(ids));
|
deleteBatchIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public List<TeamDTO> list() {
|
||||||
|
List<TeamDTO> list = mapper.list();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,4 +2,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cnbm.basic.mapper.ProductMapper">
|
<mapper namespace="com.cnbm.basic.mapper.ProductMapper">
|
||||||
|
|
||||||
|
<select id="list" resultType="com.cnbm.basic.dto.ProductDTO">
|
||||||
|
select * from product
|
||||||
|
order by id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -2,4 +2,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cnbm.basic.mapper.ShiftMapper">
|
<mapper namespace="com.cnbm.basic.mapper.ShiftMapper">
|
||||||
|
|
||||||
|
<select id="list" resultType="com.cnbm.basic.dto.ShiftDTO">
|
||||||
|
select * from shift
|
||||||
|
order by id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -2,4 +2,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cnbm.basic.mapper.TeamMapper">
|
<mapper namespace="com.cnbm.basic.mapper.TeamMapper">
|
||||||
|
|
||||||
|
<select id="list" resultType="com.cnbm.basic.dto.TeamDTO">
|
||||||
|
select * from team
|
||||||
|
order by id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -19,7 +19,7 @@ public class CodeGenerator {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test(){
|
public void test(){
|
||||||
mybatisPlusGenerator(new String[]{"product_type"});
|
mybatisPlusGenerator(new String[]{"inspection_sheet"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mybatisPlusGenerator(String[] include){
|
public static void mybatisPlusGenerator(String[] include){
|
||||||
|
@ -0,0 +1,118 @@
|
|||||||
|
package com.cnbm.generator.code.controller;
|
||||||
|
|
||||||
|
import com.cnbm.admin.annotation.LogOperation;
|
||||||
|
import com.cnbm.common.constant.Constant;
|
||||||
|
import com.cnbm.common.page.PageData;
|
||||||
|
import com.cnbm.common.utils.ExcelUtils;
|
||||||
|
import com.cnbm.common.utils.Result;
|
||||||
|
import com.cnbm.common.validator.AssertUtils;
|
||||||
|
import com.cnbm.common.validator.ValidatorUtils;
|
||||||
|
import com.cnbm.common.validator.group.AddGroup;
|
||||||
|
import com.cnbm.common.validator.group.DefaultGroup;
|
||||||
|
import com.cnbm.common.validator.group.UpdateGroup;
|
||||||
|
import com.cnbm.generator.code.dto.InspectionSheetDTO;
|
||||||
|
import com.cnbm.generator.code.excel.InspectionSheetExcel;
|
||||||
|
import com.cnbm.generator.code.service.IInspectionSheetService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验单 表 前端控制器
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/code/inspectionSheet")
|
||||||
|
@Api(tags="检验单 表")
|
||||||
|
public class InspectionSheetController {
|
||||||
|
@Autowired
|
||||||
|
private IInspectionSheetService inspectionSheetService;
|
||||||
|
|
||||||
|
@GetMapping("page")
|
||||||
|
@ApiOperation("分页")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
||||||
|
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
|
||||||
|
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
|
||||||
|
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class)
|
||||||
|
})
|
||||||
|
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:page')")
|
||||||
|
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
|
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
|
||||||
|
|
||||||
|
return new Result<PageData<InspectionSheetDTO>>().ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@ApiOperation("信息")
|
||||||
|
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')")
|
||||||
|
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
|
||||||
|
InspectionSheetDTO data = inspectionSheetService.get(id);
|
||||||
|
|
||||||
|
return new Result<InspectionSheetDTO>().ok(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("保存")
|
||||||
|
@LogOperation("保存")
|
||||||
|
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:save')")
|
||||||
|
public Result<Long> save(@RequestBody InspectionSheetDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
try {
|
||||||
|
inspectionSheetService.save(dto);
|
||||||
|
}catch (Exception e){
|
||||||
|
return new Result<Long>().error(1,"没有发现检验参数");
|
||||||
|
}
|
||||||
|
return new Result<Long>().ok(dto.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@ApiOperation("修改")
|
||||||
|
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:update')")
|
||||||
|
public Result<Long> update(@RequestBody InspectionSheetDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
inspectionSheetService.update(dto);
|
||||||
|
|
||||||
|
return new Result<Long>().ok(dto.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@ApiOperation("删除")
|
||||||
|
@LogOperation("删除")
|
||||||
|
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:delete')")
|
||||||
|
public Result delete(@RequestBody Long[] ids){
|
||||||
|
//效验数据
|
||||||
|
AssertUtils.isArrayEmpty(ids, "id");
|
||||||
|
|
||||||
|
inspectionSheetService.delete(ids);
|
||||||
|
|
||||||
|
return new Result();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("export")
|
||||||
|
@ApiOperation("导出")
|
||||||
|
@LogOperation("导出")
|
||||||
|
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:export')")
|
||||||
|
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||||
|
List<InspectionSheetDTO> list = inspectionSheetService.list(params);
|
||||||
|
|
||||||
|
ExcelUtils.exportExcelToTarget(response, null, list, InspectionSheetExcel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.cnbm.generator.code.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验单 表
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "检验单 表DTO对象")
|
||||||
|
public class InspectionSheetDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单号,手动输入")
|
||||||
|
private String orderNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "批次号,手填")
|
||||||
|
private String batchNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "检验站点,手填")
|
||||||
|
private String inspectionSite;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品id,关联product表")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
|
||||||
|
private Integer inspectionStage;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工序id,关联working_procedure表")
|
||||||
|
private Long workingProcedureId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机台id,关联machine表")
|
||||||
|
private Long machineId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "班次id,关联shift表")
|
||||||
|
private Long shiftId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分组样本数(就是这个产品下所有检测参数 的 最大样本数),只给用户查看,值是后台自动计算的")
|
||||||
|
private Integer numberOfGroupedSamples;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "样本大小(就是检验单(母体)下的子样个数),只给用户查看,值是后台自动计算的")
|
||||||
|
private Integer numberOfSamples;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "缺陷数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 )")
|
||||||
|
private Integer numberOfDefects;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "不良数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 )")
|
||||||
|
private Integer defectiveQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "生产人")
|
||||||
|
private String producer;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "检验人")
|
||||||
|
private String inspector;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品特性类型:1 计量型;2 计数型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "1 可用,0 不可用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
|
||||||
|
private Integer valid;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人姓名")
|
||||||
|
private String creatorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private Long updaterId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新人姓名")
|
||||||
|
private String updaterName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
package com.cnbm.generator.code.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 检验单 表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("inspection_sheet")
|
||||||
|
@ApiModel(value = "InspectionSheet对象", description = "检验单 表")
|
||||||
|
public class InspectionSheet implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("订单号,手动输入")
|
||||||
|
private String orderNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("批次号,手填")
|
||||||
|
private String batchNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("检验站点,手填")
|
||||||
|
private String inspectionSite;
|
||||||
|
|
||||||
|
@ApiModelProperty("产品id,关联product表")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@ApiModelProperty("检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
|
||||||
|
private Integer inspectionStage;
|
||||||
|
|
||||||
|
@ApiModelProperty("工序id,关联working_procedure表")
|
||||||
|
private Long workingProcedureId;
|
||||||
|
|
||||||
|
@ApiModelProperty("机台id,关联machine表")
|
||||||
|
private Long machineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("班次id,关联shift表")
|
||||||
|
private Long shiftId;
|
||||||
|
|
||||||
|
@ApiModelProperty("分组样本数(就是这个产品下所有检测参数 的 最大样本数),只给用户查看,值是后台自动计算的")
|
||||||
|
private Integer numberOfGroupedSamples;
|
||||||
|
|
||||||
|
@ApiModelProperty("样本大小(就是检验单(母体)下的子样个数),只给用户查看,值是后台自动计算的")
|
||||||
|
private Integer numberOfSamples;
|
||||||
|
|
||||||
|
@ApiModelProperty("缺陷数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 )")
|
||||||
|
private Integer numberOfDefects;
|
||||||
|
|
||||||
|
@ApiModelProperty("不良数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 )")
|
||||||
|
private Integer defectiveQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("生产人")
|
||||||
|
private String producer;
|
||||||
|
|
||||||
|
@ApiModelProperty("检验人")
|
||||||
|
private String inspector;
|
||||||
|
|
||||||
|
@ApiModelProperty("产品特性类型:1 计量型;2 计数型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("1 可用,0 不可用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
|
||||||
|
@TableLogic
|
||||||
|
private Integer valid;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人")
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人姓名")
|
||||||
|
private String creatorName;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private Long updaterId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人姓名")
|
||||||
|
private String updaterName;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.cnbm.generator.code.excel;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验单 表
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InspectionSheetExcel {
|
||||||
|
@Excel(name = "ID")
|
||||||
|
private Long id;
|
||||||
|
@Excel(name = "订单号,手动输入")
|
||||||
|
private String orderNumber;
|
||||||
|
@Excel(name = "批次号,手填")
|
||||||
|
private String batchNumber;
|
||||||
|
@Excel(name = "检验站点,手填")
|
||||||
|
private String inspectionSite;
|
||||||
|
@Excel(name = "产品id,关联product表")
|
||||||
|
private Long productId;
|
||||||
|
@Excel(name = "检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
|
||||||
|
private Integer inspectionStage;
|
||||||
|
@Excel(name = "工序id,关联working_procedure表")
|
||||||
|
private Long workingProcedureId;
|
||||||
|
@Excel(name = "机台id,关联machine表")
|
||||||
|
private Long machineId;
|
||||||
|
@Excel(name = "班次id,关联shift表")
|
||||||
|
private Long shiftId;
|
||||||
|
@Excel(name = "分组样本数(就是这个产品下所有检测参数 的 最大样本数),只给用户查看,值是后台自动计算的")
|
||||||
|
private Integer numberOfGroupedSamples;
|
||||||
|
@Excel(name = "样本大小(就是检验单(母体)下的子样个数),只给用户查看,值是后台自动计算的")
|
||||||
|
private Integer numberOfSamples;
|
||||||
|
@Excel(name = "缺陷数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 )")
|
||||||
|
private Integer numberOfDefects;
|
||||||
|
@Excel(name = "不良数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 )")
|
||||||
|
private Integer defectiveQuantity;
|
||||||
|
@Excel(name = "生产人")
|
||||||
|
private String producer;
|
||||||
|
@Excel(name = "检验人")
|
||||||
|
private String inspector;
|
||||||
|
@Excel(name = "产品特性类型:1 计量型;2 计数型")
|
||||||
|
private Integer type;
|
||||||
|
@Excel(name = "1 可用,0 不可用")
|
||||||
|
private Integer status;
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
|
||||||
|
private Integer valid;
|
||||||
|
@Excel(name = "创建人")
|
||||||
|
private Long creatorId;
|
||||||
|
@Excel(name = "创建人姓名")
|
||||||
|
private String creatorName;
|
||||||
|
@Excel(name = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@Excel(name = "更新人")
|
||||||
|
private Long updaterId;
|
||||||
|
@Excel(name = "更新人姓名")
|
||||||
|
private String updaterName;
|
||||||
|
@Excel(name = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
@Excel(name = "版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.cnbm.generator.code.mapper;
|
||||||
|
|
||||||
|
import com.cnbm.common.dao.BaseDao;
|
||||||
|
import com.cnbm.generator.code.entity.InspectionSheet;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验单 表
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface InspectionSheetMapper extends BaseDao<InspectionSheet> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<?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.cnbm.generator.code.mapper.InspectionSheetMapper">
|
||||||
|
<resultMap type="com.cnbm.generator.code.entity.InspectionSheet" id="InspectionSheetMap">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<id column="order_number" property="orderNumber" />
|
||||||
|
<id column="batch_number" property="batchNumber" />
|
||||||
|
<id column="inspection_site" property="inspectionSite" />
|
||||||
|
<id column="product_id" property="productId" />
|
||||||
|
<id column="inspection_stage" property="inspectionStage" />
|
||||||
|
<id column="working_procedure_id" property="workingProcedureId" />
|
||||||
|
<id column="machine_id" property="machineId" />
|
||||||
|
<id column="shift_id" property="shiftId" />
|
||||||
|
<id column="number_of_grouped_samples" property="numberOfGroupedSamples" />
|
||||||
|
<id column="number_of_samples" property="numberOfSamples" />
|
||||||
|
<id column="number_of_defects" property="numberOfDefects" />
|
||||||
|
<id column="defective_quantity" property="defectiveQuantity" />
|
||||||
|
<id column="producer" property="producer" />
|
||||||
|
<id column="inspector" property="inspector" />
|
||||||
|
<id column="type" property="type" />
|
||||||
|
<id column="status" property="status" />
|
||||||
|
<id column="remark" property="remark" />
|
||||||
|
<id column="valid" property="valid" />
|
||||||
|
<id column="creator_id" property="creatorId" />
|
||||||
|
<id column="creator_name" property="creatorName" />
|
||||||
|
<id column="create_time" property="createTime" />
|
||||||
|
<id column="updater_id" property="updaterId" />
|
||||||
|
<id column="updater_name" property="updaterName" />
|
||||||
|
<id column="update_time" property="updateTime" />
|
||||||
|
<id column="version" property="version" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
-- 菜单初始SQL
|
||||||
|
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1600308190230409218, 1067246875800000035, '检验单 表', 'code/inspectionSheet', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||||
|
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409219, 1600308190230409218, '查看', NULL, 'code:inspectionSheet:page,code:inspectionSheet:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||||
|
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409220, 1600308190230409218, '新增', NULL, 'code:inspectionSheet:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||||
|
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409221, 1600308190230409218, '修改', NULL, 'code:inspectionSheet:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||||
|
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409222, 1600308190230409218, '删除', NULL, 'code:inspectionSheet:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||||
|
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409223, 1600308190230409218, '导出', NULL, 'code:inspectionSheet:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.cnbm.generator.code.service;
|
||||||
|
|
||||||
|
import com.cnbm.common.service.CrudService;
|
||||||
|
import com.cnbm.generator.code.dto.InspectionSheetDTO;
|
||||||
|
import com.cnbm.generator.code.entity.InspectionSheet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验单 表
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
public interface IInspectionSheetService extends CrudService<InspectionSheet, InspectionSheetDTO> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.cnbm.generator.code.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||||
|
import com.cnbm.generator.code.dto.InspectionSheetDTO;
|
||||||
|
import com.cnbm.generator.code.mapper.InspectionSheetMapper;
|
||||||
|
import com.cnbm.generator.code.entity.InspectionSheet;
|
||||||
|
import com.cnbm.generator.code.service.IInspectionSheetService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验单 表
|
||||||
|
*
|
||||||
|
* @author why
|
||||||
|
* @since 2022-12-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetMapper, InspectionSheet, InspectionSheetDTO> implements IInspectionSheetService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<InspectionSheet> getWrapper(Map<String, Object> params){
|
||||||
|
String id = (String)params.get("id");
|
||||||
|
|
||||||
|
QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -146,14 +146,14 @@ public enum InfluxClient {
|
|||||||
List<String> dropedTagNames = param.getDropedTagNames();
|
List<String> dropedTagNames = param.getDropedTagNames();
|
||||||
Range range = param.getRange();
|
Range range = param.getRange();
|
||||||
String bucket = param.getBucket();
|
String bucket = param.getBucket();
|
||||||
String tagName = param.getTag().getTagName();
|
// String tagName = param.getTag().getTagName();
|
||||||
String tagValue = param.getTag().getTagValue();
|
// String tagValue = param.getTag().getTagValue();
|
||||||
PageInfo pageInfo = param.getPageInfo();
|
PageInfo pageInfo = param.getPageInfo();
|
||||||
|
|
||||||
String flux = "from(bucket:\""+bucket+"\")";
|
String flux = "from(bucket:\""+bucket+"\")";
|
||||||
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
|
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
|
||||||
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
|
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
|
||||||
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
// flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
|
||||||
//调整时区,查询出的结果 +8个小时
|
//调整时区,查询出的结果 +8个小时
|
||||||
flux += "|> timeShift(duration: 8h)";
|
flux += "|> timeShift(duration: 8h)";
|
||||||
for(String dropName:dropedTagNames){
|
for(String dropName:dropedTagNames){
|
||||||
|
@ -30,5 +30,6 @@ public class QueryDataParam extends BaseParam{
|
|||||||
private List<String> dropedTagNames;
|
private List<String> dropedTagNames;
|
||||||
private String bucket;
|
private String bucket;
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
private String inspectionSheetId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.cnbm.processInspection.controller;
|
package com.cnbm.processInspection.controller;
|
||||||
|
|
||||||
import com.cnbm.admin.annotation.LogOperation;
|
import com.cnbm.admin.annotation.LogOperation;
|
||||||
|
import com.cnbm.basic.dto.FeaturesProcedureDTO;
|
||||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||||
import com.cnbm.common.constant.Constant;
|
import com.cnbm.common.constant.Constant;
|
||||||
import com.cnbm.common.page.PageData;
|
import com.cnbm.common.page.PageData;
|
||||||
@ -12,6 +13,7 @@ import com.cnbm.common.validator.group.AddGroup;
|
|||||||
import com.cnbm.common.validator.group.DefaultGroup;
|
import com.cnbm.common.validator.group.DefaultGroup;
|
||||||
import com.cnbm.common.validator.group.UpdateGroup;
|
import com.cnbm.common.validator.group.UpdateGroup;
|
||||||
import com.cnbm.influx.param.QueryDataParam;
|
import com.cnbm.influx.param.QueryDataParam;
|
||||||
|
import com.cnbm.influx.template.Event;
|
||||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||||
import com.cnbm.processInspection.excel.InspectionSheetExcel;
|
import com.cnbm.processInspection.excel.InspectionSheetExcel;
|
||||||
@ -62,7 +64,7 @@ public class InspectionSheetController {
|
|||||||
@ApiImplicitParam(name = "batchNumber", value = "批次号", paramType = "query", dataTypeClass = String.class),
|
@ApiImplicitParam(name = "batchNumber", value = "批次号", paramType = "query", dataTypeClass = String.class),
|
||||||
@ApiImplicitParam(name = "id", value = "检验单号", paramType = "query", dataTypeClass = Integer.class)
|
@ApiImplicitParam(name = "id", value = "检验单号", paramType = "query", dataTypeClass = Integer.class)
|
||||||
})
|
})
|
||||||
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')")
|
// @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')")
|
||||||
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
|
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
|
||||||
|
|
||||||
@ -71,7 +73,7 @@ public class InspectionSheetController {
|
|||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@ApiOperation("信息")
|
@ApiOperation("信息")
|
||||||
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')")
|
//@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')")
|
||||||
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
|
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
|
||||||
InspectionSheetDTO data = inspectionSheetService.get(id);
|
InspectionSheetDTO data = inspectionSheetService.get(id);
|
||||||
|
|
||||||
@ -81,20 +83,23 @@ public class InspectionSheetController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@LogOperation("保存")
|
@LogOperation("保存")
|
||||||
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:save')")
|
// @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:save')")
|
||||||
public Result<Long> save(@RequestBody InspectionSheetDTO dto){
|
public Result save(@RequestBody InspectionSheetDTO dto){
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
try {
|
||||||
inspectionSheetService.save(dto);
|
inspectionSheetService.save(dto);
|
||||||
|
}catch (Exception e){
|
||||||
|
return new Result<Long>().error(1,"没有发现检验参数");
|
||||||
|
}
|
||||||
return new Result<Long>().ok(dto.getId());
|
return new Result<Long>().ok(dto.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@LogOperation("修改")
|
@LogOperation("修改")
|
||||||
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:update')")
|
//@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:update')")
|
||||||
public Result<Long> update(@RequestBody InspectionSheetDTO dto){
|
public Result<Long> update(@RequestBody InspectionSheetDTO dto){
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
@ -107,7 +112,7 @@ public class InspectionSheetController {
|
|||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@LogOperation("删除")
|
@LogOperation("删除")
|
||||||
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:delete')")
|
//@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:delete')")
|
||||||
public Result delete(@RequestBody Long[] ids){
|
public Result delete(@RequestBody Long[] ids){
|
||||||
//效验数据
|
//效验数据
|
||||||
AssertUtils.isArrayEmpty(ids, "id");
|
AssertUtils.isArrayEmpty(ids, "id");
|
||||||
@ -120,7 +125,7 @@ public class InspectionSheetController {
|
|||||||
@GetMapping("export")
|
@GetMapping("export")
|
||||||
@ApiOperation("导出")
|
@ApiOperation("导出")
|
||||||
@LogOperation("导出")
|
@LogOperation("导出")
|
||||||
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:export')")
|
//@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:export')")
|
||||||
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||||
List<InspectionSheetDTO> list = inspectionSheetService.list(params);
|
List<InspectionSheetDTO> list = inspectionSheetService.list(params);
|
||||||
|
|
||||||
@ -147,22 +152,34 @@ public class InspectionSheetController {
|
|||||||
@PostMapping(value = "getFluxParamList")
|
@PostMapping(value = "getFluxParamList")
|
||||||
@ApiOperation(value = "从influxdb中获取检测参数")
|
@ApiOperation(value = "从influxdb中获取检测参数")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
// @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
||||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
// @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
|
||||||
@ApiImplicitParam(name = "id", value = "检验单号", paramType = "query", dataTypeClass = Integer.class),
|
@ApiImplicitParam(name = "inspectionSheetId", value = "检验单号", paramType = "query", dataTypeClass = Long.class),
|
||||||
@ApiImplicitParam(name = "workingProcedureName", value = "工序名称", paramType = "query", dataTypeClass = String.class)
|
@ApiImplicitParam(name = "workingProcedureName", value = "工序名称", paramType = "query", dataTypeClass = String.class)
|
||||||
})
|
})
|
||||||
List<FluxTable> getFluxParamList(@ApiIgnore @RequestParam Map<String, Object> params){
|
List<Event> getFluxParamList(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
return inspectionSheetService.getFluxParamList(params);
|
return inspectionSheetService.getFluxParamList(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("saveFluxParamList")
|
@PostMapping("saveFluxParamList")
|
||||||
@ApiOperation("将样本检测参数写入influxdb")
|
@ApiOperation("将样本检测参数写入influxdb")
|
||||||
public Result saveFluxParamList(@RequestBody InspectionSampleDTO dto){
|
public Result saveFluxParamList(@RequestBody InspectionSampleDTO[] lists){
|
||||||
|
|
||||||
inspectionSheetService.saveFluxParamList(dto);
|
inspectionSheetService.saveFluxParamList(lists);
|
||||||
|
|
||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("getInspectionSheetFeaturesList")
|
||||||
|
@ApiOperation("获取检验单对应检验属性")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
|
||||||
|
@ApiImplicitParam(name = "workingProcedureId", value = "工序", paramType = "query", dataTypeClass = Long.class),
|
||||||
|
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class)
|
||||||
|
})
|
||||||
|
public Result getInspectionSheetFeaturesList(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
|
List<ProductFeaturesDTO> list = inspectionSheetService.getInspectionSheetFeaturesList(params);
|
||||||
|
return new Result<List<ProductFeaturesDTO>>().ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -32,4 +32,7 @@ public class InspectionSampleDTO implements Serializable {
|
|||||||
@ApiModelProperty(value = "取样时间")
|
@ApiModelProperty(value = "取样时间")
|
||||||
private LocalDateTime sampleTime;
|
private LocalDateTime sampleTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "样本号")
|
||||||
|
private String sampleNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ public class InspectionSheetDTO implements Serializable {
|
|||||||
@ApiModelProperty(value = "产品名称,关联product表")
|
@ApiModelProperty(value = "产品名称,关联product表")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
|
@ApiModelProperty(value = "检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
|
||||||
private String inspectionStage;
|
private Integer inspectionStage;
|
||||||
|
|
||||||
@ApiModelProperty(value = "工序id,关联working_procedure表")
|
@ApiModelProperty(value = "工序id,关联working_procedure表")
|
||||||
private Long workingProcedureId;
|
private Long workingProcedureId;
|
||||||
|
@ -38,8 +38,8 @@ public class InspectionSheet implements Serializable {
|
|||||||
@ApiModelProperty("产品id,关联product表")
|
@ApiModelProperty("产品id,关联product表")
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
@ApiModelProperty("检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
|
@ApiModelProperty("检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
|
||||||
private String inspectionStage;
|
private Integer inspectionStage;
|
||||||
|
|
||||||
@ApiModelProperty("工序id,关联working_procedure表")
|
@ApiModelProperty("工序id,关联working_procedure表")
|
||||||
private Long workingProcedureId;
|
private Long workingProcedureId;
|
||||||
|
@ -23,8 +23,8 @@ public class InspectionSheetExcel {
|
|||||||
private String inspectionSite;
|
private String inspectionSite;
|
||||||
@Excel(name = "产品id,关联product表")
|
@Excel(name = "产品id,关联product表")
|
||||||
private Long productId;
|
private Long productId;
|
||||||
@Excel(name = "检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
|
@Excel(name = "检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
|
||||||
private String inspectionStage;
|
private Integer inspectionStage;
|
||||||
@Excel(name = "工序id,关联working_procedure表")
|
@Excel(name = "工序id,关联working_procedure表")
|
||||||
private Long workingProcedureId;
|
private Long workingProcedureId;
|
||||||
@Excel(name = "机台id,关联machine表")
|
@Excel(name = "机台id,关联machine表")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cnbm.processInspection.mapper;
|
package com.cnbm.processInspection.mapper;
|
||||||
|
|
||||||
|
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||||
import com.cnbm.common.dao.BaseDao;
|
import com.cnbm.common.dao.BaseDao;
|
||||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||||
import com.cnbm.processInspection.entity.InspectionSheet;
|
import com.cnbm.processInspection.entity.InspectionSheet;
|
||||||
@ -17,5 +18,6 @@ import java.util.Map;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface InspectionSheetMapper extends BaseDao<InspectionSheet> {
|
public interface InspectionSheetMapper extends BaseDao<InspectionSheet> {
|
||||||
List<InspectionSheetDTO> list(Map<String, Object> params);
|
List<InspectionSheetDTO> list(Map<String, Object> params);
|
||||||
Integer getNumberOfSamples(Long productId);
|
// Integer getNumberOfSamples(Map<String, Object> params);
|
||||||
|
List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params);
|
||||||
}
|
}
|
@ -1,8 +1,10 @@
|
|||||||
package com.cnbm.processInspection.service;
|
package com.cnbm.processInspection.service;
|
||||||
|
|
||||||
|
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||||
import com.cnbm.common.page.PageData;
|
import com.cnbm.common.page.PageData;
|
||||||
import com.cnbm.common.service.CrudService;
|
import com.cnbm.common.service.CrudService;
|
||||||
import com.cnbm.influx.param.QueryDataParam;
|
import com.cnbm.influx.param.QueryDataParam;
|
||||||
|
import com.cnbm.influx.template.Event;
|
||||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||||
import com.cnbm.processInspection.entity.InspectionSheet;
|
import com.cnbm.processInspection.entity.InspectionSheet;
|
||||||
@ -31,8 +33,10 @@ public interface IInspectionSheetService extends CrudService<InspectionSheet, In
|
|||||||
|
|
||||||
List<InspectionSheetDTO> list(Map<String, Object> params);
|
List<InspectionSheetDTO> list(Map<String, Object> params);
|
||||||
|
|
||||||
List<FluxTable> getFluxParamList(Map<String, Object> params);
|
List<Event> getFluxParamList(Map<String, Object> params);
|
||||||
|
|
||||||
void saveFluxParamList(InspectionSampleDTO dto);
|
void saveFluxParamList(InspectionSampleDTO[] lists);
|
||||||
|
|
||||||
|
List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
|
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||||
import com.cnbm.basic.entity.Machine;
|
import com.cnbm.basic.entity.Machine;
|
||||||
import com.cnbm.basic.entity.Product;
|
import com.cnbm.basic.entity.Product;
|
||||||
import com.cnbm.basic.entity.Shift;
|
import com.cnbm.basic.entity.Shift;
|
||||||
@ -15,16 +16,20 @@ import com.cnbm.basic.service.impl.ShiftServiceImpl;
|
|||||||
import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
|
import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
|
||||||
import com.cnbm.common.page.PageData;
|
import com.cnbm.common.page.PageData;
|
||||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||||
|
import com.cnbm.common.spc.util.DataUtils;
|
||||||
import com.cnbm.common.utils.ConvertUtils;
|
import com.cnbm.common.utils.ConvertUtils;
|
||||||
import com.cnbm.influx.config.InfluxClient;
|
import com.cnbm.influx.config.InfluxClient;
|
||||||
|
import com.cnbm.influx.param.PageInfo;
|
||||||
import com.cnbm.influx.param.QueryDataParam;
|
import com.cnbm.influx.param.QueryDataParam;
|
||||||
import com.cnbm.influx.param.Range;
|
import com.cnbm.influx.param.Range;
|
||||||
|
import com.cnbm.influx.param.Tag;
|
||||||
import com.cnbm.influx.template.Event;
|
import com.cnbm.influx.template.Event;
|
||||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
import com.cnbm.processInspection.dto.InspectionSheetDTO;
|
||||||
import com.cnbm.processInspection.entity.InspectionSheet;
|
import com.cnbm.processInspection.entity.InspectionSheet;
|
||||||
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
|
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
|
||||||
import com.cnbm.processInspection.service.IInspectionSheetService;
|
import com.cnbm.processInspection.service.IInspectionSheetService;
|
||||||
|
import com.influxdb.query.FluxRecord;
|
||||||
import com.influxdb.query.FluxTable;
|
import com.influxdb.query.FluxTable;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -37,6 +42,7 @@ import java.time.Instant;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验单 表
|
* 检验单 表
|
||||||
@ -128,12 +134,22 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void save(InspectionSheetDTO dto) {
|
public void save(InspectionSheetDTO dto) {
|
||||||
|
// 验证是否有检验参数
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("productId",dto.getProductId());
|
||||||
|
params.put("workingProcedureId",dto.getWorkingProcedureId());
|
||||||
|
params.put("inspectionStage",dto.getInspectionStage());
|
||||||
|
List<ProductFeaturesDTO> inspectionSheetFeaturesList = getInspectionSheetFeaturesList(params);
|
||||||
|
if(inspectionSheetFeaturesList==null || inspectionSheetFeaturesList.size()==0){
|
||||||
|
throw new RuntimeException("没有发现检验参数");
|
||||||
|
}else{
|
||||||
//分组样本数=样本大小=检验特性分组数的最大值
|
//分组样本数=样本大小=检验特性分组数的最大值
|
||||||
Integer numbersOfSamples = getNumberOfSamples(dto.getProductId());
|
Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize();
|
||||||
if(numbersOfSamples!=null){
|
if(numbersOfSamples!=null){
|
||||||
dto.setNumberOfGroupedSamples(numbersOfSamples);
|
dto.setNumberOfGroupedSamples(numbersOfSamples);
|
||||||
dto.setNumberOfSamples(numbersOfSamples);
|
dto.setNumberOfSamples(numbersOfSamples);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class);
|
InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class);
|
||||||
insert(entity);
|
insert(entity);
|
||||||
}
|
}
|
||||||
@ -163,47 +179,129 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FluxTable> getFluxParamList(Map<String, Object> params){
|
public List<Event> getFluxParamList(Map<String, Object> params){
|
||||||
QueryDataParam queryDataParam = new QueryDataParam();
|
QueryDataParam queryDataParam = new QueryDataParam();
|
||||||
String workingProcedureName = (String)params.get("workingProcedureName");
|
String workingProcedureName = (String)params.get("workingProcedureName");
|
||||||
|
String inspectionSheetId = (String)params.get("inspectionSheetId");
|
||||||
queryDataParam.setMeasurement(workingProcedureName);
|
queryDataParam.setMeasurement(workingProcedureName);
|
||||||
|
queryDataParam.setInspectionSheetId(inspectionSheetId);
|
||||||
queryDataParam.setBucket("qgs-bucket");
|
queryDataParam.setBucket("qgs-bucket");
|
||||||
|
|
||||||
Instant startTime = (Instant) params.get("startTime");
|
// Instant startTime = (Instant) params.get("startTime");
|
||||||
Instant endTime = (Instant) params.get("endTime");
|
// Instant endTime = (Instant) params.get("endTime");
|
||||||
Range range = new Range(startTime,endTime);
|
// Range range = new Range(startTime,endTime);
|
||||||
queryDataParam.setRange(range);
|
// queryDataParam.setRange(range);
|
||||||
|
List<String> dropNames = new ArrayList<>();
|
||||||
|
dropNames.add("transationId");
|
||||||
|
// dropNames.add("inspectionSheetId");
|
||||||
|
queryDataParam.setDropedTagNames(dropNames);
|
||||||
|
// queryDataParam.setTag(new Tag("argName","forUpdate"));
|
||||||
|
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(),DataUtils.getAfterDate(999).toInstant()));
|
||||||
|
queryDataParam.setPageInfo(new PageInfo(1,10));
|
||||||
|
|
||||||
List<FluxTable> list = InfluxClient.Client.query(queryDataParam);
|
List<FluxTable> fluxTableList = InfluxClient.Client.query(queryDataParam);
|
||||||
return list;
|
List<Event> eventList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (FluxTable fluxTable : fluxTableList) {
|
||||||
|
List<FluxRecord> records = fluxTable.getRecords(); // 获取实际的记录操作
|
||||||
|
// List<FluxColumn> columns = fluxTable.getColumns(); // 获取返回的列
|
||||||
|
// System.out.println(columns); // 下面的数据显示是按照当前的column中的label名称获取的数据
|
||||||
|
//System.out.println(records);
|
||||||
|
for (FluxRecord fluxRecord : records) {
|
||||||
|
Instant time = fluxRecord.getTime();
|
||||||
|
String argName = (String)fluxRecord.getValueByKey("argName");
|
||||||
|
Double argValue = Double.valueOf(fluxRecord.getValueByKey("_value").toString());
|
||||||
|
String batchNum = (String)fluxRecord.getValueByKey("batchNum");
|
||||||
|
String sampleNo = (String)fluxRecord.getValueByKey("sampleNo");
|
||||||
|
// System.out.println(fluxRecord.getTime() + ": " + fluxRecord.getValueByKey("argName") + ":"
|
||||||
|
// + fluxRecord.getValueByKey("_value") + ": " + fluxRecord.getValueByKey("batchNum"));
|
||||||
|
eventList.add(newEvent(time,inspectionSheetId,argName,argValue,batchNum,sampleNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新检验单缺陷数不良数
|
||||||
|
//根据样本号分组
|
||||||
|
Map<String,List<Event>> map = eventList.stream().collect(Collectors.groupingBy(Event::getSampleNumber));
|
||||||
|
//获取的产品特性参照值
|
||||||
|
InspectionSheetDTO dto = get((Long) params.get("inspectionSheetId"));
|
||||||
|
Map<String, Object> params2 = new HashMap<>();
|
||||||
|
params2.put("productId",dto.getProductId());
|
||||||
|
params2.put("workingProcedureId",dto.getWorkingProcedureId());
|
||||||
|
params2.put("inspectionStage",dto.getInspectionStage());
|
||||||
|
//缺陷
|
||||||
|
Integer numberOfDefects = 0;
|
||||||
|
//不良
|
||||||
|
Integer defectiveQuantity = 0;
|
||||||
|
|
||||||
|
List<ProductFeaturesDTO> featuresList = getInspectionSheetFeaturesList(params2);
|
||||||
|
//循环每个样本组
|
||||||
|
for (Map.Entry<String, List<Event>> entry : map.entrySet()) {
|
||||||
|
//该样本的缺陷数
|
||||||
|
Integer eventDefects = 0;
|
||||||
|
//该样本的属性列表
|
||||||
|
List<Event> eventList1 = entry.getValue();
|
||||||
|
for(Event event : eventList1){
|
||||||
|
String featureName = event.getArgName();
|
||||||
|
ProductFeaturesDTO feature = featuresList.stream().filter(u -> u.getName().equals(featureName)).findAny().orElse(null);
|
||||||
|
if(feature!=null){
|
||||||
|
//1 计量型;2 计数型
|
||||||
|
if(feature.getType()==1){
|
||||||
|
Double featureValue = Double.valueOf(event.getArgValue());
|
||||||
|
if(featureValue>feature.getUsl()||featureValue<feature.getLsl()) {
|
||||||
|
eventDefects = eventDefects + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(feature.getType()==2){
|
||||||
|
Integer featureValue = Integer.valueOf(event.getArgValue());
|
||||||
|
if(featureValue==1){
|
||||||
|
eventDefects = eventDefects + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(eventDefects!=0){
|
||||||
|
numberOfDefects = numberOfDefects + eventDefects;
|
||||||
|
defectiveQuantity = defectiveQuantity + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
InspectionSheetDTO updateDto = new InspectionSheetDTO();
|
||||||
|
updateDto.setId((Long)params.get("inspectionSheetId"));
|
||||||
|
updateDto.setNumberOfDefects(numberOfDefects);
|
||||||
|
updateDto.setDefectiveQuantity(defectiveQuantity);
|
||||||
|
update(updateDto);
|
||||||
|
|
||||||
|
return eventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveFluxParamList(InspectionSampleDTO dto){
|
public void saveFluxParamList(InspectionSampleDTO[] lists){
|
||||||
|
for(InspectionSampleDTO dto:lists) {
|
||||||
//String jsonData = {"workingProcedureName":"test","inspectionSheetId":"116","param1":"0.47","param2":"0.687","param2":"0.53"};
|
//String jsonData = {"workingProcedureName":"test","inspectionSheetId":"116","param1":"0.47","param2":"0.687","param2":"0.53"};
|
||||||
String workingProcedureName = dto.getWorkingProcedureName();
|
String workingProcedureName = dto.getWorkingProcedureName();
|
||||||
String inspectionSheetId = dto.getInspectionSheetId();
|
String inspectionSheetId = dto.getInspectionSheetId();
|
||||||
String batchNum = dto.getBatchNum();
|
String batchNum = dto.getBatchNum();
|
||||||
|
String sampleNumber = dto.getSampleNumber();
|
||||||
String jsonData = dto.getJsonData();
|
String jsonData = dto.getJsonData();
|
||||||
JSONObject json = JSON.parseObject(jsonData);
|
JSONObject json = JSON.parseObject(jsonData);
|
||||||
// LocalDateTime sampleTime = dto.getSampleTime();
|
LocalDateTime sampleTime = dto.getSampleTime();
|
||||||
// Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC);
|
Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC);
|
||||||
Instant eventTime = new Date().toInstant();
|
|
||||||
|
|
||||||
List<Event> list = new ArrayList<>();
|
List<Event> list = new ArrayList<>();
|
||||||
for (Map.Entry entry : json.entrySet()) {
|
for (Map.Entry entry : json.entrySet()) {
|
||||||
String key = entry.getKey().toString();
|
String key = entry.getKey().toString();
|
||||||
Double v = Double.valueOf(entry.getValue().toString());
|
Double v = Double.valueOf(entry.getValue().toString());
|
||||||
list.add(newEvent(eventTime,inspectionSheetId,key,v,batchNum));
|
list.add(newEvent(eventTime, inspectionSheetId, key, v, batchNum, sampleNumber));
|
||||||
}
|
}
|
||||||
InfluxClient.Client.batchInsert(list, workingProcedureName);
|
InfluxClient.Client.batchInsert(list, workingProcedureName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Event newEvent(Instant time,String inspectionSheetId,String argName,Double argValue,String batchNum){
|
private Event newEvent(Instant time,String inspectionSheetId,String argName,Double argValue,String batchNum,String sampleNo){
|
||||||
Event event = new Event();
|
Event event = new Event();
|
||||||
event.setInspectionSheetId(inspectionSheetId);
|
event.setInspectionSheetId(inspectionSheetId);
|
||||||
event.setTime(time);
|
event.setTime(time);
|
||||||
event.setBatchNum(batchNum);
|
event.setBatchNum(batchNum);
|
||||||
|
event.setSampleNumber(sampleNo);
|
||||||
event.setArgName(argName);
|
event.setArgName(argName);
|
||||||
if(!Objects.equals(argValue, "") && argValue != null ){
|
if(!Objects.equals(argValue, "") && argValue != null ){
|
||||||
event.setArgValue(argValue.toString());
|
event.setArgValue(argValue.toString());
|
||||||
@ -211,7 +309,13 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNumberOfSamples(Long id) {
|
// @Override
|
||||||
return mapper.getNumberOfSamples(id);
|
// public Integer getNumberOfSamples(Map<String, Object> params) {
|
||||||
|
// return mapper.getNumberOfSamples(params);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params) {
|
||||||
|
return mapper.getInspectionSheetFeaturesList(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -65,10 +65,40 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getNumberOfSamples" resultType="Integer">
|
<select id="getNumberOfSamples" resultType="Integer">
|
||||||
select max(sample_size) from product_features
|
select max(sample_size)
|
||||||
|
from product_features pf
|
||||||
|
LEFT JOIN features_stage_procedure_relation fspr ON pf.id=fspr.product_features_id
|
||||||
<where>
|
<where>
|
||||||
valid = 1 AND product_id = #{id}
|
pf.valid = 1 and fspr.valid = 1
|
||||||
|
<if test="productId != null">
|
||||||
|
and pf.product_id = #{productId}
|
||||||
|
</if>
|
||||||
|
<if test="inspectionStage != null">
|
||||||
|
and fspr.inspection_stage = #{inspectionStage}
|
||||||
|
</if>
|
||||||
|
<if test="workingProcedureId != null">
|
||||||
|
and fspr.working_procedure_id = #{workingProcedureId}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getInspectionSheetFeaturesList" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
|
||||||
|
select pf.*
|
||||||
|
from features_stage_procedure_relation fspr
|
||||||
|
LEFT JOIN product_features pf ON pf.id=fspr.product_features_id
|
||||||
|
<where>
|
||||||
|
pf.valid = 1 and fspr.valid = 1
|
||||||
|
<if test="productId != null">
|
||||||
|
and pf.product_id = #{productId}
|
||||||
|
</if>
|
||||||
|
<if test="inspectionStage != null">
|
||||||
|
and fspr.inspection_stage = #{inspectionStage}
|
||||||
|
</if>
|
||||||
|
<if test="workingProcedureId != null">
|
||||||
|
and fspr.working_procedure_id = #{workingProcedureId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by pf.id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user