This commit is contained in:
张秉卓
2025-12-29 17:49:51 +08:00
17 changed files with 445 additions and 33 deletions

View File

@ -0,0 +1,24 @@
package com.xjrsoft.module.sales.client;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant;
/**
* @author: ksy
* @since: 2025/11/5
*/
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/customer")
public interface ICustomerClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id);
}

View File

@ -0,0 +1,24 @@
package com.xjrsoft.module.sales.client;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant;
/**
* @author: ksy
* @since: 2025/11/5
*/
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/gradeSystem")
public interface IGradeSystemClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id);
}

View File

@ -75,7 +75,8 @@ public class LngCustomerPageVo {
* 状态(未提交/审批中/已审批/已驳回) * 状态(未提交/审批中/已审批/已驳回)
*/ */
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)") @ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName") //@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
@Trans(type = TransType.DIC, id = "1990669393069129729")
private String approCode; private String approCode;
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)") @ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")

View File

@ -34,13 +34,26 @@ public class LngScorePageVo {
* 评价体系主键 * 评价体系主键
*/ */
@ApiModelProperty("评价体系主键") @ApiModelProperty("评价体系主键")
//@Trans(type = TransType.API, id = "93d735dcb7364a0f8102188ec4d77ac7") @Trans(type = TransType.GRADE_SYSTEM, transToFieldName = "gsName")
private String gsId; private String gsId;
/**
* 评价体系名称主键
*/
@ApiModelProperty("评价体系名称")
private String gsName;
/** /**
* 供应商/客户 * 供应商/客户
*/ */
@ApiModelProperty("供应商/客户") @ApiModelProperty("供应商/客户")
@Trans(type = TransType.CUSTOMER, transToFieldName = "cpName")
private String cpCode; private String cpCode;
/**
* 供应商/客户
*/
@ApiModelProperty("供应商/客户名称")
private String cpName;
/** /**
* 分数 * 分数
*/ */

View File

@ -0,0 +1,24 @@
package com.xjrsoft.module.supplier.client;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant;
/**
* @author: ksy
* @since: 2025/11/5
*/
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SUPPLIER_MODULE_PREFIX + "/tran/supplier")
public interface ISupplierClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id);
}

View File

