This commit is contained in:
2025-12-22 18:52:16 +08:00
17 changed files with 273 additions and 170 deletions

View File

@ -8,11 +8,13 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pictc.annotations.datalog.JoinCaseType;
import com.pictc.annotations.datalog.JoinType;
import com.pictc.annotations.datalog.LogAttrField;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogJoin;
import com.pictc.annotations.datalog.LogJoinColumn;
import com.pictc.annotations.datalog.LogTable;
import com.pictc.annotations.datalog.ValueDirectionType;
import com.xjrsoft.module.system.dto.UpdateLngFileUploadDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -139,8 +141,15 @@ public class UpdateLngScoreDto implements Serializable {
@ApiModelProperty("lngScoreDtl子表")
@LogJoin(name = "lngScoreDtl子表",
columns = {
@LogJoinColumn(field = "sId",relatedField = "id", valueDirection = ValueDirectionType.RIGHT)
@LogJoinColumn(field = "id",relatedField = "sId", valueDirection = ValueDirectionType.RIGHT)
},
caseType = JoinCaseType.FULL, target = UpdateLngScoreDtlDto.class, type = JoinType.MANY)
private List<UpdateLngScoreDtlDto> lngScoreDtlList;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
@LogAttrField
private List<UpdateLngFileUploadDto> lngFileUploadList;
}

View File

@ -34,7 +34,7 @@ public class LngScorePageVo {
* 评价体系主键
*/
@ApiModelProperty("评价体系主键")
@Trans(type = TransType.API, id = "93d735dcb7364a0f8102188ec4d77ac7")
//@Trans(type = TransType.API, id = "93d735dcb7364a0f8102188ec4d77ac7")
private String gsId;
/**
* 供应商/客户

View File

@ -4,6 +4,8 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import com.xjrsoft.module.supplier.vo.LngScoreDtlVo;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
@ -135,4 +137,16 @@ public class LngScoreVo {
@ApiModelProperty("lngFileUpload子表")
private List<LngFileUploadVo> lngFileUploadList;
@Trans(type = TransType.DIC, id = "1990668094164484097", transToFieldName = "cpClassName")
private String cpClassCode;
private String cpClassName;
/**
* 供应商/客户
*/
@ApiModelProperty("供应商/客户名称")
private String cpName;
}

View File

@ -45,7 +45,7 @@ public class UpdateLngScoreDto implements Serializable {
*/
@LogField(name="评分日期",index=1)
@ApiModelProperty("评分日期")
@JsonFormat(pattern = "HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dateGrade;
/**
@ -104,7 +104,7 @@ public class UpdateLngScoreDto implements Serializable {
@ApiModelProperty("lngScoreDtl子表")
@LogJoin(name = "lngScoreDtl子表",
columns = {
@LogJoinColumn(field = "sId",relatedField = "id", valueDirection = ValueDirectionType.RIGHT)
@LogJoinColumn(field = "id",relatedField = "sId", valueDirection = ValueDirectionType.RIGHT)
},
caseType = JoinCaseType.FULL, target = UpdateLngScoreDtlDto.class, type = JoinType.MANY)
private List<UpdateLngScoreDtlDto> lngScoreDtlList;

View File

@ -28,7 +28,7 @@ public class LngScorePageVo {
* 评分日期
*/
@ApiModelProperty("评分日期")
@JsonFormat(pattern = "HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dateGrade;
/**
* 评价体系主键

View File

@ -4,6 +4,10 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -129,4 +133,23 @@ public class LngScoreVo {
@ApiModelProperty("lngScoreDtl子表")
private List<LngScoreDtlVo> lngScoreDtlList;
/**
* lngFileUpload
*/
@ApiModelProperty("lngFileUpload子表")
private List<LngFileUploadVo> lngFileUploadList;
@Trans(type = TransType.DIC, id = "1990668094164484097", transToFieldName = "cpClassName")
private String cpClassCode;
private String cpClassName;
/**
* 供应商/客户
*/
@ApiModelProperty("供应商/客户名称")
private String cpName;
}

View File

@ -15,6 +15,7 @@ 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.constant.FieldNameConstants;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.BusinessCode;
@ -129,17 +130,18 @@ public class CountryRegionController {
}else {
dto.setFullPath(dto.getFullName());
}
checkParams(dto);
return content.getObj();
}
@Override
public UpdateLngBRegionDto after(DataOperationContent<UpdateLngBRegionDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
UpdateLngBRegionDto obj = content.getObj();
tranProvider.saveData(obj.getCode(), obj.getFullName());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
UpdateLngBRegionDto obj = content.getObj();
tranProvider.saveData(obj.getCode(), obj.getFullName());
return content.getObj();
}
}));
@ -164,15 +166,16 @@ public class CountryRegionController {
}else {
dto.setFullPath(dto.getFullName());
}
checkParams(dto);
return content.getObj();
}
@Override
public UpdateLngBRegionDto after(DataOperationContent<UpdateLngBRegionDto> content) {
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
if (StringUtils.isNotBlank(msg)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
}
UpdateLngBRegionDto obj = content.getObj();
tranProvider.saveData(obj.getCode(), obj.getFullName());
return content.getObj();
@ -243,4 +246,20 @@ public class CountryRegionController {
}
private void checkParams(UpdateLngBRegionDto dto) {
Long codeCount = countryRegionService.count(new LambdaQueryWrapper<LngBRegion>()
.eq(LngBRegion::getCode, dto.getCode()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE));
}
Long nameCount = countryRegionService.count(new LambdaQueryWrapper<LngBRegion>()
.eq(LngBRegion::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME));
}
}
}

