添加人工指导价

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){
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()));
model.setBaseList(avgBaseDao.findAll(model.getCityDisplay(), model.getRegion(), model.getName(),null, model.getStartDate(), model.getEndDate(), pager));
return model;
@@ -987,6 +984,8 @@ public class AverageStatisticsController {
list.add("是否加入指导价");
list.add("调查时间");
list.add("调查人");
list.add("来源");
list.add("来源小区名");
data.add(list);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("导入模板");
@@ -994,10 +993,12 @@ public class AverageStatisticsController {
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3= row.createCell(3);
HSSFCell cell4= row.createCell(4);
HSSFCell cell5= row.createCell(5);
HSSFCell cell6= row.createCell(6);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
HSSFCell cell6 = row.createCell(6);
HSSFCell cell7 = row.createCell(7);
HSSFCell cell8 = row.createCell(8);
cell0.setCellValue("城市");
cell1.setCellValue("区域");
cell2.setCellValue("小区名");
@@ -1005,6 +1006,8 @@ public class AverageStatisticsController {
cell4.setCellValue("是否加入指导价");
cell5.setCellValue("调查时间");
cell6.setCellValue("调查人");
cell7.setCellValue("来源");
cell8.setCellValue("来源小区名");
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("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.common.DistrictKey;
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.bkoff.GuidingPrice;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.service.datastore.DistrictService;
import com.fangjia.service.mongo.bkoff.GuidingPriceService;
import com.fangjia.service.mongo.fangjia.AverageStatisticsService;
import net.sf.json.JSONObject;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
@@ -47,12 +49,12 @@ import java.util.*;
public class BaseAvgImportServlet extends HttpServlet {
private static final String[] columns = { "城市", "区域", "小区名", "价格", "是否加入指导价", "调查时间", "调查人" };
private static final String[] columns = { "城市", "区域", "小区名", "价格", "是否加入指导价", "调查时间", "调查人" , "来源", "来源小区名"};
private AvgBaseDao avgBaseDao;
private GuidingPriceService guidingPriceService;
private DistrictService districtService;
private AverageStatisticsService averageStatisticsService;
@Override
public void init(ServletConfig config) throws ServletException {
@@ -62,6 +64,7 @@ public class BaseAvgImportServlet extends HttpServlet {
avgBaseDao = (AvgBaseDao) context.getBean("avgBaseDao");
guidingPriceService = (GuidingPriceService) context.getBean("guidingPriceService");
districtService = (DistrictService) context.getBean("districtService");
averageStatisticsService = (AverageStatisticsService) context.getBean("averageStatisticsService");
} catch (Exception e) {
e.printStackTrace();
}
@@ -385,17 +388,56 @@ public class BaseAvgImportServlet extends HttpServlet {
Date applyDate = (DateUtil.parseDate(map.get(key), "yyyy-MM-dd"));
avgBase.setCreationDate(applyDate == null ? curDate : applyDate);
} else if (key.equals("调查人") && map.get(key) != null) {
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");
}
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(),
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(),
avgBase.getDistrictName(),avgBase.getCreationDate());
if (price != null) {
@@ -414,7 +456,7 @@ public class BaseAvgImportServlet extends HttpServlet {
price.setGuidingPerson(avgBase.getUserName());
price.setGuidingDate(avgBase.getCreationDate());
price.setGuidingValue(avgBase.getPrice());
price.setEstateType(dis.getEstateType2().indexOf("别墅") > -1 ? "别墅" : "普通住宅");
price.setEstateType(dis.getEstateType2().contains("别墅") ? "别墅" : "普通住宅");
price.setCat("district");
guidingPriceService.save(price);
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>
</tr>
</thead>
<tbody>
@@ -94,7 +96,17 @@
<#if it.userName??>
${it.userName}
</#if>
</td>
</td>
<td align="center">
<#if it.source??>
${it.source}
</#if>
</td>
<td align="center">
<#if it.sourceCommName??>
${it.sourceCommName}
</#if>
</td>
</tr>
</#list>
</#if>
@@ -254,6 +254,9 @@
<#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??>
<td colspan="2"><b>365房产</b></td>
</#if>
<#if (it.gxdNewPrice)?? || (it.gxdEsfPrice)??>
<td colspan="2"><b>GXD</b></td>
</#if>
</tr>
<tr>
@@ -345,7 +348,10 @@
<td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td>
</#if>
<#if (it.gxdNewPrice)?? || (it.gxdEsfPrice)??>
<td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td>
</#if>
</tr>
<tr>
@@ -430,7 +436,7 @@
<#if (it.ganjiNewPrice)?? || (it.ganjiEsfPrice)??>
<td style ="color:#0C88C7">${it.ganjiNewPrice!}</td>
<td style ="color:#D3750A">${it.ganjiEsfPrice!}</td>
</#if>
</#if>
<#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??>
<td style ="color:#0C88C7">${it.yungujiaNewPrice!}</td>
<td style ="color:#D3750A">${it.yungujiaEsfPrice!}</td>
@@ -443,6 +449,10 @@
<td style ="color:#0C88C7">${it.tsfhouseNewPrice!}</td>
<td style ="color:#D3750A">${it.tsfhouseEsfPrice!}</td>
</#if>
<#if (it.gxdNewPrice)?? || (it.gxdEsfPrice)??>
<td style ="color:#0C88C7">${it.gxdNewPrice!}</td>
<td style ="color:#D3750A">${it.gxdEsfPrice!}</td>
</#if>
</tr>
</#list>