Skip to content

Commit

Permalink
Merge pull request #139 from Jzow/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Jzow authored Oct 29, 2023
2 parents d9d6b4b + 454b4d4 commit ddef1a1
Show file tree
Hide file tree
Showing 32 changed files with 1,276 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public OperatorController(IOperatorService operatorService) {
this.operatorService = operatorService;
}

@PostMapping("list")
public Response<Page<OperatorVO>> getOperatorList(@RequestBody QueryOperatorDTO queryOperatorDTO) {
return operatorService.getOperatorList(queryOperatorDTO);
@PostMapping("pageList")
public Response<Page<OperatorVO>> getOperatorPageList(@RequestBody QueryOperatorDTO queryOperatorDTO) {
return operatorService.getOperatorPageList(queryOperatorDTO);
}

@PostMapping("addOrUpdate")
Expand All @@ -40,4 +40,8 @@ public Response<String> updateOperatorStatus(@RequestParam("ids") List<Long> ids
return operatorService.updateOperatorStatus(ids, status);
}

@GetMapping("list/{type}")
public Response<List<OperatorVO>> getOperatorList(@PathVariable String type) {
return operatorService.getOperatorListByType(type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ public void exportExcel(@RequestParam("type") String type, HttpServletResponse r
public Response<List<String>> uploadOss(@RequestParam("files") List<MultipartFile> files) {
return commonService.uploadOss(files);
}

@GetMapping("nextId/{type}")
public Response<String> nextId(@PathVariable String type) {
return commonService.generateSnowflakeId(type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public FinancialAccountController(IFinancialAccountService accountService) {
this.accountService = accountService;
}

@PostMapping("list")
public Response<Page<AccountVO>> getAccountList(@RequestBody QueryAccountDTO queryAccountDTO) {
return accountService.getAccountList(queryAccountDTO);
@PostMapping("pageList")
public Response<Page<AccountVO>> getAccountPageList(@RequestBody QueryAccountDTO queryAccountDTO) {
return accountService.getAccountPageList(queryAccountDTO);
}

@PostMapping("addOrUpdate")
Expand All @@ -53,4 +53,8 @@ public Response<String> updateAccountStatus(@RequestParam("ids") List<Long> ids,
return accountService.updateAccountStatus(ids, status);
}

@GetMapping("list")
public Response<List<AccountVO>> getAccountList() {
return accountService.getAccountList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ 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")
fun addOrUpdateAdvanceCharge(@RequestBody advanceChargeDTO: AddOrUpdateAdvanceChargeDTO): Response<String> {
return advanceChargeService.addOrUpdateAdvanceCharge(advanceChargeDTO)
}

@PostMapping("getPageList")
@PostMapping("pageList")
fun getAdvanceChargePageList(@RequestBody advanceChargeDTO: QueryAdvanceChargeDTO) : Response<Page<AdvanceChargeVO>> {
return advanceChargeService.getAdvanceChargePageList(advanceChargeDTO)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions core/domain/src/main/kotlin/com/wansenai/bo/FileDataBO.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.wansenai.bo

import com.fasterxml.jackson.annotation.JsonFormat
import com.wansenai.NoArg
import lombok.Data

@Data
@NoArg
data class FileDataBO(

@JsonFormat(shape = JsonFormat.Shape.STRING)
var id: Long? = null,

var uid: String? = null,

var fileName : String,

var fileUrl : String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public interface IOperatorService extends IService<Operator> {

Response<Page<OperatorVO>> getOperatorList(QueryOperatorDTO queryOperatorDTO);
Response<Page<OperatorVO>> getOperatorPageList(QueryOperatorDTO queryOperatorDTO);

Response<String> addOrUpdateOperator(AddOrUpdateOperatorDTO addOrUpdateOperatorDTO);

Expand All @@ -34,5 +34,5 @@ public interface IOperatorService extends IService<Operator> {

Operator getOperatorById(Long id);


Response<List<OperatorVO>> getOperatorListByType(String type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public OperatorServiceImpl(OperatorMapper operatorMapper, BaseService baseServic
}

@Override
public Response<Page<OperatorVO>> getOperatorList(QueryOperatorDTO queryOperatorDTO) {
public Response<Page<OperatorVO>> getOperatorPageList(QueryOperatorDTO queryOperatorDTO) {
var result = new Page<OperatorVO>();
var operatorVOS = new ArrayList<OperatorVO>();

Expand Down Expand Up @@ -139,4 +139,28 @@ public Operator getOperatorById(Long id) {
}
return getById(id);
}

@Override
public Response<List<OperatorVO>> getOperatorListByType(String type) {
if(!StringUtils.hasLength(type)) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}

var operatorVOS = new ArrayList<OperatorVO>();
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public interface CommonService {
File exportExcel(String type);

Response<List<String>> uploadOss(List<MultipartFile> files);

Response<String> generateSnowflakeId(String type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -640,14 +640,50 @@ public Response<List<String>> uploadOss(List<MultipartFile> 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<String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
*/
public interface IFinancialAccountService extends IService<FinancialAccount> {

Response<Page<AccountVO>> getAccountList(QueryAccountDTO queryAccountDTO);
Response<Page<AccountVO>> getAccountPageList(QueryAccountDTO queryAccountDTO);

Response<String> addOrUpdateAccount(AddOrUpdateAccountDTO addOrUpdateAccountDTO);

Response<String> deleteBatchAccount(List<Long> ids);

Response<String> updateAccountStatus(List<Long> ids, Integer status);

Response<List<AccountVO>> getAccountList();
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public FinancialAccountServiceImpl(BaseService baseService, FinancialAccountMapp


@Override
public Response<Page<AccountVO>> getAccountList(QueryAccountDTO queryAccountDTO) {
public Response<Page<AccountVO>> getAccountPageList(QueryAccountDTO queryAccountDTO) {
var result = new Page<AccountVO>();
var accountVos = new ArrayList<AccountVO>();

Expand Down Expand Up @@ -156,4 +156,21 @@ public Response<String> updateAccountStatus(List<Long> ids, Integer status) {

return Response.responseMsg(FinancialCodeEnum.UPDATE_ACCOUNT_STATUS_SUCCESS);
}

@Override
public Response<List<AccountVO>> 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<AccountVO>();
accountList.forEach(item -> {
AccountVO accountVO = new AccountVO();
BeanUtils.copyProperties(item, accountVO);
accountVos.add(accountVO);
});
return Response.responseData(accountVos);
}
}
Loading

0 comments on commit ddef1a1

Please sign in to comment.