This commit is contained in:
2025-12-29 16:33:58 +08:00
parent 28737e848b
commit dc8644f6be
17 changed files with 445 additions and 33 deletions

View File

@ -0,0 +1,50 @@
package com.xjrsoft.module.sales.client;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.sales.entity.LngCustomer;
import com.xjrsoft.module.sales.service.ICustomerService;
import lombok.AllArgsConstructor;
/**
* @author: yjw
* @since: 2025/3/5
*/
//@Api(hidden = true)
@RestController
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/customer")
@AllArgsConstructor
public class CustomerClientImpl implements ICustomerClient {
private final ICustomerService customerService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngCustomer> list = customerService.list();
return list.stream().collect(Collectors.toMap(LngCustomer::getCuCode,LngCustomer::getCuName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById")
@Override
public String getTranById(@RequestParam("id")String code) {
LngCustomer cu = customerService.getByCode(code);
return cu!=null?cu.getCuName():null;
}
}

View File

@ -0,0 +1,50 @@
package com.xjrsoft.module.sales.client;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.sales.entity.LngGradeSystem;
import com.xjrsoft.module.sales.service.IGradeSystemService;
import lombok.AllArgsConstructor;
/**
* @author: yjw
* @since: 2025/3/5
*/
//@Api(hidden = true)
@RestController
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/gradeSystem")
@AllArgsConstructor
public class GradeSystemClientImpl implements IGradeSystemClient {
private final IGradeSystemService gradeSystemService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngGradeSystem> list = gradeSystemService.list();
return list.stream().collect(Collectors.toMap(e -> String.valueOf(e.getId()),LngGradeSystem::getGsName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById")
@Override
public String getTranById(@RequestParam("id")String code) {
LngGradeSystem gs = gradeSystemService.getById(code);
return gs!=null?gs.getGsName():null;
}
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -15,10 +16,16 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.xjrsoft.common.advice.tran.CustomerDataProvider;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.sales.dto.LngCustomerPageDto;
@ -55,6 +62,8 @@ public class CustomerController {
private final ICodeRuleClient codeRuleClient;
private final String CUSTOMER_CODE = "customerCode";
private final CustomerDataProvider tranProvider;
@GetMapping(value = "/page")
@ApiOperation(value="LngCustomer列表(分页)")
@ -101,9 +110,27 @@ public class CustomerController {
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
dto.setCuCode("C"+code);
UpdateLngCustomerDto obj = dataService.insert(dto);
codeRuleClient.useEncode(CUSTOMER_CODE);
return R.ok(obj);
//UpdateLngCustomerDto obj = dataService.insert(dto);
//return R.ok(obj);
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
@Override
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
return content.getObj();
}
@Override
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
codeRuleClient.useEncode(CUSTOMER_CODE);
UpdateLngCustomerDto obj =content.getObj();
tranProvider.saveData(obj.getCuCode(), obj.getCuName());
return obj;
}
}));
}
@ -112,7 +139,25 @@ public class CustomerController {
@SaCheckPermission("customer:edit")
public R update(@Valid @RequestBody UpdateLngCustomerDto dto){
return R.ok(dataService.updateById(dto));
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngCustomerDto>() {
@Override
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
return null;
}
@Override
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
UpdateLngCustomerDto obj =content.getObj();
tranProvider.saveData(obj.getCuCode(), obj.getCuName());
return obj;
}
}));
}
@DeleteMapping

View File

@ -21,19 +21,15 @@ import com.pictc.utils.StringUtils;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.sales.dto.LngScorePageDto;
import com.xjrsoft.module.sales.dto.UpdateLngCustomerGroupDto;
import com.xjrsoft.module.sales.dto.UpdateLngScoreDto;
import com.xjrsoft.module.sales.entity.LngScore;
import com.xjrsoft.module.sales.service.IScoreCustomerService;
import com.xjrsoft.module.sales.vo.LngScorePageVo;
import com.xjrsoft.module.sales.vo.LngScoreVo;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api;

View File

@ -1,21 +1,35 @@
package com.xjrsoft.module.sales.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import java.util.List;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.CollectionUtils;
import com.xjrsoft.common.advice.tran.GradeSystemDataProvider;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.vo.LngBStationLngVo;
import com.xjrsoft.module.sales.dto.LngGradeSystemPageDto;
import com.xjrsoft.module.sales.dto.UpdateLngGradeSystemDto;
import com.xjrsoft.module.sales.entity.LngGradeSystem;
@ -23,13 +37,13 @@ import com.xjrsoft.module.sales.service.IGradeSystemService;
import com.xjrsoft.module.sales.vo.LngGradeSystemPageVo;
import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
import com.xjrsoft.module.system.client.ICodeRuleClient;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @title: 评价体系
@ -48,6 +62,8 @@ public class GradeSystemController {
private final DatalogService dataService;
private final ICodeRuleClient codeRuleClient;
private final String GS_CODE = "gsCode";
private final GradeSystemDataProvider tranProvider;
@GetMapping(value = "/page")
@ApiOperation(value="LngGradeSystem列表(分页)")
@ -92,16 +108,54 @@ public class GradeSystemController {
public R add(@Valid @RequestBody UpdateLngGradeSystemDto dto){
String code = codeRuleClient.genEncode(GS_CODE);
dto.setGsCode(code);
UpdateLngGradeSystemDto res = dataService.insert(dto);
codeRuleClient.useEncode(GS_CODE);
UpdateLngGradeSystemDto res = dataService.insert(dto,new DataOperationListener<UpdateLngGradeSystemDto>() {
@Override
public UpdateLngGradeSystemDto before(DataOperationContent<UpdateLngGradeSystemDto> content) {
return content.getObj();
}
@Override
public UpdateLngGradeSystemDto after(DataOperationContent<UpdateLngGradeSystemDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
codeRuleClient.useEncode(GS_CODE);
UpdateLngGradeSystemDto obj =content.getObj();
tranProvider.saveData(obj.getId().toString(), obj.getGsName());
return obj;
}
});
return R.ok(res.getId());
}
@PutMapping
@ApiOperation(value = "修改LngGradeSystem")
@SaCheckPermission("gradeSystem:edit")
public R update(@Valid @RequestBody UpdateLngGradeSystemDto dto){
return R.ok(dataService.updateById(dto));
//return R.ok(dataService.updateById(dto));
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngGradeSystemDto>() {
@Override
public UpdateLngGradeSystemDto before(DataOperationContent<UpdateLngGradeSystemDto> content) {
return null;
}
@Override
public UpdateLngGradeSystemDto after(DataOperationContent<UpdateLngGradeSystemDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
UpdateLngGradeSystemDto obj =content.getObj();
tranProvider.saveData(obj.getId().toString(), obj.getGsName());
return obj;
}
}));
}
@DeleteMapping

