Merge branch 'dev' of http://47.94.165.164:13000/geg-gas/geg-gas-pcitc into dev
This commit is contained in:
@ -15,17 +15,10 @@ 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.StringUtils;
|
||||
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;
|
||||
@ -33,11 +26,9 @@ import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||
import com.xjrsoft.module.sales.service.ICustomerService;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerPageVo;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerVo;
|
||||
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;
|
||||
@ -92,11 +83,7 @@ public class CustomerController {
|
||||
@ApiOperation(value="根据id查询LngCustomer信息")
|
||||
@SaCheckPermission("customer:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
LngCustomer lngCustomer = customerService.getCustomerById(id);
|
||||
if (lngCustomer == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngCustomer, LngCustomerVo.class));
|
||||
return R.ok(customerService.getCustomerById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ -112,33 +99,33 @@ public class CustomerController {
|
||||
@ApiOperation(value = "新增LngCustomer")
|
||||
@SaCheckPermission("customer:add")
|
||||
public R add(@Valid @RequestBody UpdateLngCustomerDto dto){
|
||||
// String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
// dto.setCuCode("C"+code);
|
||||
// Long id = customerService.add(dto);
|
||||
// dto.setId(id);
|
||||
// codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
// return R.ok(dto);
|
||||
|
||||
|
||||
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
dto.setCuCode("C"+code);
|
||||
UpdateLngCustomerDto obj = dataService.insert(dto);
|
||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
return R.ok(obj);
|
||||
/**
|
||||
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngCustomerDto>() {
|
||||
|
||||
@Override
|
||||
public UpdateLngCustomerDto before(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String code = codeRuleClient.genEncode(CUSTOMER_CODE);
|
||||
dto.setCuCode("C"+code);
|
||||
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateLngCustomerDto after(DataOperationContent<UpdateLngCustomerDto> content) {
|
||||
String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||
if (StringUtils.isNotEmpty(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
codeRuleClient.useEncode(CUSTOMER_CODE);
|
||||
return content.getObj();
|
||||
}
|
||||
}));
|
||||
|
||||
**/
|
||||
}
|
||||
|
||||
|
||||
@ -146,24 +133,8 @@ public class CustomerController {
|
||||
@ApiOperation(value = "修改LngCustomer")
|
||||
@SaCheckPermission("customer:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngCustomerDto dto){
|
||||
// customerService.update(dto);
|
||||
// return R.ok();
|
||||
return R.ok(dataService.updateById(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.isNotEmpty(msg)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg));
|
||||
}
|
||||
return content.getObj();
|
||||
}
|
||||
}));
|
||||
|
||||
return R.ok(dataService.updateById(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.xjrsoft.module.sales.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
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.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.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;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* @title: 客户评价
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sales" + "/scoreCustomer")
|
||||
@Api(value = "/sales" + "/scoreCustomer",tags = "客户评价代码")
|
||||
@AllArgsConstructor
|
||||
public class ScoreCustomerController {
|
||||
|
||||
|
||||
private final IScoreCustomerService scoreCustomerService;
|
||||
private final DatalogService dataService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngScore列表(分页)")
|
||||
@SaCheckPermission("scoreCustomer:list")
|
||||
public R page(@Valid LngScorePageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getCpCode()),LngScore::getCpCode,dto.getCpCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getGsId()),LngScore::getGsId,dto.getGsId())
|
||||
.between(ObjectUtil.isNotNull(dto.getDateGradeStart()) && ObjectUtil.isNotNull(dto.getDateGradeEnd()),LngScore::getDateGrade,dto.getDateGradeStart(),dto.getDateGradeEnd())
|
||||
.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()));
|
||||
IPage<LngScore> page = scoreCustomerService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngScorePageVo> pageOutput = ConventPage.getPageOutput(page, LngScorePageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@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));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngScore数据详细日志")
|
||||
@SaCheckPermission("scoreCustomer:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngScoreDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngScore")
|
||||
@SaCheckPermission("scoreCustomer:add")
|
||||
public R add(@Valid @RequestBody UpdateLngScoreDto dto){
|
||||
UpdateLngScoreDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngScore")
|
||||
@SaCheckPermission("scoreCustomer:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngScoreDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("scoreCustomer:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngScoreDto.class, ids));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
package com.xjrsoft.module.sales.entity;
|
||||
|
||||
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.github.yulichang.annotation.EntityMapping;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 客户评价
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_score")
|
||||
@ApiModel(value = "客户评价对象", description = "客户评价")
|
||||
public class LngScore implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评分日期
|
||||
*/
|
||||
@ApiModelProperty("评分日期")
|
||||
private LocalDateTime dateGrade;
|
||||
|
||||
/**
|
||||
* 评价体系主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系主键")
|
||||
private Long gsId;
|
||||
|
||||
/**
|
||||
* 表名(隐藏,供应商/客户/承运商表名;应与评价体系的对象一致)
|
||||
*/
|
||||
@ApiModelProperty("表名(隐藏,供应商/客户/承运商表名;应与评价体系的对象一致)")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 供应商/客户
|
||||
*/
|
||||
@ApiModelProperty("供应商/客户")
|
||||
private String cpCode;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
@ApiModelProperty("分数")
|
||||
private BigDecimal score;
|
||||
|
||||
/**
|
||||
* 审批状态(未审批/审批中/已审批/已驳回)
|
||||
*/
|
||||
@ApiModelProperty("审批状态(未审批/审批中/已审批/已驳回)")
|
||||
private String approCode;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
/**
|
||||
* lngScoreDtl
|
||||
*/
|
||||
@ApiModelProperty("lngScoreDtl子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "id", joinField = "sId")
|
||||
private List<LngScoreDtl> lngScoreDtlList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,168 @@
|
||||
package com.xjrsoft.module.sales.entity;
|
||||
|
||||
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.github.yulichang.annotation.EntityMapping;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 客户评价
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_score_dtl")
|
||||
@ApiModel(value = "客户评价对象", description = "客户评价")
|
||||
public class LngScoreDtl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评分信息主键
|
||||
*/
|
||||
@ApiModelProperty("评分信息主键")
|
||||
private Long sId;
|
||||
|
||||
/**
|
||||
* 评价体系主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系主键")
|
||||
private Long gsId;
|
||||
|
||||
/**
|
||||
* 评价体系-条目主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系-条目主键")
|
||||
private Long gsiId;
|
||||
|
||||
/**
|
||||
* 评分事项(只读)
|
||||
*/
|
||||
@ApiModelProperty("评分事项(只读)")
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 评分标准(只读)
|
||||
*/
|
||||
@ApiModelProperty("评分标准(只读)")
|
||||
private String itemDesc;
|
||||
|
||||
/**
|
||||
* 评分部门(只读)
|
||||
*/
|
||||
@ApiModelProperty("评分部门(只读)")
|
||||
private String eDeptCode;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@ApiModelProperty("显示顺序")
|
||||
private Short sort;
|
||||
|
||||
/**
|
||||
* 实际评分部门编码(当前登录人所在部门)
|
||||
*/
|
||||
@ApiModelProperty("实际评分部门编码(当前登录人所在部门)")
|
||||
private String aDeptCode;
|
||||
|
||||
/**
|
||||
* 实际评分人编码(当前登录人)
|
||||
*/
|
||||
@ApiModelProperty("实际评分人编码(当前登录人)")
|
||||
private String aEmpCode;
|
||||
|
||||
/**
|
||||
* 实际评分时间
|
||||
*/
|
||||
@ApiModelProperty("实际评分时间")
|
||||
private Object aTime;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
@ApiModelProperty("分数")
|
||||
private BigDecimal score;
|
||||
|
||||
/**
|
||||
* 分数说明
|
||||
*/
|
||||
@ApiModelProperty("分数说明")
|
||||
private String scoreDesc;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.sales.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngScoreDtl;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngScoreDtlMapper extends MPJBaseMapper<LngScoreDtl> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.sales.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngScore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngScoreMapper extends MPJBaseMapper<LngScore> {
|
||||
|
||||
}
|
||||
@ -1,13 +1,12 @@
|
||||
package com.xjrsoft.module.sales.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.sales.dto.UpdateLngCustomerDto;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerVo;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -17,23 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepService<LngCustomer>, MPJRelationService<LngCustomer> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngCustomer
|
||||
* @return
|
||||
*/
|
||||
|
||||
Long add(UpdateLngCustomerDto updateLngCustomerDto);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngCustomer
|
||||
* @return
|
||||
*/
|
||||
Boolean update(UpdateLngCustomerDto updateLngCustomerDto);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
@ -42,6 +25,6 @@ public interface ICustomerService extends MPJBaseService<LngCustomer>, MPJDeepSe
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
|
||||
LngCustomer getCustomerById(Long id);
|
||||
LngCustomerVo getCustomerById(Long id);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.module.sales.service;
|
||||
|
||||
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.sales.entity.LngScore;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface IScoreCustomerService extends MPJBaseService<LngScore>, MPJDeepService<LngScore>, MPJRelationService<LngScore> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngScore
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngScore lngScore);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngScore
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngScore lngScore);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
}
|
||||
@ -9,11 +9,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerAttrPowerDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerBankDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerContactDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDocDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomer;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerAttrPower;
|
||||
import com.xjrsoft.module.sales.entity.LngCustomerBank;
|
||||
@ -25,8 +20,10 @@ import com.xjrsoft.module.sales.mapper.LngCustomerContactMapper;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerDocMapper;
|
||||
import com.xjrsoft.module.sales.mapper.LngCustomerMapper;
|
||||
import com.xjrsoft.module.sales.service.ICustomerService;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerDocVo;
|
||||
import com.xjrsoft.module.sales.vo.LngCustomerVo;
|
||||
import com.xjrsoft.module.system.client.IFileClient;
|
||||
import com.xjrsoft.module.system.dto.LngFileUploadBindDto;
|
||||
import com.xjrsoft.module.system.vo.LngFileUploadVo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
@ -51,238 +48,7 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
private final IFileClient fileClient;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long add(UpdateLngCustomerDto updateLngCustomerDto) {
|
||||
|
||||
LngCustomer lngCustomer = new LngCustomer();
|
||||
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
|
||||
lngCustomerMapper.insert(lngCustomer);
|
||||
for (UpdateLngCustomerAttrPowerDto updateLngCustomerAttrPowerDto : updateLngCustomerDto.getLngCustomerAttrPowerList()) {
|
||||
LngCustomerAttrPower lngCustomerAttrPower = new LngCustomerAttrPower();
|
||||
BeanUtil.copyProperties(updateLngCustomerAttrPowerDto, lngCustomerAttrPower);
|
||||
lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerAttrPowerMapper.insert(lngCustomerAttrPower);
|
||||
}
|
||||
for (UpdateLngCustomerBankDto updateLngCustomerBankDto : updateLngCustomerDto.getLngCustomerBankList()) {
|
||||
LngCustomerBank lngCustomerBank = new LngCustomerBank();
|
||||
BeanUtil.copyProperties(updateLngCustomerBankDto, lngCustomerBank);
|
||||
lngCustomerBank.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerBankMapper.insert(lngCustomerBank);
|
||||
}
|
||||
for (UpdateLngCustomerDocDto updateLngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) {
|
||||
LngCustomerDoc lngCustomerDoc = new LngCustomerDoc();
|
||||
BeanUtil.copyProperties(updateLngCustomerDocDto, lngCustomerDoc);
|
||||
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
||||
|
||||
if(CollectionUtil.isNotEmpty(updateLngCustomerDocDto.getFileList())) {
|
||||
LngFileUploadBindDto bindDto = new LngFileUploadBindDto();
|
||||
bindDto.setTableId(updateLngCustomerDocDto.getId());
|
||||
bindDto.setTableName("lng_customer_doc");
|
||||
bindDto.setColumnName("fileList");
|
||||
bindDto.setFiles(updateLngCustomerDocDto.getFileList());
|
||||
fileClient.bindTableData(bindDto);
|
||||
}
|
||||
|
||||
}
|
||||
for (UpdateLngCustomerContactDto updateLngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
|
||||
LngCustomerContact lngCustomerContact = new LngCustomerContact();
|
||||
BeanUtil.copyProperties(updateLngCustomerContactDto, lngCustomerContact);
|
||||
lngCustomerContact.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerContactMapper.insert(lngCustomerContact);
|
||||
}
|
||||
if(updateLngCustomerDto.getLngFileUploadList() != null) {
|
||||
LngFileUploadBindDto bindDto = new LngFileUploadBindDto();
|
||||
bindDto.setTableId(updateLngCustomerDto.getId());
|
||||
bindDto.setTableName("lng_customer");
|
||||
bindDto.setColumnName("lngFileUploadList");
|
||||
bindDto.setFiles(updateLngCustomerDto.getLngFileUploadList());
|
||||
fileClient.bindTableData(bindDto);
|
||||
|
||||
}
|
||||
|
||||
return lngCustomer.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(UpdateLngCustomerDto updateLngCustomerDto) {
|
||||
LngCustomer lngCustomer = new LngCustomer();
|
||||
BeanUtil.copyProperties(updateLngCustomerDto, lngCustomer);
|
||||
lngCustomerMapper.updateById(lngCustomer);
|
||||
//********************************* LngCustomerAttrPower 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngCustomerAttrPower> lngCustomerAttrPowerList = lngCustomerAttrPowerMapper.selectList(Wrappers.lambdaQuery(LngCustomerAttrPower.class).eq(LngCustomerAttrPower::getCuCode, lngCustomer.getCuCode()).select(LngCustomerAttrPower::getId));
|
||||
List<Long> lngCustomerAttrPowerIds = lngCustomerAttrPowerList.stream().map(LngCustomerAttrPower::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngCustomerAttrPowerOldIds = updateLngCustomerDto.getLngCustomerAttrPowerList().stream().map(UpdateLngCustomerAttrPowerDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngCustomerAttrPowerRemoveIds = lngCustomerAttrPowerIds.stream().filter(item -> !lngCustomerAttrPowerOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (UpdateLngCustomerAttrPowerDto lngCustomerAttrPowerDto : updateLngCustomerDto.getLngCustomerAttrPowerList()) {
|
||||
LngCustomerAttrPower lngCustomerAttrPower = new LngCustomerAttrPower();
|
||||
BeanUtil.copyProperties(lngCustomerAttrPowerDto, lngCustomerAttrPower);
|
||||
//如果不等于空则修改
|
||||
if (lngCustomerAttrPower.getId() != null) {
|
||||
|
||||
lngCustomerAttrPowerMapper.updateById(lngCustomerAttrPower);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngCustomerAttrPower.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerAttrPowerMapper.insert(lngCustomerAttrPower);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngCustomerAttrPowerRemoveIds.size() > 0){
|
||||
lngCustomerAttrPowerMapper.deleteBatchIds(lngCustomerAttrPowerRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngCustomerAttrPower 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngCustomerBank 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngCustomerBank> lngCustomerBankList = lngCustomerBankMapper.selectList(Wrappers.lambdaQuery(LngCustomerBank.class).eq(LngCustomerBank::getCuCode, lngCustomer.getCuCode()).select(LngCustomerBank::getId));
|
||||
List<Long> lngCustomerBankIds = lngCustomerBankList.stream().map(LngCustomerBank::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngCustomerBankOldIds = updateLngCustomerDto.getLngCustomerBankList().stream().map(UpdateLngCustomerBankDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngCustomerBankRemoveIds = lngCustomerBankIds.stream().filter(item -> !lngCustomerBankOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (UpdateLngCustomerBankDto lngCustomerBankDto : updateLngCustomerDto.getLngCustomerBankList()) {
|
||||
LngCustomerBank lngCustomerBank = new LngCustomerBank();
|
||||
BeanUtil.copyProperties(lngCustomerBankDto, lngCustomerBank);
|
||||
//如果不等于空则修改
|
||||
if (lngCustomerBank.getId() != null) {
|
||||
lngCustomerBankMapper.updateById(lngCustomerBank);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngCustomerBank.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerBankMapper.insert(lngCustomerBank);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngCustomerBankRemoveIds.size() > 0){
|
||||
lngCustomerBankMapper.deleteBatchIds(lngCustomerBankRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngCustomerBank 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngCustomerDoc 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngCustomerDoc> lngCustomerDocList = lngCustomerDocMapper.selectList(Wrappers.lambdaQuery(LngCustomerDoc.class).eq(LngCustomerDoc::getCuCode, lngCustomer.getCuCode()).select(LngCustomerDoc::getId));
|
||||
List<Long> lngCustomerDocIds = lngCustomerDocList.stream().map(LngCustomerDoc::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngCustomerDocOldIds = updateLngCustomerDto.getLngCustomerDocList().stream().map(UpdateLngCustomerDocDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngCustomerDocRemoveIds = lngCustomerDocIds.stream().filter(item -> !lngCustomerDocOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (UpdateLngCustomerDocDto lngCustomerDocDto : updateLngCustomerDto.getLngCustomerDocList()) {
|
||||
LngCustomerDoc lngCustomerDoc = new LngCustomerDoc();
|
||||
BeanUtil.copyProperties(lngCustomerDocDto, lngCustomerDoc);
|
||||
//如果不等于空则修改
|
||||
if (lngCustomerDoc.getId() != null) {
|
||||
|
||||
lngCustomerDocMapper.updateById(lngCustomerDoc);
|
||||
//lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").eq(LngFileUpload::getTableId, lngCustomerDoc.getId()));
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngCustomerDoc.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerDocMapper.insert(lngCustomerDoc);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(lngCustomerDocDto.getFileList())) {
|
||||
// for(UpdateLngFileUploadDto lngFileUploadDto:lngCustomerDocDto.getFileList()) {
|
||||
// LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
// BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
||||
// lngFileUpload.setTableName("lng_customer_doc");
|
||||
// lngFileUpload.setTableId(lngCustomerDoc.getId());
|
||||
// lngFileUploadMapper.insert(lngFileUpload);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngCustomerDocRemoveIds.size() > 0){
|
||||
lngCustomerDocMapper.deleteBatchIds(lngCustomerDocRemoveIds);
|
||||
//lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer_doc").in(LngFileUpload::getTableId, lngCustomerDocRemoveIds));
|
||||
|
||||
}
|
||||
}
|
||||
//********************************* LngCustomerDoc 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngCustomerContact 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngCustomerContact> lngCustomerContactList = lngCustomerContactMapper.selectList(Wrappers.lambdaQuery(LngCustomerContact.class).eq(LngCustomerContact::getCuCode, lngCustomer.getCuCode()).select(LngCustomerContact::getId));
|
||||
List<Long> lngCustomerContactIds = lngCustomerContactList.stream().map(LngCustomerContact::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngCustomerContactOldIds = updateLngCustomerDto.getLngCustomerContactList().stream().map(UpdateLngCustomerContactDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngCustomerContactRemoveIds = lngCustomerContactIds.stream().filter(item -> !lngCustomerContactOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (UpdateLngCustomerContactDto lngCustomerContactDto : updateLngCustomerDto.getLngCustomerContactList()) {
|
||||
LngCustomerContact lngCustomerContact = new LngCustomerContact();
|
||||
BeanUtil.copyProperties(lngCustomerContactDto, lngCustomerContact);
|
||||
//如果不等于空则修改
|
||||
if (lngCustomerContact.getId() != null) {
|
||||
lngCustomerContactMapper.updateById(lngCustomerContact);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngCustomerContact.setCuCode(lngCustomer.getCuCode());
|
||||
lngCustomerContactMapper.insert(lngCustomerContact);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngCustomerContactRemoveIds.size() > 0){
|
||||
lngCustomerContactMapper.deleteBatchIds(lngCustomerContactRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngCustomerContact 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngFileUpload 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
// List<LngFileUpload> lngFileUploadList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableName, "lng_customer").eq(LngFileUpload::getTableId, lngCustomer.getId()).select(LngFileUpload::getId));
|
||||
// List<Long> lngFileUploadIds = lngFileUploadList.stream().map(LngFileUpload::getId).collect(Collectors.toList());
|
||||
// //原有子表单 没有被删除的主键
|
||||
// List<Long> lngFileUploadOldIds = updateLngCustomerDto.getLngFileUploadList().stream().map(UpdateLngFileUploadDto::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
// //找到需要删除的id
|
||||
// List<Long> lngFileUploadRemoveIds = lngFileUploadIds.stream().filter(item -> !lngFileUploadOldIds.contains(item)).collect(Collectors.toList());
|
||||
//
|
||||
// for (UpdateLngFileUploadDto lngFileUploadDto : updateLngCustomerDto.getLngFileUploadList()) {
|
||||
// LngFileUpload lngFileUpload = new LngFileUpload();
|
||||
// BeanUtil.copyProperties(lngFileUploadDto, lngFileUpload);
|
||||
// lngFileUpload.setTableName("lng_customer");
|
||||
// //如果不等于空则修改
|
||||
// if (lngFileUpload.getId() != null) {
|
||||
// lngFileUploadMapper.updateById(lngFileUpload);
|
||||
// }
|
||||
// //如果等于空 则新增
|
||||
// else {
|
||||
// lngFileUpload.setTableId(lngCustomer.getId());
|
||||
// lngFileUploadMapper.insert(lngFileUpload);
|
||||
// }
|
||||
// }
|
||||
// //已经不存在的id 删除
|
||||
// if(lngFileUploadRemoveIds.size() > 0){
|
||||
// lngFileUploadMapper.deleteBatchIds(lngFileUploadRemoveIds);
|
||||
// }
|
||||
}
|
||||
//********************************* LngFileUpload 增删改 结束 *******************************************/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
@ -294,38 +60,26 @@ public class CustomerServiceImpl extends MPJBaseServiceImpl<LngCustomerMapper, L
|
||||
lngCustomerBankMapper.delete(Wrappers.lambdaQuery(LngCustomerBank.class).in(LngCustomerBank::getCuCode, cuCodeList));
|
||||
lngCustomerDocMapper.delete(Wrappers.lambdaQuery(LngCustomerDoc.class).in(LngCustomerDoc::getCuCode, cuCodeList));
|
||||
lngCustomerContactMapper.delete(Wrappers.lambdaQuery(LngCustomerContact.class).in(LngCustomerContact::getCuCode, cuCodeList));
|
||||
// lngFileUploadMapper.delete(Wrappers.lambdaQuery(LngFileUpload.class).in(LngFileUpload::getTableId, ids).eq(LngFileUpload::getTableName, "lng_customer"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LngCustomer getCustomerById(Long id) {
|
||||
public LngCustomerVo getCustomerById(Long id) {
|
||||
|
||||
LngCustomer lngCustomer = this.getByIdDeep(id);
|
||||
if(lngCustomer == null) {
|
||||
return null;
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(lngCustomer.getLngCustomerDocList())) {
|
||||
for(LngCustomerDoc lngCustomerDoc: lngCustomer.getLngCustomerDocList()) {
|
||||
// List<LngFileUpload> tempList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomerDoc.getId()).eq(LngFileUpload::getTableName, "lng_customer_doc"));
|
||||
// if(CollectionUtil.isNotEmpty(tempList)) {
|
||||
// CloudStorageService storageService = OssFactory.build();
|
||||
// tempList.forEach(file -> {
|
||||
// file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
|
||||
// });
|
||||
// lngCustomerDoc.setFileList(tempList);
|
||||
// }
|
||||
LngCustomerVo vo = BeanUtil.toBean(lngCustomer, LngCustomerVo.class);
|
||||
if(CollectionUtil.isNotEmpty(vo.getLngCustomerDocList())) {
|
||||
for(LngCustomerDocVo lngCustomerDoc: vo.getLngCustomerDocList()) {
|
||||
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_customer_doc", "fileList", lngCustomerDoc.getId());
|
||||
lngCustomerDoc.setFileList(fileList);
|
||||
}
|
||||
}
|
||||
// List<LngFileUpload> fileList = lngFileUploadMapper.selectList(Wrappers.lambdaQuery(LngFileUpload.class).eq(LngFileUpload::getTableId, lngCustomer.getId()).eq(LngFileUpload::getTableName, "lng_customer"));
|
||||
// if (CollUtil.isNotEmpty(fileList)) {
|
||||
// CloudStorageService storageService = OssFactory.build();
|
||||
// fileList.forEach(file -> {
|
||||
// file.setPresignedUrl(storageService.fixUrl(file.getFilePath()));
|
||||
// });
|
||||
// }
|
||||
//lngCustomer.setLngFileUploadList(fileList);
|
||||
return lngCustomer;
|
||||
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_customer", "lngFileUploadList", vo.getId());
|
||||
vo.setLngFileUploadList(fileList);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.xjrsoft.module.sales.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.sales.entity.LngScoreDtl;
|
||||
import com.xjrsoft.module.sales.mapper.LngScoreDtlMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngScore;
|
||||
import com.xjrsoft.module.sales.mapper.LngScoreMapper;
|
||||
import com.xjrsoft.module.sales.service.IScoreCustomerService;
|
||||
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 ScoreCustomerServiceImpl extends MPJBaseServiceImpl<LngScoreMapper, LngScore> implements IScoreCustomerService {
|
||||
private final LngScoreMapper scoreCustomerLngScoreMapper;
|
||||
|
||||
private final LngScoreDtlMapper scoreCustomerLngScoreDtlMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(LngScore lngScore) {
|
||||
scoreCustomerLngScoreMapper.insert(lngScore);
|
||||
for (LngScoreDtl lngScoreDtl : lngScore.getLngScoreDtlList()) {
|
||||
lngScoreDtl.setSId(lngScore.getId());
|
||||
scoreCustomerLngScoreDtlMapper.insert(lngScoreDtl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(LngScore lngScore) {
|
||||
scoreCustomerLngScoreMapper.updateById(lngScore);
|
||||
//********************************* LngScoreDtl 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngScoreDtl> lngScoreDtlList = scoreCustomerLngScoreDtlMapper.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) {
|
||||
scoreCustomerLngScoreDtlMapper.updateById(lngScoreDtl);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngScoreDtl.setSId(lngScore.getId());
|
||||
scoreCustomerLngScoreDtlMapper.insert(lngScoreDtl);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngScoreDtlRemoveIds.size() > 0){
|
||||
scoreCustomerLngScoreDtlMapper.deleteBatchIds(lngScoreDtlRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngScoreDtl 增删改 结束 *******************************************/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
scoreCustomerLngScoreMapper.deleteBatchIds(ids);
|
||||
scoreCustomerLngScoreDtlMapper.delete(Wrappers.lambdaQuery(LngScoreDtl.class).in(LngScoreDtl::getSId, ids));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
package com.xjrsoft.module.supplier.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.supplier.dto.AddLngScoreDto;
|
||||
import com.xjrsoft.module.supplier.dto.UpdateLngScoreDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.supplier.dto.LngScorePageDto;
|
||||
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.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.supplier.vo.LngScoreVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 供应商评价
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/supplier" + "/scoreSupplier")
|
||||
@Api(value = "/supplier" + "/scoreSupplier",tags = "供应商评价代码")
|
||||
@AllArgsConstructor
|
||||
public class ScoreSupplierController {
|
||||
|
||||
|
||||
private final IScoreSupplierService scoreSupplierService;
|
||||
private final DatalogService dataService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngScore列表(分页)")
|
||||
@SaCheckPermission("scoreSupplier:list")
|
||||
public R page(@Valid LngScorePageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getCpCode()),LngScore::getCpCode,dto.getCpCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getGsId()),LngScore::getGsId,dto.getGsId())
|
||||
.between(ObjectUtil.isNotNull(dto.getDateGradeStart()) && ObjectUtil.isNotNull(dto.getDateGradeEnd()),LngScore::getDateGrade,dto.getDateGradeStart(),dto.getDateGradeEnd())
|
||||
.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()));
|
||||
IPage<LngScore> page = scoreSupplierService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngScorePageVo> pageOutput = ConventPage.getPageOutput(page, LngScorePageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@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));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngScore数据详细日志")
|
||||
@SaCheckPermission("scoreSupplier:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngScoreDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngScore")
|
||||
@SaCheckPermission("scoreSupplier:add")
|
||||
public R add(@Valid @RequestBody UpdateLngScoreDto dto){
|
||||
UpdateLngScoreDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngScore")
|
||||
@SaCheckPermission("scoreSupplier:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngScoreDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("scoreSupplier:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngScoreDto.class, ids));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,36 +1,41 @@
|
||||
package com.xjrsoft.module.supplier.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
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.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.supplier.dto.AddLngSupplierDto;
|
||||
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngCustomerDto;
|
||||
import com.xjrsoft.module.supplier.dto.LngSupplierPageDto;
|
||||
import com.xjrsoft.module.supplier.dto.UpdateLngSupplierDto;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import com.xjrsoft.module.supplier.service.ISupplierService;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierPageVo;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
||||
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 javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 供应商
|
||||
@ -39,14 +44,19 @@ import java.util.List;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/supplier" + "/supplier")
|
||||
@Api(value = "/supplier" + "/supplier",tags = "供应商代码")
|
||||
@RequestMapping("/supplier/supplier")
|
||||
@Api(value = "/supplier/supplier",tags = "供应商代码")
|
||||
@AllArgsConstructor
|
||||
public class SupplierController {
|
||||
|
||||
|
||||
private final ISupplierService supplierService;
|
||||
private final DatalogService dataService;
|
||||
|
||||
|
||||
private final ICodeRuleClient codeRuleClient;
|
||||
|
||||
private final String SUPPLIER_CODE = "supplierCode";
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngSupplier列表(分页)")
|
||||
@ -61,7 +71,7 @@ public class SupplierController {
|
||||
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngSupplier::getTypeCode,dto.getTypeCode())
|
||||
.like(StrUtil.isNotBlank(dto.getClassCode()),LngSupplier::getClassCode,dto.getClassCode())
|
||||
.like(StrUtil.isNotBlank(dto.getDI()),LngSupplier::getDI,dto.getDI())
|
||||
.like(StrUtil.isNotBlank(dto.getValid()),LngSupplier::getValid,dto.getValid())
|
||||
.eq(StrUtil.isNotBlank(dto.getValid()),LngSupplier::getValid,dto.getValid())
|
||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngSupplier::getApproCode,dto.getApproCode())
|
||||
.orderByDesc(LngSupplier::getId)
|
||||
.select(LngSupplier.class,x -> VoToColumnUtil.fieldsToColumns(LngSupplierPageVo.class).contains(x.getProperty()));
|
||||
@ -74,11 +84,7 @@ public class SupplierController {
|
||||
@ApiOperation(value="根据id查询LngSupplier信息")
|
||||
@SaCheckPermission("supplier:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
LngSupplier lngSupplier = supplierService.getByIdDeep(id);
|
||||
if (lngSupplier == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngSupplier, LngSupplierVo.class));
|
||||
return R.ok(supplierService.getSupplierById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ -94,8 +100,11 @@ public class SupplierController {
|
||||
@ApiOperation(value = "新增LngSupplier")
|
||||
@SaCheckPermission("supplier:add")
|
||||
public R add(@Valid @RequestBody UpdateLngSupplierDto dto){
|
||||
String code = codeRuleClient.genEncode(SUPPLIER_CODE);
|
||||
dto.setSuCode("S"+code);
|
||||
UpdateLngSupplierDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
codeRuleClient.useEncode(SUPPLIER_CODE);
|
||||
return R.ok(res);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -109,7 +118,7 @@ public class SupplierController {
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("supplier:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngSupplierDto.class, ids));
|
||||
return R.ok(dataService.deleteByIds(UpdateLngSupplierDto.class, ids));
|
||||
|
||||
}
|
||||
|
||||
@ -117,7 +126,7 @@ public class SupplierController {
|
||||
@ApiOperation(value = "启用LngSupplier")
|
||||
@SaCheckPermission("supplier:enable")
|
||||
public R enable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids));
|
||||
return R.ok(dataService.enable(UpdateLngSupplierDto.class,ids));
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +134,7 @@ public class SupplierController {
|
||||
@ApiOperation(value = "禁用LngSupplier")
|
||||
@SaCheckPermission("supplier:disable")
|
||||
public R disable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids));
|
||||
return R.ok(dataService.disable(UpdateLngSupplierDto.class,ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,139 @@
|
||||
package com.xjrsoft.module.supplier.entity;
|
||||
|
||||
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.github.yulichang.annotation.EntityMapping;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 供应商评价
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_score")
|
||||
@ApiModel(value = "供应商评价对象", description = "供应商评价")
|
||||
public class LngScore implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评分日期
|
||||
*/
|
||||
@ApiModelProperty("评分日期")
|
||||
private LocalDateTime dateGrade;
|
||||
|
||||
/**
|
||||
* 评价体系主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系主键")
|
||||
private Long gsId;
|
||||
|
||||
/**
|
||||
* 表名(隐藏,供应商/客户/承运商表名;应与评价体系的对象一致)
|
||||
*/
|
||||
@ApiModelProperty("表名(隐藏,供应商/客户/承运商表名;应与评价体系的对象一致)")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 供应商/客户
|
||||
*/
|
||||
@ApiModelProperty("供应商/客户")
|
||||
private String cpCode;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
@ApiModelProperty("分数")
|
||||
private BigDecimal score;
|
||||
|
||||
/**
|
||||
* 审批状态(未审批/审批中/已审批/已驳回)
|
||||
*/
|
||||
@ApiModelProperty("审批状态(未审批/审批中/已审批/已驳回)")
|
||||
private String approCode;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
/**
|
||||
* lngScoreDtl
|
||||
*/
|
||||
@ApiModelProperty("lngScoreDtl子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "id", joinField = "sId")
|
||||
private List<LngScoreDtl> lngScoreDtlList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,168 @@
|
||||
package com.xjrsoft.module.supplier.entity;
|
||||
|
||||
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.github.yulichang.annotation.EntityMapping;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 供应商评价
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_score_dtl")
|
||||
@ApiModel(value = "供应商评价对象", description = "供应商评价")
|
||||
public class LngScoreDtl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评分信息主键
|
||||
*/
|
||||
@ApiModelProperty("评分信息主键")
|
||||
private Long sId;
|
||||
|
||||
/**
|
||||
* 评价体系主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系主键")
|
||||
private Long gsId;
|
||||
|
||||
/**
|
||||
* 评价体系-条目主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系-条目主键")
|
||||
private Long gsiId;
|
||||
|
||||
/**
|
||||
* 评分事项(只读)
|
||||
*/
|
||||
@ApiModelProperty("评分事项(只读)")
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 评分标准(只读)
|
||||
*/
|
||||
@ApiModelProperty("评分标准(只读)")
|
||||
private String itemDesc;
|
||||
|
||||
/**
|
||||
* 评分部门(只读)
|
||||
*/
|
||||
@ApiModelProperty("评分部门(只读)")
|
||||
private String eDeptCode;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@ApiModelProperty("显示顺序")
|
||||
private Short sort;
|
||||
|
||||
/**
|
||||
* 实际评分部门编码(当前登录人所在部门)
|
||||
*/
|
||||
@ApiModelProperty("实际评分部门编码(当前登录人所在部门)")
|
||||
private String aDeptCode;
|
||||
|
||||
/**
|
||||
* 实际评分人编码(当前登录人)
|
||||
*/
|
||||
@ApiModelProperty("实际评分人编码(当前登录人)")
|
||||
private String aEmpCode;
|
||||
|
||||
/**
|
||||
* 实际评分时间
|
||||
*/
|
||||
@ApiModelProperty("实际评分时间")
|
||||
private Object aTime;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
@ApiModelProperty("分数")
|
||||
private BigDecimal score;
|
||||
|
||||
/**
|
||||
* 分数说明
|
||||
*/
|
||||
@ApiModelProperty("分数说明")
|
||||
private String scoreDesc;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.supplier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngScoreDtl;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngSupplierScoreDtlMapper extends MPJBaseMapper<LngScoreDtl> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.module.supplier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngScore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngSupplierScoreMapper extends MPJBaseMapper<LngScore> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.module.supplier.service;
|
||||
|
||||
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.entity.LngScore;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-17
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface IScoreSupplierService extends MPJBaseService<LngScore>, MPJDeepService<LngScore>, MPJRelationService<LngScore> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngScore
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngScore lngScore);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngScore
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngScore lngScore);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
}
|
||||
@ -5,6 +5,8 @@ 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.LngSupplier;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@ -16,21 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepService<LngSupplier>, MPJRelationService<LngSupplier> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngSupplier
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngSupplier lngSupplier);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngSupplier
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngSupplier lngSupplier);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
@ -39,4 +27,6 @@ public interface ISupplierService extends MPJBaseService<LngSupplier>, MPJDeepSe
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
|
||||
LngSupplierVo getSupplierById(Long id);
|
||||
}
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,29 @@
|
||||
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.LngSupplierBank;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierBankMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierContactMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierDoc;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierDocMapper;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierMapper;
|
||||
import com.xjrsoft.module.supplier.service.ISupplierService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplier;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierBank;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierContact;
|
||||
import com.xjrsoft.module.supplier.entity.LngSupplierDoc;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierBankMapper;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierContactMapper;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierDocMapper;
|
||||
import com.xjrsoft.module.supplier.mapper.LngSupplierMapper;
|
||||
import com.xjrsoft.module.supplier.service.ISupplierService;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierDocVo;
|
||||
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -33,121 +39,8 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
|
||||
private final LngSupplierBankMapper supplierLngSupplierBankMapper;
|
||||
private final LngSupplierContactMapper supplierLngSupplierContactMapper;
|
||||
private final LngSupplierDocMapper supplierLngSupplierDocMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(LngSupplier lngSupplier) {
|
||||
supplierLngSupplierMapper.insert(lngSupplier);
|
||||
for (LngSupplierBank lngSupplierBank : lngSupplier.getLngSupplierBankList()) {
|
||||
lngSupplierBank.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierBankMapper.insert(lngSupplierBank);
|
||||
}
|
||||
for (LngSupplierContact lngSupplierContact : lngSupplier.getLngSupplierContactList()) {
|
||||
lngSupplierContact.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierContactMapper.insert(lngSupplierContact);
|
||||
}
|
||||
for (LngSupplierDoc lngSupplierDoc : lngSupplier.getLngSupplierDocList()) {
|
||||
lngSupplierDoc.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierDocMapper.insert(lngSupplierDoc);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(LngSupplier lngSupplier) {
|
||||
supplierLngSupplierMapper.updateById(lngSupplier);
|
||||
//********************************* LngSupplierBank 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngSupplierBank> lngSupplierBankList = supplierLngSupplierBankMapper.selectList(Wrappers.lambdaQuery(LngSupplierBank.class).eq(LngSupplierBank::getSuCode, lngSupplier.getSuCode()).select(LngSupplierBank::getId));
|
||||
List<Long> lngSupplierBankIds = lngSupplierBankList.stream().map(LngSupplierBank::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngSupplierBankOldIds = lngSupplier.getLngSupplierBankList().stream().map(LngSupplierBank::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngSupplierBankRemoveIds = lngSupplierBankIds.stream().filter(item -> !lngSupplierBankOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngSupplierBank lngSupplierBank : lngSupplier.getLngSupplierBankList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngSupplierBank.getId() != null) {
|
||||
supplierLngSupplierBankMapper.updateById(lngSupplierBank);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngSupplierBank.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierBankMapper.insert(lngSupplierBank);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngSupplierBankRemoveIds.size() > 0){
|
||||
supplierLngSupplierBankMapper.deleteBatchIds(lngSupplierBankRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngSupplierBank 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngSupplierContact 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngSupplierContact> lngSupplierContactList = supplierLngSupplierContactMapper.selectList(Wrappers.lambdaQuery(LngSupplierContact.class).eq(LngSupplierContact::getSuCode, lngSupplier.getSuCode()).select(LngSupplierContact::getId));
|
||||
List<Long> lngSupplierContactIds = lngSupplierContactList.stream().map(LngSupplierContact::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngSupplierContactOldIds = lngSupplier.getLngSupplierContactList().stream().map(LngSupplierContact::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngSupplierContactRemoveIds = lngSupplierContactIds.stream().filter(item -> !lngSupplierContactOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngSupplierContact lngSupplierContact : lngSupplier.getLngSupplierContactList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngSupplierContact.getId() != null) {
|
||||
supplierLngSupplierContactMapper.updateById(lngSupplierContact);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngSupplierContact.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierContactMapper.insert(lngSupplierContact);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngSupplierContactRemoveIds.size() > 0){
|
||||
supplierLngSupplierContactMapper.deleteBatchIds(lngSupplierContactRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngSupplierContact 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngSupplierDoc 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngSupplierDoc> lngSupplierDocList = supplierLngSupplierDocMapper.selectList(Wrappers.lambdaQuery(LngSupplierDoc.class).eq(LngSupplierDoc::getSuCode, lngSupplier.getSuCode()).select(LngSupplierDoc::getId));
|
||||
List<Long> lngSupplierDocIds = lngSupplierDocList.stream().map(LngSupplierDoc::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngSupplierDocOldIds = lngSupplier.getLngSupplierDocList().stream().map(LngSupplierDoc::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngSupplierDocRemoveIds = lngSupplierDocIds.stream().filter(item -> !lngSupplierDocOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngSupplierDoc lngSupplierDoc : lngSupplier.getLngSupplierDocList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngSupplierDoc.getId() != null) {
|
||||
supplierLngSupplierDocMapper.updateById(lngSupplierDoc);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngSupplierDoc.setSuCode(lngSupplier.getSuCode());
|
||||
supplierLngSupplierDocMapper.insert(lngSupplierDoc);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngSupplierDocRemoveIds.size() > 0){
|
||||
supplierLngSupplierDocMapper.deleteBatchIds(lngSupplierDocRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngSupplierDoc 增删改 结束 *******************************************/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private final IFileClient fileClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -159,4 +52,24 @@ public class SupplierServiceImpl extends MPJBaseServiceImpl<LngSupplierMapper, L
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LngSupplierVo getSupplierById(Long id) {
|
||||
LngSupplier lngSupplier = this.getByIdDeep(id);
|
||||
if(lngSupplier == null) {
|
||||
return null;
|
||||
}
|
||||
LngSupplierVo vo = BeanUtil.toBean(lngSupplier, LngSupplierVo.class);
|
||||
if(CollectionUtil.isNotEmpty(vo.getLngSupplierDocList())) {
|
||||
for(LngSupplierDocVo lngSupplierDoc: vo.getLngSupplierDocList()) {
|
||||
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_Supplier_doc", "fileList", lngSupplierDoc.getId());
|
||||
lngSupplierDoc.setFileList(fileList);
|
||||
}
|
||||
}
|
||||
List<LngFileUploadVo> fileList = fileClient.getTableFiles("lng_Supplier", "lngFileUploadList", vo.getId());
|
||||
vo.setLngFileUploadList(fileList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user