Commit 9386f13d by wangjian

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

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