Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-api-cloud
This commit is contained in:
commit
68abae25e8
16 files changed
+694
-24
No files matched your search
+95
@@ -0,0 +1,95 @@
|
||||
package com.bsd.pjcloud.canteen.dto.erp;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(description = "出入库记录修改对象")
|
||||
public class CanteenInventoryRecordEditDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description="主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 单据编号(规则生成,出入库编号)
|
||||
*/
|
||||
@Schema(description="单据编号(规则生成,出入库编号)")
|
||||
private String inventoryCode;
|
||||
|
||||
/**
|
||||
* 单据日期
|
||||
*/
|
||||
@Schema(description="单据日期")
|
||||
private LocalDate inventoryDate;
|
||||
|
||||
/**
|
||||
* 单据类型(字典inventory_type)采购入库、采购退货、盘点入库等
|
||||
*/
|
||||
@Schema(description="单据类型(字典inventory_type)采购入库、采购退货、盘点入库等")
|
||||
private String inventoryType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 经办人id
|
||||
*/
|
||||
@Schema(description="经办人id")
|
||||
private Long handlerUserId;
|
||||
|
||||
|
||||
/**
|
||||
* 商户编号
|
||||
*/
|
||||
@Schema(description="商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
/**
|
||||
* 货商
|
||||
*/
|
||||
@Schema(description="货商")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 订单类型(1入库 2出库)
|
||||
*/
|
||||
@Schema(description="订单类型(1入库 2出库)")
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 入库总金额
|
||||
*/
|
||||
@Schema(description="入库总金额")
|
||||
private Integer totalAmount;
|
||||
|
||||
|
||||
@Schema(description="收货数量")
|
||||
private Integer receiveAmount;
|
||||
|
||||
|
||||
/**
|
||||
* @Link SmCgPlanEditItemDTO
|
||||
*/
|
||||
@Schema(description="item")
|
||||
private List<CanteenInventoryRecordEditItemDTO> items;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.bsd.pjcloud.canteen.dto.erp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(description = "出入库记录编辑-item")
|
||||
public class CanteenInventoryRecordEditItemDTO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
|
||||
@Schema(description="id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 单据类型(字典inventory_type)
|
||||
*/
|
||||
@Schema(description="单据类型(字典inventory_type)")
|
||||
private String inventoryType;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@Schema(description="原料id")
|
||||
private Long erpMaterialId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 出入库数量
|
||||
*/
|
||||
@Schema(description="出入库数量")
|
||||
private Double quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@Schema(description="单价")
|
||||
private Integer unitPrice;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
@Schema(description="总金额")
|
||||
private Integer totalAmount;
|
||||
|
||||
/**
|
||||
* 税率%
|
||||
*/
|
||||
@Schema(description="税率%")
|
||||
private Integer taxRate;
|
||||
|
||||
/**
|
||||
* 税前金额
|
||||
*/
|
||||
@Schema(description="税前金额")
|
||||
private Integer taxAmount;
|
||||
|
||||
/**
|
||||
* 货商
|
||||
*/
|
||||
@Schema(description="货商")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 订单类型(1入库 2出库)
|
||||
*/
|
||||
@Schema(description="订单类型(1入库 2出库)")
|
||||
private String orderType;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+3
@@ -67,4 +67,7 @@ public class CanteenProductionRecordPageVO {
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description="食材名称")
|
||||
private String productName;
|
||||
}
|
||||
@@ -20,12 +20,6 @@
|
||||
<version>1.3.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 分布式发号器-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sequence</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<!-- 分布式任务-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
@@ -82,6 +76,11 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!-- 分布式发号器-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sequence</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 依赖api模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.canteen.config;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bsd.pjcloud.common.sequence.range.BizName;
|
||||
|
||||
public class PjcloudBizName implements BizName {
|
||||
/**
|
||||
* 生成名称
|
||||
*/
|
||||
@Override
|
||||
public String create() {
|
||||
return DateUtil.today();
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.canteen.config;
|
||||
|
||||
import com.bsd.pjcloud.common.sequence.builder.DbSeqBuilder;
|
||||
import com.bsd.pjcloud.common.sequence.sequence.Sequence;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置发号器生成规则
|
||||
*/
|
||||
@Configuration
|
||||
public class SequenceConfig {
|
||||
|
||||
@Bean
|
||||
public Sequence sequence(DataSource dataSource) {
|
||||
return DbSeqBuilder
|
||||
.create()
|
||||
.bizName(new PjcloudBizName())// 定义切片规则
|
||||
.dataSource(dataSource) // 注入数据源
|
||||
.step(1000) // 每次获取数据的个数
|
||||
.retryTimes(3) // 重试次数
|
||||
.tableName("pjcloud_sequence") // 存储表名信息
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordEditDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsdDTO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
@@ -83,15 +84,15 @@ public class CanteenInventoryRecordsController {
|
||||
|
||||
/**
|
||||
* 修改采购记录表
|
||||
* @param canteenInventoryRecords 采购记录表
|
||||
* @param canteenInventoryRecordEditDTO 采购记录表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改采购记录表" , description = "修改采购记录表" )
|
||||
@SysLog("修改采购记录表" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_edit')" )
|
||||
public R updateById(@RequestBody CanteenInventoryRecordsEntity canteenInventoryRecords) {
|
||||
return R.ok(canteenInventoryRecordsService.updateById(canteenInventoryRecords));
|
||||
public R updateById(@RequestBody CanteenInventoryRecordEditDTO canteenInventoryRecordEditDTO) {
|
||||
return R.ok(canteenInventoryRecordsService.updateByCanteenInventoryRecordEditDTO(canteenInventoryRecordEditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.bsd.pjcloud.canteen.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSupplierService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 货商信息
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-05-09 13:18:19
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/canteenSupplier" )
|
||||
@Tag(description = "canteenSupplier" , name = "货商信息管理" )
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class CanteenSupplierController {
|
||||
|
||||
private final CanteenSupplierService canteenSupplierService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param canteenSupplier 货商信息
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_view')" )
|
||||
public R getCanteenSupplierPage(@ParameterObject Page page, @ParameterObject CanteenSupplierEntity canteenSupplier) {
|
||||
LambdaQueryWrapper<CanteenSupplierEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenSupplier.getSupplierName()),CanteenSupplierEntity::getSupplierName,canteenSupplier.getSupplierName());
|
||||
wrapper.eq(StrUtil.isNotBlank(canteenSupplier.getPhone()),CanteenSupplierEntity::getPhone,canteenSupplier.getPhone());
|
||||
return R.ok(canteenSupplierService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询货商信息
|
||||
* @param supplierId id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{supplierId}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_view')" )
|
||||
public R getById(@PathVariable("supplierId" ) Long supplierId) {
|
||||
return R.ok(canteenSupplierService.getById(supplierId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增货商信息
|
||||
* @param canteenSupplier 货商信息
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增货商信息" , description = "新增货商信息" )
|
||||
@SysLog("新增货商信息" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_add')" )
|
||||
public R save(@RequestBody CanteenSupplierEntity canteenSupplier) {
|
||||
return R.ok(canteenSupplierService.save(canteenSupplier));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改货商信息
|
||||
* @param canteenSupplier 货商信息
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改货商信息" , description = "修改货商信息" )
|
||||
@SysLog("修改货商信息" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_edit')" )
|
||||
public R updateById(@RequestBody CanteenSupplierEntity canteenSupplier) {
|
||||
return R.ok(canteenSupplierService.updateById(canteenSupplier));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除货商信息
|
||||
* @param ids supplierId列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除货商信息" , description = "通过id删除货商信息" )
|
||||
@SysLog("通过id删除货商信息" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(canteenSupplierService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param canteenSupplier 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSupplier_export')" )
|
||||
public List<CanteenSupplierEntity> export(CanteenSupplierEntity canteenSupplier,Long[] ids) {
|
||||
return canteenSupplierService.list(Wrappers.lambdaQuery(canteenSupplier).in(ArrayUtil.isNotEmpty(ids), CanteenSupplierEntity::getSupplierId, ids));
|
||||
}
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package com.bsd.pjcloud.canteen.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 货商信息
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-05-09 13:18:19
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("canteen_supplier")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "货商信息")
|
||||
public class CanteenSupplierEntity extends Model<CanteenSupplierEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 货商ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="货商ID")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 货商名称
|
||||
*/
|
||||
@Schema(description="货商名称")
|
||||
private String supplierName;
|
||||
|
||||
/**
|
||||
* 货商地址
|
||||
*/
|
||||
@Schema(description="货商地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
@Schema(description="电话号码")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 税号
|
||||
*/
|
||||
@Schema(description="税号")
|
||||
private String tax;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@Schema(description="联系人")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 开户行账号
|
||||
*/
|
||||
@Schema(description="开户行账号")
|
||||
private String openAccount;
|
||||
|
||||
/**
|
||||
* 邮箱地址
|
||||
*/
|
||||
@Schema(description="邮箱地址")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 所属部门ID
|
||||
*/
|
||||
@Schema(description="所属部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 货商类别
|
||||
*/
|
||||
@Schema(description="货商类别")
|
||||
private Long supplierType;
|
||||
|
||||
/**
|
||||
* 货商地区
|
||||
*/
|
||||
@Schema(description="货商地区")
|
||||
private String supplierArea;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description="修改时间")
|
||||
private LocalDateTime passwordModifyTime;
|
||||
|
||||
/**
|
||||
* 开户行
|
||||
*/
|
||||
@Schema(description="开户行")
|
||||
private String openName;
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
*/
|
||||
@Schema(description="合同号")
|
||||
private String contractNumber;
|
||||
|
||||
/**
|
||||
* 状态 0使用 1禁用
|
||||
*/
|
||||
@Schema(description="状态 0使用 1禁用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 拼音简码
|
||||
*/
|
||||
@Schema(description="拼音简码")
|
||||
private String pinyinCod;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记,0未删除,1已删除
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记,0未删除,1已删除")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 所属租户ID
|
||||
*/
|
||||
@Schema(description="所属租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.canteen.mapper;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CanteenSupplierMapper extends PjcloudBaseMapper<CanteenSupplierEntity> {
|
||||
|
||||
|
||||
}
|
||||
+9
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordEditDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsdDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
|
||||
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
|
||||
@@ -24,4 +25,12 @@ public interface CanteenInventoryRecordsService extends IService<CanteenInventor
|
||||
* @return
|
||||
*/
|
||||
Page<CanteenProductionRecordPageVO> pageScope(Page page, CanteenInventoryRecordsEntity canteenInventoryRecords);
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param canteenInventoryRecordEditDTO
|
||||
* @return
|
||||
*/
|
||||
Object updateByCanteenInventoryRecordEditDTO(CanteenInventoryRecordEditDTO canteenInventoryRecordEditDTO);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
|
||||
|
||||
public interface CanteenSupplierService extends IService<CanteenSupplierEntity> {
|
||||
|
||||
}
|
||||
+84
-3
@@ -1,11 +1,10 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.constant.OrderTypeEnum;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsItemDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.CanteenInventoryRecordsdDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.UpdateStockDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.*;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsItemMapper;
|
||||
@@ -26,6 +25,8 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 采购记录表
|
||||
@@ -91,4 +92,84 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
|
||||
return baseMapper.selectPageDataByScope(page,canteenInventoryRecords, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object updateByCanteenInventoryRecordEditDTO(CanteenInventoryRecordEditDTO canteenInventoryRecordEditDTO) {
|
||||
CanteenInventoryRecordsEntity smErpInventoryRecordsEntity = BeanUtils.toBean(canteenInventoryRecordEditDTO, CanteenInventoryRecordsEntity.class);
|
||||
int i = baseMapper.updateById(smErpInventoryRecordsEntity);
|
||||
List<CanteenInventoryRecordEditItemDTO> items = canteenInventoryRecordEditDTO.getItems();
|
||||
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
List<CanteenInventoryRecordsItemEntity> CanteenInventoryRecordsItemEntityList = new ArrayList<>();
|
||||
|
||||
for (CanteenInventoryRecordEditItemDTO item : items){
|
||||
CanteenInventoryRecordsItemEntity CanteenInventoryRecordsItemEntity = new CanteenInventoryRecordsItemEntity();
|
||||
org.springframework.beans.BeanUtils.copyProperties(item,CanteenInventoryRecordsItemEntity);
|
||||
//库存更新对象
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(item.getErpMaterialId());
|
||||
Double quantity = item.getQuantity();
|
||||
String orderType = item.getOrderType();
|
||||
CanteenInventoryRecordsItemEntity.setOrderType(orderType);
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(-quantity);
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
CanteenInventoryRecordsItemEntityList.add(CanteenInventoryRecordsItemEntity);
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<CanteenInventoryRecordsItemEntity> insertItems = CanteenInventoryRecordsItemEntityList.stream().
|
||||
filter(CanteenInventoryRecordsItemEntity -> CanteenInventoryRecordsItemEntity.getId() == null).collect(Collectors.toList());
|
||||
List<CanteenInventoryRecordsItemEntity> updateItems = CanteenInventoryRecordsItemEntityList.stream().
|
||||
filter(CanteenInventoryRecordsItemEntity -> CanteenInventoryRecordsItemEntity.getId() != null).collect(Collectors.toList());
|
||||
|
||||
|
||||
//更新的话,查询之前保存了哪些item,然后去库存表删掉从新计算库存
|
||||
List<CanteenInventoryRecordsItemEntity> dataBaseCanteenInventoryRecordsItemEntityList = canteenInventoryRecordsItemMapper
|
||||
.selectList(new LambdaQueryWrapper<CanteenInventoryRecordsItemEntity>().eq(CanteenInventoryRecordsItemEntity::getInventoryId, canteenInventoryRecordEditDTO.getId()));
|
||||
|
||||
//这部分是数据库原本添加的库存数据,需要全部减掉,重新添加更新的库存数据进去
|
||||
dataBaseCanteenInventoryRecordsItemEntityList.forEach(item -> {
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(item.getErpMaterialId());
|
||||
updateStockDTO.setIncrCount(-item.getQuantity());
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
});
|
||||
|
||||
|
||||
canteenInventoryRecordsItemMapper.updateById(updateItems);
|
||||
canteenInventoryRecordsItemMapper.insert(insertItems);
|
||||
|
||||
List<Long> existingCodeIds = canteenInventoryRecordsItemMapper.selectList(
|
||||
new LambdaQueryWrapper<CanteenInventoryRecordsItemEntity>()
|
||||
.eq(CanteenInventoryRecordsItemEntity::getInventoryId, smErpInventoryRecordsEntity.getId())
|
||||
).stream().map(CanteenInventoryRecordsItemEntity::getId).collect(Collectors.toList());
|
||||
|
||||
// 收集本次提交的ID(排除新增的)
|
||||
List<Long> submittedCodeIds = updateItems.stream()
|
||||
.map(CanteenInventoryRecordsItemEntity::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 计算需要删除的ID
|
||||
List<Long> toDeleteCodeIds = existingCodeIds.stream()
|
||||
.filter(id -> !submittedCodeIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 批量删除失效
|
||||
if (!toDeleteCodeIds.isEmpty()) {
|
||||
canteenInventoryRecordsItemMapper.deleteByIds(toDeleteCodeIds);
|
||||
}
|
||||
//更新库存
|
||||
if (!CollectionUtils.isEmpty(updateStockDTOS)){
|
||||
canteenStockService.updateStock(updateStockDTOS);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenSupplierMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSupplierService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 货商信息
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-05-09 13:18:19
|
||||
*/
|
||||
@Service
|
||||
public class CanteenSupplierServiceImpl extends ServiceImpl<CanteenSupplierMapper, CanteenSupplierEntity> implements CanteenSupplierService {
|
||||
}
|
||||
+15
-12
@@ -31,19 +31,22 @@
|
||||
</resultMap>
|
||||
<select id="selectPageDataByScope"
|
||||
resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO">
|
||||
select
|
||||
cpr.id,
|
||||
cpr.production_time as productionTime,
|
||||
cpr.handler_user as handlerUser,
|
||||
cpr.record_id as recordId,
|
||||
cpr.record_code as recordCode,
|
||||
cpr.remark,
|
||||
cpr.create_by as createBy,
|
||||
cpr.create_time as createTime
|
||||
from canteen_production_record cpr
|
||||
where 1=1
|
||||
SELECT r.inventory_code,r.inventory_date, COALESCE(GROUP_CONCAT(m.name ORDER BY m.name SEPARATOR ','), '') AS product_name,r.remark,r.total_amount,s.supplier_name FROM `canteen_inventory_records` r
|
||||
LEFT JOIN canteen_inventory_records_item i
|
||||
on r.id=i.inventory_id
|
||||
LEFT JOIN canteen_erp_material m
|
||||
on i.erp_material_id=m.id
|
||||
LEFT JOIN canteen_supplier s
|
||||
on i.supplier_id=s.supplier_id
|
||||
<where>
|
||||
r.del_flag = '0'
|
||||
<if test="canteenInventoryRecords.inventoryCode != null and canteenInventoryRecords.inventoryCode != ''">
|
||||
and r.inventory_code = #{canteenInventoryRecords.inventoryCode}
|
||||
</if>
|
||||
<if test="inventoryDate != null and inventoryDate != ''">
|
||||
and cpr.production_time = #{inventoryDate}
|
||||
and cpr.production_time = #{inventoryDate}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.canteen.mapper.CanteenSupplierMapper">
|
||||
|
||||
<resultMap id="canteenSupplierMap" type="com.bsd.pjcloud.canteen.entity.CanteenSupplierEntity">
|
||||
<id property="supplierId" column="supplier_id"/>
|
||||
<result property="supplierName" column="supplier_name"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="tax" column="tax"/>
|
||||
<result property="linkName" column="link_name"/>
|
||||
<result property="openAccount" column="open_account"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="supplierType" column="supplier_type"/>
|
||||
<result property="supplierArea" column="supplier_area"/>
|
||||
<result property="passwordModifyTime" column="password_modify_time"/>
|
||||
<result property="openName" column="open_name"/>
|
||||
<result property="contractNumber" column="contract_number"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="pinyinCod" column="pinyin_cod"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user