This commit is contained in:
liuyaxin 2026-06-17 15:26:16 +08:00
parent 48075b431c
commit 2a5312a4d8
10 changed files with 702 additions and 0 deletions

View File

@ -0,0 +1,61 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 单据号码实体类
*
* @author Chill
*/
@Data
@TableName("zc_bill_code")
@EqualsAndHashCode(callSuper = true)
public class BillCode extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 单据号
*/
@Schema(description = "单据号")
private String billCode;
/**
* 单据类型
*/
@Schema(description = "单据类型")
private String billType;
}

View File

@ -0,0 +1,176 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* 年度招采计划物料明细实体类
*
* @author Chill
*/
@Data
@TableName("zc_procurement_plan_material")
@EqualsAndHashCode(callSuper = true)
public class ProcurementPlanMaterial extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "主表ID")
private Long planId;
/**
* 项目明细ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "项目明细ID")
private Long projectId;
/**
* 序号
*/
@Schema(description = "序号")
private Integer sortNo;
/**
* 物料名称
*/
@Schema(description = "物料名称")
private String materialName;
/**
* 物料编码
*/
@Schema(description = "物料编码")
private String materialCode;
/**
* 规格型号
*/
@Schema(description = "规格型号")
private String specification;
/**
* 品牌
*/
@Schema(description = "品牌")
private String brand;
/**
* 计量单位
*/
@Schema(description = "计量单位")
private String unit;
/**
* 参考价
*/
@Schema(description = "参考价")
private BigDecimal referencePrice;
/**
* 预计数量
*/
@Schema(description = "预计数量")
private Integer quantity;
/**
* 预估金额
*/
@Schema(description = "预估金额(元)")
private BigDecimal estimatedAmount;
/**
* 对接人
*/
@Schema(description = "对接人")
private String contactPerson;
/**
* 对接人ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "对接人ID")
private Long contactPersonId;
/**
* 计划申请日期
*/
@Schema(description = "计划申请日期")
private LocalDate applyDate;
/**
* 期望使用/完成日期
*/
@Schema(description = "期望使用/完成日期")
private LocalDate expectDate;
/**
* 去年总量
*/
@Schema(description = "去年总量")
private Integer lastYearTotal;
/**
* 去年均价
*/
@Schema(description = "去年均价")
private BigDecimal lastYearAvgPrice;
/**
* 去年总金额
*/
@Schema(description = "去年总金额")
private BigDecimal lastYearTotalAmount;
/**
* 需求简介
*/
@Schema(description = "需求简介")
private String requirementIntro;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,77 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.pojo.entity.Dept;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 当前登录用户部门公司查询控制器
*
* @author Chill
*/
@NonDS
@RestController
@RequestMapping("current-user")
@AllArgsConstructor
@PreAuth(menu = "procurement-plan")
@Tag(name = "当前用户信息", description = "当前登录用户部门公司查询接口")
public class UserDeptController extends BladeController {
private final ISysClient sysClient;
/**
* 获取当前登录用户所属公司
*/
@GetMapping("/company")
@ApiOperationSupport(order = 1)
@Operation(summary = "获取当前登录用户所属公司", description = "根据当前登录用户部门ID向上查找dept_category=1的公司")
public R<Dept> getCurrentUserCompany() {
return sysClient.getCurrentUserCompany();
}
/**
* 获取当前登录用户所属部门
*/
@GetMapping("/dept")
@ApiOperationSupport(order = 2)
@Operation(summary = "获取当前登录用户所属部门", description = "根据当前登录用户部门ID查找dept_category=2的部门")
public R<Dept> getCurrentUserDept() {
return sysClient.getCurrentUserDept();
}
}

View File

@ -0,0 +1,38 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.zhaocai.pojo.entity.BillCode;
/**
* 单据号码 Mapper 接口
*
* @author Chill
*/
public interface BillCodeMapper extends BaseMapper<BillCode> {
}

View File

@ -0,0 +1,56 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.zhaocai.pojo.entity.ProcurementPlanMaterial;
import java.util.List;
/**
* 年度招采计划物料明细 Mapper 接口
*
* @author Chill
*/
public interface ProcurementPlanMaterialMapper extends BaseMapper<ProcurementPlanMaterial> {
/**
* 根据项目明细ID查询物料明细列表
*
* @param projectId 项目明细ID
* @return 物料明细列表
*/
List<ProcurementPlanMaterial> selectByProjectId(Long projectId);
/**
* 根据主表ID删除物料明细
*
* @param planId 主表ID
* @return 影响行数
*/
int deleteByPlanId(Long planId);
}

View File

