Merge branch 'master' of http://14.103.246.124:16000/bonus/Bonus-Cloud-Material
This commit is contained in:
commit
0644ace525
|
|
@ -0,0 +1,65 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.basic.domain.BmProjectCombine;
|
||||
import com.bonus.material.basic.service.IBmProjectCombineService;
|
||||
import com.bonus.material.basic.service.IBmProjectService;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.common.utils.HttpClient;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 合并标段工程管理Controller
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
@Api(tags = "合并标段工程管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/bm_project_combine")
|
||||
public class BmProjectCombineController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private IBmProjectCombineService bmProjectService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询工程列表
|
||||
*/
|
||||
@ApiOperation(value = "查询工程列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BmProjectCombine project) {
|
||||
List<BmProjectCombine> list = bmProjectService.selectProInfoList(project);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "合并工程接口")
|
||||
@PostMapping("/combineProject")
|
||||
public AjaxResult combineProject(@RequestBody BmProjectCombine project) {
|
||||
int result = bmProjectService.combineProject(project);
|
||||
return result > 0 ? success("合并成功") : error("合并失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.bonus.material.basic.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 合并工程实体 bm_project
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class BmProjectCombine extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
private String tableName;
|
||||
|
||||
private String proName;
|
||||
|
||||
private String proCode;
|
||||
|
||||
private String extendId;
|
||||
|
||||
private Long tableId;
|
||||
|
||||
private Long proId;
|
||||
|
||||
private Long oldProId;
|
||||
|
||||
private Long newProId;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private List<String> oldProIds;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.basic.domain.BmProjectCombine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标段工程管理Mapper接口
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
public interface BmProjectCombineMapper
|
||||
{
|
||||
|
||||
List<BmProjectCombine> selectProInfoList(BmProjectCombine project);
|
||||
|
||||
List<BmProjectCombine> selectBAIList(BmProjectCombine oldProject);
|
||||
|
||||
void updateBAI(BmProjectCombine bai);
|
||||
|
||||
void insertCombine(BmProjectCombine bai);
|
||||
|
||||
List<BmProjectCombine> selectCBAIList(BmProjectCombine oldProject);
|
||||
|
||||
void updateCBAI(BmProjectCombine bai);
|
||||
|
||||
List<BmProjectCombine> selectLAIList(BmProjectCombine oldProject);
|
||||
|
||||
void updateLAI(BmProjectCombine bai);
|
||||
|
||||
List<BmProjectCombine> selectCLAIList(BmProjectCombine oldProject);
|
||||
|
||||
void updateCLAI(BmProjectCombine bai);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.basic.domain.BmProjectCombine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标段工程管理Service接口
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
public interface IBmProjectCombineService
|
||||
{
|
||||
|
||||
List<BmProjectCombine> selectProInfoList(BmProjectCombine project);
|
||||
|
||||
int combineProject(BmProjectCombine project);
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmProjectCombine;
|
||||
import com.bonus.material.basic.mapper.BmProjectCombineMapper;
|
||||
import com.bonus.material.basic.service.IBmProjectCombineService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 标段工程管理Service业务层处理
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BmProjectCombineServiceImpl implements IBmProjectCombineService
|
||||
{
|
||||
@Resource
|
||||
private BmProjectCombineMapper projectMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<BmProjectCombine> selectProInfoList(BmProjectCombine project) {
|
||||
return projectMapper.selectProInfoList(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int combineProject(BmProjectCombine project) {
|
||||
int res = 0;
|
||||
try {
|
||||
String createBy = SecurityUtils.getLoginUser().getUsername();
|
||||
|
||||
List<String> oldProIds = project.getOldProIds();
|
||||
if(CollectionUtils.isEmpty(oldProIds)){
|
||||
|
||||
}else{
|
||||
//查询协议表:bm_agreement_info,修改oldProId-->newProId,记录修改信息
|
||||
res= updateBAI(project,createBy);
|
||||
//查询协议表:clz_bm_agreement_info,修改oldProId-->newProId,记录修改信息
|
||||
res= updateCBAI(project,createBy);
|
||||
//业务办理领料申请:lease_apply_info,修改oldProId-->newProId,记录修改信息
|
||||
res= updateLAI(project,createBy);
|
||||
//业务办理领料申请:材料站领料申请:clz_lease_apply_info,修改oldProId-->newProId,记录修改信息
|
||||
res= updateCLAI(project,createBy);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("合并标段工程异常",e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int updateCLAI(BmProjectCombine oldProject, String createBy) {
|
||||
List<BmProjectCombine> baiList = projectMapper.selectCLAIList(oldProject);
|
||||
if (CollectionUtils.isNotEmpty(baiList)) {
|
||||
for (BmProjectCombine bai : baiList){
|
||||
projectMapper.updateCLAI(bai);
|
||||
bai.setCreateBy(createBy);
|
||||
bai.setTableName("clz_lease_apply_info");
|
||||
log.info("修改表:clz_lease_apply_info,修改oldProId-->newProId,记录修改信息");
|
||||
projectMapper.insertCombine(bai);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private int updateLAI(BmProjectCombine oldProject, String createBy) {
|
||||
List<BmProjectCombine> baiList = projectMapper.selectLAIList(oldProject);
|
||||
if (CollectionUtils.isNotEmpty(baiList)) {
|
||||
for (BmProjectCombine bai : baiList){
|
||||
projectMapper.updateLAI(bai);
|
||||
bai.setCreateBy(createBy);
|
||||
bai.setTableName("lease_apply_info");
|
||||
log.info("修改表:lease_apply_info,修改oldProId-->newProId,记录修改信息");
|
||||
projectMapper.insertCombine(bai);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private int updateCBAI(BmProjectCombine oldProject, String createBy) {
|
||||
List<BmProjectCombine> baiList = projectMapper.selectCBAIList(oldProject);
|
||||
if (CollectionUtils.isNotEmpty(baiList)) {
|
||||
for (BmProjectCombine bai : baiList){
|
||||
projectMapper.updateCBAI(bai);
|
||||
bai.setCreateBy(createBy);
|
||||
bai.setTableName("clz_bm_agreement_info");
|
||||
log.info("修改表:clz_bm_agreement_info,修改oldProId-->newProId,记录修改信息");
|
||||
projectMapper.insertCombine(bai);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private int updateBAI(BmProjectCombine oldProject, String createBy) {
|
||||
List<BmProjectCombine> baiList = projectMapper.selectBAIList(oldProject);
|
||||
if (CollectionUtils.isNotEmpty(baiList)) {
|
||||
for (BmProjectCombine bai : baiList){
|
||||
projectMapper.updateBAI(bai);
|
||||
bai.setCreateBy(createBy);
|
||||
bai.setTableName("bm_agreement_info");
|
||||
log.info("修改表:bm_agreement_info,修改oldProId-->newProId,记录修改信息");
|
||||
projectMapper.insertCombine(bai);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.basic.mapper.BmProjectCombineMapper">
|
||||
<resultMap type="com.bonus.material.basic.domain.BmProjectCombine" id="BmProjectResult">
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectProInfoList" resultType="com.bonus.material.basic.domain.BmProjectCombine">
|
||||
select bp.pro_id AS id,
|
||||
bp.pro_name as proName,
|
||||
bp.external_id AS extendId ,
|
||||
bp.pro_code as proCode
|
||||
from bm_project bp
|
||||
WHERE 1=1
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectBAIList" resultType="com.bonus.material.basic.domain.BmProjectCombine">
|
||||
select
|
||||
agreement_id as id,
|
||||
project_id as oldProId
|
||||
from
|
||||
bm_agreement_info where project_id in
|
||||
|
||||
<foreach item="item" collection="oldProIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<update id="updateBAI">
|
||||
update bm_agreement_info set project_id = #{newProId} where agreement_id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertCombine">
|
||||
insert into sys_combine_project
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tableName != null">tabel_name,</if>
|
||||
<if test="tableId != null and tableId != ''">tabel_id,</if>
|
||||
<if test="oldProId != null">pre_pro_id,</if>
|
||||
<if test="newProId != null">new_pro_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
create_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="tableName != null">#{tableName},</if>
|
||||
<if test="tableId != null">#{tableId},</if>
|
||||
<if test="oldProId != null and oldProId != ''">#{oldProId},</if>
|
||||
<if test="newProId != null">#{newProId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
now(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectCBAIList" resultType="com.bonus.material.basic.domain.BmProjectCombine">
|
||||
select
|
||||
agreement_id as id,
|
||||
project_id as oldProId
|
||||
from
|
||||
clz_bm_agreement_info where project_id in
|
||||
|
||||
<foreach item="item" collection="oldProIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<update id="updateCBAI">
|
||||
update clz_bm_agreement_info set project_id = #{newProId} where agreement_id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectLAIList" resultType="com.bonus.material.basic.domain.BmProjectCombine">
|
||||
select
|
||||
id as id,
|
||||
project_id as oldProId
|
||||
from
|
||||
lease_apply_info where project_id in
|
||||
|
||||
<foreach item="item" collection="oldProIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateLAI">
|
||||
update lease_apply_info set project_id = #{newProId} where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectCLAIList" resultType="com.bonus.material.basic.domain.BmProjectCombine">
|
||||
select
|
||||
id as id,
|
||||
project_id as oldProId
|
||||
from
|
||||
clz_lease_apply_info where project_id in
|
||||
|
||||
<foreach item="item" collection="oldProIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateCLAI">
|
||||
update clz_lease_apply_info set project_id = #{newProId} where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue