Commit 3192c866 by liru

导入

parent 0ca98c03
...@@ -3,6 +3,18 @@ package com.ruoyi.web.controller.system; ...@@ -3,6 +3,18 @@ package com.ruoyi.web.controller.system;
import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.system.domain.OrhonShzz; import com.ruoyi.system.domain.OrhonShzz;
import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.domain.SysUser;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* 社会组织信息Controller * 社会组织信息Controller
...@@ -44,6 +56,38 @@ public class OrhonShzzController extends com.ruoyi.common.core.controller.BaseCo ...@@ -44,6 +56,38 @@ public class OrhonShzzController extends com.ruoyi.common.core.controller.BaseCo
} }
/** /**
* 导入社会组织信息列表
*/
@org.apache.shiro.authz.annotation.RequiresPermissions("system:shzz:importExcel")
@com.ruoyi.common.annotation.Log(title = "社会组织信息", businessType = com.ruoyi.common.enums.BusinessType.EXPORT)
@org.springframework.web.bind.annotation.PostMapping("/importExcel")
@org.springframework.web.bind.annotation.ResponseBody
public com.ruoyi.common.core.domain.AjaxResult importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
try {
InputStream is = file.getInputStream();
com.ruoyi.common.utils.poi.ExcelUtil<com.ruoyi.system.domain.OrhonShzz> util = new com.ruoyi.common.utils.poi.ExcelUtil<com.ruoyi.system.domain.OrhonShzz>( com.ruoyi.system.domain.OrhonShzz.class);
java.util.List<com.ruoyi.system.domain.OrhonShzz> list = util.importExcel(is);
java.util.List<com.ruoyi.system.domain.OrhonShzz> wrongList =new ArrayList<>();
for(OrhonShzz orhonShzz:list){
OrhonShzz o=new OrhonShzz();
o.setMc(orhonShzz.getMc());
java.util.List<com.ruoyi.system.domain.OrhonShzz> oldlist=orhonShzzService.selectOrhonShzzList(o);
if(oldlist.size()<1){
wrongList.add(orhonShzz);
}else{
orhonShzz.setId(oldlist.get(0).getId());
orhonShzzService.updateOrhonShzz(orhonShzz);
}
}
return util.exportExcel(wrongList, "shzz");
}catch (Exception e) {
System.out.println("未找到指定路径的文件!");
e.printStackTrace();
return toAjax(0);
}
}
/**
* 导出社会组织信息列表 * 导出社会组织信息列表
*/ */
@org.apache.shiro.authz.annotation.RequiresPermissions("system:shzz:export") @org.apache.shiro.authz.annotation.RequiresPermissions("system:shzz:export")
......
...@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dzzsdgx" column="dzzsdgx" /> <result property="dzzsdgx" column="dzzsdgx" />
<result property="hjxx" column="hjxx" /> <result property="hjxx" column="hjxx" />
<result property="dfzh" column="dfzh" /> <result property="dfzh" column="dfzh" />
<result property="nyysr" column="nyysr" />
</resultMap> </resultMap>
<sql id="selectOrhonGtxxVo"> <sql id="selectOrhonGtxxVo">
...@@ -134,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -134,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dzzsdgx != null "> and dzzsdgx = #{dzzsdgx}</if> <if test="dzzsdgx != null "> and dzzsdgx = #{dzzsdgx}</if>
<if test="hjxx != null "> and hjxx = #{hjxx}</if> <if test="hjxx != null "> and hjxx = #{hjxx}</if>
<if test="dfzh != null "> and dfzh = #{dfzh}</if> <if test="dfzh != null "> and dfzh = #{dfzh}</if>
<if test="nyysr != null "> and nyysr = #{nyysr}</if>
</where> </where>
</select> </select>
...@@ -206,6 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -206,6 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dzzsdgx != null">dzzsdgx,</if> <if test="dzzsdgx != null">dzzsdgx,</if>
<if test="hjxx != null">hjxx,</if> <if test="hjxx != null">hjxx,</if>
<if test="dfzh != null">dfzh,</if> <if test="dfzh != null">dfzh,</if>
<if test="nyysr != null">nyysr,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
...@@ -269,6 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -269,6 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dzzsdgx != null">#{dzzsdgx},</if> <if test="dzzsdgx != null">#{dzzsdgx},</if>
<if test="hjxx != null">#{hjxx},</if> <if test="hjxx != null">#{hjxx},</if>
<if test="dfzh != null">#{dfzh},</if> <if test="dfzh != null">#{dfzh},</if>
<if test="nyysr != null">#{nyysr},</if>
</trim> </trim>
</insert> </insert>
...@@ -335,6 +339,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -335,6 +339,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dzzsdgx != null">dzzsdgx = #{dzzsdgx},</if> <if test="dzzsdgx != null">dzzsdgx = #{dzzsdgx},</if>
<if test="hjxx != null">hjxx = #{hjxx},</if> <if test="hjxx != null">hjxx = #{hjxx},</if>
<if test="dfzh != null">dfzh = #{dfzh},</if> <if test="dfzh != null">dfzh = #{dfzh},</if>
<if test="nyysr != null">nyysr = #{nyysr},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
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