From 5a8349b85349ba93bff38ebdfac8eb58b127c0f2 Mon Sep 17 00:00:00 2001 From: Agoni <791536664@qq.com> Date: Thu, 17 Aug 2023 22:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/util/date/DateUtils.java | 2 +- .../vo/QuotationSheetCreateReqVO.java | 4 +- .../vo/SupplierCompanyBaseVO.java | 12 +++-- .../vo/SupplierCompanyExcelVO.java | 3 +- .../suppliercompany/SupplierCompanyDO.java | 4 ++ .../QuotationSheetServiceImpl.java | 5 ++ .../SupplierCompanyServiceImpl.java | 52 ++++++------------- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java index 86adc1cd..c921d6a6 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java @@ -27,7 +27,7 @@ public class DateUtils { public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; public static final String FORMAT_HOUR_MINUTE_SECOND = "HH:mm:ss"; - public static final String FORMAT_HOUR_MINUT = "HHmmss"; + public static final String FORMAT_HOUR_MINUT = "yyyyMMdd"; /** * 将 LocalDateTime 转换成 Date diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java index d5291f74..d422650b 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java @@ -10,5 +10,7 @@ import javax.validation.constraints.*; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class QuotationSheetCreateReqVO extends QuotationSheetBaseVO { - + @Schema(description = "物料id集合", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "物料id集合不能为空") + private List suppliesIdList; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyBaseVO.java index fec01a42..cba329c1 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyBaseVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyBaseVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.suppliercompany.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -74,7 +75,7 @@ public class SupplierCompanyBaseVO { private String bankOfDeposit; @Schema(description = "是否注册", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "是否注册不能为空") +// @NotNull(message = "是否注册不能为空") private Byte isRegister; @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @@ -84,7 +85,12 @@ public class SupplierCompanyBaseVO { @Schema(description = "备注", example = "随便") private String remark; - @Schema(description = "附件") - private String files; + @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) + private List files; + + /** + * 关联账号id + */ + private Long correlationUserId; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyExcelVO.java index 04c84e83..543f8864 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyExcelVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/suppliercompany/vo/SupplierCompanyExcelVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.suppliercompany.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -70,7 +71,7 @@ public class SupplierCompanyExcelVO { private String remark; @ExcelProperty("附件") - private String files; + private List files; @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java index bf871a3b..80723f63 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java @@ -95,6 +95,10 @@ public class SupplierCompanyDO extends BaseDO { * 备注 */ private String remark; + /** + * 关联账号id + */ + private Long correlationUserId; /** * 附件 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java index 422185d5..fc6c4df9 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.service.quotationsheet; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -31,6 +32,10 @@ public class QuotationSheetServiceImpl implements QuotationSheetService { public Long createQuotationSheet(QuotationSheetCreateReqVO createReqVO) { // 插入 QuotationSheetDO quotationSheet = QuotationSheetConvert.INSTANCE.convert(createReqVO); + if (null != createReqVO.getSuppliesIdList()){ + quotationSheet.setMaterialIdList(createReqVO.getSuppliesIdList().toString()); + } +// SecurityFrameworkUtils.getLoginUser(). quotationSheetMapper.insert(quotationSheet); // 返回 return quotationSheet.getId(); diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java index ecf522e3..04dbf733 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java @@ -7,6 +7,9 @@ import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import cn.iocoder.yudao.module.bs.controller.admin.suppliercompany.vo.*; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -37,6 +40,7 @@ public class SupplierCompanyServiceImpl implements SupplierCompanyService { String companyNumber = numberCreate(); supplierCompany.setCompanyNumber(companyNumber); supplierCompanyMapper.insert(supplierCompany); + // 返回 return supplierCompany.getId(); } @@ -91,44 +95,22 @@ public class SupplierCompanyServiceImpl implements SupplierCompanyService { long currentTime = System.currentTimeMillis(); Date date = new Date(currentTime); String companyNumber="gys"+ DateUtils.dateToStr(DateUtils.FORMAT_HOUR_MINUT,date); - Long companyNumberSize = supplierCompanyMapper.selectCount(new QueryWrapper().likeLeft("company_number", companyNumber)); - Long l = companyNumberSize + 1L; - int length = String.valueOf(companyNumberSize + 1L).length(); - if ((4-length) !=0){ - String gys = fillStr("", (4-length), true, "0"); - companyNumber=companyNumber+gys+l.intValue(); + SupplierCompanyDO supplierCompanyDO = supplierCompanyMapper.selectOne(new QueryWrapper().like("company_number", companyNumber).orderByDesc("create_time").last("limit 1")); + if (null!=supplierCompanyDO){ + Long aLong = numKun(supplierCompanyDO.getCompanyNumber()); + companyNumber ="gys"+(aLong+1); }else { - companyNumber=companyNumber+l; + companyNumber=companyNumber+"0000"; + long l = numKun(companyNumber) + 1; + companyNumber ="gys"+(numKun(companyNumber) + 1); } return companyNumber; } - - private String fillStr(String value, int count, boolean frontORback, String fillChar) { - String rtvalue = value; - if (rtvalue == null) { - rtvalue = ""; - for (int i = 0; i < count; i++) - if (frontORback) - rtvalue = String.valueOf(rtvalue) - + String.valueOf(fillChar); - else - rtvalue = String.valueOf(fillChar) - + String.valueOf(rtvalue); - } else { - int len = rtvalue.length(); - if (len > count) { - rtvalue = rtvalue.substring(0, count); - } else { - int a = count - len; - for (int i = 0; i < a; i++) - if (frontORback) - rtvalue = String.valueOf(rtvalue) - + String.valueOf(fillChar); - else - rtvalue = String.valueOf(fillChar) - + String.valueOf(rtvalue); - } - } - return rtvalue; + public Long numKun(String a){ + String regEx = "[^0-9]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(a); + String result = m.replaceAll("").trim(); + return Long.valueOf(result); } }