Commit 9386f13d by wangjian

2024-03-18 校产管理 设备台账 导入 异常及修改

parent b18a0de5
......@@ -59,9 +59,9 @@ public class SchoolEquipmentLedger extends OurBaseEntity
@Excel(name = "是否已借出", readConverterExp = "1=是,0=否", combo = {"是","否"})
private String isLend;
/** 投产日期 */
/** 安装时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "投产日期", width = 30, dateFormat = "yyyy-MM-dd")
@Excel(name = "安装时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date dateOfProduction;
/** 价格 */
......
......@@ -47,4 +47,6 @@ public class SchoolProductCategory extends BaseEntity
/** 管理员 */
private String admin;
private String delFlag;
}
......@@ -50,6 +50,7 @@ public interface ProductCategoryMapper extends BaseMapper<SchoolProductCategory>
* @return
*/
List<SchoolProductCategory> selectSchoolProductCateGoryGr(SchoolProductCategory schoolProductCategory);
List<SchoolProductCategory> selectProductCategoryList(SchoolProductCategory schoolProductCategory);
/**
* 获取个人设备分类下拉框
......
......@@ -22,6 +22,7 @@ import yangtz.cs.liu.campus.vo.schoolEquipment.SchoolEquipmentLedgerVo;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@Service
......@@ -229,6 +230,12 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
*/
@Override
public void checkImport(List<SchoolEquipmentLedger> list) {
//2024-03-15 wj add
//查询分类编码是否重复
SchoolProductCategory wrapper = new SchoolProductCategory();
List<SchoolProductCategory> schoolProductCategories = productCategoryMapper.selectProductCategoryList(wrapper);
//是否为空
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入数据不能为空");
......@@ -240,21 +247,21 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
if (StringUtils.isNull(schoolEquipmentLedger.getEquipmentName())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、设备名称为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getModel())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、型号为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getSpecification())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、规格为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getModel())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、型号为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getSpecification())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、规格为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getClassificationCode())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、分类编码为空,请你重新输入!");
}else if(schoolEquipmentLedger.getClassificationCode().length() < 4){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、分类编码长度最少为4位,请你核对后重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getUnit())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、单位为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getUnit())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、单位为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getAffiliationType())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、归属类型为空,请你重新输入!");
......@@ -264,43 +271,41 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
}else if (StringUtils.isNull(schoolEquipmentLedger.getIsAllowLend())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、是否允许借出为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getIsLend())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、是否已借出为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getDateOfProduction())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、投产日期为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getPrice())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、价格为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getLifeOfUtility())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、效用年限为空,请你重新输入!");
}else if (StringUtils.isNull(schoolEquipmentLedger.getPlace())){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、地点为空,请你重新输入!");
}else {
// }else if (StringUtils.isNull(schoolEquipmentLedger.getIsLend())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、是否已借出为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getDateOfProduction())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、安装时间为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getPrice())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、价格为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getLifeOfUtility())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、效用年限为空,请你重新输入!");
// }else if (StringUtils.isNull(schoolEquipmentLedger.getPlace())){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、地点为空,请你重新输入!");
}else if (StringUtils.isNotNull(schoolEquipmentLedger.getDateOfProduction())){
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
Date dateOfProduction = schoolEquipmentLedger.getDateOfProduction();
sdf.format(dateOfProduction);
} catch (Exception e) {
throw new ServiceException("格式不对,请检查日期格式");
}
try {
Integer.parseInt(schoolEquipmentLedger.getPlace());
throw new ServiceException("地点输入错误,请重新输入!");
} catch (NumberFormatException e) {
e.printStackTrace();
throw new ServiceException(schoolEquipmentLedger.getDateOfProduction() + " 格式不对,请检查日期格式");
}
// try {
// Integer.parseInt(schoolEquipmentLedger.getPlace());
// throw new ServiceException("地点输入错误,请重新输入!");
// } catch (NumberFormatException e) {
// e.printStackTrace();
// }
}
if(StringUtils.isNotNull(schoolEquipmentLedger.getClassificationCode())){
//查询分类编码是否重复
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,schoolEquipmentLedger.getClassificationCode())
.eq(SchoolProductCategory::getDelFlag,"0");
List<SchoolProductCategory> schoolProductCategories = productCategoryMapper.selectList(wrapper);
if (schoolProductCategories.size()<=0) {
List<SchoolProductCategory> newCateLists = schoolProductCategories.stream().filter(
e -> schoolEquipmentLedger.getClassificationCode().equals(e.getClassificationCode())).collect(Collectors.toList());
if (newCateLists.size()<=0) {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、分类编码不存在,请你重新输入!");
}
......
......@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFalg" column="del_flag" />
<result property="delFlag" column="del_flag" />
</resultMap>
<resultMap type="SchoolProductCategoryVo" id="schoolProductCategoryVoResult">
<result property="id" column="id" />
......@@ -144,4 +144,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectProductCategoryList" parameterType="yangtz.cs.liu.campus.domain.schoolEquipment.SchoolProductCategory" resultMap="schoolProductCategoryResult">
SELECT *
FROM school_product_category
WHERE del_flag = '0'
ORDER BY order_num ASC
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment