Przeglądaj źródła

企业认证信息BUG修改

yanliming 4 lat temu
rodzic
commit
0549554824

+ 1 - 1
common/src/main/java/com/jpsoft/employment/modules/base/dao/CityDAO.java

@@ -15,6 +15,6 @@ public interface CityDAO {
 	int delete(String id);
 	List<City> list();
 	List<City> findByType(String type);
-	List<City> findByPid(String pid);
+	List<City> findByPid(int pid);
 	List<City> search(Map<String,Object> searchParams,List<Sort> sortList);
 }

+ 1 - 1
common/src/main/java/com/jpsoft/employment/modules/base/service/CityService.java

@@ -15,6 +15,6 @@ public interface CityService {
 	int delete(String id);
 	List<City> list();
 	List<City> findByType(String type);
-	List<City> findByPid(String pid);
+	List<City> findByPid(int pid);
 	Page<City> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
 }

+ 1 - 1
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/CityServiceImpl.java

@@ -65,7 +65,7 @@ public class CityServiceImpl implements CityService {
 	}
 
 	@Override
-	public List<City> findByPid(String pid){
+	public List<City> findByPid(int pid){
 		return cityDAO.findByPid(pid);
 	}
 		

+ 1 - 1
web/src/main/java/com/jpsoft/employment/modules/base/controller/CityController.java

@@ -144,7 +144,7 @@ public class CityController {
     public MessageResult<List> cityListByPid(String pid) {
         MessageResult<List> msgResult = new MessageResult<>();
 
-        List<City> cityList = cityService.findByPid(pid);
+        List<City> cityList = cityService.findByPid(Integer.parseInt(pid));
 
         msgResult.setResult(true);
         msgResult.setData(cityList);

+ 28 - 12
web/src/main/java/com/jpsoft/employment/modules/base/controller/EnterpriseCertificationApproveController.java

@@ -2,8 +2,10 @@ package com.jpsoft.employment.modules.base.controller;
 
 import com.github.pagehelper.Page;
 import com.jpsoft.employment.modules.base.dto.CompanyDTO;
+import com.jpsoft.employment.modules.base.entity.City;
 import com.jpsoft.employment.modules.base.entity.Company;
 import com.jpsoft.employment.modules.base.entity.EnterpriseCertificationApprove;
+import com.jpsoft.employment.modules.base.service.CityService;
 import com.jpsoft.employment.modules.base.service.CompanyService;
 import com.jpsoft.employment.modules.base.service.EnterpriseCertificationApproveService;
 import com.jpsoft.employment.modules.common.dto.MessageResult;
@@ -40,6 +42,9 @@ public class EnterpriseCertificationApproveController {
     @Autowired
     private UserService userService;
 
+    @Autowired
+    private CityService cityService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<Company> create(@RequestAttribute String subject){
@@ -55,15 +60,26 @@ public class EnterpriseCertificationApproveController {
             company.setEnterpriseCertificationApproveId(enterpriseCertificationApprove.getId());
 
             if(StringUtils.isNotEmpty(company.getArea())){
-                JSONObject jsonObject = JSONObject.fromObject(company.getArea());
+                String area = company.getArea();
+
+                City zone = cityService.get(Integer.parseInt(area));
+
+                if(zone!=null){
+                    company.setZone(zone.getId());
+                }
+
+                City city = cityService.get(zone.getPid());
+
+                if(city!=null){
+                    company.setCity(city.getId());
+                }
+
+                City province = cityService.get(city.getPid());
 
-                int province = Integer.parseInt(jsonObject.get("province").toString()) ;
-                int city = Integer.parseInt(jsonObject.get("city").toString()) ;
-                int zone = Integer.parseInt(jsonObject.get("zone").toString()) ;
+                if(province!=null){
+                    company.setProvince(province.getId());
+                }
 
-                company.setProvince(province);
-                company.setCity(city);
-                company.setZone(zone);
             }
         }
 
@@ -87,12 +103,12 @@ public class EnterpriseCertificationApproveController {
             company.setScale(dto.getScale());
             company.setIndustry(dto.getIndustry());
 
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put("province",dto.getProvince());
-            jsonObject.put("city",dto.getCity());
-            jsonObject.put("zone",dto.getZone());
+//            JSONObject jsonObject = new JSONObject();
+//            jsonObject.put("province",dto.getProvince());
+//            jsonObject.put("city",dto.getCity());
+//            jsonObject.put("zone",dto.getZone());
 
-            company.setArea(jsonObject.toString());
+            company.setArea(dto.getZone().toString());
             company.setAddress(dto.getAddress());
             company.setTel(dto.getTel());
             company.setCreditCode(dto.getCreditCode());