| | |
| | | create table lf.sys_apply ( |
| | | id serial primary key, |
| | | userid integer default 0, |
| | | depids varchar(100), |
| | | tables varchar(1000), |
| | | depids varchar(500), |
| | | tabs varchar(2000), |
| | | entities varchar(2000), |
| | | wkt varchar(4000), |
| | | pwd varchar(200), |
| | | status integer default 0, |
| | | count integer default 0, |
| | | descr varchar(50), |
| | |
| | | comment on column lf.sys_apply.id is '主键ID'; |
| | | comment on column lf.sys_apply.userid is '用户ID'; |
| | | comment on column lf.sys_apply.depids is '单位ID'; |
| | | comment on column lf.sys_apply.tables is '表名'; |
| | | comment on column lf.sys_apply.tabs is '表名'; |
| | | comment on column lf.sys_apply.entities is '实体名'; |
| | | comment on column lf.sys_apply.wkt is 'WKT'; |
| | | comment on column lf.sys_apply.pwd is '密码'; |
| | | comment on column lf.sys_apply.status is '状态:-10-作废,-1-打回,0-申请中,1~9,审核中,10-通过'; |
| | | comment on column lf.sys_apply.count is '审核总数'; |
| | | comment on column lf.sys_apply.descr is '描述'; |
| | |
| | | and ST_Intersects(geom, ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4490)) |
| | | group by depid; |
| | | |
| | | |
| | | SELECT depid FROM bd.dlg_agnp WHERE depid > 0 AND depid != ALL(fn_rec_array(38, 'dep')) |
| | | AND ST_Intersects(ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4326), geom)) |
| | | |
| | | |
| | | |
| | |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == reqEntity.getEntities() || reqEntity.getEntities().isEmpty()) { |
| | | if (null == reqEntity.getTabs() || null == reqEntity.getEntities() || reqEntity.getTabs().size() != reqEntity.getEntities().size()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) { |
| | |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | // |
| | | int rows = applyService.insertApply(ue, reqEntity); |
| | | |
| | | return success(null); |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | |
| | | |
| | | private List<String> entities; |
| | | |
| | | private List<String> tabs; |
| | | |
| | | private String descr; |
| | | |
| | | public DownloadReqEntity() { |
| | | } |
| | | |
| | |
| | | this.wkt = wkt; |
| | | } |
| | | |
| | | public List<String> getTabs() { |
| | | return tabs; |
| | | } |
| | | |
| | | public void setTabs(List<String> tabs) { |
| | | this.tabs = tabs; |
| | | } |
| | | |
| | | public List<String> getEntities() { |
| | | return entities; |
| | | } |
| | |
| | | public void setEntities(List<String> entities) { |
| | | this.entities = entities; |
| | | } |
| | | |
| | | public String getDescr() { |
| | | return descr; |
| | | } |
| | | |
| | | public void setDescr(String descr) { |
| | | this.descr = descr; |
| | | } |
| | | } |
| | |
| | | * @author WWW |
| | | */ |
| | | public class ApplyEntity implements Serializable { |
| | | private static final long serialVersionUID = -681840196569375744L; |
| | | private static final long serialVersionUID = -849213119060365952L; |
| | | |
| | | private int id; |
| | | |
| | |
| | | |
| | | private String depids; |
| | | |
| | | private String tables; |
| | | private String tabs; |
| | | |
| | | private String entities; |
| | | |
| | | private String wkt; |
| | | |
| | | private String pwd; |
| | | |
| | | private int status; |
| | | |
| | |
| | | this.depids = depids; |
| | | } |
| | | |
| | | public String getTables() { |
| | | return tables; |
| | | public String getTabs() { |
| | | return tabs; |
| | | } |
| | | |
| | | public void setTables(String tables) { |
| | | this.tables = tables; |
| | | public void setTabs(String tabs) { |
| | | this.tabs = tabs; |
| | | } |
| | | |
| | | public String getEntities() { |
| | | return entities; |
| | | } |
| | | |
| | | public void setEntities(String entities) { |
| | | this.entities = entities; |
| | | } |
| | | |
| | | public String getWkt() { |
| | |
| | | this.wkt = wkt; |
| | | } |
| | | |
| | | public String getPwd() { |
| | | return pwd; |
| | | } |
| | | |
| | | public void setPwd(String pwd) { |
| | | this.pwd = pwd; |
| | | } |
| | | |
| | | public int getStatus() { |
| | | return status; |
| | | } |
| | |
| | | /** |
| | | * 连接List集合 |
| | | * |
| | | * @param list 整数集合 |
| | | * @param join 连接字符 |
| | | * @return |
| | | * @param list list 整数集合 |
| | | * @param join join 连接字符 |
| | | * @param <T> 泛型类 |
| | | * @return 字符串 |
| | | */ |
| | | public static String join(List<Integer> list, String join) { |
| | | public static <T> String join(List<T> list, String join) { |
| | | if (null == list || list.isEmpty()) { |
| | | return ""; |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Integer i : list) { |
| | | if (null != i) { |
| | | sb.append(i.toString() + join); |
| | | for (T t : list) { |
| | | if (null != t) { |
| | | sb.append(t.toString() + join); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.lf.server.entity.ctrl.DownloadReqEntity; |
| | | import com.lf.server.entity.show.ApplyEntity; |
| | | import com.lf.server.entity.show.FlowEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.Md5Helper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.show.ApplyMapper; |
| | | import org.hsqldb.rights.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public class ApplyService implements ApplyMapper { |
| | | @Autowired |
| | | ApplyMapper applyMapper; |
| | | |
| | | @Autowired |
| | | FlowService flowService; |
| | | |
| | | @Override |
| | | public Integer selectCount(Integer userid) { |
| | |
| | | return applyMapper.updates(list); |
| | | } |
| | | |
| | | public Integer insertApply(){ |
| | | /** |
| | | * 插入数据申请 |
| | | */ |
| | | public Integer insertApply(UserEntity ue, DownloadReqEntity dr) { |
| | | ApplyEntity apply = getApplyEntity(ue, dr); |
| | | int rows = applyMapper.insert(apply); |
| | | if (0 == rows) { |
| | | return 0; |
| | | } |
| | | |
| | | List<FlowEntity> list = getFlowEntities(apply.getId(), ue, dr); |
| | | rows = flowService.inserts(list); |
| | | |
| | | return 0; |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * 获取数据申请实体类 |
| | | */ |
| | | private ApplyEntity getApplyEntity(UserEntity ue, DownloadReqEntity dr) { |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); |
| | | |
| | | ApplyEntity apply = new ApplyEntity(); |
| | | apply.setUserid(ue.getId()); |
| | | apply.setDepids(StringHelper.join(dr.getIds(), ",")); |
| | | apply.setTabs(StringHelper.join(dr.getTabs(), ",")); |
| | | apply.setEntities(StringHelper.join(dr.getEntities(), ",")); |
| | | apply.setWkt(dr.getWkt()); |
| | | apply.setPwd(dbPwd); |
| | | apply.setStatus(0); |
| | | apply.setCount(dr.getIds().size()); |
| | | apply.setDescr(dr.getDescr()); |
| | | apply.setCreateUser(ue.getId()); |
| | | |
| | | return apply; |
| | | } |
| | | |
| | | /** |
| | | * 获取申请流程实体类集合 |
| | | */ |
| | | private List<FlowEntity> getFlowEntities(Integer applyId, UserEntity ue, DownloadReqEntity dr) { |
| | | List<FlowEntity> list = new ArrayList<>(); |
| | | for (Integer depid : dr.getIds()) { |
| | | UserEntity user = selectUserByDepid(depid); |
| | | |
| | | FlowEntity flow = new FlowEntity(); |
| | | flow.setApplyid(applyId); |
| | | flow.setDepid(depid); |
| | | flow.setUserid(user.getId()); |
| | | flow.setStatus(0); |
| | | flow.setDescr(null); |
| | | flow.setCreateUser(ue.getId()); |
| | | |
| | | list.add(flow); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 根据单位ID查询用户 |
| | | */ |
| | | private UserEntity selectUserByDepid(Integer depid) { |
| | | // |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.lf.server.entity.show.ApplyEntity"> |
| | | insert into lf.sys_apply |
| | | (userid,depids,tables,wkt,status,count,descr,create_user,create_time) |
| | | values |
| | | (#{userid},#{depids},#{tables},#{wkt},#{status},#{count},#{descr},#{createUser},now()) |
| | | <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> |
| | | select currval('lf.sys_apply_id_seq'::regclass) as id |
| | | </selectKey> |
| | | |
| | | insert into lf.sys_apply |
| | | (userid,depids,tabs,entities,wkt,pwd,status,count,descr,create_user,create_time) |
| | | values |
| | | (#{userid},#{depids},#{tabs},#{entities},#{wkt},#{pwd},#{status},#{count},#{descr},#{createUser},now()) |
| | | </insert> |
| | | |
| | | <insert id="inserts"> |
| | | insert into lf.sys_apply |
| | | (userid,depids,tables,wkt,status,count,descr,create_user,create_time) |
| | | (userid,depids,tabs,entities,wkt,pwd,status,count,descr,create_user,create_time) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.userid},#{item.depids},#{item.tables},#{item.wkt},#{item.status},#{item.count},#{item.descr},#{item.createUser},now()) |
| | | (#{item.userid},#{item.depids},#{item.tabs},#{item.entities},#{item.wkt},#{item.pwd},#{item.status},#{item.count},#{item.descr},#{item.createUser},now()) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | |
| | | <update id="update"> |
| | | update lf.sys_apply |
| | | set userid=#{userid},depids=#{depids},tables=#{tables},wkt=#{wkt},status=#{status},count=#{count},descr=#{descr},update_user=#{updateUser},update_time=now() |
| | | set userid=#{userid},depids=#{depids},tabs=#{tabs},entities=#{entities},wkt=#{wkt},pwd=#{pwd},status=#{status},count=#{count},descr=#{descr},update_user=#{updateUser},update_time=now() |
| | | where id=#{id} |
| | | </update> |
| | | |
| | |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_apply |
| | | <set> |
| | | userid=#{item.userid},depids=#{item.depids},tables=#{item.tables},wkt=#{item.wkt},status=#{item.status},count=#{item.count},descr=#{item.descr},update_user=#{item.updateUser},update_time=now() |
| | | userid=#{item.userid},depids=#{item.depids},tabs=#{item.tabs},entities=#{item.entities},wkt=#{item.wkt},pwd=#{item.pwd},status=#{item.status},count=#{item.count},descr=#{item.descr},update_user=#{item.updateUser},update_time=now() |
| | | </set> |
| | | where id = #{item.id} |
| | | </foreach> |