Browse Source
# Conflicts: # esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDictService.java # esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDictServiceImpl.javadev
32 changed files with 1781 additions and 60 deletions
@ -0,0 +1,71 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 行政区划 |
|||
* |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:22 |
|||
*/ |
|||
@Data |
|||
public class AreaDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 9173956433924027751L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 父级ID |
|||
*/ |
|||
private Integer parentId; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 简称 |
|||
*/ |
|||
private String shortName; |
|||
/** |
|||
* 经度 |
|||
*/ |
|||
private Float longitude; |
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
private Float latitude; |
|||
/** |
|||
* 等级(1省/直辖市,2地级市,3区县,4镇/街道) |
|||
*/ |
|||
private Integer level; |
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
/** |
|||
* 状态(0禁用/1启用) |
|||
*/ |
|||
private Integer status; |
|||
} |
@ -0,0 +1,28 @@ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 行政区划简要信息 |
|||
* |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:22 |
|||
*/ |
|||
@Data |
|||
public class SimpleAreaDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3243672014476007901L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
} |
@ -0,0 +1,31 @@ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 数据字典简要信息 |
|||
* |
|||
* @author yujintao |
|||
* @date 2019/7/15 09:29 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "数据字典") |
|||
public class SysSimpleDictDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -4827806651372425347L; |
|||
|
|||
@ApiModelProperty(value = "字典名称") |
|||
@NotBlank(message = "{sysdict.name.require}", groups = DefaultGroup.class) |
|||
private String dictName; |
|||
|
|||
@ApiModelProperty(value = "字典值") |
|||
private String dictValue; |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.SimpleAreaDTO; |
|||
import com.elink.esua.epdc.service.AreaService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 获取行政区划 |
|||
* |
|||
* @author liuhongwei @elink-cn.com |
|||
* @since v1.0.0 2019-05-13 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("area") |
|||
public class AreaController { |
|||
|
|||
@Autowired |
|||
private AreaService areaService; |
|||
|
|||
/** |
|||
* 根据区划ID,获取下属区域列表 |
|||
* |
|||
* @param areaId |
|||
* @return com.elink.esua.commons.tools.utils.Result<java.util.List < com.elink.esua.dto.AreaDTO>> |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:28 |
|||
*/ |
|||
@GetMapping("listSimple/{areaId}") |
|||
public Result<List<SimpleAreaDTO>> listSimpleAreaInfo(@PathVariable("areaId") String areaId) { |
|||
return this.areaService.listSimpleAreaInfo(areaId); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.AreaEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:54 |
|||
*/ |
|||
@Mapper |
|||
public interface AreaDao extends BaseDao<AreaEntity> { |
|||
|
|||
} |
@ -0,0 +1,60 @@ |
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 行政区划 |
|||
* |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:25 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("area") |
|||
public class AreaEntity implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2139014717755304245L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 父级ID |
|||
*/ |
|||
private Integer parentId; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 简称 |
|||
*/ |
|||
private String shortName; |
|||
/** |
|||
* 经度 |
|||
*/ |
|||
private Float longitude; |
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
private Float latitude; |
|||
/** |
|||
* 等级(1省/直辖市,2地级市,3区县,4镇/街道) |
|||
*/ |
|||
private Integer level; |
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
/** |
|||
* 状态(0禁用/1启用) |
|||
*/ |
|||
private Integer status; |
|||
|
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisKeys; |
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import com.elink.esua.epdc.dto.SimpleAreaDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区划信息表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-05-08 |
|||
*/ |
|||
@Component |
|||
public class AreaRedis { |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* 取出区划信息 |
|||
* |
|||
* @param areaId 区域ID |
|||
* @return java.lang.String |
|||
* @author yujintao |
|||
* @date 2019/6/13 11:05 |
|||
*/ |
|||
public List<SimpleAreaDTO> getSimpleAreaList(String areaId) { |
|||
String configAreaKey = RedisKeys.getSimpleAreaKey(areaId); |
|||
return (List<SimpleAreaDTO>) redisUtils.get(configAreaKey); |
|||
} |
|||
|
|||
/** |
|||
* 缓存区划信息 |
|||
* |
|||
* @param areaId |
|||
* @param areaDtoList |
|||
* @return void |
|||
* @author yujintao |
|||
* @date 2019/6/13 11:02 |
|||
*/ |
|||
public void setSimpleAreaList(String areaId, List<SimpleAreaDTO> areaDtoList) { |
|||
String configAreaKey = RedisKeys.getSimpleAreaKey(areaId); |
|||
redisUtils.set(configAreaKey, areaDtoList); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisKeys; |
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import com.elink.esua.epdc.dto.SimpleAreaDTO; |
|||
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区划信息表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-05-08 |
|||
*/ |
|||
@Component |
|||
public class SysDictRedis { |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* 根据数据字典类型,从redis获取简版数据字典列表 |
|||
* |
|||
* @param dictType 数据字典类型 |
|||
* @return java.util.List<com.elink.esua.dto.SysSimpleDictDTO> |
|||
* @author yujintao |
|||
* @date 2019/7/15 09:42 |
|||
*/ |
|||
public List<SysSimpleDictDTO> getSimpleDictList(String dictType) { |
|||
String dictKey = RedisKeys.getSimpleDictKey(dictType); |
|||
return (List<SysSimpleDictDTO>) redisUtils.get(dictKey); |
|||
} |
|||
|
|||
/** |
|||
* 根据数据字典类型,将简版数据字典列表放入缓存 |
|||
* |
|||
* @param dictType 数据字典类型 |
|||
* @param simpleDictList 列表 |
|||
* @return void |
|||
* @author yujintao |
|||
* @date 2019/7/15 09:50 |
|||
*/ |
|||
public void setSimpleDictList(String dictType, List<SysSimpleDictDTO> simpleDictList) { |
|||
String dictKey = RedisKeys.getSimpleDictKey(dictType); |
|||
redisUtils.set(dictKey, simpleDictList); |
|||
} |
|||
|
|||
/** |
|||
* 根据数据字典类型,从redis删除简版数据字典列表 |
|||
* |
|||
* @param dictType |
|||
* @return void |
|||
* @author yujintao |
|||
* @date 2019/7/15 10:10 |
|||
*/ |
|||
public void removeSimpleDictList(String dictType) { |
|||
String dictKey = RedisKeys.getSimpleDictKey(dictType); |
|||
redisUtils.delete(dictKey); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.SimpleAreaDTO; |
|||
import com.elink.esua.epdc.entity.AreaEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 行政区划 |
|||
* |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:54 |
|||
*/ |
|||
public interface AreaService extends BaseService<AreaEntity> { |
|||
|
|||
|
|||
/** |
|||
* 根据区划ID,获取下属区域列表 |
|||
* |
|||
* @param areaId |
|||
* @return com.elink.esua.commons.tools.utils.Result<java.util.List < com.elink.esua.dto.AreaDTO>> |
|||
* @author yujintao |
|||
* @date 2019/6/13 10:35 |
|||
*/ |
|||
Result<List<SimpleAreaDTO>> listSimpleAreaInfo(String areaId); |
|||
} |
@ -0,0 +1,65 @@ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dao.AreaDao; |
|||
import com.elink.esua.epdc.dto.SimpleAreaDTO; |
|||
import com.elink.esua.epdc.entity.AreaEntity; |
|||
import com.elink.esua.epdc.redis.AreaRedis; |
|||
import com.elink.esua.epdc.service.AreaService; |
|||
import com.google.common.collect.Lists; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @date 2019/9/3 16:55 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class AreaServiceImpl extends BaseServiceImpl<AreaDao, AreaEntity> implements AreaService { |
|||
|
|||
|
|||
@Autowired |
|||
private AreaRedis areaRedis; |
|||
|
|||
@Override |
|||
public Result<List<SimpleAreaDTO>> listSimpleAreaInfo(String areaId) { |
|||
|
|||
List<SimpleAreaDTO> simpleAreaList = Lists.newArrayList(); |
|||
|
|||
try { |
|||
if (StringUtils.isNotBlank(areaId)) { |
|||
|
|||
List<SimpleAreaDTO> areaList = areaRedis.getSimpleAreaList(areaId); |
|||
if (null != areaList) { |
|||
return new Result<List<SimpleAreaDTO>>().ok(areaList); |
|||
} |
|||
|
|||
Integer pid = Integer.parseInt(areaId); |
|||
QueryWrapper<AreaEntity> arWrapper = new QueryWrapper<>(); |
|||
arWrapper.select("ID", "NAME"); |
|||
arWrapper.eq("PARENT_ID", pid); |
|||
arWrapper.eq("STATUS", NumConstant.ONE); |
|||
arWrapper.orderByAsc("LEVEL", "SORT"); |
|||
List<AreaEntity> entityList = baseDao.selectList(arWrapper); |
|||
if (!entityList.isEmpty()) { |
|||
simpleAreaList = ConvertUtils.sourceToTarget(entityList, SimpleAreaDTO.class); |
|||
areaRedis.setSimpleAreaList(areaId, simpleAreaList); |
|||
} |
|||
} |
|||
} catch (Exception e) { |
|||
log.error("获取区划信息失败,错误信息{}", e.getMessage()); |
|||
} |
|||
return new Result<List<SimpleAreaDTO>>().ok(simpleAreaList); |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1567478636229" name="" targetNamespace="http://www.activiti.org/testm1567478636229" typeLanguage="http://www.w3.org/2001/XMLSchema"> |
|||
<process id="demoTask" isClosed="false" isExecutable="true" name="测试任务流程" processType="None"> |
|||
<startEvent id="_2" name="StartEvent"/> |
|||
<endEvent id="_3" name="EndEvent"/> |
|||
<userTask activiti:assignee="${deptId}" activiti:exclusive="true" id="_4" name="初次审核"> |
|||
<extensionElements> |
|||
<activiti:executionListener event="end" expression="审核完成"/> |
|||
</extensionElements> |
|||
</userTask> |
|||
<userTask activiti:assignee="${deptId}" activiti:exclusive="true" id="_5" name="二次审核"> |
|||
<extensionElements> |
|||
<activiti:executionListener event="end" expression="审核完成"/> |
|||
</extensionElements> |
|||
</userTask> |
|||
<sequenceFlow id="_6" sourceRef="_2" targetRef="_4"/> |
|||
<sequenceFlow id="_7" sourceRef="_4" targetRef="_5"/> |
|||
<sequenceFlow id="_8" sourceRef="_5" targetRef="_3"/> |
|||
</process> |
|||
<bpmndi:BPMNDiagram documentation="background=#FFFFFF;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram"> |
|||
<bpmndi:BPMNPlane bpmnElement="demoTask"> |
|||
<bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2"> |
|||
<dc:Bounds height="32.0" width="32.0" x="370.0" y="60.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3"> |
|||
<dc:Bounds height="32.0" width="32.0" x="375.0" y="640.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNShape bpmnElement="_4" id="Shape-_4"> |
|||
<dc:Bounds height="55.0" width="85.0" x="350.0" y="225.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNShape bpmnElement="_5" id="Shape-_5"> |
|||
<dc:Bounds height="55.0" width="85.0" x="355.0" y="415.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="_2" targetElement="_4"> |
|||
<di:waypoint x="386.0" y="92.0"/> |
|||
<di:waypoint x="386.0" y="225.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNEdge> |
|||
<bpmndi:BPMNEdge bpmnElement="_7" id="BPMNEdge__7" sourceElement="_4" targetElement="_5"> |
|||
<di:waypoint x="395.0" y="280.0"/> |
|||
<di:waypoint x="395.0" y="415.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNEdge> |
|||
<bpmndi:BPMNEdge bpmnElement="_8" id="BPMNEdge__8" sourceElement="_5" targetElement="_3"> |
|||
<di:waypoint x="391.0" y="470.0"/> |
|||
<di:waypoint x="391.0" y="640.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNEdge> |
|||
</bpmndi:BPMNPlane> |
|||
</bpmndi:BPMNDiagram> |
|||
</definitions> |
@ -1,43 +1,50 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" |
|||
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" |
|||
xmlns:activiti="http://activiti.org/bpmn" |
|||
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" |
|||
xmlns:tns="http://www.activiti.org/test" |
|||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
|||
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
expressionLanguage="http://www.w3.org/1999/XPath" |
|||
id="m1566628843418" |
|||
name="" |
|||
targetNamespace="http://www.activiti.org/test" |
|||
typeLanguage="http://www.w3.org/2001/XMLSchema"> |
|||
<process xmlns="" id="myProcess_1" isClosed="false" isExecutable="true" |
|||
processType="None"> |
|||
<startEvent id="_2" name="开始"/> |
|||
<userTask activiti:exclusive="true" id="_3" name="UserTask"> |
|||
<extensionElements> |
|||
<activiti:taskListener event="create"/> |
|||
</extensionElements> |
|||
</userTask> |
|||
</process> |
|||
<bpmndi:BPMNDiagram xmlns="" |
|||
documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" |
|||
id="Diagram-_1" |
|||
name="New Diagram"> |
|||
<bpmndi:BPMNPlane bpmnElement="myProcess_1"> |
|||
<bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2"> |
|||
<omgdc:Bounds height="32.0" width="32.0" x="245.0" y="100.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3"> |
|||
<omgdc:Bounds height="55.0" width="85.0" x="255.0" y="200.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
</bpmndi:BPMNPlane> |
|||
</bpmndi:BPMNDiagram> |
|||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.activiti.org/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1566628843418" name="" targetNamespace="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema"> |
|||
<process id="myProcess_1" isClosed="false" isExecutable="true" processType="None"> |
|||
<startEvent id="_2" name="testTaskStart"/> |
|||
<endEvent id="_6" name="testTaskEnd"/> |
|||
<userTask activiti:exclusive="true" id="_11" name="UserTask"> |
|||
<extensionElements> |
|||
<activiti:executionListener event="start" expression="test"/> |
|||
</extensionElements> |
|||
</userTask> |
|||
<sequenceFlow id="_13" sourceRef="_2" targetRef="_11"/> |
|||
<sequenceFlow id="_14" sourceRef="_11" targetRef="_6"/> |
|||
</process> |
|||
<bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram"> |
|||
<bpmndi:BPMNPlane bpmnElement="myProcess_1"> |
|||
<bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2"> |
|||
<omgdc:Bounds height="32.0" width="32.0" x="290.0" y="55.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNShape bpmnElement="_6" id="Shape-_6"> |
|||
<omgdc:Bounds height="32.0" width="32.0" x="285.0" y="515.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNShape bpmnElement="_11" id="Shape-_11"> |
|||
<omgdc:Bounds height="55.0" width="85.0" x="530.0" y="240.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNShape> |
|||
<bpmndi:BPMNEdge bpmnElement="_13" id="BPMNEdge__13" sourceElement="_2" targetElement="_11"> |
|||
<omgdi:waypoint x="322.0" y="71.0"/> |
|||
<omgdi:waypoint x="530.0" y="267.5"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNEdge> |
|||
<bpmndi:BPMNEdge bpmnElement="_14" id="BPMNEdge__14" sourceElement="_11" targetElement="_6"> |
|||
<omgdi:waypoint x="530.0" y="267.5"/> |
|||
<omgdi:waypoint x="317.0" y="531.0"/> |
|||
<bpmndi:BPMNLabel> |
|||
<omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/> |
|||
</bpmndi:BPMNLabel> |
|||
</bpmndi:BPMNEdge> |
|||
</bpmndi:BPMNPlane> |
|||
</bpmndi:BPMNDiagram> |
|||
</definitions> |
|||
|
@ -0,0 +1,24 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
/** |
|||
* activiti工作流 |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/3 11:18 |
|||
*/ |
|||
public interface ActWorkflowCommonService { |
|||
|
|||
/** |
|||
* 启动流程并绑定任务 |
|||
* |
|||
* @param processKey 流程ID |
|||
* @param businessKey 任务ID |
|||
* @param deptId 部门ID(通过部门ID,判断是否有权限审核任务) |
|||
* @return boolean |
|||
* @author yujintao |
|||
* @date 2019/9/3 13:58 |
|||
*/ |
|||
boolean startProcess(String processKey, String businessKey, String deptId); |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.elink.esua.epdc.service.ActWorkflowCommonService; |
|||
import com.google.common.collect.Maps; |
|||
import org.activiti.engine.HistoryService; |
|||
import org.activiti.engine.RepositoryService; |
|||
import org.activiti.engine.RuntimeService; |
|||
import org.activiti.engine.TaskService; |
|||
import org.activiti.engine.runtime.ProcessInstance; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.context.ContextLoader; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/3 11:19 |
|||
*/ |
|||
@Service |
|||
public class ActWorkflowCommonServiceImpl implements ActWorkflowCommonService { |
|||
|
|||
@Autowired |
|||
private RepositoryService repositoryService; |
|||
|
|||
@Autowired |
|||
private RuntimeService runtimeService; |
|||
|
|||
@Autowired |
|||
private TaskService taskService; |
|||
|
|||
@Autowired |
|||
private HistoryService historyService; |
|||
|
|||
@Override |
|||
public boolean startProcess(String processKey, String businessKey, String deptId) { |
|||
Map<String, Object> map = Maps.newHashMap(); |
|||
map.put("deptId", deptId); |
|||
map.put("activityId", "_2"); |
|||
//使用正在执行对象表中的一个字段BUSINESS_KEY(Activiti提供的一个字段),让启动的流程(流程实例)关联业务
|
|||
runtimeService.startProcessInstanceByKey(processKey, businessKey, map); |
|||
return true; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
package com.elink.esua.epdc; |
|||
|
|||
import com.elink.esua.epdc.service.ActWorkflowCommonService; |
|||
import com.google.common.collect.Maps; |
|||
import org.activiti.engine.RuntimeService; |
|||
import org.activiti.engine.TaskService; |
|||
import org.activiti.engine.runtime.ProcessInstance; |
|||
import org.activiti.engine.task.Task; |
|||
import org.activiti.engine.task.TaskQuery; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/3 10:06 |
|||
*/ |
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest |
|||
public class ActivitiTest { |
|||
|
|||
@Autowired |
|||
private ActWorkflowCommonService actWorkflowCommonService; |
|||
|
|||
@Autowired |
|||
private TaskService taskService; |
|||
|
|||
@Autowired |
|||
private RuntimeService runtimeService; |
|||
|
|||
@Test |
|||
public void test() { |
|||
String processId = "demoTask"; |
|||
// 启动一个任务流程
|
|||
actWorkflowCommonService.startProcess(processId, "testBusinessKey3", "testDeptId"); |
|||
} |
|||
|
|||
@Test |
|||
public void test2() { |
|||
String processId = "demoTask"; |
|||
String deptId = "testDeptId"; |
|||
this.queryTask(processId, deptId); |
|||
/* |
|||
关联业务id:testBusinessKey |
|||
流程实例id:5001 |
|||
任务id:5006 |
|||
任务标识:_4 |
|||
任务负责人:testDeptId |
|||
任务名称:初次审核 |
|||
任务创建时间:Tue Sep 03 14:26:50 CST 2019 |
|||
*/ |
|||
} |
|||
|
|||
@Test |
|||
public void test3() { |
|||
Map<String, Object> map = Maps.newHashMap(); |
|||
map.put("deptId", "testDeptId2"); |
|||
taskService.complete("5006", map); |
|||
} |
|||
|
|||
@Test |
|||
public void test4() { |
|||
String processId = "demoTask"; |
|||
String deptId = "testDeptId2"; |
|||
this.queryTask(processId, deptId); |
|||
/* |
|||
关联业务id:testBusinessKey |
|||
流程实例id:5001 |
|||
任务id:7502 |
|||
任务标识:_5 |
|||
任务负责人:testDeptId2 |
|||
任务名称:二次审核 |
|||
任务创建时间:Tue Sep 03 14:49:29 CST 2019 |
|||
*/ |
|||
} |
|||
|
|||
|
|||
private void queryTask(String processId, String deptId) { |
|||
//创建查询对象
|
|||
TaskQuery taskQuery = taskService.createTaskQuery().taskAssignee(deptId).processDefinitionKey(processId); |
|||
//获取查询列表
|
|||
List<Task> list = taskQuery.list(); |
|||
|
|||
for (Task task : list) { |
|||
//流程实例id
|
|||
String processInstanceId = task.getProcessInstanceId(); |
|||
//根据流程实例id找到流程实例对象
|
|||
ProcessInstance processInstance = runtimeService |
|||
.createProcessInstanceQuery() |
|||
.processInstanceId(processInstanceId) |
|||
.singleResult(); |
|||
//从流程实例对象获取bussinesskey
|
|||
String businessKey = processInstance.getBusinessKey(); |
|||
//根据businessKey查询业务系统,获取相关的业务信息
|
|||
System.out.println("关联业务id:" + businessKey); |
|||
System.out.println("流程实例id:" + task.getProcessInstanceId()); |
|||
System.out.println("任务id:" + task.getId()); |
|||
System.out.println("任务标识:" + task.getTaskDefinitionKey()); |
|||
System.out.println("任务负责人:" + task.getAssignee()); |
|||
System.out.println("任务名称:" + task.getName()); |
|||
System.out.println("任务创建时间:" + task.getCreateTime()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,149 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Data |
|||
public class UserDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private String id; |
|||
|
|||
private String nickname; |
|||
|
|||
private String mobile; |
|||
|
|||
private String password; |
|||
|
|||
private Date registerTime; |
|||
|
|||
private String faceImg; |
|||
|
|||
// @ApiModelProperty(value = "性别(女性-female,男性-male)")
|
|||
private String sex; |
|||
|
|||
// @ApiModelProperty(value = "生日")
|
|||
private Date birthday; |
|||
|
|||
// @ApiModelProperty(value = "邮箱")
|
|||
private String email; |
|||
|
|||
// @ApiModelProperty(value = "电话")
|
|||
private String telephone; |
|||
|
|||
// @ApiModelProperty(value = "邮编")
|
|||
private String zipCode; |
|||
|
|||
// @ApiModelProperty(value = "职业")
|
|||
private String profession; |
|||
|
|||
// @ApiModelProperty(value = "爱好")
|
|||
private String hobbies; |
|||
|
|||
// @ApiModelProperty(value = "个性签名")
|
|||
private String userSign; |
|||
|
|||
// @ApiModelProperty(value = "邀请码")
|
|||
private String invitationCode; |
|||
|
|||
// @ApiModelProperty(value = "最近登录时间")
|
|||
private Date lastLoginTime; |
|||
|
|||
// @ApiModelProperty(value = "最近登录IP")
|
|||
private String lastLoginIp; |
|||
|
|||
// @ApiModelProperty(value = "最近登录位置经度")
|
|||
private String lastLongitude; |
|||
|
|||
// @ApiModelProperty(value = "最近登录位置维度")
|
|||
private String lastLatitude; |
|||
|
|||
// @ApiModelProperty(value = "真实姓名")
|
|||
private String realName; |
|||
|
|||
// @ApiModelProperty(value = "身份证号")
|
|||
private String identityNo; |
|||
|
|||
// @ApiModelProperty(value = "居民住址")
|
|||
private String address; |
|||
|
|||
// @ApiModelProperty(value = "微信OPENID")
|
|||
private String wxOpenId; |
|||
|
|||
// @ApiModelProperty(value = "是否是党员(0-否,1-是)")
|
|||
private String partyFlag; |
|||
|
|||
// @ApiModelProperty(value = "注册方式(wx:微信注册)")
|
|||
private String registerWay; |
|||
|
|||
// @ApiModelProperty(value = "用户来源(wp:公众号)")
|
|||
private String registerSource; |
|||
|
|||
// @ApiModelProperty(value = "手机号所属省份")
|
|||
private String phoneProvince; |
|||
|
|||
// @ApiModelProperty(value = "手机号所属城市")
|
|||
private String phoneCity; |
|||
|
|||
// @ApiModelProperty(value = "手机号所属运营商")
|
|||
private String phoneCarrier; |
|||
|
|||
// @ApiModelProperty(value = "用户积分")
|
|||
private Integer points; |
|||
|
|||
// @ApiModelProperty(value = "邀请人ID")
|
|||
private String inviteUserId; |
|||
|
|||
// @ApiModelProperty(value = "乐观锁")
|
|||
private Integer revision; |
|||
|
|||
// @ApiModelProperty(value = "网格ID")
|
|||
private String gridId; |
|||
|
|||
// @ApiModelProperty(value = "创建人")
|
|||
private String createdBy; |
|||
|
|||
// @ApiModelProperty(value = "创建时间")
|
|||
private Date createdTime; |
|||
|
|||
// @ApiModelProperty(value = "更新人")
|
|||
private String updatedBy; |
|||
|
|||
// @ApiModelProperty(value = "更新时间")
|
|||
private Date updatedTime; |
|||
|
|||
// @ApiModelProperty(value = "删除标记")
|
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 审核状态 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
} |
@ -0,0 +1,101 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.dto.UserDTO; |
|||
import com.elink.esua.epdc.excel.UserExcel; |
|||
import com.elink.esua.epdc.service.UserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("epdc/user") |
|||
public class UserController { |
|||
@Autowired |
|||
private UserService userService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<UserDTO>> page( @RequestParam Map<String, Object> params){ |
|||
PageData<UserDTO> page = userService.page(params); |
|||
|
|||
return new Result<PageData<UserDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<UserDTO> get(@PathVariable("id") String id){ |
|||
UserDTO data = userService.get(id); |
|||
|
|||
return new Result<UserDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody UserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
|
|||
userService.save(dto); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody UserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
|
|||
userService.update(dto); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
|
|||
userService.delete(ids); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export( @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<UserDTO> list = userService.list(params); |
|||
|
|||
ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.UserEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Mapper |
|||
public interface UserDao extends BaseDao<UserEntity> { |
|||
|
|||
} |
@ -0,0 +1,173 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_user") |
|||
public class UserEntity extends BaseEpdcEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 密码 |
|||
*/ |
|||
private String password; |
|||
/** |
|||
* 注册时间 |
|||
*/ |
|||
private Date registerTime; |
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String faceImg; |
|||
/** |
|||
* 性别(女性-female,男性-male) |
|||
*/ |
|||
private String sex; |
|||
/** |
|||
* 生日 |
|||
*/ |
|||
private Date birthday; |
|||
/** |
|||
* 邮箱 |
|||
*/ |
|||
private String email; |
|||
/** |
|||
* 电话 |
|||
*/ |
|||
private String telephone; |
|||
/** |
|||
* 邮编 |
|||
*/ |
|||
private String zipCode; |
|||
/** |
|||
* 职业 |
|||
*/ |
|||
private String profession; |
|||
/** |
|||
* 爱好 |
|||
*/ |
|||
private String hobbies; |
|||
/** |
|||
* 个性签名 |
|||
*/ |
|||
private String userSign; |
|||
/** |
|||
* 邀请码 |
|||
*/ |
|||
private String invitationCode; |
|||
/** |
|||
* 最近登录时间 |
|||
*/ |
|||
private Date lastLoginTime; |
|||
/** |
|||
* 最近登录IP |
|||
*/ |
|||
private String lastLoginIp; |
|||
/** |
|||
* 最近登录位置经度 |
|||
*/ |
|||
private String lastLongitude; |
|||
/** |
|||
* 最近登录位置维度 |
|||
*/ |
|||
private String lastLatitude; |
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String identityNo; |
|||
/** |
|||
* 居民住址 |
|||
*/ |
|||
private String address; |
|||
/** |
|||
* 微信OPENID |
|||
*/ |
|||
private String wxOpenId; |
|||
/** |
|||
* 是否是党员(0-否,1-是) |
|||
*/ |
|||
private String partyFlag; |
|||
/** |
|||
* 注册方式(wx:微信注册) |
|||
*/ |
|||
private String registerWay; |
|||
/** |
|||
* 用户来源(wp:公众号) |
|||
*/ |
|||
private String registerSource; |
|||
/** |
|||
* 手机号所属省份 |
|||
*/ |
|||
private String phoneProvince; |
|||
/** |
|||
* 手机号所属城市 |
|||
*/ |
|||
private String phoneCity; |
|||
/** |
|||
* 手机号所属运营商 |
|||
*/ |
|||
private String phoneCarrier; |
|||
/** |
|||
* 用户积分 |
|||
*/ |
|||
private Integer points; |
|||
/** |
|||
* 邀请人ID |
|||
*/ |
|||
private String inviteUserId; |
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 审核状态 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Data |
|||
public class UserExcel { |
|||
@Excel(name = "主键") |
|||
private String id; |
|||
@Excel(name = "昵称") |
|||
private String nickname; |
|||
@Excel(name = "手机号") |
|||
private String mobile; |
|||
@Excel(name = "密码") |
|||
private String password; |
|||
@Excel(name = "注册时间") |
|||
private Date registerTime; |
|||
@Excel(name = "头像") |
|||
private String faceImg; |
|||
@Excel(name = "性别(女性-female,男性-male)") |
|||
private String sex; |
|||
@Excel(name = "生日") |
|||
private Date birthday; |
|||
@Excel(name = "邮箱") |
|||
private String email; |
|||
@Excel(name = "电话") |
|||
private String telephone; |
|||
@Excel(name = "邮编") |
|||
private String zipCode; |
|||
@Excel(name = "职业") |
|||
private String profession; |
|||
@Excel(name = "爱好") |
|||
private String hobbies; |
|||
@Excel(name = "个性签名") |
|||
private String userSign; |
|||
@Excel(name = "邀请码") |
|||
private String invitationCode; |
|||
@Excel(name = "最近登录时间") |
|||
private Date lastLoginTime; |
|||
@Excel(name = "最近登录IP") |
|||
private String lastLoginIp; |
|||
@Excel(name = "最近登录位置经度") |
|||
private String lastLongitude; |
|||
@Excel(name = "最近登录位置维度") |
|||
private String lastLatitude; |
|||
@Excel(name = "真实姓名") |
|||
private String realName; |
|||
@Excel(name = "身份证号") |
|||
private String identityNo; |
|||
@Excel(name = "居民住址") |
|||
private String address; |
|||
@Excel(name = "微信OPENID") |
|||
private String wxOpenId; |
|||
@Excel(name = "是否是党员(0-否,1-是)") |
|||
private String partyFlag; |
|||
@Excel(name = "注册方式(wx:微信注册)") |
|||
private String registerWay; |
|||
@Excel(name = "用户来源(wp:公众号)") |
|||
private String registerSource; |
|||
@Excel(name = "手机号所属省份") |
|||
private String phoneProvince; |
|||
@Excel(name = "手机号所属城市") |
|||
private String phoneCity; |
|||
@Excel(name = "手机号所属运营商") |
|||
private String phoneCarrier; |
|||
@Excel(name = "用户积分") |
|||
private Integer points; |
|||
@Excel(name = "邀请人ID") |
|||
private String inviteUserId; |
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
@Excel(name = "网格ID") |
|||
private String gridId; |
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
@Excel(name = "删除标记") |
|||
private String delFlag; |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.redis; |
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Component |
|||
public class UserRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.UserDTO; |
|||
import com.elink.esua.epdc.entity.UserEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
public interface UserService extends BaseService<UserEntity> { |
|||
|
|||
PageData<UserDTO> page(Map<String, Object> params); |
|||
|
|||
List<UserDTO> list(Map<String, Object> params); |
|||
|
|||
UserDTO get(String id); |
|||
|
|||
void save(UserDTO dto); |
|||
|
|||
void update(UserDTO dto); |
|||
|
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,112 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.dao.UserDao; |
|||
import com.elink.esua.epdc.dto.UserDTO; |
|||
import com.elink.esua.epdc.entity.UserEntity; |
|||
import com.elink.esua.epdc.redis.UserRedis; |
|||
import com.elink.esua.epdc.service.UserService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Service |
|||
public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService { |
|||
@Autowired |
|||
private UserRedis userRedis; |
|||
|
|||
@Override |
|||
public PageData<UserDTO> page(Map<String, Object> params) { |
|||
IPage<UserEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
|
|||
return getPageData(page, UserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<UserDTO> list(Map<String, Object> params) { |
|||
List<UserEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, UserDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<UserEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get("id"); |
|||
|
|||
QueryWrapper<UserEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), "id", id); |
|||
//wrapper.eq(Constant.DEL_FLAG, DelFlagEnum.NORMAL.value());
|
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public UserDTO get(String id) { |
|||
UserEntity entity = baseDao.selectById(id); |
|||
|
|||
return ConvertUtils.sourceToTarget(entity, UserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(UserDTO dto) { |
|||
UserEntity entity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|||
|
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(UserDTO dto) { |
|||
UserEntity entity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|||
|
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
//逻辑删除
|
|||
//logicDelete(ids, UserEntity.class);
|
|||
|
|||
//物理删除
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.UserDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.UserEntity" id="userMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="password" column="PASSWORD"/> |
|||
<result property="registerTime" column="REGISTER_TIME"/> |
|||
<result property="faceImg" column="FACE_IMG"/> |
|||
<result property="sex" column="SEX"/> |
|||
<result property="birthday" column="BIRTHDAY"/> |
|||
<result property="email" column="EMAIL"/> |
|||
<result property="telephone" column="TELEPHONE"/> |
|||
<result property="zipCode" column="ZIP_CODE"/> |
|||
<result property="profession" column="PROFESSION"/> |
|||
<result property="hobbies" column="HOBBIES"/> |
|||
<result property="userSign" column="USER_SIGN"/> |
|||
<result property="invitationCode" column="INVITATION_CODE"/> |
|||
<result property="lastLoginTime" column="LAST_LOGIN_TIME"/> |
|||
<result property="lastLoginIp" column="LAST_LOGIN_IP"/> |
|||
<result property="lastLongitude" column="LAST_LONGITUDE"/> |
|||
<result property="lastLatitude" column="LAST_LATITUDE"/> |
|||
<result property="realName" column="REAL_NAME"/> |
|||
<result property="identityNo" column="IDENTITY_NO"/> |
|||
<result property="address" column="ADDRESS"/> |
|||
<result property="wxOpenId" column="WX_OPEN_ID"/> |
|||
<result property="partyFlag" column="PARTY_FLAG"/> |
|||
<result property="registerWay" column="REGISTER_WAY"/> |
|||
<result property="registerSource" column="REGISTER_SOURCE"/> |
|||
<result property="phoneProvince" column="PHONE_PROVINCE"/> |
|||
<result property="phoneCity" column="PHONE_CITY"/> |
|||
<result property="phoneCarrier" column="PHONE_CARRIER"/> |
|||
<result property="points" column="POINTS"/> |
|||
<result property="inviteUserId" column="INVITE_USER_ID"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="state" column="STATE"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue