99 changed files with 4448 additions and 41 deletions
@ -0,0 +1,36 @@ |
|||
package com.epmet.commons.tools.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2023/5/15 13:44 |
|||
*/ |
|||
@Data |
|||
public class OrgCommonFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 2261315322260807610L; |
|||
|
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
public interface AddUserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
/** |
|||
* 组织id或者网格id |
|||
*/ |
|||
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class) |
|||
private String orgId; |
|||
/** |
|||
* agency |
|||
* grid |
|||
*/ |
|||
@NotBlank(message = "orgType不能为空", groups = AddUserInternalGroup.class) |
|||
private String orgType; |
|||
} |
|||
|
|||
@ -0,0 +1,21 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @Description 灵山代办员信息 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/15 2:57 PM |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class LingShanScreenAgentRstDTO { |
|||
|
|||
private String agentName; |
|||
private String longitude; |
|||
private String latitude; |
|||
private String mobile; |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山代办,代办员列表 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/9 4:26 PM |
|||
*/ |
|||
@Data |
|||
public class LingshanServiceAgentAgentList { |
|||
|
|||
private String gridId; |
|||
private String orgNamePath; |
|||
private String agentId; |
|||
private String agentName; |
|||
private Integer gender; |
|||
private String genderDisplay; |
|||
private Integer age; |
|||
private String cultureDisplay; |
|||
private Integer culture; |
|||
private String mobile; |
|||
private String idCard; |
|||
|
|||
private String longitude; |
|||
|
|||
private String latitude; |
|||
|
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
package com.epmet.dataaggre.beans; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LingShanAgentServiceStaffAndGrid { |
|||
private String staffId; |
|||
|
|||
private String gridId; |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package com.epmet.dataaggre.beans; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class StaffInfoInGridOfRole { |
|||
private String staffId; |
|||
private String staffName; |
|||
private Integer gender; |
|||
private Integer age; |
|||
private Integer culture; |
|||
private String mobile; |
|||
private String idCard; |
|||
} |
|||
@ -0,0 +1,78 @@ |
|||
package com.epmet.dataaggre.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList; |
|||
import com.epmet.dataaggre.service.LingShanServiceAgentService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@RequestMapping("lingshan/serviceAgent") |
|||
public class LingShanServiceAgentController { |
|||
|
|||
@Autowired |
|||
private LingShanServiceAgentService lingShanServiceAgentService; |
|||
|
|||
/** |
|||
* @description: 工作端pc,代办员列表 |
|||
* @param pageNo: |
|||
* @param pageSize: |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @param agentName: |
|||
* @param mobile: |
|||
* @param idCard: |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/9 4:30 PM |
|||
*/ |
|||
@GetMapping("workpc/agentList") |
|||
public Result<PageData<LingshanServiceAgentAgentList>> workPcAgentList(@RequestParam("pageNo") Integer pageNo, |
|||
@RequestParam("pageSize") Integer pageSize, |
|||
@RequestParam(value = "orgId", required = false) String orgId, |
|||
@RequestParam(value = "orgType", required = false) String orgType, |
|||
@RequestParam(value = "agentName",required = false) String agentName, |
|||
@RequestParam(value = "mobile", required = false) Integer mobile, |
|||
@RequestParam(value = "idCard", required = false) Integer idCard) { |
|||
|
|||
PageData<LingshanServiceAgentAgentList> pd = lingShanServiceAgentService.workPcAgentList(orgId, orgType, agentName, mobile, idCard, pageNo, pageSize); |
|||
return new Result<PageData<LingshanServiceAgentAgentList>>().ok(pd); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 大屏-代办员数量 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return com.epmet.commons.tools.utils.Result<java.lang.Integer> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 10:29 AM |
|||
*/ |
|||
@GetMapping("screen/agentQty") |
|||
public Result<Integer> lingshanScreenAgentQty(@RequestParam(value = "orgId", required = false) String orgId, |
|||
@RequestParam(value = "orgType", required = false) String orgType) { |
|||
|
|||
return new Result<Integer>().ok(lingShanServiceAgentService.lingshanScreenAgentQty(orgId, orgType)); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 大屏:代办员列表 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList>> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 4:57 PM |
|||
*/ |
|||
@GetMapping("screen/agentList") |
|||
public Result<List<LingshanServiceAgentAgentList>> screenAgentList(@RequestParam(value = "orgId", required = false) String orgId, |
|||
@RequestParam(value = "orgType", required = false) String orgType) { |
|||
|
|||
List<LingshanServiceAgentAgentList> rl = lingShanServiceAgentService.screenAgentList(orgId, orgType); |
|||
return new Result<List<LingshanServiceAgentAgentList>>().ok(rl); |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package com.epmet.dataaggre.service; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface LingShanServiceAgentService { |
|||
PageData<LingshanServiceAgentAgentList> workPcAgentList(String orgId, String orgType, String agentName, Integer mobile, Integer idCard, Integer pageNo, Integer pageSize); |
|||
|
|||
Integer lingshanScreenAgentQty(String orgId, String orgType); |
|||
|
|||
List<LingshanServiceAgentAgentList> screenAgentList(String orgId, String orgType); |
|||
} |
|||
@ -0,0 +1,244 @@ |
|||
package com.epmet.dataaggre.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.enums.DictTypeEnum; |
|||
import com.epmet.commons.tools.enums.GenderEnum; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.PidUtils; |
|||
import com.epmet.constant.OrgInfoConstant; |
|||
import com.epmet.constant.RoleKeyConstants; |
|||
import com.epmet.dataaggre.beans.LingShanAgentServiceStaffAndGrid; |
|||
import com.epmet.dataaggre.beans.StaffInfoInGridOfRole; |
|||
import com.epmet.dataaggre.dao.govorg.CustomerGridDao; |
|||
import com.epmet.dataaggre.dao.govorg.CustomerStaffGridDao; |
|||
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList; |
|||
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; |
|||
import com.epmet.dataaggre.entity.govorg.CustomerStaffGridEntity; |
|||
import com.epmet.dataaggre.service.LingShanServiceAgentService; |
|||
import com.epmet.dataaggre.service.epmetuser.EpmetUserService; |
|||
import com.epmet.dataaggre.service.govorg.GovOrgService; |
|||
import com.epmet.dto.SysDictDataDTO; |
|||
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|||
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|||
import com.epmet.remote.EpmetUserRemoteService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.Stream; |
|||
|
|||
@Service |
|||
public class LingShanServiceAgentServiceImpl implements LingShanServiceAgentService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
private EpmetUserService epmetUserService; |
|||
|
|||
@Autowired |
|||
private GovOrgService govOrgService; |
|||
|
|||
@Autowired |
|||
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private EpmetUserRemoteService epmetUserRemoteService; |
|||
|
|||
/** |
|||
* @Description: 填充 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @param staffIdAndGridIds: |
|||
* @param staffIds: |
|||
* @Return void |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 10:33 AM |
|||
*/ |
|||
private void fillDatas4AgentQuery(String orgId, String orgType, Map<String, List<String>> staffIdAndGridIds, Set<String> staffIds) { |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// agency
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
List<LingShanAgentServiceStaffAndGrid> sags = govOrgService.getStaffAndItsBelongsGridByAgencyIdPath(PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids())); |
|||
for (LingShanAgentServiceStaffAndGrid sag : sags) { |
|||
staffIds.add(sag.getStaffId()); |
|||
|
|||
List<String> gridIds = staffIdAndGridIds.get(sag.getStaffId()); |
|||
if (CollectionUtils.isEmpty(gridIds)) { |
|||
gridIds = new ArrayList<>(); |
|||
staffIdAndGridIds.put(sag.getStaffId(), gridIds); |
|||
} |
|||
|
|||
gridIds.add(sag.getGridId()); |
|||
} |
|||
} else if (OrgInfoConstant.GRID.equals(orgType)) { |
|||
// 网格
|
|||
staffIds = govOrgService.getStaffIdsInGrid(orgId); |
|||
for (String staffId : staffIds) { |
|||
staffIdAndGridIds.put(staffId, Arrays.asList(orgId)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public PageData<LingshanServiceAgentAgentList> workPcAgentList(String orgId, String orgType, String agentName, Integer mobile, Integer idCard, |
|||
Integer pageNo, Integer pageSize) { |
|||
|
|||
// 1个人可能属于多个网格,这里用来给页面显示多个网格,逗号分割
|
|||
Map<String, List<String>> staffIdAndGridIds = new HashMap<>(); |
|||
|
|||
// 用来进一步查询工作人员
|
|||
Set<String> staffIds = new HashSet<>(); |
|||
|
|||
if (StringUtils.isAnyBlank(orgId, orgType)) { |
|||
// 如果前端没选择,那就取当前工作人员所属组织
|
|||
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|||
orgId = loginUserDetails.getAgencyId(); |
|||
orgType = OrgInfoConstant.AGENCY; |
|||
} |
|||
|
|||
// 得到staffIds和staffIdAndGridIds
|
|||
fillDatas4AgentQuery(orgId, orgType, staffIdAndGridIds, staffIds); |
|||
|
|||
// 开始查询staff列表
|
|||
PageData<StaffInfoInGridOfRole> pd = epmetUserService.staffListInGridsOfRole(RoleKeyConstants.ROLE_KEY_AGENT, staffIds, agentName, mobile, idCard, pageNo, pageSize); |
|||
|
|||
if (pd == null) { |
|||
return new PageData(new ArrayList(), 0); |
|||
} |
|||
|
|||
// 性别字典
|
|||
List<SysDictDataDTO> edus = getResultDataOrReturnNull(adminOpenFeignClient.dictDataList(DictTypeEnum.EDUCATION.getCode()), ServiceConstant.EPMET_ADMIN_SERVER); |
|||
Map<String, String> eduMap = edus.stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel)); |
|||
|
|||
// 转换为dto
|
|||
List<LingshanServiceAgentAgentList> rl = pd.getList().stream().map(e -> { |
|||
LingshanServiceAgentAgentList d = new LingshanServiceAgentAgentList(); |
|||
d.setAgentName(e.getStaffName()); |
|||
d.setAgentId(e.getStaffId()); |
|||
d.setGender(e.getGender()); |
|||
d.setGenderDisplay(GenderEnum.getName(e.getGender().toString())); |
|||
d.setAge(e.getAge()); |
|||
d.setCulture(e.getCulture()); |
|||
if (e.getCulture() != null) { |
|||
d.setCultureDisplay(eduMap.get(e.getCulture().toString())); |
|||
} |
|||
d.setMobile(e.getMobile()); |
|||
d.setIdCard(e.getIdCard()); |
|||
|
|||
// 组织名称
|
|||
d.setOrgNamePath(getOrgNamePath(staffIdAndGridIds.get(e.getStaffId()))); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
return new PageData<>(rl, pd.getTotal()); |
|||
} |
|||
|
|||
/** |
|||
* 通过gridid列表,拼接处组织名称path,例如:开发者社区-Java第一网格,开发者社区-Python第一网格 |
|||
*/ |
|||
private String getOrgNamePath(List<String> gridIds) { |
|||
List<String> orgNames = gridIds.stream().map(gridId -> { |
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId); |
|||
if (gridInfo == null) { |
|||
return null; |
|||
} |
|||
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(gridInfo.getPid()); |
|||
String agencyName = agencyInfo.getOrganizationName(); |
|||
return agencyName.concat("-").concat(gridInfo.getGridName()); |
|||
}).filter(Objects::nonNull).collect(Collectors.toList()); |
|||
|
|||
return String.join(",", orgNames); |
|||
} |
|||
|
|||
@Override |
|||
public Integer lingshanScreenAgentQty(String orgId, String orgType) { |
|||
|
|||
// 1个人可能属于多个wangge
|
|||
Map<String, List<String>> staffIdAndGridIds = new HashMap<>(); |
|||
Set<String> staffIds = new HashSet<>(); |
|||
|
|||
if (StringUtils.isAnyBlank(orgId, orgType)) { |
|||
// 如果前端没选择,那就取当前工作人员所属组织
|
|||
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|||
orgId = loginUserDetails.getAgencyId(); |
|||
orgType = OrgInfoConstant.AGENCY; |
|||
} |
|||
|
|||
// 得到staffIds和staffIdAndGridIds
|
|||
fillDatas4AgentQuery(orgId, orgType, staffIdAndGridIds, staffIds); |
|||
|
|||
// 开始查询staff列表
|
|||
return epmetUserService.staffQtyInGridsOfRole(RoleKeyConstants.ROLE_KEY_AGENT, staffIds); |
|||
} |
|||
|
|||
@Override |
|||
public List<LingshanServiceAgentAgentList> screenAgentList(String orgId, String orgType) { |
|||
// 1个人可能属于多个wangge
|
|||
Map<String, List<String>> staffIdAndGridIds = new HashMap<>(); |
|||
Set<String> staffIds = new HashSet<>(); |
|||
|
|||
if (StringUtils.isAnyBlank(orgId, orgType)) { |
|||
// 如果前端没选择,那就取当前工作人员所属组织
|
|||
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|||
orgId = loginUserDetails.getAgencyId(); |
|||
orgType = OrgInfoConstant.AGENCY; |
|||
} |
|||
|
|||
fillDatas4AgentQuery(orgId, orgType, staffIdAndGridIds, staffIds); |
|||
|
|||
// 开始查询staff列表
|
|||
PageData<StaffInfoInGridOfRole> staffPage = epmetUserService.staffListInGridsOfRole(RoleKeyConstants.ROLE_KEY_AGENT, staffIds, |
|||
null, null, null, 1, Integer.MAX_VALUE); |
|||
|
|||
if (staffPage == null) { |
|||
return new ArrayList(); |
|||
} |
|||
|
|||
// 性别&教育字典
|
|||
List<SysDictDataDTO> edus = getResultDataOrReturnNull(adminOpenFeignClient.dictDataList(DictTypeEnum.EDUCATION.getCode()), ServiceConstant.EPMET_ADMIN_SERVER); |
|||
Map<String, String> eduMap = edus.stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel)); |
|||
|
|||
// 转换为dto
|
|||
List<LingshanServiceAgentAgentList> rl = staffPage.getList().stream().map(e -> { |
|||
LingshanServiceAgentAgentList d = new LingshanServiceAgentAgentList(); |
|||
d.setAgentName(e.getStaffName()); |
|||
d.setAgentId(e.getStaffId()); |
|||
d.setGender(e.getGender()); |
|||
d.setGenderDisplay(GenderEnum.getName(e.getGender().toString())); |
|||
d.setAge(e.getAge()); |
|||
d.setCulture(e.getCulture()); |
|||
if (e.getCulture() != null) { |
|||
d.setCultureDisplay(eduMap.get(e.getCulture().toString())); |
|||
} |
|||
d.setMobile(e.getMobile()); |
|||
d.setIdCard(e.getIdCard()); |
|||
// 组织名称
|
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
// 展开工作人员与网格的对应关系,开始赋值坐标,坐标使用所属网格的坐标,但是一个工作人员可能属于多个网格,有几个网格就复制出来几条工作人员信息,内容重复即可。
|
|||
List<LingshanServiceAgentAgentList> finalAgentList = rl.stream().flatMap(agent -> { |
|||
List<String> gridIdsOfAgent = staffIdAndGridIds.get(agent.getAgentId()); |
|||
return gridIdsOfAgent.stream().map(gridId -> { |
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId); |
|||
LingshanServiceAgentAgentList newOne = ConvertUtils.sourceToTarget(agent, LingshanServiceAgentAgentList.class); |
|||
newOne.setLatitude(gridInfo.getLatitude()); |
|||
newOne.setLongitude(gridInfo.getLongitude()); |
|||
newOne.setGridId(gridId); |
|||
newOne.setOrgNamePath(gridInfo.getGridNamePath()); |
|||
return newOne; |
|||
}); |
|||
}).collect(Collectors.toList()); |
|||
|
|||
return finalAgentList; |
|||
} |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package com.epmet; |
|||
|
|||
/** |
|||
* @Description 红色待办-待办状态枚举 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/9 9:59 AM |
|||
*/ |
|||
public enum LingShanAgentServiceProcessStatusEnum { |
|||
// 办理状态。0待受理,1已受理,2已驳回,3已办结,-1已撤回
|
|||
|
|||
WAIT_ACCEPT(0, "待受理"), |
|||
ACCEPTED(1, "已受理"), |
|||
REJECTED(2, "已驳回"), |
|||
CLOSED(3, "已办结"), |
|||
WITHDRAW(-1, "已撤回"); |
|||
|
|||
private int statusCode; |
|||
|
|||
private String statusName; |
|||
|
|||
LingShanAgentServiceProcessStatusEnum(int status, String name) { |
|||
this.statusCode = status; |
|||
this.statusName = name; |
|||
} |
|||
|
|||
public static LingShanAgentServiceProcessStatusEnum getByStatus(int statusCode) { |
|||
for (LingShanAgentServiceProcessStatusEnum e : LingShanAgentServiceProcessStatusEnum.values()) { |
|||
if (e.statusCode == statusCode) { |
|||
return e; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static LingShanAgentServiceProcessStatusEnum getByName(String statusName) { |
|||
for (LingShanAgentServiceProcessStatusEnum e : LingShanAgentServiceProcessStatusEnum.values()) { |
|||
if (e.statusName.equals(statusName)) { |
|||
return e; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public int getStatusCode() { |
|||
return statusCode; |
|||
} |
|||
|
|||
public void setStatusCode(int statusCode) { |
|||
this.statusCode = statusCode; |
|||
} |
|||
|
|||
public String getStatusName() { |
|||
return statusName; |
|||
} |
|||
|
|||
public void setStatusName(String statusName) { |
|||
this.statusName = statusName; |
|||
} |
|||
} |
|||
@ -0,0 +1,202 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 灵山_办事大厅服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-15 |
|||
*/ |
|||
@Data |
|||
public class LingshanOfficeHallServiceRecordDTO implements Serializable { |
|||
private static final long serialVersionUID = 2157075710544884607L; |
|||
|
|||
public interface AddInternalGroup { |
|||
} |
|||
|
|||
public interface AddShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
public interface UpdateInternalGroup { |
|||
} |
|||
|
|||
public interface UpdateShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
@NotBlank(message = "id不能为空",groups = {UpdateInternalGroup.class}) |
|||
private String id; |
|||
|
|||
/** |
|||
* 租户号 |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 工作人员录入:gov_pc;居民端小程序:resi_mp |
|||
*/ |
|||
private String sourceType; |
|||
|
|||
/** |
|||
* 事项类型 |
|||
*/ |
|||
@NotBlank(message = "事项类型不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 类别名称 |
|||
* 举例:营业执照服务、食品许可证服务、医疗保险业务、养老保险业务 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 事项说明 |
|||
*/ |
|||
@NotBlank(message = "事项说明不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
|||
@Length(max = 500, message = "事项说明最多输入500字", groups = {AddShowGroup.class, UpdateShowGroup.class}) |
|||
private String content; |
|||
|
|||
/** |
|||
* 申请人所属组织id或者网格id |
|||
*/ |
|||
@NotBlank(message = "申请人所属组织不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
|||
private String applicantOrgId; |
|||
|
|||
/** |
|||
* agency或者grid |
|||
*/ |
|||
@NotBlank(message = "orgType不能为空",groups = {AddInternalGroup.class,UpdateInternalGroup.class}) |
|||
private String applicantOrgType; |
|||
|
|||
/** |
|||
* ORG_ID全路径 |
|||
*/ |
|||
private String applicantOrgIdPath; |
|||
|
|||
/** |
|||
* 申请人所属组织名称 |
|||
*/ |
|||
private String applicantOrgName; |
|||
|
|||
/** |
|||
* 申请人姓名 |
|||
*/ |
|||
// @NotBlank(message = "申请人姓名不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class})
|
|||
// @Length(max = 30, message = "申请人姓名最多输入30字", groups = {AddShowGroup.class, UpdateShowGroup.class})
|
|||
private String applicantName; |
|||
|
|||
/** |
|||
* 申请人联系电话 |
|||
*/ |
|||
// @NotBlank(message = "申请人电话不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class})
|
|||
// @Length(max = 30, message = "申请人电话最多输入30字", groups = {AddShowGroup.class, UpdateShowGroup.class})
|
|||
private String applicantMobile; |
|||
|
|||
/** |
|||
* 申请人身份证号 |
|||
*/ |
|||
// @NotBlank(message = "申请人身份证号不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class})
|
|||
// @Length(max = 30, message = "申请人身份证号最多输入30字", groups = {AddShowGroup.class, UpdateShowGroup.class})
|
|||
private String applicantIdCard; |
|||
|
|||
/** |
|||
* 申请日期 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
// @NotNull(message = "申请日期不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class})
|
|||
private Date applicantTime; |
|||
|
|||
/** |
|||
* 办理人姓名 |
|||
*/ |
|||
@NotBlank(message = "办理人姓名不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
|||
@Length(max = 30, message = "办理人姓名最多输入30字", groups = {AddShowGroup.class, UpdateShowGroup.class}) |
|||
private String transactorName; |
|||
|
|||
/** |
|||
* 未办结:0;已办结:1 |
|||
*/ |
|||
@NotBlank(message = "办理状态不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
|||
private String status; |
|||
|
|||
private String statusName; |
|||
/** |
|||
* 办结日期 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
private Date closeTime; |
|||
|
|||
/** |
|||
* 满意度评价。-1不满意,0基本满意,1非常满意 |
|||
*/ |
|||
private Integer satisfication; |
|||
|
|||
private String satisficationName; |
|||
|
|||
/** |
|||
* 本条数据所属组织id/所属网格id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* agency或者grid |
|||
*/ |
|||
private String orgType; |
|||
|
|||
/** |
|||
* 本条数据所属组织的org_id_path |
|||
*/ |
|||
private String orgIdPath; |
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
@JsonIgnore |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 删除标记 |
|||
*/ |
|||
@JsonIgnore |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
@JsonIgnore |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@JsonIgnore |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
@JsonIgnore |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@JsonIgnore |
|||
private Date updatedTime; |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.form.agentservice; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 工作端:代理服务办结 |
|||
*/ |
|||
@Data |
|||
public class WorkCloseAgentServiceFormDTO { |
|||
@NotBlank(message = "待办服务ID必填") |
|||
private String id; |
|||
|
|||
private String processDesc; |
|||
private List<String> processAttachments; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.epmet.dto.form.lingshan; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class AgentServiceResiSubmitFormDTO { |
|||
|
|||
public interface Create extends CustomerClientShowGroup {} |
|||
|
|||
@NotBlank(message = "网格ID不能为空", groups = { Create.class }) |
|||
private String gridId; |
|||
@NotBlank(message = "服务类别不能为空", groups = { Create.class }) |
|||
private String serviceCategory; |
|||
@NotBlank(message = "详细说明不能为空", groups = { Create.class }) |
|||
private String content; |
|||
@NotBlank(message = "预约服务地点不能为空", groups = { Create.class }) |
|||
private String exceptServeAddress; |
|||
@NotBlank(message = "联系人不能为空", groups = { Create.class }) |
|||
private String contactName; |
|||
@NotBlank(message = "联系电话不能为空", groups = { Create.class }) |
|||
private String contactMobile; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@NotNull(message = "预约服务时间不能为空", groups = { Create.class }) |
|||
private Date exceptServeTime; |
|||
private List<String> attachmentsList; |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package com.epmet.dto.form.lingshan; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2023/5/15 16:31 |
|||
*/ |
|||
@Data |
|||
public class LingshanOfficeHallServiceRecordPageFormDTO extends PageFormDTO { |
|||
private String orgId; |
|||
private String orgType; |
|||
/** |
|||
* 事项类型 |
|||
*/ |
|||
private String categoryCode; |
|||
/** |
|||
* 事项说明 |
|||
*/ |
|||
private String content; |
|||
/** |
|||
* 满意度评价。-1不满意,0基本满意,1非常满意 |
|||
*/ |
|||
private Integer satisfication; |
|||
|
|||
/** |
|||
* 申请开始日期 |
|||
*/ |
|||
private String applicantStartDate; |
|||
|
|||
/** |
|||
* 申请结束日期 |
|||
*/ |
|||
private String applicantEndDate; |
|||
|
|||
/** |
|||
* 办结日期 |
|||
*/ |
|||
// @DateTimeFormat(pattern = "yyyy-MM-dd")
|
|||
// @JsonFormat(pattern = "yyyy-MM-dd")
|
|||
private String closeStartDate; |
|||
|
|||
// @DateTimeFormat(pattern = "yyyy-MM-dd")
|
|||
// @JsonFormat(pattern = "yyyy-MM-dd")
|
|||
private String closeEndDate; |
|||
|
|||
/** |
|||
* 未办结:0;已办结:1 |
|||
*/ |
|||
private String status; |
|||
|
|||
//tokenDto.
|
|||
private String customerId; |
|||
//tokenDto.
|
|||
private String staffId; |
|||
} |
|||
|
|||
@ -0,0 +1,17 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山,联建单位 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 2:38 PM |
|||
*/ |
|||
@Data |
|||
public class LingShanPartyUnitRstDTO { |
|||
|
|||
private String orgName; |
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description PC工作端-服务列表 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/10 2:58 PM |
|||
*/ |
|||
@Data |
|||
public class AgentServiceList4WorkPcResultDTO { |
|||
private String id; |
|||
private String orgNamePath; |
|||
private String serviceCategory; |
|||
private String serviceCategoryName; |
|||
private String applicantName; |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
private Date createdTime; |
|||
|
|||
private String agentName; |
|||
private Integer processStatus; |
|||
private String processStatusDisplay; |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
private Date processTime; |
|||
|
|||
private Integer satisfaction; |
|||
|
|||
private String content; |
|||
|
|||
private List<String> attachments; |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* { |
|||
* "time":"1月", |
|||
* "data":[ |
|||
* { |
|||
* "name": "受理数", |
|||
* "value": 140 |
|||
* }, |
|||
* { |
|||
* "name": "办结率", |
|||
* "value": 95.3 |
|||
* } |
|||
* ] |
|||
* }, |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/16 1:38 PM |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class AgentServiceTrendAnalysisRstDTO { |
|||
// 1月
|
|||
private String time; |
|||
|
|||
//
|
|||
private List<DataObj> data; |
|||
|
|||
public static class DataObj { |
|||
private String name; |
|||
private Integer value; |
|||
|
|||
public DataObj() { |
|||
} |
|||
|
|||
public DataObj(String name, Integer value) { |
|||
this.name = name; |
|||
this.value = value; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public Integer getValue() { |
|||
return value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LingShanAgentServiceCategoryResultDTO { |
|||
|
|||
/** |
|||
* 租户号 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 类别名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 图标 |
|||
*/ |
|||
private String iconUrl; |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class LingShanScreenAgentRstDTO { |
|||
|
|||
private String gridId; |
|||
private String agentId; |
|||
private String agentName; |
|||
private String longitude; |
|||
private String latitude; |
|||
private String mobile; |
|||
private Integer unClosedServiceQty; |
|||
private Integer closedServiceQty; |
|||
|
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class LingShanScreenServiceRstDTO { |
|||
private String content; |
|||
private String applicantName; |
|||
private String applicantMobile; |
|||
private String applicantHomeAddress; |
|||
private Date createdTime; |
|||
private String agentName; |
|||
private String agentMobile; |
|||
|
|||
/** |
|||
* 经度 |
|||
*/ |
|||
private String longitude; |
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
private String latitude; |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class ResiMyCreatedAgentServiceResultDTO { |
|||
private String id; |
|||
private String serviceCategory; |
|||
private String serviceCategoryName; |
|||
private String content; |
|||
private Date createdTime; |
|||
// 待受理
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private Date exceptServeTime; |
|||
private String exceptServeAddress; |
|||
|
|||
/** |
|||
* 处理时间 |
|||
*/ |
|||
private Date processTime; |
|||
|
|||
/** |
|||
* 处理说明 |
|||
*/ |
|||
private String processDesc; |
|||
|
|||
/** |
|||
* 办结时间 |
|||
*/ |
|||
private Date closeTime; |
|||
|
|||
/** |
|||
* 办结说明 |
|||
*/ |
|||
private String closeDesc; |
|||
|
|||
private Integer processStatus; |
|||
|
|||
private String processStatusName; |
|||
|
|||
private Integer satisfaction; |
|||
|
|||
private List<String> attachments; |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @Description 灵山大屏:服务类别统计分析 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/16 12:48 PM |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class ScreenAgentServiceCategoryAnalysisRstDTO { |
|||
|
|||
private String name; |
|||
private Integer value; |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/15 10:09 AM |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class ScreenCatalogueQtyStatsRstDTO { |
|||
|
|||
// agent service_unclosed service_closed
|
|||
private String dataType; |
|||
private String name; |
|||
private Integer qty = 0; |
|||
|
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.result.agentservice; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Description 工作单-服务代办列表 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/9 10:52 AM |
|||
*/ |
|||
@Data |
|||
public class WorkServiceAgentResultDTO { |
|||
|
|||
private Integer serviceCategory; |
|||
private String serviceCategoryName; |
|||
|
|||
private Date createdTime; |
|||
private String content; |
|||
|
|||
// 待受理
|
|||
private Date exceptServeTime; |
|||
private String exceptServeAddress; |
|||
|
|||
} |
|||
@ -0,0 +1,320 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.LingShanAgentServiceProcessStatusEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.exception.ValidateException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.agentservice.WorkCloseAgentServiceFormDTO; |
|||
import com.epmet.dto.form.lingshan.AgentServiceResiSubmitFormDTO; |
|||
import com.epmet.dto.result.agentservice.*; |
|||
import com.epmet.service.LingShanAgentServiceService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description 灵山-服务代办 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/6 2:49 PM |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("lingshan/serviceAgent") |
|||
public class LingShanAgentServiceController { |
|||
|
|||
@Autowired |
|||
private LingShanAgentServiceService lingShanServiceAgentService; |
|||
|
|||
/** |
|||
* @Description: 服务分类 |
|||
* @param : |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/11 2:57 PM |
|||
*/ |
|||
@GetMapping("serviceCategoryList") |
|||
public Result<List<LingShanAgentServiceCategoryResultDTO>> listServiceCategories() { |
|||
List<LingShanAgentServiceCategoryResultDTO> l = lingShanServiceAgentService.listServiceCategories(); |
|||
return new Result<List<LingShanAgentServiceCategoryResultDTO>>().ok(l); |
|||
} |
|||
|
|||
/** |
|||
* @description: 居民端-提交代办服务 |
|||
* @param form: |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/6 3:02 PM |
|||
*/ |
|||
@PostMapping("resi/submit") |
|||
public Result resiSubmit(@RequestBody AgentServiceResiSubmitFormDTO form) { |
|||
ValidatorUtils.validateEntity(form, AgentServiceResiSubmitFormDTO.Create.class); |
|||
lingShanServiceAgentService.resiSubmit(form); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @description: 我创建的 |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/9 10:06 AM |
|||
*/ |
|||
@GetMapping("resi/mycreated") |
|||
public Result<PageData<ResiMyCreatedAgentServiceResultDTO>> myCreated(@RequestParam(value = "processStatus", required = false) Integer processStatus, |
|||
@RequestParam("gridId") String gridId, |
|||
@RequestParam("pageNo") Integer pageNo, |
|||
@RequestParam("pageSize") Integer pageSize) { |
|||
|
|||
PageData<ResiMyCreatedAgentServiceResultDTO> pd = lingShanServiceAgentService.myCreatedList(processStatus, gridId, pageNo, pageSize); |
|||
return new Result().ok(pd); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 撤回 |
|||
* @param form: |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/10 11:20 AM |
|||
*/ |
|||
@PostMapping("resi/withdraw") |
|||
public Result resiWithDraw(@RequestBody Map<String, String> form) { |
|||
String id = form.get("id"); |
|||
if (StringUtils.isBlank(id)) { |
|||
throw new ValidateException("缺少ID参数"); |
|||
} |
|||
|
|||
lingShanServiceAgentService.resiWithDraw(id); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 居民端-评价 |
|||
* @param form: |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/10 2:53 PM |
|||
*/ |
|||
@PostMapping("resi/evaluate") |
|||
public Result resiEvaluate(@RequestBody Map<String, Object> form) { |
|||
String id = (String) form.get("id"); |
|||
Integer satisfication = (Integer) form.get("satisfication"); |
|||
if (StringUtils.isAnyBlank(id) || satisfication == null) { |
|||
throw new ValidateException("缺少ID参数"); |
|||
} |
|||
|
|||
lingShanServiceAgentService.resiEvaluate(id, satisfication); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @description: 工作端-服务列表 |
|||
* 这个接口返回的跟居民端一样,所以暂时就调用居民端一样的接口了。 |
|||
* @param processStatus: |
|||
* @param gridId: |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/9 10:59 AM |
|||
*/ |
|||
@GetMapping("work/serviceList") |
|||
public Result<PageData<ResiMyCreatedAgentServiceResultDTO>> workServiceList(@RequestParam(value = "processStatus", required = false) Integer processStatus, |
|||
@RequestParam("gridId") String gridId, |
|||
@RequestParam("pageNo") Integer pageNo, |
|||
@RequestParam("pageSize") Integer pageSize) { |
|||
PageData<ResiMyCreatedAgentServiceResultDTO> pd = lingShanServiceAgentService.myCreatedList(processStatus, gridId, pageNo, pageSize); |
|||
return new Result().ok(pd); |
|||
} |
|||
|
|||
/** |
|||
* @description: 工作端提交处理。没几个参数,不值当用dto了 |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/9 11:10 AM |
|||
*/ |
|||
@PostMapping("work/process") |
|||
public Result workProcess(@RequestBody Map<String, Object> input) { |
|||
|
|||
String id = (String) input.get("id"); |
|||
Integer processType = (Integer) input.get("processType"); |
|||
String processDesc = (String) input.get("processDesc"); |
|||
|
|||
if (StringUtils.isAnyBlank(id) || processType == null) { |
|||
throw new ValidateException("参数错误"); |
|||
} |
|||
|
|||
LingShanAgentServiceProcessStatusEnum processTypeEnum = LingShanAgentServiceProcessStatusEnum.getByStatus(processType); |
|||
|
|||
// 如果是驳回,那么描述必填
|
|||
if (processTypeEnum == LingShanAgentServiceProcessStatusEnum.REJECTED |
|||
&& StringUtils.isBlank(processDesc)) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "驳回操作时,驳回原因为必填项"); |
|||
} |
|||
|
|||
lingShanServiceAgentService.workProcess(id, processType, processDesc); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @description: 工作端:办结 |
|||
* @param input: |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/9 2:57 PM |
|||
*/ |
|||
@PostMapping("work/close") |
|||
public Result workClose(@RequestBody WorkCloseAgentServiceFormDTO input) { |
|||
ValidatorUtils.validateEntity(input); |
|||
|
|||
String id = input.getId(); |
|||
String processDesc = input.getProcessDesc(); |
|||
List<String> processAttachments = input.getProcessAttachments(); |
|||
|
|||
lingShanServiceAgentService.workClose(id, processDesc, processAttachments); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 删除 |
|||
* @param input: |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/10 5:29 PM |
|||
*/ |
|||
@PostMapping("workpc/delete") |
|||
public Result workPcDelete(@RequestBody Map<String, Object> input) { |
|||
String id = (String) input.get("id"); |
|||
if (StringUtils.isBlank(id)) { |
|||
throw new ValidateException("ID为必填项"); |
|||
} |
|||
|
|||
lingShanServiceAgentService.workPcDelete(id); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @Description: pc工作端:服务列表 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @param serviceCategory: |
|||
* @param content: |
|||
* @param agentName: |
|||
* @param processTimeStartStr: |
|||
* @param processTimeEndStr: |
|||
* @Return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData<com.epmet.dto.result.agentservice.AgentServiceList4WorkPcResultDTO>> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/10 3:00 PM |
|||
*/ |
|||
@GetMapping("workpc/serviceList") |
|||
public Result<PageData<AgentServiceList4WorkPcResultDTO>> workPcServiceList(@RequestParam(value = "orgId", required = false) String orgId, |
|||
@RequestParam(value = "orgType", required = false) String orgType, |
|||
@RequestParam(value = "serviceCategory", required = false) String serviceCategory, |
|||
@RequestParam(value = "content", required = false) String content, |
|||
@RequestParam(value = "agentName", required = false) String agentName, |
|||
@RequestParam(value = "processTimeStart", required = false) String processTimeStartStr, |
|||
@RequestParam(value = "processTimeEnd", required = false) String processTimeEndStr, |
|||
@RequestParam(value = "pageNo") Integer pageNo, |
|||
@RequestParam(value = "pageSize") Integer pageSize) { |
|||
|
|||
Date processTimeStart = null, processTimeEnd = null; |
|||
|
|||
if (StringUtils.isNotBlank(processTimeStartStr)) { |
|||
processTimeStart = DateUtils.parse(processTimeStartStr, DateUtils.DATE_PATTERN); |
|||
} |
|||
if (StringUtils.isNotBlank(processTimeEndStr)) { |
|||
processTimeEnd = DateUtils.parse(processTimeEndStr, DateUtils.DATE_PATTERN); |
|||
} |
|||
|
|||
PageData<AgentServiceList4WorkPcResultDTO> pd = lingShanServiceAgentService.workPcServiceList(orgId, orgType, serviceCategory, content, agentName, |
|||
processTimeStart, processTimeEnd, pageNo, pageSize); |
|||
return new Result<PageData<AgentServiceList4WorkPcResultDTO>>().ok(pd); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 大屏:中央红色待办,选择目录(带数量) |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 12:06 AM |
|||
*/ |
|||
@GetMapping("screen/catalagueQtyStats") |
|||
public Result<List<ScreenCatalogueQtyStatsRstDTO>> screenCatalogueQtyStats(@RequestParam("orgId") String orgId, |
|||
@RequestParam("orgType") String orgType) { |
|||
|
|||
List<ScreenCatalogueQtyStatsRstDTO> l = lingShanServiceAgentService.screenCatalogueQtyStats(orgId, orgType); |
|||
return new Result<List<ScreenCatalogueQtyStatsRstDTO>>().ok(l); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 代办员列表 |
|||
* @param type: agent:代办员。service_unclosed:未办结服务。service_closed:已办结服务 |
|||
* @param orgType: grid,agency |
|||
* @param orgId: 组织id |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 2:51 PM |
|||
*/ |
|||
@GetMapping("screen/agentList") |
|||
public Result<List<LingShanScreenAgentRstDTO>> screenAagentList(@RequestParam("orgType") String orgType, |
|||
@RequestParam("orgId") String orgId) { |
|||
|
|||
List<LingShanScreenAgentRstDTO> rs = lingShanServiceAgentService.screenAgentList(orgType, orgId); |
|||
return new Result<List<LingShanScreenAgentRstDTO>>().ok(rs); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 大屏中央:服务列表 |
|||
* @param orgType: |
|||
* @param orgId: |
|||
* @param dataType: agnet service_unclosed service_closed |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 7:56 PM |
|||
*/ |
|||
@GetMapping("screen/serviceList") |
|||
public Result<List<LingShanScreenServiceRstDTO>> screenServiceList(@RequestParam("orgType") String orgType, |
|||
@RequestParam("orgId") String orgId, |
|||
@RequestParam("dataType") String dataType) { |
|||
|
|||
List<LingShanScreenServiceRstDTO> rl = lingShanServiceAgentService.screenServiceList(orgType, orgId, dataType); |
|||
return new Result<List<LingShanScreenServiceRstDTO>>().ok(rl); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 服务类型数量分析 |
|||
* @param orgType: |
|||
* @param orgId: |
|||
* @Return com.epmet.commons.tools.utils.Result |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/16 12:47 PM |
|||
*/ |
|||
@GetMapping("screen/serviceCategoryAnalysis") |
|||
public Result<List<ScreenAgentServiceCategoryAnalysisRstDTO>> serviceCategoryAnalysis(@RequestParam("orgType") String orgType, |
|||
@RequestParam("orgId") String orgId) { |
|||
|
|||
List<ScreenAgentServiceCategoryAnalysisRstDTO> rl = lingShanServiceAgentService.serviceCategoryAnalysis(orgType, orgId); |
|||
return new Result<List<ScreenAgentServiceCategoryAnalysisRstDTO>>().ok(rl); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 代办服务趋势分析 |
|||
* @param orgType: |
|||
* @param orgId: |
|||
* @Return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.agentservice.AgentServiceTrendAnalysisRstDTO>> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/16 1:39 PM |
|||
*/ |
|||
@GetMapping("screen/serviceTrendAnalysis") |
|||
public Result<List<AgentServiceTrendAnalysisRstDTO>> serviceTrendAnalysis(@RequestParam("orgType") String orgType, |
|||
@RequestParam("orgId") String orgId) { |
|||
|
|||
List<AgentServiceTrendAnalysisRstDTO> rl = lingShanServiceAgentService.serviceTrendAnalysis(orgType, orgId); |
|||
return new Result<List<AgentServiceTrendAnalysisRstDTO>>().ok(rl); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,176 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.alibaba.excel.ExcelWriter; |
|||
import com.alibaba.excel.write.metadata.WriteSheet; |
|||
import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
|||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
|||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO; |
|||
import com.epmet.dto.form.lingshan.LingshanOfficeHallServiceRecordPageFormDTO; |
|||
import com.epmet.excel.LingshanOfficeHallServiceRecordExportExcel; |
|||
import com.epmet.service.LingshanOfficeHallServiceRecordService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.poi.ss.usermodel.IndexedColors; |
|||
import org.apache.poi.ss.usermodel.VerticalAlignment; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
import java.io.PrintWriter; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 灵山_办事大厅服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-15 |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@RequestMapping("lingshanOfficeHallServiceRecord") |
|||
public class LingshanOfficeHallServiceRecordController { |
|||
|
|||
@Autowired |
|||
private LingshanOfficeHallServiceRecordService lingshanOfficeHallServiceRecordService; |
|||
|
|||
/** |
|||
* 分页列表 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("page") |
|||
public Result<PageData<LingshanOfficeHallServiceRecordDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody LingshanOfficeHallServiceRecordPageFormDTO formDTO) { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
PageData<LingshanOfficeHallServiceRecordDTO> page = lingshanOfficeHallServiceRecordService.page(formDTO); |
|||
return new Result<PageData<LingshanOfficeHallServiceRecordDTO>>().ok(page); |
|||
} |
|||
|
|||
/** |
|||
* 办事大厅-查看详情 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "detail/{id}", method = {RequestMethod.POST}) |
|||
public Result<LingshanOfficeHallServiceRecordDTO> get(@PathVariable("id") String id) { |
|||
LingshanOfficeHallServiceRecordDTO data = lingshanOfficeHallServiceRecordService.get(id); |
|||
return new Result<LingshanOfficeHallServiceRecordDTO>().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 工作端添加 |
|||
* |
|||
* @param dto |
|||
* @return |
|||
*/ |
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@LoginUser TokenDto tokenDto, @RequestBody LingshanOfficeHallServiceRecordDTO dto) { |
|||
dto.setCustomerId(tokenDto.getCustomerId()); |
|||
dto.setSourceType("gov_pc"); |
|||
ValidatorUtils.validateEntity(dto, LingshanOfficeHallServiceRecordDTO.AddShowGroup.class, LingshanOfficeHallServiceRecordDTO.AddInternalGroup.class); |
|||
return new Result().ok(lingshanOfficeHallServiceRecordService.save(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 工作端修改 |
|||
* |
|||
* @param dto |
|||
* @return |
|||
*/ |
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@LoginUser TokenDto tokenDto, @RequestBody LingshanOfficeHallServiceRecordDTO dto) { |
|||
dto.setCustomerId(tokenDto.getCustomerId()); |
|||
dto.setSourceType("gov_pc"); |
|||
ValidatorUtils.validateEntity(dto, LingshanOfficeHallServiceRecordDTO.UpdateShowGroup.class, LingshanOfficeHallServiceRecordDTO.UpdateInternalGroup.class); |
|||
lingshanOfficeHallServiceRecordService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* 单挑删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody List<String> ids) { |
|||
if (CollectionUtils.isNotEmpty(ids)) { |
|||
lingshanOfficeHallServiceRecordService.delete(ids); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("export") |
|||
public void exportEnterprise(@LoginUser TokenDto tokenDto, @RequestBody LingshanOfficeHallServiceRecordPageFormDTO formDTO, HttpServletResponse response) throws IOException { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
ExcelWriter excelWriter = null; |
|||
formDTO.setPageNo(NumConstant.ONE); |
|||
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
|||
try { |
|||
String fileName = "办事大厅" + DateUtils.format(new Date()) + ".xlsx"; |
|||
// 头的策略
|
|||
WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
|||
// 背景设置为红色
|
|||
headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); |
|||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
|||
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); |
|||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); |
|||
FreezeAndFilter writeHandler = new FreezeAndFilter(); |
|||
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), LingshanOfficeHallServiceRecordExportExcel.class) |
|||
.registerWriteHandler(horizontalCellStyleStrategy) |
|||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|||
.registerWriteHandler(writeHandler).build(); |
|||
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
|||
PageData<LingshanOfficeHallServiceRecordDTO> data = null; |
|||
List<LingshanOfficeHallServiceRecordExportExcel> list = null; |
|||
do { |
|||
data = lingshanOfficeHallServiceRecordService.page(formDTO); |
|||
list = ConvertUtils.sourceToTarget(data.getList(), LingshanOfficeHallServiceRecordExportExcel.class); |
|||
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |
|||
excelWriter.write(list, writeSheet); |
|||
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); |
|||
} catch (EpmetException e) { |
|||
response.reset(); |
|||
response.setCharacterEncoding("UTF-8"); |
|||
response.setHeader("content-type", "application/json; charset=UTF-8"); |
|||
PrintWriter printWriter = response.getWriter(); |
|||
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); |
|||
printWriter.write(JSON.toJSONString(result)); |
|||
printWriter.close(); |
|||
} catch (Exception e) { |
|||
log.error("办事大厅列表导出异常export exception", e); |
|||
} finally { |
|||
if (excelWriter != null) { |
|||
excelWriter.finish(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.LingshanAgentServiceCategoryEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 待办服务类别 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-06 |
|||
*/ |
|||
@Mapper |
|||
public interface LingshanAgentServiceCategoryDao extends BaseDao<LingshanAgentServiceCategoryEntity> { |
|||
|
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.agentservice.LingShanScreenAgentRstDTO; |
|||
import com.epmet.entity.LingshanAgentServiceRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* 待办服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-06 |
|||
*/ |
|||
@Mapper |
|||
public interface LingshanAgentServiceRecordDao extends BaseDao<LingshanAgentServiceRecordEntity> { |
|||
|
|||
/** |
|||
* @Description: 大屏:代办员列表+服务数量统计 |
|||
* @param agentIds: |
|||
* @Return java.util.List<com.epmet.dto.result.agentservice.LingShanScreenAgentRstDTO> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/15 3:22 PM |
|||
*/ |
|||
List<LingShanScreenAgentRstDTO> screenAgentListAndServiceQty(@Param("agentIds") Set<String> agentIds); |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO; |
|||
import com.epmet.entity.LingshanOfficeHallServiceRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 灵山_办事大厅服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-15 |
|||
*/ |
|||
@Mapper |
|||
public interface LingshanOfficeHallServiceRecordDao extends BaseDao<LingshanOfficeHallServiceRecordEntity> { |
|||
|
|||
List<LingshanOfficeHallServiceRecordDTO> pageList(@Param("customerId") String customerId, |
|||
@Param("orgIdPath") String orgIdPath, |
|||
@Param("categoryCode") String categoryCode, |
|||
@Param("content") String content, |
|||
@Param("satisfication") Integer satisfication, |
|||
@Param("applicantStartDate") String applicantStartDate, |
|||
@Param("applicantEndDate") String applicantEndDate, |
|||
@Param("closeStartDate") String closeStartDate, |
|||
@Param("closeEndDate") String closeEndDate, |
|||
@Param("status") String status); |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 待办服务类别 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-06 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("lingshan_agent_service_category") |
|||
public class LingshanAgentServiceCategoryEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 租户号 |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 类别名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 图标 |
|||
*/ |
|||
private String iconUrl; |
|||
|
|||
} |
|||
@ -0,0 +1,133 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 待办服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-06 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("lingshan_agent_service_record") |
|||
public class LingshanAgentServiceRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 租户号 |
|||
*/ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 申请人ID(居民端用户ID) |
|||
*/ |
|||
private String applicantId; |
|||
|
|||
/** |
|||
* 申请人姓名 |
|||
*/ |
|||
private String applicantName; |
|||
|
|||
/** |
|||
* 代办员ID。默认使用空字符串。 |
|||
*/ |
|||
private String agentId; |
|||
|
|||
/** |
|||
* 代办员姓名 |
|||
*/ |
|||
private String agentName; |
|||
|
|||
/** |
|||
* 提交者所在网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 组织id路径,含本级,含网格id |
|||
*/ |
|||
private String orgIdPath; |
|||
|
|||
private String attachments; |
|||
|
|||
/** |
|||
* 服务类型id |
|||
*/ |
|||
private String serviceCategory; |
|||
|
|||
/** |
|||
* 预约服务时间 |
|||
*/ |
|||
private Date exceptServeTime; |
|||
|
|||
/** |
|||
* 预约服务地点 |
|||
*/ |
|||
private String exceptServeAddress; |
|||
|
|||
/** |
|||
* 受理时间。状态变为受理的时间 |
|||
*/ |
|||
private Date processTime; |
|||
private String processDesc; |
|||
|
|||
private String processAttachments; |
|||
|
|||
/** |
|||
* 联系人姓名 |
|||
*/ |
|||
private String contactName; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
private String contactMobile; |
|||
|
|||
/** |
|||
* 办理状态。0待受理,1已受理,2已驳回,3已办结,-1已撤回 |
|||
*/ |
|||
private Integer processStatus; |
|||
|
|||
/** |
|||
* 办结时间 |
|||
*/ |
|||
private Date closeTime; |
|||
|
|||
/** |
|||
* 办结说明 |
|||
*/ |
|||
private String closeDesc; |
|||
|
|||
/** |
|||
* 内容,详细说明 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 满意度评价。-1不满意,0基本满意,1非常满意 |
|||
*/ |
|||
private Integer satisfication; |
|||
|
|||
/** |
|||
* 经度 |
|||
*/ |
|||
private String longitude; |
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
private String latitude; |
|||
|
|||
private transient int qty = 0; |
|||
|
|||
} |
|||
@ -0,0 +1,118 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 灵山_办事大厅服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-15 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("lingshan_office_hall_service_record") |
|||
public class LingshanOfficeHallServiceRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 租户号 |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 工作人员录入:gov_pc;居民端小程序:resi_mp |
|||
*/ |
|||
private String sourceType; |
|||
|
|||
/** |
|||
* 事项类型 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 事项说明 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 申请人所属组织id或者网格id |
|||
*/ |
|||
private String applicantOrgId; |
|||
|
|||
/** |
|||
* agency或者grid |
|||
*/ |
|||
private String applicantOrgType; |
|||
|
|||
/** |
|||
* ORG_ID全路径 |
|||
*/ |
|||
private String applicantOrgIdPath; |
|||
|
|||
/** |
|||
* 申请人所属组织名称 |
|||
*/ |
|||
private String applicantOrgName; |
|||
|
|||
/** |
|||
* 申请人姓名 |
|||
*/ |
|||
private String applicantName; |
|||
|
|||
/** |
|||
* 申请人联系电话 |
|||
*/ |
|||
private String applicantMobile; |
|||
|
|||
/** |
|||
* 申请人身份证号 |
|||
*/ |
|||
private String applicantIdCard; |
|||
|
|||
/** |
|||
* 申请日期 |
|||
*/ |
|||
private Date applicantTime; |
|||
|
|||
/** |
|||
* 办理人姓名 |
|||
*/ |
|||
private String transactorName; |
|||
|
|||
/** |
|||
* 未办结:0;已办结:1 |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 办结日期 |
|||
*/ |
|||
private Date closeTime; |
|||
|
|||
/** |
|||
* 满意度评价。-1不满意,0基本满意,1非常满意 |
|||
*/ |
|||
private Integer satisfication; |
|||
|
|||
/** |
|||
* 本条数据所属组织id/所属网格id |
|||
*/ |
|||
private String orgId; |
|||
/** |
|||
* agency或者grid |
|||
*/ |
|||
private String orgType; |
|||
|
|||
/** |
|||
* 本条数据所属组织的org_id_path |
|||
*/ |
|||
private String orgIdPath; |
|||
|
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
package com.epmet.excel; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2023/5/15 18:24 |
|||
*/ |
|||
@Data |
|||
public class LingshanOfficeHallServiceRecordExportExcel { |
|||
|
|||
/** |
|||
* 申请人所属组织名称 |
|||
*/ |
|||
@ExcelProperty(value = "所属组织") |
|||
@ColumnWidth(30) |
|||
private String applicantOrgName; |
|||
|
|||
/** |
|||
* 类别名称 |
|||
* 举例:营业执照服务、食品许可证服务、医疗保险业务、养老保险业务 |
|||
*/ |
|||
@ExcelProperty(value = "事项类型") |
|||
@ColumnWidth(25) |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 事项说明 |
|||
*/ |
|||
@ExcelProperty(value = "事项说明") |
|||
@ColumnWidth(40) |
|||
private String content; |
|||
|
|||
/** |
|||
* 申请人姓名 |
|||
*/ |
|||
@ExcelProperty(value = "申请人") |
|||
@ColumnWidth(30) |
|||
private String applicantName; |
|||
|
|||
/** |
|||
* 申请人联系电话 |
|||
*/ |
|||
@ExcelProperty(value = "申请人联系电话") |
|||
@ColumnWidth(30) |
|||
private String applicantMobile; |
|||
|
|||
/** |
|||
* 申请人身份证号 |
|||
*/ |
|||
@ExcelProperty(value = "申请人身份证号") |
|||
@ColumnWidth(30) |
|||
private String applicantIdCard; |
|||
|
|||
@ExcelProperty(value = "申请日期") |
|||
@ColumnWidth(30) |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
private Date applicantTime; |
|||
|
|||
/** |
|||
* 办理人姓名 |
|||
*/ |
|||
@ExcelProperty(value = "办理人") |
|||
@ColumnWidth(30) |
|||
private String transactorName; |
|||
|
|||
@ExcelProperty(value = "办理状态") |
|||
@ColumnWidth(30) |
|||
private String statusName; |
|||
/** |
|||
* 办结日期 |
|||
*/ |
|||
@ExcelProperty(value = "办结日期") |
|||
@ColumnWidth(30) |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
private Date closeTime; |
|||
|
|||
/** |
|||
* 满意度评价。-1不满意,0基本满意,1非常满意 |
|||
*/ |
|||
@ExcelProperty(value = "满意度") |
|||
@ColumnWidth(25) |
|||
private String satisficationName; |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,41 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.form.lingshan.AgentServiceResiSubmitFormDTO; |
|||
import com.epmet.dto.result.agentservice.*; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
public interface LingShanAgentServiceService { |
|||
void resiSubmit(AgentServiceResiSubmitFormDTO form); |
|||
|
|||
PageData<ResiMyCreatedAgentServiceResultDTO> myCreatedList(Integer processStatus, String gridId, Integer pageNo, Integer pageSize); |
|||
|
|||
PageData<WorkServiceAgentResultDTO> workServiceList(Integer processStatus, String gridId); |
|||
|
|||
void workProcess(String id, Integer processType, String processDesc); |
|||
|
|||
void workClose(String id, String processDesc, List<String> processAttachments); |
|||
|
|||
void resiWithDraw(String id); |
|||
|
|||
void resiEvaluate(String id, Integer satisfication); |
|||
|
|||
PageData<AgentServiceList4WorkPcResultDTO> workPcServiceList(String orgId, String orgType, String serviceCategory, String content, |
|||
String agentName, Date processTimeStart, Date processTimeEnd, Integer pageNo, Integer pageSize); |
|||
|
|||
void workPcDelete(String id); |
|||
|
|||
List<LingShanAgentServiceCategoryResultDTO> listServiceCategories(); |
|||
|
|||
List<ScreenCatalogueQtyStatsRstDTO> screenCatalogueQtyStats(String orgId, String orgType); |
|||
|
|||
List<LingShanScreenAgentRstDTO> screenAgentList(String orgType, String orgId); |
|||
|
|||
List<LingShanScreenServiceRstDTO> screenServiceList(String orgType, String orgId, String dataType); |
|||
|
|||
List<ScreenAgentServiceCategoryAnalysisRstDTO> serviceCategoryAnalysis(String orgType, String orgId); |
|||
|
|||
List<AgentServiceTrendAnalysisRstDTO> serviceTrendAnalysis(String orgType, String orgId); |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO; |
|||
import com.epmet.dto.form.lingshan.LingshanOfficeHallServiceRecordPageFormDTO; |
|||
import com.epmet.entity.LingshanOfficeHallServiceRecordEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 灵山_办事大厅服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-15 |
|||
*/ |
|||
public interface LingshanOfficeHallServiceRecordService extends BaseService<LingshanOfficeHallServiceRecordEntity> { |
|||
|
|||
/** |
|||
* 办事大厅-分页列表 |
|||
* |
|||
* @param formDTO |
|||
* @return PageData<LingshanOfficeHallServiceRecordDTO> |
|||
* @author generator |
|||
* @date 2023-05-15 |
|||
*/ |
|||
PageData<LingshanOfficeHallServiceRecordDTO> page(LingshanOfficeHallServiceRecordPageFormDTO formDTO); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return LingshanOfficeHallServiceRecordDTO |
|||
* @author generator |
|||
* @date 2023-05-15 |
|||
*/ |
|||
LingshanOfficeHallServiceRecordDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-05-15 |
|||
*/ |
|||
String save(LingshanOfficeHallServiceRecordDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-05-15 |
|||
*/ |
|||
void update(LingshanOfficeHallServiceRecordDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-05-15 |
|||
*/ |
|||
void delete(List<String> ids); |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,623 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import cn.hutool.http.useragent.UserAgentInfo; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.epmet.LingShanAgentServiceProcessStatusEnum; |
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|||
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|||
import com.epmet.commons.tools.utils.PidUtils; |
|||
import com.epmet.constant.OrgInfoConstant; |
|||
import com.epmet.dao.LingshanAgentServiceCategoryDao; |
|||
import com.epmet.dao.LingshanAgentServiceRecordDao; |
|||
import com.epmet.dataaggre.dto.epmetuser.result.LingshanServiceAgentAgentList; |
|||
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; |
|||
import com.epmet.dto.IcResiUserDTO; |
|||
import com.epmet.dto.form.lingshan.AgentServiceResiSubmitFormDTO; |
|||
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|||
import com.epmet.dto.result.agentservice.*; |
|||
import com.epmet.entity.LingshanAgentServiceCategoryEntity; |
|||
import com.epmet.entity.LingshanAgentServiceRecordEntity; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.remote.EpmetUserRemoteService; |
|||
import com.epmet.service.LingShanAgentServiceService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.redisson.api.RLock; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.*; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
@Slf4j |
|||
public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
private LingshanAgentServiceCategoryDao agentServiceCategoryDao; |
|||
|
|||
@Autowired |
|||
private LingshanAgentServiceRecordDao agentServiceRecordDao; |
|||
|
|||
@Autowired |
|||
private DistributedLock distributedLock; |
|||
|
|||
@Autowired |
|||
private EpmetUserRemoteService epmetUserRemoteService; |
|||
|
|||
@Autowired |
|||
private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient userOpenFeignClient; |
|||
|
|||
public static final String AGENT_SERVICE_LOCK_PREFIX = "lingshan:agentservice:statuschange:"; |
|||
|
|||
@Override |
|||
public List<LingShanAgentServiceCategoryResultDTO> listServiceCategories() { |
|||
List<LingshanAgentServiceCategoryEntity> es = agentServiceCategoryDao.selectList(new LambdaQueryWrapper<>()); |
|||
return ConvertUtils.sourceToTarget(es, LingShanAgentServiceCategoryResultDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public void resiSubmit(AgentServiceResiSubmitFormDTO form) { |
|||
// 判断类别是否存在
|
|||
if (agentServiceCategoryDao.selectById(form.getServiceCategory()) == null) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务类别ID:" + form.getServiceCategory()); |
|||
} |
|||
|
|||
ResiUserInfoCache resiInfo = CustomerResiUserRedis.getUserBaseInfo(EpmetRequestHolder.getLoginUserId()); |
|||
|
|||
LingshanAgentServiceRecordEntity e2Insert = ConvertUtils.sourceToTarget(form, LingshanAgentServiceRecordEntity.class); |
|||
e2Insert.setAttachments(JSON.toJSONString(form.getAttachmentsList())); |
|||
e2Insert.setApplicantId(EpmetRequestHolder.getLoginUserId()); |
|||
e2Insert.setApplicantName(resiInfo.getRealName()); |
|||
e2Insert.setProcessStatus(LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT.getStatusCode()); //初始为待受理状态
|
|||
|
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(form.getGridId()); |
|||
e2Insert.setOrgIdPath(PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids())); |
|||
|
|||
agentServiceRecordDao.insert(e2Insert); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<ResiMyCreatedAgentServiceResultDTO> myCreatedList(Integer processStatus, String gridId, Integer pageNo, Integer pageSize) { |
|||
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> q = new LambdaQueryWrapper<>(); |
|||
q.eq(processStatus != null, LingshanAgentServiceRecordEntity::getProcessStatus, processStatus); |
|||
q.eq(LingshanAgentServiceRecordEntity::getGridId, gridId); |
|||
|
|||
PageHelper.startPage(pageNo, pageSize); |
|||
List<LingshanAgentServiceRecordEntity> l = agentServiceRecordDao.selectList(q); |
|||
|
|||
List<ResiMyCreatedAgentServiceResultDTO> rl = l.stream().map(e -> { |
|||
ResiMyCreatedAgentServiceResultDTO d = ConvertUtils.sourceToTarget(e, ResiMyCreatedAgentServiceResultDTO.class); |
|||
|
|||
d.setProcessStatusName(LingShanAgentServiceProcessStatusEnum.getByStatus(e.getProcessStatus()).getStatusName()); |
|||
|
|||
LingshanAgentServiceCategoryEntity sc = agentServiceCategoryDao.selectById(e.getServiceCategory()); |
|||
if (sc != null) { |
|||
d.setServiceCategoryName(sc.getCategoryName()); |
|||
} else { |
|||
log.error("【红色待办】居民-我创建的列表:未找到服务类别数据:{}", e.getServiceCategory()); |
|||
} |
|||
|
|||
// 反序列化附件列表
|
|||
d.setAttachments(JSON.parseArray(e.getAttachments(), String.class)); |
|||
|
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
return new PageData<>(rl, new PageInfo<>(l).getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<WorkServiceAgentResultDTO> workServiceList(Integer processStatus, String gridId) { |
|||
|
|||
|
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void workProcess(String id, Integer processType, String processDesc) { |
|||
LingshanAgentServiceRecordEntity service; |
|||
if ((service = agentServiceRecordDao.selectById(id)) == null) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); |
|||
} |
|||
|
|||
RLock lock = distributedLock.getLock(AGENT_SERVICE_LOCK_PREFIX + id); |
|||
try { |
|||
// 执行状态变更校验
|
|||
statusChangeCheck(service.getProcessStatus(), processType); |
|||
|
|||
LingshanAgentServiceRecordEntity e2Update = new LingshanAgentServiceRecordEntity(); |
|||
e2Update.setId(id); |
|||
// 处理,处理受理状态和描述,以及处理时间
|
|||
e2Update.setProcessStatus(processType); |
|||
e2Update.setProcessDesc(processDesc); |
|||
if (LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode() == processType.intValue()) { |
|||
// 如果是受理,则记录受理人和受理时间
|
|||
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|||
e2Update.setAgentId(loginUserDetails.getUserId()); |
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), loginUserDetails.getUserId()); |
|||
if (staffInfo != null) { |
|||
e2Update.setAgentName(staffInfo.getRealName()); |
|||
} |
|||
} |
|||
e2Update.setProcessTime(new Date()); |
|||
|
|||
agentServiceRecordDao.updateById(e2Update); |
|||
} catch (Exception e) { |
|||
log.error("【待办服务】办结:分布式锁错误:" + ExceptionUtils.getErrorStackTrace(e)); |
|||
throw e; |
|||
} finally { |
|||
// 释放锁
|
|||
if (lock.isHeldByCurrentThread()) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void workClose(String id, String processDesc, List<String> processAttachments) { |
|||
LingshanAgentServiceRecordEntity service; |
|||
if ((service = agentServiceRecordDao.selectById(id)) == null) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); |
|||
} |
|||
|
|||
RLock lock = distributedLock.getLock(AGENT_SERVICE_LOCK_PREFIX + id); |
|||
|
|||
try { |
|||
// 执行状态变更校验
|
|||
LingShanAgentServiceProcessStatusEnum closeStatusEnum = LingShanAgentServiceProcessStatusEnum.CLOSED; |
|||
statusChangeCheck(service.getProcessStatus(), closeStatusEnum.getStatusCode()); |
|||
|
|||
Date now = new Date(); |
|||
|
|||
LingshanAgentServiceRecordEntity e2Update = new LingshanAgentServiceRecordEntity(); |
|||
e2Update.setId(id); |
|||
// 办结,设置处理状态,办结描述,办结时间
|
|||
e2Update.setProcessStatus(closeStatusEnum.getStatusCode()); |
|||
e2Update.setCloseDesc(processDesc); |
|||
e2Update.setCloseTime(now); |
|||
|
|||
agentServiceRecordDao.updateById(e2Update); |
|||
} catch (Exception e) { |
|||
log.error("【待办服务】办结:分布式锁错误:" + ExceptionUtils.getErrorStackTrace(e)); |
|||
throw e; |
|||
} finally { |
|||
// 释放锁
|
|||
if (lock.isHeldByCurrentThread()) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @description: 状态变更校验 |
|||
* @param oldStatus: 旧状态 |
|||
* @param newStatus: 新状态 |
|||
* @return |
|||
* @author: WangXianZhang |
|||
* @date: 2023/5/9 1:57 PM |
|||
*/ |
|||
private void statusChangeCheck(Integer oldStatus, Integer newStatus) { |
|||
if (newStatus.intValue() == LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode() |
|||
&& oldStatus.intValue() != LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT.getStatusCode()) { |
|||
// 只有待处理状态,才能撤回
|
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, String.format("【代办服务】当前状态为'%s',不允许撤回", LingShanAgentServiceProcessStatusEnum.getByStatus(oldStatus).getStatusName())); |
|||
} |
|||
|
|||
if ((newStatus.intValue() == LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode() |
|||
|| newStatus.intValue() == LingShanAgentServiceProcessStatusEnum.REJECTED.getStatusCode()) |
|||
&& oldStatus.intValue() != LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT.getStatusCode()) { |
|||
// 如果要接受,或者拒绝,那么当前状态必须为待处理
|
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, String.format("【代办服务】当前状态为'%s',不允许操作", LingShanAgentServiceProcessStatusEnum.getByStatus(oldStatus).getStatusName())); |
|||
} |
|||
|
|||
if (newStatus.intValue() == LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode() |
|||
&& oldStatus.intValue() != LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode()) { |
|||
// 如果要关闭,那么当前状态必须为已受理
|
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, String.format("【代办服务】当前状态为'%s',不允许操作", LingShanAgentServiceProcessStatusEnum.getByStatus(oldStatus).getStatusName())); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void resiWithDraw(String id) { |
|||
LingshanAgentServiceRecordEntity service; |
|||
if ((service = agentServiceRecordDao.selectById(id)) == null) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); |
|||
} |
|||
|
|||
RLock lock = distributedLock.getLock(AGENT_SERVICE_LOCK_PREFIX + id); |
|||
|
|||
try { |
|||
// 状态检查
|
|||
statusChangeCheck(service.getProcessStatus(), LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode()); |
|||
|
|||
LingshanAgentServiceRecordEntity e2update = new LingshanAgentServiceRecordEntity(); |
|||
e2update.setId(id); |
|||
e2update.setProcessStatus(LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode()); |
|||
e2update.setProcessTime(new Date()); |
|||
agentServiceRecordDao.updateById(e2update); |
|||
} catch (Exception e) { |
|||
log.error("【待办服务】撤回:分布式锁错误:" + ExceptionUtils.getErrorStackTrace(e)); |
|||
throw e; |
|||
} finally { |
|||
// 释放锁
|
|||
if (lock.isHeldByCurrentThread()) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void resiEvaluate(String id, Integer satisfication) { |
|||
LingshanAgentServiceRecordEntity service; |
|||
if ((service = agentServiceRecordDao.selectById(id)) == null) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); |
|||
} |
|||
|
|||
if (! service.getProcessStatus().equals(LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, |
|||
"【代办服务】只有办结的服务才能进行评价,当前状态为:" + LingShanAgentServiceProcessStatusEnum.getByStatus(service.getProcessStatus()).getStatusName()); |
|||
} |
|||
|
|||
LingshanAgentServiceRecordEntity e2update = new LingshanAgentServiceRecordEntity(); |
|||
e2update.setId(id); |
|||
e2update.setSatisfication(satisfication); |
|||
agentServiceRecordDao.updateById(e2update); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<AgentServiceList4WorkPcResultDTO> workPcServiceList(String orgId, String orgType, String serviceCategory, String content, |
|||
String agentName, Date processTimeStart, Date processTimeEnd, Integer pageNo, Integer pageSize) { |
|||
|
|||
String orgIdPath; |
|||
if (StringUtils.isBlank(orgId)) { |
|||
// 没传组织id,则默认使用当前人员所属的组织
|
|||
orgIdPath = epmetUserRemoteService.getLoginUserDetails().getOrgIdPath(); |
|||
} else { |
|||
if (StringUtils.isBlank(orgType)) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, |
|||
"【代办服务】缺少组织类型参数"); |
|||
} |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
} else if (OrgInfoConstant.GRID.equals(orgType)) { |
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids()); |
|||
} else { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, |
|||
"【代办服务】未知的组织类型"); |
|||
} |
|||
} |
|||
|
|||
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> q = new LambdaQueryWrapper<>(); |
|||
q.likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath); |
|||
q.eq(StringUtils.isNotBlank(serviceCategory), LingshanAgentServiceRecordEntity::getServiceCategory, serviceCategory); |
|||
q.like(StringUtils.isNotBlank(content), LingshanAgentServiceRecordEntity::getContent, content); |
|||
q.like(StringUtils.isNotBlank(agentName), LingshanAgentServiceRecordEntity::getAgentName, agentName); |
|||
q.ge(processTimeStart != null , LingshanAgentServiceRecordEntity::getProcessTime, processTimeStart); |
|||
q.le(processTimeEnd != null , LingshanAgentServiceRecordEntity::getProcessTime, processTimeEnd); |
|||
|
|||
Page<LingshanAgentServiceRecordEntity> pd = agentServiceRecordDao.selectPage(new Page<>(pageNo, pageSize), q); |
|||
|
|||
List<AgentServiceList4WorkPcResultDTO> ds = pd.getRecords().stream().map(serviceEntity -> { |
|||
String categoryName = null; |
|||
LingshanAgentServiceCategoryEntity categoryEntity = agentServiceCategoryDao.selectById(serviceEntity.getServiceCategory()); |
|||
if (categoryEntity != null) { |
|||
categoryName = categoryEntity.getCategoryName(); |
|||
} |
|||
|
|||
AgentServiceList4WorkPcResultDTO d = new AgentServiceList4WorkPcResultDTO(); |
|||
d.setId(serviceEntity.getId()); |
|||
d.setContent(serviceEntity.getContent()); |
|||
d.setOrgNamePath(getOrgNamePath(serviceEntity.getGridId())); |
|||
d.setServiceCategory(serviceEntity.getServiceCategory()); |
|||
d.setServiceCategoryName(categoryName); |
|||
d.setApplicantName(serviceEntity.getApplicantName()); |
|||
d.setCreatedTime(serviceEntity.getCreatedTime()); |
|||
d.setAgentName(serviceEntity.getAgentName()); |
|||
d.setProcessStatus(serviceEntity.getProcessStatus()); |
|||
d.setProcessStatusDisplay(LingShanAgentServiceProcessStatusEnum.getByStatus(serviceEntity.getProcessStatus()).getStatusName()); |
|||
if (LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode() == serviceEntity.getProcessStatus().intValue() |
|||
|| LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode() == serviceEntity.getProcessStatus().intValue()) { |
|||
// 只有已受理和驳回才显示这个时间。
|
|||
d.setProcessTime(serviceEntity.getProcessTime()); |
|||
} |
|||
d.setSatisfaction(serviceEntity.getSatisfication()); |
|||
|
|||
// 反序列化附件列表
|
|||
d.setAttachments(JSON.parseArray(serviceEntity.getAttachments(), String.class)); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
return new PageData<>(ds, pd.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public void workPcDelete(String id) { |
|||
LingshanAgentServiceRecordEntity service; |
|||
if ((service = agentServiceRecordDao.selectById(id)) == null) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【代办服务】未找到指定的服务信息,ID:" + id); |
|||
} |
|||
|
|||
agentServiceRecordDao.deleteById(id); |
|||
} |
|||
|
|||
/** |
|||
* 通过gridid列表,拼接处组织名称path,例如:开发者社区-Java第一网格,开发者社区-Python第一网格 |
|||
*/ |
|||
private String getOrgNamePath(String gridId) { |
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId); |
|||
if (gridInfo == null) { |
|||
return null; |
|||
} |
|||
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(gridInfo.getPid()); |
|||
String agencyName = agencyInfo.getOrganizationName(); |
|||
return agencyName.concat("-").concat(gridInfo.getGridName()); |
|||
} |
|||
|
|||
@Override |
|||
public List<ScreenCatalogueQtyStatsRstDTO> screenCatalogueQtyStats(String orgId, String orgType) { |
|||
|
|||
ArrayList<ScreenCatalogueQtyStatsRstDTO> rl = new ArrayList<>(); |
|||
|
|||
// 代办员
|
|||
Integer c = getResultDataOrThrowsException(dataAggregatorOpenFeignClient.lingshanScreenAgentQty(orgId, orgType), |
|||
ServiceConstant.DATA_AGGREGATOR_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "查询代办员数量失败"); |
|||
|
|||
rl.add(new ScreenCatalogueQtyStatsRstDTO("agent", "代办员", c)); |
|||
|
|||
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> q = new LambdaQueryWrapper<>(); |
|||
|
|||
String orgIdPath; |
|||
|
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// 行政组织
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
} else { |
|||
// 网格
|
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids()); |
|||
} |
|||
|
|||
// 未办结事件
|
|||
q.eq(LingshanAgentServiceRecordEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); |
|||
q.likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath); |
|||
q.eq(LingshanAgentServiceRecordEntity::getProcessStatus, LingShanAgentServiceProcessStatusEnum.ACCEPTED); //已受理=未办结
|
|||
|
|||
rl.add(new ScreenCatalogueQtyStatsRstDTO("service_unclosed", "未办结事件", agentServiceRecordDao.selectCount(q))); |
|||
|
|||
// 已办结事件
|
|||
q.clear(); |
|||
q.eq(LingshanAgentServiceRecordEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); |
|||
q.likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath); |
|||
q.eq(LingshanAgentServiceRecordEntity::getProcessStatus, LingShanAgentServiceProcessStatusEnum.CLOSED); //已受理=未办结
|
|||
|
|||
rl.add(new ScreenCatalogueQtyStatsRstDTO("service_closed", "已办结事件", agentServiceRecordDao.selectCount(q))); |
|||
|
|||
return rl; |
|||
} |
|||
|
|||
@Override |
|||
public List<LingShanScreenAgentRstDTO> screenAgentList(String orgType, String orgId) { |
|||
// 此时一个工作人员可能对应两个网格,也即这个列表里面,可能有同一个agentId对应多个GridId数据,笛卡尔积
|
|||
List<LingshanServiceAgentAgentList> agentList = getResultDataOrThrowsException(dataAggregatorOpenFeignClient.screenAgentList(orgId, orgType), |
|||
ServiceConstant.DATA_AGGREGATOR_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "查询代办员列表失败"); |
|||
|
|||
Set<String> agentIds = agentList.stream().map(LingshanServiceAgentAgentList::getAgentId).collect(Collectors.toSet()); |
|||
|
|||
// 拼接一个二维map;得到每一个agentId和gridId和统计数量列表
|
|||
// <agentId:<gridId:LingShanScreenAgentRstDTO>>
|
|||
HashMap<String, Map<String, LingShanScreenAgentRstDTO>> staffsIdAndStatsDatasInGrid = new HashMap<>(); |
|||
|
|||
List<LingShanScreenAgentRstDTO> agents = agentServiceRecordDao.screenAgentListAndServiceQty(agentIds); |
|||
agents.stream().forEach(agent -> { |
|||
Map<String, LingShanScreenAgentRstDTO> gridIdAndStatsData = staffsIdAndStatsDatasInGrid.get(agent.getAgentId()); |
|||
if (gridIdAndStatsData == null) { |
|||
gridIdAndStatsData = new HashMap<>(); |
|||
staffsIdAndStatsDatasInGrid.put(agent.getAgentId(), gridIdAndStatsData); |
|||
} |
|||
|
|||
LingShanScreenAgentRstDTO statsDataInGrid = gridIdAndStatsData.get(agent.getGridId()); |
|||
if (statsDataInGrid == null) { |
|||
gridIdAndStatsData.put(agent.getGridId(), agent); |
|||
} |
|||
}); |
|||
|
|||
return agentList.stream().map(agent -> { |
|||
LingShanScreenAgentRstDTO d = new LingShanScreenAgentRstDTO(); |
|||
d.setGridId(agent.getGridId()); |
|||
d.setMobile(agent.getMobile()); |
|||
d.setAgentId(agent.getAgentId()); |
|||
d.setAgentName(agent.getAgentName()); |
|||
d.setLatitude(agent.getLatitude()); |
|||
d.setLongitude(agent.getLongitude()); |
|||
d.setClosedServiceQty(0); |
|||
d.setUnClosedServiceQty(0); |
|||
// 赋值数量
|
|||
Map<String, LingShanScreenAgentRstDTO> gridIdsAndStats = staffsIdAndStatsDatasInGrid.get(agent.getAgentId()); |
|||
if (gridIdsAndStats != null) { |
|||
LingShanScreenAgentRstDTO statsOfGrid = gridIdsAndStats.get(agent.getGridId()); |
|||
if (statsOfGrid != null) { |
|||
d.setClosedServiceQty(statsOfGrid.getClosedServiceQty()); |
|||
d.setUnClosedServiceQty(statsOfGrid.getUnClosedServiceQty()); |
|||
} |
|||
} |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
} |
|||
|
|||
@Override |
|||
public List<LingShanScreenServiceRstDTO> screenServiceList(String orgType, String orgId, String dataType) { |
|||
String orgIdPath; |
|||
|
|||
if (StringUtils.isAnyBlank(orgType, orgId)) { |
|||
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|||
orgIdPath = loginUserDetails.getOrgIdPath(); |
|||
} else { |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
} else { |
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids()); |
|||
} |
|||
} |
|||
|
|||
|
|||
Integer processStatus; |
|||
if ("service_unclosed".equals(dataType)) { |
|||
processStatus = LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode(); |
|||
} else if ("service_closed".equals(dataType)) { |
|||
processStatus = LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode(); |
|||
} else { |
|||
processStatus = -100; |
|||
} |
|||
|
|||
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> q = new LambdaQueryWrapper<>(); |
|||
q.likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath); |
|||
q.eq(LingshanAgentServiceRecordEntity::getProcessStatus, processStatus); |
|||
|
|||
List<LingshanAgentServiceRecordEntity> serviceRecords = agentServiceRecordDao.selectList(q); |
|||
return serviceRecords.stream().map(rec -> { |
|||
LingShanScreenServiceRstDTO d = new LingShanScreenServiceRstDTO(); |
|||
CustomerStaffInfoCacheResult agentInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), rec.getAgentId()); |
|||
if (agentInfo != null) { |
|||
d.setAgentMobile(agentInfo.getMobile()); |
|||
} |
|||
|
|||
// todo 此处要查什么??申请人家庭住址?申请人家庭住址是什么?
|
|||
// IcResiUserDTO resiUser = getResultDataOrReturnNull(userOpenFeignClient.getIcResiUserDTO(rec.getApplicantId()), ServiceConstant.EPMET_USER_SERVER);
|
|||
// if (resiUser == null) {
|
|||
// log.error("【灵山大屏】代办事件列表:查询申请人信息失败,申请人ID:" + rec.getApplicantId());
|
|||
// } else {
|
|||
// GridInfoCache resiUserGridInfo = CustomerOrgRedis.getGridInfo(resiUser.getGridId());
|
|||
// if (resiUserGridInfo == null) {
|
|||
// log.error("【灵山大屏】代办事件列表:查询申请人所属网格信息失败,申请人ID:" + rec.getApplicantId());
|
|||
// } else {
|
|||
// d.setApplicantHomeAddress(resiUserGridInfo.getGridName());
|
|||
// }
|
|||
// }
|
|||
|
|||
d.setContent(rec.getContent()); |
|||
d.setCreatedTime(rec.getCreatedTime()); |
|||
d.setApplicantName(rec.getApplicantName()); |
|||
d.setApplicantMobile(rec.getContactMobile()); |
|||
d.setAgentName(rec.getAgentName()); |
|||
d.setLongitude(rec.getLongitude()); |
|||
d.setLatitude(rec.getLatitude()); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
} |
|||
|
|||
@Override |
|||
public List<ScreenAgentServiceCategoryAnalysisRstDTO> serviceCategoryAnalysis(String orgType, String orgId) { |
|||
|
|||
String orgIdPath; |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
} else { |
|||
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids()); |
|||
} |
|||
|
|||
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> q = new QueryWrapper<LingshanAgentServiceRecordEntity>().select(" service_category, count(*) qty ") |
|||
.lambda() |
|||
.likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath) |
|||
.groupBy(LingshanAgentServiceRecordEntity::getServiceCategory); |
|||
|
|||
Map<String, LingshanAgentServiceRecordEntity> categoryAndData = |
|||
agentServiceRecordDao.selectList(q).stream().collect(Collectors.toMap(LingshanAgentServiceRecordEntity::getServiceCategory, Function.identity())); |
|||
|
|||
LambdaQueryWrapper<LingshanAgentServiceCategoryEntity> cq = new LambdaQueryWrapper<>(); |
|||
cq.eq(LingshanAgentServiceCategoryEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); |
|||
|
|||
List<LingshanAgentServiceCategoryEntity> cateogries = agentServiceCategoryDao.selectList(cq); |
|||
|
|||
return cateogries.stream().map(c -> { |
|||
LingshanAgentServiceRecordEntity data = categoryAndData.get(c.getId()); |
|||
return new ScreenAgentServiceCategoryAnalysisRstDTO(c.getCategoryName(), data.getQty()); |
|||
}).collect(Collectors.toList()); |
|||
} |
|||
|
|||
@Override |
|||
public List<AgentServiceTrendAnalysisRstDTO> serviceTrendAnalysis(String orgType, String orgId) { |
|||
|
|||
// 计算得到时间列表
|
|||
Map<String, Date[]> dateCatelogue = generateTimeCatelogue(); |
|||
|
|||
// 为了能使用索引,只能循环查询每个时间段的了,否则就要加一列日期,就这样吧
|
|||
return dateCatelogue.entrySet().stream().map(entry -> { |
|||
String monthName = entry.getKey(); |
|||
Date timeStart = entry.getValue()[0]; |
|||
Date timeEnd = entry.getValue()[1]; |
|||
|
|||
// 1.受理数
|
|||
// 受理数,使用processTime计算,processTime可用于表示受理时间和驳回时间。要查询受理数,要查询状态为已受理和已结案两种状态,使用processTime+processStatus结合查询
|
|||
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> rq = new LambdaQueryWrapper<>(); |
|||
rq.ge(LingshanAgentServiceRecordEntity::getProcessTime, timeStart); |
|||
rq.le(LingshanAgentServiceRecordEntity::getProcessTime, timeEnd); |
|||
rq.in(LingshanAgentServiceRecordEntity::getProcessStatus, |
|||
LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode(), LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode()); |
|||
Integer acceptCount = agentServiceRecordDao.selectCount(rq); |
|||
|
|||
// 2.办结率 todo
|
|||
|
|||
// 3.组合数据
|
|||
ArrayList<AgentServiceTrendAnalysisRstDTO.DataObj> dataList = new ArrayList<>(); |
|||
dataList.add(new AgentServiceTrendAnalysisRstDTO.DataObj("受理数", acceptCount)); |
|||
dataList.add(new AgentServiceTrendAnalysisRstDTO.DataObj("办结率", 0)); |
|||
AgentServiceTrendAnalysisRstDTO rd = new AgentServiceTrendAnalysisRstDTO(monthName, dataList); |
|||
return rd; |
|||
}).collect(Collectors.toList()); |
|||
} |
|||
|
|||
/** |
|||
* @Description: 计算时间目录 |
|||
* @param : |
|||
* @Return java.util.Map<java.lang.String,java.lang.String[]> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/16 1:53 PM |
|||
*/ |
|||
public Map<String, Date[]> generateTimeCatelogue() { |
|||
Date startDate = DateUtils.addDateMonths(new Date(), -11); |
|||
HashMap<String, Date[]> rm = new LinkedHashMap<>(); |
|||
|
|||
for (int c = 1; c <= 12; c++) { |
|||
Date monthStart = DateUtils.getMonthStart(startDate); |
|||
Date monthEnd = DateUtils.getMonthEnd(startDate); |
|||
rm.put(DateUtils.format(startDate, "MM") + "月", new Date[]{monthStart, monthEnd}); |
|||
|
|||
startDate = DateUtils.addDateMonths(startDate, 1); |
|||
} |
|||
|
|||
return rm; |
|||
} |
|||
} |
|||
@ -0,0 +1,207 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|||
import com.epmet.commons.tools.enums.DictTypeEnum; |
|||
import com.epmet.commons.tools.enums.OrgTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|||
import com.epmet.commons.tools.utils.PidUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.LingshanOfficeHallServiceRecordDao; |
|||
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO; |
|||
import com.epmet.dto.form.lingshan.LingshanOfficeHallServiceRecordPageFormDTO; |
|||
import com.epmet.entity.LingshanOfficeHallServiceRecordEntity; |
|||
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|||
import com.epmet.service.LingshanOfficeHallServiceRecordService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.collections4.MapUtils; |
|||
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.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 灵山_办事大厅服务记录 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-15 |
|||
*/ |
|||
@Service |
|||
public class LingshanOfficeHallServiceRecordServiceImpl extends BaseServiceImpl<LingshanOfficeHallServiceRecordDao, LingshanOfficeHallServiceRecordEntity> implements LingshanOfficeHallServiceRecordService { |
|||
@Autowired |
|||
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|||
|
|||
|
|||
/** |
|||
* 办事大厅-分页列表 |
|||
* |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public PageData<LingshanOfficeHallServiceRecordDTO> page(LingshanOfficeHallServiceRecordPageFormDTO formDTO) { |
|||
if (StringUtils.isBlank(formDTO.getOrgId()) && StringUtils.isBlank(formDTO.getOrgType())) { |
|||
formDTO.setOrgId(CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()).getAgencyId()); |
|||
formDTO.setOrgType(OrgTypeEnum.AGENCY.getCode()); |
|||
} |
|||
String orgIdPath = queryOrgIdPath(formDTO.getCustomerId(), formDTO.getStaffId(), formDTO.getOrgId(), formDTO.getOrgType()); |
|||
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|||
List<LingshanOfficeHallServiceRecordDTO> resultList = baseDao.pageList(formDTO.getCustomerId(), orgIdPath, |
|||
formDTO.getCategoryCode(), formDTO.getContent(), |
|||
formDTO.getSatisfication(), |
|||
formDTO.getApplicantStartDate(), formDTO.getApplicantEndDate(), |
|||
formDTO.getCloseStartDate(), formDTO.getCloseEndDate(), |
|||
formDTO.getStatus()); |
|||
if (CollectionUtils.isNotEmpty(resultList)) { |
|||
Result<Map<String, String>> categoryRes = adminOpenFeignClient.dictMap(DictTypeEnum.LINGSHAN_OFFICE_HALL_SERVICE_RECORD.getCode()); |
|||
resultList.forEach(dto -> { |
|||
dto.setCategoryName(MapUtils.isNotEmpty(categoryRes.getData()) ? categoryRes.getData().get(dto.getCategoryCode()) : StrConstant.EPMETY_STR); |
|||
}); |
|||
} |
|||
PageInfo pageInfo = new PageInfo<>(resultList); |
|||
return new PageData<>(resultList, pageInfo.getTotal(),formDTO.getPageSize()); |
|||
} |
|||
|
|||
/** |
|||
* 办事大厅-查看详情 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public LingshanOfficeHallServiceRecordDTO get(String id) { |
|||
LingshanOfficeHallServiceRecordEntity entity = baseDao.selectById(id); |
|||
if (null == entity) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"办事大厅服务记录不存在","服务记录不存在"); |
|||
} |
|||
LingshanOfficeHallServiceRecordDTO resultDto=ConvertUtils.sourceToTarget(entity, LingshanOfficeHallServiceRecordDTO.class); |
|||
Result<Map<String, String>> categoryRes = adminOpenFeignClient.dictMap(DictTypeEnum.LINGSHAN_OFFICE_HALL_SERVICE_RECORD.getCode()); |
|||
resultDto.setCategoryName(MapUtils.isNotEmpty(categoryRes.getData()) ? categoryRes.getData().get(resultDto.getCategoryCode()) : StrConstant.EPMETY_STR); |
|||
//未办结:0;已办结:1
|
|||
if(NumConstant.ZERO_STR.equals(resultDto.getStatus())){ |
|||
resultDto.setStatusName("未办结"); |
|||
}else if(NumConstant.ONE_STR.equals(resultDto.getStatus())){ |
|||
resultDto.setStatusName("已办结"); |
|||
} |
|||
if(null!=resultDto.getSatisfication()){ |
|||
// 满意度评价。-1不满意,0基本满意,1非常满意
|
|||
switch(resultDto.getSatisfication()) |
|||
{ |
|||
case -1: |
|||
resultDto.setSatisficationName("不满意"); |
|||
break; |
|||
case 0: |
|||
resultDto.setSatisficationName("基本满意"); |
|||
break; |
|||
case 1: |
|||
resultDto.setSatisficationName("非常满意"); |
|||
break; |
|||
default: |
|||
resultDto.setSatisficationName(StrConstant.EPMETY_STR); |
|||
break; |
|||
} |
|||
} |
|||
return resultDto; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public String save(LingshanOfficeHallServiceRecordDTO dto) { |
|||
LingshanOfficeHallServiceRecordEntity entity = ConvertUtils.sourceToTarget(dto, LingshanOfficeHallServiceRecordEntity.class); |
|||
entity.setStatus(NumConstant.ZERO_STR); |
|||
if (StringUtils.isNotBlank(dto.getApplicantOrgId())) { |
|||
if (OrgTypeEnum.GRID.getCode().equals(dto.getApplicantOrgType())) { |
|||
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(dto.getApplicantOrgId()); |
|||
entity.setApplicantOrgIdPath(PidUtils.convertPid2OrgIdPath(gridInfoCache.getId(), gridInfoCache.getPids())); |
|||
entity.setApplicantOrgName(gridInfoCache.getGridNamePath()); |
|||
|
|||
// 本条数据属于网格
|
|||
entity.setOrgId(gridInfoCache.getId()); |
|||
entity.setOrgType(dto.getApplicantOrgType()); |
|||
entity.setOrgIdPath(entity.getApplicantOrgIdPath()); |
|||
} else if (OrgTypeEnum.AGENCY.getCode().equals(dto.getApplicantOrgType())) { |
|||
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(dto.getApplicantOrgId()); |
|||
entity.setApplicantOrgIdPath(PidUtils.convertPid2OrgIdPath(agencyInfoCache.getId(), agencyInfoCache.getPids())); |
|||
entity.setApplicantOrgName(agencyInfoCache.getOrganizationName()); |
|||
// 本条数据属于组织
|
|||
entity.setOrgId(agencyInfoCache.getId()); |
|||
entity.setOrgType(dto.getApplicantOrgType()); |
|||
entity.setOrgIdPath(entity.getApplicantOrgIdPath()); |
|||
} |
|||
} else { |
|||
// 如果申请人所属组织没填写, 本条数据属于当前工作人员所属组织
|
|||
entity.setOrgId(CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), EpmetRequestHolder.getLoginUserId()).getAgencyId()); |
|||
entity.setOrgType(OrgTypeEnum.AGENCY.getCode()); |
|||
entity.setOrgIdPath(CustomerOrgRedis.getOrgIdPath(entity.getOrgId(), entity.getOrgType())); |
|||
} |
|||
insert(entity); |
|||
return entity.getId(); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(LingshanOfficeHallServiceRecordDTO dto) { |
|||
LingshanOfficeHallServiceRecordEntity entity = ConvertUtils.sourceToTarget(dto, LingshanOfficeHallServiceRecordEntity.class); |
|||
if (StringUtils.isNotBlank(dto.getApplicantOrgId())) { |
|||
if (OrgTypeEnum.GRID.getCode().equals(dto.getApplicantOrgType())) { |
|||
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(dto.getApplicantOrgId()); |
|||
entity.setApplicantOrgIdPath(PidUtils.convertPid2OrgIdPath(gridInfoCache.getId(), gridInfoCache.getPids())); |
|||
entity.setApplicantOrgName(gridInfoCache.getGridNamePath()); |
|||
// 本条数据属于网格
|
|||
entity.setOrgId(gridInfoCache.getId()); |
|||
entity.setOrgType(dto.getApplicantOrgType()); |
|||
entity.setOrgIdPath(entity.getApplicantOrgIdPath()); |
|||
} else if (OrgTypeEnum.AGENCY.getCode().equals(dto.getApplicantOrgType())) { |
|||
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(dto.getApplicantOrgId()); |
|||
entity.setApplicantOrgIdPath(PidUtils.convertPid2OrgIdPath(agencyInfoCache.getId(), agencyInfoCache.getPids())); |
|||
entity.setApplicantOrgName(agencyInfoCache.getOrganizationName()); |
|||
// 本条数据属于组织
|
|||
entity.setOrgId(agencyInfoCache.getId()); |
|||
entity.setOrgType(dto.getApplicantOrgType()); |
|||
entity.setOrgIdPath(entity.getApplicantOrgIdPath()); |
|||
} |
|||
} else { |
|||
// 如果申请人所属组织没填写, 本条数据属于当前工作人员所属组织
|
|||
entity.setOrgId(CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), EpmetRequestHolder.getLoginUserId()).getAgencyId()); |
|||
entity.setOrgType(OrgTypeEnum.AGENCY.getCode()); |
|||
entity.setOrgIdPath(CustomerOrgRedis.getOrgIdPath(entity.getOrgId(), entity.getOrgType())); |
|||
} |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(List<String> ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(ids); |
|||
} |
|||
|
|||
private String queryOrgIdPath(String customerId, String staffId, String orgId, String orgType) { |
|||
String orgIdPath = ""; |
|||
// 如果没传,默认查询当前工作人员所属组织
|
|||
if (StringUtils.isBlank(orgId) && StringUtils.isBlank(orgType)) { |
|||
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|||
orgId = staffInfoCacheResult.getAgencyId(); |
|||
orgType = OrgTypeEnum.AGENCY.getCode(); |
|||
} |
|||
orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType); |
|||
return orgIdPath; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
<?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.epmet.dao.LingshanAgentServiceCategoryDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.LingshanAgentServiceCategoryEntity" id="lingshanAgentServiceCategoryMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="categoryName" column="CATEGORY_NAME"/> |
|||
<result property="description" column="DESCRIPTION"/> |
|||
<result property="iconUrl" column="ICON_URL"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
|||
@ -0,0 +1,62 @@ |
|||
<?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.epmet.dao.LingshanAgentServiceRecordDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.LingshanAgentServiceRecordEntity" id="lingshanAgentServiceRecordMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="applicantId" column="APPLICANT_ID"/> |
|||
<result property="applicantName" column="APPLICANT_NAME"/> |
|||
<result property="agentId" column="AGENT_ID"/> |
|||
<result property="agentName" column="AGENT_NAME"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="orgIdPath" column="ORG_ID_PATH"/> |
|||
<result property="serviceCategory" column="SERVICE_CATEGORY"/> |
|||
<result property="exceptServeTime" column="EXCEPT_SERVE_TIME"/> |
|||
<result property="exceptServeAddress" column="EXCEPT_SERVE_ADDRESS"/> |
|||
<result property="attachments" column="ATTACHMENTS"/> |
|||
<result property="processTime" column="PROCESS_TIME"/> |
|||
<result property="processDesc" column="PROCESS_DESC"/> |
|||
<result property="processStatus" column="PROCESS_STATUS"/> |
|||
<result property="processAttachments" column="PROCESS_ATTACHMENTS"/> |
|||
<result property="closeDesc" column="CLOSE_DESC"/> |
|||
<result property="closeTime" column="CLOSE_TIME"/> |
|||
<result property="contactName" column="CONTACT_NAME"/> |
|||
<result property="contactMobile" column="CONTACT_MOBILE"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="satisfication" column="SATISFICATION"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<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="longitude" column="LONGITUDE"/> |
|||
<result property="latitude" column="LATITUDE"/> |
|||
</resultMap> |
|||
|
|||
<!--大屏:代办员列表+服务数量统计--> |
|||
<select id="screenAgentListAndServiceQty" |
|||
resultType="com.epmet.dto.result.agentservice.LingShanScreenAgentRstDTO"> |
|||
select r.AGENT_ID |
|||
, r.GRID_ID |
|||
, count(r.PROCESS_STATUS = 1 or null) as unClosedServiceQty |
|||
, count(r.PROCESS_STATUS = 3 or null) as closedServiceQty |
|||
from lingshan_agent_service_record r |
|||
<where> |
|||
<if test="agentIds != null and agentIds.size() > 0"> |
|||
r.AGENT_ID in |
|||
<foreach collection="agentIds" open="(" separator="," item="agentId" close=")" > |
|||
#{agentId} |
|||
</foreach> |
|||
</if> |
|||
and r.DEL_FLAG = 0 |
|||
and r.AGENT_ID is not null |
|||
and r.AGENT_ID != '' |
|||
</where> |
|||
group by r.AGENT_ID, r.GRID_ID |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
|||
@ -0,0 +1,48 @@ |
|||
<?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.epmet.dao.LingshanOfficeHallServiceRecordDao"> |
|||
|
|||
<select id="pageList" parameterType="map" resultType="com.epmet.dto.LingshanOfficeHallServiceRecordDTO"> |
|||
select r.*, |
|||
(case when r.STATUS='0' then '未办结' |
|||
when r.STATUS='1' then '已办结' |
|||
else '' |
|||
end)as statusName, |
|||
( |
|||
case when r.SATISFICATION='-1' then '不满意' |
|||
when r.SATISFICATION='0' then '基本满意' |
|||
when r.SATISFICATION='1' then '非常满意' |
|||
else '' |
|||
end)as satisficationName |
|||
from lingshan_office_hall_service_record r |
|||
where r.DEL_FLAG = '0' |
|||
and r.CUSTOMER_ID = #{customerId} |
|||
and r.ORG_ID_PATH like concat(#{orgIdPath},'%') |
|||
<if test="categoryCode != null and categoryCode != ''"> |
|||
and r.CATEGORY_CODE = #{categoryCode} |
|||
</if> |
|||
<if test="content != null and content != ''"> |
|||
and r.CONTENT like concat('%',#{content},'%') |
|||
</if> |
|||
<if test="satisfication != null"> |
|||
and r.SATISFICATION = #{satisfication} |
|||
</if> |
|||
<if test="status != null and status != ''"> |
|||
and r.STATUS = #{status} |
|||
</if> |
|||
<if test='applicantStartDate != null and applicantStartDate != "" '> |
|||
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m-%d') >= #{applicantStartDate} |
|||
</if> |
|||
<if test='applicantEndDate != null and applicantEndDate != "" '> |
|||
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{applicantEndDate} |
|||
</if> |
|||
<if test='closeStartDate != null and closeStartDate != "" '> |
|||
AND DATE_FORMAT(r.CLOSE_TIME,'%Y-%m-%d') >= #{closeStartDate} |
|||
</if> |
|||
<if test='closeEndDate != null and closeEndDate != "" '> |
|||
AND DATE_FORMAT(r.CLOSE_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{closeEndDate} |
|||
</if> |
|||
ORDER BY R.CREATED_TIME DESC |
|||
</select> |
|||
</mapper> |
|||
@ -0,0 +1,15 @@ |
|||
package com.epmet.dto.form.lingshan; |
|||
|
|||
import com.epmet.commons.tools.dto.form.OrgCommonFormDTO; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山大屏-安全生产-生产企业类型统计,点击饼图,中间地图显示列表 |
|||
* @Author yzm |
|||
* @Date 2023/5/15 14:59 |
|||
*/ |
|||
@Data |
|||
public class DangerousChemicalsDistributionFormDTO extends OrgCommonFormDTO { |
|||
private String typeCode; |
|||
} |
|||
|
|||
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LingShanPartyServiceCenterQtyRstDTO { |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
// private String orgId;
|
|||
|
|||
/** |
|||
* 组织类型 |
|||
*/ |
|||
private String orgType; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private Integer qty; |
|||
|
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LingShanScreenPartyObjectByTypeRstDTO { |
|||
|
|||
private String orgName; |
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
package com.epmet.dto.result.lingshan; |
|||
|
|||
/** |
|||
* @Description 灵山大屏-安全生产-生产企业类型统计 点击饼图,列表及详情返参DTO |
|||
* @Author yzm |
|||
* @Date 2023/5/15 15:00 |
|||
*/ |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DangerousChemicalsTypeStatDetailDTO { |
|||
/** |
|||
* 企业id |
|||
*/ |
|||
private String id; |
|||
/** |
|||
* 企业名称 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 企业介绍 |
|||
*/ |
|||
private String content; |
|||
private String longitude; |
|||
private String latitude; |
|||
private String addr; |
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String annt; |
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
private String phone; |
|||
// @JsonIgnore
|
|||
private String category; |
|||
|
|||
/** |
|||
* 类别名称 |
|||
*/ |
|||
private String type; |
|||
/** |
|||
* 是否重点企业 |
|||
*/ |
|||
private Boolean zd; |
|||
/** |
|||
* 包企领导 |
|||
*/ |
|||
private String leader; |
|||
/** |
|||
* 包企干部 |
|||
*/ |
|||
private String cadre; |
|||
} |
|||
|
|||
@ -0,0 +1,17 @@ |
|||
package com.epmet.dto.result.lingshan; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山大屏-安全生产-生产企业类型统计 |
|||
* @Author yzm |
|||
* @Date 2023/5/15 13:48 |
|||
*/ |
|||
@Data |
|||
public class DangerousChemicalsTypeStatResultDTO { |
|||
private String name; |
|||
private Integer value; |
|||
private String typeCode; |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,10 @@ |
|||
package com.epmet.resi.partymember.dto.partyOrg.result; |
|||
|
|||
/** |
|||
* @Description 地图中的党员数量分布 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 3:25 PM |
|||
*/ |
|||
public class LingShanPartyMemQtyStatsInOrgRstDTO { |
|||
private String name; |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.epmet.resi.partymember.dto.partyOrg.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class LingShanPartyOrgAndOtherObjQtyRstDTO { |
|||
/** |
|||
* 党建相关对象类型code |
|||
*/ |
|||
private String partyObjectTypeCode; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private Integer value; |
|||
|
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.epmet.resi.partymember.dto.partyOrg.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山街道:按照党类型查询党相关对象 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 1:16 PM |
|||
*/ |
|||
@Data |
|||
public class LingShanScreenPartyObjectByTypeRstDTO { |
|||
|
|||
private String name; |
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
private Integer partymemberQty; |
|||
|
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package com.epmet.resi.partymember.enums; |
|||
|
|||
/** |
|||
* @Description 灵山党建相关对象枚举 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 1:26 PM |
|||
*/ |
|||
public enum LingShanPartyObjEnums { |
|||
DW("dw", "党委"), |
|||
BRANCH("branch", "支部"), |
|||
PARTY_SERVICE_CENTER("party_service_center", "党群服务中心"), |
|||
PARTY_SERVICE_STATION("party_service_station", "党群服务站"), |
|||
PARTY_UNIT("party_unit", "联建单位"); |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
LingShanPartyObjEnums(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package com.epmet.modules.partyOrg.service; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanPartyOrgAndOtherObjQtyRstDTO; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface LingShanPartyOrgService { |
|||
List<LingShanPartyOrgAndOtherObjQtyRstDTO> partyOrgAndOtherObjectQtyStats(String agencyId); |
|||
|
|||
List<LingShanScreenPartyObjectByTypeRstDTO> partyObjsByType(String objType, String orgId, String orgType); |
|||
} |
|||
@ -0,0 +1,189 @@ |
|||
package com.epmet.modules.partyOrg.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.enums.OrgLevelEnum; |
|||
import com.epmet.commons.tools.enums.PartyOrgTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.PidUtils; |
|||
import com.epmet.constant.OrgInfoConstant; |
|||
import com.epmet.dto.result.LingShanPartyServiceCenterQtyRstDTO; |
|||
import com.epmet.dto.result.LingShanPartyUnitRstDTO; |
|||
import com.epmet.feign.EpmetHeartOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; |
|||
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; |
|||
import com.epmet.modules.partyOrg.service.LingShanPartyOrgService; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanPartyOrgAndOtherObjQtyRstDTO; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO; |
|||
import com.epmet.resi.partymember.enums.LingShanPartyObjEnums; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import java.util.ArrayList; |
|||
import java.util.LinkedList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class LingShanPartyOrgServiceImpl implements LingShanPartyOrgService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
private IcPartyOrgDao partyOrgDao; |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
@Autowired |
|||
private EpmetHeartOpenFeignClient heartOpenFeignClient; |
|||
|
|||
@Override |
|||
public List<LingShanPartyOrgAndOtherObjQtyRstDTO> partyOrgAndOtherObjectQtyStats(String agencyId) { |
|||
|
|||
ArrayList<LingShanPartyOrgAndOtherObjQtyRstDTO> tl = new ArrayList<>(); |
|||
|
|||
// 1.党组织
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); |
|||
String orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
|
|||
String level = agencyInfo.getLevel(); |
|||
|
|||
LambdaQueryWrapper<IcPartyOrgEntity> q; |
|||
if (OrgLevelEnum.COMMUNITY.getCode().equals(level)) { |
|||
// 社区级别,那直接用agencyId查,因为它下面就只有党支部一级了
|
|||
q = new QueryWrapper<IcPartyOrgEntity>().select(" party_org_type, count(*) childrenQty").lambda() |
|||
// 本组织下级的所有子级
|
|||
.eq(IcPartyOrgEntity::getAgencyId, agencyId) |
|||
.eq(IcPartyOrgEntity::getPartyOrgType, PartyOrgTypeEnum.BRANCH.getCode()) // 是社区,就只能查询支部了。这里要控制,因为支部的行政组织也是对应到社区,所以这里必须限制一下
|
|||
.groupBy(IcPartyOrgEntity::getPartyOrgType); |
|||
} else { |
|||
// 街道及以上级别,用pids,因为要从社区开始查,本级及下级
|
|||
q = new QueryWrapper<IcPartyOrgEntity>().select(" party_org_type, count(*) childrenQty").lambda() |
|||
// 本组织下级的所有子级,不含本级
|
|||
.like(IcPartyOrgEntity::getAgencyPids, orgIdPath) |
|||
.groupBy(IcPartyOrgEntity::getPartyOrgType); |
|||
} |
|||
|
|||
List<IcPartyOrgEntity> es = partyOrgDao.selectList(q); |
|||
List<LingShanPartyOrgAndOtherObjQtyRstDTO> l1 = es.stream().map(e -> { |
|||
LingShanPartyOrgAndOtherObjQtyRstDTO d = new LingShanPartyOrgAndOtherObjQtyRstDTO(); |
|||
d.setPartyObjectTypeCode(e.getPartyOrgType().equals("5") ? LingShanPartyObjEnums.BRANCH.getCode() : LingShanPartyObjEnums.DW.getCode()); |
|||
d.setName(PartyOrgTypeEnum.getEnumByCode(e.getPartyOrgType()).getName()); |
|||
d.setValue(e.getChildrenQty()); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
tl.addAll(l1); |
|||
|
|||
// 2.党群服务中心/站
|
|||
List<LingShanPartyServiceCenterQtyRstDTO> serviceCenters = getResultDataOrReturnNull(govOrgOpenFeignClient.partyServiceCenterQtyStats(agencyId, OrgInfoConstant.AGENCY), ServiceConstant.GOV_ORG_SERVER); |
|||
if (serviceCenters == null) { |
|||
logger.error("【灵山大屏-党组织数量统计】查询党群服务中心失败,返回空"); |
|||
} else { |
|||
List<LingShanPartyOrgAndOtherObjQtyRstDTO> temp = serviceCenters.stream().map(e -> { |
|||
LingShanPartyOrgAndOtherObjQtyRstDTO d = new LingShanPartyOrgAndOtherObjQtyRstDTO(); |
|||
d.setPartyObjectTypeCode(e.getOrgType().equals(OrgInfoConstant.AGENCY) ? LingShanPartyObjEnums.PARTY_SERVICE_CENTER.getCode() : LingShanPartyObjEnums.PARTY_SERVICE_STATION.getCode()); |
|||
d.setName(e.getOrgType().equals(OrgInfoConstant.AGENCY) ? "党群服务中心" : "党群服务站"); |
|||
d.setValue(e.getQty()); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
temp.addAll(temp); |
|||
} |
|||
|
|||
// 3.联建单位
|
|||
Integer partyUnitQty = getResultDataOrReturnNull(heartOpenFeignClient.qtyInAgency(agencyId), ServiceConstant.EPMET_HEART_SERVER); |
|||
tl.add(new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_UNIT.getCode(), "联建单位", partyUnitQty)); |
|||
|
|||
// 4.检查缺项(党委, 支部, 党群服务中心, 党群服务站, 联建单位几项都要有,没有数据则显示0。党代表工作室目前还没开发,开发了也要有)
|
|||
Map<String, LingShanPartyOrgAndOtherObjQtyRstDTO> map = tl.stream().collect(Collectors.toMap(LingShanPartyOrgAndOtherObjQtyRstDTO::getName, Function.identity())); |
|||
|
|||
LinkedList rl = new LinkedList<LingShanPartyOrgAndOtherObjQtyRstDTO>(); |
|||
LingShanPartyOrgAndOtherObjQtyRstDTO dw = map.get("党委"); |
|||
rl.add(dw != null ? dw : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.DW.getCode(), "党委", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO zb = map.get("支部"); |
|||
rl.add(zb != null ? zb : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.BRANCH.getCode(), "支部", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO dqfwzx = map.get("党群服务中心"); |
|||
rl.add(dqfwzx != null ? dqfwzx : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_SERVICE_CENTER.getCode(), "党群服务中心", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO dqfwz = map.get("党群服务站"); |
|||
rl.add(dqfwz != null ? dqfwz : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_SERVICE_STATION.getCode(), "党群服务站", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO ljdz = map.get("联建单位"); |
|||
rl.add(ljdz != null ? ljdz : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_UNIT.getCode(), "联建单位", 0)); |
|||
|
|||
return rl; |
|||
} |
|||
|
|||
@Override |
|||
public List<LingShanScreenPartyObjectByTypeRstDTO> partyObjsByType(String objType, String orgId, String orgType) { |
|||
if (LingShanPartyObjEnums.DW.getCode().equals(objType)) { |
|||
// 党委
|
|||
return listDw(orgId, orgType); |
|||
} else if (LingShanPartyObjEnums.BRANCH.getCode().equals(objType)) { |
|||
// 支部
|
|||
return listBranch(orgId, orgType); |
|||
} else if (LingShanPartyObjEnums.PARTY_SERVICE_CENTER.getCode().equals(objType) |
|||
|| LingShanPartyObjEnums.PARTY_SERVICE_STATION.getCode().equals(objType)) { |
|||
// 党群服务中心
|
|||
List<com.epmet.dto.result.LingShanScreenPartyObjectByTypeRstDTO> rsts = |
|||
getResultDataOrReturnNull(govOrgOpenFeignClient.lingshanPartyServiceCenterList(objType, orgId), ServiceConstant.GOV_ORG_SERVER); |
|||
return ConvertUtils.sourceToTarget(rsts, LingShanScreenPartyObjectByTypeRstDTO.class); |
|||
} else if (LingShanPartyObjEnums.PARTY_UNIT.getCode().equals(objType)) { |
|||
// 联建单位
|
|||
List<LingShanPartyUnitRstDTO> rsts = getResultDataOrReturnNull(heartOpenFeignClient.lingshanPartyUnitList(orgId), ServiceConstant.EPMET_HEART_SERVER); |
|||
if (rsts == null) { |
|||
logger.error("【灵山大屏-党建相关对象列表查询】出错,"); |
|||
} |
|||
return ConvertUtils.sourceToTarget(rsts, LingShanScreenPartyObjectByTypeRstDTO.class); |
|||
} else { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未知的数据类型"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @Description: 查询党委列表 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return java.util.List<com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/12 1:42 PM |
|||
*/ |
|||
List<LingShanScreenPartyObjectByTypeRstDTO> listDw(String orgId, String orgType) { |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// 是行政组织,就要查询组织的下一级。查询下一级只能用AGENCY_PIDS
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
return partyOrgDao.lingshanListDw(PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids())); |
|||
} else { |
|||
// 是网格,哪里来的党委?
|
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @Description: 查询支部。支部是直属的 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return java.util.List<com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/12 1:52 PM |
|||
*/ |
|||
List<LingShanScreenPartyObjectByTypeRstDTO> listBranch(String orgId, String orgType) { |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// 是行政组织
|
|||
// AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
|
|||
return partyOrgDao.lingshanListZsBranchs(orgId); |
|||
} else { |
|||
// 是网格
|
|||
// 这里应该是有问题。因为查询支部,只能用社区id查,不能用网格id查,party_org里面没有网格相关字段去关联
|
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue