代码同步02.13

main
张博文 6 months ago
parent c13e5e8e54
commit 5a6f345362

@ -21,7 +21,6 @@
<module>yudao-module-basic</module> <module>yudao-module-basic</module>
<module>yudao-module-chain</module> <module>yudao-module-chain</module>
<module>yudao-module-configure</module> <module>yudao-module-configure</module>
<module>yudao-module-flow</module>
<module>yudao-module-product</module> <module>yudao-module-product</module>
<module>yudao-module-identity</module> <module>yudao-module-identity</module>
</modules> </modules>

@ -1,30 +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.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Api(tags = "RPC 服务 - 商品认证")
public interface GoodsVerifyApi {
String PREFIX = ApiConstants.PREFIX + "/goods-verify";
@GetMapping(PREFIX + "/getGoodsVerifys")
@ApiOperation("获得商品认证信息列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "goodsId", value = "商品编码", required = true, example = "INBTBC20230421141955HIMK976D", dataTypeClass = String.class),
@ApiImplicitParam(name = "belongBusinessId", value = "所属商户id", required = true, example = "1", dataTypeClass = Long.class)
})
CommonResult<List<GoodsVerifyRespDTO>> getGoodsVerifys(@RequestParam("goodsId") String goodsId, @RequestParam("belongBusinessId") Long belongBusinessId);
}

@ -1,55 +0,0 @@
package cn.iocoder.yudao.module.basic.api.goodsverify.dto;
import lombok.Data;
import java.util.Date;
@Data
public class GoodsVerifyRespDTO {
/**
*
*/
private Long id;
/**
*
*/
private String goodsName;
/**
* ID
*/
private String goodsId;
/**
*
*/
private String verifyName;
/**
*
*/
private String verifyAgencies;
/**
*
*/
private Date verifyStartTime;
/**
*
*/
private Date verifyEndTime;
/**
* url6
*/
private String verifyDataUrl;
/**
*
*/
private Boolean verifyIsForver;
/**
* id
*/
private Long belongBusinessId;
/**
*
*/
private String belongBusinessName;
}

@ -65,12 +65,6 @@
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-flow-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 --> <!-- 业务组件 -->
<dependency> <dependency>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>

@ -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,5 +1,6 @@
package cn.iocoder.yudao.module.basic.api.redis; package cn.iocoder.yudao.module.basic.api.redis;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.basic.api.redis.dto.BusinessInfoDTO; import cn.iocoder.yudao.module.basic.api.redis.dto.BusinessInfoDTO;
import cn.iocoder.yudao.module.basic.api.redis.dto.DealerInfoDTO; import cn.iocoder.yudao.module.basic.api.redis.dto.DealerInfoDTO;
@ -79,16 +80,16 @@ public class RedisBasicInfoUtilImpl implements RedisBasicInfoUtilApi {
String tenantId = String.valueOf(TenantContextHolder.getRequiredTenantId()); String tenantId = String.valueOf(TenantContextHolder.getRequiredTenantId());
if (!redisTemplate.hasKey("BusinessInfo:" + tenantId)) { if (!redisTemplate.hasKey("BusinessInfo:" + tenantId)) {
HashMap<String, BusinessInfoDTO> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
List<BusinessInfoDTO> businessInfoDOList = BusinessInfoConvert.INSTANCE.convertToDTOList(businessInfoMapper.selectList()); List<BusinessInfoDTO> businessInfoDOList = BusinessInfoConvert.INSTANCE.convertToDTOList(businessInfoMapper.selectList());
businessInfoDOList.forEach(item -> map.put(String.valueOf(item.getId()), item)); businessInfoDOList.forEach(item -> map.put(String.valueOf(item.getId()), JsonUtils.toJsonString(item)));
System.out.println("插入Redis," + "BusinessInfo:" + tenantId); System.out.println("插入Redis," + "BusinessInfo:" + tenantId);
redisTemplate.opsForHash().putAll("BusinessInfo:" + tenantId, map); redisTemplate.opsForHash().putAll("BusinessInfo:" + tenantId, map);
redisTemplate.expire("BusinessInfo:" + tenantId, 7, TimeUnit.DAYS); redisTemplate.expire("BusinessInfo:" + tenantId, 7, TimeUnit.DAYS);
} }
BusinessInfoDTO o = (BusinessInfoDTO) redisTemplate.opsForHash().get("BusinessInfo:" + tenantId, String.valueOf(id)); String result = (String) redisTemplate.opsForHash().get("BusinessInfo:" + tenantId, String.valueOf(id));
return o; return JsonUtils.parseObject(result, BusinessInfoDTO.class);
} }
@Override @Override

@ -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,57 +0,0 @@
package cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class GoodsVerifyBaseVO {
@ApiModelProperty(value = "商品名称", required = true)
@NotNull(message = "商品名称不能为空")
private String goodsName;
@ApiModelProperty(value = "商品ID", required = true)
@NotNull(message = "商品ID不能为空")
private String goodsId;
@ApiModelProperty(value = "认证名称", required = true)
@NotNull(message = "认证名称不能为空")
private String verifyName;
@ApiModelProperty(value = "认证机构", required = true)
@NotNull(message = "认证机构不能为空")
private String verifyAgencies;
@ApiModelProperty(value = "有效起始时间", required = true)
@NotNull(message = "有效起始时间不能为空")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date verifyStartTime;
@ApiModelProperty(value = "有效截止时间")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date verifyEndTime;
@ApiModelProperty(value = "认证资料url分割最多6张", required = true)
@NotNull(message = "认证资料不能为空,请添加认证资料")
private String verifyDataUrl;
@ApiModelProperty(value = "是否长期有效", required = true)
@NotNull(message = "是否长期有效不能为空")
private Boolean verifyIsForver;
@ApiModelProperty(value = "所属商户id", required = true)
@NotNull(message = "所属商户id不能为空")
private Long belongBusinessId;
@ApiModelProperty(value = "所属商户名称", required = true)
@NotNull(message = "所属商户名称不能为空")
private String belongBusinessName;
}

