13 changed files with 833 additions and 0 deletions
@ -0,0 +1,115 @@ |
|||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcServiceOrgDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* agencyId的所有上级,包含自己 |
||||
|
*/ |
||||
|
private String agencyIdPath; |
||||
|
|
||||
|
/** |
||||
|
* 服务类别【字典表 ic_service_type】多个值逗号分隔 |
||||
|
*/ |
||||
|
private String serviceType; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织名称 |
||||
|
*/ |
||||
|
private String orgName; |
||||
|
|
||||
|
/** |
||||
|
* 组织描述 |
||||
|
*/ |
||||
|
private String orgDescribe; |
||||
|
|
||||
|
/** |
||||
|
* 负责人姓名 |
||||
|
*/ |
||||
|
private String principalName; |
||||
|
|
||||
|
/** |
||||
|
* 负责人电话 |
||||
|
*/ |
||||
|
private String principalMobile; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,3 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
public class IcMoveInListFormDTO implements Serializable { |
@ -0,0 +1,71 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 服务组织新增/修改 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcServiceOrgAddEditFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
public interface Del extends CustomerClientShowGroup { |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 服务组织Id |
||||
|
*/ |
||||
|
@NotBlank(message = "服务组织Id不能为空", groups = {UpdateGroup.class, Del.class}) |
||||
|
private String icServiceOrgId; |
||||
|
/** |
||||
|
* 服务类型,多个值逗号分隔,字典值,字典key:ic_service_type |
||||
|
*/ |
||||
|
@NotBlank(message = "服务类型不能为空", groups = {AddGroup.class}) |
||||
|
private String serviceType; |
||||
|
/** |
||||
|
* 服务组织名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "服务组织名称不能为空", groups = {AddGroup.class}) |
||||
|
private String orgName; |
||||
|
/** |
||||
|
* 组织描述 |
||||
|
*/ |
||||
|
private String orgDescribe; |
||||
|
/** |
||||
|
* 负责人姓名 |
||||
|
*/ |
||||
|
@NotBlank(message = "负责人姓名不能为空", groups = {AddGroup.class}) |
||||
|
private String principalName; |
||||
|
/** |
||||
|
* 负责人说手机号 |
||||
|
*/ |
||||
|
@NotBlank(message = "负责人说手机号不能为空", groups = {AddGroup.class}) |
||||
|
private String principalMobile; |
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
/** |
||||
|
* 维度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
/** |
||||
|
* 服务地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
/** |
||||
|
* 备注信息 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
|
||||
|
private String customerId; |
||||
|
private String userId; |
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 【组织】服务组织列表--接口入参 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcServiceOrgListFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 9156247659994638103L; |
||||
|
|
||||
|
/** |
||||
|
* 服务类型,字典值 |
||||
|
*/ |
||||
|
private String serviceType; |
||||
|
/** |
||||
|
* 服务组织名称 |
||||
|
*/ |
||||
|
private String orgName; |
||||
|
/** |
||||
|
* 服务地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
/** |
||||
|
* 备注信息 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
/** |
||||
|
* 页码 |
||||
|
*/ |
||||
|
private Integer pageNo = 1; |
||||
|
/** |
||||
|
* 每页显示数量 |
||||
|
*/ |
||||
|
private Integer pageSize = 20; |
||||
|
|
||||
|
private Boolean isPage = true; |
||||
|
private String icServiceOrgId; |
||||
|
private String customerId; |
||||
|
private String staffId; |
||||
|
private String agencyId; |
||||
|
|
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 【组织】服务组织列表--接口返参 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcServiceOrgListResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织Id |
||||
|
*/ |
||||
|
private String icServiceOrgId; |
||||
|
/** |
||||
|
* 组织Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
/** |
||||
|
* 服务类别 |
||||
|
*/ |
||||
|
private List<ServiceType> serviceTypeList; |
||||
|
/** |
||||
|
* 服务类别,多个值逗号分隔 |
||||
|
*/ |
||||
|
private String serviceType; |
||||
|
/** |
||||
|
* 服务组织名称 |
||||
|
*/ |
||||
|
private String orgName; |
||||
|
/** |
||||
|
* 组织描述 |
||||
|
*/ |
||||
|
private String orgDescribe; |
||||
|
/** |
||||
|
* 负责人名称 |
||||
|
*/ |
||||
|
private String principalName; |
||||
|
/** |
||||
|
* 负责人电话 |
||||
|
*/ |
||||
|
private String principalMobile; |
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
|
||||
|
@Data |
||||
|
public static class ServiceType { |
||||
|
/** |
||||
|
* 服务类别值 |
||||
|
*/ |
||||
|
private String value; |
||||
|
/** |
||||
|
* 服务类别名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.IcServiceOrgDTO; |
||||
|
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; |
||||
|
import com.epmet.dto.form.IcServiceOrgListFormDTO; |
||||
|
import com.epmet.dto.result.IcServiceOrgListResultDTO; |
||||
|
import com.epmet.service.IcServiceOrgService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("icServiceOrg") |
||||
|
public class IcServiceOrgController { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcServiceOrgService icServiceOrgService; |
||||
|
|
||||
|
@RequestMapping("list") |
||||
|
public Result<PageData<IcServiceOrgListResultDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgListFormDTO formDTO){ |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
formDTO.setStaffId(tokenDto.getUserId()); |
||||
|
return new Result<PageData<IcServiceOrgListResultDTO>>().ok(icServiceOrgService.list(formDTO)); |
||||
|
} |
||||
|
|
||||
|
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
||||
|
public Result<IcServiceOrgDTO> get(@PathVariable("id") String id){ |
||||
|
IcServiceOrgDTO data = icServiceOrgService.get(id); |
||||
|
return new Result<IcServiceOrgDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("add") |
||||
|
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgAddEditFormDTO dto) { |
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
dto.setCustomerId(tokenDto.getCustomerId()); |
||||
|
dto.setUserId(tokenDto.getUserId()); |
||||
|
icServiceOrgService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("edit") |
||||
|
public Result edit(@RequestBody IcServiceOrgAddEditFormDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
icServiceOrgService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("del") |
||||
|
public Result delete(@RequestBody IcServiceOrgAddEditFormDTO formDTO){ |
||||
|
ValidatorUtils.validateEntity(formDTO, IcServiceOrgAddEditFormDTO.Del.class); |
||||
|
icServiceOrgService.delete(formDTO.getIcServiceOrgId()); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.form.IcServiceOrgListFormDTO; |
||||
|
import com.epmet.dto.result.IcServiceOrgListResultDTO; |
||||
|
import com.epmet.entity.IcServiceOrgEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IcServiceOrgDao extends BaseDao<IcServiceOrgEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 服务组织-列表查询 |
||||
|
**/ |
||||
|
List<IcServiceOrgListResultDTO> selectServiceOrgList(IcServiceOrgListFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ic_service_org") |
||||
|
public class IcServiceOrgEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* agencyId的所有上级,包含自己 |
||||
|
*/ |
||||
|
private String agencyIdPath; |
||||
|
|
||||
|
/** |
||||
|
* 服务类别【字典表 ic_service_type】多个值逗号分隔 |
||||
|
*/ |
||||
|
private String serviceType; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织名称 |
||||
|
*/ |
||||
|
private String orgName; |
||||
|
|
||||
|
/** |
||||
|
* 组织描述 |
||||
|
*/ |
||||
|
private String orgDescribe; |
||||
|
|
||||
|
/** |
||||
|
* 负责人姓名 |
||||
|
*/ |
||||
|
private String principalName; |
||||
|
|
||||
|
/** |
||||
|
* 负责人电话 |
||||
|
*/ |
||||
|
private String principalMobile; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.epmet.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcServiceOrgExcel { |
||||
|
|
||||
|
@Excel(name = "ID") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "客户Id") |
||||
|
private String customerId; |
||||
|
|
||||
|
@Excel(name = "所属组织机构Id") |
||||
|
private String agencyId; |
||||
|
|
||||
|
@Excel(name = "agencyId的所有上级,包含自己") |
||||
|
private String agencyIdPath; |
||||
|
|
||||
|
@Excel(name = "服务类别【字典表 ic_service_type】多个值逗号分隔") |
||||
|
private String serviceType; |
||||
|
|
||||
|
@Excel(name = "服务组织名称") |
||||
|
private String orgName; |
||||
|
|
||||
|
@Excel(name = "组织描述") |
||||
|
private String orgDescribe; |
||||
|
|
||||
|
@Excel(name = "负责人姓名") |
||||
|
private String principalName; |
||||
|
|
||||
|
@Excel(name = "负责人电话") |
||||
|
private String principalMobile; |
||||
|
|
||||
|
@Excel(name = "经度") |
||||
|
private String longitude; |
||||
|
|
||||
|
@Excel(name = "纬度") |
||||
|
private String latitude; |
||||
|
|
||||
|
@Excel(name = "地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Excel(name = "备注") |
||||
|
private String remarks; |
||||
|
|
||||
|
@Excel(name = "删除标识") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.IcServiceOrgDTO; |
||||
|
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; |
||||
|
import com.epmet.dto.form.IcServiceOrgListFormDTO; |
||||
|
import com.epmet.dto.result.IcServiceOrgListResultDTO; |
||||
|
import com.epmet.entity.IcServiceOrgEntity; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
public interface IcServiceOrgService extends BaseService<IcServiceOrgEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return java.util.List<IcServiceOrgDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-05-27 |
||||
|
*/ |
||||
|
PageData<IcServiceOrgListResultDTO> list(IcServiceOrgListFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return IcServiceOrgDTO |
||||
|
* @author generator |
||||
|
* @date 2022-05-27 |
||||
|
*/ |
||||
|
IcServiceOrgDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-05-27 |
||||
|
*/ |
||||
|
void save(IcServiceOrgAddEditFormDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-05-27 |
||||
|
*/ |
||||
|
void update(IcServiceOrgAddEditFormDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param icServiceOrgId |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-05-27 |
||||
|
*/ |
||||
|
void delete(String icServiceOrgId); |
||||
|
} |
@ -0,0 +1,152 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
||||
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
||||
|
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.CustomerStaffRedis; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dao.IcServiceOrgDao; |
||||
|
import com.epmet.dto.IcServiceOrgDTO; |
||||
|
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; |
||||
|
import com.epmet.dto.form.IcServiceOrgListFormDTO; |
||||
|
import com.epmet.dto.result.IcServiceOrgListResultDTO; |
||||
|
import com.epmet.entity.IcServiceOrgEntity; |
||||
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
||||
|
import com.epmet.service.IcServiceOrgService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
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 org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 服务组织表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-27 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class IcServiceOrgServiceImpl extends BaseServiceImpl<IcServiceOrgDao, IcServiceOrgEntity> implements IcServiceOrgService { |
||||
|
@Autowired |
||||
|
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public PageData<IcServiceOrgListResultDTO> list(IcServiceOrgListFormDTO formDTO) { |
||||
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
||||
|
if (null == staffInfo) { |
||||
|
throw new EpmetException("获取工作人员信息失败"); |
||||
|
} |
||||
|
//查询当前组织及下级数据
|
||||
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
||||
|
//列表/导出查询
|
||||
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); |
||||
|
List<IcServiceOrgListResultDTO> list = baseDao.selectServiceOrgList(formDTO); |
||||
|
PageInfo<IcServiceOrgListResultDTO> pageInfo = new PageInfo<>(list); |
||||
|
|
||||
|
//封装服务类别数据
|
||||
|
if (!CollectionUtils.isEmpty(list)) { |
||||
|
//服务类别字典表数据
|
||||
|
Result<Map<String, String>> statusRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.IC_SERVICE_TYPE.getCode()); |
||||
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
||||
|
List<IcServiceOrgListResultDTO.ServiceType> stList = null; |
||||
|
IcServiceOrgListResultDTO.ServiceType st = null; |
||||
|
for (IcServiceOrgListResultDTO dto : list) { |
||||
|
stList = new ArrayList<>(); |
||||
|
for (String str : dto.getServiceType().split(",")) { |
||||
|
st = new IcServiceOrgListResultDTO.ServiceType(); |
||||
|
st.setValue(str); |
||||
|
st.setName(null != statusMap.get(str) ? statusMap.get(str) : ""); |
||||
|
stList.add(st); |
||||
|
} |
||||
|
dto.setServiceTypeList(stList); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return new PageData<>(list, pageInfo.getTotal()); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<IcServiceOrgEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<IcServiceOrgEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public IcServiceOrgDTO get(String id) { |
||||
|
IcServiceOrgEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, IcServiceOrgDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(IcServiceOrgAddEditFormDTO formDTO) { |
||||
|
//1.获取当前工作人员缓存信息
|
||||
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
||||
|
if (null == staffInfo) { |
||||
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
||||
|
} |
||||
|
//2.校验同组织下服务组织名称不能重复
|
||||
|
LambdaQueryWrapper<IcServiceOrgEntity> tWrapper = new LambdaQueryWrapper<>(); |
||||
|
tWrapper.eq(IcServiceOrgEntity::getAgencyId, staffInfo.getAgencyId()); |
||||
|
tWrapper.eq(IcServiceOrgEntity::getOrgName, formDTO.getOrgName()); |
||||
|
List<IcServiceOrgEntity> entityList = baseDao.selectList(tWrapper); |
||||
|
if (!CollectionUtils.isEmpty(entityList)) { |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的服务组织"); |
||||
|
} |
||||
|
//3.新增服务组织数据
|
||||
|
IcServiceOrgEntity entity = ConvertUtils.sourceToTarget(formDTO, IcServiceOrgEntity.class); |
||||
|
entity.setAgencyId(staffInfo.getAgencyId()); |
||||
|
entity.setAgencyIdPath(staffInfo.getAgencyPIds()); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(IcServiceOrgAddEditFormDTO formDTO) { |
||||
|
//1.获取当前工作人员缓存信息
|
||||
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
||||
|
if (null == staffInfo) { |
||||
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
||||
|
} |
||||
|
//2.校验同组织下服务组织名称不能重复
|
||||
|
LambdaQueryWrapper<IcServiceOrgEntity> tWrapper = new LambdaQueryWrapper<>(); |
||||
|
tWrapper.eq(IcServiceOrgEntity::getAgencyId, staffInfo.getAgencyId()); |
||||
|
tWrapper.ne(IcServiceOrgEntity::getId, formDTO.getIcServiceOrgId()); |
||||
|
tWrapper.eq(IcServiceOrgEntity::getOrgName, formDTO.getOrgName()); |
||||
|
List<IcServiceOrgEntity> entityList = baseDao.selectList(tWrapper); |
||||
|
if (!CollectionUtils.isEmpty(entityList)) { |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的服务组织"); |
||||
|
} |
||||
|
//3.更新服务组织数据
|
||||
|
IcServiceOrgEntity entity = ConvertUtils.sourceToTarget(formDTO, IcServiceOrgEntity.class); |
||||
|
entity.setId(formDTO.getIcServiceOrgId()); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String icServiceOrgId) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteById(icServiceOrgId); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
<?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.IcServiceOrgDao"> |
||||
|
|
||||
|
<select id="selectServiceOrgList" resultType="com.epmet.dto.result.IcServiceOrgListResultDTO"> |
||||
|
SELECT |
||||
|
id icServiceOrgId, |
||||
|
agency_id agencyId, |
||||
|
service_type serviceType, |
||||
|
org_name orgName, |
||||
|
org_describe orgDescribe, |
||||
|
principal_name principalName, |
||||
|
principal_mobile principalMobile, |
||||
|
longitude longitude, |
||||
|
latitude latitude, |
||||
|
address address, |
||||
|
remarks remarks |
||||
|
FROM |
||||
|
ic_service_org |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
<if test="icServiceOrgId != null and icServiceOrgId != '' "> |
||||
|
AND id = #{icServiceOrgId} |
||||
|
</if> |
||||
|
<if test="customerId != null and customerId != '' "> |
||||
|
AND customer_id = #{customerId} |
||||
|
</if> |
||||
|
<if test="agencyId != null and agencyId != '' "> |
||||
|
AND pids LIKE CONCAT('%',#{agencyId},'%') |
||||
|
</if> |
||||
|
<if test="orgName != null and orgName != '' "> |
||||
|
AND org_name LIKE CONCAT('%', #{orgName}, '%') |
||||
|
</if> |
||||
|
<if test="address != null and address != '' "> |
||||
|
AND address LIKE CONCAT('%', #{address}, '%') |
||||
|
</if> |
||||
|
<if test="remarks != null and remarks != '' "> |
||||
|
AND remarks LIKE CONCAT('%', #{remarks}, '%') |
||||
|
</if> |
||||
|
ORDER BY created_time DESC |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue