添加人工指导价

This commit is contained in:
2023-01-15 20:31:41 +08:00
parent 83d96e4634
commit 61bdc844fe
9 changed files with 144 additions and 22 deletions
@@ -968,9 +968,6 @@ public class AverageStatisticsController {
*/ */
public Object baseAction(AverageStatisticsModel model){ public Object baseAction(AverageStatisticsModel model){
Pager pager = model.getPager(25); Pager pager = model.getPager(25);
if (StringUtils.isBlank(model.getCityDisplay())) {
return model;
}
pager.setTotalRows(avgBaseDao.count(model.getCityDisplay(), model.getRegion(), model.getName(),null, model.getStartDate(), model.getEndDate())); pager.setTotalRows(avgBaseDao.count(model.getCityDisplay(), model.getRegion(), model.getName(),null, model.getStartDate(), model.getEndDate()));
model.setBaseList(avgBaseDao.findAll(model.getCityDisplay(), model.getRegion(), model.getName(),null, model.getStartDate(), model.getEndDate(), pager)); model.setBaseList(avgBaseDao.findAll(model.getCityDisplay(), model.getRegion(), model.getName(),null, model.getStartDate(), model.getEndDate(), pager));
return model; return model;
@@ -987,6 +984,8 @@ public class AverageStatisticsController {
list.add("是否加入指导价"); list.add("是否加入指导价");
list.add("调查时间"); list.add("调查时间");
list.add("调查人"); list.add("调查人");
list.add("来源");
list.add("来源小区名");
data.add(list); data.add(list);
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("导入模板"); HSSFSheet sheet = workbook.createSheet("导入模板");
@@ -994,10 +993,12 @@ public class AverageStatisticsController {
HSSFCell cell0 = row.createCell(0); HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1); HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2); HSSFCell cell2 = row.createCell(2);
HSSFCell cell3= row.createCell(3); HSSFCell cell3 = row.createCell(3);
HSSFCell cell4= row.createCell(4); HSSFCell cell4 = row.createCell(4);
HSSFCell cell5= row.createCell(5); HSSFCell cell5 = row.createCell(5);
HSSFCell cell6= row.createCell(6); HSSFCell cell6 = row.createCell(6);
HSSFCell cell7 = row.createCell(7);
HSSFCell cell8 = row.createCell(8);
cell0.setCellValue("城市"); cell0.setCellValue("城市");
cell1.setCellValue("区域"); cell1.setCellValue("区域");
cell2.setCellValue("小区名"); cell2.setCellValue("小区名");
@@ -1005,6 +1006,8 @@ public class AverageStatisticsController {
cell4.setCellValue("是否加入指导价"); cell4.setCellValue("是否加入指导价");
cell5.setCellValue("调查时间"); cell5.setCellValue("调查时间");
cell6.setCellValue("调查人"); cell6.setCellValue("调查人");
cell7.setCellValue("来源");
cell8.setCellValue("来源小区名");
HttpServletResponse response = ActionContext.getContext().getResponse(); HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/x-download;charset=UTF-8"); response.setContentType("application/x-download;charset=UTF-8");
@@ -8,11 +8,13 @@ import com.fangjia.core.util.HttpRequestException;
import com.fangjia.dal.QueryParam; import com.fangjia.dal.QueryParam;
import com.fangjia.dal.common.DistrictKey; import com.fangjia.dal.common.DistrictKey;
import com.fangjia.dal.mongo.dao.AvgBaseDao; import com.fangjia.dal.mongo.dao.AvgBaseDao;
import com.fangjia.dal.mongo.model.AverageStatistics;
import com.fangjia.dal.mongo.model.AvgBase; import com.fangjia.dal.mongo.model.AvgBase;
import com.fangjia.dal.mongo.model.bkoff.GuidingPrice; import com.fangjia.dal.mongo.model.bkoff.GuidingPrice;
import com.fangjia.dal.seaweed.model.District; import com.fangjia.dal.seaweed.model.District;
import com.fangjia.service.datastore.DistrictService; import com.fangjia.service.datastore.DistrictService;
import com.fangjia.service.mongo.bkoff.GuidingPriceService; import com.fangjia.service.mongo.bkoff.GuidingPriceService;
import com.fangjia.service.mongo.fangjia.AverageStatisticsService;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileItemFactory;
@@ -47,12 +49,12 @@ import java.util.*;
public class BaseAvgImportServlet extends HttpServlet { public class BaseAvgImportServlet extends HttpServlet {
private static final String[] columns = { "城市", "区域", "小区名", "价格", "是否加入指导价", "调查时间", "调查人" }; private static final String[] columns = { "城市", "区域", "小区名", "价格", "是否加入指导价", "调查时间", "调查人" , "来源", "来源小区名"};
private AvgBaseDao avgBaseDao; private AvgBaseDao avgBaseDao;
private GuidingPriceService guidingPriceService; private GuidingPriceService guidingPriceService;
private DistrictService districtService; private DistrictService districtService;
private AverageStatisticsService averageStatisticsService;
@Override @Override
public void init(ServletConfig config) throws ServletException { public void init(ServletConfig config) throws ServletException {
@@ -62,6 +64,7 @@ public class BaseAvgImportServlet extends HttpServlet {
avgBaseDao = (AvgBaseDao) context.getBean("avgBaseDao"); avgBaseDao = (AvgBaseDao) context.getBean("avgBaseDao");
guidingPriceService = (GuidingPriceService) context.getBean("guidingPriceService"); guidingPriceService = (GuidingPriceService) context.getBean("guidingPriceService");
districtService = (DistrictService) context.getBean("districtService"); districtService = (DistrictService) context.getBean("districtService");
averageStatisticsService = (AverageStatisticsService) context.getBean("averageStatisticsService");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -385,17 +388,56 @@ public class BaseAvgImportServlet extends HttpServlet {
Date applyDate = (DateUtil.parseDate(map.get(key), "yyyy-MM-dd")); Date applyDate = (DateUtil.parseDate(map.get(key), "yyyy-MM-dd"));
avgBase.setCreationDate(applyDate == null ? curDate : applyDate); avgBase.setCreationDate(applyDate == null ? curDate : applyDate);
} else if (key.equals("调查人") && map.get(key) != null) { } else if (key.equals("调查人") && map.get(key) != null) {
avgBase.setUserName(map.get(key)); avgBase.setUserName(map.get(key));
} else if (key.equals("来源") && map.get(key) !=null){
avgBase.setSource(map.get(key).replaceAll("\\s", ""));
} else if (key.equals("来源小区名") && map.get(key) != null){
avgBase.setSourceCommName(map.get(key).replaceAll("\\s", ""));
} }
avgBase.setCategory("district"); avgBase.setCategory("district");
} }
if (avgBase.getIsGuidancePrice() == 1) { District dis = null;
if(StringUtils.isNotBlank(avgBase.getSourceCommName()) && !avgBase.getSourceCommName().equals(avgBase.getDistrictName())){
DistrictKey districtKey = new DistrictKey(avgBase.getCity(), avgBase.getRegion(), DistrictKey districtKey = new DistrictKey(avgBase.getCity(), avgBase.getRegion(),
avgBase.getDistrictName()); avgBase.getDistrictName());
District dis = districtService.findOneByKey(districtKey, "district"); dis = districtService.findOneByKey(districtKey, "district");
if(dis.getAlias() == null){
dis.setAlias(Collections.singletonList(avgBase.getSourceCommName()));
}else if(!dis.getAlias().contains(avgBase.getSourceCommName())){
dis.getAlias().add(avgBase.getSourceCommName());
}
if(dis.getMappingAlias() == null){
dis.setMappingAlias(Collections.singletonList(avgBase.getSourceCommName()));
}else if(!dis.getMappingAlias().contains(avgBase.getSourceCommName())){
dis.getMappingAlias().add(avgBase.getSourceCommName());
}
districtService.save(dis);
}
if(StringUtils.isNotBlank(avgBase.getSource()) && avgBase.getSource().equalsIgnoreCase("GXD")){
AverageStatistics averageStatistics = averageStatisticsService.findSecendAverageStatictics(avgBase.getCity(), avgBase.getRegion(), avgBase.getDistrictName(), "district");
if(averageStatistics != null){
averageStatistics.setGxdEsfPrice(avgBase.getPrice());
}else{
averageStatistics = new AverageStatistics();
averageStatistics.setGxdEsfPrice(avgBase.getPrice());
averageStatistics.setCategory("district");
averageStatistics.setCity(avgBase.getCity());
averageStatistics.setRegion(avgBase.getRegion());
averageStatistics.setName(avgBase.getDistrictName());
if(dis != null){
averageStatistics.setMasterDistrictName(dis.getDistrictName());
averageStatistics.setModificationDate(new Date());
}
}
averageStatisticsService.save(averageStatistics);
}
if (avgBase.getIsGuidancePrice() == 1) {
if(dis == null){
DistrictKey districtKey = new DistrictKey(avgBase.getCity(), avgBase.getRegion(),
avgBase.getDistrictName());
dis = districtService.findOneByKey(districtKey, "district");
}
GuidingPrice price = guidingPriceService.findByBizKey(avgBase.getCity(), avgBase.getRegion(), GuidingPrice price = guidingPriceService.findByBizKey(avgBase.getCity(), avgBase.getRegion(),
avgBase.getDistrictName(),avgBase.getCreationDate()); avgBase.getDistrictName(),avgBase.getCreationDate());
if (price != null) { if (price != null) {
@@ -414,7 +456,7 @@ public class BaseAvgImportServlet extends HttpServlet {
price.setGuidingPerson(avgBase.getUserName()); price.setGuidingPerson(avgBase.getUserName());
price.setGuidingDate(avgBase.getCreationDate()); price.setGuidingDate(avgBase.getCreationDate());
price.setGuidingValue(avgBase.getPrice()); price.setGuidingValue(avgBase.getPrice());
price.setEstateType(dis.getEstateType2().indexOf("别墅") > -1 ? "别墅" : "普通住宅"); price.setEstateType(dis.getEstateType2().contains("别墅") ? "别墅" : "普通住宅");
price.setCat("district"); price.setCat("district");
guidingPriceService.save(price); guidingPriceService.save(price);
HttpRequest request = new HttpRequest(); HttpRequest request = new HttpRequest();
@@ -66,6 +66,8 @@
<th style="width:10%;">是否加入指导价</th> <th style="width:10%;">是否加入指导价</th>
<th style="width:10%;">调查时间</th> <th style="width:10%;">调查时间</th>
<th style="width:10%;">调查人</th> <th style="width:10%;">调查人</th>
<th style="width:10%;">来源</th>
<th style="width:10%;">来源小区名</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -95,6 +97,16 @@
${it.userName} ${it.userName}
</#if> </#if>
</td> </td>
<td align="center">
<#if it.source??>
${it.source}
</#if>
</td>
<td align="center">
<#if it.sourceCommName??>
${it.sourceCommName}
</#if>
</td>
</tr> </tr>
</#list> </#list>
</#if> </#if>
@@ -254,6 +254,9 @@
<#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??> <#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??>
<td colspan="2"><b>365房产</b></td> <td colspan="2"><b>365房产</b></td>
</#if> </#if>
<#if (it.gxdNewPrice)?? || (it.gxdEsfPrice)??>
<td colspan="2"><b>GXD</b></td>
</#if>
</tr> </tr>
<tr> <tr>
@@ -345,7 +348,10 @@
<td style="width:70px;color:#0C88C7">新房</td> <td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td> <td style="width:70px;color:#D3750A">二手房</td>
</#if> </#if>
<#if (it.gxdNewPrice)?? || (it.gxdEsfPrice)??>
<td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td>
</#if>
</tr> </tr>
<tr> <tr>
@@ -430,7 +436,7 @@
<#if (it.ganjiNewPrice)?? || (it.ganjiEsfPrice)??> <#if (it.ganjiNewPrice)?? || (it.ganjiEsfPrice)??>
<td style ="color:#0C88C7">${it.ganjiNewPrice!}</td> <td style ="color:#0C88C7">${it.ganjiNewPrice!}</td>
<td style ="color:#D3750A">${it.ganjiEsfPrice!}</td> <td style ="color:#D3750A">${it.ganjiEsfPrice!}</td>
</#if> </#if>
<#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??> <#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??>
<td style ="color:#0C88C7">${it.yungujiaNewPrice!}</td> <td style ="color:#0C88C7">${it.yungujiaNewPrice!}</td>
<td style ="color:#D3750A">${it.yungujiaEsfPrice!}</td> <td style ="color:#D3750A">${it.yungujiaEsfPrice!}</td>
@@ -443,6 +449,10 @@
<td style ="color:#0C88C7">${it.tsfhouseNewPrice!}</td> <td style ="color:#0C88C7">${it.tsfhouseNewPrice!}</td>
<td style ="color:#D3750A">${it.tsfhouseEsfPrice!}</td> <td style ="color:#D3750A">${it.tsfhouseEsfPrice!}</td>
</#if> </#if>
<#if (it.gxdNewPrice)?? || (it.gxdEsfPrice)??>
<td style ="color:#0C88C7">${it.gxdNewPrice!}</td>
<td style ="color:#D3750A">${it.gxdEsfPrice!}</td>
</#if>
</tr> </tr>
</#list> </#list>
@@ -166,6 +166,8 @@ public class AverageStatistics implements MongoEntity {
private Double tsfhouseEsfDiff; private Double tsfhouseEsfDiff;
private Integer tsfhouseNewPrice; private Integer tsfhouseNewPrice;
private Double tsfhouseNewDiff; private Double tsfhouseNewDiff;
/**国信达*/
private Integer gxdEsfPrice;
private String level;//价格评级 private String level;//价格评级
private Integer lastAvgPrice;//最终价 private Integer lastAvgPrice;//最终价
@@ -1155,4 +1157,13 @@ public class AverageStatistics implements MongoEntity {
public void setTsfhouseNewDiff(Double tsfhouseNewDiff) { public void setTsfhouseNewDiff(Double tsfhouseNewDiff) {
this.tsfhouseNewDiff = tsfhouseNewDiff; this.tsfhouseNewDiff = tsfhouseNewDiff;
} }
@Column(name = "gxd_esf_price")
public Integer getGxdEsfPrice() {
return gxdEsfPrice;
}
public void setGxdEsfPrice(Integer gxdEsfPrice) {
this.gxdEsfPrice = gxdEsfPrice;
}
} }
@@ -30,9 +30,9 @@ public class AvgBase implements MongoEntity{
private String category; private String category;
private Integer status; private Integer status;
private String dateStr; private String dateStr;
private Integer isGuidancePrice; private Integer isGuidancePrice;
private String source;
private String sourceCommName;
@Id @Id
@GeneratedValue @GeneratedValue
@@ -135,4 +135,22 @@ public class AvgBase implements MongoEntity{
public void setDateStr(String dateStr) { public void setDateStr(String dateStr) {
this.dateStr = dateStr; this.dateStr = dateStr;
} }
@Column(name = "source")
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Column(name = "source_comm_name")
public String getSourceCommName() {
return sourceCommName;
}
public void setSourceCommName(String sourceCommName) {
this.sourceCommName = sourceCommName;
}
} }
@@ -1 +1,19 @@
package com.fangjia.script.wenyan package com.fangjia.script.wenyan
import com.fangjia.core.ProvinceData
import com.fangjia.core.util.DateUtil
import com.fangjia.core.util.Mongo3Utils
import com.fangjia.datastore.driver.DSCollection
import com.fangjia.datastore.driver.DataStore
import com.fangjia.script.util.CommonUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils
import com.mongodb.client.MongoCollection
import org.bson.Document
MongoCollection<Document> documents = Mongo3Utils.getDbCollection("fangjia", "deal_price")
ProvinceData.getAllCity("º£ÄÏ").each{def it->
long c = documents.countDocuments(new Document("city", it).append("trade_date", new Document('$gt', DateUtil.add(new Date(), Calendar.YEAR, -3))))
println("${it}\t${c}")
}
@@ -17,4 +17,6 @@ public interface AverageStatisticsService {
AverageStatistics findSecendAverageStatictics(String city,String region,String name,String category); AverageStatistics findSecendAverageStatictics(String city,String region,String name,String category);
Map<String, Object> findFirstAverageStatictics(String city,String region,String name,String category, Date sDate); Map<String, Object> findFirstAverageStatictics(String city,String region,String name,String category, Date sDate);
AverageStatistics save(AverageStatistics averageStatistics);
} }
@@ -199,6 +199,12 @@ public class AverageStatisticsServiceImpl implements AverageStatisticsService {
return dataMap; return dataMap;
} }
@Override
public AverageStatistics save(AverageStatistics averageStatistics) {
averageStatisticsDao.save(averageStatistics);
return averageStatistics;
}
private boolean isValid(Integer value) { private boolean isValid(Integer value) {
if (value != null && value > 1000) { if (value != null && value > 1000) {