@ -0,0 +1,58 @@
<?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="org.springblade.zhaocai.mapper.ProcurementPlanMaterialMapper">
<!-- 通用查询映射结果 -->
<resultMap id="procurementPlanMaterialResultMap" type="org.springblade.zhaocai.pojo.entity.ProcurementPlanMaterial">
<result column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="plan_id" property="planId"/>
<result column="project_id" property="projectId"/>
<result column="sort_no" property="sortNo"/>
<result column="material_name" property="materialName"/>
<result column="material_code" property="materialCode"/>
<result column="specification" property="specification"/>
<result column="brand" property="brand"/>
<result column="unit" property="unit"/>
<result column="reference_price" property="referencePrice"/>
<result column="quantity" property="quantity"/>
<result column="estimated_amount" property="estimatedAmount"/>
<result column="contact_person" property="contactPerson"/>
<result column="contact_person_id" property="contactPersonId"/>
<result column="apply_date" property="applyDate"/>
<result column="expect_date" property="expectDate"/>
<result column="last_year_total" property="lastYearTotal"/>
<result column="last_year_avg_price" property="lastYearAvgPrice"/>
<result column="last_year_total_amount" property="lastYearTotalAmount"/>
<result column="requirement_intro" property="requirementIntro"/>
<result column="remark" property="remark"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="baseColumnList">
select
id, tenant_id, create_user, create_time, update_user, update_time, status, is_deleted,
plan_id, project_id, sort_no, material_name, material_code, specification, brand, unit,
reference_price, quantity, estimated_amount, contact_person, contact_person_id, apply_date,
expect_date, last_year_total, last_year_avg_price, last_year_total_amount, requirement_intro, remark
</sql>
<select id="selectByProjectId" resultMap="procurementPlanMaterialResultMap">
<include refid="baseColumnList"/>
from zc_procurement_plan_material
where project_id = #{projectId}
and is_deleted = 0
order by sort_no asc
</select>
<delete id="deleteByPlanId">
delete from zc_procurement_plan_material where plan_id = #{planId}
</delete>
</mapper>

View File

@ -0,0 +1,46 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.zhaocai.pojo.entity.BillCode;
/**
* 单据号码服务类
*
* @author Chill
*/
public interface IBillCodeService extends IService<BillCode> {
/**
* 生成唯一单据号
*
* @param billType 单据类型
* @return 单据号
*/
String generateBillCode(String billType);
}

View File

@ -0,0 +1,56 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.zhaocai.pojo.entity.ProcurementPlanMaterial;
import java.util.List;
/**
* 年度招采计划物料明细服务类
*
* @author Chill
*/
public interface IProcurementPlanMaterialService extends IService<ProcurementPlanMaterial> {
/**
* 根据项目明细ID查询物料明细列表
*
* @param projectId 项目明细ID
* @return 物料明细列表
*/
List<ProcurementPlanMaterial> listByProjectId(Long projectId);
/**
* 根据主表ID删除物料明细
*
* @param planId 主表ID
* @return 是否成功
*/
boolean removeByPlanId(Long planId);
}

View File

@ -0,0 +1,79 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.zhaocai.mapper.BillCodeMapper;
import org.springblade.zhaocai.pojo.entity.BillCode;
import org.springblade.zhaocai.service.IBillCodeService;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ThreadLocalRandom;
/**
* 单据号码服务实现类
*
* @author Chill
*/
@Service
public class BillCodeServiceImpl extends ServiceImpl<BillCodeMapper, BillCode> implements IBillCodeService {
/**
* 最大重试次数
*/
private static final int MAX_RETRY = 10;
/**
* 单据号前缀
*/
private static final String BILL_NO_PREFIX = "NDZC";
@Override
public String generateBillCode(String billType) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
for (int i = 0; i < MAX_RETRY; i++) {
String dateStr = dateFormat.format(new Date());
String randomStr = String.format("%03d", ThreadLocalRandom.current().nextInt(0, 1000));
String candidate = BILL_NO_PREFIX + dateStr + randomStr;
if (baseMapper.selectCount(Wrappers.<BillCode>lambdaQuery()
.eq(BillCode::getBillCode, candidate)) == 0) {
BillCode billCode = new BillCode();
billCode.setBillCode(candidate);
billCode.setBillType(billType);
billCode.setCreateTime(DateUtil.now());
baseMapper.insert(billCode);
return candidate;
}
}
throw new ServiceException("单据号生成失败,请重试");
}
}

View File

@ -0,0 +1,55 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.zhaocai.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.zhaocai.mapper.ProcurementPlanMaterialMapper;
import org.springblade.zhaocai.pojo.entity.ProcurementPlanMaterial;
import org.springblade.zhaocai.service.IProcurementPlanMaterialService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 年度招采计划物料明细服务实现类
*
* @author Chill
*/
@Service
public class ProcurementPlanMaterialServiceImpl extends ServiceImpl<ProcurementPlanMaterialMapper, ProcurementPlanMaterial> implements IProcurementPlanMaterialService {
@Override
public List<ProcurementPlanMaterial> listByProjectId(Long projectId) {
return baseMapper.selectByProjectId(projectId);
}
@Override
public boolean removeByPlanId(Long planId) {
return baseMapper.deleteByPlanId(planId) >= 0;
}
}