yanyang #5

Merged
yanyang merged 2 commits from yanyang into master 2022-08-01 13:54:40 +08:00
26 changed files with 436 additions and 24 deletions
Showing only changes of commit e9e0c47536 - Show all commits

View File

@ -73,6 +73,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/webjars/**", "/webjars/**",
"/websocket/**", "/websocket/**",
"/influx/**", "/influx/**",
"/basic/**",
"/processInspection/**", "/processInspection/**",
"/captcha").anonymous() "/captcha").anonymous()
// .antMatchers("/testCors").hasAuthority("system:dept:list222") // .antMatchers("/testCors").hasAuthority("system:dept:list222")

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/factory") @RequestMapping("/basic/factory")
@Api(tags="工厂 表") @Api(tags="工厂 表")
public class FactoryController { public class FactoryController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/machine") @RequestMapping("/basic/machine")
@Api(tags="机台表") @Api(tags="机台表")
public class MachineController { public class MachineController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/measureTool") @RequestMapping("/basic/measureTool")
@Api(tags="量具表") @Api(tags="量具表")
public class MeasureToolController { public class MeasureToolController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/platform") @RequestMapping("/basic/platform")
@Api(tags="站点表") @Api(tags="站点表")
public class PlatformController { public class PlatformController {
@Autowired @Autowired

View File

@ -13,6 +13,7 @@ import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.basic.dto.ProductDTO; import com.cnbm.basic.dto.ProductDTO;
import com.cnbm.basic.excel.ProductExcel; import com.cnbm.basic.excel.ProductExcel;
import com.cnbm.basic.service.IProductService; import com.cnbm.basic.service.IProductService;
import com.google.gson.internal.$Gson$Preconditions;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -34,7 +35,7 @@ import java.util.Map;
* @since 2022-07-11 * @since 2022-07-11
*/ */
@RestController @RestController
@RequestMapping("/code/product") @RequestMapping("/basic/product")
@Api(tags="产品 表") @Api(tags="产品 表")
public class ProductController { public class ProductController {
@Autowired @Autowired
@ -68,13 +69,13 @@ public class ProductController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
//@PreAuthorize("@ex.hasAuthority('code:product:save')") //@PreAuthorize("@ex.hasAuthority('code:product:save')")
public Result save(@RequestBody ProductDTO dto){ public Result<ProductDTO> save(@RequestBody ProductDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
productService.save(dto); productService.save(dto);
return new Result(); return new Result<ProductDTO>().ok(dto);
} }
@PutMapping @PutMapping
@ -113,13 +114,12 @@ public class ProductController {
ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class);
} }
@GetMapping("status") @GetMapping("status/{id}")
@ApiOperation("改变状态") @ApiOperation("改变状态")
@LogOperation("改变状态") @LogOperation("改变状态")
public Result changeStatus(@PathVariable("id") Long id){ public Result changeStatus(@PathVariable("id") Long id){
productService.changeStatus(id); boolean b = productService.changeStatus(id);
return new Result().ok(b);
return new Result();
} }
} }

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-27 * @since 2022-07-27
*/ */
@RestController @RestController
@RequestMapping("/code/productFactoryRelation") @RequestMapping("/basic/productFactoryRelation")
@Api(tags="产品-工厂 关系表") @Api(tags="产品-工厂 关系表")
public class ProductFactoryRelationController { public class ProductFactoryRelationController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/productFeatures") @RequestMapping("/basic/productFeatures")
@Api(tags="产品特性 表") @Api(tags="产品特性 表")
public class ProductFeaturesController { public class ProductFeaturesController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/productFeaturesHis") @RequestMapping("/basic/productFeaturesHis")
@Api(tags="产品特性 历史表") @Api(tags="产品特性 历史表")
public class ProductFeaturesHisController { public class ProductFeaturesHisController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-06-30 * @since 2022-06-30
*/ */
@RestController @RestController
@RequestMapping("/code/productType") @RequestMapping("/basic/productType")
@Api(tags="产品类型 表") @Api(tags="产品类型 表")
public class ProductTypeController { public class ProductTypeController {
@Autowired @Autowired

View File

@ -35,7 +35,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/productWorkingprocedureRelation") @RequestMapping("/basic/productWorkingprocedureRelation")
@Api(tags="产品-工序 关系表") @Api(tags="产品-工序 关系表")
public class ProductWorkingprocedureRelationController { public class ProductWorkingprocedureRelationController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/shift") @RequestMapping("/basic/shift")
@Api(tags="班次 表") @Api(tags="班次 表")
public class ShiftController { public class ShiftController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/team") @RequestMapping("/basic/team")
@Api(tags="班组 表") @Api(tags="班组 表")
public class TeamController { public class TeamController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-06-30 * @since 2022-06-30
*/ */
@RestController @RestController
@RequestMapping("/code/unit") @RequestMapping("/basic/unit")
@Api(tags="单位 表") @Api(tags="单位 表")
public class UnitController { public class UnitController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/workingProcedure") @RequestMapping("/basic/workingProcedure")
@Api(tags="工序 表") @Api(tags="工序 表")
public class WorkingProcedureController { public class WorkingProcedureController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/workingProcedureType") @RequestMapping("/basic/workingProcedureType")
@Api(tags="工序类型表 表") @Api(tags="工序类型表 表")
public class WorkingProcedureTypeController { public class WorkingProcedureTypeController {
@Autowired @Autowired

View File

@ -22,6 +22,6 @@ public interface IProductService extends CrudService<Product, ProductDTO> {
void update(ProductDTO dto); void update(ProductDTO dto);
void changeStatus(Long id); boolean changeStatus(Long id);
} }

View File

@ -90,12 +90,12 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void changeStatus(Long id) { public boolean changeStatus(Long id) {
//改变状态 开启1 关闭0 //改变状态 开启1 关闭0
Product entity = baseDao.selectById(id); Product entity = baseDao.selectById(id);
Integer status = 1 - entity.getStatus(); Integer status = 1 - entity.getStatus();
entity.setStatus(status); entity.setStatus(status);
updateById(entity); return updateById(entity);
} }
} }

View File

@ -0,0 +1,116 @@
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.ProductDTO;
import com.cnbm.generator.code.excel.ProductExcel;
import com.cnbm.generator.code.service.IProductService;
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-08-01
*/
@RestController
@RequestMapping("/code/product")
@Api(tags="产品 表")
public class ProductController {
@Autowired
private IProductService productService;
@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:product:page')")
public Result<PageData<ProductDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ProductDTO> page = productService.page(params);
return new Result<PageData<ProductDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:product:info')")
public Result<ProductDTO> get(@PathVariable("id") Long id){
ProductDTO data = productService.get(id);
return new Result<ProductDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:product:save')")
public Result save(@RequestBody ProductDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
productService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:product:update')")
public Result update(@RequestBody ProductDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
productService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:product:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
productService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:product:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ProductDTO> list = productService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class);
}
}

View File

@ -0,0 +1,86 @@
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-08-01
*/
@Data
@ApiModel(value = "产品 表DTO对象")
public class ProductDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "产品 名")
private String name;
@ApiModelProperty(value = "产品 编码")
private String code;
@ApiModelProperty(value = "产品 规格")
private String specifications;
@ApiModelProperty(value = "产品 图纸")
private String drawing;
@ApiModelProperty(value = "描述")
private String descs;
@ApiModelProperty(value = "")
private Long productTypeId;
@ApiModelProperty(value = "")
private Long unitId;
@ApiModelProperty(value = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@ApiModelProperty(value = "检验标准")
private String inspectionStandard;
@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;
}

View File

@ -0,0 +1,79 @@
package com.cnbm.generator.code.entity;
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-08-01
*/
@Data
@ApiModel(value = "Product对象", description = "产品 表")
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty("产品 名")
private String name;
@ApiModelProperty("产品 编码")
private String code;
@ApiModelProperty("产品 规格")
private String specifications;
@ApiModelProperty("产品 图纸")
private String drawing;
@ApiModelProperty("描述")
private String descs;
private Long productTypeId;
private Long unitId;
@ApiModelProperty("检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@ApiModelProperty("检验标准")
private String inspectionStandard;
@ApiModelProperty("1 可用0 不可用")
private Integer status;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
private Integer valid;
private Long creatorId;
@ApiModelProperty("创建人姓名")
private String creatorName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
private Long updaterId;
@ApiModelProperty("更新人姓名")
private String updaterName;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("版本号")
private Integer version;
}

View File

@ -0,0 +1,60 @@
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-08-01
*/
@Data
public class ProductExcel {
@Excel(name = "")
private Long id;
@Excel(name = "产品 名")
private String name;
@Excel(name = "产品 编码")
private String code;
@Excel(name = "产品 规格")
private String specifications;
@Excel(name = "产品 图纸")
private String drawing;
@Excel(name = "描述")
private String descs;
@Excel(name = "")
private Long productTypeId;
@Excel(name = "")
private Long unitId;
@Excel(name = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@Excel(name = "检验标准")
private String inspectionStandard;
@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;
}

View File

@ -0,0 +1,16 @@
package com.cnbm.generator.code.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.generator.code.entity.Product;
import org.apache.ibatis.annotations.Mapper;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
@Mapper
public interface ProductMapper extends BaseDao<Product> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.generator.code.mapper.ProductMapper">
</mapper>

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.ProductDTO;
import com.cnbm.generator.code.entity.Product;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
public interface IProductService extends CrudService<Product, ProductDTO> {
}

View File

@ -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.ProductDTO;
import com.cnbm.generator.code.mapper.ProductMapper;
import com.cnbm.generator.code.entity.Product;
import com.cnbm.generator.code.service.IProductService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
@Service
public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product, ProductDTO> implements IProductService {
@Override
public QueryWrapper<Product> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<Product> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}