Commit 86f68eb8 authored by tangwei's avatar tangwei

运维管理列表

parent dac17316
......@@ -105,6 +105,7 @@ public class ControllerAop {
urls.add("/hygf/peasant-household/mobile/login");
urls.add("/hygf/qiyuesuo/callback");
urls.add("/hygf/unit-info/unitRegister");
urls.add("/hygf/maintenance/getDealer");
// 获取请求路径
for (String uri : urls) {
......
......@@ -87,23 +87,23 @@ public class MaintenanceDto extends BaseDto {
@ApiModelProperty(value = "管理员密码")
private String adminLoginPwd;
@ApiModelProperty(value = "低压电工证")
private String electricianCertificate;
@ApiModelProperty(value = "登高证")
private String climbingCertificate;
@ApiModelProperty(value = "低压电工证有效期开始")
private Date electricianCertificateStart;
@ApiModelProperty(value = "低压电工证有效期结束")
private Date electricianCertificateEnd;
@ApiModelProperty(value = "登高证有效期开始")
private Date climbingCertificateStart;
@ApiModelProperty(value = "登高证有效期结束")
private Date climbingCertificateEnd;
// @ApiModelProperty(value = "低压电工证")
// private String electricianCertificate;
//
// @ApiModelProperty(value = "登高证")
// private String climbingCertificate;
//
// @ApiModelProperty(value = "低压电工证有效期开始")
// private Date electricianCertificateStart;
//
// @ApiModelProperty(value = "低压电工证有效期结束")
// private Date electricianCertificateEnd;
//
// @ApiModelProperty(value = "登高证有效期开始")
// private Date climbingCertificateStart;
//
// @ApiModelProperty(value = "登高证有效期结束")
// private Date climbingCertificateEnd;
@ApiModelProperty(value = "培训状态")
private String trainingStatus;
......
......@@ -19,7 +19,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_maintenance")
@TableName(value = "hygf_maintenance",autoResultMap = true)
public class Maintenance extends BaseEntity {
private static final long serialVersionUID = 1L;
......
......@@ -3,10 +3,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
......@@ -19,7 +22,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_maintenance_file")
@TableName(value ="hygf_maintenance_file",autoResultMap = true)
public class MaintenanceFile extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -45,18 +48,22 @@ public class MaintenanceFile extends BaseEntity {
/**
* 文件对象
*/
@TableField(value = "file_url", typeHandler = FastjsonTypeHandler.class)
@TableField(value ="file_url", typeHandler = FastjsonTypeHandler.class)
private List<Object> fileUrl;
/**
* 有效开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField("effective_date_start")
private Date effectiveDateStart;
/**
* 有效结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField("effective_date_end")
private Date effectiveDateEnd;
......
......@@ -54,4 +54,7 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
@UserLimits
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto, Page<JpStationDto> pa);
List<DropDown> getDealerNew(@Param("regionalCompaniesSeq") String regionalCompaniesSeq);
}
......@@ -218,7 +218,18 @@
GROUP BY hygf_unit_info.amos_company_code,hygf_unit_info.`name`
</select>
<select id="getDealerNew" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT hygf_unit_info.`name`, hygf_unit_info.sequence_nbr orgCode
FROM hygf_regional_companies LEFT JOIN hygf_unit_info
ON hygf_unit_info.sequence_nbr=hygf_regional_companies.unit_info_id WHERE hygf_unit_info.audit_status='2'
AND hygf_unit_info.blacklist='0' AND hygf_unit_info.is_delete='0'
<if test="regionalCompaniesSeq!=null">
and hygf_regional_companies.regional_companies_seq =#{regionalCompaniesSeq}
</if>
and hygf_unit_info.amos_company_code is not null
GROUP BY hygf_unit_info.sequence_nbr,hygf_unit_info.`name`
</select>
......
......@@ -21,10 +21,14 @@
</select>
<select id="selectMaintenance" resultType="INT">
select COUNT(hygf_maintenance.SEQUENCE_NBR ) from hygf_maintenance where
select COUNT(hygf_maintenance.SEQUENCE_NBR ) from
hygf_maintenance LEFT JOIN std_user_biz on hygf_maintenance.foundation_id=std_user_biz.sequence_nbr
where
hygf_maintenance.review_status!='驳回'
and hygf_maintenance.telephone=#{telephone}
or privilege_agency_user.admin_login_name=#{adminLoginName}
and std_user_biz.emergency_telephone=#{telephone}
or std_user_biz.amos_user_name=#{adminLoginName}
</select>
......@@ -52,14 +56,14 @@
ph.is_delete = 0
<if test="name != null and name != ''">
AND ph.name LIKE CONCAT('%', #{name}, '%')
AND std_user_biz.real_name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="maintenanceTypeCode != null and maintenanceTypeCode != ''">
AND ph.maintenance_type_code = #{maintenanceTypeCode}
</if>
<if test="lockStatus != null and lockStatus != ''">
AND ph.lock_status &gt;= #{lockStatus}
AND std_user_biz.lock_status = #{lockStatus}
</if>
<if test="reviewStatus != null and reviewStatus != ''">
AND ph.review_status &gt;= #{reviewStatus}
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.entity.Maintenance;
import com.yeejoin.amos.boot.module.hygf.api.entity.MaintenanceLog;
import com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.MaintenanceServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -32,7 +44,8 @@ public class MaintenanceController extends BaseController {
@Autowired
MaintenanceServiceImpl maintenanceServiceImpl;
@Autowired
JpStationMapper jpStationMapper;
/**
* 新增运维人员
*
......@@ -82,7 +95,7 @@ public class MaintenanceController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个运维人员", notes = "根据sequenceNbr查询单个运维人员")
public ResponseModel<MaintenanceDto> selectOne(@PathVariable Long sequenceNbr) {
public ResponseModel<Map<String,Object> > selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(maintenanceServiceImpl.selectOneById(sequenceNbr));
}
......@@ -133,4 +146,33 @@ public class MaintenanceController extends BaseController {
public ResponseModel<List<MaintenanceDto>> selectForList() {
return ResponseHelper.buildResponse(maintenanceServiceImpl.queryForMaintenanceList());
}
//查询当前登录人权限经销商
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "查询当前登录人权限经销商", notes = "查询当前登录人权限经销商")
@GetMapping(value = "/getDealer")
public ResponseModel<List<Map<String,String>>> getDealer(String regionalCompaniesCode ) {
List<DropDown> list= jpStationMapper.getDealerNew(regionalCompaniesCode);
List<Map<String,String>> result = new ArrayList<>();
list.forEach(dropDown -> {
Map<String,String> item = new HashMap<>();
item.put("text",dropDown.getName());
item.put("value",dropDown.getOrgCode());
result.add(item);
});
return ResponseHelper.buildResponse(result);
}
//查询当前登录人权限经销商
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "经销商人员加入黑名单/撤销黑名单", notes = "经销商人员加入黑名单/撤销黑名单")
@GetMapping(value = "/updateUser")
public ResponseModel<Object> updateUser(Long sequenceNbr ,String type) {
maintenanceServiceImpl.updateUser( sequenceNbr , type);
return ResponseHelper.buildResponse(null);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -32,6 +33,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.util.*;
......@@ -50,7 +52,8 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
private UnitInfoServiceImpl unitInfoService;
@Autowired
MaintenanceFileServiceImpl maintenanceFileServiceImpl;
@Autowired
MaintenanceFileMapper maintenanceFileMapper;
@Autowired
MaintenanceMapper maintenanceMapper;
@Autowired
......@@ -181,6 +184,8 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
publicAgencyUser.setLockStatus("LOCK");
publicAgencyUser.setLockTime(new Date());
publicAgencyUser.setEmergencyTelephone(model.getTelephone());
publicAgencyUser.setIdCardFront(model.getIdCardFront()!=null?JSON.toJSONString(model.getIdCardFront()):null);
publicAgencyUser.setIdCardOpposite(model.getIdCardOpposite()!=null?JSON.toJSONString(model.getIdCardOpposite()):null);
publicAgencyUserMapper.insert(publicAgencyUser);
//保存运维人员
......@@ -233,24 +238,26 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
}
//详情
public MaintenanceDto selectOneById(Long sequenceNbr){
public Map<String,Object> selectOneById(Long sequenceNbr){
MaintenanceDto maintenanceDto= maintenanceMapper.selectOneById(sequenceNbr);
maintenanceDto.setIdCardFrontList(maintenanceDto.getIdCardFront()!=null?JSONArray.parseArray(maintenanceDto.getIdCardFront()):null);
maintenanceDto.setIdCardOppositeList(maintenanceDto.getIdCardFront()!=null?JSONArray.parseArray(maintenanceDto.getIdCardOpposite()):null);
//获取文档
List<MaintenanceFile> list= maintenanceFileServiceImpl.list(
List<MaintenanceFile> list= maintenanceFileMapper.selectList(
new QueryWrapper<MaintenanceFile>().lambda().eq(MaintenanceFile::getMaintenanceId, sequenceNbr)
);
maintenanceDto.setMaintenanceFiles(list);
JSONObject jsonObject = JSONObject.fromObject(maintenanceDto);
Map<String,Object> jsonObject= BeanUtil.beanToMap(maintenanceDto);
if(list!=null&&!list.isEmpty()){
for (MaintenanceFile maintenanceFile : list) {
jsonObject.put(maintenanceFile.getFileKey(),maintenanceFile.getFileUrl());
jsonObject.put(maintenanceFile.getFileKey()+"effectiveDateEnd",maintenanceFile.getEffectiveDateEnd());
jsonObject.put(maintenanceFile.getFileKey()+"effectiveDateStart",maintenanceFile.getEffectiveDateStart());
}
}
return maintenanceDto;
return jsonObject;
}
@Transactional
......@@ -329,4 +336,28 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
public void updateTraining(String userId){
this.getBaseMapper().updateTraining(userId);
}
@Transactional
public void updateUser( Long sequenceNbr , String type){
FeignClientResult<List<String>> userResult =null;
MaintenanceDto maintenanceDto= maintenanceMapper.selectOneById(sequenceNbr);
PublicAgencyUser publicAgencyUser = publicAgencyUserMapper.selectById(maintenanceDto.getFoundationId());
if("LOCK".equals(type)){
userResult = Privilege.agencyUserClient.lockUsers(publicAgencyUser.getAmosUserId());
publicAgencyUser.setLockStatus("LOCK");
}else{
userResult = Privilege.agencyUserClient.unlockUsers(publicAgencyUser.getAmosUserId());
publicAgencyUser.setLockStatus("UNLOCK");
}
publicAgencyUser.setLockTime(new Date());
publicAgencyUserMapper.updateById(publicAgencyUser);
}
}
\ No newline at end of file
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