@ -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,52 +0,0 @@
package cn.iocoder.yudao.module.basic.controller.admin.goodsverify.vo;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import lombok.*;
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 GoodsVerifyPageReqVO extends PageParam {
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品ID")
private String goodsId;
@ApiModelProperty(value = "认证名称")
private String verifyName;
@ApiModelProperty(value = "认证机构")
private String verifyAgencies;
@ApiModelProperty(value = "有效起始时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] verifyStartTime;
@ApiModelProperty(value = "有效截止时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] verifyEndTime;
@ApiModelProperty(value = "认证资料url分割最多6张")
private String verifyDataUrl;
@ApiModelProperty(value = "是否长期有效")
private Boolean verifyIsForver;
@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.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,74 +0,0 @@
package cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import org.springframework.format.annotation.DateTimeFormat;
/**
* DO
*
* @author
*/
@TableName("basic_goods_verify")
@KeySequence("basic_goods_verify_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class GoodsVerifyDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String goodsName;
/**
* ID
*/
private String goodsId;
/**
*
*/
private String verifyName;
/**
*
*/
private String verifyAgencies;
/**
*
*/
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date verifyStartTime;
/**
*
*/
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date verifyEndTime;
/**
* url6
*/
private String verifyDataUrl;
/**
*
*/
private Boolean verifyIsForver;
/**
* id
*/
private Long belongBusinessId;
/**
*
*/
private String belongBusinessName;
}

@ -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,7 +1,6 @@
package cn.iocoder.yudao.module.basic.framework.rpc.config; package cn.iocoder.yudao.module.basic.framework.rpc.config;
import cn.iocoder.yudao.module.configure.api.uniTemplate.UniTemplateApi; import cn.iocoder.yudao.module.configure.api.uniTemplate.UniTemplateApi;
import cn.iocoder.yudao.module.flow.api.outbound.OutboundApi;
import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.product.api.harvestbatch.HarvestBatchApi; import cn.iocoder.yudao.module.product.api.harvestbatch.HarvestBatchApi;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
@ -11,7 +10,6 @@ import org.springframework.context.annotation.Configuration;
@EnableFeignClients(clients = { @EnableFeignClients(clients = {
FileApi.class, FileApi.class,
UniTemplateApi.class, UniTemplateApi.class,
OutboundApi.class,
HarvestBatchApi.class, HarvestBatchApi.class,
}) })
public class RpcConfiguration { public class RpcConfiguration {

@ -17,7 +17,6 @@ import cn.iocoder.yudao.module.basic.dal.mysql.dealergoods.DealerGoodsMapper;
import cn.iocoder.yudao.module.basic.dal.mysql.dealerinfo.DealerInfoMapper; import cn.iocoder.yudao.module.basic.dal.mysql.dealerinfo.DealerInfoMapper;
import cn.iocoder.yudao.module.basic.dal.mysql.goodsinfo.GoodsInfoMapper; import cn.iocoder.yudao.module.basic.dal.mysql.goodsinfo.GoodsInfoMapper;
import cn.iocoder.yudao.module.basic.service.businessinfo.BusinessInfoServiceImpl; import cn.iocoder.yudao.module.basic.service.businessinfo.BusinessInfoServiceImpl;
import cn.iocoder.yudao.module.flow.api.outbound.OutboundApi;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -54,8 +53,6 @@ public class DealerInfoServiceImpl implements DealerInfoService {
@Resource @Resource
private BusinessInfoServiceImpl businessInfoService; private BusinessInfoServiceImpl businessInfoService;
@Resource @Resource
private OutboundApi outboundApi;
@Resource
private RedisBasicInfoUtilApi redisUtil; private RedisBasicInfoUtilApi redisUtil;
@Override @Override
@ -257,10 +254,6 @@ public class DealerInfoServiceImpl implements DealerInfoService {
public void deleteDealerInfo(Long id) { public void deleteDealerInfo(Long id) {
// 校验存在 // 校验存在
validateDealerInfoExists(id); validateDealerInfoExists(id);
//校验是否关联出库单
if (!outboundApi.getOutboundListByVendorId(dealerInfoMapper.selectById(id).getDealerId()).getData().isEmpty()) {
throw exception(DEALER_GOODS_FAIL_DELETE_BELONG_OUTBOUND_EXISTS);
}
// 删除 // 删除
dealerInfoMapper.deleteById(id); dealerInfoMapper.deleteById(id);
} }
@ -275,10 +268,6 @@ public class DealerInfoServiceImpl implements DealerInfoService {
public void deleteDealerAndAreaGoodsInfo(Long id) { public void deleteDealerAndAreaGoodsInfo(Long id) {
// 校验存在 // 校验存在
validateDealerInfoExists(id); validateDealerInfoExists(id);
//校验是否关联出库单
if (!outboundApi.getOutboundListByVendorId(dealerInfoMapper.selectById(id).getDealerId()).getData().isEmpty()) {
throw exception(DEALER_GOODS_FAIL_DELETE_BELONG_OUTBOUND_EXISTS);
}
// 删除 // 删除
String dealer_id = dealerInfoMapper.selectById(id).getDealerId(); String dealer_id = dealerInfoMapper.selectById(id).getDealerId();
QueryWrapper<DealerGoodsDO> wrapper = new QueryWrapper<>(); QueryWrapper<DealerGoodsDO> wrapper = new 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,158 +0,0 @@
package cn.iocoder.yudao.module.basic.service.goodsverify;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.module.basic.api.redis.RedisBasicInfoUtilApi;
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.dal.mysql.goodsverify.GoodsVerifyMapper;
import cn.iocoder.yudao.module.basic.service.businessinfo.BusinessInfoServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.basic.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class GoodsVerifyServiceImpl implements GoodsVerifyService {
@Resource
private GoodsVerifyMapper goodsVerifyMapper;
@Resource
private BusinessInfoServiceImpl businessInfoService;
@Resource
private RedisBasicInfoUtilApi redisUtil;
/**
*
* @param createReqVO
* @return
*/
@Override
public Long createGoodsVerify(GoodsVerifyCreateReqVO createReqVO) {
//校验所属商户是否存在
businessInfoService.validateBusinessInfoExists(createReqVO.getBelongBusinessId());
// 插入
GoodsVerifyDO goodsVerify = GoodsVerifyConvert.INSTANCE.convert(createReqVO);
goodsVerifyMapper.insert(goodsVerify);
// 返回
return goodsVerify.getId();
}
/**
*
* @param updateReqVO
*/
@Override
public void updateGoodsVerify(GoodsVerifyUpdateReqVO updateReqVO) {
//校验所属商户是否存在
businessInfoService.validateBusinessInfoExists(updateReqVO.getBelongBusinessId());
//跟新记录
GoodsVerifyDO convert = GoodsVerifyConvert.INSTANCE.convert(updateReqVO);
convert.setVerifyEndTime(updateReqVO.getVerifyEndTime());
goodsVerifyMapper.updateById(convert);
}
/**
*
*
* @param id
*/
@Override
public void deleteGoodsVerify(Long id) {
// 校验存在
validateGoodsVerifyExists(id);
// 删除
goodsVerifyMapper.deleteById(id);
}
private void validateGoodsVerifyExists(Long id) {
if (goodsVerifyMapper.selectById(id) == null) {
throw exception(GOODS_VERIFY_NOT_EXISTS);
}
}
/**
*
*
* @param id
* @return
*/
@Override
public GoodsVerifyDO getGoodsVerify(Long id) {
return goodsVerifyMapper.selectById(id);
}
@Override
public List<GoodsVerifyDO> getGoodsVerifys(String goodsId, Long belongBusinessId) {
return goodsVerifyMapper.selectList(new LambdaQueryWrapperX<GoodsVerifyDO>().eq(GoodsVerifyDO::getGoodsId, goodsId)
.eq(GoodsVerifyDO::getBelongBusinessId, belongBusinessId));
}
/**
*
*
* @param pageReqVO
* @return
*/
@Override
public PageResult<GoodsVerifyDO> getGoodsVerifyPage(GoodsVerifyPageReqVO pageReqVO) {
// 调用MyBatis-Plus提供的分页查询方法获取分页结果
PageResult<GoodsVerifyDO> goodsVerifyDOPageResult = new PageResult<>();
// 获取查询结果中的记录列表
if (pageReqVO.getBelongBusinessName() != null && !Objects.equals(pageReqVO.getBelongBusinessName(), "")) {
Page<GoodsVerifyDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<GoodsVerifyDO> goodsVerifyDOIPage = goodsVerifyMapper.selectPageByInfo(page, new QueryWrapperX<GoodsVerifyDO>()
.likeIfPresent("goods_name", pageReqVO.getGoodsName())
.likeIfPresent("verify_name", pageReqVO.getVerifyName())
.eqIfPresent("verify_agencies", pageReqVO.getVerifyAgencies())
.betweenIfPresent("verify_start_time", pageReqVO.getVerifyStartTime())
.betweenIfPresent("verify_end_time", pageReqVO.getVerifyEndTime())
.likeIfPresent("bbi.business_name", pageReqVO.getBelongBusinessName())
.eq("bgv.deleted",0));
goodsVerifyDOPageResult.setList(goodsVerifyDOIPage.getRecords());
goodsVerifyDOPageResult.setTotal(goodsVerifyDOIPage.getTotal());
} else {
goodsVerifyDOPageResult = goodsVerifyMapper.selectPage(pageReqVO);
}
goodsVerifyDOPageResult.getList().forEach(item -> {
if (redisUtil.validateBusinessInfoRedisExists(item.getBelongBusinessId())) {
item.setBelongBusinessName(redisUtil.getBusinessInfoRedis(item.getBelongBusinessId()).getBusinessName());
}else {
item.setBelongBusinessName("所属商户不存在");
}
});
// 返回修改后的分页结果
return goodsVerifyDOPageResult;
}
@Override
public List<GoodsVerifyDO> getByGoodsId(String goodsId) {
return goodsVerifyMapper.selectList(new LambdaQueryWrapperX<GoodsVerifyDO>().eq(GoodsVerifyDO::getGoodsId, goodsId));
}
}

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.basic.dal.mysql.goodsverify.GoodsVerifyMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.basic.dal.dataobject.goodsverify.GoodsVerifyDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
<result column="goods_id" jdbcType="VARCHAR" property="goodsId"/>
<result column="verify_name" jdbcType="VARCHAR" property="verifyName"/>
<result column="verify_agencies" jdbcType="VARCHAR" property="verifyAgencies"/>
<result column="verify_start_time" jdbcType="TIMESTAMP" property="verifyStartTime"/>
<result column="verify_end_time" jdbcType="TIMESTAMP" property="verifyEndTime"/>
<result column="verify_data_url" jdbcType="VARCHAR" property="verifyDataUrl"/>
<result column="verify_is_forver" jdbcType="BIT" property="verifyIsForver"/>
<result column="belong_business_id" jdbcType="BIGINT" property="belongBusinessId"/>
<result column="belong_business_name" jdbcType="VARCHAR" property="belongBusinessName"/>
</resultMap>
<select id="selectPageByInfo" resultMap="BaseResultMap">
select bgv.*,bbi.id,bbi.business_name from basic_goods_verify bgv
left join basic_business_info bbi on bbi.id = bgv.belong_business_id
${ew.customSqlSegment}
order by bgv.id DESC
</select>
</mapper>

@ -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,47 +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>
<artifactId>yudao-module-flow-api</artifactId>
<packaging>jar</packaging> <!-- 2. 新增 packaging 为 jar -->
<name>${project.artifactId}</name> <!-- 3. 新增 name 为 ${project.artifactId} -->
<description> <!-- 4. 新增 description 为该模块的描述 -->
flow 模块 API暴露给其它模块调用
</description>
<dependencies> <!-- 5. 新增 yudao-common 依赖 -->
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<optional>true</optional>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

@ -1,30 +0,0 @@
package cn.iocoder.yudao.module.flow.api.outbound;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.flow.api.outbound.dto.OutboundRespDTO;
import cn.iocoder.yudao.module.flow.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Api(tags = "RPC 服务 - 出库单")
public interface OutboundApi {
String PREFIX = ApiConstants.PREFIX + "/flow";
@GetMapping(PREFIX + "/getOutboundByOutBoundId")
@ApiOperation("获取出库单")
@ApiImplicitParam(name = "outBoundId", value = "出库单号", required = true, example = "OUPJOE20230420153938958B81W0", dataTypeClass = List.class)
CommonResult<OutboundRespDTO> getOutboundByOutBoundId(@RequestParam("outBoundId") String outBoundId);
@GetMapping(PREFIX + "/getOutboundListByVendorId")
@ApiOperation("根据经销商编码获取出库单列表")
@ApiImplicitParam(name = "vendorId", value = "经销商编码", required = true, example = "DACD202304181514F2ER", dataTypeClass = String.class)
CommonResult<List<OutboundRespDTO>> getOutboundListByVendorId(@RequestParam("vendorId") String vendorId);
}

@ -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,70 +0,0 @@
package cn.iocoder.yudao.module.flow.api.outbound.dto;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class OutboundRespDTO {
/**
*
*/
private Long id;
/**
* id
*/
private String vendorId;
/**
*
*/
private String vendorName;
/**
*
*/
private String goodsId;
/**
*
*/
private String outBoundId;
/**
*
*/
private Date outBoundTime;
/**
*
*/
private String carrierVehicles;
/**
*
*/
private String carrier;
/**
*
*/
private String carrierContact;
/**
* 0 1 2
*/
private Integer blockState;
/**
* id
*/
private String blockChainId;
/**
*
*/
private String blockChainBlockIdentity;
/**
* id
*/
private Long belongBusinessId;
/**
*
*/
private String belongBusinessName;
List<OutboundGoodsDTO> outboundGoodsList;
}

@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.flow.api.outboundgoods;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.flow.api.outboundgoods.dto.OutboundgoodsRespDTO;
import cn.iocoder.yudao.module.flow.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Api(tags = "RPC 服务 - 出库单商品")
public interface OtboundgoodsApi {
String PREFIX = ApiConstants.PREFIX + "/outbound-goods";
@GetMapping(PREFIX + "/getOtboundgoodsListByInputId")
@ApiOperation("获得出库单商品列表")
@ApiImplicitParam(name = "ids", value = "出库单商品编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
CommonResult<List<OutboundgoodsRespDTO>> getOtboundgoodsListByInputId(@RequestParam("ids") List<String> ids);
}

@ -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,23 +0,0 @@
package cn.iocoder.yudao.module.flow.enums;
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
/**
* API
*
* @author
*/
public class ApiConstants {
/**
*
*
* spring.application.name
*/
public static final String NAME = "flow-server";
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/flow";
public static final String VERSION = "1.0.0";
}

@ -1,18 +0,0 @@
package cn.iocoder.yudao.module.flow.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* 使
*/
public interface ErrorCodeConstants {
ErrorCode OUTBOUND_NOT_EXISTS = new ErrorCode(1012000001,"出库单不存在");
ErrorCode OUTBOUND_GOODS_NOT_EXISTS = new ErrorCode(1012000002, "出库单商品不存在");
ErrorCode OUTBOUND_GOODS_NOT_BE_REPEATED = new ErrorCode(1012000003, "出库单商品不能重复存在");
ErrorCode HARVEST_BATCH_NOT_BE_REPEATED = new ErrorCode(1012000004, "采收批次id重复存在");
ErrorCode GOODS_INFO_NOT_EXISTS_BE_REPEATED = new ErrorCode(1012000005, "商品编码重复存在");
ErrorCode GOODS_NOT_EXISTS_BE_REPEATED = new ErrorCode(1012000006, "商品重复存在");
ErrorCode HARVEST_BATCH_ID_NOT_EXISTS_BE_REPEATED = new ErrorCode(1012000007, "入库批次重复存在");
ErrorCode EXPORT_HAS_BEEN_DELETED_OUTBOUND = new ErrorCode(1013002004, "存在已删除的出库单商号");
}

@ -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,58 +0,0 @@
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class OutboundBaseVO {
@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 = "上链状态 0未上链 1激活状态 2冻结状态", required = true)
@NotNull(message = "上链状态 0未上链 1激活状态 2冻结状态不能为空")
private Integer blockState;
@ApiModelProperty(value = "出库批次上链区块id")
private String blockChainId;
@ApiModelProperty(value = "出库批次上链区块唯一识别码")
private String blockChainBlockIdentity;
@ApiModelProperty(value = "所属商户id", required = true)
@NotNull(message = "所属商户id不能为空")
private Long belongBusinessId;
@ApiModelProperty(value = "所属商户名称", required = true)
@NotNull(message = "所属商户名称不能为空")
private String belongBusinessName;
}

@ -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,70 +0,0 @@
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class OutboundDTO {
/**
*
*/
private Long id;
/**
* id
*/
private String vendorId;
/**
*
*/
private String vendorName;
/**
*
*/
private String outBoundId;
/**
*
*/
private Date outBoundTime;
/**
*
*/
private String carrierVehicles;
/**
*
*/
private String carrier;
/**
*
*/
private String carrierContact;
/**
* 0 1 2
*/
private Integer blockState;
/**
* id
*/
private String blockChainId;
/**
*
*/
private String blockChainBlockIdentity;
/**
* id
*/
private Long belongBusinessId;
/**
*
*/
private String belongBusinessName;
/**
*
*/
private List<OutboundGoodsDO> outboundGoodsList;
}

@ -1,59 +0,0 @@
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class OutboundExcelVO {
@ExcelProperty("编号")
private Long id;
@ExcelProperty("经销商id")
private String vendorId;
@ExcelProperty("经销商名称")
private String vendorName;
@ExcelProperty("出库单号")
private String outBoundId;
@ExcelProperty("出库时间")
private Date outBoundTime;
@ExcelProperty("承运人")
private String carrierVehicles;
@ExcelProperty("承运车辆")
private String carrier;
@ExcelProperty("联系方式")
private String carrierContact;
@ExcelProperty("上链状态 0未上链 1激活状态 2冻结状态")
private Integer blockState;
@ExcelProperty("出库批次上链区块id")
private String blockChainId;
@ExcelProperty("出库批次上链区块唯一识别码")
private String blockChainBlockIdentity;
@ExcelProperty("所属商户id")
private Long belongBusinessId;
@ExcelProperty("所属商户名称")
private String belongBusinessName;
@ExcelProperty("创建时间")
private Date createTime;
}

@ -1,55 +0,0 @@
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;
@ApiModel(value = "管理后台 - 出库单 Excel 导出 Request VO", description = "参数和 OutboundPageReqVO 是一致的")
@Data
public class OutboundExportReqVO {
@ApiModelProperty(value = "经销商id")
private String vendorId;
@ApiModelProperty(value = "经销商名称")
private String vendorName;
@ApiModelProperty(value = "出库单号")
private String outBoundId;
@ApiModelProperty(value = "出库时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] outBoundTime;
@ApiModelProperty(value = "承运人")
private String carrierVehicles;
@ApiModelProperty(value = "承运车辆")
private String carrier;
@ApiModelProperty(value = "联系方式")
private String carrierContact;
@ApiModelProperty(value = "上链状态 0未上链 1激活状态 2冻结状态")
private Integer blockState;
@ApiModelProperty(value = "出库批次上链区块id")
private String blockChainId;
@ApiModelProperty(value = "出库批次上链区块唯一识别码")
private String blockChainBlockIdentity;
@ApiModelProperty(value = "所属商户id")
private Long belongBusinessId;
@ApiModelProperty(value = "所属商户名称")
private String belongBusinessName;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern =DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

@ -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,57 +0,0 @@
package cn.iocoder.yudao.module.flow.controller.admin.outbound.vo;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import lombok.*;
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 OutboundPageReqVO extends PageParam {
@ApiModelProperty(value = "经销商id")
private String vendorId;
@ApiModelProperty(value = "经销商名称")
private String vendorName;
@ApiModelProperty(value = "出库单号")
private String outBoundId;
@ApiModelProperty(value = "出库时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] outBoundTime;
@ApiModelProperty(value = "承运人")
private String carrierVehicles;
@ApiModelProperty(value = "承运车辆")
private String carrier;
@ApiModelProperty(value = "联系方式")
private String carrierContact;
@ApiModelProperty(value = "上链状态 0未上链 1激活状态 2冻结状态")
private Integer blockState;
@ApiModelProperty(value = "出库批次上链区块id")
private String blockChainId;
@ApiModelProperty(value = "出库批次上链区块唯一识别码")
private String blockChainBlockIdentity;
@ApiModelProperty(value = "所属商户id")
private Long belongBusinessId;
@ApiModelProperty(value = "所属商户名称")
private String belongBusinessName;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

@ -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,54 +0,0 @@
package cn.iocoder.yudao.module.flow.controller.admin.outbound.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 java.util.Date;
@Data
public class OutboundSaveReqVO {
@ApiModelProperty(value = "经销商id")
private String vendorId;
@ApiModelProperty(value = "经销商名称")
private String vendorName;
@ApiModelProperty(value = "出库单号")
private String outBoundId;
@ApiModelProperty(value = "出库时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date outBoundTime;
@ApiModelProperty(value = "承运人")
private String carrierVehicles;
@ApiModelProperty(value = "承运车辆")
private String carrier;
@ApiModelProperty(value = "联系方式")
private String carrierContact;
@ApiModelProperty(value = "上链状态 0未上链 1激活状态 2冻结状态")
private Integer blockState;
@ApiModelProperty(value = "出库批次上链区块id")
private String blockChainId;
@ApiModelProperty(value = "出库批次上链区块唯一识别码")
private String blockChainBlockIdentity;
@ApiModelProperty(value = "所属商户id")
private Long belongBusinessId;
@ApiModelProperty(value = "所属商户名称")
private String belongBusinessName;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date createTime;
}

@ -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,64 +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 javax.validation.constraints.*;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class OutboundGoodsBaseVO {
// @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 = "溯源码数量")
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,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,77 +0,0 @@
package cn.iocoder.yudao.module.flow.dal.dataobject.outbound;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("flow_outbound")
@KeySequence("flow_outbound_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OutboundDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
* id
*/
private String vendorId;
/**
*
*/
private String vendorName;
/**
*
*/
private String outBoundId;
/**
*
*/
private Date outBoundTime;
/**
*
*/
private String carrierVehicles;
/**
*
*/
private String carrier;
/**
*
*/
private String carrierContact;
/**
* 0 1 2
*/
private Integer blockState;
/**
* id
*/
private String blockChainId;
/**
*
*/
private String blockChainBlockIdentity;
/**
* id
*/
private Long belongBusinessId;
/**
*
*/
private String belongBusinessName;
}

@ -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,463 +0,0 @@
package cn.iocoder.yudao.module.flow.service.outbound;
import cn.iocoder.yudao.framework.common.enums.BlockStateEnum;
import cn.iocoder.yudao.framework.common.enums.CodeEnum;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.basic.api.dealerinfo.DealerInfoApi;
import cn.iocoder.yudao.module.basic.api.dealerinfo.dto.DealerInfoRespDTO;
import cn.iocoder.yudao.module.chain.api.blockcertificate.BlockCertificateApi;
import cn.iocoder.yudao.module.chain.api.blockcertificate.dto.BlockCertificateRespDTO;
import cn.iocoder.yudao.module.chain.api.blockcertificate.dto.BlockCertificateUpChainReqDTO;
import cn.iocoder.yudao.module.chain.api.blockcertificate.dto.UpChainObjReqDTO;
import cn.iocoder.yudao.module.chain.api.blockcertificate.dto.UpdateStatusReqDTO;
import cn.iocoder.yudao.module.chain.enums.ChainStatusEnum;
import cn.iocoder.yudao.module.chain.enums.OperateTypeEnum;
import cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.*;
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsRespVO;
import cn.iocoder.yudao.module.flow.controller.admin.outboundgoods.vo.OutboundGoodsSaveReqVO;
import cn.iocoder.yudao.module.flow.convert.outbound.OutboundConvert;
import cn.iocoder.yudao.module.flow.convert.outboundgoods.OutboundGoodsConvert;
import cn.iocoder.yudao.module.flow.dal.dataobject.outbound.OutboundDO;
import cn.iocoder.yudao.module.flow.dal.dataobject.outboundgoods.OutboundGoodsDO;
import cn.iocoder.yudao.module.flow.dal.mysql.outbound.OutboundMapper;
import cn.iocoder.yudao.module.flow.dal.mysql.outboundgoods.OutboundGoodsMapper;
import cn.iocoder.yudao.module.flow.enums.ErrorCodeConstants;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.basic.enums.ErrorCodeConstants.GOODS_ENCODING_INFO_NOT_EXISTS;
/**
* Service
*
* @author
*/
@Service
@Validated
public class OutboundServiceImpl implements OutboundService {
@Resource
private OutboundMapper outboundMapper;
@Resource
private OutboundGoodsMapper outboundGoodsMapper;
@Resource
private DealerInfoApi dealerInfoApi;
@Resource
private BlockCertificateApi blockCertificateApi;
/**
*
*
* @param createReqVO
* @return
*/
@Override
@Transactional
public Long createOutbound(OutboundCreateReqVO createReqVO) {
//检验经销商id是否存在如果不存在则抛出异常。
CommonResult<DealerInfoRespDTO> result = dealerInfoApi.getDealerGoodsInfoByDealerGoodsId(createReqVO.getVendorId());
DealerInfoRespDTO dto = result.getData();
if (result.isError() || dto == null) {
throw exception(cn.iocoder.yudao.module.basic.enums.ErrorCodeConstants.VENDOR_INFO_NOT_EXISTS);
}
//将输批次信息转换成对应的 DO 对象,并进行存在性校验。 第一种
List<OutboundGoodsDO> outboundGoods = OutboundConvert.INSTANCE.convertListCreate(createReqVO.getOutboundGoods());
Map<String, String> idAndNames = new HashMap<>();
//判断出库单商品是否存在
this.verifiHarvestBatchs(outboundGoods, idAndNames, null, null,null);
outboundGoods.forEach(outboundGood -> {
outboundGood.setBindId(CodeEnum.OUTBOUND_BIND_CODE.getCode());
outboundGood.setId(null);
outboundGood.setOutBoundId(createReqVO.getOutBoundId());
outboundGood.setBelongBusinessId(dto.getBelongBusinessId());
outboundGood.setBelongBusinessName(dto.getBelongBusinessName());
if (outboundGood.getGoodsUnitPrice() != null){
//重新计算总额
outboundGood.setTotalPrice(outboundGood.getGoodsUnitPrice().multiply(new BigDecimal(outboundGood.getGoodsNum())));
}else {
outboundGood.setTotalPrice(new BigDecimal(0));
}
});
// 插入数据
OutboundDO outbound = OutboundConvert.INSTANCE.convert(createReqVO);
//下面的数据参照数据库为准
outbound.setOutBoundTime(createReqVO.getOutBoundTime());
outbound.setBelongBusinessId(dto.getBelongBusinessId());
outbound.setBelongBusinessName(dto.getBelongBusinessName());
outbound.setBlockState(BlockStateEnum.ACTIVATION.getBlockState());
outboundMapper.insert(outbound);
outboundGoodsMapper.insertBatch(outboundGoods);
// 返回
return outbound.getId();
}
/**
*
* @param outboundGoods OutboundGoodsDO
* @param idAndNames id
* @param harvestInfoMaps
* @param willUpdateIds id
*/
private void verifiHarvestBatchs(List<OutboundGoodsDO> outboundGoods, Map<String, String> idAndNames, Map<String, OutboundGoodsDO> harvestInfoMaps,
List<Long> willUpdateIds, OutboundDO outboundDO) {
Set<String> outboundIdsSet = new HashSet<>();
Set<Long> willUpdateIdsSet = new HashSet<>();
outboundGoods.forEach(outboundsBatch -> {
outboundIdsSet.add(outboundsBatch.getGoodsId());
if (outboundsBatch.getId() != null ){
willUpdateIdsSet.add(outboundsBatch.getId());
if (willUpdateIds != null){
willUpdateIds.add(outboundsBatch.getId());
}
}
});
//存在相同的商品编码
if (outboundIdsSet.size() != outboundGoods.size()){
throw exception(ErrorCodeConstants.GOODS_INFO_NOT_EXISTS_BE_REPEATED);
}
//存在相同的批次id
if (willUpdateIds != null && willUpdateIdsSet.size() != willUpdateIds.size()){
throw exception(ErrorCodeConstants.HARVEST_BATCH_NOT_BE_REPEATED);
}
//这边开始校验商品编码是否存在
if(outboundDO != null){
List<String> outBoundGoodsIds = new ArrayList<>(outboundIdsSet);
List<OutboundGoodsDO> outboundGoodsRespDTO = outboundGoodsMapper.selectList(new LambdaQueryWrapperX<OutboundGoodsDO>()
.in(OutboundGoodsDO::getGoodsId, outBoundGoodsIds).eq(OutboundGoodsDO::getOutBoundId, outboundDO.getOutBoundId()));
if (!outboundGoodsRespDTO.isEmpty() && outboundGoodsRespDTO.size() != outboundGoodsRespDTO.size()){
throw exception(GOODS_ENCODING_INFO_NOT_EXISTS);
}
outboundGoodsRespDTO.forEach(item ->{
idAndNames.put(item.getGoodsId(),item.getGoodsName());
if (harvestInfoMaps != null){
harvestInfoMaps.put(item.getGoodsId(),item);
}
});
}
}
/**
*
*
* @param updateReqVO
*/
@Override
@Transactional
public void updateOutbound(OutboundUpdateReqVO updateReqVO) {
//查询出库单信息
OutboundDO outboundBy = outboundMapper.selectById(updateReqVO.getId());
if (outboundBy == null){
throw exception(ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
}
List<OutboundGoodsDO> outboundGoods = OutboundGoodsConvert.INSTANCE.convertListCreate(updateReqVO.getOutboundGoods());
//构建出库商品批次 id 和名称的映射
HashMap<String,String> idAndNames = new HashMap<>();
//页面传入的outboundGoods集合
Map<String, OutboundGoodsDO> outboundGoodsMaps = new HashMap<>();
//将要更新的出库商品批次主键id
List<Long> willUpdateId = new ArrayList<>();
//判断出库商品是否存在
this.verifiHarvestBatchs(outboundGoods, idAndNames, outboundGoodsMaps, willUpdateId, outboundBy);
//出库商品批次键值对
Map<Long,OutboundGoodsDO> outboundGoodsDOMaps = new HashMap<>();
if(willUpdateId.size() > 0){
//查询需要更新的出库商品批次
List<OutboundGoodsDO> outboundGoodsDOS = outboundGoodsMapper.selectList(new LambdaQueryWrapperX<OutboundGoodsDO>()
.in(OutboundGoodsDO::getId, willUpdateId)
.eq(OutboundGoodsDO::getOutBoundId, outboundBy.getOutBoundId()));
// if (outboundGoodsDOS.size() != willUpdateId.size()){ //存在已删除或者不是该出库商品出库单号的批次信息
// throw exception(ErrorCodeConstants.EXPORT_HAS_BEEN_DELETED_OUTBOUND);//存在已删除的出库商品批次
// }
outboundGoodsDOS.forEach(item -> outboundGoodsDOMaps.put(item.getId(),item));
}
//需要新增的的集合
List<OutboundGoodsDO> addList = new ArrayList<>();
//需要新增修改的集合
List<OutboundGoodsDO> updateList = new ArrayList<>();
//遍历出库商品列表
for (OutboundGoodsSaveReqVO item: updateReqVO.getOutboundGoods()){
//加了Id字段
if (item.getId() != null){
//更新流程
OutboundGoodsDO outboundGoodsDO = outboundGoodsDOMaps.get(item.getId());
//防止非法修改数据
if(outboundGoodsDO == null){
continue;
}
//只更新可更新的字段
outboundGoodsDO.setHarvestBatchId(item.getHarvestBatchId());
outboundGoodsDO.setGoodsWeight(item.getGoodsWeight());
outboundGoodsDO.setGoodsNum(item.getGoodsNum());
outboundGoodsDO.setGoodsUnitPrice(item.getGoodsUnitPrice());
//计算总额
if (outboundGoodsDO.getGoodsUnitPrice() != null){
outboundGoodsDO.setTotalPrice(outboundGoodsDO.getGoodsUnitPrice().multiply(new BigDecimal(outboundGoodsDO.getGoodsNum())));
}else {
outboundGoodsDO.setTotalPrice(new BigDecimal(0));
}
//更新所有
updateList.add(outboundGoodsDO);
}else {
OutboundGoodsDO outboundGood = OutboundGoodsConvert.INSTANCE.convert(item);
//新增 这里都以数据库的数据为准
outboundGood.setId(null);
outboundGood.setBindId(CodeEnum.OUTBOUND_BIND_CODE.getCode());
outboundGood.setBelongBusinessId(outboundBy.getBelongBusinessId());
outboundGood.setBelongBusinessName(outboundBy.getBelongBusinessName());
outboundGood.setOutBoundId(outboundBy.getOutBoundId());
// 使用相同的单位
outboundGood.setGoodsUnit(item.getGoodsUnit());
// 使用相同的单位
if (outboundGood.getGoodsUnitPrice() != null){
outboundGood.setTotalPrice(outboundGood.getGoodsUnitPrice().multiply(new BigDecimal(outboundGood.getGoodsNum())));
}else {
outboundGood.setTotalPrice(new BigDecimal(0));
}
//将新增成功的数据返回给调用者
addList.add(outboundGood);
}
}
//更新主库
OutboundDO updateOutboundDO = OutboundConvert.INSTANCE.convert(updateReqVO);
if (!addList.isEmpty()){
outboundGoodsMapper.insertBatch(addList);
}
if (!updateList.isEmpty()){
outboundGoodsMapper.updateBatch(updateList,Integer.MAX_VALUE);
}
outboundMapper.updateById(updateOutboundDO);
}
/**
*
*
* @param id
*/
@Override
public void deleteOutbound(Long id) {
// 校验存在
validateOutboundExists(id);
// 删除
outboundMapper.deleteById(id);
}
private void validateOutboundExists(Long id) {
//判断id为空
if (outboundMapper.selectById(id) == null) {
throw exception(ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
}
}
/**
*
*
* @param id
* @return
*/
@Override
public OutboundRespVO getOutbound(Long id) {
OutboundDO outboundDO = outboundMapper.selectById(id);
if (outboundDO == null){
throw exception(ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
}
OutboundRespVO outboundRespVO = OutboundConvert.INSTANCE.convert(outboundDO);
List<OutboundGoodsDO> outboundGoodsDOList = outboundGoodsMapper.selectList(OutboundGoodsDO::getOutBoundId, outboundRespVO.getOutBoundId());
List<OutboundGoodsRespVO> outboundGoodsRespVOS = OutboundGoodsConvert.INSTANCE.convertList(outboundGoodsDOList);
outboundRespVO.setOutboundGoods(outboundGoodsRespVOS);
return outboundRespVO;
}
/**
*
*
* @param ids
* @return
*/
@Override
public List<OutboundDO> getOutboundList(Collection<Long> ids) {
return outboundMapper.selectBatchIds(ids);
}
/**
*
*
* @param pageReqVO
* @return
*/
@Override
public PageResult<OutboundDO> getOutboundPage(OutboundPageReqVO pageReqVO) {
return outboundMapper.selectPage(pageReqVO);
}
/**
* id
*
* @param id@return
*/
@Override
public Map<String, Object> getOutboundGoodsInfoById(Long id) {
//根据主表id查询单条数据
OutboundDO outboundDO = outboundMapper.selectById(id);
if (outboundDO == null) {
throw exception(ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
}
//根据主表所获得的记录绑定查询子表的所有数据
List<OutboundGoodsDO> outboundGoodsDOList = outboundGoodsMapper.selectList(OutboundGoodsDO::getId, outboundDO.getVendorId());
Map<String, Object> result = new HashMap<>();
result.put("outboundDO", outboundDO); //将主表信息放入Map中
result.put("outboundGoodsDOList",outboundGoodsDOList); // 将子表列表放入Map中
return result;
}
/**
* ,
* @param outBoundId
* @return
*/
@Override
public OutboundDTO getOutboundGoodsInfoOutBoundId(String outBoundId) {
// 根据出库单号查询主单信息
OutboundDO outboundDO = outboundMapper.selectOne(new QueryWrapper<OutboundDO>()
.eq("out_bound_id", outBoundId));
if (outboundDO == null) {
return null;
}
// 根据主单ID查询子单信息
List<OutboundGoodsDO> outboundGoodsList = outboundGoodsMapper.selectList(new QueryWrapper<OutboundGoodsDO>()
.eq("out_bound_id", outBoundId));
// 将主单和子单组装成DTO返回
OutboundDTO outboundDTO = new OutboundDTO();
BeanUtils.copyProperties(outboundDO, outboundDTO);
outboundDTO.setOutboundGoodsList(outboundGoodsList);
return outboundDTO;
}
/**
*
*
* @param id id
*/
@Override
public void upChain(Long id) {
OutboundDO outboundInfo = outboundMapper.selectById(id);
if (outboundInfo == null){
throw ServiceExceptionUtil.exception(cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
}
if (!outboundInfo.getBlockState().equals(BlockStateEnum.NOT_ON_CHAIN.getBlockState())){
throw ServiceExceptionUtil.exception(cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.OUTBOUND_NOT_ON_CHAIN_HARVEST_INFO_CAN_DO_UP_CHAIN);
}
//封装出库
ArrayList<UpChainObjReqDTO> operateOutbounds = new ArrayList<>();
UpChainObjReqDTO upChainObjReqDTO = new UpChainObjReqDTO();
upChainObjReqDTO.setOperateObjId(id);
operateOutbounds.add(upChainObjReqDTO);
BlockCertificateUpChainReqDTO upChainReqDTO = new BlockCertificateUpChainReqDTO();
upChainReqDTO.setOperateType(OperateTypeEnum.OUT_BOUND.getType());
upChainReqDTO.setOperateName(OperateTypeEnum.OUT_BOUND.getName());
upChainReqDTO.setOperateObjs(operateOutbounds);
upChainReqDTO.setBelongBusinessId(outboundInfo.getBelongBusinessId());
upChainReqDTO.setBelongBusinessName(outboundInfo.getBelongBusinessName());
//远程管理
List<BlockCertificateRespDTO> batchResults = blockCertificateApi.createAndUpChainBatch(upChainReqDTO).getData();
if (batchResults == null){
throw ServiceExceptionUtil.exception(cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.CREATE_BLOCK_CERTIFICATE_FAIL);
}
//将要更新的类
OutboundDO outboundDO = new OutboundDO();
outboundDO.setId(id);
outboundDO.setBlockChainBlockIdentity(batchResults.get(0).getChainBlockIdentity());
outboundDO.setBlockChainId(batchResults.get(0).getChainOperateId());
outboundDO.setBlockState(BlockStateEnum.ACTIVATION.getBlockState());// 改为激活状态
outboundMapper.updateById(outboundDO);
}
/**
*
*
* @param id id
* @param state
*/
@Override
public void updateChainStatus(Long id, Integer state) {
OutboundDO outboundInfo = outboundMapper.selectById(id);
if (outboundInfo == null){
throw ServiceExceptionUtil.exception(cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.OUTBOUND_NOT_EXISTS);
}
if (outboundInfo.getBlockState().equals(BlockStateEnum.NOT_ON_CHAIN.getBlockState())){
throw ServiceExceptionUtil.exception(cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.OUTBOUND_ON_CHAIN_HARVEST_INFO_CAN_DO_UPDATE_CHAIN_STATUS);
}
Integer blockState = state.equals(BlockStateEnum.ACTIVATION.getBlockState()) ? BlockStateEnum.ACTIVATION.getBlockState() : BlockStateEnum.FREEZE.getBlockState();
Integer chainStatus = state.equals(BlockStateEnum.ACTIVATION.getBlockState()) ? ChainStatusEnum.ACTIVE.getStatus() : ChainStatusEnum.FREEZE.getStatus();
// 修改主单的链状态时,将同步修改子单的链状态
List<UpdateStatusReqDTO> batchsReqDTOS = new ArrayList<>();
UpdateStatusReqDTO harvestReqDTO = new UpdateStatusReqDTO();
harvestReqDTO.setChainOperateId(outboundInfo.getBlockChainId());
harvestReqDTO.setChainStatus(chainStatus);
batchsReqDTOS.add(harvestReqDTO);
OutboundDO updateDO = new OutboundDO();
updateDO.setId(id);
updateDO.setBlockState(blockState);
batchsReqDTOS.forEach(batch -> batch.setChainStatus(blockState));
outboundMapper.updateById(updateDO);
}
/**
*
*
* @return
*/
@Override
public OutboundInfoDataRespVO getOutboundInfoDataStatistics() {
OutboundInfoDataRespVO result = new OutboundInfoDataRespVO();
//查询本月的每个商品的出库总量
result.setGoodsWeekStatisticsDatas(outboundMapper.getDatasGroupByGoodsId("month"));
//查询最新7天的出库总量
result.setGoodsMonthStatisticsDatas(outboundMapper.getSixDatasByGoodsId());
//将每个商品的出库总量进行相加
result.setTodayOutboundCount(outboundMapper.getTodayOutboundCount());
return result;
}
}

@ -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,72 +0,0 @@
package cn.iocoder.yudao.module.flow.service.outboundgoods;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.basic.api.dealerinfo.DealerInfoApi;
import cn.iocoder.yudao.module.basic.api.dealerinfo.dto.DealerInfoRespDTO;
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.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.springframework.stereotype.Service;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.flow.enums.ErrorCodeConstants.OUTBOUND_GOODS_NOT_EXISTS;
/**
* Service
*
* @author
*/
@Service
public class OutboundGoodsServiceImpl implements OutboundGoodsService {
@Resource
private OutboundGoodsMapper outboundGoodsMapper;
@Resource
private DealerInfoApi dealerGoodsApi;
@Override
public Long createOutboundGoods(OutboundGoodsCreateReqVO createReqVO) {
//检验经销商id是否存在如果不存在则抛出异常。
CommonResult<DealerInfoRespDTO> result = dealerGoodsApi.getDealerGoodsInfoByDealerGoodsId(createReqVO.getHarvestBatchId());
DealerInfoRespDTO dto = result.getData();
if (result.isError() || dto == null){
throw exception(cn.iocoder.yudao.module.basic.enums.ErrorCodeConstants.VENDOR_INFO_NOT_EXISTS.getCode());
}
// 插入数据
OutboundGoodsDO outboundGoods = OutboundGoodsConvert.INSTANCE.convert(createReqVO);
outboundGoodsMapper.insert(outboundGoods);
// 返回
return outboundGoods.getId();
}
@Override
public void updateOutboundGoods(OutboundGoodsUpdateReqVO updateReqVO) {
// 校验存在
validateOutboundGoodsExists(updateReqVO.getId());
// 更新
OutboundGoodsDO updateObj = OutboundGoodsConvert.INSTANCE.convert(updateReqVO);
outboundGoodsMapper.updateById(updateObj);
}
@Override
public void deleteOutboundGoods(Long id) {
// 校验存在
validateOutboundGoodsExists(id);
// 删除
outboundGoodsMapper.deleteById(id);
}
private void validateOutboundGoodsExists(Long id) {
if (outboundGoodsMapper.selectById(id) == null) {
throw exception(OUTBOUND_GOODS_NOT_EXISTS);
}
}
}

@ -1,31 +0,0 @@
spring:
main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Dubbo 或者 Feign 等会存在重复定义的服务
--- #################### 注册中心相关配置 ####################
spring:
cloud:
nacos:
server-addr: 192.168.2.74:8848
discovery:
namespace: dev # 命名空间。这里使用 dev 开发环境
metadata:
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
--- #################### 配置中心相关配置 ####################
spring:
cloud:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 192.168.2.74:8848 # Nacos 服务器地址
namespace: dev # 命名空间。这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: # 使用的 Nacos 配置集的 dataId默认为 spring.application.name
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -1,31 +0,0 @@
spring:
main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Dubbo 或者 Feign 等会存在重复定义的服务
--- #################### 注册中心相关配置 ####################
spring:
cloud:
nacos:
server-addr: 127.0.0.1:8848
discovery:
namespace: prod # 命名空间。这里使用 dev 开发环境
metadata:
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
--- #################### 配置中心相关配置 ####################
spring:
cloud:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
namespace: prod # 命名空间。这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: # 使用的 Nacos 配置集的 dataId默认为 spring.application.name
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -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,76 +0,0 @@
<configuration>
<!-- 引用 Spring Boot 的 logback 基础配置 -->
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<!-- 变量 yudao.info.base-package基础业务包 -->
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level级别从左显示 5 个字符宽度,%msg日志消息%n是换行符 -->
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%thread] [%tid] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
<!-- 控制台 Appender -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">     
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<pattern>${PATTERN_DEFAULT}</pattern>
</layout>
</encoder>
</appender>
<!-- 文件 Appender -->
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<pattern>${PATTERN_DEFAULT}</pattern>
</layout>
</encoder>
<!-- 日志文件名 -->
<file>${LOG_FILE}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 滚动后的日志文件名 -->
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
<!-- 日志文件,到达多少容量,进行滚动 -->
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
<!-- 日志文件的总大小0 表示不限制 -->
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
<!-- 日志文件的保留天数 -->
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
</rollingPolicy>
</appender>
<!-- 异步写入日志,提升性能 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
<queueSize>256</queueSize>
<appender-ref ref="FILE"/>
</appender>
<!-- SkyWalking GRPC 日志收集实现日志中心。注意SkyWalking 8.4.0 版本开始支持 -->
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<pattern>${PATTERN_DEFAULT}</pattern>
</layout>
</encoder>
</appender>
<!-- 本地环境 -->
<springProfile name="local">
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
</root>
</springProfile>
<!-- 其它环境 -->
<springProfile name="dev,test,stage,prod,default">
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ASYNC"/>
<appender-ref ref="GRPC"/>
</root>
</springProfile>
</configuration>

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.flow.dal.mysql.outbound.OutboundMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getDatasGroupByGoodsId"
resultType="cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.OutboundStatisticsDataRespVO">
SELECT
b.goods_id AS goodsId,
b.goods_name AS goodsName,
SUM(b.goods_num) AS goodsNum,
SUM(b.goods_weight) AS goodsWeight,
(
SELECT SUM(g.goods_num * g.goods_weight)
FROM flow_outbound a
LEFT JOIN flow_outbound_goods g ON g.out_bound_id = a.out_bound_id
WHERE
MONTH(a.out_bound_time) = MONTH(NOW())
AND g.goods_id = b.goods_id
) AS sumNum
FROM
flow_outbound a
LEFT JOIN
flow_outbound_goods b ON b.out_bound_id = a.out_bound_id
WHERE
MONTH(a.out_bound_time) = MONTH(NOW())
GROUP BY
b.goods_id, b.goods_name
</select>
<select id="getSixDatasByGoodsId"
resultType="cn.iocoder.yudao.module.flow.controller.admin.outbound.vo.OutboundStatisticsDataRespVO">
SELECT
DATE(a.out_bound_time) AS date,
SUM(b.goods_num) AS goodsNum,
SUM(b.goods_weight) AS goodsWeight,
SUM(b.goods_num * b.goods_weight) AS sumNum
FROM
flow_outbound a
LEFT JOIN
flow_outbound_goods b ON b.out_bound_id = a.out_bound_id
WHERE
a.out_bound_time >= CURDATE() - INTERVAL 6 DAY
AND a.out_bound_time &lt; CURDATE()
GROUP BY
DATE(a.out_bound_time)
ORDER BY
DATE(a.out_bound_time);
</select>
<select id="getTodayOutboundCount" resultType="java.math.BigDecimal">
SELECT SUM(sumNum) AS totalQuantity
FROM (
SELECT b.goods_id AS goodsId,
b.goods_name AS goodsName,
SUM(b.goods_num * b.goods_weight) AS sumNum
FROM flow_outbound a
LEFT JOIN flow_outbound_goods b ON b.out_bound_id = a.out_bound_id
WHERE MONTH(a.out_bound_time) = MONTH(NOW())
GROUP BY b.goods_id, b.goods_name
) AS subquery
</select>
</mapper>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.flow.dal.mysql.outboundgoods.OutboundGoodsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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);
}
}

@ -46,18 +46,6 @@
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-basic-biz</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-product-biz</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-basic-api</artifactId> <artifactId>yudao-module-basic-api</artifactId>

@ -1,12 +1,13 @@
package cn.iocoder.yudao.module.identity.controller.admin.generaterecord.vo; package cn.iocoder.yudao.module.identity.controller.admin.generaterecord.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.fasterxml.jackson.annotation.JsonFormat; import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@ -25,8 +26,8 @@ public class GenerateRecordPageReqVO extends PageParam {
@ApiModelProperty(value = "所属商户名称") @ApiModelProperty(value = "所属商户名称")
private String belongBusinessName; private String belongBusinessName;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime; private Date[] createTime;
@ApiModelProperty(value = "采收批次") @ApiModelProperty(value = "采收批次")

@ -20,7 +20,7 @@
<if test="pageReqVO.generateRecordId != null">and igr.generate_record_id = #{pageReqVO.generateRecordId}</if> <if test="pageReqVO.generateRecordId != null">and igr.generate_record_id = #{pageReqVO.generateRecordId}</if>
<if test="pageReqVO.codeRuleFormat != null and pageReqVO.codeRuleFormat != ''">and igr.code_rule_format like concat('%',#{pageReqVO.codeRuleFormat},'%') ESCAPE '/'</if> <if test="pageReqVO.codeRuleFormat != null and pageReqVO.codeRuleFormat != ''">and igr.code_rule_format like concat('%',#{pageReqVO.codeRuleFormat},'%') ESCAPE '/'</if>
<if test="pageReqVO.belongBusinessName != null and pageReqVO.belongBusinessName != ''">and igr.belong_business_name like concat('%',#{pageReqVO.belongBusinessName},'%') ESCAPE '/'</if> <if test="pageReqVO.belongBusinessName != null and pageReqVO.belongBusinessName != ''">and igr.belong_business_name like concat('%',#{pageReqVO.belongBusinessName},'%') ESCAPE '/'</if>
<if test="pageReqVO.createTime != null and pageReqVO.createTime.size() == 2"> <if test="pageReqVO.createTime != null and pageReqVO.createTime.length == 2">
and igr.belong_business_name BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]} and igr.belong_business_name BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}
</if> </if>
<if test="pageReqVO.batchId != null and pageReqVO.batchId != ''">and igb.batch_id = #{pageReqVO.batchId}</if> <if test="pageReqVO.batchId != null and pageReqVO.batchId != ''">and igb.batch_id = #{pageReqVO.batchId}</if>

@ -17,9 +17,6 @@ public class ScanDataDTO {
@ApiModelProperty(value = "商品信息") @ApiModelProperty(value = "商品信息")
private BlockCertificateDTO goodsInfo; private BlockCertificateDTO goodsInfo;
@ApiModelProperty(value = "商品认证信息")
private List<BlockCertificateDTO> goodsVerifys;
@ApiModelProperty(value = "环节信息") @ApiModelProperty(value = "环节信息")
@Valid @Valid
private List<BlockCertificateDTO> linkInfos; private List<BlockCertificateDTO> linkInfos;

@ -55,11 +55,6 @@
<artifactId>yudao-module-basic-api</artifactId> <artifactId>yudao-module-basic-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-flow-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency> <dependency>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-chain-api</artifactId> <artifactId>yudao-module-chain-api</artifactId>

@ -29,6 +29,4 @@ public class GoodsConfigRespVO {
@ApiModelProperty(value = "区块证书信息(商品信息)") @ApiModelProperty(value = "区块证书信息(商品信息)")
private BlockCertificateSaveReqVO goodsInfo; private BlockCertificateSaveReqVO goodsInfo;
@ApiModelProperty(value = "区块证书信息(商品认证信息)集合")
private List<BlockCertificateSaveReqVO> goodsVerifys;
} }

@ -25,7 +25,4 @@ public class GoodsConfigSaveReqVO {
@NotNull(message = "商品信息不能为空") @NotNull(message = "商品信息不能为空")
@Valid @Valid
private BlockCertificateSaveReqVO goodsInfo; private BlockCertificateSaveReqVO goodsInfo;
@ApiModelProperty(value = "区块证书信息(商品认证信息)集合")
private List<BlockCertificateSaveReqVO> goodsVerifys;
} }

@ -33,9 +33,6 @@ public class HarvestBatchConfigRespVO {
@ApiModelProperty(value = "商品信息") @ApiModelProperty(value = "商品信息")
private BlockCertificateSaveReqVO goodsInfo; private BlockCertificateSaveReqVO goodsInfo;
@ApiModelProperty(value = "商品认证信息")
private List<BlockCertificateSaveReqVO> goodsVerifys;
@ApiModelProperty(value = "环节信息") @ApiModelProperty(value = "环节信息")
@Valid @Valid
private List<BlockCertificateSaveReqVO> linkInfos; private List<BlockCertificateSaveReqVO> linkInfos;

@ -33,10 +33,6 @@ public class HarvestBatchConfigSaveReqVO {
@Valid @Valid
private BlockCertificateSaveReqVO goodsInfo; private BlockCertificateSaveReqVO goodsInfo;
@ApiModelProperty(value = "商品认证信息集合")
@Valid
private List<BlockCertificateSaveReqVO> goodsVerifys;
@ApiModelProperty(value = "环节信息集合") @ApiModelProperty(value = "环节信息集合")
@Valid @Valid
private List<BlockCertificateSaveReqVO> linkInfos; private List<BlockCertificateSaveReqVO> linkInfos;

@ -24,9 +24,6 @@ public class PreviewRespVO {
@ApiModelProperty(value = "商品信息") @ApiModelProperty(value = "商品信息")
private BlockCertificateSaveReqVO goodsInfo; private BlockCertificateSaveReqVO goodsInfo;
@ApiModelProperty(value = "商品认证信息")
private List<BlockCertificateSaveReqVO> goodsVerifys;
@ApiModelProperty(value = "环节信息") @ApiModelProperty(value = "环节信息")
@Valid @Valid
private List<BlockCertificateSaveReqVO> linkInfos; private List<BlockCertificateSaveReqVO> linkInfos;

@ -101,7 +101,7 @@ public class HarvestInfoController {
@GetMapping("/getHarverstIdList") @GetMapping("/getHarverstIdList")
@ApiOperation("获得采收入库编号列表") @ApiOperation("获得采收入库编号列表")
@ApiImplicitParam(name = "count", value = "数量", required = true, example = "1", dataTypeClass = Integer.class) @ApiImplicitParam(name = "count", value = "数量", required = true, example = "1", dataTypeClass = Integer.class)
@PreAuthorize("@ss.hasPermission('product:inputs-buy:query')") @PreAuthorize("@ss.hasPermission('product:harvest-info:query')")
public CommonResult<List<String>> getHarverstIdList(@RequestParam("count") @NotNull Integer count) { public CommonResult<List<String>> getHarverstIdList(@RequestParam("count") @NotNull Integer count) {
return CommonResult.success(harvestInfoService.getHarverstIdList(count)); return CommonResult.success(harvestInfoService.getHarverstIdList(count));
} }

@ -2,14 +2,12 @@ package cn.iocoder.yudao.module.product.framework.rpc.config;
import cn.iocoder.yudao.module.basic.api.businessinfo.BusinessInfoApi; import cn.iocoder.yudao.module.basic.api.businessinfo.BusinessInfoApi;
import cn.iocoder.yudao.module.basic.api.goodsinfo.GoodsInfoApi; import cn.iocoder.yudao.module.basic.api.goodsinfo.GoodsInfoApi;
import cn.iocoder.yudao.module.basic.api.goodsverify.GoodsVerifyApi;
import cn.iocoder.yudao.module.basic.api.vendorinfo.VendorInfoApi; import cn.iocoder.yudao.module.basic.api.vendorinfo.VendorInfoApi;
import cn.iocoder.yudao.module.basic.api.workersinfo.WorkersinfoApi; import cn.iocoder.yudao.module.basic.api.workersinfo.WorkersinfoApi;
import cn.iocoder.yudao.module.chain.api.blockcertificate.BlockCertificateApi; import cn.iocoder.yudao.module.chain.api.blockcertificate.BlockCertificateApi;
import cn.iocoder.yudao.module.chain.api.operatedetail.OperateDetailApi; import cn.iocoder.yudao.module.chain.api.operatedetail.OperateDetailApi;
import cn.iocoder.yudao.module.configure.api.deviceenvtype.DeviceEnvTypeApi; import cn.iocoder.yudao.module.configure.api.deviceenvtype.DeviceEnvTypeApi;
import cn.iocoder.yudao.module.configure.api.uniTemplate.UniTemplateApi; import cn.iocoder.yudao.module.configure.api.uniTemplate.UniTemplateApi;
import cn.iocoder.yudao.module.flow.api.outbound.OutboundApi;
import cn.iocoder.yudao.module.identity.api.scanrecord.ScanRecordApi; import cn.iocoder.yudao.module.identity.api.scanrecord.ScanRecordApi;
import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
@ -21,11 +19,9 @@ import org.springframework.context.annotation.Configuration;
@EnableFeignClients(clients = { @EnableFeignClients(clients = {
VendorInfoApi.class, VendorInfoApi.class,
GoodsInfoApi.class, GoodsInfoApi.class,
OutboundApi.class,
BlockCertificateApi.class, BlockCertificateApi.class,
OperateDetailApi.class, OperateDetailApi.class,
DictDataApi.class, DictDataApi.class,
GoodsVerifyApi.class,
BusinessInfoApi.class, BusinessInfoApi.class,
WorkersinfoApi.class, WorkersinfoApi.class,
UniTemplateApi.class, UniTemplateApi.class,

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.service.harvestbatch;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.common.enums.BlockStateEnum; import cn.iocoder.yudao.framework.common.enums.BlockStateEnum;
import cn.iocoder.yudao.framework.common.enums.CodeEnum; import cn.iocoder.yudao.framework.common.enums.CodeEnum;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
@ -11,8 +10,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.basic.api.businessinfo.BusinessInfoApi; import cn.iocoder.yudao.module.basic.api.businessinfo.BusinessInfoApi;
import cn.iocoder.yudao.module.basic.api.goodsinfo.GoodsInfoApi; import cn.iocoder.yudao.module.basic.api.goodsinfo.GoodsInfoApi;
import cn.iocoder.yudao.module.basic.api.goodsinfo.dto.GoodsInfoRespDTO; import cn.iocoder.yudao.module.basic.api.goodsinfo.dto.GoodsInfoRespDTO;
import cn.iocoder.yudao.module.basic.api.goodsverify.GoodsVerifyApi;
import cn.iocoder.yudao.module.basic.api.goodsverify.dto.GoodsVerifyRespDTO;
import cn.iocoder.yudao.module.basic.api.redis.dto.BusinessInfoDTO; import cn.iocoder.yudao.module.basic.api.redis.dto.BusinessInfoDTO;
import cn.iocoder.yudao.module.chain.api.blockcertificate.BlockCertificateApi; import cn.iocoder.yudao.module.chain.api.blockcertificate.BlockCertificateApi;
import cn.iocoder.yudao.module.chain.api.blockcertificate.dto.*; import cn.iocoder.yudao.module.chain.api.blockcertificate.dto.*;
@ -73,9 +70,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
@Resource @Resource
private GoodsInfoApi goodsInfoApi; private GoodsInfoApi goodsInfoApi;
@Resource
private GoodsVerifyApi goodsVerifyApi;
@Resource @Resource
private BusinessInfoApi businessInfoApi; private BusinessInfoApi businessInfoApi;
@ -253,81 +247,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
// 设置商品信息 // 设置商品信息
result.setGoodsInfo(goodsInfo); result.setGoodsInfo(goodsInfo);
// 查询商品认证的上链信息 如果没有查询到,返回商品认证信息
BlockCertificateReqDTO goodsVerifyBCReq = new BlockCertificateReqDTO();
goodsVerifyBCReq.setOperateType(OperateTypeEnum.GOODS_VERIFY.getType());// 查询商品认证类型
goodsVerifyBCReq.setBatchType(BatchTypeEnum.HARVEST_BATCH.getType());// 查询类型为采收批次的类型
goodsVerifyBCReq.setBatchId(harvestBatch.getHarvestBatchId());
List<BlockCertificateRespDTO> verifyRespDTOs = blockCertificateApi.getBlockCertificateList(goodsVerifyBCReq).getData();
List<BlockCertificateSaveReqVO> goodsVerifys = new ArrayList<>();
if(verifyRespDTOs.isEmpty() || verifyRespDTOs.get(0).getOperateDetails().isEmpty()) {
/*
, 2
1
,
2
*/
if(goodsInfo.getId() == null) {
List<GoodsVerifyRespDTO> goodsVerifyRespDTOs = goodsVerifyApi.getGoodsVerifys(harvestBatch.getGoodsId(), harvestBatch.getBelongBusinessId()).getData();
if (goodsVerifyRespDTOs != null && !goodsVerifyRespDTOs.isEmpty()) {
goodsVerifyRespDTOs.forEach(verify -> {
BlockCertificateSaveReqVO goodsVerify = new BlockCertificateSaveReqVO();
goodsVerify.setBatchId(harvestBatch.getHarvestBatchId());
goodsVerify.setBatchType(BatchTypeEnum.HARVEST_BATCH.getType());
goodsVerify.setOperateType(OperateTypeEnum.GOODS_VERIFY.getType());
goodsVerify.setLinkName("商品认证");
goodsVerify.setOperateObjId(verify.getId());// 认证主键id
List<OperateDetailSaveReqVO> details = new ArrayList<>();
OperateDetailSaveReqVO verifyName = new OperateDetailSaveReqVO();
verifyName.setTitle("认证名称");
verifyName.setType(OperateDetailTypeEnum.TEXT.getType());
verifyName.setContent(verify.getVerifyName());
details.add(verifyName);
OperateDetailSaveReqVO verifyAgencies = new OperateDetailSaveReqVO();
verifyAgencies.setTitle("认证机构");
verifyAgencies.setType(OperateDetailTypeEnum.TEXT.getType());
verifyAgencies.setContent(verify.getVerifyAgencies());
details.add(verifyAgencies);
OperateDetailSaveReqVO periodOfValidity = new OperateDetailSaveReqVO();
periodOfValidity.setTitle("有效期");
periodOfValidity.setType(OperateDetailTypeEnum.TEXT.getType());
if (verify.getVerifyIsForver()) {
periodOfValidity.setContent("长期有效");
} else {
String format = "yyyy-MM-dd";
periodOfValidity.setContent(DateUtil.format(verify.getVerifyStartTime(), format) + " ~ "
+ DateUtil.format(verify.getVerifyEndTime(), format));
}
details.add(periodOfValidity);
OperateDetailSaveReqVO verifyDataUrl = new OperateDetailSaveReqVO();
verifyDataUrl.setTitle("认证资料");
verifyDataUrl.setType(OperateDetailTypeEnum.IMAGE.getType());
verifyDataUrl.setContent(verify.getVerifyDataUrl());
details.add(verifyDataUrl);
goodsVerify.setOperateDetails(details);
goodsVerifys.add(goodsVerify);
});
}
}
} else {
/*
*/
verifyRespDTOs.forEach(verify -> {
BlockCertificateSaveReqVO BlockCertificateSaveReqVO = new BlockCertificateSaveReqVO();
List<OperateDetailSaveReqVO> operateDetails = this.getOperateDetails(verify, BlockCertificateSaveReqVO);
BlockCertificateSaveReqVO.setOperateDetails(operateDetails);
goodsVerifys.add(BlockCertificateSaveReqVO);
});
}
result.setGoodsVerifys(goodsVerifys);
return result; return result;
} }
@ -412,30 +331,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
reqs.add(blockCertificate);// 商品信息 reqs.add(blockCertificate);// 商品信息
// 这里开始设置商品认证信息
if(createReqVO.getGoodsVerifys() != null && !createReqVO.getGoodsVerifys().isEmpty()) {
Integer chainState = createReqVO.getGoodsVerifys().get(0).getChainState();// 已第一个为准,避免多个认证信息状态不一致的后果
createReqVO.getGoodsVerifys().forEach(gv -> {
// 如果传了商品认证信息, 首先判断该商品是否有认证信息,有了才可以添加, 并且已数据库为准
// 商品认证信息
BlockCertificateCreateReqDTO goodsVerify = new BlockCertificateCreateReqDTO();
goodsVerify.setChainOperateId(CodeEnum.CHAIN_OPERATE_CODE.getCode());
goodsVerify.setOperateType(OperateTypeEnum.GOODS_VERIFY.getType()); // 操作类型: 商品认证信息类型
goodsVerify.setOperateName(OperateTypeEnum.GOODS_VERIFY.getName()); //
goodsVerify.setBatchId(goodsConfig.getHarvestBatchId());
goodsVerify.setBatchType(BatchTypeEnum.HARVEST_BATCH.getType());
goodsVerify.setChainState(chainState); // 上链状态(是否自动上链
goodsVerify.setBelongBusinessId(goodsConfig.getBelongBusinessId());
goodsVerify.setBelongBusinessName(goodsConfig.getBelongBusinessName());
goodsVerify.setLinkName("商品认证");// 这里写死成商品认证
goodsVerify.setOperateObjId(gv.getOperateObjId());
// 设置认证明细
this.setOperateDetails(gv.getOperateDetails(), goodsVerify);
reqs.add(goodsVerify);// 商品认证信息
});
}
return !blockCertificateApi.createBlockCertificateBatch(reqs).isError(); return !blockCertificateApi.createBlockCertificateBatch(reqs).isError();
} }
@ -458,7 +353,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
List<Long> biDetailsIdsDB = biDetailsInDB.stream().map(OperateDetailSaveReqVO::getId).collect(Collectors.toList()); // 数据库中已存在的环节明细商户配置信息id List<Long> biDetailsIdsDB = biDetailsInDB.stream().map(OperateDetailSaveReqVO::getId).collect(Collectors.toList()); // 数据库中已存在的环节明细商户配置信息id
List<Long> biWillUpdateIds = biDetails.stream().map(OperateDetailSaveReqVO::getId).filter(Objects::nonNull).collect(Collectors.toList()); // 页面传过来拥有id的数据 List<Long> biWillUpdateIds = biDetails.stream().map(OperateDetailSaveReqVO::getId).filter(Objects::nonNull).collect(Collectors.toList()); // 页面传过来拥有id的数据
List<Long> deleteCertificateIds = new ArrayList<>();// 需要删除的区块证书id集合
List<OperateDetailSaveReqDTO> createOperateDetails = new ArrayList<>(); List<OperateDetailSaveReqDTO> createOperateDetails = new ArrayList<>();
List<BlockCertificateUpdateReqDTO> updateBlockCertificates = new ArrayList<>(); // 待更新的列表 List<BlockCertificateUpdateReqDTO> updateBlockCertificates = new ArrayList<>(); // 待更新的列表
@ -514,73 +408,15 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
createOperateDetails.add(operateDetail); createOperateDetails.add(operateDetail);
} }
}); });
goodsInfo.setDetails(operateDetailSaves);
updateBlockCertificates.add(goodsInfo);
// 因为是调用通用的方法, getGoodsVerifys()方法获取到的集合可能是给页面初始化用的, 所以这里再拿到第一条记录看id是否存在
if(!goodsConfig.getGoodsVerifys().isEmpty() && goodsConfig.getGoodsVerifys().get(0).getId() != null) {
List<Long> verifyIdsDB = goodsConfig.getGoodsVerifys().stream().map(BlockCertificateSaveReqVO::getId).collect(Collectors.toList());
Map<Long, BlockCertificateSaveReqVO> goodsVerifysMap = new HashMap<>();
goodsConfig.getGoodsVerifys().forEach(goodsVerifys -> goodsVerifysMap.put(goodsVerifys.getId(), goodsVerifys));
// 这里改为不管是否上链都可以修改所有参数
// 只有未上链的才可进行删除, 注:即使是未上链,认证信息一旦添加之后,就无法进行更新,只能做删除操作
if(updateReqVO.getGoodsVerifys().isEmpty()) {
// 此时说明认证信息被全部删除了
deleteCertificateIds.addAll(goodsConfig.getGoodsVerifys().stream().map(BlockCertificateSaveReqVO::getId).collect(Collectors.toList()));
} else {
List<Long> verifyIdsReq = updateReqVO.getGoodsVerifys().stream().map(BlockCertificateSaveReqVO::getId)
.filter(Objects::nonNull).collect(Collectors.toList());
deleteCertificateIds.addAll(verifyIdsDB.stream().filter(v -> !verifyIdsReq.contains(v)).collect(Collectors.toList())); // 找出需要删除的数据id
// 判断是否需要上链操作
if(updateReqVO.getGoodsVerifys().get(0).getChainState().equals(ChainStateEnum.ON_CHAIN.getState())) {
updateReqVO.getGoodsVerifys().forEach(goodsVerify -> {
if(goodsVerify.getId() != null && verifyIdsDB.contains(goodsVerify.getId())) {
BlockCertificateUpdateReqDTO updateReq = new BlockCertificateUpdateReqDTO();
BeanUtil.copyProperties(goodsVerifysMap.get(goodsVerify.getId()), updateReq);
updateReq.setId(goodsVerify.getId());
updateReq.setChainState(ChainStateEnum.ON_CHAIN.getState());
updateBlockCertificates.add(updateReq);
}
});
}
}
// } else {// 已上链
// /*
// 此时只能修改是否扫码展示字段
// */
// updateReqVO.getGoodsVerifys().forEach(goodsVerify -> {
// if(goodsVerify.getId() != null && verifyIdsDB.contains(goodsVerify.getId())) {
// BlockCertificateUpdateReqDTO updateReq = new BlockCertificateUpdateReqDTO();
//
// BeanUtil.copyProperties(goodsVerifysMap.get(goodsVerify.getId()), updateReq);
// updateReq.setScanShow(goodsVerify.getScanShow());
//
// List<OperateDetailSaveReqDTO> operateDetails = new ArrayList<>();
// goodsVerifysMap.get(goodsVerify.getId()).getOperateDetails().forEach(detail -> {
// OperateDetailSaveReqDTO operateDetail = new OperateDetailSaveReqDTO();
// BeanUtil.copyProperties(detail, operateDetail);
// operateDetail.setScanShow(goodsVerify.getScanShow());// 也将明细的扫码展示统一给成主表的
// operateDetails.add(operateDetail);
// });
// updateReq.setDetails(operateDetails);
// updateBlockCertificates.add(updateReq);
// }
// });
// }
}
if(!deleteCertificateIds.isEmpty()) {
blockCertificateApi.deleteBlockCertificateBatch(deleteCertificateIds);
}
goodsInfo.setDetails(operateDetailSaves);
if(!deleteDetailIds.isEmpty()) { if(!deleteDetailIds.isEmpty()) {
operateDetailApi.deleteOperateDetailBatch(deleteDetailIds); operateDetailApi.deleteOperateDetailBatch(deleteDetailIds);
} }
if(!createOperateDetails.isEmpty()) { // 新增明细 if(!createOperateDetails.isEmpty()) { // 新增明细
operateDetailApi.createOperateDetailBatch(createOperateDetails); operateDetailApi.createOperateDetailBatch(createOperateDetails);
} }
if(!updateBlockCertificates.isEmpty()) { if(!updateBlockCertificates.isEmpty()) {
blockCertificateApi.updateBlockCertificateBatch(updateBlockCertificates); blockCertificateApi.updateBlockCertificateBatch(updateBlockCertificates);
} }
@ -1217,7 +1053,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
blockCertificateDTO.setLanguageTypeId(languageTypeId); blockCertificateDTO.setLanguageTypeId(languageTypeId);
List<BlockCertificateRespDTO> respDTOs = blockCertificateApi.getBlockCertificateList(blockCertificateDTO).getData(); List<BlockCertificateRespDTO> respDTOs = blockCertificateApi.getBlockCertificateList(blockCertificateDTO).getData();
List<BlockCertificateSaveReqVO> goodsVerifys = new ArrayList<>();
List<BlockCertificateSaveReqVO> links = new ArrayList<>(); List<BlockCertificateSaveReqVO> links = new ArrayList<>();
List<FarmingPlantReqVO> farmingPlans = new ArrayList<>(); List<FarmingPlantReqVO> farmingPlans = new ArrayList<>();
Map<String, List<BlockCertificateSaveReqVO>> jobMaps = new HashMap<>(); Map<String, List<BlockCertificateSaveReqVO>> jobMaps = new HashMap<>();
@ -1235,11 +1070,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
List<OperateDetailSaveReqVO> details = this.getOperateDetails(respDTO, blockCertificate); List<OperateDetailSaveReqVO> details = this.getOperateDetails(respDTO, blockCertificate);
blockCertificate.setOperateDetails(details); blockCertificate.setOperateDetails(details);
previewResp.setGoodsInfo(blockCertificate); previewResp.setGoodsInfo(blockCertificate);
} else if (respDTO.getOperateType().equals(OperateTypeEnum.GOODS_VERIFY.getType())) {
// 商品认证
List<OperateDetailSaveReqVO> operateDetails = this.getOperateDetails(respDTO, blockCertificate);
blockCertificate.setOperateDetails(operateDetails);
goodsVerifys.add(blockCertificate);
} else if (respDTO.getOperateType().equals(OperateTypeEnum.LINK.getType())) { } else if (respDTO.getOperateType().equals(OperateTypeEnum.LINK.getType())) {
// 环节 // 环节
BeanUtil.copyProperties(respDTO, blockCertificate); BeanUtil.copyProperties(respDTO, blockCertificate);
@ -1268,7 +1098,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
} }
}); });
} }
previewResp.setGoodsVerifys(goodsVerifys);
previewResp.setLinkInfos(links); previewResp.setLinkInfos(links);
farmingPlans.forEach(plan -> { farmingPlans.forEach(plan -> {
List<BlockCertificateSaveReqVO> jobList = new ArrayList<>(); List<BlockCertificateSaveReqVO> jobList = new ArrayList<>();
@ -1416,11 +1245,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
// 获取环境配置 // 获取环境配置
List<EnvTypeDeviceConfigRespVO> envTypeConfigs = envTypeService.getEnvTypeConfigGroupByLandId(harvestBatch.getBelongBusinessId()); List<EnvTypeDeviceConfigRespVO> envTypeConfigs = envTypeService.getEnvTypeConfigGroupByLandId(harvestBatch.getBelongBusinessId());
List<Long> willUpdateVerifyIds = new ArrayList<>();// 将要更新的商品认证id集合
Map<Long, BlockCertificateSaveReqVO> verifyDBMaps = new HashMap<>(); // 数据库中已有的商品认证信息配置
configRespVO.getGoodsVerifys().forEach(verify -> verifyDBMaps.put(verify.getId(), verify));
//******************** 环节相关参数 ********************/ //******************** 环节相关参数 ********************/
Map<Long, List<Long>> linkDetailIdsDBMap = new HashMap<>();// 数据库中已有的操作ID集合, 以map存储 Map<Long, List<Long>> linkDetailIdsDBMap = new HashMap<>();// 数据库中已有的操作ID集合, 以map存储
Map<Long, OperateDetailSaveReqVO> linkDetailDBMap = new HashMap<>(); Map<Long, OperateDetailSaveReqVO> linkDetailDBMap = new HashMap<>();
@ -1658,58 +1482,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
createBlockCertificates.add(goodsInfo); createBlockCertificates.add(goodsInfo);
} }
//********************************* 更新商品认证信息 **************************************//
saveReqVO.getGoodsVerifys().forEach(verify -> {
if(verify.getId() != null) {
// 编辑流程
BlockCertificateSaveReqVO verifyDB = verifyDBMaps.get(verify.getId());
if(verifyDB == null) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_IS_NOT_EXISTS);
}
BlockCertificateUpdateReqDTO goodsVerify = new BlockCertificateUpdateReqDTO();
BeanUtil.copyProperties(verifyDB, goodsVerify);
goodsVerify.setScanShow(verify.getScanShow());
goodsVerify.setSort(verify.getSort() == null ? BigInteger.ZERO.intValue() : verify.getSort());
goodsVerify.setLinkName(verify.getLinkName());
List<Long> willUpdateIds = new ArrayList<>();
this.setOperateDetailsForUpdate(verify, createOperateDetails, willUpdateIds, goodsVerify);
updateBlockCertificates.add(goodsVerify);
// 找出需要删除的操作明细id
deleteOperateDetailIds.addAll(verifyDB.getOperateDetails().stream().map(OperateDetailSaveReqVO::getId)
.filter(id -> !willUpdateIds.contains(id)).collect(Collectors.toList()));
willUpdateVerifyIds.add(verify.getId());
} else {
// 新增流程
BlockCertificateCreateReqDTO goodsVerify = new BlockCertificateCreateReqDTO();
goodsVerify.setChainOperateId(CodeEnum.CHAIN_OPERATE_CODE.getCode());
goodsVerify.setOperateType(OperateTypeEnum.GOODS_VERIFY.getType()); // 操作类型: 商品认证信息类型
goodsVerify.setOperateName(OperateTypeEnum.GOODS_VERIFY.getName()); //
goodsVerify.setBatchId(configRespVO.getHarvestBatchId());
goodsVerify.setBatchType(BatchTypeEnum.HARVEST_BATCH.getType());
goodsVerify.setChainState(ChainStateEnum.NOT_ON_CHAIN.getState()); // 上链状态(是否自动上链
goodsVerify.setBelongBusinessId(configRespVO.getBelongBusinessId());
goodsVerify.setBelongBusinessName(configRespVO.getBelongBusinessName());
goodsVerify.setLinkName(verify.getLinkName());
goodsVerify.setOperateObjId(verify.getOperateObjId());
goodsVerify.setScanShow(verify.getScanShow());
goodsVerify.setSort(verify.getSort() == null ? BigInteger.ZERO.intValue() : verify.getSort());
goodsVerify.setLanguageTypeId(saveReqVO.getLanguageTypeId());
// 设置认证明细
this.setOperateDetails(verify.getOperateDetails(), goodsVerify);
createBlockCertificates.add(goodsVerify);// 商品认证信息
}
});
if(!configRespVO.getGoodsVerifys().isEmpty()) {
deleteCertificateIds.addAll(configRespVO.getGoodsVerifys().stream().map(BlockCertificateSaveReqVO::getId)
.filter(id -> !willUpdateVerifyIds.contains(id)).collect(Collectors.toList()));
}
//********************************* 更新环节信息 **************************************// //********************************* 更新环节信息 **************************************//
if(saveReqVO.getLinkInfos() != null && !saveReqVO.getLinkInfos().isEmpty()) { if(saveReqVO.getLinkInfos() != null && !saveReqVO.getLinkInfos().isEmpty()) {
List<Long> willUpdateLinkIds = new ArrayList<>(); List<Long> willUpdateLinkIds = new ArrayList<>();
@ -1787,118 +1559,6 @@ public class HarvestBatchServiceImpl implements HarvestBatchService {
deleteCertificateIds.addAll(linkIdsDB); deleteCertificateIds.addAll(linkIdsDB);
} }
//********************************* 更新农事作业 **************************************//
// 每次重新选择地块计划之后,旧的都会进行删除操作
// 只要没传id 都当做新增
// if(willUpdatePlanIds.isEmpty()) {
// // 新增
// // 获取种植计划以及种植作业相关数据
// // 这里直接使用页面调用的获取接口, 由于页面无法进行过多的变更,故这里的数据为了保证准确性(不被串改),无法修改的字段直接用该接口的数据, 如果没传,就按默认。
// List<FarmingPlantReqVO> plantDBs = landPlanService.getLandPlanForFarmingConfig(configRespVO.getGoodsId(), planIds, null, BlockStateEnum.ACTIVATION.getBlockState());
// plantDBs.forEach(plantConfig -> {
// BlockCertificateCreateReqDTO createPlant = new BlockCertificateCreateReqDTO();
// BeanUtil.copyProperties(plantConfig, createPlant);
// this.setBlockCertificate(createPlant, OperateTypeEnum.PLAN.getType(), OperateTypeEnum.PLAN.getName(), harvestBatch, plantConfig);
// // createPlant.setRemarks(reqPlanMap.get(plantConfig.getOperateObjId()).getRemarks());// 修改remark字段
// // 循环找到说明字段,并进行修改
// plantConfig.getOperateDetails().forEach(detail -> {
// if(detail.getTitle().equals("说明")) {
// detail.setContent(planRemarksMap.get(plantConfig.getOperateObjId()));
// }
// });
// // 修改是否展示
// createPlant.setScanShow(reqPlanMap.get(plantConfig.getOperateObjId()).getScanShow());
// // 修改环节名称
// createPlant.setLinkName(reqPlanMap.get(plantConfig.getOperateObjId()).getLinkName());
// createPlant.setLanguageTypeId(saveReqVO.getLanguageTypeId());
//
// createBlockCertificates.add(createPlant);
// // 循环农事作业
// plantConfig.getFarmingJobs().forEach(job -> {
// BlockCertificateCreateReqDTO createJob = new BlockCertificateCreateReqDTO();
// BeanUtil.copyProperties(job, createJob);
// Map<String, String> jobItemMap = jobMap.get(job.getOperateType() + "" + job.getOperateObjId());
// // 找到备注字段,并设置值
// job.getOperateDetails().forEach(detail -> {
// if(detail.getTitle().equals("任务类型")) {
// detail.setContent(jobItemMap.get("jobType"));
// }
// if(detail.getTitle().equals("投入品名称")) {
// detail.setContent(jobItemMap.get("inputsName"));
// }
// if(detail.getTitle().equals("作业日期")) {
// detail.setContent(jobItemMap.get("jobDate"));
// }
// if(detail.getTitle().equals("作业员工")) {
// detail.setContent(jobItemMap.get("jobWorker"));
// }
// if(detail.getTitle().equals("说明")) {
// detail.setContent(jobItemMap.get("remarks"));
// }
// });
//
// this.setBlockCertificate(createJob, OperateTypeEnum.JOB.getType(), OperateTypeEnum.JOB.getName(), harvestBatch, job);
// // createJob.setRemarks(reqJobMap.get(job.getOperateObjId()).getRemarks());// 修改remark字段
//
// createJob.setScanShow(reqJobMap.get(job.getOperateType() + "" + job.getOperateObjId()).getScanShow());// 修改扫码展示
// createJob.setParentOperateId(createPlant.getChainOperateId());// 设置该字段与农事计划作绑定
// createJob.setLanguageTypeId(saveReqVO.getLanguageTypeId());
//
// createBlockCertificates.add(createJob);
// });
// });
//
// // 删除所有旧的数据
// configRespVO.getFarmingPlans().forEach(plant -> {
// plant.getFarmingJobs().forEach(job -> deleteCertificateIds.add(job.getId()));
// deleteCertificateIds.add(plant.getId());
// });
// } else {
// // 编辑
// // 此时不会做新增操作
// configRespVO.getFarmingPlans().forEach(plant -> {
// if(willUpdatePlanIds.contains(plant.getId())) {
// // 只更新已存在的,其他无视
// FarmingPlantSaveReqVO plantReq = willUpdatePlanMap.get(plant.getId());
// BlockCertificateUpdateReqDTO updatePlant = new BlockCertificateUpdateReqDTO();
// BeanUtil.copyProperties(plant, updatePlant);
//
// updatePlant.setScanShow(plantReq.getScanShow());
// // updatePlant.setChainState(updateReqVO.getChainState());
// updatePlant.setLinkName(reqPlanMap.get(plant.getOperateObjId()).getLinkName());
// List<OperateDetailSaveReqDTO> details = new ArrayList<>();
// // 找到备注, 更新备注
// this.setPlanRemarks(plant.getOperateDetails(), details, planRemarksMap.get(plant.getOperateObjId()));
// updatePlant.setDetails(details);
//
// plant.getFarmingJobs().forEach(job -> {
// // 页面如果不传
// if(willUpdateJobIds.contains(job.getId())) {
// // 只更新已存在的,其他无视
// BlockCertificateSaveReqVO jobReq = willUpdateJobMap.get(job.getId());
// BlockCertificateUpdateReqDTO updateJob = new BlockCertificateUpdateReqDTO();
// BeanUtil.copyProperties(job, updateJob);
// List<OperateDetailSaveReqDTO> jobDetails = new ArrayList<>();
// // 找到备注, 更新备注
// this.setFarmingRemarks(job.getOperateDetails(), jobDetails, jobMap.get(job.getOperateType() + "" + job.getOperateObjId()));
// updateJob.setDetails(jobDetails);
// updateJob.setScanShow(jobReq.getScanShow());
// updateJob.setChainState(updatePlant.getChainState());
//
// updateBlockCertificates.add(updateJob);
// } else {
// // 如果未上链, 则可进行删除操作( 这里也去掉限制 2023.06.25
// deleteCertificateIds.add(job.getId());
// }
// });
// updateBlockCertificates.add(updatePlant);
// } else {
// deleteCertificateIds.add(plant.getId());
// plant.getFarmingJobs().forEach(job -> deleteCertificateIds.add(job.getId()));
// }
// });
// }
//********************************* 更新检验检疫 **************************************// //********************************* 更新检验检疫 **************************************//
if(saveReqVO.getInspections() != null && !saveReqVO.getInspections().isEmpty()) { if(saveReqVO.getInspections() != null && !saveReqVO.getInspections().isEmpty()) {
List<Long> willUpdateInspectionIds = new ArrayList<>(); List<Long> willUpdateInspectionIds = new ArrayList<>();

Loading…
Cancel
Save