refactor(sip): 优化客户名称相关术语并完善发货单删除功能
- 将"客户名称"统一修改为"最终客户名称",以提升术语一致性 - 在 DeliveryListMapper 中新增删除多条发货记录的功能 - 优化 ProjectInfoServiceImpl 中的日志记录方法 - 修复 OrderDeliveryServiceImpl 中删除发货单的逻辑master
parent
bf8cedec44
commit
99cdcf8e4e
|
@ -128,7 +128,9 @@ public class ProjectInfo extends BaseEntity
|
||||||
private Boolean highlight;
|
private Boolean highlight;
|
||||||
private Boolean canGenerate;
|
private Boolean canGenerate;
|
||||||
/** 项目产品信息 */
|
/** 项目产品信息 */
|
||||||
private List<ProjectProductInfo> projectProductInfoList;
|
private List<ProjectProductInfo> softwareProjectProductInfoList;
|
||||||
|
private List<ProjectProductInfo> hardwareProjectProductInfoList;
|
||||||
|
private List<ProjectProductInfo> maintenanceProjectProductInfoList;
|
||||||
|
|
||||||
/** 项目操作日志信息 */
|
/** 项目操作日志信息 */
|
||||||
private List<ProjectOperateLog> projectOperateLogList;
|
private List<ProjectOperateLog> projectOperateLogList;
|
||||||
|
|
|
@ -70,5 +70,6 @@ public class ProjectProductInfo extends BaseEntity
|
||||||
/** 折扣 */
|
/** 折扣 */
|
||||||
@Excel(name = "折扣")
|
@Excel(name = "折扣")
|
||||||
private BigDecimal discount;
|
private BigDecimal discount;
|
||||||
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,4 +62,6 @@ public interface ProjectProductInfoMapper
|
||||||
List<ProjectProductInfo> selectProjectProductInfoListByProjectId(Long projectId);
|
List<ProjectProductInfo> selectProjectProductInfoListByProjectId(Long projectId);
|
||||||
|
|
||||||
void saveBatch(List<ProjectProductInfo> addList);
|
void saveBatch(List<ProjectProductInfo> addList);
|
||||||
|
|
||||||
|
void updateBatch(List<ProjectProductInfo> updateList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,12 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
}
|
}
|
||||||
//查询产品信息
|
//查询产品信息
|
||||||
List<ProjectProductInfo> projectProductInfos = productInfoService.selectProjectProductInfoListByProjectId(projectInfo.getId());
|
List<ProjectProductInfo> projectProductInfos = productInfoService.selectProjectProductInfoListByProjectId(projectInfo.getId());
|
||||||
projectInfo.setProjectProductInfoList(projectProductInfos);
|
Map<String, List<ProjectProductInfo>> productListMap = projectProductInfos.stream().collect(Collectors.groupingBy(ProjectProductInfo::getType));
|
||||||
|
projectInfo.setSoftwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.SOFTWARE.getType()));
|
||||||
|
projectInfo.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
|
||||||
|
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
|
||||||
|
projectInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
||||||
//查询变更记录信息
|
//查询变更记录信息
|
||||||
List<ProjectWorkProgress> projectWorkProgresses = workProgressService.selectProjectWorkProgressListByProjectId((projectInfo.getId()));
|
List<ProjectWorkProgress> projectWorkProgresses = workProgressService.selectProjectWorkProgressListByProjectId((projectInfo.getId()));
|
||||||
projectInfo.setProjectWorkProgressList(projectWorkProgresses);
|
projectInfo.setProjectWorkProgressList(projectWorkProgresses);
|
||||||
|
@ -145,7 +150,12 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
|
|
||||||
private void saveOtherInfo(ProjectInfo projectInfo1) {
|
private void saveOtherInfo(ProjectInfo projectInfo1) {
|
||||||
//插入产品信息
|
//插入产品信息
|
||||||
List<ProjectProductInfo> projectProductInfoList = projectInfo1.getProjectProductInfoList();
|
List<ProjectProductInfo> projectProductInfoList = projectInfo1.getHardwareProjectProductInfoList();
|
||||||
|
if (CollUtil.isEmpty(projectProductInfoList)) {
|
||||||
|
projectProductInfoList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
projectProductInfoList.addAll(CollUtil.isNotEmpty(projectInfo1.getSoftwareProjectProductInfoList()) ? projectInfo1.getSoftwareProjectProductInfoList() : new ArrayList<>());
|
||||||
|
projectProductInfoList.addAll(CollUtil.isNotEmpty(projectInfo1.getMaintenanceProjectProductInfoList()) ? projectInfo1.getMaintenanceProjectProductInfoList() : new ArrayList<>());
|
||||||
if (CollUtil.isNotEmpty(projectProductInfoList)) {
|
if (CollUtil.isNotEmpty(projectProductInfoList)) {
|
||||||
for (ProjectProductInfo projectProductInfo : projectProductInfoList) {
|
for (ProjectProductInfo projectProductInfo : projectProductInfoList) {
|
||||||
projectProductInfo.setProjectId(projectInfo1.getId());
|
projectProductInfo.setProjectId(projectInfo1.getId());
|
||||||
|
@ -155,6 +165,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
//插入变更记录信息
|
//插入变更记录信息
|
||||||
List<ProjectWorkProgress> projectWorkProgressList = projectInfo1.getProjectWorkProgressList();
|
List<ProjectWorkProgress> projectWorkProgressList = projectInfo1.getProjectWorkProgressList();
|
||||||
if (CollUtil.isNotEmpty(projectWorkProgressList)) {
|
if (CollUtil.isNotEmpty(projectWorkProgressList)) {
|
||||||
|
projectWorkProgressList = projectWorkProgressList.stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
||||||
for (ProjectWorkProgress workProgress : projectWorkProgressList) {
|
for (ProjectWorkProgress workProgress : projectWorkProgressList) {
|
||||||
workProgress.setProjectId(projectInfo1.getId());
|
workProgress.setProjectId(projectInfo1.getId());
|
||||||
workProgress.setWorkUser(ShiroUtils.getUserId().toString());
|
workProgress.setWorkUser(ShiroUtils.getUserId().toString());
|
||||||
|
@ -240,12 +251,25 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
logSimpleContent.append("1.项目信息发生变更\n");
|
logSimpleContent.append("1.项目信息发生变更\n");
|
||||||
}
|
}
|
||||||
// 配置信息变更
|
// 配置信息变更
|
||||||
List<ProjectProductInfo> oldProductList = oldProjectInfo.getProjectProductInfoList();
|
List<ProjectProductInfo> oldSoftWareProductList = oldProjectInfo.getSoftwareProjectProductInfoList();
|
||||||
|
|
||||||
List<ProjectProductInfo> newProductList = projectInfo.getProjectProductInfoList();
|
List<ProjectProductInfo> newSoftWareProductList = projectInfo.getSoftwareProjectProductInfoList();
|
||||||
|
|
||||||
// 比较产品信息
|
// 比较产品信息
|
||||||
logIndex = compareProductInfoList(logContent, logIndex, "配置", oldProductList, newProductList);
|
logIndex = compareProductInfoList(logContent, logIndex, "配置软件信息", oldSoftWareProductList, newSoftWareProductList);
|
||||||
|
|
||||||
|
List<ProjectProductInfo> oldHardwareProductList = oldProjectInfo.getHardwareProjectProductInfoList();
|
||||||
|
|
||||||
|
List<ProjectProductInfo> newHardwareProductList = projectInfo.getHardwareProjectProductInfoList();
|
||||||
|
|
||||||
|
// 比较产品信息
|
||||||
|
logIndex = compareProductInfoList(logContent, logIndex, "配置硬件信息", oldHardwareProductList, newHardwareProductList);
|
||||||
|
List<ProjectProductInfo> oldMaintenanceProductList = oldProjectInfo.getMaintenanceProjectProductInfoList();
|
||||||
|
|
||||||
|
List<ProjectProductInfo> newMaintenanceProductList = projectInfo.getMaintenanceProjectProductInfoList();
|
||||||
|
|
||||||
|
// 比较产品信息
|
||||||
|
logIndex = compareProductInfoList(logContent, logIndex, "配置硬件信息", oldMaintenanceProductList, newMaintenanceProductList);
|
||||||
|
|
||||||
if (logSimpleIndex != logIndex) {
|
if (logSimpleIndex != logIndex) {
|
||||||
logSimpleContent.append(StringUtils.isNotEmpty(logSimpleContent)?"1.":"2.").append("配置信息发生变更");
|
logSimpleContent.append(StringUtils.isNotEmpty(logSimpleContent)?"1.":"2.").append("配置信息发生变更");
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.sip.mapper.ProjectProductInfoMapper;
|
import com.ruoyi.sip.mapper.ProjectProductInfoMapper;
|
||||||
|
@ -95,16 +96,24 @@ public class ProjectProductInfoServiceImpl implements IProjectProductInfoService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveBatch(List<ProjectProductInfo> addList) {
|
public void saveBatch(List<ProjectProductInfo> list) {
|
||||||
List<ProjectProductInfo> projectProductInfos = projectProductInfoMapper.selectProjectProductInfoListByProjectId(addList.get(0).getProjectId());
|
List<ProjectProductInfo> projectProductInfos = projectProductInfoMapper.selectProjectProductInfoListByProjectId(list.get(0).getProjectId());
|
||||||
Set<Long> idSet = addList.stream().map(ProjectProductInfo::getId).collect(Collectors.toSet());
|
Set<Long> idSet = list.stream().map(ProjectProductInfo::getId).collect(Collectors.toSet());
|
||||||
String[] deleteIds = projectProductInfos.stream().filter(item -> !idSet.contains(item.getId())).map(item -> item.getId().toString()).toArray(String[]::new);
|
String[] deleteIds = projectProductInfos.stream().filter(item -> !idSet.contains(item.getId())).map(item -> item.getId().toString()).toArray(String[]::new);
|
||||||
//删除数据
|
//删除数据
|
||||||
if (deleteIds.length > 0) {
|
if (deleteIds.length > 0) {
|
||||||
projectProductInfoMapper.deleteProjectProductInfoByIds(deleteIds);
|
projectProductInfoMapper.deleteProjectProductInfoByIds(deleteIds);
|
||||||
}
|
}
|
||||||
|
List<ProjectProductInfo> insertList = list.stream().filter(item -> item.getId() == null).collect(Collectors.toList());
|
||||||
//新增数据
|
//新增数据
|
||||||
projectProductInfoMapper.saveBatch(addList);
|
if (CollUtil.isNotEmpty(insertList)) {
|
||||||
|
projectProductInfoMapper.saveBatch(insertList);
|
||||||
|
}
|
||||||
|
List<ProjectProductInfo> updateList = list.stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(updateList)) {
|
||||||
|
//更新数据
|
||||||
|
projectProductInfoMapper.updateBatch(updateList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectProjectProductInfoVo">
|
<sql id="selectProjectProductInfoVo">
|
||||||
select id, project_id, product_bom_code, model, product_code, product_desc, quantity, catalogue_price, catalogue_all_price, price, all_price, guidance_discount, discount, remark from project_product_info
|
select t1.id, t1.project_id, t1.product_bom_code, t1.model, t1.product_code, t1.product_desc, t1.quantity, t1.catalogue_price,
|
||||||
|
t1.catalogue_all_price, t1.price, t1.all_price, t1.guidance_discount, t1.discount, t1.remark from project_product_info t1
|
||||||
|
</sql>
|
||||||
|
<sql id="selectProjectProductRelationInfoVo">
|
||||||
|
select t1.id, t1.project_id, t1.product_bom_code, t1.model, t1.product_code, t1.product_desc, t1.quantity, t1.catalogue_price,
|
||||||
|
t1.catalogue_all_price, t1.price, t1.all_price, t1.guidance_discount, t1.discount, t1.remark,t2.type
|
||||||
|
from project_product_info t1
|
||||||
|
left join product_info t2 on t1.product_bom_code = t2.product_code
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectProjectProductInfoList" parameterType="ProjectProductInfo" resultMap="ProjectProductInfoResult">
|
<select id="selectProjectProductInfoList" parameterType="ProjectProductInfo" resultMap="ProjectProductInfoResult">
|
||||||
|
@ -48,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectProjectProductInfoListByProjectId" resultType="com.ruoyi.sip.domain.ProjectProductInfo">
|
<select id="selectProjectProductInfoListByProjectId" resultType="com.ruoyi.sip.domain.ProjectProductInfo">
|
||||||
<include refid="selectProjectProductInfoVo"/>
|
<include refid="selectProjectProductRelationInfoVo"/>
|
||||||
where project_id = #{projectId}
|
where project_id = #{projectId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -118,6 +126,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateBatch">
|
||||||
|
|
||||||
|
<foreach collection="list" item="item" separator=";">
|
||||||
|
update project_product_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="item.projectId != null">project_id = #{item.projectId},</if>
|
||||||
|
<if test="item.productBomCode != null and productBomCode != ''">product_bom_code = #{item.productBomCode},</if>
|
||||||
|
<if test="item.model != null">model = #{item.model},</if>
|
||||||
|
<if test="item.productCode != null">product_code = #{item.productCode},</if>
|
||||||
|
<if test="item.productDesc != null">product_desc = #{item.productDesc},</if>
|
||||||
|
<if test="item.quantity != null">quantity = #{item.quantity},</if>
|
||||||
|
<if test="item.cataloguePrice != null">catalogue_price = #{item.cataloguePrice},</if>
|
||||||
|
<if test="item.catalogueAllPrice != null">catalogue_all_price = #{item.catalogueAllPrice},</if>
|
||||||
|
<if test="item.price != null">price = #{item.price},</if>
|
||||||
|
<if test="item.allPrice != null">all_price = #{item.allPrice},</if>
|
||||||
|
<if test="item.guidanceDiscount != null">guidance_discount = #{item.guidanceDiscount},</if>
|
||||||
|
<if test="item.discount != null">discount = #{item.discount},</if>
|
||||||
|
<if test="item.remark != null">remark = #{item.remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteProjectProductInfoById" parameterType="Long">
|
<delete id="deleteProjectProductInfoById" parameterType="Long">
|
||||||
delete from project_product_info where id = #{id}
|
delete from project_product_info where id = #{id}
|
||||||
|
|
Loading…
Reference in New Issue