19 changed files with 524 additions and 7 deletions
@ -0,0 +1,28 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.CompleteDeptDTO; |
|||
import com.elink.esua.epdc.feign.fallback.SysDeptFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
|
|||
/** |
|||
* 系统服务模块 |
|||
* @Author LC |
|||
* @Date 2019/9/8 16:00 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = SysDeptFeignClientFallback.class) |
|||
public interface SysDeptFeignClient { |
|||
|
|||
/** |
|||
* 通过网格ID获取该网格所有上级机构 |
|||
* @Params: [gridId] |
|||
* @Return: com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.CompleteDeptDTO> |
|||
* @Author: liuchuang |
|||
* @Date: 2019/9/8 16:11 |
|||
*/ |
|||
@GetMapping(value = "sys/dept/getCompleteDept/{gridId}") |
|||
Result<CompleteDeptDTO> getCompleteDept(@PathVariable("gridId") Long gridId); |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.CompleteDeptDTO; |
|||
import com.elink.esua.epdc.feign.SysDeptFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
|
|||
/** |
|||
* @Author LC |
|||
* @Date 2019/9/8 16:00 |
|||
*/ |
|||
@Component |
|||
public class SysDeptFeignClientFallback implements SysDeptFeignClient { |
|||
|
|||
@Override |
|||
public Result<CompleteDeptDTO> getCompleteDept(@PathVariable("gridId") Long gridId) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getCompleteDept", gridId); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.elink.esua.epdc.constant; |
|||
|
|||
/** |
|||
* 图片常量 |
|||
* @Author LC |
|||
* @Date 2019/9/8 17:07 |
|||
*/ |
|||
public interface ImageConstant { |
|||
|
|||
/** |
|||
* 图片类型-事件 |
|||
*/ |
|||
public final static String TYPE_IMAGE_BIZ_EVENTS = "events"; |
|||
|
|||
/** |
|||
* 图片类型-头像 |
|||
*/ |
|||
public final static String TYPE_IMAGE_BIZ_FACE = "face"; |
|||
} |
@ -0,0 +1,98 @@ |
|||
package com.elink.esua.epdc.dto.events.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author LC |
|||
* @Date 2019/9/8 15:25 |
|||
*/ |
|||
@Data |
|||
public class EpdcEventSubmitFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -1869446375416414676L; |
|||
|
|||
/** |
|||
* 事件内容 |
|||
*/ |
|||
@NotBlank(message = "事件内容不能为空") |
|||
private String eventContent; |
|||
/** |
|||
* 事件地址 |
|||
*/ |
|||
@NotBlank(message = "地址信息不能为空") |
|||
private String issueAddress; |
|||
/** |
|||
* 经度 |
|||
*/ |
|||
@NotNull(message = "经度不能为空") |
|||
private Double issueLongitude; |
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
@NotNull(message = "纬度不能为空") |
|||
private Double issueLatitude; |
|||
/** |
|||
* 图片 |
|||
*/ |
|||
private List<String> images; |
|||
/** |
|||
* 区 |
|||
*/ |
|||
private String area; |
|||
/** |
|||
* 区ID |
|||
*/ |
|||
@NotBlank(message = "用户区ID不能为空") |
|||
private String areaId; |
|||
/** |
|||
* 街道 |
|||
*/ |
|||
private String street; |
|||
/** |
|||
* 街道ID |
|||
*/ |
|||
@NotBlank(message = "用户街道ID不能为空") |
|||
private String streetId; |
|||
/** |
|||
* 社区 |
|||
*/ |
|||
private String community; |
|||
/** |
|||
* 社区ID |
|||
*/ |
|||
@NotBlank(message = "用户社区ID不能为空") |
|||
private String communityId; |
|||
/** |
|||
* 网格 |
|||
*/ |
|||
private String grid; |
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
@NotBlank(message = "用户网格ID不能为空") |
|||
private String gridId; |
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@NotBlank(message = "用户ID不能为空") |
|||
private String userId; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickName; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
/** |
|||
* 党员标识 0:否、1:是 |
|||
*/ |
|||
private Long isPartyMember; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.elink.esua.epdc.modules.events.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
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.dto.events.form.EpdcEventSubmitFormDTO; |
|||
import com.elink.esua.epdc.modules.events.service.EpdcEventsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Author LC |
|||
* @Date 2019/9/8 16:42 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "event") |
|||
public class EpdcAppEventsController { |
|||
|
|||
@Autowired |
|||
private EpdcEventsService epdcEventsService; |
|||
|
|||
/** |
|||
* 发布议题 |
|||
* @Params: [formDto] |
|||
* @Return: com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @Author: liuchuang |
|||
* @Date: 2019/9/8 16:54 |
|||
*/ |
|||
@PostMapping("submit") |
|||
public Result submitEvent(@RequestBody EpdcEventSubmitFormDTO formDto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); |
|||
epdcEventsService.saveEvent(formDto); |
|||
return new Result(); |
|||
} |
|||
} |
@ -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.modules.events.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.events.entity.ImgEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 党建系统图片表 党建系统图片表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-09-08 |
|||
*/ |
|||
@Mapper |
|||
public interface ImgDao extends BaseDao<ImgEntity> { |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
/** |
|||
* 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.modules.events.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
|
|||
/** |
|||
* 党建系统图片表 党建系统图片表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-09-08 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_img") |
|||
public class ImgEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 引用ID |
|||
*/ |
|||
private String referenceId; |
|||
|
|||
/** |
|||
* 图片地址 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 图片类型 |
|||
*/ |
|||
private String imgType; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* 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.modules.events.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.modules.events.entity.ImgEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 党建系统图片表 党建系统图片表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-09-08 |
|||
*/ |
|||
public interface ImgService extends BaseService<ImgEntity> { |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 保存图片 |
|||
* @Params: [images, eventId, imgType] |
|||
* @Return: boolean |
|||
* @Author: liuchuang |
|||
* @Date: 2019/9/8 17:12 |
|||
*/ |
|||
boolean saveImages(List<String> images, String referenceId, String imgType); |
|||
} |
@ -0,0 +1,65 @@ |
|||
/** |
|||
* 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.modules.events.service.impl; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.modules.events.dao.ImgDao; |
|||
import com.elink.esua.epdc.modules.events.entity.ImgEntity; |
|||
import com.elink.esua.epdc.modules.events.service.ImgService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 党建系统图片表 党建系统图片表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-09-08 |
|||
*/ |
|||
@Service |
|||
public class ImgServiceImpl extends BaseServiceImpl<ImgDao, ImgEntity> implements ImgService { |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public boolean saveImages(List<String> images, String referenceId, String imgType) { |
|||
if (null == images || images.isEmpty()) { |
|||
return true; |
|||
} |
|||
List<ImgEntity> imgEntities = new ArrayList<>(images.size()); |
|||
ImgEntity entity = null; |
|||
for (int i = 0; i < images.size(); i++) { |
|||
entity = new ImgEntity(); |
|||
entity.setReferenceId(referenceId); |
|||
entity.setImgUrl(images.get(i)); |
|||
entity.setImgType(imgType); |
|||
imgEntities.add(entity); |
|||
} |
|||
return insertBatch(imgEntities); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue