|
@@ -1,17 +1,34 @@
|
|
|
package com.xt.js.gkaq.web.ctl;
|
|
|
|
|
|
+import java.io.BufferedInputStream;
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
+import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.sql.Blob;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.swing.text.StyledEditorKit.BoldAction;
|
|
|
|
|
|
+import oracle.sql.BLOB;
|
|
|
+
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Lookup;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -23,19 +40,32 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.xt.js.gkaq.common.BaseCtl;
|
|
|
import com.xt.js.gkaq.common.BaseUUIDModel;
|
|
|
+import com.xt.js.gkaq.common.Constants;
|
|
|
+import com.xt.js.gkaq.common.util.FileUtil;
|
|
|
+import com.xt.js.gkaq.dwxx.model.JyrjcxxModel;
|
|
|
import com.xt.js.gkaq.dwxx.service.JyrjcxxService;
|
|
|
+import com.xt.js.gkaq.frame.model.CodeModel;
|
|
|
+import com.xt.js.gkaq.frame.model.CodeModelDto;
|
|
|
import com.xt.js.gkaq.frame.model.ComboBoxDto;
|
|
|
+import com.xt.js.gkaq.frame.model.UserModel;
|
|
|
import com.xt.js.gkaq.frame.service.CodeService;
|
|
|
import com.xt.js.gkaq.web.model.BloBModel;
|
|
|
+import com.xt.js.gkaq.web.model.FjbModel;
|
|
|
import com.xt.js.gkaq.web.model.GqModel;
|
|
|
import com.xt.js.gkaq.web.model.JyrUserListModel;
|
|
|
import com.xt.js.gkaq.web.model.JyrUserModel;
|
|
|
+import com.xt.js.gkaq.web.model.JyrUserTJModel;
|
|
|
+import com.xt.js.gkaq.web.model.RyzsbInfoModel;
|
|
|
+import com.xt.js.gkaq.web.model.RyzsbModel;
|
|
|
import com.xt.js.gkaq.web.service.BloBService;
|
|
|
+import com.xt.js.gkaq.web.service.FjbService;
|
|
|
import com.xt.js.gkaq.web.service.GqService;
|
|
|
import com.xt.js.gkaq.web.service.JyrUserService;
|
|
|
import com.xt.js.gkaq.web.service.RyzsbService;
|
|
|
import com.xt.js.gkaq.web.vo.BloBVo;
|
|
|
+import com.xt.js.gkaq.web.vo.FjbVo;
|
|
|
import com.xt.js.gkaq.web.vo.JyrUserVo;
|
|
|
+import com.xt.js.gkaq.web.vo.RyzsbVo;
|
|
|
import com.yuanxd.tools.pagehelper.PageHelper;
|
|
|
import com.yuanxd.tools.pagehelper.PageInfo;
|
|
|
import com.yuanxd.tools.utils.WebJsonResult;
|
|
@@ -59,13 +89,15 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
|
|
|
@Autowired
|
|
|
private RyzsbService ryzsbService;
|
|
|
+ @Autowired
|
|
|
+ private FjbService fjbService;
|
|
|
|
|
|
@RequestMapping("")
|
|
|
public String main(HttpServletRequest request) {
|
|
|
//加载所在地
|
|
|
List<ComboBoxDto> list = codeService.findByPcode("DM_SZD");
|
|
|
//加载人员类型
|
|
|
- List<ComboBoxDto> rylxList = codeService.findByPcode("RYLX");
|
|
|
+ List<com.xt.js.gkaq.dwxx.model.ComboBoxDto> rylxList = jyrUserService.getSelect("RYLX");
|
|
|
request.setAttribute("code", list);
|
|
|
request.setAttribute("rylx", rylxList);
|
|
|
return "dwxx/jyrUser/main";
|
|
@@ -89,7 +121,7 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
@ResponseBody
|
|
|
public String getRylx() {
|
|
|
//加载人员类型
|
|
|
- List<ComboBoxDto> rylxList = codeService.findByPcode("RYLX");
|
|
|
+ List<com.xt.js.gkaq.dwxx.model.ComboBoxDto> rylxList = jyrUserService.getSelect("RYLX");
|
|
|
return JSONArray.toJSONString(rylxList);
|
|
|
}
|
|
|
/**
|
|
@@ -128,7 +160,9 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
@ResponseBody
|
|
|
public String getJyr(String szd) {
|
|
|
//获取经营人
|
|
|
- List<com.xt.js.gkaq.dwxx.model.ComboBoxDto> jyrlist = jyrjcxxService.getSelect(szd);
|
|
|
+ JyrjcxxModel model = new JyrjcxxModel();
|
|
|
+ model .setSzd(szd);
|
|
|
+ List<com.xt.js.gkaq.dwxx.model.ComboBoxDto> jyrlist = jyrjcxxService.getSelect(model);
|
|
|
return JSONArray.toJSONString(jyrlist);
|
|
|
}
|
|
|
/**
|
|
@@ -139,20 +173,35 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
@RequestMapping("list")
|
|
|
@ResponseBody
|
|
|
public PageInfo<JyrUserListModel> list(JyrUserVo vo) {
|
|
|
- if (null == vo.getPage() || vo.getPage() < 1) {
|
|
|
- vo.setPage(1);
|
|
|
- }
|
|
|
- if (null == vo.getRows() || vo.getRows() < 1) {
|
|
|
- vo.setRows(1);
|
|
|
- }
|
|
|
- PageHelper.startPage(vo.getPage(), vo.getRows());
|
|
|
+ PageHelper.startPage(vo.getcPage(), vo.getpSize());
|
|
|
JyrUserModel model = new JyrUserModel();
|
|
|
BeanUtils.copyProperties(vo, model);
|
|
|
List<JyrUserListModel> list = jyrUserService.selectInfo(model);
|
|
|
PageInfo<JyrUserListModel> pageResult = new PageInfo<>(list);
|
|
|
return pageResult;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 加载统计的数据表格
|
|
|
+ * @param vo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("selectTJByInfo")
|
|
|
+ @ResponseBody
|
|
|
+ public PageInfo<JyrUserTJModel> selectTJByInfo(JyrUserVo vo) {
|
|
|
+ PageHelper.startPage(vo.getcPage(), vo.getpSize());
|
|
|
+ JyrUserModel model = new JyrUserModel();
|
|
|
+ BeanUtils.copyProperties(vo, model);
|
|
|
+ String year = vo.getByzd1();
|
|
|
+ if (year != null && !"".equals(year)) {
|
|
|
+ String createTime = year + "-01-01";
|
|
|
+ String updateTime = year + "-12-31";
|
|
|
+ model.setByzd1(createTime);
|
|
|
+ model.setByzd2(updateTime);
|
|
|
+ }
|
|
|
+ List<JyrUserTJModel> list = jyrUserService.selectTJByInfo(model);
|
|
|
+ PageInfo<JyrUserTJModel> pageResult = new PageInfo<>(list);
|
|
|
+ return pageResult;
|
|
|
+ }
|
|
|
/**
|
|
|
* 编辑详情
|
|
|
* @return
|
|
@@ -165,6 +214,19 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 人员证书表的编辑详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("initRyzsbEdit")
|
|
|
+ @ResponseBody
|
|
|
+ public String initRyzsbEdit (String id) {
|
|
|
+ RyzsbModel model = new RyzsbModel();
|
|
|
+ model.setRyid(id);
|
|
|
+ List<RyzsbInfoModel> list = ryzsbService.selectInfo(model);
|
|
|
+ return JSONArray.toJSONString(list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 添加或修改
|
|
|
* @param vo
|
|
|
* @return
|
|
@@ -177,8 +239,6 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
//添加
|
|
|
JyrUserModel model = new JyrUserModel();
|
|
|
BeanUtils.copyProperties(vo, model);
|
|
|
-
|
|
|
-
|
|
|
jyrUserService.add(model);
|
|
|
} else {
|
|
|
//修改
|
|
@@ -188,60 +248,139 @@ public class JyrUserCtl extends BaseCtl {
|
|
|
}
|
|
|
return success();
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 保存人员证书
|
|
|
+ * @param request
|
|
|
+ * @param fileName
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @RequestMapping("saveBlob")
|
|
|
+ @ResponseBody
|
|
|
+ public WebJsonResult saveBlob (HttpServletRequest request, String fileName,BloBVo vo){
|
|
|
+ String webpath = request.getSession().getServletContext().getRealPath("/uplod");//程序路径
|
|
|
+ BloBModel model = new BloBModel();
|
|
|
+ //保存的文件名是否为空
|
|
|
+ if (fileName != null && !"".equals(fileName)) {
|
|
|
+ String filepath = webpath + "/" + fileName;
|
|
|
+ File file = new File(filepath);
|
|
|
+
|
|
|
+ try {
|
|
|
+ InputStream inputStream = new FileInputStream(file);
|
|
|
+ byte[] data = FileUtil.inputStreamToByte(inputStream);
|
|
|
+ //判断是修改还是添加
|
|
|
+ if (vo.getId() != null && !"".equals(vo.getId())) {
|
|
|
+ model = bloBService.findById(vo.getId());
|
|
|
+ model.setValue(data);
|
|
|
+ model.setSzd(vo.getSzd());
|
|
|
+ bloBService.update(model);
|
|
|
+ } else {
|
|
|
+ model.setValue(data);
|
|
|
+ model.setSzd(vo.getSzd());
|
|
|
+ bloBService.add(model);
|
|
|
+ }
|
|
|
+ //释放读取的文件流的自由
|
|
|
+ inputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ //删除文件
|
|
|
+ FileUtil.filedelete(webpath + "/"+fileName);
|
|
|
+ }
|
|
|
+ //设置参数返回值
|
|
|
+ WebJsonResult jsonResult = new WebJsonResult();
|
|
|
+ jsonResult.setAttr("zsnr",model.getId());
|
|
|
+ jsonResult.setSuccess(true);
|
|
|
+ return jsonResult;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
- * 添加或修改证书
|
|
|
+ * 保存人员证书信息
|
|
|
* @param vo
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping("saveBlob")
|
|
|
+ @RequestMapping("saveRyzsInfo")
|
|
|
@ResponseBody
|
|
|
- public WebJsonResult saveBlob ( HttpServletRequest request,BloBVo vo) {
|
|
|
- String path = request.getSession().getServletContext().getRealPath("");
|
|
|
-
|
|
|
- // 创建一个通用的多部分解析器
|
|
|
- CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession()
|
|
|
- .getServletContext());
|
|
|
- // 判断 request 是否有文件上传,即多部分请求
|
|
|
- if (multipartResolver.isMultipart(request)) {
|
|
|
- // 转换成多部分request
|
|
|
- MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
|
|
|
- // 取得request中的所有文件名
|
|
|
+ public WebJsonResult saveRyzsInfo (RyzsbVo vo) {
|
|
|
+ RyzsbModel model = new RyzsbModel();
|
|
|
+ if (vo.getId() != null && !"".equals(vo.getId())) {
|
|
|
+ model = ryzsbService.findById(vo.getId());
|
|
|
+ BeanUtils.copyProperties(vo,model);
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ try {
|
|
|
+ model.setYxq(sdf.parse(vo.getYxq()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ ryzsbService.update(model);
|
|
|
+ } else {
|
|
|
+ BeanUtils.copyProperties(vo,model);
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ try {
|
|
|
+ model.setYxq(sdf.parse(vo.getYxq()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ ryzsbService.add(model);
|
|
|
}
|
|
|
- String sys = "C:\\Users\\Administrator\\Desktop\\";
|
|
|
- InputStream inputStream;
|
|
|
- byte[] data = new byte[] {};
|
|
|
- try {
|
|
|
- inputStream = new FileInputStream(new File(sys+vo.getFile()));
|
|
|
- data = inputStreamToByte(inputStream);
|
|
|
- } catch (FileNotFoundException e1) {
|
|
|
- e1.printStackTrace();
|
|
|
- }catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- //将文件保存到字节数组中
|
|
|
- if (StringUtils.isEmpty(vo.getId())) {
|
|
|
- //添加
|
|
|
- BloBModel model = new BloBModel();
|
|
|
- BeanUtils.copyProperties(vo, model);
|
|
|
- model.setValue(data);
|
|
|
- bloBService.add(model);
|
|
|
+
|
|
|
+ //设置参数返回值
|
|
|
+ WebJsonResult jsonResult = new WebJsonResult();
|
|
|
+ jsonResult.setAttr("ssid",model.getId());
|
|
|
+ jsonResult.setSuccess(true);
|
|
|
+ return jsonResult;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 保存证书信息到附件表
|
|
|
+ * @param vo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("saveFjInfo")
|
|
|
+ @ResponseBody
|
|
|
+ public WebJsonResult saveFjInfo (FjbVo vo) {
|
|
|
+ FjbModel model = new FjbModel();
|
|
|
+ if (vo.getId() != null && !"".equals(vo.getId())) {
|
|
|
+ model = fjbService.findById(vo.getId());
|
|
|
+ BeanUtils.copyProperties(vo,model);
|
|
|
+ fjbService.update(model);
|
|
|
} else {
|
|
|
- //修改
|
|
|
- BloBModel model = bloBService.findById(vo.getId());
|
|
|
- BeanUtils.copyProperties(vo, model);
|
|
|
- bloBService.update(model);
|
|
|
+ BeanUtils.copyProperties(vo,model);
|
|
|
+ CodeModelDto codeModel = new CodeModelDto();
|
|
|
+ codeModel.setPcode("FJSSLX");//父级类别
|
|
|
+ codeModel.setCode("T_YJPT_JYRDRYZS");//所属类别
|
|
|
+ List<com.xt.js.gkaq.dwxx.model.ComboBoxDto> list = ryzsbService.selectCode(codeModel);
|
|
|
+ model.setSslx(list.get(0).getOptVal());
|
|
|
+ fjbService.add(model);
|
|
|
}
|
|
|
+
|
|
|
return success();
|
|
|
}
|
|
|
- private byte [] inputStreamToByte(InputStream is) throws IOException {
|
|
|
- ByteArrayOutputStream bAOutputStream = new ByteArrayOutputStream();
|
|
|
- int ch;
|
|
|
- while((ch = is.read() ) != -1){
|
|
|
- bAOutputStream.write(ch);
|
|
|
+ /**
|
|
|
+ * 文件删除
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("fileDel")
|
|
|
+ @ResponseBody
|
|
|
+ public WebJsonResult fileDel (String id,String fjid) {
|
|
|
+ //获取人员证书表信息
|
|
|
+ RyzsbModel model = ryzsbService.findById(id);
|
|
|
+ //附件表信息
|
|
|
+ FjbModel fjb = fjbService.findById(fjid);
|
|
|
+ if(model != null && fjb != null) {
|
|
|
+ fjb.setState("9");//修改附件表状态
|
|
|
+ fjbService.update(fjb);//删除附件表信息
|
|
|
+ model.setState("9");//修改人员证书状态
|
|
|
+ ryzsbService.update(model);//删除人员证书信息
|
|
|
+ } else {
|
|
|
+ //设置参数返回值
|
|
|
+ WebJsonResult jsonResult = new WebJsonResult();
|
|
|
+ jsonResult.setMessage("您要删除的信息不存在,请刷新页面后再操作!");
|
|
|
+ jsonResult.setSuccess(false);
|
|
|
+ return jsonResult;
|
|
|
}
|
|
|
- byte data [] =bAOutputStream.toByteArray();
|
|
|
- bAOutputStream.close();
|
|
|
- return data;
|
|
|
+
|
|
|
+ return success();
|
|
|
}
|
|
|
/**
|
|
|
* 删除信息,可多条删除
|