代码同步02.13
parent
c13e5e8e54
commit
5a6f345362
@ -1,29 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.api.goodsverify;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.basic.api.goodsverify.dto.GoodsVerifyRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.basic.convert.goodsverify.GoodsVerifyConvert;
|
|
||||||
import cn.iocoder.yudao.module.basic.service.goodsverify.GoodsVerifyService;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
|
||||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
|
||||||
@Validated
|
|
||||||
public class GoodsVerifyApiImpl implements GoodsVerifyApi {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private GoodsVerifyService goodsVerifyService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<List<GoodsVerifyRespDTO>> getGoodsVerifys(String goodsId, Long belongBusinessId) {
|
|
||||||
return CommonResult.success(GoodsVerifyConvert.INSTANCE.convertToDTOList(goodsVerifyService.getGoodsVerifys(goodsId, belongBusinessId)));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.controller.admin.goodsverify;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.GoodsVerifyCreateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.GoodsVerifyPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.GoodsVerifyRespVO;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.GoodsVerifyUpdateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.basic.convert.goodsverify.GoodsVerifyConvert;
|
|
||||||
import cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify.GoodsVerifyDO;
|
|
||||||
import cn.iocoder.yudao.module.basic.service.goodsverify.GoodsVerifyService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
@Api(tags = "管理后台 - 商品认证")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/basic/goods-verify")
|
|
||||||
@Validated
|
|
||||||
public class GoodsVerifyController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private GoodsVerifyService goodsVerifyService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@ApiOperation("创建商品认证")
|
|
||||||
@PreAuthorize("@ss.hasPermission('basic:goods-verify:create')")
|
|
||||||
public CommonResult<Long> createGoodsVerify(@Valid @RequestBody GoodsVerifyCreateReqVO createReqVO) {
|
|
||||||
return success(goodsVerifyService.createGoodsVerify(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@ApiOperation("更新商品认证")
|
|
||||||
@PreAuthorize("@ss.hasPermission('basic:goods-verify:update')")
|
|
||||||
public CommonResult<Boolean> updateGoodsVerify(@Valid @RequestBody GoodsVerifyUpdateReqVO updateReqVO) {
|
|
||||||
goodsVerifyService.updateGoodsVerify(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@ApiOperation("删除商品认证")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('basic:goods-verify:delete')")
|
|
||||||
public CommonResult<Boolean> deleteGoodsVerify(@RequestParam("id") Long id) {
|
|
||||||
goodsVerifyService.deleteGoodsVerify(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
|
||||||
@ApiOperation("获得商品认证")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('basic:goods-verify:query')")
|
|
||||||
public CommonResult<GoodsVerifyRespVO> getGoodsVerify(@RequestParam("id") Long id) {
|
|
||||||
GoodsVerifyDO goodsVerify = goodsVerifyService.getGoodsVerify(id);
|
|
||||||
return success(GoodsVerifyConvert.INSTANCE.convert(goodsVerify));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
|
||||||
@ApiOperation("获得商品认证分页")
|
|
||||||
@PreAuthorize("@ss.hasPermission('basic:goods-verify:query')")
|
|
||||||
public CommonResult<PageResult<GoodsVerifyRespVO>> getGoodsVerifyPage(@Valid GoodsVerifyPageReqVO pageVO) {
|
|
||||||
PageResult<GoodsVerifyDO> pageResult = goodsVerifyService.getGoodsVerifyPage(pageVO);
|
|
||||||
return success(GoodsVerifyConvert.INSTANCE.convertPage(pageResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/getByGoodsId")
|
|
||||||
@ApiOperation("根据商品编码获得商品认证")
|
|
||||||
@ApiImplicitParam(name = "goodsId", value = "商品编码", required = true, example = "GOCD202305061351B2PO", dataTypeClass = String.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('basic:goods-verify:query')")
|
|
||||||
public CommonResult<List<GoodsVerifyRespVO>> getByGoodsId(@RequestParam("goodsId") String goodsId) {
|
|
||||||
return success(GoodsVerifyConvert.INSTANCE.convertList(goodsVerifyService.getByGoodsId(goodsId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 商品认证创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class GoodsVerifyCreateReqVO extends GoodsVerifyBaseVO {
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 商品认证 Response VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class GoodsVerifyRespVO extends GoodsVerifyBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码", required = true)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 商品认证更新 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class GoodsVerifyUpdateReqVO extends GoodsVerifyBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码", required = true)
|
|
||||||
@NotNull(message = "编码不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.convert.goodsverify;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.basic.api.goodsverify.dto.GoodsVerifyRespDTO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify.GoodsVerifyDO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品认证 Convert
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface GoodsVerifyConvert {
|
|
||||||
|
|
||||||
GoodsVerifyConvert INSTANCE = Mappers.getMapper(GoodsVerifyConvert.class);
|
|
||||||
|
|
||||||
GoodsVerifyDO convert(GoodsVerifyCreateReqVO bean);
|
|
||||||
|
|
||||||
GoodsVerifyDO convert(GoodsVerifyUpdateReqVO bean);
|
|
||||||
|
|
||||||
GoodsVerifyRespVO convert(GoodsVerifyDO bean);
|
|
||||||
|
|
||||||
List<GoodsVerifyRespDTO> convertToDTOList(List<GoodsVerifyDO> list);
|
|
||||||
|
|
||||||
List<GoodsVerifyRespVO> convertList(List<GoodsVerifyDO> list);
|
|
||||||
|
|
||||||
PageResult<GoodsVerifyRespVO> convertPage(PageResult<GoodsVerifyDO> page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.dal.mysql.goodsverify;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
||||||
import cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify.GoodsVerifyDO;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.*;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品认证 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface GoodsVerifyMapper extends BaseMapperX<GoodsVerifyDO> {
|
|
||||||
|
|
||||||
default PageResult<GoodsVerifyDO> selectPage(GoodsVerifyPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<GoodsVerifyDO>()
|
|
||||||
.likeIfPresent(GoodsVerifyDO::getGoodsName, reqVO.getGoodsName())
|
|
||||||
.eqIfPresent(GoodsVerifyDO::getGoodsId, reqVO.getGoodsId())
|
|
||||||
.likeIfPresent(GoodsVerifyDO::getVerifyName, reqVO.getVerifyName())
|
|
||||||
.eqIfPresent(GoodsVerifyDO::getVerifyAgencies, reqVO.getVerifyAgencies())
|
|
||||||
.betweenIfPresent(GoodsVerifyDO::getVerifyStartTime, reqVO.getVerifyStartTime())
|
|
||||||
.betweenIfPresent(GoodsVerifyDO::getVerifyEndTime, reqVO.getVerifyEndTime())
|
|
||||||
.eqIfPresent(GoodsVerifyDO::getVerifyDataUrl, reqVO.getVerifyDataUrl())
|
|
||||||
.eqIfPresent(GoodsVerifyDO::getVerifyIsForver, reqVO.getVerifyIsForver())
|
|
||||||
.betweenIfPresent(GoodsVerifyDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.eqIfPresent(GoodsVerifyDO::getBelongBusinessId, reqVO.getBelongBusinessId())
|
|
||||||
.likeIfPresent(GoodsVerifyDO::getBelongBusinessName, reqVO.getBelongBusinessName())
|
|
||||||
.orderByDesc(GoodsVerifyDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
IPage<GoodsVerifyDO> selectPageByInfo(IPage<GoodsVerifyDO> page, @Param(Constants.WRAPPER) Wrapper<GoodsVerifyDO> queryWrapper);
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.service.goodsverify;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import javax.validation.*;
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify.GoodsVerifyDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品认证 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface GoodsVerifyService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建商品认证
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
Long createGoodsVerify(@Valid GoodsVerifyCreateReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新商品认证
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateGoodsVerify(@Valid GoodsVerifyUpdateReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除商品认证
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteGoodsVerify(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得商品认证
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 商品认证
|
|
||||||
*/
|
|
||||||
GoodsVerifyDO getGoodsVerify(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得商品认证列表
|
|
||||||
* @param goodsId
|
|
||||||
* @param belongBusinessId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<GoodsVerifyDO> getGoodsVerifys(String goodsId, Long belongBusinessId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得商品认证分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 商品认证分页
|
|
||||||
*/
|
|
||||||
PageResult<GoodsVerifyDO> getGoodsVerifyPage(GoodsVerifyPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据商品编码获得商品认证信息
|
|
||||||
* @param goodsId 商品编码
|
|
||||||
* @return 认证信息
|
|
||||||
*/
|
|
||||||
List<GoodsVerifyDO> getByGoodsId(String goodsId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,169 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.basic.service.goodsverify;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify.GoodsVerifyDO;
|
|
||||||
import cn.iocoder.yudao.module.basic.dal.mysql.goodsverify.GoodsVerifyMapper;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.hutool.core.util.RandomUtil.*;
|
|
||||||
import static cn.iocoder.yudao.module.basic.enums.ErrorCodeConstants.*;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link GoodsVerifyServiceImpl} 的单元测试类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Import(GoodsVerifyServiceImpl.class)
|
|
||||||
public class GoodsVerifyServiceImplTest extends BaseDbUnitTest {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private GoodsVerifyServiceImpl goodsVerifyService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private GoodsVerifyMapper goodsVerifyMapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateGoodsVerify_success() {
|
|
||||||
// 准备参数
|
|
||||||
GoodsVerifyCreateReqVO reqVO = randomPojo(GoodsVerifyCreateReqVO.class);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Long goodsVerifyId = goodsVerifyService.createGoodsVerify(reqVO);
|
|
||||||
// 断言
|
|
||||||
assertNotNull(goodsVerifyId);
|
|
||||||
// 校验记录的属性是否正确
|
|
||||||
GoodsVerifyDO goodsVerify = goodsVerifyMapper.selectById(goodsVerifyId);
|
|
||||||
assertPojoEquals(reqVO, goodsVerify);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateGoodsVerify_success() {
|
|
||||||
// mock 数据
|
|
||||||
GoodsVerifyDO dbGoodsVerify = randomPojo(GoodsVerifyDO.class);
|
|
||||||
goodsVerifyMapper.insert(dbGoodsVerify);// @Sql: 先插入出一条存在的数据
|
|
||||||
// 准备参数
|
|
||||||
GoodsVerifyUpdateReqVO reqVO = randomPojo(GoodsVerifyUpdateReqVO.class, o -> {
|
|
||||||
o.setId(dbGoodsVerify.getId()); // 设置更新的 ID
|
|
||||||
});
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
goodsVerifyService.updateGoodsVerify(reqVO);
|
|
||||||
// 校验是否更新正确
|
|
||||||
GoodsVerifyDO goodsVerify = goodsVerifyMapper.selectById(reqVO.getId()); // 获取最新的
|
|
||||||
assertPojoEquals(reqVO, goodsVerify);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateGoodsVerify_notExists() {
|
|
||||||
// 准备参数
|
|
||||||
GoodsVerifyUpdateReqVO reqVO = randomPojo(GoodsVerifyUpdateReqVO.class);
|
|
||||||
|
|
||||||
// 调用, 并断言异常
|
|
||||||
assertServiceException(() -> goodsVerifyService.updateGoodsVerify(reqVO), GOODS_VERIFY_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteGoodsVerify_success() {
|
|
||||||
// mock 数据
|
|
||||||
GoodsVerifyDO dbGoodsVerify = randomPojo(GoodsVerifyDO.class);
|
|
||||||
goodsVerifyMapper.insert(dbGoodsVerify);// @Sql: 先插入出一条存在的数据
|
|
||||||
// 准备参数
|
|
||||||
Long id = dbGoodsVerify.getId();
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
goodsVerifyService.deleteGoodsVerify(id);
|
|
||||||
// 校验数据不存在了
|
|
||||||
assertNull(goodsVerifyMapper.selectById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteGoodsVerify_notExists() {
|
|
||||||
// 准备参数
|
|
||||||
Long id = randomLongId();
|
|
||||||
|
|
||||||
// 调用, 并断言异常
|
|
||||||
assertServiceException(() -> goodsVerifyService.deleteGoodsVerify(id), GOODS_VERIFY_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
|
||||||
public void testGetGoodsVerifyPage() {
|
|
||||||
// mock 数据
|
|
||||||
GoodsVerifyDO dbGoodsVerify = randomPojo(GoodsVerifyDO.class, o -> { // 等会查询到
|
|
||||||
o.setGoodsName(null);
|
|
||||||
o.setGoodsId(null);
|
|
||||||
o.setVerifyName(null);
|
|
||||||
o.setVerifyAgencies(null);
|
|
||||||
o.setVerifyStartTime(null);
|
|
||||||
o.setVerifyEndTime(null);
|
|
||||||
o.setVerifyDataUrl(null);
|
|
||||||
o.setVerifyIsForver(null);
|
|
||||||
o.setCreateTime(null);
|
|
||||||
o.setBelongBusinessId(null);
|
|
||||||
o.setBelongBusinessName(null);
|
|
||||||
});
|
|
||||||
goodsVerifyMapper.insert(dbGoodsVerify);
|
|
||||||
// 测试 goodsName 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setGoodsName(null)));
|
|
||||||
// 测试 goodsId 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setGoodsId(null)));
|
|
||||||
// 测试 verifyName 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setVerifyName(null)));
|
|
||||||
// 测试 verifyAgencies 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setVerifyAgencies(null)));
|
|
||||||
// 测试 verifyStartTime 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setVerifyStartTime(null)));
|
|
||||||
// 测试 verifyEndTime 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setVerifyEndTime(null)));
|
|
||||||
// 测试 verifyDataUrl 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setVerifyDataUrl(null)));
|
|
||||||
// 测试 verifyIsForver 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setVerifyIsForver(null)));
|
|
||||||
// 测试 createTime 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setCreateTime(null)));
|
|
||||||
// 测试 belongBusinessId 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setBelongBusinessId(null)));
|
|
||||||
// 测试 belongBusinessName 不匹配
|
|
||||||
goodsVerifyMapper.insert(cloneIgnoreId(dbGoodsVerify, o -> o.setBelongBusinessName(null)));
|
|
||||||
// 准备参数
|
|
||||||
GoodsVerifyPageReqVO reqVO = new GoodsVerifyPageReqVO();
|
|
||||||
reqVO.setGoodsName(null);
|
|
||||||
reqVO.setGoodsId(null);
|
|
||||||
reqVO.setVerifyName(null);
|
|
||||||
reqVO.setVerifyAgencies(null);
|
|
||||||
// reqVO.setVerifyStartTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
|
||||||
// reqVO.setVerifyEndTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
|
||||||
reqVO.setVerifyDataUrl(null);
|
|
||||||
reqVO.setVerifyIsForver(null);
|
|
||||||
// reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
|
||||||
reqVO.setBelongBusinessId(null);
|
|
||||||
reqVO.setBelongBusinessName(null);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
PageResult<GoodsVerifyDO> pageResult = goodsVerifyService.getGoodsVerifyPage(reqVO);
|
|
||||||
// 断言
|
|
||||||
assertEquals(1, pageResult.getTotal());
|
|
||||||
assertEquals(1, pageResult.getList().size());
|
|
||||||
assertPojoEquals(dbGoodsVerify, pageResult.getList().get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>yudao</artifactId>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<version>${revision}</version> <!-- 1. 修改 version 为 ${revision} -->
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<modules>
|
|
||||||
<module>yudao-module-flow-api</module>
|
|
||||||
<module>yudao-module-flow-biz</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<artifactId>yudao-module-flow</artifactId>
|
|
||||||
<packaging>pom</packaging> <!-- 2. 新增 packaging 为 pom -->
|
|
||||||
|
|
||||||
<name>${project.artifactId}</name> <!-- 3. 新增 name 为 ${project.artifactId} -->
|
|
||||||
<description> <!-- 4. 新增 description 为该模块的描述 -->
|
|
||||||
flow 模块,主要实现 经销流转 等功能。
|
|
||||||
</description>
|
|
||||||
</project>
|
|
@ -1,63 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.api.outbound.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class OutboundGoodsDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 出库单-商品批次关联绑定id
|
|
||||||
*/
|
|
||||||
private String bindId;
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private String goodsId;
|
|
||||||
/**
|
|
||||||
* 商品名称
|
|
||||||
*/
|
|
||||||
private String goodsName;
|
|
||||||
/**
|
|
||||||
* 出库单号
|
|
||||||
*/
|
|
||||||
private String outBoundId;
|
|
||||||
/**
|
|
||||||
* 出库关联采收批次id
|
|
||||||
*/
|
|
||||||
private String harvestBatchId;
|
|
||||||
/**
|
|
||||||
* 溯源码数量
|
|
||||||
*/
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
/**
|
|
||||||
* 商品单位
|
|
||||||
*/
|
|
||||||
private String goodsUnit;
|
|
||||||
/**
|
|
||||||
* 商品重量
|
|
||||||
*/
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
/**
|
|
||||||
* 商品单价
|
|
||||||
*/
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
/**
|
|
||||||
* 总价
|
|
||||||
*/
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
/**
|
|
||||||
* 所属商户id
|
|
||||||
*/
|
|
||||||
private Long belongBusinessId;
|
|
||||||
/**
|
|
||||||
* 所属商户名称
|
|
||||||
*/
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.api.outboundgoods.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class OutboundgoodsRespDTO {
|
|
||||||
/**
|
|
||||||
* 编码
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
// * 出库单-商品批次关联绑定id
|
|
||||||
// */
|
|
||||||
// private String bindId;
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private String goodsId;
|
|
||||||
/**
|
|
||||||
* 商品名称
|
|
||||||
*/
|
|
||||||
private String goodsName;
|
|
||||||
/**
|
|
||||||
* 出库单号
|
|
||||||
*/
|
|
||||||
private String outBoundId;
|
|
||||||
/**
|
|
||||||
* 出库关联采收批次id
|
|
||||||
*/
|
|
||||||
private String harvestBatchId;
|
|
||||||
/**
|
|
||||||
* 溯源码数量
|
|
||||||
*/
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品码数量
|
|
||||||
*/
|
|
||||||
private Integer goodsNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品单位
|
|
||||||
*/
|
|
||||||
private String goodsUnit;
|
|
||||||
/**
|
|
||||||
* 商品重量
|
|
||||||
*/
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
/**
|
|
||||||
* 商品单价
|
|
||||||
*/
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
/**
|
|
||||||
* 总价
|
|
||||||
*/
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
/**
|
|
||||||
* 所属商户id
|
|
||||||
*/
|
|
||||||
private Long belongBusinessId;
|
|
||||||
/**
|
|
||||||
* 所属商户名称
|
|
||||||
*/
|
|
||||||
private String belongBusinessName;
|
|
||||||
}
|
|
@ -1,193 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>yudao-module-flow</artifactId>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<version>${revision}</version> <!-- 1. 修改 version 为 ${revision} -->
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging> <!-- 2. 新增 packaging 为 jar -->
|
|
||||||
|
|
||||||
<artifactId>yudao-module-flow-biz</artifactId>
|
|
||||||
|
|
||||||
<name>${project.artifactId}</name> <!-- 3. 新增 name 为 ${project.artifactId} -->
|
|
||||||
<description> <!-- 4. 新增 description 为该模块的描述 -->
|
|
||||||
configure 模块,主要实现 模板配置等 等功能。
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<dependencies> <!-- 5. 新增依赖,这里引入的都是比较常用的业务组件、技术组件 -->
|
|
||||||
<!-- Spring Cloud 基础 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-env</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 依赖服务 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-module-system-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-module-infra-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-module-flow-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-module-product-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-module-basic-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-module-chain-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 业务组件 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-banner</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-biz-dict</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-biz-error-code</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Web 相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- DB 相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- RPC 远程调用相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Registry 注册中心相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Config 配置中心相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Job 定时任务相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-job</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 消息队列相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Test 测试相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 工具类相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 监控相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- seata 分布式事物 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<!-- 设置构建的 jar 包名 -->
|
|
||||||
<finalName>${project.artifactId}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<!-- 打包 -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<version>2.7.8</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 -->
|
|
||||||
<configuration>
|
|
||||||
<fork>true</fork>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,11 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class FlowServerApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(FlowServerApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.api.outbound;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outbound.dto.OutboundGoodsDTO;
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outbound.dto.OutboundRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.OutboundDTO;
|
|
||||||
import cn.iocoder.yudao.module.flow.convert.outbound.OutboundConvert;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.mysql.outbound.OutboundMapper;
|
|
||||||
import cn.iocoder.yudao.module.flow.enums.ErrorCodeConstants;
|
|
||||||
import cn.iocoder.yudao.module.flow.service.outbound.OutboundService;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
|
||||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
|
||||||
@Validated
|
|
||||||
public class OutboundApiImpl implements OutboundApi {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundService OutboundService;
|
|
||||||
@Resource
|
|
||||||
private OutboundMapper outboundMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<OutboundRespDTO> getOutboundByOutBoundId(String outBoundId) {
|
|
||||||
OutboundDTO outboundDTO = OutboundService.getOutboundGoodsInfoOutBoundId(outBoundId);
|
|
||||||
if(outboundDTO == null || outboundDTO.getOutboundGoodsList().isEmpty()) {
|
|
||||||
throw exception(ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
OutboundRespDTO respDTO = new OutboundRespDTO();
|
|
||||||
BeanUtil.copyProperties(outboundDTO, respDTO);
|
|
||||||
List<OutboundGoodsDTO> list = BeanUtil.copyToList(outboundDTO.getOutboundGoodsList(), OutboundGoodsDTO.class);
|
|
||||||
respDTO.setOutboundGoodsList(list);
|
|
||||||
return CommonResult.success(respDTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<List<OutboundRespDTO>> getOutboundListByVendorId(String vendorId) {
|
|
||||||
return CommonResult.success(OutboundConvert.INSTANCE.convertToRespDTOList(outboundMapper.selectList(OutboundDO::getVendorId,vendorId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.api;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outboundgoods.OtboundgoodsApi;
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outboundgoods.dto.OutboundgoodsRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.flow.convert.outboundgoods.OutboundGoodsConvert;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.mysql.outboundgoods.OutboundGoodsMapper;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
|
||||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
|
||||||
@Validated
|
|
||||||
public class outboundgoodsApiImpl implements OtboundgoodsApi {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundGoodsMapper outboundGoodsMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<List<OutboundgoodsRespDTO>> getOtboundgoodsListByInputId(List<String> ids) {
|
|
||||||
return CommonResult.success(OutboundGoodsConvert.INSTANCE.convertToDTOList(outboundGoodsMapper.selectList(OutboundGoodsDO::getGoodsId, ids)));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.BlockStateEnum;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.flow.convert.outbound.OutboundConvert;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
|
|
||||||
import cn.iocoder.yudao.module.flow.service.outbound.OutboundService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
@Api(tags = "管理后台 - 出库单")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/flow/outbound")
|
|
||||||
@Validated
|
|
||||||
public class OutboundController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundService outboundService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@ApiOperation("创建出库单")
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:create')")
|
|
||||||
public CommonResult<Long> createOutbound(@Valid @RequestBody OutboundCreateReqVO createReqVO) {
|
|
||||||
return success(outboundService.createOutbound(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/upChain")
|
|
||||||
@ApiOperation("上链")
|
|
||||||
@ApiImplicitParam(name = "id", value = "id", required = true, example = "1", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:update')")
|
|
||||||
public CommonResult<Boolean> upChain(@RequestParam("id") Long id) {
|
|
||||||
outboundService.upChain(id);
|
|
||||||
return CommonResult.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/freeze")
|
|
||||||
@ApiOperation("冻结")
|
|
||||||
@ApiImplicitParam(name = "id", value = "ID", required = true, example = "1024", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:freeze')")
|
|
||||||
public CommonResult<Boolean> freeze(@RequestParam("id") Long id) {
|
|
||||||
outboundService.updateChainStatus(id, BlockStateEnum.FREEZE.getBlockState());
|
|
||||||
return success(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/active")
|
|
||||||
@ApiOperation("激活")
|
|
||||||
@ApiImplicitParam(name = "id", value = "ID", required = true, example = "1024", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('product:inspection:active')")
|
|
||||||
public CommonResult<Boolean> active(@RequestParam("id") Long id) {
|
|
||||||
outboundService.updateChainStatus(id, BlockStateEnum.ACTIVATION.getBlockState());
|
|
||||||
return success(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@ApiOperation("更新出库单")
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:update')")
|
|
||||||
public CommonResult<Boolean> updateOutbound(@Valid @RequestBody OutboundUpdateReqVO updateReqVO) {
|
|
||||||
outboundService.updateOutbound(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@ApiOperation("删除出库单")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:delete')")
|
|
||||||
public CommonResult<Boolean> deleteOutbound(@RequestParam("id") Long id) {
|
|
||||||
outboundService.deleteOutbound(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
|
||||||
@ApiOperation("获得出库单")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:query')")
|
|
||||||
public CommonResult<OutboundRespVO> getOutbound(@RequestParam("id") Long id) {
|
|
||||||
OutboundRespVO outboundRespVO = outboundService.getOutbound(id);
|
|
||||||
return success(outboundRespVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/getOutboundGoodsInfoById")
|
|
||||||
@ApiOperation("根据id获取主表和子表的信息")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:query')")
|
|
||||||
public CommonResult<Map<String,Object>> getOutboundGoodsInfoById(@RequestParam("id") Long id) {
|
|
||||||
Map<String, Object> goodsInfoById = outboundService.getOutboundGoodsInfoById(id);
|
|
||||||
return success(goodsInfoById);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/getOutbound")
|
|
||||||
@ApiOperation("根据主出库单号,查询所有子出库单号")
|
|
||||||
@ApiImplicitParam(name = "outBoundId", value = "出库单号", required = true, example = "1024", dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:query')")
|
|
||||||
public CommonResult<OutboundDTO> getOutboundGoodsInfoOutBoundId(@RequestParam("outBoundId") String outBoundId) {
|
|
||||||
OutboundDTO infoOutBoundId = outboundService.getOutboundGoodsInfoOutBoundId(outBoundId);
|
|
||||||
return success(infoOutBoundId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@ApiOperation("获得出库单列表")
|
|
||||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:query')")
|
|
||||||
public CommonResult<List<OutboundRespVO>> getOutboundList(@RequestParam("ids") Collection<Long> ids) {
|
|
||||||
List<OutboundDO> list = outboundService.getOutboundList(ids);
|
|
||||||
return success(OutboundConvert.INSTANCE.convertList(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
|
||||||
@ApiOperation("获得出库单分页")
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound:query')")
|
|
||||||
public CommonResult<PageResult<OutboundRespVO>> getOutboundPage(@Valid OutboundPageReqVO pageVO) {
|
|
||||||
PageResult<OutboundDO> pageResult = outboundService.getOutboundPage(pageVO);
|
|
||||||
return success(OutboundConvert.INSTANCE.convertPage(pageResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/outboundStatistics")
|
|
||||||
@ApiOperation("获取首页出库数据记录")
|
|
||||||
public CommonResult<OutboundInfoDataRespVO> getOutboundInfoDataStatistics() {
|
|
||||||
return CommonResult.success(outboundService.getOutboundInfoDataStatistics());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MonthYOYRespVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "统计的年份")
|
|
||||||
private Integer year;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "统计的月份")
|
|
||||||
private Integer month;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "总数")
|
|
||||||
private BigDecimal sumNum;
|
|
||||||
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsSaveReqVO;
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundCreateReqVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "经销商id", required = true)
|
|
||||||
@NotNull(message = "经销商id不能为空")
|
|
||||||
private String vendorId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "经销商名称")
|
|
||||||
private String vendorName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库时间", required = true)
|
|
||||||
@NotNull(message = "出库时间不能为空")
|
|
||||||
private Date outBoundTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "承运人")
|
|
||||||
private String carrierVehicles;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "承运车辆")
|
|
||||||
private String carrier;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "联系方式")
|
|
||||||
private String carrierContact;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号", required = true)
|
|
||||||
@Valid
|
|
||||||
private List<OutboundGoodsSaveReqVO> outboundGoods;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class OutboundGoodsVO {
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class OutboundInfoDataRespVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "农产品出库每个商品的当月统计信息")
|
|
||||||
private List<OutboundStatisticsDataRespVO> goodsWeekStatisticsDatas;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "农产品出库最新七天统计信息")
|
|
||||||
private List<OutboundStatisticsDataRespVO> goodsMonthStatisticsDatas;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库月统计总重量")
|
|
||||||
private BigDecimal todayOutboundCount;
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsRespVO;
|
|
||||||
import lombok.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单 Response VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundRespVO extends OutboundBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编号", required = true)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库关联采收批次集合")
|
|
||||||
private List<OutboundGoodsRespVO> outboundGoods;
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class OutboundStatisticsDataRespVO {
|
|
||||||
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
private Integer goodsNum;
|
|
||||||
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
|
|
||||||
private BigDecimal sumNum;
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsSaveReqVO;
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单更新 Request VO")
|
|
||||||
@Data
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundUpdateReqVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编号", required = true)
|
|
||||||
@NotNull(message = "编号不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "经销商id", required = true)
|
|
||||||
@NotNull(message = "经销商id不能为空")
|
|
||||||
private String vendorId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "经销商名称", required = true)
|
|
||||||
@NotNull(message = "经销商名称不能为空")
|
|
||||||
private String vendorName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号", required = true)
|
|
||||||
@NotNull(message = "出库单号不能为空")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库时间", required = true)
|
|
||||||
@NotNull(message = "出库时间不能为空")
|
|
||||||
private Date outBoundTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "承运人")
|
|
||||||
private String carrierVehicles;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "承运车辆")
|
|
||||||
private String carrier;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "联系方式")
|
|
||||||
private String carrierContact;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号", required = true)
|
|
||||||
@Valid
|
|
||||||
private List<OutboundGoodsSaveReqVO> outboundGoods;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class WeekYOYRespVO extends MonthYOYRespVO{
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "统计的周数")
|
|
||||||
private Integer week;
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsCreateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsUpdateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.flow.service.outboundgoods.OutboundGoodsService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
@Api(tags = "管理后台 - 出库单商品")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/flow/outbound-goods")
|
|
||||||
@Validated
|
|
||||||
public class OutboundGoodsController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundGoodsService outboundGoodsService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@ApiOperation("创建出库单商品")
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound-goods:create')")
|
|
||||||
public CommonResult<Long> createOutboundGoods(@Valid @RequestBody OutboundGoodsCreateReqVO createReqVO) {
|
|
||||||
return success(outboundGoodsService.createOutboundGoods(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@ApiOperation("更新出库单商品")
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound-goods:update')")
|
|
||||||
public CommonResult<Boolean> updateOutboundGoods(@Valid @RequestBody OutboundGoodsUpdateReqVO updateReqVO) {
|
|
||||||
outboundGoodsService.updateOutboundGoods(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@ApiOperation("删除出库单商品")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('flow:outbound-goods:delete')")
|
|
||||||
public CommonResult<Boolean> deleteOutboundGoods(@RequestParam("id") Long id) {
|
|
||||||
outboundGoodsService.deleteOutboundGoods(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.OutboundSaveReqVO;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单商品创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundGoodsCreateReqVO {
|
|
||||||
|
|
||||||
// @ApiModelProperty(value = "出库单-商品批次关联绑定id", required = true)
|
|
||||||
// @NotNull(message = "出库单-商品批次关联绑定id不能为空")
|
|
||||||
// private String bindId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品id", required = true)
|
|
||||||
@NotNull(message = "商品id不能为空")
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品名称", required = true)
|
|
||||||
@NotNull(message = "商品名称不能为空")
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号", required = true)
|
|
||||||
@NotNull(message = "出库单号不能为空")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库关联采收批次id", required = true)
|
|
||||||
@NotNull(message = "出库关联采收批次id不能为空")
|
|
||||||
private String harvestBatchId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户id", required = true)
|
|
||||||
@NotNull(message = "所属商户id不能为空")
|
|
||||||
private Long belongBusinessId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户名称", required = true)
|
|
||||||
@NotNull(message = "所属商户名称不能为空")
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号", required = true)
|
|
||||||
@Valid
|
|
||||||
private List<OutboundGoodsSaveReqVO> OutBounds;
|
|
||||||
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单商品 Excel VO
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class OutboundGoodsExcelVO {
|
|
||||||
|
|
||||||
@ExcelProperty("编码")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ExcelProperty("出库单-商品批次关联绑定id")
|
|
||||||
private String bindId;
|
|
||||||
|
|
||||||
@ExcelProperty("商品id")
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
@ExcelProperty("商品名称")
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ExcelProperty("出库单号")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ExcelProperty("出库关联采收批次id")
|
|
||||||
private String harvestBatchId;
|
|
||||||
|
|
||||||
@ExcelProperty("溯源码数量")
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品数量")
|
|
||||||
private Integer goodsNum;
|
|
||||||
|
|
||||||
@ExcelProperty("商品单位")
|
|
||||||
private String goodsUnit;
|
|
||||||
|
|
||||||
@ExcelProperty("商品重量")
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
|
|
||||||
@ExcelProperty("商品单价")
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
|
|
||||||
@ExcelProperty("总价")
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
@ExcelProperty("所属商户id")
|
|
||||||
private Long belongBusinessId;
|
|
||||||
|
|
||||||
@ExcelProperty("所属商户名称")
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
@ApiModel(value = "管理后台 - 出库单商品 Excel 导出 Request VO", description = "参数和 OutboundGoodsPageReqVO 是一致的")
|
|
||||||
@Data
|
|
||||||
public class OutboundGoodsExportReqVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单-商品批次关联绑定id")
|
|
||||||
private String bindId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品id")
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品名称")
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库关联采收批次id")
|
|
||||||
private String harvestBatchId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "溯源码数量")
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品数量")
|
|
||||||
private Integer goodsNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单位")
|
|
||||||
private String goodsUnit;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品重量")
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单价")
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "总价")
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private Date[] createTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户id")
|
|
||||||
private Long belongBusinessId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户名称")
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单商品分页 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundGoodsPageReqVO extends PageParam {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单-商品批次关联绑定id")
|
|
||||||
private String bindId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品id")
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品名称")
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库关联采收批次id")
|
|
||||||
private String harvestBatchId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "溯源码数量")
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品数量")
|
|
||||||
private Integer goodsNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单位")
|
|
||||||
private String goodsUnit;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品重量")
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单价")
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "总价")
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private Date[] createTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户id")
|
|
||||||
private Long belongBusinessId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户名称")
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单商品 Response VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundGoodsRespVO extends OutboundGoodsBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码", required = true)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class OutboundGoodsSaveReqVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码", required = true)
|
|
||||||
// @NotNull(message = "编码不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品id", required = true)
|
|
||||||
@NotNull(message = "商品id不能为空")
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品名称", required = true)
|
|
||||||
@NotNull(message = "商品名称不能为空")
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库单号")
|
|
||||||
private String outBoundId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库关联采收批次id", required = true)
|
|
||||||
@NotNull(message = "出库关联采收批次id不能为空")
|
|
||||||
private String harvestBatchId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "溯源码数量")
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品数量")
|
|
||||||
private Integer goodsNum;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单位")
|
|
||||||
private String goodsUnit;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品重量")
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单价")
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "总价")
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户id", required = true)
|
|
||||||
@NotNull(message = "所属商户id不能为空")
|
|
||||||
private Long belongBusinessId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属商户名称", required = true)
|
|
||||||
@NotNull(message = "所属商户名称不能为空")
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单商品更新 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class OutboundGoodsUpdateReqVO extends OutboundGoodsBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码", required = true)
|
|
||||||
@NotNull(message = "编码不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 出库单商品 Response VO (精简版)")
|
|
||||||
@Data
|
|
||||||
public class OutboundgoodsForTransferRespVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码", required = true)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品id", required = true)
|
|
||||||
private String goodsId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品名称", required = true)
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "出库关联采收批次id", required = true)
|
|
||||||
private String harvestBatchId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单位")
|
|
||||||
private String goodsUnit;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "总价")
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.convert.outbound;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.basic.api.redis.dto.DealerInfoDTO;
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outbound.dto.OutboundRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单 Convert
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface OutboundConvert {
|
|
||||||
|
|
||||||
OutboundConvert INSTANCE = Mappers.getMapper(OutboundConvert.class);
|
|
||||||
|
|
||||||
OutboundDO convert(OutboundCreateReqVO bean);
|
|
||||||
|
|
||||||
OutboundDO convert(OutboundUpdateReqVO bean);
|
|
||||||
|
|
||||||
OutboundRespVO convert(OutboundDO bean);
|
|
||||||
|
|
||||||
List<OutboundRespVO> convertList(List<OutboundDO> list);
|
|
||||||
|
|
||||||
PageResult<OutboundRespVO> convertPage(PageResult<OutboundDO> page);
|
|
||||||
|
|
||||||
List<OutboundExcelVO> convertList02(List<OutboundDO> list);
|
|
||||||
|
|
||||||
List<OutboundGoodsDO> convertListCreate(List<OutboundGoodsSaveReqVO> list);
|
|
||||||
|
|
||||||
List<OutboundRespDTO> convertToRespDTOList(List<OutboundDO> list);
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.convert.outboundgoods;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outboundgoods.dto.OutboundgoodsRespDTO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单商品 Convert
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface OutboundGoodsConvert {
|
|
||||||
|
|
||||||
OutboundGoodsConvert INSTANCE = Mappers.getMapper(OutboundGoodsConvert.class);
|
|
||||||
|
|
||||||
OutboundGoodsDO convert(OutboundGoodsCreateReqVO bean);
|
|
||||||
|
|
||||||
OutboundGoodsDO convert(OutboundGoodsSaveReqVO bean);
|
|
||||||
|
|
||||||
OutboundGoodsDO convert(OutboundGoodsUpdateReqVO bean);
|
|
||||||
|
|
||||||
OutboundGoodsRespVO convert(OutboundGoodsDO bean);
|
|
||||||
|
|
||||||
List<OutboundGoodsRespVO> convertList(List<OutboundGoodsDO> list);
|
|
||||||
|
|
||||||
PageResult<OutboundGoodsRespVO> convertPage(PageResult<OutboundGoodsDO> page);
|
|
||||||
|
|
||||||
List<OutboundGoodsExcelVO> convertList02(List<OutboundGoodsDO> list);
|
|
||||||
|
|
||||||
List<OutboundGoodsDO> convertListCreate(List<OutboundGoodsSaveReqVO> list);
|
|
||||||
|
|
||||||
List<OutboundgoodsRespDTO> convertToDTOList(List<OutboundGoodsDO>list);
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单商品 DO
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@TableName("flow_outbound_goods")
|
|
||||||
@KeySequence("flow_outbound_goods_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class OutboundGoodsDO extends BaseDO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码
|
|
||||||
*/
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 出库单-商品批次关联绑定id
|
|
||||||
*/
|
|
||||||
private String bindId;
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private String goodsId;
|
|
||||||
/**
|
|
||||||
* 商品名称
|
|
||||||
*/
|
|
||||||
private String goodsName;
|
|
||||||
/**
|
|
||||||
* 出库单号
|
|
||||||
*/
|
|
||||||
private String outBoundId;
|
|
||||||
/**
|
|
||||||
* 出库关联采收批次id
|
|
||||||
*/
|
|
||||||
private String harvestBatchId;
|
|
||||||
/**
|
|
||||||
* 溯源码数量
|
|
||||||
*/
|
|
||||||
private Integer identityCodeNum;
|
|
||||||
/**
|
|
||||||
* 商品数量
|
|
||||||
*/
|
|
||||||
private Integer goodsNum;
|
|
||||||
/**
|
|
||||||
* 商品单位
|
|
||||||
*/
|
|
||||||
private String goodsUnit;
|
|
||||||
/**
|
|
||||||
* 商品重量
|
|
||||||
*/
|
|
||||||
private BigDecimal goodsWeight;
|
|
||||||
/**
|
|
||||||
* 商品单价
|
|
||||||
*/
|
|
||||||
private BigDecimal goodsUnitPrice;
|
|
||||||
/**
|
|
||||||
* 总价
|
|
||||||
*/
|
|
||||||
private BigDecimal totalPrice;
|
|
||||||
/**
|
|
||||||
* 所属商户id
|
|
||||||
*/
|
|
||||||
private Long belongBusinessId;
|
|
||||||
/**
|
|
||||||
* 所属商户名称
|
|
||||||
*/
|
|
||||||
private String belongBusinessName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.dal.mysql.outbound;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.*;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface OutboundMapper extends BaseMapperX<OutboundDO> {
|
|
||||||
|
|
||||||
default PageResult<OutboundDO> selectPage(OutboundPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<OutboundDO>()
|
|
||||||
.eqIfPresent(OutboundDO::getVendorId, reqVO.getVendorId())
|
|
||||||
.likeIfPresent(OutboundDO::getVendorName, reqVO.getVendorName())
|
|
||||||
.eqIfPresent(OutboundDO::getOutBoundId, reqVO.getOutBoundId())
|
|
||||||
.betweenIfPresent(OutboundDO::getOutBoundTime, reqVO.getOutBoundTime())
|
|
||||||
.eqIfPresent(OutboundDO::getCarrierVehicles, reqVO.getCarrierVehicles())
|
|
||||||
.eqIfPresent(OutboundDO::getCarrier, reqVO.getCarrier())
|
|
||||||
.eqIfPresent(OutboundDO::getCarrierContact, reqVO.getCarrierContact())
|
|
||||||
.eqIfPresent(OutboundDO::getBlockState, reqVO.getBlockState())
|
|
||||||
.eqIfPresent(OutboundDO::getBlockChainId, reqVO.getBlockChainId())
|
|
||||||
.eqIfPresent(OutboundDO::getBlockChainBlockIdentity, reqVO.getBlockChainBlockIdentity())
|
|
||||||
.eqIfPresent(OutboundDO::getBelongBusinessId, reqVO.getBelongBusinessId())
|
|
||||||
.likeIfPresent(OutboundDO::getBelongBusinessName, reqVO.getBelongBusinessName())
|
|
||||||
.betweenIfPresent(OutboundDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(OutboundDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<OutboundDO> selectList(OutboundExportReqVO reqVO) {
|
|
||||||
return selectList(new LambdaQueryWrapperX<OutboundDO>()
|
|
||||||
.eqIfPresent(OutboundDO::getVendorId, reqVO.getVendorId())
|
|
||||||
.likeIfPresent(OutboundDO::getVendorName, reqVO.getVendorName())
|
|
||||||
.eqIfPresent(OutboundDO::getOutBoundId, reqVO.getOutBoundId())
|
|
||||||
.betweenIfPresent(OutboundDO::getOutBoundTime, reqVO.getOutBoundTime())
|
|
||||||
.eqIfPresent(OutboundDO::getCarrierVehicles, reqVO.getCarrierVehicles())
|
|
||||||
.eqIfPresent(OutboundDO::getCarrier, reqVO.getCarrier())
|
|
||||||
.eqIfPresent(OutboundDO::getCarrierContact, reqVO.getCarrierContact())
|
|
||||||
.eqIfPresent(OutboundDO::getBlockState, reqVO.getBlockState())
|
|
||||||
.eqIfPresent(OutboundDO::getBlockChainId, reqVO.getBlockChainId())
|
|
||||||
.eqIfPresent(OutboundDO::getBlockChainBlockIdentity, reqVO.getBlockChainBlockIdentity())
|
|
||||||
.eqIfPresent(OutboundDO::getBelongBusinessId, reqVO.getBelongBusinessId())
|
|
||||||
.likeIfPresent(OutboundDO::getBelongBusinessName, reqVO.getBelongBusinessName())
|
|
||||||
.betweenIfPresent(OutboundDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(OutboundDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得月统计的出库每个商品总重量数据
|
|
||||||
*/
|
|
||||||
List<OutboundStatisticsDataRespVO> getDatasGroupByGoodsId(@Param("type") String type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新7天每天总数量除去当天
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<OutboundStatisticsDataRespVO> getSixDatasByGoodsId();
|
|
||||||
|
|
||||||
BigDecimal getTodayOutboundCount();
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.dal.mysql.outboundgoods;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单商品 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface OutboundGoodsMapper extends BaseMapperX<OutboundGoodsDO> {
|
|
||||||
|
|
||||||
default PageResult<OutboundGoodsDO> selectPage(OutboundGoodsPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<OutboundGoodsDO>()
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getBindId, reqVO.getBindId())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsId, reqVO.getGoodsId())
|
|
||||||
.likeIfPresent(OutboundGoodsDO::getGoodsName, reqVO.getGoodsName())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getOutBoundId, reqVO.getOutBoundId())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getHarvestBatchId, reqVO.getHarvestBatchId())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getIdentityCodeNum, reqVO.getIdentityCodeNum())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsUnit, reqVO.getGoodsUnit())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsWeight, reqVO.getGoodsWeight())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsUnitPrice, reqVO.getGoodsUnitPrice())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getTotalPrice, reqVO.getTotalPrice())
|
|
||||||
.betweenIfPresent(OutboundGoodsDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getBelongBusinessId, reqVO.getBelongBusinessId())
|
|
||||||
.likeIfPresent(OutboundGoodsDO::getBelongBusinessName, reqVO.getBelongBusinessName())
|
|
||||||
.orderByDesc(OutboundGoodsDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<OutboundGoodsDO> selectList(OutboundGoodsExportReqVO reqVO) {
|
|
||||||
return selectList(new LambdaQueryWrapperX<OutboundGoodsDO>()
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getBindId, reqVO.getBindId())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsId, reqVO.getGoodsId())
|
|
||||||
.likeIfPresent(OutboundGoodsDO::getGoodsName, reqVO.getGoodsName())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getOutBoundId, reqVO.getOutBoundId())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getHarvestBatchId, reqVO.getHarvestBatchId())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getIdentityCodeNum, reqVO.getIdentityCodeNum())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsUnit, reqVO.getGoodsUnit())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsWeight, reqVO.getGoodsWeight())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getGoodsUnitPrice, reqVO.getGoodsUnitPrice())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getTotalPrice, reqVO.getTotalPrice())
|
|
||||||
.betweenIfPresent(OutboundGoodsDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.eqIfPresent(OutboundGoodsDO::getBelongBusinessId, reqVO.getBelongBusinessId())
|
|
||||||
.likeIfPresent(OutboundGoodsDO::getBelongBusinessName, reqVO.getBelongBusinessName())
|
|
||||||
.orderByDesc(OutboundGoodsDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.framework.rpc.config;
|
|
||||||
import cn.iocoder.yudao.module.basic.api.dealerinfo.DealerInfoApi;
|
|
||||||
import cn.iocoder.yudao.module.chain.api.blockcertificate.BlockCertificateApi;
|
|
||||||
import cn.iocoder.yudao.module.flow.api.outboundgoods.OtboundgoodsApi;
|
|
||||||
import cn.iocoder.yudao.module.product.api.harvestbatch.HarvestBatchApi;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
@EnableFeignClients(clients = {
|
|
||||||
HarvestBatchApi.class,
|
|
||||||
DealerInfoApi.class,
|
|
||||||
OtboundgoodsApi.class,
|
|
||||||
BlockCertificateApi.class,
|
|
||||||
})
|
|
||||||
public class RpcConfiguration {
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.framework.security.config;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
|
||||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Demo 模块的 Security 配置
|
|
||||||
*/
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
public class SecurityConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
|
||||||
return new AuthorizeRequestsCustomizer() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
|
||||||
// Swagger 接口文档
|
|
||||||
registry.antMatchers("/swagger-ui.html").anonymous()
|
|
||||||
.antMatchers("/swagger-resources/**").anonymous()
|
|
||||||
.antMatchers("/webjars/**").anonymous()
|
|
||||||
.antMatchers("/*/api-docs").anonymous();
|
|
||||||
// Druid 监控
|
|
||||||
registry.antMatchers("/druid/**").anonymous();
|
|
||||||
// Spring Boot Actuator 的安全配置
|
|
||||||
registry.antMatchers("/actuator").anonymous()
|
|
||||||
.antMatchers("/actuator/**").anonymous();
|
|
||||||
// RPC 服务的安全配置
|
|
||||||
registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.service.outbound;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface OutboundService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建出库单
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
Long createOutbound(@Valid OutboundCreateReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新出库单
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateOutbound(@Valid OutboundUpdateReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除出库单
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteOutbound(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得出库单
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 出库单
|
|
||||||
*/
|
|
||||||
OutboundRespVO getOutbound(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得出库单列表
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
* @return 出库单列表
|
|
||||||
*/
|
|
||||||
List<OutboundDO> getOutboundList(Collection<Long> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得出库单分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 出库单分页
|
|
||||||
*/
|
|
||||||
PageResult<OutboundDO> getOutboundPage(OutboundPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id获取主表和子表的信息
|
|
||||||
*
|
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, Object> getOutboundGoodsInfoById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据单号查询主单,再根据主单查询子单
|
|
||||||
*
|
|
||||||
* @param outBoundId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public OutboundDTO getOutboundGoodsInfoOutBoundId(String outBoundId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上链
|
|
||||||
* @param id id
|
|
||||||
*/
|
|
||||||
void upChain(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新链状态
|
|
||||||
* @param id id
|
|
||||||
* @param state 状态
|
|
||||||
*/
|
|
||||||
void updateChainStatus(Long id, Integer state);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得首页出库的统计数据
|
|
||||||
* @return 出库数据
|
|
||||||
*/
|
|
||||||
OutboundInfoDataRespVO getOutboundInfoDataStatistics();
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.service.outboundgoods;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsCreateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsUpdateReqVO;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出库单商品 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface OutboundGoodsService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建出库单商品
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
Long createOutboundGoods(@Valid OutboundGoodsCreateReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新出库单商品
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateOutboundGoods(@Valid OutboundGoodsUpdateReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除出库单商品
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteOutboundGoods(Long id);
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
spring:
|
|
||||||
application:
|
|
||||||
name: flow-server
|
|
||||||
|
|
||||||
profiles:
|
|
||||||
active: local
|
|
||||||
|
|
||||||
server:
|
|
||||||
port: 49084
|
|
||||||
|
|
||||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
|
||||||
logging:
|
|
||||||
file:
|
|
||||||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
|
@ -1,2 +0,0 @@
|
|||||||
DELETE FROM "flow_outbound";
|
|
||||||
DELETE FROM "flow_outbound_goods";
|
|
@ -1,44 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS "flow_outbound" (
|
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
|
||||||
"vendor_id" varchar NOT NULL,
|
|
||||||
"vendor_name" varchar NOT NULL,
|
|
||||||
"out_bound_id" varchar NOT NULL,
|
|
||||||
"out_bound_time" datetime NOT NULL,
|
|
||||||
"carrier_vehicles" varchar,
|
|
||||||
"carrier" varchar,
|
|
||||||
"carrier_contact" varchar,
|
|
||||||
"block_state" bit NOT NULL,
|
|
||||||
"block_chain_id" varchar,
|
|
||||||
"block_chain_block_identity" varchar,
|
|
||||||
"belong_business_id" bigint NOT NULL,
|
|
||||||
"belong_business_name" varchar NOT NULL,
|
|
||||||
"tenant_id" bigint NOT NULL,
|
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
|
||||||
"creator" varchar DEFAULT '',
|
|
||||||
"updater" varchar DEFAULT '',
|
|
||||||
PRIMARY KEY ("id")
|
|
||||||
) COMMENT '出库单';
|
|
||||||
CREATE TABLE IF NOT EXISTS "flow_outbound_goods" (
|
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
|
||||||
"bind_id" varchar NOT NULL,
|
|
||||||
"goods_id" varchar NOT NULL,
|
|
||||||
"goods_name" varchar NOT NULL,
|
|
||||||
"out_bound_id" varchar NOT NULL,
|
|
||||||
"harvest_batch_id" varchar NOT NULL,
|
|
||||||
"identity_code_num" int,
|
|
||||||
"goods_unit" varchar,
|
|
||||||
"goods_weight" varchar,
|
|
||||||
"goods_unit_price" varchar,
|
|
||||||
"total_price" varchar,
|
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
"belong_business_id" bigint NOT NULL,
|
|
||||||
"belong_business_name" varchar NOT NULL,
|
|
||||||
"tenant_id" bigint NOT NULL,
|
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
|
||||||
"creator" varchar DEFAULT '',
|
|
||||||
"updater" varchar DEFAULT '',
|
|
||||||
PRIMARY KEY ("id")
|
|
||||||
) COMMENT '出库单商品';
|
|
@ -1,178 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.service.outbound;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.mysql.outbound.OutboundMapper;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.hutool.core.util.RandomUtil.*;
|
|
||||||
import static cn.iocoder.yudao.module.flow.enums.ErrorCodeConstants.*;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link OutboundServiceImpl} 的单元测试类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Import(OutboundServiceImpl.class)
|
|
||||||
public class OutboundServiceImplTest extends BaseDbUnitTest {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundServiceImpl outboundService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundMapper outboundMapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateOutbound_success() {
|
|
||||||
// 准备参数
|
|
||||||
OutboundCreateReqVO reqVO = randomPojo(OutboundCreateReqVO.class);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Long outboundId = outboundService.createOutbound(reqVO);
|
|
||||||
// 断言
|
|
||||||
assertNotNull(outboundId);
|
|
||||||
// 校验记录的属性是否正确
|
|
||||||
OutboundDO outbound = outboundMapper.selectById(outboundId);
|
|
||||||
assertPojoEquals(reqVO, outbound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateOutbound_success() {
|
|
||||||
// mock 数据
|
|
||||||
OutboundDO dbOutbound = randomPojo(OutboundDO.class);
|
|
||||||
outboundMapper.insert(dbOutbound);// @Sql: 先插入出一条存在的数据
|
|
||||||
// 准备参数
|
|
||||||
OutboundUpdateReqVO reqVO = randomPojo(OutboundUpdateReqVO.class, o -> {
|
|
||||||
o.setId(dbOutbound.getId()); // 设置更新的 ID
|
|
||||||
});
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
outboundService.updateOutbound(reqVO);
|
|
||||||
// 校验是否更新正确
|
|
||||||
OutboundDO outbound = outboundMapper.selectById(reqVO.getId()); // 获取最新的
|
|
||||||
assertPojoEquals(reqVO, outbound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateOutbound_notExists() {
|
|
||||||
// 准备参数
|
|
||||||
OutboundUpdateReqVO reqVO = randomPojo(OutboundUpdateReqVO.class);
|
|
||||||
|
|
||||||
// 调用, 并断言异常
|
|
||||||
assertServiceException(() -> outboundService.updateOutbound(reqVO), OUTBOUND_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteOutbound_success() {
|
|
||||||
// mock 数据
|
|
||||||
OutboundDO dbOutbound = randomPojo(OutboundDO.class);
|
|
||||||
outboundMapper.insert(dbOutbound);// @Sql: 先插入出一条存在的数据
|
|
||||||
// 准备参数
|
|
||||||
Long id = dbOutbound.getId();
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
outboundService.deleteOutbound(id);
|
|
||||||
// 校验数据不存在了
|
|
||||||
assertNull(outboundMapper.selectById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteOutbound_notExists() {
|
|
||||||
// 准备参数
|
|
||||||
Long id = randomLongId();
|
|
||||||
|
|
||||||
// 调用, 并断言异常
|
|
||||||
assertServiceException(() -> outboundService.deleteOutbound(id), OUTBOUND_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
|
||||||
public void testGetOutboundPage() {
|
|
||||||
// mock 数据
|
|
||||||
OutboundDO dbOutbound = randomPojo(OutboundDO.class, o -> { // 等会查询到
|
|
||||||
o.setVendorId(null);
|
|
||||||
o.setVendorName(null);
|
|
||||||
o.setOutBoundId(null);
|
|
||||||
o.setOutBoundTime(null);
|
|
||||||
o.setCarrierVehicles(null);
|
|
||||||
o.setCarrier(null);
|
|
||||||
o.setCarrierContact(null);
|
|
||||||
o.setBlockState(null);
|
|
||||||
o.setBlockChainId(null);
|
|
||||||
o.setBlockChainBlockIdentity(null);
|
|
||||||
o.setBelongBusinessId(null);
|
|
||||||
o.setBelongBusinessName(null);
|
|
||||||
o.setCreateTime(null);
|
|
||||||
});
|
|
||||||
outboundMapper.insert(dbOutbound);
|
|
||||||
// 测试 vendorId 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setVendorId(null)));
|
|
||||||
// 测试 vendorName 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setVendorName(null)));
|
|
||||||
// 测试 outBoundId 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setOutBoundId(null)));
|
|
||||||
// 测试 outBoundTime 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setOutBoundTime(null)));
|
|
||||||
// 测试 carrierVehicles 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setCarrierVehicles(null)));
|
|
||||||
// 测试 carrier 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setCarrier(null)));
|
|
||||||
// 测试 carrierContact 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setCarrierContact(null)));
|
|
||||||
// 测试 blockState 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setBlockState(null)));
|
|
||||||
// 测试 blockChainId 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setBlockChainId(null)));
|
|
||||||
// 测试 blockChainBlockIdentity 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setBlockChainBlockIdentity(null)));
|
|
||||||
// 测试 belongBusinessId 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setBelongBusinessId(null)));
|
|
||||||
// 测试 belongBusinessName 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setBelongBusinessName(null)));
|
|
||||||
// 测试 createTime 不匹配
|
|
||||||
outboundMapper.insert(cloneIgnoreId(dbOutbound, o -> o.setCreateTime(null)));
|
|
||||||
// 准备参数
|
|
||||||
OutboundPageReqVO reqVO = new OutboundPageReqVO();
|
|
||||||
reqVO.setVendorId(null);
|
|
||||||
reqVO.setVendorName(null);
|
|
||||||
reqVO.setOutBoundId(null);
|
|
||||||
// reqVO.setOutBoundTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
|
||||||
reqVO.setCarrierVehicles(null);
|
|
||||||
reqVO.setCarrier(null);
|
|
||||||
reqVO.setCarrierContact(null);
|
|
||||||
reqVO.setBlockState(null);
|
|
||||||
reqVO.setBlockChainId(null);
|
|
||||||
reqVO.setBlockChainBlockIdentity(null);
|
|
||||||
reqVO.setBelongBusinessId(null);
|
|
||||||
reqVO.setBelongBusinessName(null);
|
|
||||||
// reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
PageResult<OutboundDO> pageResult = outboundService.getOutboundPage(reqVO);
|
|
||||||
// 断言
|
|
||||||
assertEquals(1, pageResult.getTotal());
|
|
||||||
assertEquals(1, pageResult.getList().size());
|
|
||||||
assertPojoEquals(dbOutbound, pageResult.getList().get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.flow.service.outboundgoods;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsCreateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsUpdateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
|
|
||||||
import cn.iocoder.yudao.module.flow.dal.mysql.outboundgoods.OutboundGoodsMapper;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
|
||||||
import static cn.iocoder.yudao.module.flow.enums.ErrorCodeConstants.OUTBOUND_GOODS_NOT_EXISTS;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link OutboundGoodsServiceImpl} 的单元测试类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Import(OutboundGoodsServiceImpl.class)
|
|
||||||
public class OutboundGoodsServiceImplTest extends BaseDbUnitTest {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundGoodsServiceImpl outboundGoodsService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OutboundGoodsMapper outboundGoodsMapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateOutboundGoods_success() {
|
|
||||||
// 准备参数
|
|
||||||
OutboundGoodsCreateReqVO reqVO = randomPojo(OutboundGoodsCreateReqVO.class);
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
Long outboundGoodsId = outboundGoodsService.createOutboundGoods(reqVO);
|
|
||||||
// 断言
|
|
||||||
assertNotNull(outboundGoodsId);
|
|
||||||
// 校验记录的属性是否正确
|
|
||||||
OutboundGoodsDO outboundGoods = outboundGoodsMapper.selectById(outboundGoodsId);
|
|
||||||
assertPojoEquals(reqVO, outboundGoods);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateOutboundGoods_success() {
|
|
||||||
// mock 数据
|
|
||||||
OutboundGoodsDO dbOutboundGoods = randomPojo(OutboundGoodsDO.class);
|
|
||||||
outboundGoodsMapper.insert(dbOutboundGoods);// @Sql: 先插入出一条存在的数据
|
|
||||||
// 准备参数
|
|
||||||
OutboundGoodsUpdateReqVO reqVO = randomPojo(OutboundGoodsUpdateReqVO.class, o -> {
|
|
||||||
o.setId(dbOutboundGoods.getId()); // 设置更新的 ID
|
|
||||||
});
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
outboundGoodsService.updateOutboundGoods(reqVO);
|
|
||||||
// 校验是否更新正确
|
|
||||||
OutboundGoodsDO outboundGoods = outboundGoodsMapper.selectById(reqVO.getId()); // 获取最新的
|
|
||||||
assertPojoEquals(reqVO, outboundGoods);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdateOutboundGoods_notExists() {
|
|
||||||
// 准备参数
|
|
||||||
OutboundGoodsUpdateReqVO reqVO = randomPojo(OutboundGoodsUpdateReqVO.class);
|
|
||||||
|
|
||||||
// 调用, 并断言异常
|
|
||||||
assertServiceException(() -> outboundGoodsService.updateOutboundGoods(reqVO), OUTBOUND_GOODS_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteOutboundGoods_success() {
|
|
||||||
// mock 数据
|
|
||||||
OutboundGoodsDO dbOutboundGoods = randomPojo(OutboundGoodsDO.class);
|
|
||||||
outboundGoodsMapper.insert(dbOutboundGoods);// @Sql: 先插入出一条存在的数据
|
|
||||||
// 准备参数
|
|
||||||
Long id = dbOutboundGoods.getId();
|
|
||||||
|
|
||||||
// 调用
|
|
||||||
outboundGoodsService.deleteOutboundGoods(id);
|
|
||||||
// 校验数据不存在了
|
|
||||||
assertNull(outboundGoodsMapper.selectById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteOutboundGoods_notExists() {
|
|
||||||
// 准备参数
|
|
||||||
Long id = randomLongId();
|
|
||||||
|
|
||||||
// 调用, 并断言异常
|
|
||||||
assertServiceException(() -> outboundGoodsService.deleteOutboundGoods(id), OUTBOUND_GOODS_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue