bug 4465修复: 专业录入导入工程的时候没有总工程字段,导致录入成功后,该字段空白
This commit is contained in:
parent
777e6c9168
commit
12b7846440
|
|
@ -35,4 +35,6 @@ public interface ProjectGeneralDao {
|
|||
int getProCount(@Param("params") Map<String, Object> params);
|
||||
/** 专业工程查询页面 */
|
||||
List<ProjectGeneralBean> getProList(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
|
||||
|
||||
ProjectGeneralBean getGeneralInfoByName(String name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ public class ProjectBean {
|
|||
/**
|
||||
* 总工程名称
|
||||
*/
|
||||
@Excel(name = "总包工程")
|
||||
private String proGeneralName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.bonus.bmw.basic.service;
|
|||
|
||||
import com.bonus.bmw.basic.dao.CompanyDao;
|
||||
import com.bonus.bmw.basic.dao.ProjectDao;
|
||||
import com.bonus.bmw.basic.dao.ProjectGeneralDao;
|
||||
import com.bonus.bmw.basic.entity.ProjectBean;
|
||||
import com.bonus.bmw.basic.entity.ProjectGeneralBean;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -21,6 +23,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
|
||||
private final CompanyDao companyDao;
|
||||
|
||||
private final ProjectGeneralDao projectGeneralDao;
|
||||
|
||||
@Override
|
||||
public String importData(List<ProjectBean> list) {
|
||||
if (list.size()>0){
|
||||
|
|
@ -49,6 +53,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
return "第" + (i+1) + "行业主姓名为空,导入失败";
|
||||
}else if (StringUtils.isEmpty(bean.getCompanyName())){
|
||||
return "第" + (i+1) + "行公司名称为空,导入失败";
|
||||
}else if (StringUtils.isBlank(bean.getProGeneralName())){
|
||||
return "第" + (i+1) + "行总包工程为空,导入失败";
|
||||
}
|
||||
|
||||
switch (bean.getProStatus()){
|
||||
|
|
@ -89,6 +95,13 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
return "第" + (i+1) + "行,对应的业主姓名不存在,导入失败";
|
||||
}
|
||||
|
||||
ProjectGeneralBean projectGeneralBean = projectGeneralDao.getGeneralInfoByName(bean.getProGeneralName().trim());
|
||||
if (projectGeneralBean != null){
|
||||
list.get(i).setProGeneralId(projectGeneralBean.getProGeneralId());
|
||||
}else{
|
||||
return "第" + (i+1) + "行,对应的总包工程不存在,导入失败";
|
||||
}
|
||||
|
||||
}
|
||||
int result = projectDao.importData(list);
|
||||
return result > 0 ? "成功导入" + result + "条数据,保存成功" : "导入失败" ;
|
||||
|
|
|
|||
|
|
@ -107,4 +107,8 @@
|
|||
AND bpg.id = #{params.proGeneralId}
|
||||
) aa
|
||||
</select>
|
||||
|
||||
<select id="getGeneralInfoByName" resultType="com.bonus.bmw.basic.entity.ProjectGeneralBean">
|
||||
select id as proGeneralId from bm_project_general where name = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -12,13 +12,13 @@
|
|||
</insert>
|
||||
|
||||
<insert id="importData">
|
||||
INSERT INTO `bm_project`( `name`, `abbreviation`, `pro_type`,
|
||||
INSERT INTO `bm_project`( `project_general_id`, `name`, `abbreviation`, `pro_type`,
|
||||
`company_id`, `owner_id`, `power_grid`, `project_address`, `lon`, `lat`,
|
||||
`pro_status`, `plan_start_time`, `plan_stop_time`, `create_time`, `update_time`, `is_active`)
|
||||
VALUES
|
||||
<foreach item="item" collection="list" separator="," index="index" >
|
||||
(
|
||||
#{item.name},#{item.abbreviation},#{item.proType},#{item.companyId},#{item.ownerId},
|
||||
#{item.proGeneralId}, #{item.name},#{item.abbreviation},#{item.proType},#{item.companyId},#{item.ownerId},
|
||||
#{item.powerGrid},#{item.projectAddress},#{item.lon},#{item.lat},
|
||||
#{item.proStatusCode},#{item.planStartTime},#{item.planStopTime},now(),now(),'1'
|
||||
)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue