Commit 8a173552 by 陶光胜

代码规范

parent 1cbff4ae
...@@ -44,9 +44,9 @@ public class ProvincesController { ...@@ -44,9 +44,9 @@ public class ProvincesController {
ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince(); ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince();
return RestResponse.success(EntityUtil.changeEntityListByJSON(ProvinceVO.class, serviceResponse.getResult())); return RestResponse.success(EntityUtil.changeEntityListByJSON(ProvinceVO.class, serviceResponse.getResult()));
case 2: case 2:
ServiceResponse<List<CityDTO>> serviceResponse1 = this.provincesApiService.selectAllCity(); ServiceResponse<List<CityDTO>> cityResponse = this.provincesApiService.selectAllCity();
if(serviceResponse1.isSuccess()){ if(cityResponse.isSuccess()){
List<CityDTO> list = serviceResponse1.getResult(); List<CityDTO> list = cityResponse.getResult();
List<CityVO> resultList = new ArrayList<>(); List<CityVO> resultList = new ArrayList<>();
for(CityDTO cityDTO : list){ for(CityDTO cityDTO : list){
if(cityDTO.getProvinceId().equals(id)){ if(cityDTO.getProvinceId().equals(id)){
...@@ -56,9 +56,9 @@ public class ProvincesController { ...@@ -56,9 +56,9 @@ public class ProvincesController {
return RestResponse.success(resultList); return RestResponse.success(resultList);
} }
case 3: case 3:
ServiceResponse<List<CountyDTO>> serviceResponse2 = this.provincesApiService.selectAllCounty(); ServiceResponse<List<CountyDTO>> countyResponse = this.provincesApiService.selectAllCounty();
if(serviceResponse2.isSuccess()){ if(countyResponse.isSuccess()){
List<CountyDTO> list = serviceResponse2.getResult(); List<CountyDTO> list = countyResponse.getResult();
List<CountyDTO> resultList = new ArrayList<>(); List<CountyDTO> resultList = new ArrayList<>();
for(CountyDTO countyDTO : list){ for(CountyDTO countyDTO : list){
if(countyDTO.getCityId().equals(id)){ if(countyDTO.getCityId().equals(id)){
...@@ -120,8 +120,8 @@ public class ProvincesController { ...@@ -120,8 +120,8 @@ public class ProvincesController {
} }
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince(); ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince();
ServiceResponse<List<CityDTO>> serviceResponse1 = this.provincesApiService.selectAllCity(); ServiceResponse<List<CityDTO>> cityResponse = this.provincesApiService.selectAllCity();
ServiceResponse<List<CountyDTO>> serviceResponse2 = this.provincesApiService.selectAllCounty(); ServiceResponse<List<CountyDTO>> countyResponse = this.provincesApiService.selectAllCounty();
String[] idArr = ids.split(","); String[] idArr = ids.split(",");
for(String id : idArr){ for(String id : idArr){
if(serviceResponse.isSuccess()){ if(serviceResponse.isSuccess()){
...@@ -133,8 +133,8 @@ public class ProvincesController { ...@@ -133,8 +133,8 @@ public class ProvincesController {
} }
} }
} }
if(serviceResponse1.isSuccess()){ if(cityResponse.isSuccess()){
List<CityDTO> cityDTOList = serviceResponse1.getResult(); List<CityDTO> cityDTOList = cityResponse.getResult();
for(CityDTO cityDTO : cityDTOList){ for(CityDTO cityDTO : cityDTOList){
if(id.equals(cityDTO.getCityId())){ if(id.equals(cityDTO.getCityId())){
result.add(cityDTO.getCityName()); result.add(cityDTO.getCityName());
...@@ -142,8 +142,8 @@ public class ProvincesController { ...@@ -142,8 +142,8 @@ public class ProvincesController {
} }
} }
} }
if(serviceResponse2.isSuccess()){ if(countyResponse.isSuccess()){
List<CountyDTO> countyDTOList = serviceResponse2.getResult(); List<CountyDTO> countyDTOList = countyResponse.getResult();
for(CountyDTO countyDTO : countyDTOList){ for(CountyDTO countyDTO : countyDTOList){
if(id.equals(countyDTO.getCountyId())){ if(id.equals(countyDTO.getCountyId())){
result.add(countyDTO.getCountyName()); result.add(countyDTO.getCountyName());
...@@ -160,7 +160,7 @@ public class ProvincesController { ...@@ -160,7 +160,7 @@ public class ProvincesController {
@IgnoreLogin @IgnoreLogin
public RestResponse listProvincesCitys(){ public RestResponse listProvincesCitys(){
ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince(); ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince();
ServiceResponse<List<CityDTO>> serviceResponse1 = this.provincesApiService.selectAllCity(); ServiceResponse<List<CityDTO>> citResponse = this.provincesApiService.selectAllCity();
List<JSONObject> result = new ArrayList<>(); List<JSONObject> result = new ArrayList<>();
if(serviceResponse.isSuccess()){ if(serviceResponse.isSuccess()){
List<ProvinceDTO> list = serviceResponse.getResult(); List<ProvinceDTO> list = serviceResponse.getResult();
...@@ -169,8 +169,8 @@ public class ProvincesController { ...@@ -169,8 +169,8 @@ public class ProvincesController {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("provinceId", provinceDTO.getProvinceId()); jsonObject.put("provinceId", provinceDTO.getProvinceId());
jsonObject.put("provinceName", provinceDTO.getProvinceName()); jsonObject.put("provinceName", provinceDTO.getProvinceName());
if(serviceResponse1.isSuccess()){ if(citResponse.isSuccess()){
List<CityDTO> cityDTOList = serviceResponse1.getResult(); List<CityDTO> cityDTOList = citResponse.getResult();
if(CollectionUtils.isNotEmpty(cityDTOList)){ if(CollectionUtils.isNotEmpty(cityDTOList)){
List<JSONObject> jsonObjectList = new ArrayList<>(); List<JSONObject> jsonObjectList = new ArrayList<>();
for(CityDTO cityDTO : cityDTOList){ for(CityDTO cityDTO : cityDTOList){
......
...@@ -158,41 +158,41 @@ public class StoreCustomBackImpl implements ScreenBackStrategy { ...@@ -158,41 +158,41 @@ public class StoreCustomBackImpl implements ScreenBackStrategy {
public String yearMonthDateHourMinuteSecondBack(String value) throws ParseException { public String yearMonthDateHourMinuteSecondBack(String value) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormatCommon = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return this.dateBack(value, simpleDateFormat, simpleDateFormat1); return this.dateBack(value, simpleDateFormat, simpleDateFormatCommon);
} }
public String yearMonthDateBack(String value) throws ParseException { public String yearMonthDateBack(String value) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat simpleDateFormatCommon = new SimpleDateFormat("yyyy-MM-dd");
return this.dateBack(value, simpleDateFormat, simpleDateFormat1); return this.dateBack(value, simpleDateFormat, simpleDateFormatCommon);
} }
public String yearMonth(String value) throws ParseException { public String yearMonth(String value) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat simpleDateFormatCommon = new SimpleDateFormat("yyyy-MM");
return this.dateBack(value, simpleDateFormat, simpleDateFormat1); return this.dateBack(value, simpleDateFormat, simpleDateFormatCommon);
} }
public String monthDateBack(String value) throws ParseException { public String monthDateBack(String value) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMdd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMdd");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("MM-dd"); SimpleDateFormat simpleDateFormatCommon = new SimpleDateFormat("MM-dd");
return this.dateBack(value, simpleDateFormat, simpleDateFormat1); return this.dateBack(value, simpleDateFormat, simpleDateFormatCommon);
} }
public String hourMinuteSecondBack(String value) throws ParseException { public String hourMinuteSecondBack(String value) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HHmmss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HHmmss");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("HH:mm:ss"); SimpleDateFormat simpleDateFormatCommon = new SimpleDateFormat("HH:mm:ss");
return this.dateBack(value, simpleDateFormat, simpleDateFormat1); return this.dateBack(value, simpleDateFormat, simpleDateFormatCommon);
} }
private String dateBack(String value, SimpleDateFormat simpleDateFormat, SimpleDateFormat simpleDateFormat1) throws ParseException { private String dateBack(String value, SimpleDateFormat simpleDateFormat, SimpleDateFormat simpleDateFormatCommon) throws ParseException {
String[] valueArr = value.split(" "); String[] valueArr = value.split(" ");
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("【").append(simpleDateFormat1.format(simpleDateFormat.parse(valueArr[0]))).append("】").append(" "); stringBuilder.append("【").append(simpleDateFormatCommon.format(simpleDateFormat.parse(valueArr[0]))).append("】").append(" ");
if (valueArr.length > 1) { if (valueArr.length > 1) {
stringBuilder.append("至"); stringBuilder.append("至");
stringBuilder.append("【").append(simpleDateFormat1.format(simpleDateFormat.parse(valueArr[1]))).append("】").append(" "); stringBuilder.append("【").append(simpleDateFormatCommon.format(simpleDateFormat.parse(valueArr[1]))).append("】").append(" ");
} }
return stringBuilder.toString(); return stringBuilder.toString();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment