Commit 025f1c3c by 刘鑫

Merge remote-tracking branch 'origin/develop' into develop

2 parents 1132e3da 76567c40
Showing with 804 additions and 633 deletions
...@@ -84,45 +84,44 @@ public class BatchServiceImpl implements BatchService { ...@@ -84,45 +84,44 @@ public class BatchServiceImpl implements BatchService {
batchDay = optional.get().getBatchDate(); batchDay = optional.get().getBatchDate();
} }
// FIXME 因为系统暂时没有订单,每次固定拉取2023-08-13号订单数据生成新订单 // LocalDate localDt = LocalDate.parse(batchDay, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate localDt = LocalDate.parse(batchDay, DateTimeFormatter.ofPattern("yyyy-MM-dd")); // List<OrderInfo> orders = orderInfoRepository.findByOrgGroupIdAndDt(groupId, localDt);
List<OrderInfo> orders = orderInfoRepository.findByOrgGroupIdAndDt(groupId, localDt); // if (CollectionUtils.isEmpty(orders)) {
if (CollectionUtils.isEmpty(orders)) { // String tempDay = "2023-08-13";
String tempDay = "2023-08-13"; // String createOrder = "INSERT INTO order_info (\r\n" + " order_id,\r\n" + " dt,\r\n" + " sub_id,\r\n"
String createOrder = "INSERT INTO order_info (\r\n" + " order_id,\r\n" + " dt,\r\n" + " sub_id,\r\n" // + " NAME,\r\n" + " phone,\r\n" + " province,\r\n" + " city,\r\n" + " county,\r\n"
+ " NAME,\r\n" + " phone,\r\n" + " province,\r\n" + " city,\r\n" + " county,\r\n" // + " address,\r\n" + " X,\r\n" + " Y,\r\n" + " bean_brand,\r\n" + " brand,\r\n" + " TYPE,\r\n"
+ " address,\r\n" + " X,\r\n" + " Y,\r\n" + " bean_brand,\r\n" + " brand,\r\n" + " TYPE,\r\n" // + " skill,\r\n" + " take_time,\r\n" + " is_workshop,\r\n" + " fault_describe,\r\n"
+ " skill,\r\n" + " take_time,\r\n" + " is_workshop,\r\n" + " fault_describe,\r\n" // + " apply_note,\r\n" + " expect_time_begin,\r\n" + " expect_time_end,\r\n"
+ " apply_note,\r\n" + " expect_time_begin,\r\n" + " expect_time_end,\r\n" // + " expect_time_desc,\r\n" + " source,\r\n" + " bean_priority,\r\n" + " bean_tags,\r\n"
+ " expect_time_desc,\r\n" + " source,\r\n" + " bean_priority,\r\n" + " bean_tags,\r\n" // + " bean_status,\r\n" + " bean_sub_status,\r\n" + " area_id,\r\n" + " org_cluster_id,\r\n"
+ " bean_status,\r\n" + " bean_sub_status,\r\n" + " area_id,\r\n" + " org_cluster_id,\r\n" // + " org_branch_id,\r\n" + " org_group_id,\r\n" + " org_team_id,\r\n" + " priority,\r\n"
+ " org_branch_id,\r\n" + " org_group_id,\r\n" + " org_team_id,\r\n" + " priority,\r\n" // + " tags,\r\n" + " appointment_method,\r\n" + " appointment_status,\r\n" + " dispatcher,\r\n"
+ " tags,\r\n" + " appointment_method,\r\n" + " appointment_status,\r\n" + " dispatcher,\r\n" // + " order_status,\r\n" + " service_status,\r\n" + " engineer_code,\r\n" + " engineer_name,\r\n"
+ " order_status,\r\n" + " service_status,\r\n" + " engineer_code,\r\n" + " engineer_name,\r\n" // + " engineer_phone,\r\n" + " engineer_code_sub,\r\n" + " plan_start_time,\r\n"
+ " engineer_phone,\r\n" + " engineer_code_sub,\r\n" + " plan_start_time,\r\n" // + " plan_end_time,\r\n" + " arrive_elapsed,\r\n" + " arrive_distance,\r\n"
+ " plan_end_time,\r\n" + " arrive_elapsed,\r\n" + " arrive_distance,\r\n" // + " actual_start_time,\r\n" + " actual_end_time,\r\n" + " description,\r\n" + " extra_info,\r\n"
+ " actual_start_time,\r\n" + " actual_end_time,\r\n" + " description,\r\n" + " extra_info,\r\n" // + " create_time,\r\n" + " update_time\r\n" + ") \r\n" + "SELECT \r\n" + " CONCAT(order_id,'" + batchDay + "') order_id,\r\n" + " '"
+ " create_time,\r\n" + " update_time\r\n" + ") \r\n" + "SELECT \r\n" + " CONCAT(order_id,'" + batchDay + "') order_id,\r\n" + " '" // + batchDay + "',\r\n" + " sub_id,\r\n" + " NAME,\r\n" + " phone,\r\n" + " province,\r\n"
+ batchDay + "',\r\n" + " sub_id,\r\n" + " NAME,\r\n" + " phone,\r\n" + " province,\r\n" // + " city,\r\n" + " county,\r\n" + " address,\r\n" + " X,\r\n" + " Y,\r\n" + " bean_brand,\r\n"
+ " city,\r\n" + " county,\r\n" + " address,\r\n" + " X,\r\n" + " Y,\r\n" + " bean_brand,\r\n" // + " brand,\r\n" + " TYPE,\r\n" + " skill,\r\n" + " take_time,\r\n" + " is_workshop,\r\n"
+ " brand,\r\n" + " TYPE,\r\n" + " skill,\r\n" + " take_time,\r\n" + " is_workshop,\r\n" // + " fault_describe,\r\n" + " apply_note,\r\n" + " '" + batchDay + " 08:00:00' expect_time_begin,\r\n"
+ " fault_describe,\r\n" + " apply_note,\r\n" + " expect_time_begin,\r\n" // + " '" + batchDay + " 18:00:00' expect_time_end,\r\n" + " expect_time_desc,\r\n" + " source,\r\n" + " bean_priority,\r\n"
+ " expect_time_end,\r\n" + " expect_time_desc,\r\n" + " source,\r\n" + " bean_priority,\r\n" // + " bean_tags,\r\n" + " bean_status,\r\n" + " bean_sub_status,\r\n" + " area_id,\r\n"
+ " bean_tags,\r\n" + " bean_status,\r\n" + " bean_sub_status,\r\n" + " area_id,\r\n" // + " org_cluster_id,\r\n" + " org_branch_id,\r\n" + " org_group_id,\r\n" + " org_team_id,\r\n"
+ " org_cluster_id,\r\n" + " org_branch_id,\r\n" + " org_group_id,\r\n" + " org_team_id,\r\n" // + " priority,\r\n" + " tags,\r\n" + " appointment_method,\r\n" + " appointment_status,\r\n"
+ " priority,\r\n" + " tags,\r\n" + " appointment_method,\r\n" + " appointment_status,\r\n" // + " dispatcher,\r\n" + " order_status,\r\n" + " service_status,\r\n" + " null engineer_code,\r\n"
+ " dispatcher,\r\n" + " order_status,\r\n" + " service_status,\r\n" + " engineer_code,\r\n" // + " null engineer_name,\r\n" + " null engineer_phone,\r\n" + " null engineer_code_sub,\r\n"
+ " engineer_name,\r\n" + " engineer_phone,\r\n" + " engineer_code_sub,\r\n" // + " null plan_start_time,\r\n" + " null plan_end_time,\r\n" + " arrive_elapsed,\r\n"
+ " plan_start_time,\r\n" + " plan_end_time,\r\n" + " arrive_elapsed,\r\n" // + " arrive_distance,\r\n" + " actual_start_time,\r\n" + " actual_end_time,\r\n"
+ " arrive_distance,\r\n" + " actual_start_time,\r\n" + " actual_end_time,\r\n" // + " description,\r\n" + " extra_info,\r\n" + " create_time,\r\n" + " update_time \r\n"
+ " description,\r\n" + " extra_info,\r\n" + " create_time,\r\n" + " update_time \r\n" // + "FROM\r\n" + " order_info a \r\n" + "WHERE a.org_group_id = 'gsuzhou' \r\n" + " AND a.dt = '"
+ "FROM\r\n" + " order_info a \r\n" + "WHERE a.org_group_id = 'gsuzhou' \r\n" + " AND a.dt = '" // + tempDay + "' \r\n" + " AND bean_status = 'OPEN' \r\n"
+ tempDay + "' \r\n" + " AND bean_status = 'OPEN' \r\n" // + " AND appointment_method LIKE 'AUTO%' \r\n"
+ " AND appointment_method LIKE 'AUTO%' \r\n" // + " AND a.appointment_status IN ('INIT', 'PRE') \r\n" + " AND order_status = 'NORMAL' \r\n"
+ " AND a.appointment_status IN ('INIT', 'PRE') \r\n" + " AND order_status = 'NORMAL' \r\n" // + " AND service_status = 'INIT' \r\n" + "";
+ " AND service_status = 'INIT' \r\n" + ""; // int createCount = jdbcTemplate.update(createOrder);
int createCount = jdbcTemplate.update(createOrder); // }
}
log.info("清理原批次数据, groupId:{}, day:{}, batchNo:{}", groupId, batchDay, batchNo); log.info("清理原批次数据, groupId:{}, day:{}, batchNo:{}", groupId, batchDay, batchNo);
jdbcTemplate.update("delete from dispatch_engineer where group_id=? and batch_no=?", groupId, batchNo); jdbcTemplate.update("delete from dispatch_engineer where group_id=? and batch_no=?", groupId, batchNo);
......
...@@ -3,9 +3,7 @@ package com.dituhui.pea.order.controller; ...@@ -3,9 +3,7 @@ package com.dituhui.pea.order.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.dituhui.pea.common.PageResult; import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dto.MsgDTO; import com.dituhui.pea.order.dto.*;
import com.dituhui.pea.order.dto.MsgGroupResp;
import com.dituhui.pea.order.dto.MsgResp;
import com.dituhui.pea.order.service.MsgService; import com.dituhui.pea.order.service.MsgService;
import com.dituhui.pea.order.utils.AssertUtil; import com.dituhui.pea.order.utils.AssertUtil;
import com.dituhui.pea.order.utils.CommonUtil; import com.dituhui.pea.order.utils.CommonUtil;
...@@ -39,7 +37,7 @@ public class MsgController { ...@@ -39,7 +37,7 @@ public class MsgController {
*/ */
@GetMapping("/msg/list") @GetMapping("/msg/list")
public Result<PageResult<MsgGroupResp>> list(@RequestHeader(name = "userId", required = true) String userId, public Result<PageResult<MsgGroupResp>> list(@RequestHeader(name = "userId", required = true) String userId,
MsgDTO.Request request) { MsgQuery request) {
CommonUtil.setNullValue(request); CommonUtil.setNullValue(request);
request.setUserId(userId); request.setUserId(userId);
if (!"is_read".equalsIgnoreCase(request.getSort())) { if (!"is_read".equalsIgnoreCase(request.getSort())) {
...@@ -65,8 +63,9 @@ public class MsgController { ...@@ -65,8 +63,9 @@ public class MsgController {
* @date 2023/10/24 * @date 2023/10/24
*/ */
@PostMapping("/msg/delete") @PostMapping("/msg/delete")
public Result<Boolean> delete(@RequestHeader(name = "userId", required = true) String userId, @RequestBody @Valid MsgDTO.DeleteDto dto) { public Result<Boolean> delete(@RequestHeader(name = "userId", required = true) String userId, @RequestBody @Valid IdDTO dto) {
AssertUtil.isNotEmpty(userId, "用户ID不能为空"); AssertUtil.isNotEmpty(userId, "用户ID不能为空");
AssertUtil.isNotNull(dto.getId(), "消息ID不能为空");
msgService.delete(dto.getId(), userId); msgService.delete(dto.getId(), userId);
return Result.success(true); return Result.success(true);
} }
...@@ -81,7 +80,7 @@ public class MsgController { ...@@ -81,7 +80,7 @@ public class MsgController {
* @date 2023/10/24 * @date 2023/10/24
*/ */
@PostMapping("/msg/read") @PostMapping("/msg/read")
public Result<Boolean> read(@RequestHeader(name = "userId", required = true) String userId, @RequestBody @Valid MsgDTO.ReadDto dto) { public Result<Boolean> read(@RequestHeader(name = "userId", required = true) String userId, @RequestBody @Valid IdsDTO dto) {
AssertUtil.isNotEmpty(userId, "用户ID不能为空"); AssertUtil.isNotEmpty(userId, "用户ID不能为空");
msgService.readMsg(dto.getIds(), userId); msgService.readMsg(dto.getIds(), userId);
return Result.success(true); return Result.success(true);
...@@ -96,7 +95,7 @@ public class MsgController { ...@@ -96,7 +95,7 @@ public class MsgController {
* @date 2023/10/25 * @date 2023/10/25
*/ */
@PostMapping("/msg/add") @PostMapping("/msg/add")
public Result<Boolean> add(@RequestBody @Valid MsgDTO.addDto dto) { public Result<Boolean> add(@RequestBody @Valid MsgDTO dto) {
CommonUtil.setNullValue(dto); CommonUtil.setNullValue(dto);
AssertUtil.checkArgument(StrUtil.isNotEmpty(dto.getClusterId()) AssertUtil.checkArgument(StrUtil.isNotEmpty(dto.getClusterId())
|| StrUtil.isNotEmpty(dto.getBranchId()) || StrUtil.isNotEmpty(dto.getBranchId())
......
package com.dituhui.pea.order.dao; package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.dto.MsgDTO;
import com.dituhui.pea.order.dto.MsgGroupResp; import com.dituhui.pea.order.dto.MsgGroupResp;
import com.dituhui.pea.order.dto.MsgResp; import com.dituhui.pea.order.dto.MsgQuery;
import com.dituhui.pea.order.entity.MsgEntity; import com.dituhui.pea.order.entity.MsgEntity;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
...@@ -23,6 +21,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -23,6 +21,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" where IF(:#{#req.startDate} is not null, tt.create_time>=:#{#req.startDate}, 1=1)" + " where IF(:#{#req.startDate} is not null, tt.create_time>=:#{#req.startDate}, 1=1)" +
" and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)" + " and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)" +
" and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)" + " and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)" +
" and IF(:#{#req.orgTreeValue} is not null, (tt.cluster_id=:#{#req.orgTreeValue} or tt.branch_id=:#{#req.orgTreeValue} or tt.group_id=:#{#req.orgTreeValue}), 1=1)" +
"group by tt.cluster_id,tt.branch_id,tt.group_id" + "group by tt.cluster_id,tt.branch_id,tt.group_id" +
") t", ") t",
countQuery = "select count(t.cluster_id)" + countQuery = "select count(t.cluster_id)" +
...@@ -32,11 +31,12 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -32,11 +31,12 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" where IF(:#{#req.startDate} is not null, tt.create_time>=:#{#req.startDate}, 1=1)" + " where IF(:#{#req.startDate} is not null, tt.create_time>=:#{#req.startDate}, 1=1)" +
" and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)" + " and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)" +
" and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)" + " and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)" +
" and IF(:#{#req.orgTreeValue} is not null, (tt.cluster_id=:#{#req.orgTreeValue} or tt.branch_id=:#{#req.orgTreeValue} or tt.group_id=:#{#req.orgTreeValue}), 1=1)" +
"group by tt.cluster_id,tt.branch_id,tt.group_id" + "group by tt.cluster_id,tt.branch_id,tt.group_id" +
") t" ") t"
, nativeQuery = true // 开启原生sql , nativeQuery = true // 开启原生sql
) )
Page<Map<String, Objects>> getGroupList(@Param("req") MsgDTO.Request req, Pageable pageable); Page<Map<String, Objects>> getGroupList(@Param("req") MsgQuery req, Pageable pageable);
@Query(value = "select t.* from (select tt.*,r.is_read," + @Query(value = "select t.* from (select tt.*,r.is_read," +
...@@ -51,7 +51,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -51,7 +51,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
") t" ") t"
, nativeQuery = true // 开启原生sql , nativeQuery = true // 开启原生sql
) )
List<Map<String, Objects>> getList(@Param("req") MsgDTO.Request req List<Map<String, Objects>> getList(@Param("req") MsgQuery req
, @Param("msgGroupResp") MsgGroupResp msgGroupResp, Pageable pageable); , @Param("msgGroupResp") MsgGroupResp msgGroupResp, Pageable pageable);
/** /**
......
...@@ -26,6 +26,10 @@ public class BusinessTeamAddDTO { ...@@ -26,6 +26,10 @@ public class BusinessTeamAddDTO {
* 开放工作日 * 开放工作日
*/ */
private List<String> workdays; private List<String> workdays;
private String workOn;
private String workOff;
} }
......
...@@ -33,5 +33,9 @@ public class BusinessTeamUpdateDTO { ...@@ -33,5 +33,9 @@ public class BusinessTeamUpdateDTO {
* 开放工作日 * 开放工作日
*/ */
private List<String> workdays; private List<String> workdays;
private String workOn;
private String workOff;
} }
} }
...@@ -26,5 +26,10 @@ public class EngineerInfoListResp { ...@@ -26,5 +26,10 @@ public class EngineerInfoListResp {
private List<String> tags; private List<String> tags;
private List<String> credentials; private List<String> credentials;
private String grade; private String grade;
/**
* 工作地址
*/
private String workAddress;
} }
} }
package com.dituhui.pea.order.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 公共 id类
*
* @author RenPing
* @date 2023/10/26
*/
@Data
public class IdDTO {
@NotNull(message = "ID不能为空")
private Integer id;
}
package com.dituhui.pea.order.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* 公共 id集合类,用于批量操作
*
* @author RenPing
* @date 2023/10/26
*/
@Data
public class IdsDTO {
@NotEmpty(message = "Id集合不能为空")
private List<Integer> ids;
}
package com.dituhui.pea.order.dto; package com.dituhui.pea.order.dto;
import com.dituhui.pea.pojo.PageRequest; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max; import javax.validation.constraints.Max;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.LocalDate; @Data
import java.util.Date;
import java.util.List;
import static com.dituhui.pea.order.config.OrderConfig.DEFAULT_PAGE_SIZE;
public class MsgDTO { public class MsgDTO {
/**
@lombok.Data * 大区ID(大区Id、分部Id、分组Id只需传一个)
public static class Request { */
/** private String clusterId;
* 每页大小
*/ /**
private Integer size = DEFAULT_PAGE_SIZE; * 分部ID
*/
/** private String branchId;
* 页码
*/ /**
private Integer page = 1; * 小组ID
*/
private String groupId;
/**
* 当前用户Id,前端将userId放在header中 /**
*/ * 消息类型,0:派工类,1:服务类,2:容量类
private String userId; */
@NotNull(message = "消息类型不能为空")
/** @Min(value = 0, message = "消息类型格式不对")
* 排序字段:create_time、is_read @Max(value = 2, message = "消息类型格式不对")
*/ private Integer type;
private String sort;
/**
/** * 消息内容
* 排序类型:asc、desc */
*/ @NotNull(message = "消息内容不能为空")
private String sortType; private String content;
/** /**
* 开始日期 * 单号集合,以“、”连接
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd") private String orderIds;
private Date startDate;
/**
/** * 标签类型,0:紧急,1:正常
* 结束日期 */
*/ @NotNull(message = "标签类型不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd") @Min(value = 0, message = "标签类型格式不对")
private Date endDate; @Max(value = 1, message = "标签类型格式不对")
private Integer tag;
/**
* 关键词模糊查询
*/
private String keyWord;
}
@lombok.Data
public static class DeleteDto {
@NotNull(message = "消息ID不能为空")
private Integer id;
}
@lombok.Data
public static class ReadDto {
/**
* 消息Id集合
*/
@NotEmpty(message = "消息Id集合不能为空")
private List<Integer> ids;
}
@lombok.Data
public static class addDto {
/**
* 大区ID(大区Id、分部Id、分组Id只需传一个)
*/
private String clusterId;
/**
* 分部ID
*/
private String branchId;
/**
* 小组ID
*/
private String groupId;
/**
* 消息类型,0:派工类,1:服务类,2:容量类
*/
@NotNull(message = "消息类型不能为空")
@Min(value = 0, message = "消息类型格式不对")
@Max(value = 2, message = "消息类型格式不对")
private Integer type;
/**
* 消息内容
*/
@NotNull(message = "消息内容不能为空")
private String content;
/**
* 单号集合,以“、”连接
*/
private String orderIds;
/**
* 标签类型,0:紧急,1:正常
*/
@NotNull(message = "标签类型不能为空")
@Min(value = 0, message = "标签类型格式不对")
@Max(value = 1, message = "标签类型格式不对")
private Integer tag;
}
} }
\ No newline at end of file
package com.dituhui.pea.order.dto;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;
import static com.dituhui.pea.order.config.OrderConfig.DEFAULT_PAGE_SIZE;
@lombok.Data
public class MsgQuery {
/**
* 每页大小
*/
private Integer size = DEFAULT_PAGE_SIZE;
/**
* 页码
*/
private Integer page = 1;
/**
* 当前用户Id,前端将userId放在header中
*/
private String userId;
/**
* 排序字段:create_time、is_read
*/
private String sort;
/**
* 排序类型:asc、desc
*/
private String sortType;
/**
* 开始日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startDate;
/**
* 结束日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endDate;
/**
* 关键词模糊查询
*/
private String keyWord;
/**
* 大区ID、部门ID、小组ID
*/
private String orgTreeValue;
}
\ No newline at end of file
...@@ -58,8 +58,11 @@ public class EngineerBusinessEntity implements Serializable { ...@@ -58,8 +58,11 @@ public class EngineerBusinessEntity implements Serializable {
@Column(name = "priority", nullable = false, columnDefinition = "tinyint(4) default '1'") @Column(name = "priority", nullable = false, columnDefinition = "tinyint(4) default '1'")
private int priority; private int priority;
@Column(name = "departure", nullable = false, columnDefinition = "tinyint(4) default '0'") /**
private int departure; * 常规出发地,1配件仓,2家庭住址,3工作地址 默认工作地址
*/
@Column(name = "departure", nullable = false, columnDefinition = "tinyint(4) default '3'")
private int departure = 3;
@Column(name = "dispatch_strategy", nullable = false, length = 32, columnDefinition = "varchar(32) default 'CENTER'") @Column(name = "dispatch_strategy", nullable = false, length = 32, columnDefinition = "varchar(32) default 'CENTER'")
private String dispatchStrategy; private String dispatchStrategy;
......
...@@ -58,6 +58,11 @@ public class EngineerInfoEntity { ...@@ -58,6 +58,11 @@ public class EngineerInfoEntity {
private String address; private String address;
/** /**
* 工作地址
*/
private String workAddress;
/**
* 类型(1全职 2兼职) * 类型(1全职 2兼职)
*/ */
private Integer kind; private Integer kind;
......
...@@ -31,7 +31,7 @@ public class OrgClusterEntity { ...@@ -31,7 +31,7 @@ public class OrgClusterEntity {
private String cityName; private String cityName;
private Integer status; private Integer status = 1;
private String updateUser; private String updateUser;
......
...@@ -88,5 +88,37 @@ public class OrgGroupEntity { ...@@ -88,5 +88,37 @@ public class OrgGroupEntity {
*/ */
private LocalDateTime updateTime = LocalDateTime.now(); private LocalDateTime updateTime = LocalDateTime.now();
public OrgGroupEntity() {} public OrgGroupEntity() {
}
/**
* 管理城市列表
*/
private String citycodeList;
/**
* 部门缩写
*/
private String abbreviation;
/**
* 部门编号
*/
private String code;
/**
* 部门负责人联系方式
*/
private String phone;
/**
* 是否启用外围仓 0未启用 1启用
*/
private Integer warehouseEnabled = 0;
/**
* 最长配件保留时长(天)
*/
private Integer reserveTimeMax = 0;
/**
* 帐号状态(0无效 1有效)
*/
private Integer status = 1;
} }
...@@ -49,9 +49,15 @@ public class OrgTeamEntity { ...@@ -49,9 +49,15 @@ public class OrgTeamEntity {
@Column(name = "update_time", nullable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp") @Column(name = "update_time", nullable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/**
* 工作起始时间
*/
@Column(name = "work_on", nullable = false, columnDefinition = "varchar(5) default '08:00'") @Column(name = "work_on", nullable = false, columnDefinition = "varchar(5) default '08:00'")
private String workOn = "08:00"; private String workOn = "08:00";
/**
* 工作截止时间
*/
@Column(name = "work_off", nullable = false, columnDefinition = "varchar(5) default '18:00'") @Column(name = "work_off", nullable = false, columnDefinition = "varchar(5) default '18:00'")
private String workOff = "18:00"; private String workOff = "18:00";
......
...@@ -22,7 +22,7 @@ public class ServiceOrg { ...@@ -22,7 +22,7 @@ public class ServiceOrg {
/** /**
* 状态;1正常、0注销 * 状态;1正常、0注销
*/ */
private int status; private Integer status;
/** /**
* 服务商类型 * 服务商类型
*/ */
......
...@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service; ...@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service;
import com.dituhui.pea.common.PageResult; import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.order.dto.MsgDTO; import com.dituhui.pea.order.dto.MsgDTO;
import com.dituhui.pea.order.dto.MsgGroupResp; import com.dituhui.pea.order.dto.MsgGroupResp;
import com.dituhui.pea.order.dto.MsgQuery;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -17,7 +18,7 @@ public interface MsgService { ...@@ -17,7 +18,7 @@ public interface MsgService {
* @author RenPing * @author RenPing
* @date 2023/10/23 * @date 2023/10/23
*/ */
PageResult<MsgGroupResp> list(MsgDTO.Request request); PageResult<MsgGroupResp> list(MsgQuery request);
/** /**
* 删除 * 删除
...@@ -47,5 +48,5 @@ public interface MsgService { ...@@ -47,5 +48,5 @@ public interface MsgService {
* @author RenPing * @author RenPing
* @date 2023/10/25 * @date 2023/10/25
*/ */
void add(MsgDTO.addDto dto); void add(MsgDTO dto);
} }
...@@ -141,6 +141,11 @@ public class BeanRemoteServiceImpl { ...@@ -141,6 +141,11 @@ public class BeanRemoteServiceImpl {
} }
/**
* 处理全部机构
*
* @return
*/
public Result allDepartment() { public Result allDepartment() {
//获取token //获取token
final String accessToken = getAccessToken(); final String accessToken = getAccessToken();
...@@ -149,13 +154,20 @@ public class BeanRemoteServiceImpl { ...@@ -149,13 +154,20 @@ public class BeanRemoteServiceImpl {
return Result.failed(beanR.getMessage()); return Result.failed(beanR.getMessage());
} }
for (Department department : beanR.getData()) { for (Department department : beanR.getData()) {
log.info("处理部门详情---->{}" + department.getBsDeptId()); log.info("处理部门详情---->{}", department.getBsDeptId());
Result result = this.departmentDetail(accessToken, department.getBsDeptId()); Result result = this.departmentDetail(accessToken, department.getBsDeptId());
log.info("处理部门详情,id:{},结果---->{}" + department.getBsDeptId(), result.getCode()); log.info("处理部门详情,id:{},结果---->{}", department.getBsDeptId(), result.getCode());
} }
return Result.success(); return Result.success();
} }
/**
* 处理单极机构,包含大区,分部,分站
*
* @param token
* @param orgId
* @return
*/
public Result departmentDetail(String token, String orgId) { public Result departmentDetail(String token, String orgId) {
//获取token //获取token
BeanR<Department> departmentBeanR = beanRemoteService.departmentDetail(token, orgId); BeanR<Department> departmentBeanR = beanRemoteService.departmentDetail(token, orgId);
...@@ -207,14 +219,33 @@ public class BeanRemoteServiceImpl { ...@@ -207,14 +219,33 @@ public class BeanRemoteServiceImpl {
groupEntity = new OrgGroupEntity(); groupEntity = new OrgGroupEntity();
} }
groupEntity.setGroupName(data.getTagName()); groupEntity.setGroupName(data.getTagName());
//groupEntity.setAbbreviation(data.getAbbreviation()); groupEntity.setAbbreviation(data.getAbbreviation());
//groupEntity.setStatus(data.getEnable()); groupEntity.setStatus(data.getEnable());
//groupEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "" : JSONObject.toJSONString(data.getManageCityList())); groupEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "" : JSONObject.toJSONString(data.getManageCityList()));
//groupEntity.setMemo(data.getDesc()); groupEntity.setMemo(data.getDesc());
//groupEntity.setCode(data.getCode()); groupEntity.setCode(data.getCode());
//groupEntity.setPhone(data.getPhone()); groupEntity.setPhone(data.getPhone());
//groupEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled()); groupEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled());
//groupEntity.setReserveTimeMax(data.getPartReserveTimeMax()); groupEntity.setReserveTimeMax(data.getPartReserveTimeMax());
//处理clusterId和branchId
OrgBranchEntity branchEntity = branchMap.get(data.getParentId());
if (ObjUtil.isNull(branchEntity)) {
branchEntity = orgBranchDao.getByBranchId(data.getParentId());
if (ObjUtil.isNull(branchEntity)) {
return Result.failed();
}
branchMap.put(data.getParentId(), branchEntity);
}
groupEntity.setBranchId(data.getParentId());
groupEntity.setClusterId(branchEntity.getClusterId());
//处理分站外围
if (data.getDeptType().equals(BeanOrgLevelEnum.PERIPHERY.getCode())) {
groupEntity.setKind(2);
}
if (data.getDeptType().equals(BeanOrgLevelEnum.STATION.getCode())) {
groupEntity.setKind(1);
}
groupEntity.setCategory(1);
orgGroupDao.save(groupEntity); orgGroupDao.save(groupEntity);
return Result.success(); return Result.success();
} }
...@@ -223,6 +254,53 @@ public class BeanRemoteServiceImpl { ...@@ -223,6 +254,53 @@ public class BeanRemoteServiceImpl {
/** /**
* 处理全部网点
*
* @return
*/
public Result serviceOrgList() {
//获取token
final String accessToken = getAccessToken();
BeanR<List<ServiceOrg>> listBeanR = beanRemoteService.serviceOrgList(accessToken, 1);
log.info("[查询网点/车队列表]【/api/openapi/department/queryServiceOrgList】返回值-------------------->{}", JsonUtil.toJson(listBeanR));
if (!listBeanR.getSuccess() || ObjUtil.isNull(listBeanR.getData())) {
return Result.failed(listBeanR.getMessage());
}
for (ServiceOrg serviceOrg : listBeanR.getData()) {
log.info("处理网点部门详情---->{}", serviceOrg.getServiceOrgId());
Result result = this.serviceOrgDetail(accessToken, serviceOrg);
log.info("处理网点部门详情,id:{},结果---->{}", serviceOrg.getServiceOrgId(), result.getCode());
}
return Result.success();
}
private Result serviceOrgDetail(String accessToken, ServiceOrg serviceOrg) {
BeanR<ServiceOrgDetail> beanR = beanRemoteService.serviceOrgDetail(accessToken, serviceOrg.getServiceOrgId());
log.info("[查询网点/车队列表]【/api/openapi/department/queryServiceOrgList】返回值-------------------->{}", JsonUtil.toJson(beanR));
if (!beanR.getSuccess() || ObjUtil.isNull(beanR.getData())) {
return Result.failed(beanR.getMessage());
}
ServiceOrgDetail data = beanR.getData();
OrgGroupEntity groupEntity = orgGroupDao.getByGroupId(data.getServiceOrgId());
if (ObjUtil.isNull(groupEntity)) {
groupEntity = new OrgGroupEntity();
}
groupEntity.setGroupName(data.getName());
groupEntity.setStatus(data.getStatus());
groupEntity.setCitycodeList(CollectionUtils.isEmpty(data.getServiceRange()) ? "" : JSONObject.toJSONString(data.getServiceRange()));
groupEntity.setPhone(data.getContactPhone());
groupEntity.setBranchId(data.getBelongBranch().getBsDeptId());
groupEntity.setClusterId(data.getBelongRegion().getBsDeptId());
//处理分站外围
groupEntity.setKind(4);
groupEntity.setCategory(2);
groupEntity.setAddress(data.getBusinessAddress().getAddress());
orgGroupDao.save(groupEntity);
return Result.success();
}
/**
* 获取bean token * 获取bean token
* *
* @return * @return
......
...@@ -131,6 +131,8 @@ public class BusinessTeamServiceImpl implements BusinessTeamService { ...@@ -131,6 +131,8 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
.setTeamName(req.getTeamName()) .setTeamName(req.getTeamName())
.setTeamType(TEAMTYPE_PEA) .setTeamType(TEAMTYPE_PEA)
.setWarehouseId(req.getWarehouseId()) .setWarehouseId(req.getWarehouseId())
.setWorkOn(req.getWorkOn())
.setWorkOff(req.getWorkOff())
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setUpdateTime(LocalDateTime.now()); .setUpdateTime(LocalDateTime.now());
if (req.getWorkdays() != null) { if (req.getWorkdays() != null) {
...@@ -177,6 +179,12 @@ public class BusinessTeamServiceImpl implements BusinessTeamService { ...@@ -177,6 +179,12 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
if (StringUtils.isNotBlank(req.getGroupId())) { if (StringUtils.isNotBlank(req.getGroupId())) {
entity.setGroupId(req.getGroupId()); entity.setGroupId(req.getGroupId());
} }
if (StringUtils.isNotBlank(req.getWorkOn())) {
entity.setWorkOn(req.getWorkOn());
}
if (StringUtils.isNotBlank(req.getWorkOff())) {
entity.setWorkOff(req.getWorkOff());
}
entity.setUpdateTime(LocalDateTime.now()); entity.setUpdateTime(LocalDateTime.now());
orgTeamDao.save(entity); orgTeamDao.save(entity);
......
...@@ -42,334 +42,335 @@ import java.util.stream.Collectors; ...@@ -42,334 +42,335 @@ import java.util.stream.Collectors;
@Service @Service
public class EngineerServiceImpl implements EngineerService { public class EngineerServiceImpl implements EngineerService {
@Autowired @Autowired
private EngineerInfoDao engineerInfoDao; private EngineerInfoDao engineerInfoDao;
@Autowired @Autowired
private EngineerSkillGroupDao engineerSkillGroupDao; private EngineerSkillGroupDao engineerSkillGroupDao;
@Autowired @Autowired
private OrgGroupDao orgGroupDao; private OrgGroupDao orgGroupDao;
@Autowired @Autowired
private EngineerBusinessDao engineerBusinessDao; private EngineerBusinessDao engineerBusinessDao;
@Autowired @Autowired
private EntityManager entityManager; private EntityManager entityManager;
@Transactional @Transactional
@Override @Override
public Result<?> getEngineerInfoList(String levelType, String levelValue, int page, int size, String kind, String key) { public Result<?> getEngineerInfoList(String levelType, String levelValue, int page, int size, String kind, String key) {
// 查询工程师信息 // 查询工程师信息
Page<EngineerInfoEntity> pg = this.queryEngineerInfoIPage(levelType, levelValue, page, size, kind, key); Page<EngineerInfoEntity> pg = this.queryEngineerInfoIPage(levelType, levelValue, page, size, kind, key);
List<EngineerInfoEntity> records = pg.getContent(); List<EngineerInfoEntity> records = pg.getContent();
// 获取groupIds // 获取groupIds
List<String> groupIds = records.stream().map(EngineerInfoEntity::getGroupId).collect(Collectors.toList()); List<String> groupIds = records.stream().map(EngineerInfoEntity::getGroupId).collect(Collectors.toList());
// 获取Map<groupId, groupName> // 获取Map<groupId, groupName>
HashMap<String, String> groupNames = this.queryGroupNames(groupIds); HashMap<String, String> groupNames = this.queryGroupNames(groupIds);
// 设置返回值 // 设置返回值
EngineerInfoListResp res = new EngineerInfoListResp(); EngineerInfoListResp res = new EngineerInfoListResp();
res.setContent(this.packEngineerInfos(records, groupNames)); res.setContent(this.packEngineerInfos(records, groupNames));
res.setTotal(pg.getTotalElements()); res.setTotal(pg.getTotalElements());
res.setPages(pg.getTotalPages()); res.setPages(pg.getTotalPages());
res.setPageCurrent(pg.getNumber() + 1); res.setPageCurrent(pg.getNumber() + 1);
res.setPageSize(pg.getSize()); res.setPageSize(pg.getSize());
return Result.success(res); return Result.success(res);
} }
@Override @Override
public Result<?> getEngineerInfoDetail(String engineerCode) throws BusinessException { public Result<?> getEngineerInfoDetail(String engineerCode) throws BusinessException {
// 获取技术员基础信息详情 // 获取技术员基础信息详情
// 获取技术员列表 // 获取技术员列表
EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode); EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode);
if (engineer == null) { if (engineer == null) {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
String groupId = engineer.getGroupId(); String groupId = engineer.getGroupId();
HashMap<String, String> groupNames = this.queryGroupNames(List.of(groupId)); HashMap<String, String> groupNames = this.queryGroupNames(List.of(groupId));
List<EngineerInfoListResp.EngineerInfo> items = this.packEngineerInfos(List.of(engineer), groupNames); List<EngineerInfoListResp.EngineerInfo> items = this.packEngineerInfos(List.of(engineer), groupNames);
if (items.isEmpty()) { if (items.isEmpty()) {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
return Result.success(items.get(0)); return Result.success(items.get(0));
} }
@Transactional @Transactional
@Override @Override
public Result<?> getEngineerSkillList(String levelType, String levelValue, int page, int size, String kind, String key) { public Result<?> getEngineerSkillList(String levelType, String levelValue, int page, int size, String kind, String key) {
// 获取技术员技能列表 // 获取技术员技能列表
Page<EngineerInfoEntity> pg = this.queryEngineerInfoIPage(levelType, levelValue, page, size, kind, key); Page<EngineerInfoEntity> pg = this.queryEngineerInfoIPage(levelType, levelValue, page, size, kind, key);
List<EngineerInfoEntity> engineers = pg.getContent(); List<EngineerInfoEntity> engineers = pg.getContent();
EngineerSkillListResp res = new EngineerSkillListResp(); EngineerSkillListResp res = new EngineerSkillListResp();
res.setTotal(pg.getTotalElements()); res.setTotal(pg.getTotalElements());
res.setPages(pg.getTotalPages()); res.setPages(pg.getTotalPages());
res.setPageCurrent(pg.getNumber() + 1); res.setPageCurrent(pg.getNumber() + 1);
res.setPageSize(pg.getSize()); res.setPageSize(pg.getSize());
res.setContent(this.packEngineerSkills(engineers)); res.setContent(this.packEngineerSkills(engineers));
return Result.success(res); return Result.success(res);
} }
@Override @Override
public Result<?> getEngineerSkillDetail(String engineerCode) throws BusinessException { public Result<?> getEngineerSkillDetail(String engineerCode) throws BusinessException {
// 获取工程师技能详情 // 获取工程师技能详情
EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode); EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode);
if (engineer == null) { if (engineer == null) {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
List<EngineerSkillListResp.EngineerSkill> items = this.packEngineerSkills(List.of(engineer)); List<EngineerSkillListResp.EngineerSkill> items = this.packEngineerSkills(List.of(engineer));
if (items.isEmpty()) { if (items.isEmpty()) {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
return Result.success(items.get(0)); return Result.success(items.get(0));
} }
@Transactional @Transactional
@Override @Override
public Result<?> engineerSkillUpdate(String engineerCode, List<String> skillGroupIds) { public Result<?> engineerSkillUpdate(String engineerCode, List<String> skillGroupIds) {
// 更新技术员技能 // 更新技术员技能
// 先将所有技能更新为0-不可用状态 // 先将所有技能更新为0-不可用状态
CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaUpdate<EngineerSkillGroupEntity> update = cb.createCriteriaUpdate(EngineerSkillGroupEntity.class); CriteriaUpdate<EngineerSkillGroupEntity> update = cb.createCriteriaUpdate(EngineerSkillGroupEntity.class);
Root<EngineerSkillGroupEntity> root = update.from(EngineerSkillGroupEntity.class); Root<EngineerSkillGroupEntity> root = update.from(EngineerSkillGroupEntity.class);
update.set(root.get("status"), 0); update.set(root.get("status"), 0);
update.where(cb.equal(root.get("engineerCode"), engineerCode)); update.where(cb.equal(root.get("engineerCode"), engineerCode));
entityManager.createQuery(update).executeUpdate(); entityManager.createQuery(update).executeUpdate();
if (skillGroupIds.isEmpty()) { if (skillGroupIds.isEmpty()) {
return null; return null;
} }
// 更新categoryIds状态为1 // 更新categoryIds状态为1
CriteriaBuilder cb1 = entityManager.getCriteriaBuilder(); CriteriaBuilder cb1 = entityManager.getCriteriaBuilder();
CriteriaUpdate<EngineerSkillGroupEntity> update1 = cb.createCriteriaUpdate(EngineerSkillGroupEntity.class); CriteriaUpdate<EngineerSkillGroupEntity> update1 = cb.createCriteriaUpdate(EngineerSkillGroupEntity.class);
Root<EngineerSkillGroupEntity> root1 = update1.from(EngineerSkillGroupEntity.class); Root<EngineerSkillGroupEntity> root1 = update1.from(EngineerSkillGroupEntity.class);
update1.set(root1.get("status"), 1); update1.set(root1.get("status"), 1);
update1.where( update1.where(
cb1.equal(root1.get("engineerCode"), engineerCode), cb1.equal(root1.get("engineerCode"), engineerCode),
root1.get("skillGroupCode").in(skillGroupIds) root1.get("skillGroupCode").in(skillGroupIds)
); );
int n = entityManager.createQuery(update1).executeUpdate(); int n = entityManager.createQuery(update1).executeUpdate();
if (skillGroupIds.size() == n) { if (skillGroupIds.size() == n) {
// 更新记录条数等于提交记录条数 // 更新记录条数等于提交记录条数
return null; return null;
} }
// 可能存在engineerSkill表不存在的记录,需要补充录入 // 可能存在engineerSkill表不存在的记录,需要补充录入
List<Boolean> statuses = new ArrayList<Boolean>(Arrays.asList(true, false)); List<Boolean> statuses = new ArrayList<Boolean>(Arrays.asList(true, false));
List<String> engineerCodes = new ArrayList<>(Collections.singletonList(engineerCode)); List<String> engineerCodes = new ArrayList<>(Collections.singletonList(engineerCode));
HashMap<String, List<String>> engineerSkills = this.queryEngineerSkills(engineerCodes, statuses); HashMap<String, List<String>> engineerSkills = this.queryEngineerSkills(engineerCodes, statuses);
Set<String> sInput = new HashSet<>(skillGroupIds); Set<String> sInput = new HashSet<>(skillGroupIds);
Set<String> sDB = new HashSet<>(engineerSkills.getOrDefault(engineerCode, new ArrayList<>())); Set<String> sDB = new HashSet<>(engineerSkills.getOrDefault(engineerCode, new ArrayList<>()));
sInput.removeAll(sDB); sInput.removeAll(sDB);
for (String skillGroupId : sInput) { for (String skillGroupId : sInput) {
EngineerSkillGroupEntity e = new EngineerSkillGroupEntity(); EngineerSkillGroupEntity e = new EngineerSkillGroupEntity();
e.setEngineerCode(engineerCode); e.setEngineerCode(engineerCode);
e.setSkillGroupCode(skillGroupId); e.setSkillGroupCode(skillGroupId);
e.setBeanStatus(Boolean.TRUE); e.setBeanStatus(Boolean.TRUE);
e.setDescription(""); e.setDescription("");
e.setStatus(true); e.setStatus(true);
e.setMemo(""); e.setMemo("");
e.setCreateTime(LocalDateTime.now()); e.setCreateTime(LocalDateTime.now());
e.setUpdateTime(LocalDateTime.now()); e.setUpdateTime(LocalDateTime.now());
entityManager.persist(e); entityManager.persist(e);
} }
return null; return null;
} }
@Transactional @Transactional
@Override @Override
public Result<?> getEngineerBusinessList(String levelType, String levelValue, int page, int size, String kind, String key) { public Result<?> getEngineerBusinessList(String levelType, String levelValue, int page, int size, String kind, String key) {
// 技术员业务属性配置列表 // 技术员业务属性配置列表
// 查询技术员列表 // 查询技术员列表
Page<EngineerInfoEntity> pg = this.queryEngineerInfoIPage(levelType, levelValue, page, size, kind, key); Page<EngineerInfoEntity> pg = this.queryEngineerInfoIPage(levelType, levelValue, page, size, kind, key);
List<EngineerInfoEntity> engineers = pg.getContent(); List<EngineerInfoEntity> engineers = pg.getContent();
// 查询技术员业务属性 // 查询技术员业务属性
EngineerBusinessListResp res = new EngineerBusinessListResp(); EngineerBusinessListResp res = new EngineerBusinessListResp();
res.setTotal(pg.getTotalElements()); res.setTotal(pg.getTotalElements());
res.setPages(pg.getTotalPages()); res.setPages(pg.getTotalPages());
res.setPageCurrent(pg.getNumber() + 1); res.setPageCurrent(pg.getNumber() + 1);
res.setPageSize(pg.getSize()); res.setPageSize(pg.getSize());
res.setContent(this.packEngineerBusinesses(engineers)); res.setContent(this.packEngineerBusinesses(engineers));
return Result.success(res); return Result.success(res);
} }
@Override @Override
public Result<?> getEngineerBusinessDetail(String engineerCode) { public Result<?> getEngineerBusinessDetail(String engineerCode) {
// 获取技术员业务熟悉详情 // 获取技术员业务熟悉详情
EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode); EngineerInfoEntity engineer = engineerInfoDao.getByEngineerCode(engineerCode);
if (engineer == null) { if (engineer == null) {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
List<?> items = this.packEngineerBusinesses(List.of(engineer)); List<?> items = this.packEngineerBusinesses(List.of(engineer));
if (items.isEmpty()) { if (items.isEmpty()) {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
return Result.success(items.get(0)); return Result.success(items.get(0));
} }
@Transactional @Transactional
@Override @Override
public Result<?> engineerBusinessUpdate(String engineerCode, Integer maxNum, Integer departure, Integer priority, public Result<?> engineerBusinessUpdate(String engineerCode, Integer maxNum, Integer departure, Integer priority,
String workOn, String workOff, String transportMode) { String workOn, String workOff, String transportMode) {
// 计算时间差 // 计算时间差
int minute = this.getMinuteDiff(TimeUtils.time2LocalTime(workOn), TimeUtils.time2LocalTime(workOff)); int minute = this.getMinuteDiff(TimeUtils.time2LocalTime(workOn), TimeUtils.time2LocalTime(workOff));
// 技术员业务属性配置修改 // 技术员业务属性配置修改
CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaUpdate<EngineerBusinessEntity> update = cb.createCriteriaUpdate(EngineerBusinessEntity.class); CriteriaUpdate<EngineerBusinessEntity> update = cb.createCriteriaUpdate(EngineerBusinessEntity.class);
Root<EngineerBusinessEntity> root = update.from(EngineerBusinessEntity.class); Root<EngineerBusinessEntity> root = update.from(EngineerBusinessEntity.class);
update.set(root.get("maxNum"), maxNum); update.set(root.get("maxNum"), maxNum);
update.set(root.get("departure"), departure); update.set(root.get("departure"), departure);
update.set(root.get("priority"), priority); update.set(root.get("priority"), priority);
update.set(root.get("workOn"), workOn); update.set(root.get("workOn"), workOn);
update.set(root.get("workOff"), workOff); update.set(root.get("workOff"), workOff);
update.set(root.get("maxMinute"), minute); update.set(root.get("maxMinute"), minute);
update.set(root.get("vehicle"), transportMode); update.set(root.get("vehicle"), transportMode);
update.where(cb.equal(root.get("engineerCode"), engineerCode)); update.where(cb.equal(root.get("engineerCode"), engineerCode));
entityManager.createQuery(update).executeUpdate(); entityManager.createQuery(update).executeUpdate();
return Result.success(null); return Result.success(null);
} }
private Page<EngineerInfoEntity> queryEngineerInfoIPage(String levelType, String levelValue, int page, int size, String kind, String key) { private Page<EngineerInfoEntity> queryEngineerInfoIPage(String levelType, String levelValue, int page, int size, String kind, String key) {
// 分页查询工程师基础信息 // 分页查询工程师基础信息
// 查询技术员所在的groupIds // 查询技术员所在的groupIds
List<OrgGroupEntity> groups = new ArrayList<>(); List<OrgGroupEntity> groups = new ArrayList<>();
if (levelType.equals("cluster")) { if (levelType.equals("cluster")) {
groups = orgGroupDao.findAllByClusterId(levelValue); groups = orgGroupDao.findAllByClusterId(levelValue);
} else if (levelType.equals("branch")) { } else if (levelType.equals("branch")) {
groups = orgGroupDao.findAllByBranchId(levelValue); groups = orgGroupDao.findAllByBranchId(levelValue);
} else if (levelType.equals("group")) { } else if (levelType.equals("group")) {
groups = orgGroupDao.findAllByGroupId(levelValue); groups = orgGroupDao.findAllByGroupId(levelValue);
} }
List<String> groupIds = groups.stream().map(OrgGroupEntity::getGroupId).collect(Collectors.toList()); List<String> groupIds = groups.stream().map(OrgGroupEntity::getGroupId).collect(Collectors.toList());
Pageable pageable = PageRequest.of(page, size); Pageable pageable = PageRequest.of(page, size);
Specification<EngineerInfoEntity> spec = (root, query, cb) -> { Specification<EngineerInfoEntity> spec = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
if (groupIds != null && !groupIds.isEmpty()) { if (groupIds != null && !groupIds.isEmpty()) {
predicates.add(root.get("groupId").in(groupIds)); predicates.add(root.get("groupId").in(groupIds));
} }
if (StringUtils.hasText(kind)) { if (StringUtils.hasText(kind)) {
int kindValue = kind.equals("fullJob") ? 1 : 2; int kindValue = kind.equals("fullJob") ? 1 : 2;
predicates.add(cb.equal(root.get("kind"), kindValue)); predicates.add(cb.equal(root.get("kind"), kindValue));
} }
if (StringUtils.hasText(key)) { if (StringUtils.hasText(key)) {
String likeKey = "%" + key + "%"; String likeKey = "%" + key + "%";
predicates.add(cb.or( predicates.add(cb.or(
cb.like(root.get("phone"), likeKey), cb.like(root.get("phone"), likeKey),
cb.like(root.get("name"), likeKey), cb.like(root.get("name"), likeKey),
cb.like(root.get("engineerCode"), likeKey) cb.like(root.get("engineerCode"), likeKey)
)); ));
} }
return cb.and(predicates.toArray(new Predicate[0])); return cb.and(predicates.toArray(new Predicate[0]));
}; };
return engineerInfoDao.findAll(spec, pageable); return engineerInfoDao.findAll(spec, pageable);
} }
private HashMap<String, String> queryGroupNames(List<String> groupIds) { private HashMap<String, String> queryGroupNames(List<String> groupIds) {
//查询小组名称映射关系 //查询小组名称映射关系
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
if (groupIds.isEmpty()) { if (groupIds.isEmpty()) {
return map; return map;
} }
List<OrgGroupEntity> groups = orgGroupDao.findByGroupIdIn(groupIds); List<OrgGroupEntity> groups = orgGroupDao.findByGroupIdIn(groupIds);
for (OrgGroupEntity g : groups) { for (OrgGroupEntity g : groups) {
map.put(g.getGroupId(), g.getGroupName()); map.put(g.getGroupId(), g.getGroupName());
} }
return map; return map;
} }
private HashMap<String, List<String>> queryEngineerSkills(List<String> engineerCodes, List<Boolean> statuses) { private HashMap<String, List<String>> queryEngineerSkills(List<String> engineerCodes, List<Boolean> statuses) {
// 获取engineerCode对应的技能表, HashMap<engineerCode, List<skillId>> // 获取engineerCode对应的技能表, HashMap<engineerCode, List<skillId>>
HashMap<String, List<String>> map = new HashMap<>(); HashMap<String, List<String>> map = new HashMap<>();
if (engineerCodes.isEmpty()) { if (engineerCodes.isEmpty()) {
return map; return map;
} }
List<EngineerSkillGroupEntity> records = engineerSkillGroupDao.findByEngineerCodeInAndStatusIn(engineerCodes, statuses); List<EngineerSkillGroupEntity> records = engineerSkillGroupDao.findByEngineerCodeInAndStatusIn(engineerCodes, statuses);
if (ListUtils.isEmpty(records)) { if (ListUtils.isEmpty(records)) {
return map; return map;
} }
Comparator<EngineerSkillGroupEntity> ec = Comparator.comparing(EngineerSkillGroupEntity::getEngineerCode, String.CASE_INSENSITIVE_ORDER); Comparator<EngineerSkillGroupEntity> ec = Comparator.comparing(EngineerSkillGroupEntity::getEngineerCode, String.CASE_INSENSITIVE_ORDER);
List<EngineerSkillGroupEntity> results = records.stream().sorted(ec).collect(Collectors.toList()); List<EngineerSkillGroupEntity> results = records.stream().sorted(ec).collect(Collectors.toList());
// 根据engineerCode分组 // 根据engineerCode分组
Map<String, List<EngineerSkillGroupEntity>> g = results.stream().collect(Collectors.groupingBy(EngineerSkillGroupEntity::getEngineerCode)); Map<String, List<EngineerSkillGroupEntity>> g = results.stream().collect(Collectors.groupingBy(EngineerSkillGroupEntity::getEngineerCode));
for (String engineerCode : g.keySet()) { for (String engineerCode : g.keySet()) {
// 技术员技能ID列表 // 技术员技能ID列表
List<String> skillGroupIds = g.get(engineerCode).stream().map(EngineerSkillGroupEntity::getSkillGroupCode).collect(Collectors.toList()); List<String> skillGroupIds = g.get(engineerCode).stream().map(EngineerSkillGroupEntity::getSkillGroupCode).collect(Collectors.toList());
map.put(engineerCode, skillGroupIds); map.put(engineerCode, skillGroupIds);
} }
return map; return map;
} }
private HashMap<String, EngineerBusinessEntity> queryEngineerBusiness(List<String> engineerCodes) { private HashMap<String, EngineerBusinessEntity> queryEngineerBusiness(List<String> engineerCodes) {
HashMap<String, EngineerBusinessEntity> map = new HashMap<>(); HashMap<String, EngineerBusinessEntity> map = new HashMap<>();
if (engineerCodes.isEmpty()) { if (engineerCodes.isEmpty()) {
return map; return map;
} }
List<EngineerBusinessEntity> records = engineerBusinessDao.findByEngineerCodeIn(engineerCodes); List<EngineerBusinessEntity> records = engineerBusinessDao.findByEngineerCodeIn(engineerCodes);
for (EngineerBusinessEntity r : records) { for (EngineerBusinessEntity r : records) {
map.put(r.getEngineerCode(), r); map.put(r.getEngineerCode(), r);
} }
return map; return map;
} }
private List<EngineerInfoListResp.EngineerInfo> packEngineerInfos(List<EngineerInfoEntity> engineers, HashMap<String, String> groups) { private List<EngineerInfoListResp.EngineerInfo> packEngineerInfos(List<EngineerInfoEntity> engineers, HashMap<String, String> groups) {
String groupName, age, kind; String groupName, age, kind;
List<EngineerInfoListResp.EngineerInfo> items = new ArrayList<>(); List<EngineerInfoListResp.EngineerInfo> items = new ArrayList<>();
for (EngineerInfoEntity e : engineers) { for (EngineerInfoEntity e : engineers) {
EngineerInfoListResp.EngineerInfo item = new EngineerInfoListResp.EngineerInfo(); EngineerInfoListResp.EngineerInfo item = new EngineerInfoListResp.EngineerInfo();
item.setEngineerCode(e.getEngineerCode()); item.setEngineerCode(e.getEngineerCode());
item.setNumber(e.getEngineerCode()); item.setNumber(e.getEngineerCode());
item.setName(e.getName()); item.setName(e.getName());
item.setSex(e.getGender()); item.setSex(e.getGender());
item.setPhone(e.getPhone()); item.setPhone(e.getPhone());
item.setAddress(e.getAddress()); item.setAddress(e.getAddress());
item.setGrade(e.getGrade()); item.setGrade(e.getGrade());
item.setWorkAddress(e.getWorkAddress());
// group name
groupName = groups.getOrDefault(e.getGroupId(), ""); // group name
item.setGroupName(groupName); groupName = groups.getOrDefault(e.getGroupId(), "");
item.setGroupName(groupName);
// 年龄
age = this.getEngineerAge(e.getBirth()); // 年龄
item.setAge(age); age = this.getEngineerAge(e.getBirth());
item.setAge(age);
// 工作类型:全职/兼职
kind = (e.getKind() == 1) ? "fullJob" : "partJob"; // 工作类型:全职/兼职
item.setKind(kind); kind = (e.getKind() == 1) ? "fullJob" : "partJob";
item.setKind(kind);
if (e.getCredentials() != null) {
item.setCredentials(Arrays.asList(e.getCredentials().split("、"))); if (e.getCredentials() != null) {
} else { item.setCredentials(Arrays.asList(e.getCredentials().split("、")));
item.setCredentials(new ArrayList<String>()); } else {
} item.setCredentials(new ArrayList<String>());
}
// 标签
// 标签
/* /*
List<String> tags = new ArrayList<>(); List<String> tags = new ArrayList<>();
if (e.getTags() != null && !e.getTags().isEmpty()) { if (e.getTags() != null && !e.getTags().isEmpty()) {
...@@ -380,121 +381,121 @@ public class EngineerServiceImpl implements EngineerService { ...@@ -380,121 +381,121 @@ public class EngineerServiceImpl implements EngineerService {
item.setTags(tags); item.setTags(tags);
*/ */
items.add(item); items.add(item);
} }
return items; return items;
} }
private List<EngineerSkillListResp.EngineerSkill> packEngineerSkills(List<EngineerInfoEntity> engineers) { private List<EngineerSkillListResp.EngineerSkill> packEngineerSkills(List<EngineerInfoEntity> engineers) {
// 获取groupId类表 // 获取groupId类表
List<String> groupIds = engineers.stream().map(EngineerInfoEntity::getGroupId).collect(Collectors.toList()); List<String> groupIds = engineers.stream().map(EngineerInfoEntity::getGroupId).collect(Collectors.toList());
HashMap<String, String> groupNames = this.queryGroupNames(groupIds); HashMap<String, String> groupNames = this.queryGroupNames(groupIds);
// 获取技术员code列表 // 获取技术员code列表
List<String> engineerCodes = engineers.stream().map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList()); List<String> engineerCodes = engineers.stream().map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
// 获取技术员的可用技能列表 // 获取技术员的可用技能列表
List<Boolean> statuses = Collections.singletonList(true); List<Boolean> statuses = Collections.singletonList(true);
HashMap<String, List<String>> engineerSkillGroups = this.queryEngineerSkills(engineerCodes, statuses); HashMap<String, List<String>> engineerSkillGroups = this.queryEngineerSkills(engineerCodes, statuses);
List<String> emptySkills = Collections.emptyList(); List<String> emptySkills = Collections.emptyList();
List<EngineerSkillListResp.EngineerSkill> items = new ArrayList<>(); List<EngineerSkillListResp.EngineerSkill> items = new ArrayList<>();
for (EngineerInfoEntity e : engineers) { for (EngineerInfoEntity e : engineers) {
EngineerSkillListResp.EngineerSkill skill = new EngineerSkillListResp.EngineerSkill(); EngineerSkillListResp.EngineerSkill skill = new EngineerSkillListResp.EngineerSkill();
skill.setEngineerCode(e.getEngineerCode()); skill.setEngineerCode(e.getEngineerCode());
skill.setEngineerName(e.getName()); skill.setEngineerName(e.getName());
skill.setGroupName(groupNames.getOrDefault(e.getGroupId(), "")); skill.setGroupName(groupNames.getOrDefault(e.getGroupId(), ""));
skill.setUpdateTime(TimeUtils.IsoLocalDateTime2String(e.getUpdateTime())); skill.setUpdateTime(TimeUtils.IsoLocalDateTime2String(e.getUpdateTime()));
// 获取一个工程师的技能列表 // 获取一个工程师的技能列表
skill.setSkillGroupIds(engineerSkillGroups.getOrDefault(e.getEngineerCode(), emptySkills)); skill.setSkillGroupIds(engineerSkillGroups.getOrDefault(e.getEngineerCode(), emptySkills));
items.add(skill); items.add(skill);
} }
return items; return items;
} }
private List<EngineerBusinessListResp.EngineerBusiness> packEngineerBusinesses(List<EngineerInfoEntity> engineers) { private List<EngineerBusinessListResp.EngineerBusiness> packEngineerBusinesses(List<EngineerInfoEntity> engineers) {
// 获取技术员code列表 // 获取技术员code列表
List<String> engineerCodes = engineers.stream().map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList()); List<String> engineerCodes = engineers.stream().map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
List<String> groupIds = engineers.stream().map(EngineerInfoEntity::getGroupId).collect(Collectors.toList()); List<String> groupIds = engineers.stream().map(EngineerInfoEntity::getGroupId).collect(Collectors.toList());
HashMap<String, String> groupNames = this.queryGroupNames(groupIds); HashMap<String, String> groupNames = this.queryGroupNames(groupIds);
HashMap<String, EngineerBusinessEntity> buss = this.queryEngineerBusiness(engineerCodes); HashMap<String, EngineerBusinessEntity> buss = this.queryEngineerBusiness(engineerCodes);
List<EngineerBusinessListResp.EngineerBusiness> items = new ArrayList<>(); List<EngineerBusinessListResp.EngineerBusiness> items = new ArrayList<>();
for (EngineerInfoEntity e : engineers) { for (EngineerInfoEntity e : engineers) {
EngineerBusinessListResp.EngineerBusiness item = new EngineerBusinessListResp.EngineerBusiness(); EngineerBusinessListResp.EngineerBusiness item = new EngineerBusinessListResp.EngineerBusiness();
EngineerBusinessEntity b = buss.getOrDefault(e.getEngineerCode(), null); EngineerBusinessEntity b = buss.getOrDefault(e.getEngineerCode(), null);
if (b == null) { if (b == null) {
// 若没有配置,则不返回, 由同步程序初始化 // 若没有配置,则不返回, 由同步程序初始化
continue; continue;
} }
item.setEngineerCode(e.getEngineerCode()); item.setEngineerCode(e.getEngineerCode());
item.setGroupName(groupNames.getOrDefault(e.getGroupId(), "")); item.setGroupName(groupNames.getOrDefault(e.getGroupId(), ""));
item.setEngineerName(e.getName()); item.setEngineerName(e.getName());
item.setKind((e.getKind() == 1) ? "fullJob" : "partJob"); item.setKind((e.getKind() == 1) ? "fullJob" : "partJob");
item.setAddress(b.getAddress()); item.setAddress(b.getAddress());
item.setLocation(String.format("%s,%s", b.getX(), b.getY())); item.setLocation(String.format("%s,%s", b.getX(), b.getY()));
item.setWorkOn(b.getWorkOn()); item.setWorkOn(b.getWorkOn());
item.setWorkOff(b.getWorkOff()); item.setWorkOff(b.getWorkOff());
item.setTransportMode(b.getVehicle()); item.setTransportMode(b.getVehicle());
item.setDeparture(b.getDeparture()); item.setDeparture(b.getDeparture());
item.setMaxMinute(b.getMaxMinute()); item.setMaxMinute(b.getMaxMinute());
item.setMaxNum(b.getMaxNum()); item.setMaxNum(b.getMaxNum());
item.setPriority(b.getPriority()); item.setPriority(b.getPriority());
items.add(item); items.add(item);
} }
return items; return items;
} }
private HashMap<String, Integer> getEngineerSkillIds(List<String> skillIds, HashMap<String, Integer> engineerSkillIds) { private HashMap<String, Integer> getEngineerSkillIds(List<String> skillIds, HashMap<String, Integer> engineerSkillIds) {
HashMap<String, Integer> map = new HashMap<>(); HashMap<String, Integer> map = new HashMap<>();
for (String skillId : skillIds) { for (String skillId : skillIds) {
map.put(skillId, engineerSkillIds.getOrDefault(skillId, 0)); map.put(skillId, engineerSkillIds.getOrDefault(skillId, 0));
} }
return map; return map;
} }
private String getEngineerAge(String birth) { private String getEngineerAge(String birth) {
// 获取工程师年龄 // 获取工程师年龄
if (birth.isEmpty()) { if (birth.isEmpty()) {
return ""; return "";
} }
int age; int age;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try { try {
Date birthDate = dateFormat.parse(birth); Date birthDate = dateFormat.parse(birth);
Calendar birthCalendar = Calendar.getInstance(); Calendar birthCalendar = Calendar.getInstance();
birthCalendar.setTime(birthDate); birthCalendar.setTime(birthDate);
Calendar nowCalendar = Calendar.getInstance(); Calendar nowCalendar = Calendar.getInstance();
age = nowCalendar.get(Calendar.YEAR) - birthCalendar.get(Calendar.YEAR); age = nowCalendar.get(Calendar.YEAR) - birthCalendar.get(Calendar.YEAR);
if (nowCalendar.get(Calendar.DAY_OF_YEAR) < birthCalendar.get(Calendar.DAY_OF_YEAR)) { if (nowCalendar.get(Calendar.DAY_OF_YEAR) < birthCalendar.get(Calendar.DAY_OF_YEAR)) {
age--; age--;
} }
} catch (Exception e) { } catch (Exception e) {
return ""; return "";
} }
return (age <= 0) ? "" : Integer.toString(age); return (age <= 0) ? "" : Integer.toString(age);
} }
private int getMinuteDiff(LocalTime tBegin, LocalTime tEnd) { private int getMinuteDiff(LocalTime tBegin, LocalTime tEnd) {
int r = tBegin.compareTo(tEnd); int r = tBegin.compareTo(tEnd);
if (r == 0) { if (r == 0) {
return 0; return 0;
} }
LocalDateTime dtBegin = LocalDateTime.of(LocalDateTime.now().toLocalDate(), tBegin); LocalDateTime dtBegin = LocalDateTime.of(LocalDateTime.now().toLocalDate(), tBegin);
LocalDateTime dtEnd; LocalDateTime dtEnd;
if (r < 0) { if (r < 0) {
dtEnd = LocalDateTime.of(LocalDateTime.now().toLocalDate(), tEnd); dtEnd = LocalDateTime.of(LocalDateTime.now().toLocalDate(), tEnd);
} else { } else {
dtEnd = LocalDateTime.of(LocalDateTime.now().plusDays(1).toLocalDate(), tEnd); dtEnd = LocalDateTime.of(LocalDateTime.now().plusDays(1).toLocalDate(), tEnd);
} }
Duration duration = Duration.between(dtBegin, dtEnd); Duration duration = Duration.between(dtBegin, dtEnd);
return (int) duration.toMinutes(); return (int) duration.toMinutes();
} }
} }
...@@ -7,6 +7,7 @@ import com.dituhui.pea.common.PageResult; ...@@ -7,6 +7,7 @@ import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.order.dao.*; import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dto.MsgDTO; import com.dituhui.pea.order.dto.MsgDTO;
import com.dituhui.pea.order.dto.MsgGroupResp; import com.dituhui.pea.order.dto.MsgGroupResp;
import com.dituhui.pea.order.dto.MsgQuery;
import com.dituhui.pea.order.dto.MsgResp; import com.dituhui.pea.order.dto.MsgResp;
import com.dituhui.pea.order.entity.MsgEntity; import com.dituhui.pea.order.entity.MsgEntity;
import com.dituhui.pea.order.entity.MsgReceiverEntity; import com.dituhui.pea.order.entity.MsgReceiverEntity;
...@@ -47,7 +48,7 @@ public class MsgServiceImpl implements MsgService { ...@@ -47,7 +48,7 @@ public class MsgServiceImpl implements MsgService {
private OrgGroupDao groupDao; private OrgGroupDao groupDao;
@Override @Override
public PageResult<MsgGroupResp> list(MsgDTO.Request request) { public PageResult<MsgGroupResp> list(MsgQuery request) {
Sort sort = Sort.by("asc".equalsIgnoreCase(request.getSortType()) ? Sort.Direction.ASC : Sort.Direction.DESC, request.getSort()); Sort sort = Sort.by("asc".equalsIgnoreCase(request.getSortType()) ? Sort.Direction.ASC : Sort.Direction.DESC, request.getSort());
Pageable pageable = PageRequest.of(request.getPage() - 1, request.getSize(), sort); Pageable pageable = PageRequest.of(request.getPage() - 1, request.getSize(), sort);
Page<Map<String, Objects>> page = msgDao.getGroupList(request, pageable); Page<Map<String, Objects>> page = msgDao.getGroupList(request, pageable);
...@@ -100,7 +101,7 @@ public class MsgServiceImpl implements MsgService { ...@@ -100,7 +101,7 @@ public class MsgServiceImpl implements MsgService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void add(MsgDTO.addDto dto) { public void add(MsgDTO dto) {
if (Objects.nonNull(dto.getGroupId())) { if (Objects.nonNull(dto.getGroupId())) {
OrgGroupEntity group = groupDao.getByGroupId(dto.getGroupId()); OrgGroupEntity group = groupDao.getByGroupId(dto.getGroupId());
dto.setBranchId(group.getBranchId()); dto.setBranchId(group.getBranchId());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!