Commit 71a7c86f by Ren Ping

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

2 parents c46cb0ab a7f9ec8e
...@@ -2,6 +2,7 @@ package com.dituhui.pea.pojo; ...@@ -2,6 +2,7 @@ package com.dituhui.pea.pojo;
import java.util.List; import java.util.List;
import com.dituhui.pea.pojo.user.UserMenuSettingInfo;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
...@@ -26,5 +27,6 @@ public class UserLoginDTO { ...@@ -26,5 +27,6 @@ public class UserLoginDTO {
private List<RoleInfo> roles; private List<RoleInfo> roles;
private List<ResourceInfo> menus; private List<ResourceInfo> menus;
private List<OrganizationDTO> auths; private List<OrganizationDTO> auths;
private List<UserMenuSettingInfo> settings;
} }
...@@ -82,7 +82,8 @@ public class EngineerUtils { ...@@ -82,7 +82,8 @@ public class EngineerUtils {
Predicate engineerCodePredicate = criteriaBuilder.like(root.get("engineerCode"), "%" + keyword + "%"); Predicate engineerCodePredicate = criteriaBuilder.like(root.get("engineerCode"), "%" + keyword + "%");
Predicate mobilePredicate = criteriaBuilder.like(root.get("phone"), "%" + keyword + "%"); Predicate mobilePredicate = criteriaBuilder.like(root.get("phone"), "%" + keyword + "%");
Predicate msgContentPredicate = criteriaBuilder.like(root.get("name"), "%" + keyword + "%"); Predicate msgContentPredicate = criteriaBuilder.like(root.get("name"), "%" + keyword + "%");
predicates.add(criteriaBuilder.or(engineerCodePredicate, mobilePredicate, msgContentPredicate)); Predicate statusContentPredicate = criteriaBuilder.equal(root.get("beanStatus"), 1);
predicates.add(criteriaBuilder.or(engineerCodePredicate, mobilePredicate, msgContentPredicate, statusContentPredicate));
return criteriaBuilder.and(predicates.toArray(new Predicate[0])); return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
} }
......
...@@ -28,11 +28,11 @@ public interface CapacityStatisticDao extends JpaRepository<CapacityTeamStatEnti ...@@ -28,11 +28,11 @@ public interface CapacityStatisticDao extends JpaRepository<CapacityTeamStatEnti
" ifnull(sum(cap_used),0)+ifnull(sum(cap_used_travel),0) as cap_used, " + " ifnull(sum(cap_used),0)+ifnull(sum(cap_used_travel),0) as cap_used, " +
" sum(a.cap_left) cap_left " + " sum(a.cap_left) cap_left " +
" FROM org_team ot " + " FROM org_team ot " +
" LEFT JOIN org_group og ON og.group_id = ot.group_id AND og.status = 1 " + " INNER JOIN org_group og ON og.group_id = ot.group_id AND og.status = 1 " +
" LEFT JOIN org_team_engineer ote ON ote.team_id = ot.team_id AND ot.status =1 AND ote.status =1 " + " INNER JOIN org_team_engineer ote ON ote.team_id = ot.team_id AND ot.status =1 AND ote.status =1 " +
" LEFT JOIN capacity_engineer_stat a ON a.engineer_code = ote.engineer_code " + " INNER JOIN capacity_engineer_stat a ON a.engineer_code = ote.engineer_code " +
" LEFT JOIN v_engineer_skill v ON a.engineer_code = v.engineer_code " + " INNER JOIN v_engineer_skill v ON a.engineer_code = v.engineer_code " +
" LEFT JOIN engineer_info z ON a.engineer_code = z.engineer_code AND z.bean_status = 1 " + " INNER JOIN engineer_info z ON a.engineer_code = z.engineer_code AND z.bean_status = 1 " +
" WHERE ot.group_id= :groupId AND a.workday= :date " + " WHERE ot.group_id= :groupId AND a.workday= :date " +
" GROUP BY a.workday, v.layer_id, v.layer", nativeQuery = true) " GROUP BY a.workday, v.layer_id, v.layer", nativeQuery = true)
List<Object[]> sumGroupCapacity(String date, String groupId); List<Object[]> sumGroupCapacity(String date, String groupId);
...@@ -42,12 +42,12 @@ public interface CapacityStatisticDao extends JpaRepository<CapacityTeamStatEnti ...@@ -42,12 +42,12 @@ public interface CapacityStatisticDao extends JpaRepository<CapacityTeamStatEnti
" ifnull(sum(cap_used),0)+ifnull(sum(cap_used_travel),0) as cap_used, \n" + " ifnull(sum(cap_used),0)+ifnull(sum(cap_used_travel),0) as cap_used, \n" +
" sum(a.cap_left) cap_left \n" + " sum(a.cap_left) cap_left \n" +
" FROM org_team ot \n" + " FROM org_team ot \n" +
" LEFT JOIN org_group og ON og.group_id = ot.group_id AND og.status = 1\n" + " INNER JOIN org_group og ON og.group_id = ot.group_id AND og.status = 1\n" +
" LEFT JOIN org_branch ob ON ob.branch_id = og.branch_id AND ob.status = 1\n" + " INNER JOIN org_branch ob ON ob.branch_id = og.branch_id AND ob.status = 1\n" +
" LEFT JOIN org_team_engineer ote ON ote.team_id = ot.team_id AND ot.status = 1 AND ote.status =1\n" + " INNER JOIN org_team_engineer ote ON ote.team_id = ot.team_id AND ot.status = 1 AND ote.status =1\n" +
" LEFT JOIN capacity_engineer_stat a ON a.engineer_code = ote.engineer_code \n" + " INNER JOIN capacity_engineer_stat a ON a.engineer_code = ote.engineer_code \n" +
" LEFT JOIN v_engineer_skill v ON a.engineer_code = v.engineer_code\n" + " INNER JOIN v_engineer_skill v ON a.engineer_code = v.engineer_code\n" +
" LEFT JOIN engineer_info z ON a.engineer_code = z.engineer_code AND z.bean_status = 1 \n" + " INNER JOIN engineer_info z ON a.engineer_code = z.engineer_code AND z.bean_status = 1 \n" +
" WHERE ot.branch_id = :branchId AND a.workday= :date \n" + " WHERE ot.branch_id = :branchId AND a.workday= :date \n" +
" GROUP BY a.workday, v.layer_id, v.layer ", nativeQuery = true) " GROUP BY a.workday, v.layer_id, v.layer ", nativeQuery = true)
List<Object[]> sumBranchCapacity(String date, String branchId); List<Object[]> sumBranchCapacity(String date, String branchId);
......
...@@ -53,7 +53,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -53,7 +53,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
@Query(value = "SELECT ei.* FROM skill_info si LEFT JOIN skill_group sg ON sg.skill_group_code =si.skill_group_code " @Query(value = "SELECT ei.* FROM skill_info si LEFT JOIN skill_group sg ON sg.skill_group_code =si.skill_group_code "
+ " LEFT JOIN engineer_skill_group esg ON sg.skill_group_code = esg.skill_group_code " + " LEFT JOIN engineer_skill_group esg ON sg.skill_group_code = esg.skill_group_code "
+ " LEFT JOIN engineer_info ei ON esg.engineer_code = ei.engineer_code " + " LEFT JOIN engineer_info ei ON esg.engineer_code = ei.engineer_code "
+ " WHERE si.brand = :brand AND si.type= :productType AND si.skill = :skill " + " WHERE ei.bean_status = 1 and esg.status = 1 and si.brand = :brand AND si.type= :productType AND si.skill = :skill "
+ " AND group_id = :groupId ", nativeQuery = true) + " AND group_id = :groupId ", nativeQuery = true)
Set<EngineerInfoEntity> listByBrandAndTypeAndSkillAndGroupId(@Param("brand") String brand, @Param("productType") String productType, Set<EngineerInfoEntity> listByBrandAndTypeAndSkillAndGroupId(@Param("brand") String brand, @Param("productType") String productType,
@Param("skill") String skill, @Param("groupId") String groupId); @Param("skill") String skill, @Param("groupId") String groupId);
...@@ -71,7 +71,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -71,7 +71,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
" LEFT JOIN engineer_skill_group esg ON sg.skill_group_code = esg.skill_group_code " + " LEFT JOIN engineer_skill_group esg ON sg.skill_group_code = esg.skill_group_code " +
" LEFT JOIN engineer_info ei ON esg.engineer_code = ei.engineer_code " + " LEFT JOIN engineer_info ei ON esg.engineer_code = ei.engineer_code " +
" LEFT JOIN org_team_engineer ote ON ote.engineer_code = ei.engineer_code " + " LEFT JOIN org_team_engineer ote ON ote.engineer_code = ei.engineer_code " +
" WHERE si.brand = :brand AND si.type= :productType AND si.skill = :skill " + " WHERE ei.bean_status = 1 and si.brand = :brand AND si.type= :productType AND si.skill = :skill " +
" AND ote.team_id = :teamId AND ote.status = 1 AND esg.status = 1", nativeQuery = true) " AND ote.team_id = :teamId AND ote.status = 1 AND esg.status = 1", nativeQuery = true)
Set<EngineerInfoEntity> listByBrandAndTypeAndSkillAndTeamId(@Param("brand") String brand, @Param("productType") String productType, Set<EngineerInfoEntity> listByBrandAndTypeAndSkillAndTeamId(@Param("brand") String brand, @Param("productType") String productType,
@Param("skill") String skill, @Param("teamId") String teamId); @Param("skill") String skill, @Param("teamId") String teamId);
...@@ -90,7 +90,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -90,7 +90,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
" ) AS tabA" + " ) AS tabA" +
" LEFT JOIN org_team_engineer ote ON tabA.engineer_code = ote.engineer_code " + " LEFT JOIN org_team_engineer ote ON tabA.engineer_code = ote.engineer_code " +
" LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " + " LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " +
"WHERE ote.team_id = :teamId AND ote.status = 1" + "WHERE ei.bean_status = 1 and ote.team_id = :teamId AND ote.status = 1" +
" order by ei.engineer_code desc ", nativeQuery = true) " order by ei.engineer_code desc ", nativeQuery = true)
Set<EngineerInfoEntity> listBySkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("teamId") String teamId); Set<EngineerInfoEntity> listBySkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("teamId") String teamId);
...@@ -107,14 +107,14 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -107,14 +107,14 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
" WHERE esg.status = 1 AND esg.skill_group_code IN( :skillGroupCodes ) group by esg.engineer_code having count(esg.skill_group_code) = :skillGroupNumber " + " WHERE esg.status = 1 AND esg.skill_group_code IN( :skillGroupCodes ) group by esg.engineer_code having count(esg.skill_group_code) = :skillGroupNumber " +
" ) AS tabA " + " ) AS tabA " +
" LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " + " LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code " +
" WHERE ei.group_id = :groupId AND ei.id is not null " + " WHERE ei.bean_status = 1 and ei.group_id = :groupId AND ei.id is not null " +
" order by ei.engineer_code desc ", nativeQuery = true) " order by ei.engineer_code desc ", nativeQuery = true)
Set<EngineerInfoEntity> listByBranchSkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("groupId") String groupId); Set<EngineerInfoEntity> listByBranchSkillGroupCode(@Param("skillGroupCodes") Collection<String> skillGroupCodes, @Param("skillGroupNumber") int skillGroupNumber, @Param("groupId") String groupId);
@Query(value = "SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code " + @Query(value = "SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code " +
"left join skill_info si on si.skill_group_code = esg.skill_group_code left join map_layer_customize mlc on mlc.layer_id = si.layer_id " + "left join skill_info si on si.skill_group_code = esg.skill_group_code left join map_layer_customize mlc on mlc.layer_id = si.layer_id " +
" WHERE si.brand = :brand and si.`type` = :productType and si.skill_code = :skillCode and ei.group_id in ( :teamIds ) " + " WHERE ei.bean_status = 1 AND esg.status = 1 AND mlc.status = 1 and si.brand = :brand and si.`type` = :productType and si.skill_code = :skillCode and ei.group_id in ( :teamIds ) " +
" order by mlc.priority ", nativeQuery = true) " order by mlc.priority ", nativeQuery = true)
List<EngineerInfoEntity> listBrandAndSkillCodeAndTeamIdIn(@Param("brand") String brand, @Param("productType") String productType, List<EngineerInfoEntity> listBrandAndSkillCodeAndTeamIdIn(@Param("brand") String brand, @Param("productType") String productType,
@Param("skillCode") String skillCode, @Param("teamIds") List<String> teamIds); @Param("skillCode") String skillCode, @Param("teamIds") List<String> teamIds);
...@@ -122,7 +122,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -122,7 +122,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
@Query(value = "SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code " + @Query(value = "SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code " +
"left join skill_info si on si.skill_group_code = esg.skill_group_code left join map_layer_customize mlc on mlc.layer_id = si.layer_id " + "left join skill_info si on si.skill_group_code = esg.skill_group_code left join map_layer_customize mlc on mlc.layer_id = si.layer_id " +
" WHERE si.brand = :brand and si.`type` = :productType and si.skill = :skill and ei.group_id in ( :teamIds ) " + " WHERE ei.bean_status = 1 AND esg.status = 1 AND mlc.status = 1 and si.brand = :brand and si.`type` = :productType and si.skill = :skill and ei.group_id in ( :teamIds ) " +
" order by mlc.priority ", nativeQuery = true) " order by mlc.priority ", nativeQuery = true)
List<EngineerInfoEntity> listBrandAndSkillAndTeamIdIn(@Param("brand") String brand, @Param("productType") String productType, List<EngineerInfoEntity> listBrandAndSkillAndTeamIdIn(@Param("brand") String brand, @Param("productType") String productType,
@Param("skill") String skill, @Param("teamIds") List<String> teamIds); @Param("skill") String skill, @Param("teamIds") List<String> teamIds);
...@@ -130,7 +130,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -130,7 +130,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
@Query(value = "SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code " + @Query(value = "SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code " +
"left join skill_info si on si.skill_group_code = esg.skill_group_code left join map_layer_customize mlc on mlc.layer_id = si.layer_id " + "left join skill_info si on si.skill_group_code = esg.skill_group_code left join map_layer_customize mlc on mlc.layer_id = si.layer_id " +
" WHERE si.brand = :brand and si.`type` = :productType and si.skill = :skill and ei.engineer_code in ( :engineerCodes ) " + " WHERE ei.bean_status = 1 AND esg.status = 1 AND mlc.status = 1 and si.brand = :brand and si.`type` = :productType and si.skill = :skill and ei.engineer_code in ( :engineerCodes ) " +
" order by mlc.priority ", nativeQuery = true) " order by mlc.priority ", nativeQuery = true)
List<EngineerInfoEntity> listBrandAndSkillAndEngineerCodes(@Param("brand") String brand, @Param("productType") String productType, List<EngineerInfoEntity> listBrandAndSkillAndEngineerCodes(@Param("brand") String brand, @Param("productType") String productType,
@Param("skill") String skill, @Param("engineerCodes") List<String> engineerCodes); @Param("skill") String skill, @Param("engineerCodes") List<String> engineerCodes);
...@@ -143,7 +143,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ ...@@ -143,7 +143,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
* @return 工作队下没有工程师则返回空 * @return 工作队下没有工程师则返回空
*/ */
@Query(value = "SELECT ei.* from org_team_engineer ote left join engineer_info ei ON ote.engineer_code = ei.engineer_code " + @Query(value = "SELECT ei.* from org_team_engineer ote left join engineer_info ei ON ote.engineer_code = ei.engineer_code " +
"WHERE ote.team_id = :teamId AND ote.engineer_code = :engineerCode AND ote.`status` = 1", nativeQuery = true) "WHERE ei.bean_status = 1 AND ote.team_id = :teamId AND ote.engineer_code = :engineerCode AND ote.`status` = 1", nativeQuery = true)
EngineerInfoEntity selectEngineerByEngineerCodeAndTeamId(@Param("engineerCode") String engineerCode, @Param("teamId") String teamId); EngineerInfoEntity selectEngineerByEngineerCodeAndTeamId(@Param("engineerCode") String engineerCode, @Param("teamId") String teamId);
@Query(value = "SELECT DISTINCT esg.engineer_code FROM engineer_skill_group esg WHERE engineer_code in (:engineerCodes) and skill_group_code in (:skillGroupCodes) and status = 1", nativeQuery = true) @Query(value = "SELECT DISTINCT esg.engineer_code FROM engineer_skill_group esg WHERE engineer_code in (:engineerCodes) and skill_group_code in (:skillGroupCodes) and status = 1", nativeQuery = true)
......
...@@ -29,7 +29,7 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> { ...@@ -29,7 +29,7 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> {
public List<OrgGroupEntity> findByGroupIdIn(List<String> ids); public List<OrgGroupEntity> findByGroupIdIn(List<String> ids);
@Query(value = "SELECT * from org_group og left join org_team ot on og.group_id = ot.group_id WHERE ot.team_id in (:teamIds) order by og.category ", nativeQuery = true) @Query(value = "SELECT * from org_group og left join org_team ot on og.group_id = ot.group_id WHERE og.status = 1 and ot.status = 1 and ot.team_id in (:teamIds) order by og.category ", nativeQuery = true)
List<OrgGroupEntity> findByTeamIdIn(@Param("teamIds") List<String> teamIds); List<OrgGroupEntity> findByTeamIdIn(@Param("teamIds") List<String> teamIds);
/** /**
...@@ -39,7 +39,7 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> { ...@@ -39,7 +39,7 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> {
* @return 工作队ID * @return 工作队ID
*/ */
@Query(value = "SELECT og.* FROM org_group og left join org_team ot ON ot.group_id = og.group_id " @Query(value = "SELECT og.* FROM org_group og left join org_team ot ON ot.group_id = og.group_id "
+ "WHERE ot.team_id = :teamId",nativeQuery = true) + "WHERE og.status = 1 and ot.status = 1 and ot.team_id = :teamId",nativeQuery = true)
OrgGroupEntity queryGroupByTeam(String teamId); OrgGroupEntity queryGroupByTeam(String teamId);
OrgGroupEntity getByCitycodeListLike(String citycodeList); OrgGroupEntity getByCitycodeListLike(String citycodeList);
......
...@@ -39,7 +39,7 @@ public class BeanMqMessageEntity implements Serializable { ...@@ -39,7 +39,7 @@ public class BeanMqMessageEntity implements Serializable {
* 是否同步成功,0:失败,1:成功 默认成功 * 是否同步成功,0:失败,1:成功 默认成功
*/ */
@Column(name = "success") @Column(name = "success")
private Integer success = 1; private Boolean success = Boolean.TRUE;
@Column(name = "create_time", nullable = false, updatable = false, columnDefinition = "timestamp default current_timestamp") @Column(name = "create_time", nullable = false, updatable = false, columnDefinition = "timestamp default current_timestamp")
......
...@@ -2,6 +2,7 @@ package com.dituhui.pea.order.entity; ...@@ -2,6 +2,7 @@ package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Where;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -10,6 +11,7 @@ import java.time.LocalDateTime; ...@@ -10,6 +11,7 @@ import java.time.LocalDateTime;
@Entity @Entity
@Table(name = "engineer_info") @Table(name = "engineer_info")
@EqualsAndHashCode @EqualsAndHashCode
@Where(clause = "bean_status = 1")
public class EngineerInfoEntity { public class EngineerInfoEntity {
/** /**
* 工程师id * 工程师id
......
package com.dituhui.pea.order.entity; package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.Where;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -9,6 +10,7 @@ import java.util.Date; ...@@ -9,6 +10,7 @@ import java.util.Date;
@Entity @Entity
@Data @Data
@Table(name = "org_branch") @Table(name = "org_branch")
@Where(clause = "status = 1")
public class OrgBranchEntity { public class OrgBranchEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
......
package com.dituhui.pea.order.entity; package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.Where;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -9,6 +10,7 @@ import java.util.Date; ...@@ -9,6 +10,7 @@ import java.util.Date;
@Entity @Entity
@Data @Data
@Table(name = "org_cluster") @Table(name = "org_cluster")
@Where(clause = "status = 1")
public class OrgClusterEntity { public class OrgClusterEntity {
@Id @Id
......
package com.dituhui.pea.order.entity; package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.Where;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -9,6 +10,7 @@ import java.util.Date; ...@@ -9,6 +10,7 @@ import java.util.Date;
@Entity @Entity
@Data @Data
@Table(name = "org_group") @Table(name = "org_group")
@Where(clause = "status = 1")
public class OrgGroupEntity { public class OrgGroupEntity {
/** /**
......
...@@ -2,6 +2,7 @@ package com.dituhui.pea.order.entity; ...@@ -2,6 +2,7 @@ package com.dituhui.pea.order.entity;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hibernate.annotations.Where;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -10,6 +11,7 @@ import java.time.LocalDateTime; ...@@ -10,6 +11,7 @@ import java.time.LocalDateTime;
@Table(name = "org_team") @Table(name = "org_team")
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@Where(clause = "status = 1")
public class OrgTeamEntity { public class OrgTeamEntity {
@Id @Id
......
...@@ -58,7 +58,7 @@ public interface IBeanRemoteService { ...@@ -58,7 +58,7 @@ public interface IBeanRemoteService {
* 查询BEAN账号详情 * 查询BEAN账号详情
* *
* @param accessToken ACCESS_TOKEN * @param accessToken ACCESS_TOKEN
* @param workNo 账号中心ID * @param workNo hrId
* @return 人员详情信息 * @return 人员详情信息
* @apiNote 根据账号ID(账号中心ID)从BEAN查询账号详情,包括账号姓名、联系方式、所属部门、技能资质等信息 * @apiNote 根据账号ID(账号中心ID)从BEAN查询账号详情,包括账号姓名、联系方式、所属部门、技能资质等信息
*/ */
......
...@@ -39,4 +39,7 @@ public interface ISaaSRemoteService { ...@@ -39,4 +39,7 @@ public interface ISaaSRemoteService {
@PostMapping("/saas/baseData/area/getDistrictByRegion") @PostMapping("/saas/baseData/area/getDistrictByRegion")
public String getAdminDistrict(@RequestParam("ak") String ak, @RequestBody AdministrativeDistrictReq districtReq); public String getAdminDistrict(@RequestParam("ak") String ak, @RequestBody AdministrativeDistrictReq districtReq);
@GetMapping("/saas/baseData/area/getAreaById")
public String getAreaById(@RequestParam String ak, @RequestParam String areaId, @RequestParam Boolean needPoints, @RequestParam Boolean layerStyle);
} }
...@@ -113,7 +113,7 @@ public class CalcOrgCapacityScheduler { ...@@ -113,7 +113,7 @@ public class CalcOrgCapacityScheduler {
} }
} }
private void calcOneGroup(String date, String groupId) { public void calcOneGroup(String date, String groupId) {
// 重新计算1个分组/分站 1天的容量 // 重新计算1个分组/分站 1天的容量
List<Object[]> nativeQueryResult = capacityStatisticDao.sumGroupCapacity(date, groupId); List<Object[]> nativeQueryResult = capacityStatisticDao.sumGroupCapacity(date, groupId);
List<CapacityOrgStatDTO> stats = new ArrayList<>(); List<CapacityOrgStatDTO> stats = new ArrayList<>();
......
...@@ -192,17 +192,29 @@ public class BeanRemoteServiceImpl { ...@@ -192,17 +192,29 @@ public class BeanRemoteServiceImpl {
for (BeanAccountInfo account : userlist) { for (BeanAccountInfo account : userlist) {
log.info("开始同步人员信息{}", JsonUtil.toJson(account)); log.info("开始同步人员信息{}", JsonUtil.toJson(account));
BeanR<BeanUserDetail> beanUserDetailBeanR = beanRemoteService.userDetail(getAccessToken(), account.getHrId()); saveEngineerInfoByHrId(departId, account.getHrId(), account.getUserName());
}
}
/**
* 根据hrId 获取BEAN自有账户(工程师)详情,并存储工程师基本信息和业务信息, (会自动忽略不存在工号的账户信息- 库里如果已有相关账户会被覆盖)
*
* @param departId 部门ID, (这里只能传分部)
* @param hrId bean 用户列表接口提供的 hrId
* @param userName 用户名
*/
public void saveEngineerInfoByHrId(String departId, String hrId, String userName) {
BeanR<BeanUserDetail> beanUserDetailBeanR = beanRemoteService.userDetail(getAccessToken(), hrId);
log.info("[查询BEAN用户详情]【/api/openapi/user/queryDetail】返回值-------------------->{}", JsonUtil.toJson(beanUserDetailBeanR)); log.info("[查询BEAN用户详情]【/api/openapi/user/queryDetail】返回值-------------------->{}", JsonUtil.toJson(beanUserDetailBeanR));
BeanUserDetail userDetailInfo = beanUserDetailBeanR.getData(); BeanUserDetail userDetailInfo = beanUserDetailBeanR.getData();
if (!beanUserDetailBeanR.getSuccess() || Objects.isNull(userDetailInfo)) { if (!beanUserDetailBeanR.getSuccess() || Objects.isNull(userDetailInfo)) {
log.error("用户详情列表未获取到用户:{}-{}的详细信息 , 错误信息:{}", account.getUserName(), account.getCenterId(), beanUserDetailBeanR.getMessage()); log.error("用户详情列表未获取到用户:{}-{}的详细信息 , 错误信息:{}", userName, hrId, beanUserDetailBeanR.getMessage());
continue; return;
} }
String engineerCode = userDetailInfo.getWorkNo(); String engineerCode = userDetailInfo.getWorkNo();
if (StringUtils.isBlank(engineerCode)) { if (StringUtils.isBlank(engineerCode)) {
log.warn("分站:{}工程师{}没有工号", departId, userDetailInfo.getUsername()); log.warn("分站:{}工程师{}没有工号", departId, userDetailInfo.getUsername());
continue; return;
} }
final Address address = userDetailInfo.getAddress(); final Address address = userDetailInfo.getAddress();
//fixme 正式同步需移除当前逻辑 //fixme 正式同步需移除当前逻辑
...@@ -212,9 +224,10 @@ public class BeanRemoteServiceImpl { ...@@ -212,9 +224,10 @@ public class BeanRemoteServiceImpl {
engineerInfoDao.flush(); engineerInfoDao.flush();
//保存业务属性信息--常用出发地信息 //保存业务属性信息--常用出发地信息
EngineerBusinessEntity engineerBusiness = getEngineerBusiness(engineerCode, address); EngineerBusinessEntity engineerBusiness = getEngineerBusiness(engineerCode, address);
if (engineerBusiness == null){ continue;} if (engineerBusiness == null) {
engineerBusinessDao.save(engineerBusiness); return;
} }
engineerBusinessDao.save(engineerBusiness);
} }
private EngineerInfoEntity getEngineerInfoEntity(String departId, String engineerCode, BeanUserDetail userDetailInfo, Address address) { private EngineerInfoEntity getEngineerInfoEntity(String departId, String engineerCode, BeanUserDetail userDetailInfo, Address address) {
......
...@@ -86,8 +86,8 @@ scheduler: ...@@ -86,8 +86,8 @@ scheduler:
day-offset-end: 20 day-offset-end: 20
calc-org-capacity: calc-org-capacity:
# 8-20点,每小时1次 # 每小时两次, 分别于10分以及 40分执行
cron-expr: 0 0 1-23 * * ? cron-expr: 0 10,40 * * * ?
day-offset-begin: 0 day-offset-begin: 0
day-offset-end: 20 day-offset-end: 20
......
...@@ -216,6 +216,9 @@ public class UserService { ...@@ -216,6 +216,9 @@ public class UserService {
} }
} }
userDTO.setAuths(allOrgs); userDTO.setAuths(allOrgs);
// 获取用户配置
userDTO.setSettings(getSettings(userDTO.getId()));
return userDTO; return userDTO;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!