|
@@ -139,24 +139,24 @@ public class RyjbxxController extends BaseController {
|
|
|
@RequestMapping(value = "ryjcxxJasper", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@RemotingExclude
|
|
|
- public void jasperPrint(@RequestParam String id,String sfzh,
|
|
|
+ public void jasperPrint(@RequestParam String id, String sfzh,
|
|
|
HttpServletResponse response, HttpServletRequest request) {
|
|
|
List<RyjbxxEntity> dataList = new ArrayList<RyjbxxEntity>();
|
|
|
RyjbxxEntity data = service.findOne(Long.parseLong(id));
|
|
|
dataList.add(data);
|
|
|
- Map<String, Object> parameters=new HashMap<String, Object>();
|
|
|
-
|
|
|
- List<RyjbxxZSEntity> dataList2 = new ArrayList<RyjbxxZSEntity>();
|
|
|
+ Map<String, Object> parameters = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ List<RyjbxxZSEntity> dataList2 = new ArrayList<RyjbxxZSEntity>();
|
|
|
dataList2 = service.ryjbxxzsByRyid(sfzh);
|
|
|
- //parameters.put("SUBREPORT_DIR", "iReport/jyr/");
|
|
|
+ // parameters.put("SUBREPORT_DIR", "iReport/jyr/");
|
|
|
parameters.put("SUBREPORT_DIR", "iReport/jyr/");
|
|
|
|
|
|
parameters.put("sublist", dataList2);
|
|
|
download(parameters, "人员基础信息", "iReport/jyr/ryjcxx.jasper",
|
|
|
ReportExportHelper.REPORT_EXPORT_TYPE_WORD,
|
|
|
new JRBeanCollectionDataSource(dataList), response, request);
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
public Collection<String[]> print(List<String> param) {
|
|
|
List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
addNotEmptyModel(filterList, "szd.id", param.get(0), Operator.LIKE_R);
|
|
@@ -221,8 +221,8 @@ public class RyjbxxController extends BaseController {
|
|
|
@Log(Type.ADD)
|
|
|
public BusinessContext doAdd(RyjbxxEntity ryjbxxEntity,
|
|
|
List<RyjbxxZSEntity> zsList, List<RyjbxxZSEntity> deleteZsList,
|
|
|
- Long functionId ,Long accId) {
|
|
|
- return save(ryjbxxEntity, zsList, deleteZsList, functionId,accId);
|
|
|
+ Long functionId, Long accId) {
|
|
|
+ return save(ryjbxxEntity, zsList, deleteZsList, functionId, accId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -234,13 +234,13 @@ public class RyjbxxController extends BaseController {
|
|
|
@Log(Type.EDIT)
|
|
|
public BusinessContext doEdit(RyjbxxEntity ryjbxxEntity,
|
|
|
List<RyjbxxZSEntity> zsList, List<RyjbxxZSEntity> deleteZsList,
|
|
|
- Long functionId,Long accId) {
|
|
|
- return save(ryjbxxEntity, zsList, deleteZsList, functionId,accId);
|
|
|
+ Long functionId, Long accId) {
|
|
|
+ return save(ryjbxxEntity, zsList, deleteZsList, functionId, accId);
|
|
|
}
|
|
|
|
|
|
public BusinessContext save(RyjbxxEntity ryjbxxEntity,
|
|
|
List<RyjbxxZSEntity> zsList, List<RyjbxxZSEntity> deleteZsList,
|
|
|
- Long functionId,Long accId) {
|
|
|
+ Long functionId, Long accId) {
|
|
|
BusinessContext bContext = new BusinessContext();
|
|
|
if (null == ryjbxxEntity.getId()) {
|
|
|
// 新增
|
|
@@ -253,7 +253,7 @@ public class RyjbxxController extends BaseController {
|
|
|
ryjbxxEntity.setUpdateUser(Utils.getCurrentUser());
|
|
|
}
|
|
|
RyjbxxEntity ryjbxx = new RyjbxxEntity();
|
|
|
- ryjbxx = service.save(ryjbxxEntity, zsList, deleteZsList,accId);
|
|
|
+ ryjbxx = service.save(ryjbxxEntity, zsList, deleteZsList, accId);
|
|
|
bContext.setResult(ryjbxx);
|
|
|
bContext.addMsg("save.success", "common", MsgLevel.INFO);
|
|
|
return bContext;
|
|
@@ -312,10 +312,37 @@ public class RyjbxxController extends BaseController {
|
|
|
}
|
|
|
bContext.setResult(ryjbxxEntity);
|
|
|
bContext.setAttribute("zss", zsEntities);
|
|
|
+ bContext.setAttribute("acc", getAccById(ryjbxxEntity.getId()));
|
|
|
+ bContext.setAttribute(
|
|
|
+ "qrcode",
|
|
|
+ Utils.getQrcodeImage(100, 100, Constants.ALL_QRCODE
|
|
|
+ + Constants.QRCODE_RYJBXX + ryjbxxEntity.getId()));
|
|
|
return bContext;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public byte[] getAccById(Long id) {
|
|
|
+ List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
+ addNotEmptyModel(filterList, "entityType.id", Constants.FJSSLX_RYJBXX,
|
|
|
+ Operator.EQ);
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
|
+ addNotEmptyModel(filterList, "entityId", id, PredicateModel.Operator.EQ);
|
|
|
+ Specification<AccessoryEntity> accSpec = SpecificationCreater
|
|
|
+ .searchByPredicateModels(filterList);
|
|
|
+ List<AccessoryEntity> accList = accessoryService.findAll(accSpec);
|
|
|
+ byte[] acc =null;
|
|
|
+ if (accList != null && accList.size() > 0) {
|
|
|
+ acc = accList.get(0).getContent().getValue();
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 经营人人员信息查看
|
|
|
*
|
|
|
* @return
|
|
@@ -378,7 +405,7 @@ public class RyjbxxController extends BaseController {
|
|
|
outputStream.close();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@RequestMapping(value = "ryjbxx", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@RemotingExclude
|
|
@@ -400,167 +427,164 @@ public class RyjbxxController extends BaseController {
|
|
|
return "0";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private Map<String, List<?>> getRyjbxx(HSSFWorkbook workbook, Long fid) {
|
|
|
Map<String, List<?>> map = new HashMap<String, List<?>>();
|
|
|
List<RyjbxxEntity> list = new ArrayList<RyjbxxEntity>();// 记录有效的数据
|
|
|
List<HSSFRow> rowlist = new ArrayList<HSSFRow>();// 记录无效的数据
|
|
|
List<String> strList = new ArrayList<String>();// 记录错误信息
|
|
|
HSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
- RyjbxxEntity ryjbxxEntity = new RyjbxxEntity();//人员基本信息
|
|
|
- List<RyjbxxZSEntity> zsList = new ArrayList<RyjbxxZSEntity>();//证书信息
|
|
|
- for(int i = 6; i<=sheet.getLastRowNum(); i++) {
|
|
|
+ RyjbxxEntity ryjbxxEntity = new RyjbxxEntity();// 人员基本信息
|
|
|
+ List<RyjbxxZSEntity> zsList = new ArrayList<RyjbxxZSEntity>();// 证书信息
|
|
|
+ for (int i = 6; i <= sheet.getLastRowNum(); i++) {
|
|
|
List<CodeEntity> codelist = null;
|
|
|
HSSFRow row = sheet.getRow(i);
|
|
|
try {
|
|
|
- //过滤掉序号没填或已删除的数据
|
|
|
- if(getRowCellString(row, 0) == null || "".equals(getRowCellString(row, 0).trim()))
|
|
|
+ // 过滤掉序号没填或已删除的数据
|
|
|
+ if (getRowCellString(row, 0) == null
|
|
|
+ || "".equals(getRowCellString(row, 0).trim()))
|
|
|
continue;
|
|
|
- ryjbxxEntity = new RyjbxxEntity();
|
|
|
+ ryjbxxEntity = new RyjbxxEntity();
|
|
|
zsList = new ArrayList<RyjbxxZSEntity>();
|
|
|
// 所在地
|
|
|
- if(getRowCellString(row, 1)==null)
|
|
|
- continue;
|
|
|
+ if (getRowCellString(row, 1) == null)
|
|
|
+ continue;
|
|
|
codelist = codeService.findByBz(getRowCellString(row, 1));
|
|
|
if (codelist != null && codelist.size() > 0) {
|
|
|
ryjbxxEntity.setSzd(codelist.get(0));
|
|
|
} else {
|
|
|
rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- +getRowCellString(row, 0)+ ":不存在的所在地");
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":不存在的所在地");
|
|
|
continue;
|
|
|
}
|
|
|
// 港区
|
|
|
List<GqEntity> gqlist = null;
|
|
|
- //查询所在地下的港区
|
|
|
+ // 查询所在地下的港区
|
|
|
if (codelist != null && codelist.size() > 0) {
|
|
|
- gqlist = gqService.findByNameAndSzd(getRowCellString(row, 2),codelist.get(0).getId() + "%");
|
|
|
+ gqlist = gqService.findByNameAndSzd(
|
|
|
+ getRowCellString(row, 2), codelist.get(0).getId()
|
|
|
+ + "%");
|
|
|
} else {
|
|
|
gqlist = gqService.findByName(getRowCellString(row, 2));
|
|
|
- }
|
|
|
+ }
|
|
|
// 港区不是这个所在地下的也不行
|
|
|
if (gqlist != null && gqlist.size() > 0) {
|
|
|
- //根据港区的所在地来设置所在地
|
|
|
+ // 根据港区的所在地来设置所在地
|
|
|
ryjbxxEntity.setSsgq(gqlist.get(0));
|
|
|
ryjbxxEntity.setSzd(gqlist.get(0).getSzd());
|
|
|
} else {
|
|
|
rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0) + ":不存在的港区");
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":不存在的港区");
|
|
|
continue;
|
|
|
}
|
|
|
- //姓名
|
|
|
+ // 姓名
|
|
|
String xm = getRowCellString(row, 3);
|
|
|
- if(xm == null || xm.trim().isEmpty()) {
|
|
|
- rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0) + ":姓名为空");
|
|
|
+ if (xm == null || xm.trim().isEmpty()) {
|
|
|
+ rowlist.add(row);
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":姓名为空");
|
|
|
continue;
|
|
|
}
|
|
|
ryjbxxEntity.setXm(xm.trim());
|
|
|
- //证件类型
|
|
|
- codelist = codeService.findByBz(getRowCellString( row, 4));
|
|
|
+ // 证件类型
|
|
|
+ codelist = codeService.findByBz(getRowCellString(row, 4));
|
|
|
if (codelist != null && codelist.size() > 0) {
|
|
|
ryjbxxEntity.setZjlx(codelist.get(0));
|
|
|
} else {
|
|
|
rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- +getRowCellString(row, 0)+ ":不存在的证件类型");
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":不存在的证件类型");
|
|
|
continue;
|
|
|
}
|
|
|
- //证件号码
|
|
|
+ // 证件号码
|
|
|
String zjhm = getRowCellString(row, 5);
|
|
|
- if(zjhm == null || zjhm.trim().isEmpty()) {
|
|
|
- rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0) + ":证件号码为空");
|
|
|
+ if (zjhm == null || zjhm.trim().isEmpty()) {
|
|
|
+ rowlist.add(row);
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":证件号码为空");
|
|
|
continue;
|
|
|
}
|
|
|
- if(ryjbxxEntity.getZjlx().getId() == 80102 && !zjhm.matches("^[1-9]{1}\\d{16}[0-9X]{1}$")) {
|
|
|
- rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0) + ":身份证号格式不对");
|
|
|
+ if (ryjbxxEntity.getZjlx().getId() == 80102
|
|
|
+ && !zjhm.matches("^[1-9]{1}\\d{16}[0-9X]{1}$")) {
|
|
|
+ rowlist.add(row);
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":身份证号格式不对");
|
|
|
continue;
|
|
|
}
|
|
|
ryjbxxEntity.setSfzh(zjhm);
|
|
|
// 港口经营人
|
|
|
- List<JyrEntity> jyrlist = jyrService.findByName(getRowCellString(row, 6));
|
|
|
+ List<JyrEntity> jyrlist = jyrService
|
|
|
+ .findByName(getRowCellString(row, 6));
|
|
|
if (jyrlist != null && jyrlist.size() > 0) {
|
|
|
ryjbxxEntity.setSsjyr(jyrlist.get(0));
|
|
|
} else {
|
|
|
rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0)
|
|
|
- + ":不存在的经营人");
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":不存在的经营人");
|
|
|
continue;
|
|
|
}
|
|
|
- //人员类型
|
|
|
- codelist = codeService.findByBz(getRowCellString( row, 7));
|
|
|
+ // 人员类型
|
|
|
+ codelist = codeService.findByBz(getRowCellString(row, 7));
|
|
|
if (codelist != null && codelist.size() > 0) {
|
|
|
ryjbxxEntity.setRylx(codelist.get(0));
|
|
|
} else {
|
|
|
rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- +getRowCellString(row, 0)+ ":不存在的人员类型");
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":不存在的人员类型");
|
|
|
continue;
|
|
|
- }
|
|
|
- //职务
|
|
|
+ }
|
|
|
+ // 职务
|
|
|
ryjbxxEntity.setZwhzc(getRowCellString(row, 8));
|
|
|
- //联系电话
|
|
|
+ // 联系电话
|
|
|
ryjbxxEntity.setLxdh(getRowCellString(row, 9));
|
|
|
- //备注
|
|
|
+ // 备注
|
|
|
ryjbxxEntity.setBz(getRowCellString(row, 10));
|
|
|
- //根据身份证号查询是否已经存在该人的数据
|
|
|
- List<RyjbxxEntity> ryjbxxEntities = service.findRyBySfzh(ryjbxxEntity.getSfzh());
|
|
|
- if(ryjbxxEntities != null && ryjbxxEntities.size()>0) {
|
|
|
- RyjbxxEntity ryjbxxEntity2 = ryjbxxEntities.get(0);
|
|
|
+ // 根据身份证号查询是否已经存在该人的数据
|
|
|
+ List<RyjbxxEntity> ryjbxxEntities = service
|
|
|
+ .findRyBySfzh(ryjbxxEntity.getSfzh());
|
|
|
+ if (ryjbxxEntities != null && ryjbxxEntities.size() > 0) {
|
|
|
+ RyjbxxEntity ryjbxxEntity2 = ryjbxxEntities.get(0);
|
|
|
ryjbxxEntity.setId(ryjbxxEntity2.getId());
|
|
|
ryjbxxEntity.setRecordCode(ryjbxxEntity2.getRecordCode());
|
|
|
ryjbxxEntity.setAddDate(ryjbxxEntity2.getAddDate());
|
|
|
ryjbxxEntity.setAddUser(ryjbxxEntity2.getAddUser());
|
|
|
ryjbxxEntity.setUpdateDate(new Date());
|
|
|
ryjbxxEntity.setUpdateUser(Utils.getCurrentUser());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
ryjbxxEntity.setAddDate(new Date());
|
|
|
ryjbxxEntity.setAddUser(Utils.getCurrentUser());
|
|
|
ryjbxxEntity.setRecordCode(getCurrentRoleCode(fid));
|
|
|
}
|
|
|
do {
|
|
|
RyjbxxZSEntity ryjbxxZSEntity = new RyjbxxZSEntity();
|
|
|
- //证书名称
|
|
|
+ // 证书名称
|
|
|
String zsmc = getRowCellString(row, 11);
|
|
|
- if(zsmc == null || zsmc.trim().isEmpty()) {
|
|
|
- rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0) + ":证书名称为空");
|
|
|
+ if (zsmc == null || zsmc.trim().isEmpty()) {
|
|
|
+ rowlist.add(row);
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":证书名称为空");
|
|
|
continue;
|
|
|
}
|
|
|
ryjbxxZSEntity.setZsmc(zsmc);
|
|
|
- //证书种类
|
|
|
+ // 证书种类
|
|
|
ryjbxxZSEntity.setZszl(getRowCellString(row, 12));
|
|
|
- //证书编号
|
|
|
+ // 证书编号
|
|
|
String zsbh = getRowCellString(row, 13);
|
|
|
- if(zsbh == null || zsbh.trim().isEmpty()) {
|
|
|
+ if (zsbh == null || zsbh.trim().isEmpty()) {
|
|
|
rowlist.add(row);
|
|
|
- strList.add("序号"
|
|
|
- + getRowCellString(row, 0) + ":证书编号为空");
|
|
|
+ strList.add("序号" + getRowCellString(row, 0) + ":证书编号为空");
|
|
|
continue;
|
|
|
}
|
|
|
ryjbxxZSEntity.setZsbh(zsbh);
|
|
|
- //有效期
|
|
|
+ // 有效期
|
|
|
String yxq = getRowCellString(row, 14);
|
|
|
- if(yxq !=null && yxq.matches("\\d{4}-\\d{2}-\\d{2}"))
|
|
|
+ if (yxq != null && yxq.matches("\\d{4}-\\d{2}-\\d{2}"))
|
|
|
ryjbxxZSEntity.setYxq(sdf.parse(yxq));
|
|
|
ryjbxxZSEntity.setSzd(ryjbxxEntity.getSzd());
|
|
|
ryjbxxZSEntity.setAddDate(new Date());
|
|
|
ryjbxxZSEntity.setAddUser(Utils.getCurrentUser());
|
|
|
zsList.add(ryjbxxZSEntity);
|
|
|
- } while(++i<=sheet.getLastRowNum() && (getRowCellString(row = sheet.getRow(i), 1) == null
|
|
|
- || getRowCellString(row, 1).trim().isEmpty()));
|
|
|
+ } while (++i <= sheet.getLastRowNum()
|
|
|
+ && (getRowCellString(row = sheet.getRow(i), 1) == null || getRowCellString(
|
|
|
+ row, 1).trim().isEmpty()));
|
|
|
i--;
|
|
|
- ryjbxxEntity = service.save(ryjbxxEntity, zsList, new ArrayList<RyjbxxZSEntity>());
|
|
|
- list.add(ryjbxxEntity);
|
|
|
- }catch (Exception e) {
|
|
|
+ ryjbxxEntity = service.save(ryjbxxEntity, zsList,
|
|
|
+ new ArrayList<RyjbxxZSEntity>());
|
|
|
+ list.add(ryjbxxEntity);
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
rowlist.add(row);
|
|
|
continue;
|
|
@@ -571,21 +595,21 @@ public class RyjbxxController extends BaseController {
|
|
|
map.put("info", strList);
|
|
|
return map;
|
|
|
}
|
|
|
-
|
|
|
- public String getRowCellString(HSSFRow row , int i ) {
|
|
|
- if(row.getCell(i)!=null) {
|
|
|
+
|
|
|
+ public String getRowCellString(HSSFRow row, int i) {
|
|
|
+ if (row.getCell(i) != null) {
|
|
|
row.getCell(i).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- return row.getCell(i).getRichStringCellValue().getString();
|
|
|
+ return row.getCell(i).getRichStringCellValue().getString();
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public HSSFWorkbook paraseExcel(byte[] bytes) throws IOException {
|
|
|
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook(is);
|
|
|
return workbook;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private Long exportInfo(List<String> strlist) throws Exception, IOException {
|
|
|
StringBuffer sbf = new StringBuffer();
|
|
|
for (String str : strlist) {
|
|
@@ -603,7 +627,7 @@ public class RyjbxxController extends BaseController {
|
|
|
blob.setValue(sbf.toString().getBytes());
|
|
|
accessoryEntity.setContent(blob);
|
|
|
accessoryEntity.setName("errorInfo.txt");
|
|
|
- accessoryEntity.setSuffix("txt");
|
|
|
+ accessoryEntity.setSuffix("txt");
|
|
|
return accessoryService.save(accessoryEntity).getId();
|
|
|
}
|
|
|
}
|