@ -34,13 +34,26 @@ public class LngScorePageVo {
* 评价体系主键 * 评价体系主键
*/ */
@ApiModelProperty("评价体系主键") @ApiModelProperty("评价体系主键")
@Trans(type = TransType.API, id = "93d735dcb7364a0f8102188ec4d77ac7") @Trans(type = TransType.GRADE_SYSTEM, transToFieldName = "gsName")
private String gsId; private String gsId;
/**
* 评价体系名称主键
*/
@ApiModelProperty("评价体系名称")
private String gsName;
/** /**
* 供应商/客户 * 供应商/客户
*/ */
@ApiModelProperty("供应商/客户") @ApiModelProperty("供应商/客户")
@Trans(type = TransType.SUPPLIER, transToFieldName = "cpName")
private String cpCode; private String cpCode;
/**
* 供应商/客户
*/
@ApiModelProperty("供应商/客户名称")
private String cpName;
/** /**
* 分数 * 分数
*/ */

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 javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; 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.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.sales.dto.LngCustomerPageDto; import com.xjrsoft.module.sales.dto.LngCustomerPageDto;
@ -56,6 +63,8 @@ public class CustomerController {
private final String CUSTOMER_CODE = "customerCode"; private final String CUSTOMER_CODE = "customerCode";
private final CustomerDataProvider tranProvider;
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(value="LngCustomer列表(分页)") @ApiOperation(value="LngCustomer列表(分页)")
@SaCheckPermission("customer:list") @SaCheckPermission("customer:list")
@ -101,9 +110,27 @@ public class CustomerController {
String code = codeRuleClient.genEncode(CUSTOMER_CODE); String code = codeRuleClient.genEncode(CUSTOMER_CODE);
dto.setCuCode("C"+code); dto.setCuCode("C"+code);
UpdateLngCustomerDto obj = dataService.insert(dto); //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); codeRuleClient.useEncode(CUSTOMER_CODE);
return R.ok(obj); UpdateLngCustomerDto obj =content.getObj();
tranProvider.saveData(obj.getCuCode(), obj.getCuName());
return obj;
}
}));
} }
@ -112,7 +139,25 @@ public class CustomerController {
@SaCheckPermission("customer:edit") @SaCheckPermission("customer:edit")
public R update(@Valid @RequestBody UpdateLngCustomerDto dto){ 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 @DeleteMapping

View File

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

View File

@ -1,21 +1,35 @@
package com.xjrsoft.module.sales.controller; package com.xjrsoft.module.sales.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import java.util.List;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pictc.datalog.DataOperationContent; import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener; import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.utils.CollectionUtils; 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.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil; 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.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; 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.LngGradeSystemPageDto;
import com.xjrsoft.module.sales.dto.UpdateLngGradeSystemDto; import com.xjrsoft.module.sales.dto.UpdateLngGradeSystemDto;
import com.xjrsoft.module.sales.entity.LngGradeSystem; 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.LngGradeSystemPageVo;
import com.xjrsoft.module.sales.vo.LngGradeSystemVo; import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
import com.xjrsoft.module.system.client.ICodeRuleClient; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/** /**
* @title: 评价体系 * @title: 评价体系
@ -49,6 +63,8 @@ public class GradeSystemController {
private final ICodeRuleClient codeRuleClient; private final ICodeRuleClient codeRuleClient;
private final String GS_CODE = "gsCode"; private final String GS_CODE = "gsCode";
private final GradeSystemDataProvider tranProvider;
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(value="LngGradeSystem列表(分页)") @ApiOperation(value="LngGradeSystem列表(分页)")
@SaCheckPermission("gradeSystem:list") @SaCheckPermission("gradeSystem:list")
@ -92,16 +108,54 @@ public class GradeSystemController {
public R add(@Valid @RequestBody UpdateLngGradeSystemDto dto){ public R add(@Valid @RequestBody UpdateLngGradeSystemDto dto){
String code = codeRuleClient.genEncode(GS_CODE); String code = codeRuleClient.genEncode(GS_CODE);
dto.setGsCode(code); dto.setGsCode(code);
UpdateLngGradeSystemDto res = dataService.insert(dto); 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); codeRuleClient.useEncode(GS_CODE);
UpdateLngGradeSystemDto obj =content.getObj();
tranProvider.saveData(obj.getId().toString(), obj.getGsName());
return obj;
}
});
return R.ok(res.getId()); return R.ok(res.getId());
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngGradeSystem") @ApiOperation(value = "修改LngGradeSystem")
@SaCheckPermission("gradeSystem:edit") @SaCheckPermission("gradeSystem:edit")
public R update(@Valid @RequestBody UpdateLngGradeSystemDto dto){ 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 @DeleteMapping

View File

@ -27,4 +27,6 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
LngCustomerVo getCustomerById(Long id); 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.sales.entity.LngCustomer; import com.xjrsoft.module.sales.entity.LngCustomer;
@ -82,4 +83,11 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
vo.setLngFileUploadList(fileList); vo.setLngFileUploadList(fileList);
return vo; 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 javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.model.result.R;
import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput; 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.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.supplier.dto.LngSupplierPageDto; import com.xjrsoft.module.supplier.dto.LngSupplierPageDto;
@ -55,6 +63,8 @@ public class SupplierController {
private final String SUPPLIER_CODE = "supplierCode"; private final String SUPPLIER_CODE = "supplierCode";
private final SupplierDataProvider tranProvider;
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(value="LngSupplier列表(分页)") @ApiOperation(value="LngSupplier列表(分页)")
@SaCheckPermission("supplier:list") @SaCheckPermission("supplier:list")
@ -98,16 +108,53 @@ public class SupplierController {
public R add(@Valid @RequestBody UpdateLngSupplierDto dto){ public R add(@Valid @RequestBody UpdateLngSupplierDto dto){
String code = codeRuleClient.genEncode(SUPPLIER_CODE); String code = codeRuleClient.genEncode(SUPPLIER_CODE);
dto.setSuCode("S"+code); dto.setSuCode("S"+code);
UpdateLngSupplierDto res = dataService.insert(dto); //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); codeRuleClient.useEncode(SUPPLIER_CODE);
return R.ok(res); UpdateLngSupplierDto obj =content.getObj();
tranProvider.saveData(obj.getSuCode(), obj.getSuName());
return obj;
}
}));
} }
@PutMapping @PutMapping
@ApiOperation(value = "修改LngSupplier") @ApiOperation(value = "修改LngSupplier")
@SaCheckPermission("supplier:edit") @SaCheckPermission("supplier:edit")
public R update(@Valid @RequestBody UpdateLngSupplierDto dto){ 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 @DeleteMapping

View File

@ -31,4 +31,6 @@ public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepSe
LngSupplierVo getSupplierById(Long id); 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl; 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.dto.UpdateLngSupplierDto;
import com.xjrsoft.module.supplier.entity.LngSupplier; import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.entity.LngSupplierBank; import com.xjrsoft.module.supplier.entity.LngSupplierBank;
@ -72,6 +74,13 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
return vo; return vo;
} }
@Override
public LngSupplier getByCode(String code) {
LambdaQueryWrapper<LngSupplier> queryWrapper = new LambdaQueryWrapper<LngSupplier>();
queryWrapper.eq(LngSupplier::getSuCode,code);
return baseMapper.selectOne(queryWrapper);
}
} }