发布功能

This commit is contained in:
jing's 2023-12-03 19:36:20 +08:00
parent 221fe95c89
commit d50ca019c3
6 changed files with 72 additions and 137 deletions

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.api.user;
import cn.hutool.crypto.digest.MD5;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.conmon.util.SessionUtil;
@ -63,6 +64,7 @@ public class OptionalMbomApi extends BaseApi {
@ApiOperation("已发布机型分页数据")
public ResultVO<IPage<OptionalEbomConfigVO>> getPublishListPage(@RequestBody OptionalEbomConfigListQuery query) {
query.setCreatedBy(SessionUtil.getUserCode());
return ResultVO.success(this.optionalEbomConfigService.getPublishListPage(query));
}

View File

@ -10,8 +10,7 @@ import org.springframework.stereotype.Service;
/**
* 用户选配比对是否相同(OptionalMbomCompare)表服务实现类
*
* @author makejava
* @since 2023-11-26 22:19:49
*/
@Service
public class OptionalMbomCompareService extends ServiceImpl<OptionalMbomCompareMapper, OptionalMbomCompareEntity > {

View File

@ -257,4 +257,6 @@ public class AggregOptionConfigService {
}

View File

@ -0,0 +1,60 @@
package com.nflg.product.bomnew.service.aggreg;
import cn.hutool.crypto.digest.MD5;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nflg.product.bomnew.pojo.entity.OptionalMbomCompareEntity;
import com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO;
import com.nflg.product.bomnew.service.OptionalEbomConfigService;
import com.nflg.product.bomnew.service.OptionalMbomCompareService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class PublishService {
@Resource
private OptionalMbomCompareService optionalMbomCompareService;
@Resource
private OptionalEbomConfigService optionalEbomConfigService;
/**
* 发布
* 1.获取物料信息
* 2.更改状态
* 3.上传sap
* @param rowId
*/
public void publish(Long rowId) {
List<OptionalEbomImportChildVO> previewOptionList= optionalEbomConfigService.getPreviewOptionList(rowId);
List<String> materialNoList = previewOptionList.stream().map(OptionalEbomImportChildVO::getMaterialNo).collect(Collectors.toList());
Collections.sort(materialNoList);
String result = materialNoList.stream().map(String::valueOf).collect(Collectors.joining(","));
String signMd5= MD5.create().digestHex(result);
QueryWrapper<OptionalMbomCompareEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OptionalMbomCompareEntity::getSignMd5, signMd5);
OptionalMbomCompareEntity optionalMbomCompareEntity = optionalMbomCompareService.getOne(queryWrapper);
System.out.println(result);
System.out.println(signMd5);
}
}

View File

@ -94,9 +94,12 @@
t1.created_by,
t2.choose_status from
t_optional_ebom_config_r as t2 LEFT JOIN t_optional_ebom_import_child as t1 on t2.option_row_id=t1.row_id
where t1.is_enable=1 and t2.parent_row_id=#{rowId} and (t1.material_no!=null or t1.material_no!='')
where t1.is_enable=1 and t2.choose_status =1 and t2.parent_row_id=#{rowId} and (t1.material_no!=null or t1.material_no!='')
</select>
</mapper>

View File

@ -3,8 +3,8 @@
<mapper namespace="com.nflg.product.bomnew.mapper.master.OptionalMbomCompareMapper">
<resultMap type="com.nflg.product.bomnew.pojo.entity.OptionalMbomCompareEntity" id="OptionalMbomCompareMap">
<result property="rowId" column="row_id" jdbcType="INTEGER"/>
<result property="parentRowId" column="parent_row_id" jdbcType="INTEGER"/>
<result property="rowId" column="row_id" jdbcType="BIGINT"/>
<result property="parentRowId" column="parent_row_id" jdbcType="BIGINT"/>
<result property="createdTime" column="created_time" jdbcType="VARCHAR"/>
<result property="materialNo" column="material_no" jdbcType="VARCHAR"/>
<result property="materialName" column="material_name" jdbcType="VARCHAR"/>
@ -16,146 +16,15 @@
<sql id="Base_Column_List" >
row_id,parent_row_id,created_time,material_no,material_name,material_desc,drawing_no,child_row_ids,sign_md5,
</sql>
<!--查询单个-->
<select id="queryById" resultMap="OptionalMbomCompareMap">
select
<include refid="Base_Column_List" />
from t_optional_mbom_compare
where row_id = #{rowId}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="OptionalMbomCompareMap">
select
<include refid="Base_Column_List" />
from t_optional_mbom_compare
<where>
<if test="rowId != null">
and row_id = #{rowId}
</if>
<if test="parentRowId != null">
and parent_row_id = #{parentRowId}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="materialNo != null and materialNo != ''">
and material_no = #{materialNo}
</if>
<if test="materialName != null and materialName != ''">
and material_name = #{materialName}
</if>
<if test="materialDesc != null and materialDesc != ''">
and material_desc = #{materialDesc}
</if>
<if test="drawingNo != null and drawingNo != ''">
and drawing_no = #{drawingNo}
</if>
<if test="childRowIds != null and childRowIds != ''">
and child_row_ids = #{childRowIds}
</if>
<if test="signMd5 != null and signMd5 != ''">
and sign_md5 = #{signMd5}
</if>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(*)
from t_optional_mbom_compare
<where>
<if test="rowId != null">
and row_id = #{rowId}
</if>
<if test="parentRowId != null">
and parent_row_id = #{parentRowId}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="materialNo != null and materialNo != ''">
and material_no = #{materialNo}
</if>
<if test="materialName != null and materialName != ''">
and material_name = #{materialName}
</if>
<if test="materialDesc != null and materialDesc != ''">
and material_desc = #{materialDesc}
</if>
<if test="drawingNo != null and drawingNo != ''">
and drawing_no = #{drawingNo}
</if>
<if test="childRowIds != null and childRowIds != ''">
and child_row_ids = #{childRowIds}
</if>
<if test="signMd5 != null and signMd5 != ''">
and sign_md5 = #{signMd5}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="rowId" useGeneratedKeys="true">
insert into t_optional_mbom_compare(parent_row_id,created_time,material_no,material_name,material_desc,drawing_no,child_row_ids,sign_md5,)
values (#{parentRowId},#{createdTime},#{materialNo},#{materialName},#{materialDesc},#{drawingNo},#{childRowIds},#{signMd5},)
</insert>
<insert id="insertBatch" keyProperty="rowId" useGeneratedKeys="true">
insert into t_optional_mbom_compare(parent_row_id,created_time,material_no,material_name,material_desc,drawing_no,child_row_ids,sign_md5,)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.parentRowId},#{entity.createdTime},#{entity.materialNo},#{entity.materialName},#{entity.materialDesc},#{entity.drawingNo},#{entity.childRowIds},#{entity.signMd5},)
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="rowId" useGeneratedKeys="true">
insert into t_optional_mbom_compare(parent_row_id,created_time,material_no,material_name,material_desc,drawing_no,child_row_ids,sign_md5,)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.parentRowId}#{entity.createdTime}#{entity.materialNo}#{entity.materialName}#{entity.materialDesc}#{entity.drawingNo}#{entity.childRowIds}#{entity.signMd5})
</foreach>
on duplicate key update
parent_row_id = values(parent_row_id),created_time = values(created_time),material_no = values(material_no),material_name = values(material_name),material_desc = values(material_desc),drawing_no = values(drawing_no),child_row_ids = values(child_row_ids),sign_md5 = values(sign_md5),
</insert>
<!--通过主键修改数据-->
<update id="update">
update t_optional_mbom_compare
<set>
<if test="parentRowId != null">
parent_row_id = #{parentRowId},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="materialNo != null and materialNo != ''">
material_no = #{materialNo},
</if>
<if test="materialName != null and materialName != ''">
material_name = #{materialName},
</if>
<if test="materialDesc != null and materialDesc != ''">
material_desc = #{materialDesc},
</if>
<if test="drawingNo != null and drawingNo != ''">
drawing_no = #{drawingNo},
</if>
<if test="childRowIds != null and childRowIds != ''">
child_row_ids = #{childRowIds},
</if>
<if test="signMd5 != null and signMd5 != ''">
sign_md5 = #{signMd5},
</if>
</set>
where row_id = #{rowId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from t_optional_mbom_compare where row_id = #{rowId}
</delete>
</mapper>