|
|
|
@ -51,6 +51,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.InputStream; |
|
|
|
@ -135,7 +136,9 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<EvaluateOfficerDTO> list(Map<String, Object> params) { |
|
|
|
List<EvaluateOfficerEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
//List<EvaluateOfficerEntity> entityList = baseDao.selectList(getWrapper(params));
|
|
|
|
List<EvaluateOfficerDTO> list = baseDao.getOfficerPage(params); |
|
|
|
List<EvaluateOfficerEntity> entityList = ConvertUtils.sourceToTarget(list, EvaluateOfficerEntity.class); |
|
|
|
return ConvertUtils.sourceToTarget(entityList, EvaluateOfficerDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@ -198,15 +201,11 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Result insertPartyList(MultipartFile file, String deptId) { |
|
|
|
// 清空当前街道数据
|
|
|
|
if (deptId != null && !"".equals(deptId)) { |
|
|
|
baseDao.deleteByDeptId(deptId); |
|
|
|
} |
|
|
|
// 清空该人员相关评价数据
|
|
|
|
baseDao.deleteEvaluateDetailByDeptId(deptId); |
|
|
|
baseDao.deleteEvaluateInfoByDeptId(deptId); |
|
|
|
// 清空该人员相关评价数据 和 当前街道数据
|
|
|
|
deleteInfoByDeptId(deptId); |
|
|
|
|
|
|
|
//获取excle版本
|
|
|
|
String isExcel2003 = ExcelUtils.getExcelInfo(file); |
|
|
|
@ -244,7 +243,7 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
} |
|
|
|
EvaluateOfficerEntity evaluateOfficerEntity = new EvaluateOfficerEntity(); |
|
|
|
// 循环Excel的列
|
|
|
|
for (int c = 0; c < 6; c++) { |
|
|
|
for (int c = 0; c < 4; c++) { |
|
|
|
Cell cell = row.getCell(c); |
|
|
|
if (null != cell) { |
|
|
|
if (c == 0) { |
|
|
|
@ -268,16 +267,6 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
evaluateOfficerEntity.setPosition(value); |
|
|
|
|
|
|
|
} else if (c == 3) { |
|
|
|
// 点赞次数
|
|
|
|
String value = ExcelUtils.getCellContent(cell); |
|
|
|
evaluateOfficerEntity.setLikesCount(Integer.parseInt(value)); |
|
|
|
|
|
|
|
} else if (c == 4) { |
|
|
|
// 被踩次数
|
|
|
|
String value = ExcelUtils.getCellContent(cell); |
|
|
|
evaluateOfficerEntity.setOpposeCount(Integer.parseInt(value)); |
|
|
|
|
|
|
|
} else if (c == 5) { |
|
|
|
// 排序
|
|
|
|
String value = ExcelUtils.getCellContent(cell); |
|
|
|
evaluateOfficerEntity.setSort(Integer.parseInt(value)); |
|
|
|
@ -288,6 +277,8 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
} |
|
|
|
} |
|
|
|
evaluateOfficerEntity.setDeptId(deptId); |
|
|
|
evaluateOfficerEntity.setLikesCount(0); |
|
|
|
evaluateOfficerEntity.setOpposeCount(0); |
|
|
|
|
|
|
|
String userId = SecurityUser.getUserId() == null ? "" : SecurityUser.getUserId().toString(); |
|
|
|
evaluateOfficerEntity.setId(getLongRandom()); |
|
|
|
@ -318,7 +309,7 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
result.setData("数据导入成功!"); |
|
|
|
return result; |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|
|
|
} |
|
|
|
result.setMsg("defeat"); |
|
|
|
result.setCode(1); |
|
|
|
@ -346,5 +337,15 @@ public class EvaluateOfficerServiceImpl extends BaseServiceImpl<EvaluateOfficerD |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
public void deleteInfoByDeptId(String deptId){ |
|
|
|
// 清空当前街道数据
|
|
|
|
if (deptId != null && !"".equals(deptId)) { |
|
|
|
baseDao.deleteByDeptId(deptId); |
|
|
|
} |
|
|
|
// 清空该人员相关评价数据
|
|
|
|
baseDao.deleteEvaluateDetailByDeptId(deptId); |
|
|
|
baseDao.deleteEvaluateInfoByDeptId(deptId); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |