@@ -0,0 +1,59 @@ | |||
package com.ningdatech.kqapi.admin.controller; | |||
import com.ningdatech.basic.model.IdVo; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.kqapi.admin.manage.AdminMatterManage; | |||
import com.ningdatech.kqapi.admin.model.req.MatterListReq; | |||
import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO; | |||
import com.ningdatech.kqapi.admin.model.vo.MatterListVO; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* <p> | |||
* MatterController | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 16:10 2024/4/20 | |||
*/ | |||
@Api(tags = "事项管理") | |||
@RestController | |||
@RequiredArgsConstructor | |||
@RequestMapping("/api/v1/matter") | |||
public class MatterController { | |||
private final AdminMatterManage matterManage; | |||
@DeleteMapping("/del") | |||
@ApiOperation("删除事项") | |||
@WebLog("删除事项") | |||
public void del(@RequestBody IdVo<Long> id) { | |||
matterManage.del(id); | |||
} | |||
@GetMapping("/page") | |||
@ApiOperation("事项列表") | |||
@WebLog("事项列表") | |||
public PageVo<MatterListVO> pageMatter(MatterListReq req) { | |||
return matterManage.pageMatter(req); | |||
} | |||
@GetMapping("/detail/{id}") | |||
@ApiOperation("事项详情") | |||
@WebLog("事项详情") | |||
public MatterDetailDTO detail(@PathVariable Long id) { | |||
return matterManage.detail(id); | |||
} | |||
@PostMapping("/save") | |||
@ApiOperation("事项保存或修改") | |||
@WebLog("事项保存或修改") | |||
public void saveOrUpdate(@RequestBody MatterDetailDTO req) { | |||
matterManage.saveOrUpdate(req); | |||
} | |||
} |
@@ -2,6 +2,7 @@ package com.ningdatech.kqapi.admin.controller; | |||
import com.ningdatech.basic.model.IdVo; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.kqapi.admin.manage.WindowManage; | |||
import com.ningdatech.kqapi.admin.model.req.ListWindowReq; | |||
import com.ningdatech.kqapi.admin.model.req.WindowSaveReq; | |||
@@ -47,8 +48,8 @@ public class WindowController { | |||
@GetMapping("/page") | |||
@WebLog("窗口列表") | |||
@ApiOperation("窗口列表") | |||
public void page(ListWindowReq req) { | |||
windowManage.pageWindow(req); | |||
public PageVo<WindowDetailVO> page(ListWindowReq req) { | |||
return windowManage.pageWindow(req); | |||
} | |||
@GetMapping("/option") | |||
@@ -0,0 +1,121 @@ | |||
package com.ningdatech.kqapi.admin.manage; | |||
import cn.hutool.core.util.StrUtil; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.ningdatech.basic.model.IdVo; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.kqapi.admin.model.req.MatterListReq; | |||
import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO; | |||
import com.ningdatech.kqapi.admin.model.vo.MatterListVO; | |||
import com.ningdatech.kqapi.zzsfw.model.entity.NdKqZzsfwMenu; | |||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* MatterManage | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 15:41 2024/4/20 | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
public class AdminMatterManage { | |||
private final INdKqZzsfwMenuService zzsfwMenuService; | |||
public PageVo<MatterListVO> pageMatter(MatterListReq req) { | |||
Wrapper<NdKqZzsfwMenu> query = Wrappers.lambdaQuery(NdKqZzsfwMenu.class) | |||
.like(StrUtil.isNotBlank(req.getMatterName()), NdKqZzsfwMenu::getItemName, req.getMatterName()) | |||
.eq(req.getZoneId() != null, NdKqZzsfwMenu::getZoneId, req.getZoneId()) | |||
.eq(req.getWindowId() != null, NdKqZzsfwMenu::getWindowId, req.getWindowId()) | |||
.eq(req.getMatterType() != null, NdKqZzsfwMenu::getType, req.getMatterType()) | |||
.eq(req.getDepartment() != null, NdKqZzsfwMenu::getDepartment, req.getDepartment()) | |||
.orderByDesc(NdKqZzsfwMenu::getCreateOn); | |||
Page<NdKqZzsfwMenu> page = zzsfwMenuService.page(req.page(), query); | |||
if (page.getTotal() == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<MatterListVO> data = CollUtils.convert(page.getRecords(), | |||
w -> MatterListVO.builder() | |||
.matterName(w.getItemName()) | |||
.matterType(w.getType()) | |||
.department(w.getDepartment()) | |||
.zoneName(w.getZoneName()) | |||
.windowName(w.getWindow()) | |||
.build()); | |||
return PageVo.of(data, page.getTotal()); | |||
} | |||
public void del(IdVo<Long> id) { | |||
zzsfwMenuService.removeById(id.getId()); | |||
} | |||
public MatterDetailDTO detail(Long id) { | |||
NdKqZzsfwMenu matter = zzsfwMenuService.getById(id); | |||
if (matter == null) { | |||
return null; | |||
} | |||
return MatterDetailDTO.builder() | |||
.id(matter.getId()) | |||
.free(matter.getFree()) | |||
.onlinePay(matter.getOnlinePay()) | |||
.hasUrl(matter.getHasUrl()) | |||
.matterType(matter.getType()) | |||
.matterName(matter.getItemName()) | |||
.department(matter.getDepartment()) | |||
.handleAddress(matter.getHandleAddress()) | |||
.handleChannel(matter.getHandleChannel()) | |||
.handleTime(matter.getHandleTime()) | |||
.implSubjectNature(matter.getImplSubjectNature()) | |||
.publicityMaterials(matter.getPublicityMaterials()) | |||
.sceneDesc(matter.getSceneDesc()) | |||
.serviceContent(matter.getServiceContent()) | |||
.serviceObject(matter.getServiceObject()) | |||
.serviceProcess(matter.getServiceProcess()) | |||
.sort(matter.getSort()) | |||
.telephone(matter.getTelephone()) | |||
.window(matter.getWindow()) | |||
.windowId(matter.getWindowId()) | |||
.zoneId(matter.getZoneId()) | |||
.zoneName(matter.getZoneName()) | |||
.webApplyUrl(matter.getWebapplyurl()) | |||
.build(); | |||
} | |||
public void saveOrUpdate(MatterDetailDTO req) { | |||
NdKqZzsfwMenu matter = new NdKqZzsfwMenu(); | |||
matter.setId(req.getId()); | |||
matter.setFree(req.getFree()); | |||
matter.setOnlinePay(req.getOnlinePay()); | |||
matter.setHasUrl(req.getHasUrl()); | |||
matter.setType(req.getMatterType()); | |||
matter.setItemName(req.getMatterName()); | |||
matter.setDepartment(req.getDepartment()); | |||
matter.setHandleAddress(req.getHandleAddress()); | |||
matter.setHandleChannel(req.getHandleChannel()); | |||
matter.setHandleTime(req.getHandleTime()); | |||
matter.setImplSubjectNature(req.getImplSubjectNature()); | |||
matter.setPublicityMaterials(req.getPublicityMaterials()); | |||
matter.setSceneDesc(req.getSceneDesc()); | |||
matter.setServiceContent(req.getServiceContent()); | |||
matter.setServiceObject(req.getServiceObject()); | |||
matter.setServiceProcess(req.getServiceProcess()); | |||
matter.setSort(req.getSort()); | |||
matter.setTelephone(req.getTelephone()); | |||
matter.setWindow(req.getWindow()); | |||
matter.setWindowId(req.getWindowId()); | |||
matter.setZoneId(req.getZoneId()); | |||
matter.setZoneName(req.getZoneName()); | |||
matter.setWebapplyurl(req.getWebApplyUrl()); | |||
zzsfwMenuService.saveOrUpdate(matter); | |||
} | |||
} |
@@ -16,6 +16,7 @@ import com.ningdatech.kqapi.admin.model.req.WindowSaveReq; | |||
import com.ningdatech.kqapi.admin.model.vo.WindowDetailVO; | |||
import com.ningdatech.kqapi.admin.service.IWindowService; | |||
import com.ningdatech.kqapi.admin.service.IZoneService; | |||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
@@ -35,7 +36,7 @@ import java.util.stream.Collectors; | |||
public class WindowManage { | |||
private final IWindowService windowService; | |||
private final IZoneService zoneService; | |||
private final INdKqZzsfwMenuService zzsfwMenuService; | |||
public void windowSaveOrUpdate(WindowSaveReq req) { | |||
Window win = BeanUtil.copyProperties(req, Window.class); | |||
@@ -54,9 +55,10 @@ public class WindowManage { | |||
} | |||
List<Window> records = page.getRecords(); | |||
List<Integer> windowIds = CollUtils.fieldList(records, Window::getId); | |||
Map<Integer, Integer> matterCountMap = zzsfwMenuService.matterCountByWindowIds(windowIds); | |||
List<WindowDetailVO> data = records.stream().map(w -> { | |||
WindowDetailVO window = BeanUtil.copyProperties(w, WindowDetailVO.class); | |||
window.setItemCount(0); | |||
window.setItemCount(matterCountMap.getOrDefault(w.getId(), 0)); | |||
return window; | |||
}).collect(Collectors.toList()); | |||
return PageVo.of(data, page.getTotal()); | |||
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.kqapi.admin.model.dto; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* WindowCountByZoneIdDTO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 14:14 2024/4/20 | |||
*/ | |||
@Data | |||
public class MatterCountByWindowIdDTO { | |||
private Integer windowId; | |||
private Integer matterCount; | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.ningdatech.kqapi.admin.model.req; | |||
import com.ningdatech.kqapi.common.model.PagePo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
/** | |||
* <p> | |||
* MatterListReq | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 15:52 2024/4/20 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
public class MatterListReq extends PagePo { | |||
@ApiModelProperty("部门") | |||
private String department; | |||
@ApiModelProperty("事项名称") | |||
private String matterName; | |||
@ApiModelProperty("服务类型") | |||
private Integer matterType; | |||
@ApiModelProperty("专区ID") | |||
private Integer zoneId; | |||
@ApiModelProperty("窗口ID") | |||
private Integer windowId; | |||
} |
@@ -0,0 +1,95 @@ | |||
package com.ningdatech.kqapi.admin.model.vo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* MatterDetailVO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 15:48 2024/4/20 | |||
*/ | |||
@Data | |||
@Builder | |||
public class MatterDetailDTO { | |||
private Long id; | |||
@ApiModelProperty("事项名称") | |||
private String matterName; | |||
@ApiModelProperty("专区名称") | |||
private String zoneName; | |||
@ApiModelProperty("专区ID") | |||
private Integer zoneId; | |||
@ApiModelProperty("窗口ID") | |||
private Integer windowId; | |||
@ApiModelProperty("窗口名称") | |||
private String windowName; | |||
@ApiModelProperty("部门") | |||
private String department; | |||
@ApiModelProperty("事项类型") | |||
private Integer matterType; | |||
@ApiModelProperty("事项链接") | |||
private String webApplyUrl; | |||
@ApiModelProperty("窗口") | |||
private String window; | |||
@ApiModelProperty("排序") | |||
private Integer sort; | |||
@ApiModelProperty("是否在政务中心查到url") | |||
private Integer hasUrl; | |||
@ApiModelProperty("服务内容") | |||
private String serviceContent; | |||
@ApiModelProperty("服务流程") | |||
private String serviceProcess; | |||
@ApiModelProperty("咨询电话") | |||
private String telephone; | |||
@ApiModelProperty("服务对象") | |||
private String serviceObject; | |||
@ApiModelProperty("是否免费") | |||
private Boolean free; | |||
@ApiModelProperty("是否网上缴费") | |||
private Boolean onlinePay; | |||
@ApiModelProperty("办理渠道") | |||
private Integer handleChannel; | |||
@ApiModelProperty("办理地点") | |||
private String handleAddress; | |||
@ApiModelProperty("办理时间") | |||
private String handleTime; | |||
@ApiModelProperty("行使层级") | |||
private String exerciseLevel; | |||
@ApiModelProperty("实施主体性质") | |||
private Integer implSubjectNature; | |||
@ApiModelProperty("特色场景描述") | |||
private String sceneDesc; | |||
@ApiModelProperty("宣传资料") | |||
private String publicityMaterials; | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.ningdatech.kqapi.admin.model.vo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* MatterListVO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 15:48 2024/4/20 | |||
*/ | |||
@Data | |||
@Builder | |||
public class MatterListVO { | |||
@ApiModelProperty("事项名称") | |||
private String matterName; | |||
@ApiModelProperty("专区名称") | |||
private String zoneName; | |||
@ApiModelProperty("窗口名称") | |||
private String windowName; | |||
@ApiModelProperty("部门") | |||
private String department; | |||
@ApiModelProperty("事项类型") | |||
private Integer matterType; | |||
} |
@@ -1,11 +1,16 @@ | |||
package com.ningdatech.kqapi.zzsfw.mapper; | |||
import com.ningdatech.kqapi.admin.model.dto.MatterCountByWindowIdDTO; | |||
import com.ningdatech.kqapi.zzsfw.model.entity.NdKqZzsfwMenu; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.Collection; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author ZPF | |||
@@ -13,4 +18,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
*/ | |||
public interface NdKqZzsfwMenuMapper extends BaseMapper<NdKqZzsfwMenu> { | |||
List<MatterCountByWindowIdDTO> selectMatterCountByWindowIds(@Param("windowIds") Collection<Integer> windowIds); | |||
} |
@@ -2,4 +2,14 @@ | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.kqapi.zzsfw.mapper.NdKqZzsfwMenuMapper"> | |||
<select id="selectMatterCountByWindowIds" | |||
resultType="com.ningdatech.kqapi.admin.model.dto.MatterCountByWindowIdDTO"> | |||
select window_id as windowId, count(1) as matterCount from nd_zzsfw_menu | |||
where deleted = 0 and window_id in | |||
<foreach collection="windowIds" item="windowId" open="(" separator="," close=")"> | |||
#{windowId} | |||
</foreach> | |||
group by window_id | |||
</select> | |||
</mapper> |
@@ -1,17 +1,16 @@ | |||
package com.ningdatech.kqapi.zzsfw.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import com.baomidou.mybatisplus.annotation.*; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* | |||
* | |||
* </p> | |||
* | |||
* @author ZPF | |||
@@ -29,8 +28,21 @@ public class NdKqZzsfwMenu implements Serializable { | |||
private Long id; | |||
@ApiModelProperty("数据同步时间") | |||
@TableField(fill = FieldFill.INSERT) | |||
private LocalDateTime createOn; | |||
@ApiModelProperty("数据更新时间") | |||
@TableField(fill = FieldFill.INSERT_UPDATE) | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("创建人") | |||
@TableField(fill = FieldFill.INSERT) | |||
private Long createBy; | |||
@ApiModelProperty("更新人") | |||
@TableField(fill = FieldFill.INSERT_UPDATE) | |||
private Long updateBy; | |||
@ApiModelProperty("社区名") | |||
private String zoneName; | |||
@@ -66,4 +78,44 @@ public class NdKqZzsfwMenu implements Serializable { | |||
@ApiModelProperty("咨询电话") | |||
private String telephone; | |||
@ApiModelProperty("专区id") | |||
private Integer zoneId; | |||
@ApiModelProperty("窗口id") | |||
private Integer windowId; | |||
@ApiModelProperty("是否删除") | |||
private Boolean deleted; | |||
@ApiModelProperty("服务对象") | |||
private String serviceObject; | |||
@ApiModelProperty("是否免费") | |||
private Boolean free; | |||
@ApiModelProperty("是否网上缴费") | |||
private Boolean onlinePay; | |||
@ApiModelProperty("办理渠道") | |||
private Integer handleChannel; | |||
@ApiModelProperty("办理地点") | |||
private String handleAddress; | |||
@ApiModelProperty("办理时间") | |||
private String handleTime; | |||
@ApiModelProperty("行使层级") | |||
private String exerciseLevel; | |||
@ApiModelProperty("实施主体性质") | |||
private Integer implSubjectNature; | |||
@ApiModelProperty("特色场景描述") | |||
private String sceneDesc; | |||
@ApiModelProperty("宣传资料") | |||
private String publicityMaterials; | |||
} |
@@ -1,11 +1,14 @@ | |||
package com.ningdatech.kqapi.zzsfw.service; | |||
import com.ningdatech.kqapi.zzsfw.model.entity.NdKqZzsfwMenu; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.kqapi.zzsfw.model.entity.NdKqZzsfwMenu; | |||
import java.util.Collection; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
@@ -13,4 +16,6 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||
*/ | |||
public interface INdKqZzsfwMenuService extends IService<NdKqZzsfwMenu> { | |||
Map<Integer, Integer> matterCountByWindowIds(Collection<Integer> windowIds); | |||
} |
@@ -1,14 +1,22 @@ | |||
package com.ningdatech.kqapi.zzsfw.service.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.kqapi.admin.model.dto.MatterCountByWindowIdDTO; | |||
import com.ningdatech.kqapi.zzsfw.model.entity.NdKqZzsfwMenu; | |||
import com.ningdatech.kqapi.zzsfw.mapper.NdKqZzsfwMenuMapper; | |||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
@@ -17,4 +25,14 @@ import org.springframework.stereotype.Service; | |||
@Service | |||
public class NdKqZzsfwMenuServiceImpl extends ServiceImpl<NdKqZzsfwMenuMapper, NdKqZzsfwMenu> implements INdKqZzsfwMenuService { | |||
@Override | |||
public Map<Integer, Integer> matterCountByWindowIds(Collection<Integer> windowIds) { | |||
if (CollUtil.isEmpty(windowIds)) { | |||
return Collections.emptyMap(); | |||
} | |||
List<MatterCountByWindowIdDTO> matterCountByWindowIds = baseMapper.selectMatterCountByWindowIds(windowIds); | |||
return CollUtils.listToMap(matterCountByWindowIds, | |||
MatterCountByWindowIdDTO::getWindowId, | |||
MatterCountByWindowIdDTO::getMatterCount); | |||
} | |||
} |