Commit 227a8722 authored by lisong's avatar lisong

更新

parent a0050b43
......@@ -10,37 +10,40 @@ public class HouseholdPvImport {
@ExcelProperty(value = "所属场站", index = 0)
private String platformCompanyId;
@ColumnWidth(15)
@ExcelProperty(value = "户号", index = 1)
@ExcelProperty(value = "所属区域", index = 1)
private String districtId;
@ColumnWidth(15)
@ExcelProperty(value = "户号", index = 2)
private String number;
@ColumnWidth(15)
@ExcelProperty(value = "户主姓名", index = 2)
@ExcelProperty(value = "户主姓名", index = 3)
private String name;
@ColumnWidth(15)
@ExcelProperty(value = "性别", index = 3)
@ExcelProperty(value = "性别", index = 4)
private String sex;
@ColumnWidth(15)
@ExcelProperty(value = "身份证号", index = 4)
@ExcelProperty(value = "身份证号", index = 5)
private String idNumber;
@ColumnWidth(20)
@ExcelProperty(value = "证件过期时间", index = 5)
@ExcelProperty(value = "证件过期时间", index = 6)
private String expiryTime;
@ColumnWidth(15)
@ExcelProperty(value = "签发机关", index = 6)
@ExcelProperty(value = "签发机关", index = 7)
private String issuingAuthority;
@ColumnWidth(15)
@ExcelProperty(value = "户籍地址", index = 7)
@ExcelProperty(value = "户籍地址", index = 8)
private String residenceAddress;
@ColumnWidth(15)
@ExcelProperty(value = "手机号码", index = 8)
@ExcelProperty(value = "手机号码", index = 9)
private String phone;
@ColumnWidth(15)
@ExcelProperty(value = "居住地", index = 9)
@ExcelProperty(value = "居住地", index = 10)
private String address;
@ColumnWidth(15)
@ExcelProperty(value = "居住地邮编", index = 10)
@ExcelProperty(value = "居住地邮编", index = 11)
private String postcode;
@ColumnWidth(15)
@ExcelProperty(value = "送达地址", index = 11)
@ExcelProperty(value = "送达地址", index = 12)
private String serviceAddress;
......
......@@ -23,5 +23,5 @@ public interface IHouseholdPvDistrictService extends IService<HouseholdPvDistric
HouseholdPvDistrict treeUpdate(Long id, String name);
void treeNodesRemove(Long id);
String treeNodesRemove(Long id);
}
......@@ -175,7 +175,13 @@ public class HouseholdPvDistrictController extends BaseController {
@DeleteMapping(value = "/treeNodesRemove")
@ApiOperation(httpMethod = "DELETE", value = "树节点删除", notes = "树节点删除")
public ResponseModel<Object> treeNodesRemove(@RequestParam("id") String id) {
householdPvDistrictService.treeNodesRemove(Long.parseLong(id));
return ResponseHelper.buildResponse("ok");
ResponseModel<Object> model = new ResponseModel<>();
String result = householdPvDistrictService.treeNodesRemove(Long.parseLong(id));
if (!"ok".equals(result)) {
model.setStatus(500);
model.setMessage(result);
return model;
}
return ResponseHelper.buildResponse(result);
}
}
......@@ -54,7 +54,7 @@ public class HouseholdPvDeviceServiceImpl
@Override
public void exportTemplates(HttpServletResponse response) {
FileUtil.downloadResource("户用光伏-设备导入模板.xlsx", "templates/户用光伏-设备导入模板.xlsx", response);
FileUtil.downloadResource("equipTemplates.xls", "templates/equipTemplates.xls", response);
}
@Override
......
......@@ -106,15 +106,17 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
}
@Override
public void treeNodesRemove(Long id) {
public String treeNodesRemove(Long id) {
String result = "ok";
Integer treeNodes = householdPvDistrictMapper.countTreeNodesById(id);
Integer integer = householdPvDistrictMapper.countHouseholdById(id);
if (treeNodes > 0) {
throw new BadRequest("该节点存在子节点");
return "该节点存在子节点";
} else if (integer > 0) {
throw new BadRequest("该节点已绑定户用光伏信息");
return "该节点已绑定户用光伏信息";
}
this.removeById(id);
return result;
}
@Override
......
......@@ -124,7 +124,7 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
Map<String, Object> map = companyNameList();
list.forEach(item -> {
HouseholdPv householdPv = new HouseholdPv();
BeanUtils.copyProperties(item, householdPv, "platformCompanyId", "expiryTime");
BeanUtils.copyProperties(item, householdPv, "platformCompanyId", "expiryTime" ,"districtId");
householdPv.setCreateTime(LocalDateTime.now().toDate());
if (!ObjectUtils.isEmpty(item.getExpiryTime())) {
try {
......@@ -134,12 +134,19 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
e.printStackTrace();
}
}
// 所属场站
if (!ObjectUtils.isEmpty(item.getPlatformCompanyId())) {
if (map.containsKey(item.getPlatformCompanyId())) {
householdPv.setPlatformCompanyId(Long.parseLong(String.valueOf(map.get(item.getPlatformCompanyId()))));
householdPv.setBizOrgCode(getOrgCode(householdPv.getPlatformCompanyId()));
}
}
// 所属区域
if (!ObjectUtils.isEmpty(item.getDistrictId())) {
if (map.containsKey(item.getDistrictId())) {
householdPv.setDistrictId(Long.parseLong(String.valueOf(map.get(item.getDistrictId()))));
}
}
householdPvs.add(householdPv);
});
this.saveBatch(householdPvs);
......
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