diff --git a/core/api/src/main/java/com/wansenai/api/basic/OperatorController.java b/core/api/src/main/java/com/wansenai/api/basic/OperatorController.java index 83cc817e..35e3fed4 100644 --- a/core/api/src/main/java/com/wansenai/api/basic/OperatorController.java +++ b/core/api/src/main/java/com/wansenai/api/basic/OperatorController.java @@ -20,9 +20,9 @@ public OperatorController(IOperatorService operatorService) { this.operatorService = operatorService; } - @PostMapping("list") - public Response> getOperatorList(@RequestBody QueryOperatorDTO queryOperatorDTO) { - return operatorService.getOperatorList(queryOperatorDTO); + @PostMapping("pageList") + public Response> getOperatorPageList(@RequestBody QueryOperatorDTO queryOperatorDTO) { + return operatorService.getOperatorPageList(queryOperatorDTO); } @PostMapping("addOrUpdate") @@ -40,4 +40,8 @@ public Response updateOperatorStatus(@RequestParam("ids") List ids return operatorService.updateOperatorStatus(ids, status); } + @GetMapping("list/{type}") + public Response> getOperatorList(@PathVariable String type) { + return operatorService.getOperatorListByType(type); + } } diff --git a/core/api/src/main/java/com/wansenai/api/common/CommonController.java b/core/api/src/main/java/com/wansenai/api/common/CommonController.java index 9908b2d5..6d4e2273 100644 --- a/core/api/src/main/java/com/wansenai/api/common/CommonController.java +++ b/core/api/src/main/java/com/wansenai/api/common/CommonController.java @@ -74,4 +74,9 @@ public void exportExcel(@RequestParam("type") String type, HttpServletResponse r public Response> uploadOss(@RequestParam("files") List files) { return commonService.uploadOss(files); } + + @GetMapping("nextId/{type}") + public Response nextId(@PathVariable String type) { + return commonService.generateSnowflakeId(type); + } } diff --git a/core/api/src/main/java/com/wansenai/api/financial/FinancialAccountController.java b/core/api/src/main/java/com/wansenai/api/financial/FinancialAccountController.java index 8909d205..27ae84df 100644 --- a/core/api/src/main/java/com/wansenai/api/financial/FinancialAccountController.java +++ b/core/api/src/main/java/com/wansenai/api/financial/FinancialAccountController.java @@ -33,9 +33,9 @@ public FinancialAccountController(IFinancialAccountService accountService) { this.accountService = accountService; } - @PostMapping("list") - public Response> getAccountList(@RequestBody QueryAccountDTO queryAccountDTO) { - return accountService.getAccountList(queryAccountDTO); + @PostMapping("pageList") + public Response> getAccountPageList(@RequestBody QueryAccountDTO queryAccountDTO) { + return accountService.getAccountPageList(queryAccountDTO); } @PostMapping("addOrUpdate") @@ -53,4 +53,8 @@ public Response updateAccountStatus(@RequestParam("ids") List ids, return accountService.updateAccountStatus(ids, status); } + @GetMapping("list") + public Response> getAccountList() { + return accountService.getAccountList(); + } } diff --git a/core/api/src/main/kotlin/com/wansenai/api/financial/AdvanceChargeController.kt b/core/api/src/main/kotlin/com/wansenai/api/financial/AdvanceChargeController.kt index 8230a012..bc0c08d0 100644 --- a/core/api/src/main/kotlin/com/wansenai/api/financial/AdvanceChargeController.kt +++ b/core/api/src/main/kotlin/com/wansenai/api/financial/AdvanceChargeController.kt @@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @RestController -@RequestMapping("/financial/advanceCharge") +@RequestMapping("/financial/advance-charge") class AdvanceChargeController(private val advanceChargeService: AdvanceChargeService) { @PostMapping("addOrUpdate") @@ -37,7 +37,7 @@ class AdvanceChargeController(private val advanceChargeService: AdvanceChargeSer return advanceChargeService.addOrUpdateAdvanceCharge(advanceChargeDTO) } - @PostMapping("getPageList") + @PostMapping("pageList") fun getAdvanceChargePageList(@RequestBody advanceChargeDTO: QueryAdvanceChargeDTO) : Response> { return advanceChargeService.getAdvanceChargePageList(advanceChargeDTO) } diff --git a/core/domain/src/main/java/com/wansenai/entities/system/SysFile.java b/core/domain/src/main/java/com/wansenai/entities/system/SysFile.java index d40c7f02..a898bd9f 100644 --- a/core/domain/src/main/java/com/wansenai/entities/system/SysFile.java +++ b/core/domain/src/main/java/com/wansenai/entities/system/SysFile.java @@ -37,7 +37,7 @@ public class SysFile implements Serializable { @TableId(value = "id", type = IdType.NONE) private Long id; - private String uId; + private String uid; private String fileName; diff --git a/core/domain/src/main/kotlin/com/wansenai/bo/AdvanceChargeDataBO.kt b/core/domain/src/main/kotlin/com/wansenai/bo/AdvanceChargeDataBO.kt index 58224de0..fcaa7147 100644 --- a/core/domain/src/main/kotlin/com/wansenai/bo/AdvanceChargeDataBO.kt +++ b/core/domain/src/main/kotlin/com/wansenai/bo/AdvanceChargeDataBO.kt @@ -12,6 +12,8 @@ */ package com.wansenai.bo +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.wansenai.NoArg import lombok.Data import java.math.BigDecimal @@ -20,10 +22,12 @@ import java.math.BigDecimal @Data data class AdvanceChargeDataBO( + @JsonFormat(shape = JsonFormat.Shape.STRING) val accountId: Long, val accountName: String, + @JsonSerialize(using = BigDecimalSerializerBO::class) val amount : BigDecimal, val remark : String? = null, diff --git a/core/domain/src/main/kotlin/com/wansenai/bo/FileDataBO.kt b/core/domain/src/main/kotlin/com/wansenai/bo/FileDataBO.kt index 7c1a51b0..1ac2d4ad 100644 --- a/core/domain/src/main/kotlin/com/wansenai/bo/FileDataBO.kt +++ b/core/domain/src/main/kotlin/com/wansenai/bo/FileDataBO.kt @@ -1,5 +1,6 @@ package com.wansenai.bo +import com.fasterxml.jackson.annotation.JsonFormat import com.wansenai.NoArg import lombok.Data @@ -7,8 +8,11 @@ import lombok.Data @NoArg data class FileDataBO( + @JsonFormat(shape = JsonFormat.Shape.STRING) var id: Long? = null, + var uid: String? = null, + var fileName : String, var fileUrl : String, diff --git a/core/domain/src/main/kotlin/com/wansenai/vo/financial/AdvanceChargeDetailVO.kt b/core/domain/src/main/kotlin/com/wansenai/vo/financial/AdvanceChargeDetailVO.kt index c6204e74..2914130d 100644 --- a/core/domain/src/main/kotlin/com/wansenai/vo/financial/AdvanceChargeDetailVO.kt +++ b/core/domain/src/main/kotlin/com/wansenai/vo/financial/AdvanceChargeDetailVO.kt @@ -26,6 +26,9 @@ import java.time.LocalDateTime @Data data class AdvanceChargeDetailVO ( + @JsonFormat(shape = JsonFormat.Shape.STRING) + var memberId: Long? = null, + var memberName: String? = null, var receiptNumber: String, @@ -35,6 +38,9 @@ data class AdvanceChargeDetailVO ( var financialPersonnel: String, + @JsonFormat(shape = JsonFormat.Shape.STRING) + var financialPersonnelId: Long? = null, + @JsonSerialize(using = BigDecimalSerializerBO::class) var totalAmount : BigDecimal, diff --git a/core/middleware/src/main/java/com/wansenai/middleware/security/JWTConfig.java b/core/middleware/src/main/java/com/wansenai/middleware/security/JWTConfig.java index 773bf5db..88f6e030 100644 --- a/core/middleware/src/main/java/com/wansenai/middleware/security/JWTConfig.java +++ b/core/middleware/src/main/java/com/wansenai/middleware/security/JWTConfig.java @@ -35,6 +35,7 @@ public void addInterceptors(InterceptorRegistry registry) { .excludePathPatterns("/user/login") .excludePathPatterns("/user/mobileLogin") .excludePathPatterns("/user/updatePassword") - .excludePathPatterns("/v2/common/sms/{type}/{phoneNumber}"); + .excludePathPatterns("/v2/common/sms/{type}/{phoneNumber}") + .excludePathPatterns("/v2/common/nextId/{type}"); } } \ No newline at end of file diff --git a/core/service/src/main/java/com/wansenai/service/basic/IOperatorService.java b/core/service/src/main/java/com/wansenai/service/basic/IOperatorService.java index 334ac213..c575ae67 100644 --- a/core/service/src/main/java/com/wansenai/service/basic/IOperatorService.java +++ b/core/service/src/main/java/com/wansenai/service/basic/IOperatorService.java @@ -24,7 +24,7 @@ public interface IOperatorService extends IService { - Response> getOperatorList(QueryOperatorDTO queryOperatorDTO); + Response> getOperatorPageList(QueryOperatorDTO queryOperatorDTO); Response addOrUpdateOperator(AddOrUpdateOperatorDTO addOrUpdateOperatorDTO); @@ -34,5 +34,5 @@ public interface IOperatorService extends IService { Operator getOperatorById(Long id); - + Response> getOperatorListByType(String type); } diff --git a/core/service/src/main/java/com/wansenai/service/basic/impl/OperatorServiceImpl.java b/core/service/src/main/java/com/wansenai/service/basic/impl/OperatorServiceImpl.java index 735c6b0e..2cd1a727 100644 --- a/core/service/src/main/java/com/wansenai/service/basic/impl/OperatorServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/basic/impl/OperatorServiceImpl.java @@ -48,7 +48,7 @@ public OperatorServiceImpl(OperatorMapper operatorMapper, BaseService baseServic } @Override - public Response> getOperatorList(QueryOperatorDTO queryOperatorDTO) { + public Response> getOperatorPageList(QueryOperatorDTO queryOperatorDTO) { var result = new Page(); var operatorVOS = new ArrayList(); @@ -139,4 +139,28 @@ public Operator getOperatorById(Long id) { } return getById(id); } + + @Override + public Response> getOperatorListByType(String type) { + if(!StringUtils.hasLength(type)) { + return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL); + } + + var operatorVOS = new ArrayList(); + var operator = lambdaQuery() + .eq(Operator::getType, type) + .eq(Operator::getStatus, CommonConstants.STATUS_NORMAL) + .eq(Operator::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); + + if (operator.isEmpty()) { + return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY); + } + operator.forEach(item -> { + OperatorVO operatorVO = new OperatorVO(); + BeanUtils.copyProperties(item, operatorVO); + operatorVOS.add(operatorVO); + }); + return Response.responseData(operatorVOS); + } } diff --git a/core/service/src/main/java/com/wansenai/service/common/CommonService.java b/core/service/src/main/java/com/wansenai/service/common/CommonService.java index 44f3d1c7..5ec45784 100644 --- a/core/service/src/main/java/com/wansenai/service/common/CommonService.java +++ b/core/service/src/main/java/com/wansenai/service/common/CommonService.java @@ -28,4 +28,6 @@ public interface CommonService { File exportExcel(String type); Response> uploadOss(List files); + + Response generateSnowflakeId(String type); } diff --git a/core/service/src/main/java/com/wansenai/service/common/CommonServiceImpl.java b/core/service/src/main/java/com/wansenai/service/common/CommonServiceImpl.java index 0d7694bc..fde8fbfc 100644 --- a/core/service/src/main/java/com/wansenai/service/common/CommonServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/common/CommonServiceImpl.java @@ -640,14 +640,50 @@ public Response> uploadOss(List files) { keys.add("temp" + "_" + SnowflakeIdUtil.nextId() + "_" + file.getOriginalFilename()); }); var result = instance.uploadBatch(FileUtil.convertMultipartFilesToFiles(files), keys); - log.info("上传图片信息: " + result); + log.info("上传文件信息: " + result); return Response.responseData(result); }catch (Exception e) { - log.error("上传图片失败: " + e.getMessage()); + log.error("上传文件失败: " + e.getMessage()); return Response.responseMsg(BaseCodeEnum.FILE_UPLOAD_ERROR); } } + @Override + public Response generateSnowflakeId(String type) { + if (!StringUtils.hasText(type)) { + return Response.responseMsg(BaseCodeEnum.SNOWFLAKE_ID_GENERATE_ERROR); + } + var id = SnowflakeIdUtil.nextId(); + StringBuilder idStr = new StringBuilder(String.valueOf(id)); + var idLength = idStr.length(); + if (idLength < 18) { + var zero = 18 - idLength; + for (int i = 0; i < zero; ++i) { + idStr.insert(0, "0"); + } + } + var idPrefix = switch (type) { + case "供应商" -> "S"; + case "客户" -> "C"; + case "会员" -> "V"; + case "商品" -> "P"; + case "订单" -> "O"; + case "采购单" -> "CGD"; + case "销售单" -> "XSD"; + case "退货单" -> "THD"; + case "入库单" -> "RKD"; + case "出库单" -> "CKD"; + case "调拨单" -> "DBD"; + case "盘点单" -> "PDD"; + case "报损单" -> "BSD"; + case "报溢单" -> "BZD"; + case "调价单" -> "DJD"; + case "收预付款" -> "ACD"; + default -> ""; + }; + return Response.responseData(idPrefix + idStr); + } + private String getCellValue(Cell cell, DataFormatter dataFormatter) { if (cell != null) { String value = dataFormatter.formatCellValue(cell); diff --git a/core/service/src/main/java/com/wansenai/service/financial/IFinancialAccountService.java b/core/service/src/main/java/com/wansenai/service/financial/IFinancialAccountService.java index cfe4db0d..02a7d45b 100644 --- a/core/service/src/main/java/com/wansenai/service/financial/IFinancialAccountService.java +++ b/core/service/src/main/java/com/wansenai/service/financial/IFinancialAccountService.java @@ -29,11 +29,13 @@ */ public interface IFinancialAccountService extends IService { - Response> getAccountList(QueryAccountDTO queryAccountDTO); + Response> getAccountPageList(QueryAccountDTO queryAccountDTO); Response addOrUpdateAccount(AddOrUpdateAccountDTO addOrUpdateAccountDTO); Response deleteBatchAccount(List ids); Response updateAccountStatus(List ids, Integer status); + + Response> getAccountList(); } diff --git a/core/service/src/main/java/com/wansenai/service/financial/impl/FinancialAccountServiceImpl.java b/core/service/src/main/java/com/wansenai/service/financial/impl/FinancialAccountServiceImpl.java index c0dbe0b4..2eb2a928 100644 --- a/core/service/src/main/java/com/wansenai/service/financial/impl/FinancialAccountServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/financial/impl/FinancialAccountServiceImpl.java @@ -49,7 +49,7 @@ public FinancialAccountServiceImpl(BaseService baseService, FinancialAccountMapp @Override - public Response> getAccountList(QueryAccountDTO queryAccountDTO) { + public Response> getAccountPageList(QueryAccountDTO queryAccountDTO) { var result = new Page(); var accountVos = new ArrayList(); @@ -156,4 +156,21 @@ public Response updateAccountStatus(List ids, Integer status) { return Response.responseMsg(FinancialCodeEnum.UPDATE_ACCOUNT_STATUS_SUCCESS); } + + @Override + public Response> getAccountList() { + var accountList = lambdaQuery() + .eq(FinancialAccount::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); + if(accountList.isEmpty()) { + return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY); + } + var accountVos = new ArrayList(); + accountList.forEach(item -> { + AccountVO accountVO = new AccountVO(); + BeanUtils.copyProperties(item, accountVO); + accountVos.add(accountVO); + }); + return Response.responseData(accountVos); + } } diff --git a/core/service/src/main/kotlin/com/wansenai/service/financial/impl/AdvanceChargeServiceImpl.kt b/core/service/src/main/kotlin/com/wansenai/service/financial/impl/AdvanceChargeServiceImpl.kt index 144df60e..64b08e37 100644 --- a/core/service/src/main/kotlin/com/wansenai/service/financial/impl/AdvanceChargeServiceImpl.kt +++ b/core/service/src/main/kotlin/com/wansenai/service/financial/impl/AdvanceChargeServiceImpl.kt @@ -24,6 +24,7 @@ import com.wansenai.dto.financial.AddOrUpdateAdvanceChargeDTO import com.wansenai.dto.financial.QueryAdvanceChargeDTO import com.wansenai.entities.basic.Member import com.wansenai.entities.basic.Operator +import com.wansenai.entities.system.SysFile import com.wansenai.entities.user.SysUser import com.wansenai.mappers.financial.FinancialMainMapper import com.wansenai.mappers.system.SysFileMapper @@ -44,6 +45,7 @@ import com.wansenai.vo.financial.AdvanceChargeVO import lombok.extern.slf4j.Slf4j import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional +import java.time.LocalDateTime @Service @Slf4j @@ -79,6 +81,8 @@ open class AdvanceChargeServiceImpl( ?.let { it.parentId ?: it.id } } + + val fileIdList = ArrayList() if (advanceChargeDTO.id != null) { val financialSubList = financialSubService.lambdaQuery() .eq(FinancialSub::getFinancialMainId, advanceChargeDTO.id) @@ -92,13 +96,36 @@ open class AdvanceChargeServiceImpl( return Response.responseMsg(FinancialCodeEnum.UPDATE_ADVANCE_ERROR) } } - } - // If the id is empty, it is a new addition, otherwise it is a modification - val fileIds = advanceChargeDTO.files?.map { it.id }?.joinToString(",") + // If the id is empty, it is a new addition, otherwise it is a modification + if (advanceChargeDTO.files != null) { + val financialMain = getById(advanceChargeDTO.id) + if (financialMain != null) { + if (!financialMain.fileId.isNullOrEmpty()) { + val ids = financialMain.fileId.split(",").map { it.toLong() } + fileMapper.deleteBatchIds(ids) + } + } + + advanceChargeDTO.files?.map { file -> + val fileId = SnowflakeIdUtil.nextId() + val fileEntity = SysFile.builder() + .id(fileId) + .uid(file.uid) + .fileName(file.fileName) + .fileUrl(file.fileUrl) + .fileType(file.fileType) + .fileSize(file.fileSize) + .build() + fileIdList.add(fileId) + fileMapper.insert(fileEntity) + } + } + } + val fileIds = fileIdList.map { it }.joinToString(",") if (advanceChargeDTO.tableData.isNotEmpty()) { - val financialMainId = SnowflakeIdUtil.nextId() + val financialMainId = advanceChargeDTO.id ?: SnowflakeIdUtil.nextId() val financialMain = FinancialMain.builder() .id(financialMainId) .organizationId(deptId) @@ -111,9 +138,18 @@ open class AdvanceChargeServiceImpl( .receiptSource(0) .receiptTime(TimeUtil.parse(advanceChargeDTO.receiptDate)) .fileId(fileIds) + .status(CommonConstants.UNAUDITED) + .createBy(userId) .remark(advanceChargeDTO.remark) .build() + if (advanceChargeDTO.id == null) { + financialMain.createTime = LocalDateTime.now() + } else { + financialMain.updateBy = userId + financialMain.updateTime = LocalDateTime.now() + } + val isFinancialMainAdded = saveOrUpdate(financialMain) val financialSubList = advanceChargeDTO.tableData.toFinancialSubList(financialMainId) @@ -167,13 +203,13 @@ open class AdvanceChargeServiceImpl( } // Extension function to convert FinancialMain to AdvanceChargeVO - private fun FinancialMain.toAdvanceChargeVO(member: Member?, operator: SysUser, financialPerson: Operator): AdvanceChargeVO { + private fun FinancialMain.toAdvanceChargeVO(member: Member?, operator: SysUser, financialPerson: Operator?): AdvanceChargeVO { return AdvanceChargeVO( id = this.id, receiptNumber = this.receiptNumber, receiptDate = this.receiptTime, operator = operator.name, - financialPersonnel = financialPerson.name, + financialPersonnel = financialPerson?.name ?: "", memberName = member?.memberName, totalAmount = this.totalPrice, collectedAmount = this.changePrice, @@ -196,10 +232,10 @@ open class AdvanceChargeServiceImpl( val financialMain = getById(id) if(financialMain != null) { val member = memberService.getMemberById(financialMain.memberId) - val financialPerson = operatorService.getOperatorById(financialMain.handsPersonId) + val financialPerson = operatorService.getOperatorById(financialMain.handsPersonId) val subData = financialSubService.lambdaQuery() - .eq(FinancialSub::getFinancialMainId, financialPerson.id) + .eq(FinancialSub::getFinancialMainId, id) .list() val tableData = ArrayList() @@ -214,30 +250,35 @@ open class AdvanceChargeServiceImpl( tableData.add(record) } - val ids = financialMain.fileId.split(",").map { it.toLong() } val filesData = ArrayList() - val fileList = fileMapper.selectBatchIds(ids) - fileList.map { file -> - val fileBo = FileDataBO( - id = file.id, - fileName = file.fileName, - fileUrl = file.fileUrl, - fileType = file.fileType, - fileSize = file.fileSize - ) - filesData.add(fileBo) + if(!financialMain.fileId.isNullOrEmpty()) { + val ids = financialMain.fileId.split(",").map { it.toLong() } + val fileList = fileMapper.selectBatchIds(ids) + fileList.map { file -> + val fileBo = FileDataBO( + id = file.id, + fileName = file.fileName, + fileUrl = file.fileUrl, + fileType = file.fileType, + fileSize = file.fileSize + ) + filesData.add(fileBo) + } } val resultVO = AdvanceChargeDetailVO( + memberId = financialMain.memberId, memberName = member?.memberName, receiptNumber = financialMain.receiptNumber, receiptDate = financialMain.receiptTime, - financialPersonnel = financialPerson.name, + financialPersonnel = financialPerson?.name ?: "", + financialPersonnelId = financialPerson?.id, totalAmount = financialMain.totalPrice, collectedAmount = financialMain.changePrice, tableData = tableData, files = filesData - ); + ) + return Response.responseData(resultVO); } return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY) } diff --git a/core/utils/src/main/java/com/wansenai/utils/SnowflakeIdUtil.java b/core/utils/src/main/java/com/wansenai/utils/SnowflakeIdUtil.java index c666bf98..64a64a2a 100644 --- a/core/utils/src/main/java/com/wansenai/utils/SnowflakeIdUtil.java +++ b/core/utils/src/main/java/com/wansenai/utils/SnowflakeIdUtil.java @@ -21,7 +21,7 @@ public class SnowflakeIdUtil { /** * 开始时间截 (2015-01-01) */ - private final static long twepoch = 1420041600000L; + private final static long starTimeCutoff = 1420041600000L; /** * 机器id所占的位数 @@ -36,12 +36,12 @@ public class SnowflakeIdUtil { /** * 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */ - private final static long maxWorkerId = -1L ^ (-1L << workerIdBits); + private final static long maxWorkerId = ~(-1L << workerIdBits); /** * 支持的最大数据标识id,结果是31 */ - private final static long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); + private final static long maxDatacenterId = ~(-1L << datacenterIdBits); /** * 序列在id中占的位数 @@ -66,7 +66,7 @@ public class SnowflakeIdUtil { /** * 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */ - private final static long sequenceMask = -1L ^ (-1L << sequenceBits); + private final static long sequenceMask = ~(-1L << sequenceBits); /** * 工作机器ID(0~31) @@ -103,8 +103,8 @@ public SnowflakeIdUtil(long workerId, long datacenterId) { if (datacenterId > maxDatacenterId || datacenterId < 0) { throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); } - this.workerId = workerId; - this.datacenterId = datacenterId; + SnowflakeIdUtil.workerId = workerId; + SnowflakeIdUtil.datacenterId = datacenterId; } // ==============================Methods========================================== @@ -140,7 +140,7 @@ public synchronized static long nextId() { lastTimestamp = timestamp; //移位并通过或运算拼到一起组成64位的ID - return ((timestamp - twepoch) << timestampLeftShift) + return ((timestamp - starTimeCutoff) << timestampLeftShift) | (datacenterId << datacenterIdShift) | (workerId << workerIdShift) | sequence; @@ -168,20 +168,4 @@ protected static long tilNextMillis(long lastTimestamp) { protected static long timeGen() { return System.currentTimeMillis(); } - - //==============================Test============================================= - - /** - * 测试 - */ - public static void main(String[] args) { - long start = System.currentTimeMillis(); - SnowflakeIdUtil idWorker = new SnowflakeIdUtil(1, 3); - for (int i = 0; i < 50; i++) { - long id = idWorker.nextId(); - System.out.println(id); - } - long end = System.currentTimeMillis(); - System.out.println(end - start); - } } diff --git a/core/utils/src/main/java/com/wansenai/utils/constants/CommonConstants.java b/core/utils/src/main/java/com/wansenai/utils/constants/CommonConstants.java index 4abcde07..a2f38b66 100644 --- a/core/utils/src/main/java/com/wansenai/utils/constants/CommonConstants.java +++ b/core/utils/src/main/java/com/wansenai/utils/constants/CommonConstants.java @@ -30,4 +30,8 @@ public interface CommonConstants { int IS_DEFAULT = 1; int NOT_DEFAULT = 0; + + int UNAUDITED = 0; + + int REVIEWED = 1; } diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/BaseCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/BaseCodeEnum.java index a1006bf2..d5c537f0 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/BaseCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/BaseCodeEnum.java @@ -49,7 +49,9 @@ public enum BaseCodeEnum { OSS_KEY_NOT_EXIST("T0500", "腾讯云OSS对象存储key不存在"), - OSS_GET_INSTANCE_ERROR("T0501", "腾讯云OSS对象存储实例获取失败"); + OSS_GET_INSTANCE_ERROR("T0501", "腾讯云OSS对象存储实例获取失败"), + + SNOWFLAKE_ID_GENERATE_ERROR("B0009", "雪花算法生成ID失败"); /** * 响应状态码 diff --git a/core/utils/src/test/java/SnowflakeIdTest.java b/core/utils/src/test/java/SnowflakeIdTest.java new file mode 100644 index 00000000..6328fca5 --- /dev/null +++ b/core/utils/src/test/java/SnowflakeIdTest.java @@ -0,0 +1,17 @@ +import com.wansenai.utils.SnowflakeIdUtil; +import org.junit.jupiter.api.Test; + +public class SnowflakeIdTest { + + @Test + public void generateId() { + long start = System.currentTimeMillis(); + SnowflakeIdUtil idWorker = new SnowflakeIdUtil(5, 9); + for (int i = 0; i < 50; i++) { + long id = idWorker.nextId(); + System.out.println(id); + } + long end = System.currentTimeMillis(); + System.out.println(end - start); + } +} diff --git a/web/src/api/basic/common.ts b/web/src/api/basic/common.ts index be1a1551..cb981a82 100644 --- a/web/src/api/basic/common.ts +++ b/web/src/api/basic/common.ts @@ -7,6 +7,7 @@ enum Api { UploadXlsx = '/v2/common/upload/excel', ExportXlsx = '/v2/common/export/excel', UploadOss = '/v2/common/uploadOss', + GenerateId = '/v2/common/nextId', } export interface UploadFileParams { @@ -58,4 +59,12 @@ export function uploadOss(params: UploadFileParams, mode: ErrorMessageMode = 'no errorMessageMode: mode, }, ); +} + +export function generateId(type: string) { + return defHttp.get>( + { + url: `${Api.GenerateId}/${type}`, + } + ); } \ No newline at end of file diff --git a/web/src/api/basic/member.ts b/web/src/api/basic/member.ts index eefb9088..ea13e631 100644 --- a/web/src/api/basic/member.ts +++ b/web/src/api/basic/member.ts @@ -61,4 +61,12 @@ export function deleteBatchMember(ids: number[], mode: ErrorMessageMode = 'notic errorMessageMode: mode, }, ); +} + +export function getMemberList() { + return defHttp.get>( + { + url: API.List + } + ); } \ No newline at end of file diff --git a/web/src/api/basic/operator.ts b/web/src/api/basic/operator.ts index 9e7d6216..09ae80d8 100644 --- a/web/src/api/basic/operator.ts +++ b/web/src/api/basic/operator.ts @@ -9,16 +9,17 @@ import { enum API { - List = '/basic/operator/list', + PageList = '/basic/operator/pageList', AddOrUpdateOperator = '/basic/operator/addOrUpdate', DeleteBatch = '/basic/operator/delete', UpdateStatus = '/basic/operator/updateStatus', + List = '/basic/operator/list', } -export function getOperatorList(params: QueryOperatorReq, mode: ErrorMessageMode = 'notice') { +export function getOperatorPageList(params: QueryOperatorReq, mode: ErrorMessageMode = 'notice') { return defHttp.post>( { - url: API.List, + url: API.PageList, params, }, { @@ -60,4 +61,12 @@ export function deleteBatchOperator(ids: number[], mode: ErrorMessageMode = 'not errorMessageMode: mode, }, ); +} + +export function getOperatorList(type: string) { + return defHttp.get>( + { + url: `${API.List}/${type}` + }, + ); } \ No newline at end of file diff --git a/web/src/api/financial/account.ts b/web/src/api/financial/account.ts index a75dd52a..e4558e74 100644 --- a/web/src/api/financial/account.ts +++ b/web/src/api/financial/account.ts @@ -9,16 +9,17 @@ import { enum API { - List = '/financial/account/list', + PageList = '/financial/account/pageList', AddOrUpdateAccount = '/financial/account/addOrUpdate', DeleteBatch = '/financial/account/delete', UpdateStatus = '/financial/account/updateStatus', + List = '/financial/account/list', } -export function getAccountList(params: QueryAccountReq, mode: ErrorMessageMode = 'notice') { +export function getAccountPageList(params: QueryAccountReq, mode: ErrorMessageMode = 'notice') { return defHttp.post>( { - url: API.List, + url: API.PageList, params, }, { @@ -60,4 +61,12 @@ export function deleteBatchAccount(ids: number[], mode: ErrorMessageMode = 'noti errorMessageMode: mode, }, ); +} + +export function getAccountList() { + return defHttp.get>( + { + url: API.List, + } + ); } \ No newline at end of file diff --git a/web/src/api/financial/advance.ts b/web/src/api/financial/advance.ts new file mode 100644 index 00000000..146f7347 --- /dev/null +++ b/web/src/api/financial/advance.ts @@ -0,0 +1,74 @@ +import {defHttp} from '/@/utils/http/axios'; +import { ErrorMessageMode } from '/#/axios'; +import {BaseDataResp, BaseResp} from "@/api/model/baseModel"; +import { + AdvanceChargeResp, + AddOrUpdateAdvanceReq, + QueryAdvanceReq, AdvanceChargeDetailResp, +} from "@/api/financial/model/advanceModel"; + +enum API { + PageList = '/financial/advance-charge/pageList', + AddOrUpdateAccount = '/financial/advance-charge/addOrUpdate', + DeleteBatch = '/financial/advance-charge/deleteByIds', + UpdateStatus = '/financial/advance-charge/updateStatusByIds', + GetDetail = '/financial/advance-charge/getDetailById', +} + +export function getAdvancePageList(params: QueryAdvanceReq, mode: ErrorMessageMode = 'notice') { + return defHttp.post>( + { + url: API.PageList, + params, + }, + { + errorMessageMode: mode, + successMessageMode: mode, + }, + ); +} + +export function addOrUpdateAdvance(params: AddOrUpdateAdvanceReq, mode: ErrorMessageMode = 'notice') { + return defHttp.post( + { + url: API.AddOrUpdateAccount, + params, + }, + { + errorMessageMode: mode, + }, + ); +} + +export function updateAdvanceStatus(ids: number[], status: number, mode: ErrorMessageMode = 'notice') { + return defHttp.post( + { + url: `${API.UpdateStatus}?ids=${ids}&status=${status}` + }, + { + errorMessageMode: mode, + }, + ); +} + +export function deleteBatchAdvance(ids: number[], mode: ErrorMessageMode = 'notice') { + return defHttp.put( + { + url: `${API.DeleteBatch}?ids=${ids}` + }, + { + errorMessageMode: mode, + }, + ); +} + +export function getAdvanceDetail(id: number | string, mode: ErrorMessageMode = 'notice') { + return defHttp.get>( + { + url: `${API.GetDetail}/${id}` + }, + { + errorMessageMode: mode, + }, + ); +} \ No newline at end of file diff --git a/web/src/api/financial/model/advanceModel.ts b/web/src/api/financial/model/advanceModel.ts new file mode 100644 index 00000000..ca497ccf --- /dev/null +++ b/web/src/api/financial/model/advanceModel.ts @@ -0,0 +1,71 @@ +interface FileData { + id: number | string; + fileName: string; + fileUrl: string; + fileType: string; + fileSize: number; +} + +interface AdvanceChargeData { + accountId: number | string; + accountName: string; + amount: number; + remark: string; +} + +interface AddOrUpdateAdvanceReq { + id: number | string | undefined; + memberId: number | string; + receiptDate: string; + receiptNumber: string; + financialPersonnelId: number | string; + totalAmount: number; + collectedAmount: number; + remark: string; + tableData: AdvanceChargeData[]; + fileDataList: FileData[]; +} + +interface QueryAdvanceReq { + receiptNumber: string; + memberId: number | string; + operatorId: number | string; + financialPersonnelId: number | string; + status: number; + remark: string; +} + +interface AdvanceChargeResp { + id: number | string; + memberName: string; + receiptNumber: string; + receiptDate: string; + operator: string; + financialPersonnel: string; + totalAmount: number; + collectedAmount: number; + status: number; + remark: string; +} + +interface AdvanceChargeDetailResp { + memberId: string; + memberName: string; + receiptNumber: string; + receiptDate: string; + financialPersonnel: string; + financialPersonnelId: string; + remark: string; + totalAmount: number; + collectedAmount: number; + tableData: AdvanceChargeData[]; + files: FileData[]; +} + +export { + AdvanceChargeData, + AddOrUpdateAdvanceReq, + QueryAdvanceReq, + AdvanceChargeResp, + AdvanceChargeDetailResp +} \ No newline at end of file diff --git a/web/src/views/basic/operator/index.vue b/web/src/views/basic/operator/index.vue index 120bf2c1..acdf5bec 100644 --- a/web/src/views/basic/operator/index.vue +++ b/web/src/views/basic/operator/index.vue @@ -41,7 +41,7 @@ import {BasicTable, TableAction, useTable} from "@/components/Table"; import {useModal} from "@/components/Modal"; import {useMessage} from "@/hooks/web/useMessage"; import {columns, searchFormSchema} from "@/views/basic/operator/operator.data"; -import {getOperatorList, deleteBatchOperator, updateOperatorStatus} from "@/api/basic/operator"; +import {getOperatorPageList, deleteBatchOperator, updateOperatorStatus} from "@/api/basic/operator"; import OperatorModal from "@/views/basic/operator/components/OperatorModal.vue"; export default defineComponent({ @@ -52,7 +52,7 @@ export default defineComponent({ const { createMessage } = useMessage(); const [registerTable, { reload, getSelectRows }] = useTable({ title: '操作员/经办人列表', - api: getOperatorList, + api: getOperatorPageList, rowKey: 'id', columns: columns, rowSelection: { diff --git a/web/src/views/basic/settlement-account/index.vue b/web/src/views/basic/settlement-account/index.vue index 8347d49f..8282a8e6 100644 --- a/web/src/views/basic/settlement-account/index.vue +++ b/web/src/views/basic/settlement-account/index.vue @@ -46,7 +46,7 @@ import {BasicTable, TableAction, useTable} from "@/components/Table"; import {useModal} from "@/components/Modal"; import {useMessage} from "@/hooks/web/useMessage"; import {columns, searchFormSchema} from "@/views/basic/settlement-account/financialAccount.data"; -import {getAccountList, deleteBatchAccount, updateAccountStatus} from "@/api/financial/account"; +import {getAccountPageList, deleteBatchAccount, updateAccountStatus} from "@/api/financial/account"; import FinancialAccountModal from "@/views/basic/settlement-account/components/FinancialAccountModal.vue"; import { Tag } from 'ant-design-vue'; @@ -58,7 +58,7 @@ export default defineComponent({ const { createMessage } = useMessage(); const [registerTable, { reload, getSelectRows }] = useTable({ title: '结算账户列表', - api: getAccountList, + api: getAccountPageList, rowKey: 'id', columns: columns, rowSelection: { diff --git a/web/src/views/financial/advance-charge/advance.data.ts b/web/src/views/financial/advance-charge/advance.data.ts new file mode 100644 index 00000000..85999356 --- /dev/null +++ b/web/src/views/financial/advance-charge/advance.data.ts @@ -0,0 +1,166 @@ +import {FormSchema} from "@/components/Form"; +import {BasicColumn} from "@/components/Table"; +import {h, reactive, UnwrapRef} from 'vue'; +import {Switch} from "ant-design-vue"; +import {useMessage} from "@/hooks/web/useMessage"; +import {useI18n} from "@/hooks/web/useI18n"; +import dayjs, {Dayjs} from "dayjs"; + +const {t} = useI18n(); + +export const columns: BasicColumn[] = [ + { + title: '付款会员', + dataIndex: 'memberName', + width: 120, + }, + { + title: '单据编号', + dataIndex: 'receiptNumber', + width: 150, + }, + { + title: '单据日期', + dataIndex: 'receiptDate', + width: 150, + }, + { + title: '收款金额', + dataIndex: 'collectedAmount', + width: 90, + }, + { + title: '合计金额', + dataIndex: 'totalAmount', + width: 90, + }, + { + title: '备注', + dataIndex: 'remark', + width: 150, + }, + { + title: '财务人员', + dataIndex: 'financialPersonnel', + width: 80, + }, + { + title: '操作员', + dataIndex: 'operator', + width: 80, + }, + { + title: '状态', + dataIndex: 'createTime', + width: 100, + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '单据编号', + field: 'memberNumber', + component: 'Input', + colProps: { + xl: 8, + xxl: 8, + }, + }, + { + field: '[startDate, endDate]', + label: '单据日期', + component: 'RangePicker', + componentProps: { + format: 'YYYY/MM/DD', + placeholder: ['开始日期', '结束日期'], + }, + colProps: { + xl: 8, + xxl: 8, + }, + }, + { + label: '付款会员', + field: 'phoneNumber', + component: 'Input', + colProps: { + xl: 8, + xxl: 8, + }, + }, + { + label: '单据状态', + field: 'type', + component: 'Select', + colProps: { + xl: 8, + xxl: 8, + }, + componentProps: { + options: [ + {label: '未审核', value: 0, key: 0}, + {label: '已审核', value: 1, key: 1}, + ], + }, + }, + { + label: '单据备注', + field: 'type', + component: 'Input', + colProps: { + xl: 8, + xxl: 8, + }, + } +] + +export const formSchema: FormSchema[] = [] + +export const tableColumns = [ + { + title: '账户名称', + key: 'accountId', + width: '25%', + placeholder: '请选择${title}', + options: [], + allowSearch: true, + validateRules: [{required: true, message: '${title}不能为空'}], + }, + { + title: '金额', + key: 'amount', + width: '20%', + statistics: true, + placeholder: '请选择${title}', + validateRules: [{required: true, message: '${title}不能为空'}] + }, + { + title: '备注', + key: 'remark', + width: '50%', + placeholder: '请选择${title}' + } +] + +interface FormState { + id: string; + memberId: string; + receiptNumber: string; + financialPersonnelId: string; + receiptDate: string | undefined | Dayjs; + remark: string; + totalAmount: number; + collectedAmount: number; +} + +export const formState: UnwrapRef = reactive({ + id: '', + memberId: '', + receiptNumber: '', + financialPersonnelId: '', + receiptDate: undefined, + remark: '', + totalAmount: 0, + collectedAmount: 0, + +}); \ No newline at end of file diff --git a/web/src/views/financial/advance-charge/components/AdvanceChargeModal.vue b/web/src/views/financial/advance-charge/components/AdvanceChargeModal.vue new file mode 100644 index 00000000..d7201890 --- /dev/null +++ b/web/src/views/financial/advance-charge/components/AdvanceChargeModal.vue @@ -0,0 +1,552 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/financial/advance-charge/index.vue b/web/src/views/financial/advance-charge/index.vue new file mode 100644 index 00000000..20459b07 --- /dev/null +++ b/web/src/views/financial/advance-charge/index.vue @@ -0,0 +1,149 @@ + +
+
+ + \ No newline at end of file diff --git a/web/src/views/product/info/components/ProductInfoModal.vue b/web/src/views/product/info/components/ProductInfoModal.vue index 22f4120a..38679c98 100644 --- a/web/src/views/product/info/components/ProductInfoModal.vue +++ b/web/src/views/product/info/components/ProductInfoModal.vue @@ -786,7 +786,6 @@ export default defineComponent({ meTable.dataSource.forEach(row => { edit(row.key); }); - console.info(meTable.dataSource) } if (data.stockList) { stock.dataSource = []; @@ -1160,9 +1159,6 @@ export default defineComponent({ return; } - console.info(editableData) - console.info(editStockData) - const imageList: AddProductImageReq[] = []; if (fileList && fileList.value) { for (let i = 0; i < fileList.value.length; i++) {