From e90dbdbb7c9b589aca9ff4f4c7a08da34827bb23 Mon Sep 17 00:00:00 2001 From: zhenggl Date: Thu, 14 Sep 2023 15:27:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=BA=94=E6=94=B6=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=82=AE=E7=AE=B1,=E9=99=90=E5=88=B6=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/entity/ReceivablesDetailEntity.java | 18 +++- .../ReceivablesInitialCreateEAIService.java | 84 ++++++++++++++----- doc/sql/app-20230912-ddl.sql | 3 + 3 files changed, 81 insertions(+), 24 deletions(-) diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java index 77c467f..a116ee9 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java @@ -121,14 +121,28 @@ public class ReceivablesDetailEntity extends BaseMgrEntity skuList = Arrays.asList( + new ReceivablesDetailEntity("24080Y100231","曲股组件(右)","仅前端钻接头孔"), + new ReceivablesDetailEntity("24070Y100230","直股组件(右)","仅前端钻接头孔"), + new ReceivablesDetailEntity("24100Y400023","可动心轨辙叉组件(右)","20992mm;无砟道床"), + new ReceivablesDetailEntity("220500100187","导轨","60kg/m,16193mm(两端均钻接头孔)"), + new ReceivablesDetailEntity("2111H0320001","60AT1-75单头锻压件(右轨)","U75V,在线淬火轨"), + new ReceivablesDetailEntity("24020Z100018","曲基本轨-组装(左)","60kg/m,(600+16792+600)mm"), + new ReceivablesDetailEntity("22040Y200001","曲线尖轨(右)","60AT1,21450mm"), + new ReceivablesDetailEntity("10940000124","手动扳道器-库改","60AT1,21450mm"), + new ReceivablesDetailEntity("3011040Y5014","60kg/m钢轨18号可动心轨单开道岔(右)","60-18"), + new ReceivablesDetailEntity("3011010Y1037","60kg/m钢轨9号单开道岔(右)","60-9(详见:营销2022261号-排20220800083号;顺坡垫板设置2处)(试车线、#64)"), + new ReceivablesDetailEntity("230300100008","胶接轨","60kg/m,20913(7809+8+13096)mm"), + new ReceivablesDetailEntity("220600200004","侧向护轨","50kg/m,4800mm"), + new ReceivablesDetailEntity("241200100015","叉心组件","直股后加长1800mm,不钻接头孔;曲股不加长,钻接头孔"), + new ReceivablesDetailEntity("2112H0610001","60AT1-模锻翼轨单头锻压件(左轨)","U71Mn,在线淬火轨"), + new ReceivablesDetailEntity("230109100004","序号9活动心轨(焊接轨件)","60kg/m+60AT1,15020(10737+4283)mm"), + new ReceivablesDetailEntity("221700200001","左侧尖轨","50AT1,6450mm(按图纸要求钻孔)") + ); + @Override public DWEAIResult execute(Map headers, String messageBody) throws Exception { + //生成6个随机且不重复的随机整数 + Random random = new Random(); + HashSet set = new HashSet<>(); + int count = 0; + while (count < 6) { + int num = random.nextInt(27); + if (!set.contains(num)) { + set.add(num); + count++; + } + } + List indexList = new ArrayList<>(set); + //客户名称随机生成 + String[] abcArray = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; + + + Date date = new Date(); + Date date1 = org.apache.commons.lang.time.DateUtils.addDays(date, -1); + Date date2 = org.apache.commons.lang.time.DateUtils.addDays(date, -7); //随机赋值list List list = Arrays.asList( - new ReceivablesDetailEntity("鼎捷A半导体有限公司","dj001","张三","186****9498"), - new ReceivablesDetailEntity("鼎捷B半导体有限公司","dj002","李四","158****4794"), - new ReceivablesDetailEntity("鼎捷C半导体有限公司","dj003","王五","150****9529"), - new ReceivablesDetailEntity("鼎新A半导体有限公司","dj004","赵六","139****0530"), - new ReceivablesDetailEntity("鼎新B半导体有限公司","dj005","陈七","136****5333"), - new ReceivablesDetailEntity("鼎新C半导体有限公司","dj006","刘八","188****9299"), - new ReceivablesDetailEntity("鼎华A半导体有限公司","dj007","韩九","130****3555"), - new ReceivablesDetailEntity("鼎华B半导体有限公司","dj008","管十一","138****9999"), - new ReceivablesDetailEntity("鼎华C半导体有限公司","dj009","谢十二","187****6160")); + new ReceivablesDetailEntity("鼎捷"+abcArray[indexList.get(0)]+"半导体有限公司",abcArray[indexList.get(0)]+indexList.get(0),"张三","186****9498",new BigDecimal("10000"),new BigDecimal("135"),new BigDecimal("1350000"),new BigDecimal("20000000"),date), + new ReceivablesDetailEntity("鼎捷"+abcArray[indexList.get(0)]+"半导体有限公司",abcArray[indexList.get(0)]+indexList.get(0),"李四","158****4794",new BigDecimal("800"),new BigDecimal("2500"),new BigDecimal("2000000"),new BigDecimal("20000000"),date1), + new ReceivablesDetailEntity("鼎捷"+abcArray[indexList.get(0)]+"半导体有限公司",abcArray[indexList.get(0)]+indexList.get(0),"王五","150****9529",new BigDecimal("50000"),new BigDecimal("70"),new BigDecimal("3500000"),new BigDecimal("20000000"),date2), + new ReceivablesDetailEntity("鼎新"+abcArray[indexList.get(1)]+"半导体有限公司",abcArray[indexList.get(1)]+indexList.get(1),"赵六","139****0530",new BigDecimal("250000"),new BigDecimal("26"),new BigDecimal("6500000"),new BigDecimal("20000000"),date1), + new ReceivablesDetailEntity("鼎新"+abcArray[indexList.get(1)]+"半导体有限公司",abcArray[indexList.get(1)]+indexList.get(1),"陈七","136****5333",new BigDecimal("2500"),new BigDecimal("3400"),new BigDecimal("8500000"),new BigDecimal("20000000"),date2), + new ReceivablesDetailEntity("鼎新"+abcArray[indexList.get(2)]+"半导体有限公司",abcArray[indexList.get(2)]+indexList.get(2),"刘八","188****9299",new BigDecimal("10000"),new BigDecimal("20"),new BigDecimal("200000"),new BigDecimal("5000000"),date1), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(2)]+"半导体有限公司",abcArray[indexList.get(2)]+indexList.get(2),"韩九","130****3555",new BigDecimal("360"),new BigDecimal("5000"),new BigDecimal("1800000"),new BigDecimal("5000000"),date2), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(3)]+"半导体有限公司",abcArray[indexList.get(3)]+indexList.get(3),"管十一","138****9999",new BigDecimal("2500"),new BigDecimal("800"),new BigDecimal("2000000"),new BigDecimal("10000000"),date1), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(3)]+"半导体有限公司",abcArray[indexList.get(3)]+indexList.get(3),"丁十三","187****6160",new BigDecimal("30000"),new BigDecimal("100"),new BigDecimal("3000000"),new BigDecimal("10000000"),date2), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(4)]+"半导体有限公司",abcArray[indexList.get(4)]+indexList.get(4),"包十四","187****6160",new BigDecimal("400"),new BigDecimal("10000"),new BigDecimal("4000000"),new BigDecimal("15000000"),date1), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(4)]+"半导体有限公司",abcArray[indexList.get(4)]+indexList.get(4),"董十五","187****6160",new BigDecimal("100"),new BigDecimal("80000"),new BigDecimal("8000000"),new BigDecimal("15000000"),date2), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(5)]+"半导体有限公司",abcArray[indexList.get(5)]+indexList.get(5),"肖十六","187****6160",new BigDecimal("3500"),new BigDecimal("200"),new BigDecimal("7000000"),new BigDecimal("10000000"),date1), + new ReceivablesDetailEntity("鼎华"+abcArray[indexList.get(5)]+"半导体有限公司",abcArray[indexList.get(5)]+indexList.get(5),"肖十六","187****6160",new BigDecimal("4000"),new BigDecimal("250"),new BigDecimal("1000000"),new BigDecimal("10000000"),date2)); Long tenantSid = SecurityUtil.getUserProfile().getTenantSid(); @@ -81,29 +124,26 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { } - Random random = new Random(); - List integerList = Arrays.asList(0,-1,-7); + //随机新增 for (ReceivablesDetailEntity receivablesDetailEntity : list) { - int randomNumber = random.nextInt(100)+1; - int nextInt = random.nextInt(30)+1; - int dateInt = random.nextInt(3); - //int dayInt = random.nextInt(10)+1; + int i = random.nextInt(16); + ReceivablesDetailEntity sku = skuList.get(i); + receivablesDetailEntity.setSkuCode(sku.getSkuCode()); + receivablesDetailEntity.setSkuName(sku.getSkuName()); + receivablesDetailEntity.setSkuSpec(sku.getSkuSpec()); receivablesDetailEntity.setReceivableNo("RE-"+DateUtils.currentTimeString()); receivablesDetailEntity.setReceivableNo("SEQ-"+DateUtils.currentTimeString()); receivablesDetailEntity.setStatus("1"); receivablesDetailEntity.setSalesOrder("SO-"+DateUtils.currentTimeString()); receivablesDetailEntity.setSalesOrderNumber("SON-"+DateUtils.currentTimeString()); - receivablesDetailEntity.setPriceTax(new BigDecimal(String.valueOf(randomNumber))); - receivablesDetailEntity.setQuantity(new BigDecimal(String.valueOf(nextInt))); - receivablesDetailEntity.setAmountTax(receivablesDetailEntity.getPriceTax().multiply(receivablesDetailEntity.getQuantity())); - receivablesDetailEntity.setReceivableDate(org.apache.commons.lang.time.DateUtils.addDays(new Date(),integerList.get(dateInt))); - receivablesDetailEntity.setSalesmanAssistant("qcsupplierqcuser001"); - receivablesDetailEntity.setSalesmanBoss("Sp0001"); + receivablesDetailEntity.setSalesmanAssistant("Sp0001"); + receivablesDetailEntity.setSalesmanBoss("qcsupplierqcuser001"); receivablesDetailEntity.setSalesman("qcuser001"); receivablesDetailEntity.setProduceBoss("Sp0002"); + receivablesDetailEntity.setEmail("ath_Sp0001@163.com"); receivablesDetailEntity.setWorkNo("work-"+DateUtils.currentTimeString()); - receivablesDetailEntity.setOverdueDays(String.valueOf(DateUtils.getDayInterval(new Date(),receivablesDetailEntity.getReceivableDate()))); + receivablesDetailEntity.setOverdueDays(String.valueOf((new Date().getTime()-receivablesDetailEntity.getReceivableDate().getTime())/86400000L)); } receivablesDetailService.saveBatch(list); diff --git a/doc/sql/app-20230912-ddl.sql b/doc/sql/app-20230912-ddl.sql index dc608de..2413d0f 100644 --- a/doc/sql/app-20230912-ddl.sql +++ b/doc/sql/app-20230912-ddl.sql @@ -128,3 +128,6 @@ alter table cim_receivables_detail Add column produce_boss varchar(100) null def --修改问题明细跟处理详情字段类型 ALTER TABLE `cim_chat_file` MODIFY COLUMN `question` text, MODIFY COLUMN `complete_explain` text; + +--应收表增加邮箱,限制金额字段 +alter table cim_receivables_detail Add column email varchar(50) null default '' COMMENT '邮箱',Add column limit_amount decimal(15,3) DEFAULT NULL COMMENT '限制金额';