Commit c0b2eab2 authored by KeYong's avatar KeYong

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

parents 57f4064d 848168e8
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.feign.TzsFeign;
import com.yeejoin.amos.patrol.business.param.PlanInfoPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
......@@ -39,6 +40,8 @@ public class PlanController extends AbstractBaseController {
@Autowired
JcsFeignClient jcsFeignClient;
@Autowired
TzsFeign tzsFeign;
/**
* 新加接口
......@@ -153,36 +156,38 @@ public class PlanController extends AbstractBaseController {
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> map = new HashMap<String, Object>();
HashMap<String, Object> map = new HashMap<>();
map.put("org_code", loginOrgCode);
map.put("user_id", userId);
Map<String, String> deptMap = new HashMap<>();
Set<String> departmentIds = new HashSet<>();
List<String> depts = Arrays.asList(param.getUserDept().split(","));
depts.stream().forEach(dept -> {
deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
});
for (String entry : deptMap.keySet()) {
String entryValue = deptMap.get(entry);
departmentIds.add(entryValue);
}
StringBuffer departmentIdBuffer = new StringBuffer();
Iterator<String> it = departmentIds.iterator();
while (it.hasNext()) {
departmentIdBuffer.append(it.next()).append(",");
}
if(departmentIds.size() > 0){
FeignClientResult<List<Map<String, Object>>> departmentModeldate= jcsFeignClient.selectByIdDeptList
(departmentIdBuffer.toString().substring(0, departmentIdBuffer.toString().length() - 1));
List<Map<String, Object>> departmentModels = departmentModeldate.getResult();
if(departmentModels!=null&&departmentModels.size()>0){
Map<String, Object> mapj= departmentModels.get(0);
param.setBizOrgCode(mapj.get("bizOrgCode").toString());
param.setBizOrgName(mapj.get("bizOrgName").toString());
}
}
// Map<String, String> deptMap = new HashMap<>();
// Set<String> departmentIds = new HashSet<>();
// List<String> groupIds = Arrays.asList(param.getUserGroupId().split(","));
// depts.stream().forEach(dept -> {
// deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
// });
// for (String entry : deptMap.keySet()) {
// String entryValue = deptMap.get(entry);
// departmentIds.add(entryValue);
// }
// StringBuffer departmentIdBuffer = new StringBuffer();
// Iterator<String> it = departmentIds.iterator();
// while (it.hasNext()) {
// departmentIdBuffer.append(it.next()).append(",");
// }
// if(departmentIds.size() > 0){
// FeignClientResult<List<Map<String, Object>>> departmentModeldate= jcsFeignClient.selectByIdDeptList
// (departmentIdBuffer.toString().substring(0, departmentIdBuffer.toString().length() - 1));
// List<Map<String, Object>> departmentModels = departmentModeldate.getResult();
// if(departmentModels!=null&&departmentModels.size()>0){
// Map<String, Object> mapj= departmentModels.get(0);
// param.setBizOrgCode(mapj.get("bizOrgCode").toString());
// param.setBizOrgName(mapj.get("bizOrgName").toString());
// }
// }
param.setBizOrgCode(loginOrgCode);
param.setBizOrgName(getCompanyName(reginParams));
map.put("param", param);
Plan plan = planService.addPlan(map);
Object ob = plan != null ? ToJson.tojson(plan) : null;
......
......@@ -27,7 +27,7 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
@Modifying
@Transactional
@Query(value = "UPDATE p_plan SET is_delete = 1,`status` = 1 WHERE id IN (?1)", nativeQuery = true)
@Query(value = "UPDATE p_plan SET is_delete = 1,status = 1 WHERE id IN (?1)", nativeQuery = true)
void updatePlanDel(List<Long> ids);
Plan findByOriginalId(String originalId);
......
......@@ -14,26 +14,26 @@ public interface IPlanTaskDetailDao extends BaseDao<PlanTaskDetail, Long> {
@Transactional
@Query(value = "DELETE FROM p_plan_task_detail WHERE point_id IN (?1)", nativeQuery = true)
void deletePlanTaskDetailByPointId(List<Long> pointIds);
/**
* 根据任务id获取任务详情
* @param planTaskId
* @return
*/
public List<PlanTaskDetail> findAllByTaskNo(Long planTaskId);
/**
* 根据任务id及状态获取计划详情
* @param planTaskId
* @return
*/
public List<PlanTaskDetail> findAllByTaskNoAndStatus(Long planTaskId,String status);
int countByIsFinish(int status);
int countByIsFinishAndTaskNo(int status,Long taskNo);
@Modifying
@Transactional
@Query(value = "DELETE FROM p_plan_task_detail WHERE task_no IN (?1)", nativeQuery = true)
......@@ -42,6 +42,6 @@ public interface IPlanTaskDetailDao extends BaseDao<PlanTaskDetail, Long> {
@Query(value = "select * FROM p_plan_task_detail WHERE point_id IN (?1)", nativeQuery = true)
List<PlanTaskDetail> findALLByPointId(Long pointId);
@Query(value = "select * FROM p_plan_task_detail WHERE id = ?1 AND `status` = ?2", nativeQuery = true)
@Query(value = "select * FROM p_plan_task_detail WHERE id = ?1 AND status = ?2", nativeQuery = true)
List<PlanTaskDetail> findAllByIdAndStatus(long id, String status);
}
......@@ -48,17 +48,17 @@ public class PlanServiceImpl implements IPlanService {
public Plan addPlan(HashMap<String, Object> map) {
Plan param = (Plan) map.get("param");
String userDept = param.getUserDept();
String[] userDeptArr = userDept.split(",");
// String userGroupId = param.getUserGroupId();
// String[] userGroupIdArr = userGroupId.split(",");
StringBuilder stringBuilder = new StringBuilder();
for(String str : userDeptArr) {
if(stringBuilder.length() > 0){
stringBuilder.append("," + str.split("@")[0]);
}else{
stringBuilder.append(str.split("@")[0]);
}
}
// for(String str : userGroupIdArr) {
// if(stringBuilder.length() > 0){
// stringBuilder.append(",").append(str.split("@")[0]);
// }else{
// stringBuilder.append(str.split("@")[0]);
// }
//
// }
param.setUserId(stringBuilder.toString());
String org_code = map.get("org_code") == null ? "":map.get("org_code").toString();
......
......@@ -670,8 +670,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
//3.生成含有人员信息的日期执行数据
// 获取路线中的企业类型和设备类型
// Route route = routeDao.getOne(plan.getRouteId());
Route route = new Route();
Route route = routeDao.getOne(plan.getRouteId());
// Route route = new Route();
List<UserDetailsDto> userDetailsDtos = new ArrayList<>();
// 获取用户组下所有的用户信息
try{
......
......@@ -512,10 +512,10 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String,
return null;
}
List<HashMap<String, Object>> wholeList = new ArrayList<>();
// String deviceType = route.getDeviceType();
// String unitType = route.getUnitType();
String deviceType = "3000";
String unitType = "1232";
String deviceType = route.getEquipType();
String unitType = route.getEnterpriseType();
// String deviceType = "3000";
// String unitType = "1232";
if (!CollectionUtils.isEmpty(userDetailsDtoList)) {
Map<String, List<UserDetailsDto>> userDetailsDtoMap = userDetailsDtoList.stream().
......
......@@ -20,7 +20,7 @@ ribbon.MaxAutoRetries = 1
xiy_amos_satety_business
spring.reactor.debug-agent.enabled=true
#DB properties:
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=business&allowMultiQueries=true
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=business&allowMultiQueries=true&stringtype=unspecified
spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023
spring.datasource.driver-class-name = cn.com.vastbase.Driver
......@@ -38,7 +38,7 @@ security.appKey=studio_normalapp_3056965
#redis 配置
spring.redis.database=1
spring.redis.host=172.16.10.210
spring.redis.port=6379
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
......
......@@ -112,51 +112,53 @@
<!--统计-巡检计划 -->
<select id="countPlanInfoData" resultType="long">
SELECT
count(1) AS total_num
count(1) AS total_num
FROM
p_plan a ,
p_route b
p_plan a ,
p_route b
WHERE
a.route_Id = b.id and a.is_delete = 0
<if test="planName!=null"> and a.name like concat(concat('%',#{planName}),'%')</if>
<if test="planType!=null"> and a.plan_Type = #{planType}</if>
<if test="routeId!=null"> and a.route_Id = #{routeId}</if>
<if test="remark!=null"> and a.remark like concat(concat('%',#{remark}),'%')</if>
<if test="deptId!=null"> and a.dept_id = #{deptId}</if>
<if test="orgCode!=null"> and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="userId!=null"> and FIND_IN_SET(#{userId},a.user_id)</if>
<if test="bizOrgCode!=null"> and b.biz_org_code like concat(concat('%',#{bizOrgCode}),'%')</if>
a.route_Id = b.id and a.is_delete = 0
<if test="planName!=null"> and a.name like concat('%',#{planName}::varchar,'%')</if>
<if test="planType!=null"> and a.plan_Type = #{planType}</if>
<if test="routeId!=null"> and a.route_Id = #{routeId}</if>
<if test="remark!=null"> and a.remark1 like concat('%',#{remark}::varchar,'%')</if>
<if test="orgCode!=null"> and (a.org_Code like concat (#{orgCode}::varchar,'-%')or a.org_code= #{orgCode})</if>
<if test="userId!=null"> and FIND_IN_SET(#{userId}::varchar,a.user_id)</if>
<if test="bizOrgCode!=null"> and b.biz_org_code like concat('%',#{bizOrgCode}::varchar,'%')</if>
</select>
<!--巡检计划查询 -->
<select id="getPlanInfo" resultType="java.util.HashMap">
SELECT
a.id,a.name , IFNULL(a.plan_begin,"") planBegin,a.status,
(case a.plan_type
when 1 THEN '天'
when 2 THEN '周'
when 3 THEN '月'
else '年' END) as planTypeName,
(case a.is_fixed_date
when 0 THEN '否'
else '是' END) as isFixedDateName,
IFNULL(a.plan_end,"") planEnd,a.plan_end planEnd,a.plan_type planType,
b.name routeName,a.route_id routeId,a.is_fixed_date isFixedDate,a.remark,a.remark1,
b.dept_name bizOrgCode
SELECT
a.id,a.name , IFNULL(a.plan_begin::varchar,'') planBegin,a.status,
(
case a.plan_type
when 1 THEN '天'
when 2 THEN '周'
when 3 THEN '月'
else '年'
end
) as planTypeName,
(
case a.is_fixed_date
when 0 THEN '否'
else '是'
end
) as isFixedDateName,
IFNULL(a.plan_end::varchar,'') planEnd,a.plan_end planEnd,a.plan_type planType,
b.name routeName,a.route_id routeId,a.is_fixed_date isFixedDate,a.remark,a.remark1,
b.dept_name bizOrgCode
FROM
p_plan a,
p_route b
p_plan a,
p_route b
WHERE
a.route_Id = b.id and a.is_delete = 0
<if test="planName!=null"> and a.name like concat(concat('%',#{planName}),'%')</if>
<if test="planType!=null"> and a.plan_Type = #{planType}</if>
<if test="routeId!=null"> and a.route_Id = #{routeId}</if>
<if test="remark!=null"> and a.remark1 like concat(concat('%',#{remark}),'%')</if>
<if test="orgCode!=null"> and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="userId!=null"> and FIND_IN_SET(#{userId},a.user_id)</if>
<if test="bizOrgCode!=null"> and b.biz_org_code like concat(concat('%',#{bizOrgCode}),'%')</if>
a.route_Id = b.id and a.is_delete = 0
<if test="planName!=null"> and a.name like concat('%',#{planName}::varchar,'%')</if>
<if test="planType!=null"> and a.plan_Type = #{planType}</if>
<if test="routeId!=null"> and a.route_Id = #{routeId}</if>
<if test="remark!=null"> and a.remark1 like concat('%',#{remark}::varchar,'%')</if>
<if test="orgCode!=null"> and (a.org_Code like concat (#{orgCode}::varchar,'-%')or a.org_code= #{orgCode})</if>
<if test="userId!=null"> and FIND_IN_SET(#{userId}::varchar,a.user_id)</if>
<if test="bizOrgCode!=null"> and b.biz_org_code like concat('%',#{bizOrgCode}::varchar,'%')</if>
order by a.id desc
<choose>
......@@ -176,18 +178,18 @@
p_route b
WHERE
a.is_delete = 0 and a.route_Id = b.id
<if test="planName!=null"> and a.name like concat(concat('%',#{planName}),'%')</if>
<if test="planName!=null"> and a.name like concat('%',#{planName}::varchar,'%')</if>
<if test="planType!=null"> and a.plan_Type = #{planType}</if>
<if test="routeId!=null"> and a.route_Id = #{routeId}</if>
<if test="remark!=null"> and a.remark like concat(concat('%',#{remark}),'%')</if>
<if test="orgCode!=null"> and (a.org_code LIKE CONCAT( #{orgCode}, '-%' ) or a.org_code= #{orgCode} )</if>
<if test="userId!=null"> and FIND_IN_SET(#{userId},a.user_id)</if>
<if test="bizOrgCode!=null"> and b.biz_org_code like concat(#{bizOrgCode},'%')</if>
<if test="remark!=null"> and a.remark like concat('%',#{remark}::varchar,'%')</if>
<if test="orgCode!=null"> and (a.org_code LIKE CONCAT(#{orgCode}::varchar, '-%' ) or a.org_code= #{orgCode} )</if>
<if test="userId!=null"> and FIND_IN_SET(#{userId}::varchar,a.user_id)</if>
<if test="bizOrgCode!=null"> and b.biz_org_code like concat(#{bizOrgCode}::varchar,'%')</if>
order by a.id
</select>
<select id="queryPlanListByOrgCode" resultType="Map">
select p.id, p.name from p_plan p where p.is_delete = 0 and and b.biz_org_code like concat(#{loginOrgCode},'%')
select p.id, p.name from p_plan p where p.is_delete = 0 and and b.biz_org_code like concat(#{loginOrgCode}::varchar,'%')
</select>
<update id="initUpdatePlanStatus">
......
......@@ -11,40 +11,27 @@
LEFT JOIN p_plan_task a ON a.id = b.task_no
LEFT JOIN p_point d ON d.id = b.point_id
<where>
<if test="pointNo!=null"> and d.point_no like concat('%',#{pointNo},'%')</if>
<if test="pointName!=null"> and d.name like concat('%',#{pointName},'%')</if>
<!-- AND-->
<!-- ((<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[>=]]> #{beginDate} AND a.end_Time <![CDATA[<=]]> #{endDate}</if>)-->
<!-- OR-->
<!-- (<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[<=]]> #{beginDate} AND a.end_Time <![CDATA[>=]]> #{beginDate}</if>)-->
<!-- OR-->
<!-- (<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[<=]]> #{endDate} AND a.end_Time <![CDATA[>=]]> #{endDate}</if>)-->
<!-- OR-->
<!-- (<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[<=]]> #{beginDate} AND a.end_Time <![CDATA[>=]]> #{endDate}</if>)-->
<!-- )-->
<if test="pointNo!=null">and d.point_no like concat('%',#{pointNo}::varchar,'%')</if>
<if test="pointName!=null">and d.name like concat('%',#{pointName}::varchar,'%')</if>
<if test="beginDate!=null and endDate!=null and endDate != '' and beginDate != ''">
and a.begin_Time <![CDATA[>=]]> #{beginDate} AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="beginDate=='' and endDate != null and endDate != ''">
AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="beginDate!=null and beginDate != '' and endDate == ''">
and a.begin_Time <![CDATA[>=]]> #{beginDate}
</if>
<if test="status!=null"> and b.is_finish = #{status}</if>
<if test="planId!=null"> and a.plan_id = #{planId}</if>
<if test="routeId!=null"> and a.route_id = #{routeId}</if>
<if test="orgCode!=null">
and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})
</if>
<if test="searchDay!=null and searchDay != '' and searchDay == 1">
and a.check_date = curdate()
</if>
<if test="status!=null">and b.is_finish = #{status}</if>
<if test="routeId!=null">and a.route_id = #{routeId}</if>
<if test="planId!=null">and a.plan_id = #{planId}</if>
<if test="bizOrgCode!=null">and a.org_code like concat (#{bizOrgCode}::varchar,'%')</if>
<if test="orgCode!=null">
and (a.org_Code like concat (#{orgCode}::varchar,'-%')or a.org_code= #{orgCode})
</if>
<if test="searchDay!=null and searchDay != '' and searchDay == 1">
and a.check_date = curdate()
</if>
</where>
order by b.id) t
</select>
......@@ -91,38 +78,23 @@
<include refid="planTaskInfoSql"/>
<where>
<if test="pointNo!=null">and d.point_no like concat('%',#{pointNo},'%')</if>
<if test="pointName!=null">and d.name like concat('%',#{pointName},'%')</if>
<!-- AND-->
<!-- ((<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[>=]]> #{beginDate} AND a.end_Time <![CDATA[<=]]> #{endDate}</if>)-->
<!-- OR-->
<!-- (<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[<=]]> #{beginDate} AND a.end_Time <![CDATA[>=]]> #{beginDate}</if>)-->
<!-- OR-->
<!-- (<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[<=]]> #{endDate} AND a.end_Time <![CDATA[>=]]> #{endDate}</if>)-->
<!-- OR-->
<!-- (<if test="beginDate!=null and endDate!=null">a.begin_Time <![CDATA[<=]]> #{beginDate} AND a.end_Time <![CDATA[>=]]> #{endDate}</if>)-->
<!-- )-->
<if test="pointNo!=null">and d.point_no like concat('%',#{pointNo}::varchar,'%')</if>
<if test="pointName!=null">and d.name like concat('%',#{pointName}::varchar,'%')</if>
<if test="beginDate!=null and endDate!=null and endDate != '' and beginDate != ''">
and a.begin_Time <![CDATA[>=]]> #{beginDate} AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="beginDate=='' and endDate != null and endDate != ''">
AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="beginDate!=null and beginDate != '' and endDate == ''">
and a.begin_Time <![CDATA[>=]]> #{beginDate}
</if>
<if test="status!=null">and b.is_finish = #{status}</if>
<if test="routeId!=null">and a.route_id = #{routeId}</if>
<if test="planId!=null">and a.plan_id = #{planId}</if>
<if test="bizOrgCode!=null">and a.org_Code like concat (#{bizOrgCode},'%')</if>
<if test="bizOrgCode!=null">and a.org_code like concat (#{bizOrgCode}::varchar,'%')</if>
<if test="orgCode!=null">
and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})
and (a.org_Code like concat (#{orgCode}::varchar,'-%')or a.org_code= #{orgCode})
</if>
<if test="searchDay!=null and searchDay != '' and searchDay == 1">
and a.check_date = curdate()
......
......@@ -1405,15 +1405,13 @@
pp.id pointId
, pp.name pointName
, pp.point_no pointNo
, wws.name area
, wws.full_name position
, prp.order_no orderNo
, prp.id prpId
, prp.exclude_items excludeItems
FROM
p_point pp
LEFT JOIN wl_warehouse_structure wws
ON pp.risk_source_id = wws.source_id
LEFT JOIN p_route_point prp
ON prp.point_id = pp.id
WHERE prp.route_id = #{routeId}
......@@ -1435,10 +1433,10 @@
SELECT
ppi.id itemId,
pii.name,
pii.picture_json photo,
pii.basis_json basis,
pii.check_method method,
pii.item_type type,
pii.picture_json as photo,
pii.basis_json as basis,
pii.check_method as method,
pii.item_type as type,
pii.level,
pii.risk_desc,
pii.input_classify
......
......@@ -436,8 +436,8 @@
and ppc.id = #{classifyId}
</if>
<if test="inputName!=null and inputName !=''">
and (pii.name like CONCAT('%', #{inputName}, '%')
or pii.item_no like CONCAT('%', #{inputName}, '%'))
and (pii.name like CONCAT('%', #{inputName}::varchar, '%')
or pii.item_no like CONCAT('%', #{inputName}::varchar, '%'))
</if>
<if test="isBound!=null and isBound !=''">
and temp.routePointItemId >0
......@@ -447,7 +447,7 @@
</select>
<select id="queryRoutesByOrgCode" resultType="com.yeejoin.amos.patrol.dao.entity.Route">
SELECT * FROM p_route r where r.is_delete = 0 and r.biz_org_code like CONCAT( #{orgCode}, '%')
SELECT * FROM p_route r where r.is_delete = 0 and r.biz_org_code like CONCAT( #{orgCode}::varchar, '%')
</select>
<!--如果查询的点下没有检查项 返回一个标识 -->
......@@ -460,7 +460,7 @@
left join p_route_point prp on prp.route_id = r.id
left join p_route_point_item prpi on prpi.route_point_id = prp.id
WHERE
r.is_delete = 0 and r.biz_org_code like CONCAT( #{orgCode}, '%')
r.is_delete = 0 and r.biz_org_code like CONCAT( #{orgCode}::varchar, '%')
GROUP BY r.id
order by r.create_date DESC
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment