|
@@ -176,10 +176,11 @@ public class DataLianjiaServiceImpl implements DataLianjiaService, BeanWrapCallb
|
|
|
Criteria criteria = session.createCriteria(DataLianjia.class)
|
|
|
.add(Restrictions.eq("houses", dataLianjia.getHouses()))
|
|
|
.add(Restrictions.eq("dealDate", dataLianjia.getDealDate()))
|
|
|
- .add(Restrictions.eq("dealMoney", dataLianjia.getDealMoney()));
|
|
|
+ .add(Restrictions.eq("dealMoney", dataLianjia.getDealMoney()))
|
|
|
+ .setProjection(Projections.rowCount());
|
|
|
// 判断是否存在重复数据
|
|
|
- boolean exists = criteria.uniqueResult() != null;
|
|
|
- if (!exists) { // 未重复新增
|
|
|
+ Long count = (Long) criteria.uniqueResult();
|
|
|
+ if (count == 0) { // 未重复新增
|
|
|
session.save(dataLianjia);
|
|
|
} else { // 已重复数据跳过不新增
|
|
|
logger.info(String.format("重复的成交数据!小区/楼盘名称:%s-成交日期:%s-成交总价:%f万,该条数据已跳过!",dataLianjia.getHouses(),dataLianjia.getDealDate(),dataLianjia.getDealMoney()));
|