View File

@ -1,17 +1,13 @@
package com.xjrsoft.module.mdm.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.mdm.entity.LngBPlaceLngUnload;
import com.xjrsoft.module.mdm.mapper.LngBPlaceLngUnloadMapper;
import com.xjrsoft.module.mdm.service.IPlaceLngUnloadService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
/**
* @title: service

View File

@ -15,6 +15,9 @@ 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.utils.StringUtils;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
@ -22,6 +25,7 @@ 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;
@ -43,7 +47,7 @@ import lombok.AllArgsConstructor;
* @Version 1.0
*/
@RestController
@RequestMapping("/sales" + "/scoreCustomer")
@RequestMapping("/sales/scoreCustomer")
@Api(value = "/sales" + "/scoreCustomer",tags = "客户评价代码")
@AllArgsConstructor
public class CustomerScoreController {
@ -65,6 +69,7 @@ public class CustomerScoreController {
.eq(ObjectUtil.isNotNull(dto.getScore()),LngScore::getScore,dto.getScore())
.like(StrUtil.isNotBlank(dto.getApproCode()),LngScore::getApproCode,dto.getApproCode())
.like(StrUtil.isNotBlank(dto.getNote()),LngScore::getNote,dto.getNote())
.eq(LngScore::getTableName, "lng_customer")
.orderByDesc(LngScore::getId);
IPage<LngScore> page = scoreCustomerService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngScorePageVo> pageOutput = ConventPage.getPageOutput(page, LngScorePageVo.class);
@ -75,11 +80,7 @@ public class CustomerScoreController {
@ApiOperation(value="根据id查询LngScore信息")
@SaCheckPermission("scoreCustomer:detail")
public R info(@RequestParam Long id){
LngScore lngScore = scoreCustomerService.getByIdDeep(id);
if (lngScore == null) {
return R.error("找不到此数据!");
}
return R.ok(BeanUtil.toBean(lngScore, LngScoreVo.class));
return R.ok(scoreCustomerService.getInfoById(id));
}
@GetMapping(value = "/datalog")
@ -95,15 +96,41 @@ public class CustomerScoreController {
@ApiOperation(value = "新增LngScore")
@SaCheckPermission("scoreCustomer:add")
public R add(@Valid @RequestBody UpdateLngScoreDto dto){
UpdateLngScoreDto res = dataService.insert(dto);
return R.ok(res.getId());
if(StringUtils.isEmpty(dto.getTableName())) {
dto.setTableName("lng_customer");
}
UpdateLngScoreDto res = dataService.insert(dto, new DataOperationListener<UpdateLngScoreDto>() {
@Override
public UpdateLngScoreDto before(DataOperationContent<UpdateLngScoreDto> content) {
return null;
}
@Override
public UpdateLngScoreDto after(DataOperationContent<UpdateLngScoreDto> content) {
//execAfter(content.getTableName(), content.getIdValue(), "I");
return content.getObj();
}
});
return R.ok(res);
}
@PutMapping
@ApiOperation(value = "修改LngScore")
@SaCheckPermission("scoreCustomer:edit")
public R update(@Valid @RequestBody UpdateLngScoreDto dto){
return R.ok(dataService.updateById(dto));
return R.ok(dataService.updateById(dto, new DataOperationListener<UpdateLngScoreDto>() {
@Override
public UpdateLngScoreDto before(DataOperationContent<UpdateLngScoreDto> content) {
return null;
}
@Override
public UpdateLngScoreDto after(DataOperationContent<UpdateLngScoreDto> content) {
//execAfter(content.getTableName(), content.getIdValue(), "I");
return content.getObj();
}
}));
}
@DeleteMapping

View File

@ -1,20 +1,24 @@
package com.xjrsoft.module.sales.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.yulichang.annotation.EntityMapping;
import com.pictc.annotations.datalog.JoinCaseType;
import com.pictc.annotations.datalog.JoinType;
import com.pictc.annotations.datalog.LogJoin;
import com.pictc.annotations.datalog.LogJoinColumn;
import com.pictc.annotations.datalog.ValueDirectionType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.List;
/**
@ -134,6 +138,11 @@ public class LngScore implements Serializable {
@ApiModelProperty("lngScoreDtl子表")
@TableField(exist = false)
@EntityMapping(thisField = "id", joinField = "sId")
@LogJoin(name = "客户联系人信息",
columns = {
@LogJoinColumn(field = "id",relatedField = "sId", valueDirection = ValueDirectionType.RIGHT)
}, caseType = JoinCaseType.FULL, target = LngScoreDtl.class, type = JoinType.MANY)
private List<LngScoreDtl> lngScoreDtlList;
}

View File

@ -1,28 +1,25 @@
package com.xjrsoft.module.sales.service.impl;
import java.util.List;
import java.util.Objects;
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;
import com.xjrsoft.module.sales.entity.LngScore;
import com.xjrsoft.module.sales.entity.LngScoreDtl;
import com.xjrsoft.module.sales.mapper.LngCustomerMapper;
import com.xjrsoft.module.sales.mapper.LngCustomerScoreDtlMapper;
import com.xjrsoft.module.sales.mapper.LngCustomerScoreMapper;
import com.xjrsoft.module.sales.service.IScoreCustomerService;
import com.xjrsoft.module.sales.vo.LngCustomerDocVo;
import com.xjrsoft.module.sales.vo.LngCustomerVo;
import com.xjrsoft.module.sales.vo.LngScoreVo;
import com.xjrsoft.module.system.client.IFileClient;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import lombok.AllArgsConstructor;
/**
@ -34,9 +31,12 @@ import lombok.AllArgsConstructor;
@Service
@AllArgsConstructor
public class CustomerScoreServiceImpl extends MPJBaseServiceImpl<LngCustomerScoreMapper, LngScore> implements IScoreCustomerService {
private final LngCustomerScoreMapper scoreCustomerLngScoreMapper;
private final LngCustomerScoreMapper customerScoreMapper;
private final LngCustomerScoreDtlMapper customerScoreDtlMapper;
private final LngCustomerMapper customerMapper;
private final LngCustomerScoreDtlMapper scoreCustomerLngScoreDtlMapper;
private final IFileClient fileClient;
@ -44,8 +44,8 @@ public class CustomerScoreServiceImpl extends MPJBaseServiceImpl<LngCustomerScor
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) {
scoreCustomerLngScoreMapper.deleteBatchIds(ids);
scoreCustomerLngScoreDtlMapper.delete(Wrappers.lambdaQuery(LngScoreDtl.class).in(LngScoreDtl::getSId, ids));
customerScoreMapper.deleteBatchIds(ids);
customerScoreDtlMapper.delete(Wrappers.lambdaQuery(LngScoreDtl.class).in(LngScoreDtl::getSId, ids));
return true;
}
@ -57,6 +57,13 @@ public class CustomerScoreServiceImpl extends MPJBaseServiceImpl<LngCustomerScor
return null;
}
LngScoreVo vo = BeanUtil.toBean(lngScore, LngScoreVo.class);
LngCustomer customer = customerMapper.selectOne(new LambdaQueryWrapper<LngCustomer>()
.eq(LngCustomer::getCuCode, vo.getCpCode()));
if(customer != null) {
vo.setCpClassCode(customer.getClassCode());
vo.setCpName(customer.getCuName());
}
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_score", "lngFileUploadList", vo.getId());
vo.setLngFileUploadList(fileList);
return vo;

View File

@ -15,10 +15,12 @@ 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.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.supplier.dto.LngScorePageDto;
@ -26,10 +28,8 @@ import com.xjrsoft.module.supplier.dto.UpdateLngScoreDto;
import com.xjrsoft.module.supplier.entity.LngScore;
import com.xjrsoft.module.supplier.service.IScoreSupplierService;
import com.xjrsoft.module.supplier.vo.LngScorePageVo;
import com.xjrsoft.module.supplier.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;
@ -43,7 +43,7 @@ import lombok.AllArgsConstructor;
* @Version 1.0
*/
@RestController
@RequestMapping("/supplier" + "/scoreSupplier")
@RequestMapping("/supplier/scoreSupplier")
@Api(value = "/supplier" + "/scoreSupplier",tags = "供应商评价代码")
@AllArgsConstructor
public class SupplierScoreController {
@ -65,8 +65,8 @@ public class SupplierScoreController {
.eq(ObjectUtil.isNotNull(dto.getScore()),LngScore::getScore,dto.getScore())
.like(StrUtil.isNotBlank(dto.getApproCode()),LngScore::getApproCode,dto.getApproCode())
.like(StrUtil.isNotBlank(dto.getNote()),LngScore::getNote,dto.getNote())
.orderByDesc(LngScore::getId)
.select(LngScore.class,x -> VoToColumnUtil.fieldsToColumns(LngScorePageVo.class).contains(x.getProperty()));
.eq(LngScore::getTableName, "lng_supplier")
.orderByDesc(LngScore::getId);
IPage<LngScore> page = scoreSupplierService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngScorePageVo> pageOutput = ConventPage.getPageOutput(page, LngScorePageVo.class);
return R.ok(pageOutput);
@ -76,11 +76,7 @@ public class SupplierScoreController {
@ApiOperation(value="根据id查询LngScore信息")
@SaCheckPermission("scoreSupplier:detail")
public R info(@RequestParam Long id){
LngScore lngScore = scoreSupplierService.getByIdDeep(id);
if (lngScore == null) {
return R.error("找不到此数据!");
}
return R.ok(BeanUtil.toBean(lngScore, LngScoreVo.class));
return R.ok(scoreSupplierService.getInfoById(id));
}
@GetMapping(value = "/datalog")
@ -96,22 +92,45 @@ public class SupplierScoreController {
@ApiOperation(value = "新增LngScore")
@SaCheckPermission("scoreSupplier:add")
public R add(@Valid @RequestBody UpdateLngScoreDto dto){
UpdateLngScoreDto res = dataService.insert(dto);
return R.ok(res.getId());
if(StringUtils.isEmpty(dto.getTableName())) {
dto.setTableName("lng_supplier");
}
UpdateLngScoreDto res = dataService.insert(dto, new DataOperationListener<UpdateLngScoreDto>() {
@Override
public UpdateLngScoreDto before(DataOperationContent<UpdateLngScoreDto> content) {
return null;
}
@Override
public UpdateLngScoreDto after(DataOperationContent<UpdateLngScoreDto> content) {
return content.getObj();
}
});
return R.ok(res);
}
@PutMapping
@ApiOperation(value = "修改LngScore")
@SaCheckPermission("scoreSupplier:edit")
public R update(@Valid @RequestBody UpdateLngScoreDto dto){
return R.ok(dataService.updateById(dto));
return R.ok(dataService.updateById(dto, new DataOperationListener<UpdateLngScoreDto>() {
@Override
public UpdateLngScoreDto before(DataOperationContent<UpdateLngScoreDto> content) {
return null;
}
@Override
public UpdateLngScoreDto after(DataOperationContent<UpdateLngScoreDto> content) {
return content.getObj();
}
}));
}
@DeleteMapping
@ApiOperation(value = "删除")
@SaCheckPermission("scoreSupplier:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngScoreDto.class, ids));
return R.ok(dataService.deleteByIds(UpdateLngScoreDto.class, ids));
}

View File

@ -1,12 +1,12 @@
package com.xjrsoft.module.supplier.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.github.yulichang.extension.mapping.base.MPJRelationService;
import com.xjrsoft.module.supplier.entity.LngScore;
import lombok.Data;
import java.util.List;
import com.xjrsoft.module.supplier.vo.LngScoreVo;
/**
* @title: service
@ -16,21 +16,7 @@ import java.util.List;
*/
public interface IScoreSupplierService extends MPJBaseService<LngScore>, MPJDeepService<LngScore>, MPJRelationService<LngScore> {
/**
* 新增
*
* @param lngScore
* @return
*/
Boolean add(LngScore lngScore);
/**
* 更新
*
* @param lngScore
* @return
*/
Boolean update(LngScore lngScore);
/**
* 删除
@ -39,4 +25,6 @@ public interface IScoreSupplierService extends MPJBaseService<LngScore>, MPJDeep
* @return
*/
Boolean delete(List<Long> ids);
LngScoreVo getInfoById(Long id);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.github.yulichang.extension.mapping.base.MPJRelationService;
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
@ -29,4 +30,5 @@ public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepSe
Boolean delete(List<Long> ids);
LngSupplierVo getSupplierById(Long id);
}

View File

@ -1,88 +0,0 @@
package com.xjrsoft.module.supplier.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.supplier.entity.LngScoreDtl;
import com.xjrsoft.module.supplier.mapper.LngSupplierScoreDtlMapper;
import com.xjrsoft.module.supplier.entity.LngScore;
import com.xjrsoft.module.supplier.mapper.LngSupplierScoreMapper;
import com.xjrsoft.module.supplier.service.IScoreSupplierService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
/**
* @title: service
* @Author 管理员
* @Date: 2025-12-17
* @Version 1.0
*/
@Service
@AllArgsConstructor
public class ScoreSupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierScoreMapper, LngScore> implements IScoreSupplierService {
private final LngSupplierScoreMapper scoreSupplierLngScoreMapper;
private final LngSupplierScoreDtlMapper scoreSupplierLngScoreDtlMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean add(LngScore lngScore) {
scoreSupplierLngScoreMapper.insert(lngScore);
for (LngScoreDtl lngScoreDtl : lngScore.getLngScoreDtlList()) {
lngScoreDtl.setSId(lngScore.getId());
scoreSupplierLngScoreDtlMapper.insert(lngScoreDtl);
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean update(LngScore lngScore) {
scoreSupplierLngScoreMapper.updateById(lngScore);
//********************************* LngScoreDtl 增删改 开始 *******************************************/
{
// 查出所有子级的id
List<LngScoreDtl> lngScoreDtlList = scoreSupplierLngScoreDtlMapper.selectList(Wrappers.lambdaQuery(LngScoreDtl.class).eq(LngScoreDtl::getSId, lngScore.getId()).select(LngScoreDtl::getId));
List<Long> lngScoreDtlIds = lngScoreDtlList.stream().map(LngScoreDtl::getId).collect(Collectors.toList());
//原有子表单 没有被删除的主键
List<Long> lngScoreDtlOldIds = lngScore.getLngScoreDtlList().stream().map(LngScoreDtl::getId).filter(Objects::nonNull).collect(Collectors.toList());
//找到需要删除的id
List<Long> lngScoreDtlRemoveIds = lngScoreDtlIds.stream().filter(item -> !lngScoreDtlOldIds.contains(item)).collect(Collectors.toList());
for (LngScoreDtl lngScoreDtl : lngScore.getLngScoreDtlList()) {
//如果不等于空则修改
if (lngScoreDtl.getId() != null) {
scoreSupplierLngScoreDtlMapper.updateById(lngScoreDtl);
}
//如果等于空 则新增
else {
//已经不存在的id 删除
lngScoreDtl.setSId(lngScore.getId());
scoreSupplierLngScoreDtlMapper.insert(lngScoreDtl);
}
}
//已经不存在的id 删除
if(lngScoreDtlRemoveIds.size() > 0){
scoreSupplierLngScoreDtlMapper.deleteBatchIds(lngScoreDtlRemoveIds);
}
}
//********************************* LngScoreDtl 增删改 结束 *******************************************/
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) {
scoreSupplierLngScoreMapper.deleteBatchIds(ids);
scoreSupplierLngScoreDtlMapper.delete(Wrappers.lambdaQuery(LngScoreDtl.class).in(LngScoreDtl::getSId, ids));
return true;
}
}

View File

@ -0,0 +1,76 @@
package com.xjrsoft.module.supplier.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.supplier.entity.LngScoreDtl;
import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.mapper.LngSupplierMapper;
import com.xjrsoft.module.supplier.mapper.LngSupplierScoreDtlMapper;
import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
import com.xjrsoft.module.supplier.entity.LngScore;
import com.xjrsoft.module.supplier.mapper.LngSupplierScoreMapper;
import com.xjrsoft.module.supplier.service.IScoreSupplierService;
import com.xjrsoft.module.supplier.vo.LngScoreVo;
import com.xjrsoft.module.system.client.IFileClient;
import com.xjrsoft.module.system.vo.LngFileUploadVo;
import cn.hutool.core.bean.BeanUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
/**
* @title: service
* @Author 管理员
* @Date: 2025-12-17
* @Version 1.0
*/
@Service
@AllArgsConstructor
public class SupplierScoreServiceImpl extends MPJBaseServiceImpl<LngSupplierScoreMapper, LngScore> implements IScoreSupplierService {
private final LngSupplierScoreMapper supplierScoreMapper;
private final LngSupplierScoreDtlMapper supplierScoreDtlMapper;
private final LngSupplierMapper supplierMapper;
private final IFileClient fileClient;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) {
supplierScoreMapper.deleteBatchIds(ids);
supplierScoreDtlMapper.delete(Wrappers.lambdaQuery(LngScoreDtl.class).in(LngScoreDtl::getSId, ids));
return true;
}
@Override
public LngScoreVo getInfoById(Long id) {
LngScore lngScore = this.getByIdDeep(id);
if(lngScore == null) {
return null;
}
LngScoreVo vo = BeanUtil.toBean(lngScore, LngScoreVo.class);
LngSupplier supplier = supplierMapper.selectOne(new LambdaQueryWrapper<LngSupplier>()
.eq(LngSupplier::getSuCode, vo.getCpCode()));
if(supplier != null) {
vo.setCpClassCode(supplier.getClassCode());
vo.setCpName(supplier.getSuName());
}
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_score", "lngFileUploadList", vo.getId());
vo.setLngFileUploadList(fileList);
return vo;
}
}

View File

@ -7,6 +7,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
@ -34,7 +35,7 @@ import lombok.AllArgsConstructor;
@Service
@AllArgsConstructor
public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, LngSupplier> implements ISupplierService {
private final LngSupplierMapper supplierLngSupplierMapper;
private final LngSupplierMapper supplierMapper;
private final LngSupplierBankMapper supplierLngSupplierBankMapper;
private final LngSupplierContactMapper supplierLngSupplierContactMapper;
@ -45,7 +46,7 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean delete(List<Long> ids) {
supplierLngSupplierMapper.deleteBatchIds(ids);
supplierMapper.deleteBatchIds(ids);
supplierLngSupplierBankMapper.delete(Wrappers.lambdaQuery(LngSupplierBank.class).in(LngSupplierBank::getSuCode, ids));
supplierLngSupplierContactMapper.delete(Wrappers.lambdaQuery(LngSupplierContact.class).in(LngSupplierContact::getSuCode, ids));
supplierLngSupplierDocMapper.delete(Wrappers.lambdaQuery(LngSupplierDoc.class).in(LngSupplierDoc::getSuCode, ids));
@ -72,4 +73,5 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
}
}