View File

@ -27,4 +27,6 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
LngCustomerVo getCustomerById(Long id);
LngCustomer getByCode(String code);
}

View File

@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.sales.entity.LngCustomer;
@ -82,4 +83,11 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
vo.setLngFileUploadList(fileList);
return vo;
}
@Override
public LngCustomer getByCode(String code) {
LambdaQueryWrapper<LngCustomer> queryWrapper = new LambdaQueryWrapper<LngCustomer>();
queryWrapper.eq(LngCustomer::getCuCode,code);
return baseMapper.selectOne(queryWrapper);
}
}

View File

@ -0,0 +1,50 @@
package com.xjrsoft.module.supplier.client;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.service.ISupplierService;
import lombok.AllArgsConstructor;
/**
* @author: yjw
* @since: 2025/3/5
*/
//@Api(hidden = true)
@RestController
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.SUPPLIER_MODULE_PREFIX + "/tran/supplier")
@AllArgsConstructor
public class SupplierClientImpl implements ISupplierClient {
private final ISupplierService supplierService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngSupplier> list = supplierService.list();
return list.stream().collect(Collectors.toMap(LngSupplier::getSuCode,LngSupplier::getSuName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById")
@Override
public String getTranById(@RequestParam("id")String code) {
LngSupplier su = supplierService.getByCode(code);
return su!=null?su.getSuName():null;
}
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -15,10 +16,17 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.xjrsoft.common.advice.tran.CustomerDataProvider;
import com.xjrsoft.common.advice.tran.SupplierDataProvider;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.supplier.dto.LngSupplierPageDto;
@ -54,6 +62,8 @@ public class SupplierController {
private final ICodeRuleClient codeRuleClient;
private final String SUPPLIER_CODE = "supplierCode";
private final SupplierDataProvider tranProvider;
@GetMapping(value = "/page")
@ApiOperation(value="LngSupplier列表(分页)")
@ -98,16 +108,53 @@ public class SupplierController {
public R add(@Valid @RequestBody UpdateLngSupplierDto dto){
String code = codeRuleClient.genEncode(SUPPLIER_CODE);
dto.setSuCode("S"+code);
UpdateLngSupplierDto res = dataService.insert(dto);
codeRuleClient.useEncode(SUPPLIER_CODE);
return R.ok(res);
//UpdateLngSupplierDto res = dataService.insert(dto);
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngSupplierDto>() {
@Override
public UpdateLngSupplierDto before(DataOperationContent<UpdateLngSupplierDto> content) {
return content.getObj();
}
@Override
public UpdateLngSupplierDto after(DataOperationContent<UpdateLngSupplierDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
codeRuleClient.useEncode(SUPPLIER_CODE);
UpdateLngSupplierDto obj =content.getObj();
tranProvider.saveData(obj.getSuCode(), obj.getSuName());
return obj;
}
}));
}
@PutMapping
@ApiOperation(value = "修改LngSupplier")
@SaCheckPermission("supplier:edit")
public R update(@Valid @RequestBody UpdateLngSupplierDto dto){
return R.ok(dataService.updateById(dto));
//return R.ok(dataService.updateById(dto));
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngSupplierDto>() {
@Override
public UpdateLngSupplierDto before(DataOperationContent<UpdateLngSupplierDto> content) {
return null;
}
@Override
public UpdateLngSupplierDto after(DataOperationContent<UpdateLngSupplierDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
UpdateLngSupplierDto obj =content.getObj();
tranProvider.saveData(obj.getSuCode(), obj.getSuName());
return obj;
}
}));
}
@DeleteMapping

View File

@ -31,4 +31,6 @@ public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepSe
LngSupplierVo getSupplierById(Long id);
LngSupplier getByCode(String code);
}

View File

@ -5,8 +5,10 @@ import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.sales.entity.LngCustomer;
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
@ -71,6 +73,13 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
vo.setLngFileUploadList(fileList);
return vo;
}
@Override
public LngSupplier getByCode(String code) {
LambdaQueryWrapper<LngSupplier> queryWrapper = new LambdaQueryWrapper<LngSupplier>();
queryWrapper.eq(LngSupplier::getSuCode,code);
return baseMapper.selectOne(queryWrapper);
}