企业端设备模块->企业端PC,小程序接口调试

This commit is contained in:
79493 2022-11-21 17:38:49 +08:00
parent 5dba86d87a
commit cc27b45249
15 changed files with 337 additions and 37 deletions

View File

@ -33,4 +33,7 @@ public interface EntDeviceMaintenancePlanMapper extends BaseMapper<EntDeviceMain
* */ * */
List<EntDeviceMaintenancePlan>selectEntDeviceMaintenancePlanList(String deviceId); List<EntDeviceMaintenancePlan>selectEntDeviceMaintenancePlanList(String deviceId);
} }

View File

@ -24,4 +24,12 @@ public interface EntRepairRecordMapper extends BaseMapper<EntRepairRecord> {
* */ * */
List<EntRepairRecord>repairRecord(String deviceId); List<EntRepairRecord>repairRecord(String deviceId);
/**
* 新增修改维修记录
* @param entRepairRecord
* @return int
* */
int repairRecordUpdate(EntRepairRecord entRepairRecord);
} }

View File

@ -24,7 +24,7 @@ public class EntInspectionRecord implements Serializable {
@ApiModelProperty(value = "送检记录") @ApiModelProperty(value = "送检记录")
@TableId("inspection_id") @TableId("inspection_id")
private Integer inspectionId; private String inspectionId;
@ApiModelProperty(value = "送检设备id") @ApiModelProperty(value = "送检设备id")
@TableField("inspection_device_id") @TableField("inspection_device_id")
@ -74,11 +74,11 @@ public class EntInspectionRecord implements Serializable {
this.deviceId = deviceId; this.deviceId = deviceId;
} }
public Integer getInspectionId() { public String getInspectionId() {
return inspectionId; return inspectionId;
} }
public void setInspectionId(Integer inspectionId) { public void setInspectionId(String inspectionId) {
this.inspectionId = inspectionId; this.inspectionId = inspectionId;
} }

View File

@ -57,6 +57,18 @@ public class EntReportRepair implements Serializable {
@TableField("modify_time") @TableField("modify_time")
private Date modifyTime; private Date modifyTime;
@ApiModelProperty(value = "故障发生时间")
@TableField("fault_occurrence_time")
private String faultOccurrenceTime;
public String getFaultOccurrenceTime() {
return faultOccurrenceTime;
}
public void setFaultOccurrenceTime(String faultOccurrenceTime) {
this.faultOccurrenceTime = faultOccurrenceTime;
}
public String getReportRepairId() { public String getReportRepairId() {
return reportRepairId; return reportRepairId;
} }

View File

@ -0,0 +1,194 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
/**
* 设备维修记录dto
* @author Xuwanxin
* @date 2022/11/21
* */
public class EntRepairRecordDto {
@ApiModelProperty(value = "维修记录")
private String repairRecordId;
@TableField("device_id")
private String deviceId;
@ApiModelProperty(value = "维修Code")
private String repairCode;
@ApiModelProperty(value = "送修时间")
private Date repairTime;
@ApiModelProperty(value = "故障原因 1.自然磨损 2.违章操作 3.配件质量差 4.维护保养不到位 5.其他")
private Integer causeOfFailure;
@ApiModelProperty(value = "外委维修单位")
private String externalMaintenanceUnit;
@ApiModelProperty(value = "外委维修单位人员名称")
private String externalMaintenancePersonName;
@ApiModelProperty(value = "1.正在维修 2.待采购件 3.待加工件 4.待停机维修 5.停机维修 6.无法修复 7.待转外委维修 8.已完成")
private Integer repairState;
@ApiModelProperty(value = "维修开始时间")
private Date repairStartTime;
@ApiModelProperty(value = "维修结束时间")
private Date repairEndTime;
@ApiModelProperty(value = "1.常见故障维修 2.突发性故障维修 3.计划项目维修 4.不正当使用维修")
private Integer repairLevel;
@ApiModelProperty(value = "1. 否 2.是")
private Integer shutdown;
@ApiModelProperty(value = "停机时间")
private Double downTime;
@ApiModelProperty(value = "1.否 2.是")
private Integer affectedGeneration;
@ApiModelProperty(value = "维修花费")
private BigDecimal repairCost;
@ApiModelProperty(value = "工作描述")
private String workDescription;
public String getRepairRecordId() {
return repairRecordId;
}
public void setRepairRecordId(String repairRecordId) {
this.repairRecordId = repairRecordId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getRepairCode() {
return repairCode;
}
public void setRepairCode(String repairCode) {
this.repairCode = repairCode;
}
public Date getRepairTime() {
return repairTime;
}
public void setRepairTime(Date repairTime) {
this.repairTime = repairTime;
}
public Integer getCauseOfFailure() {
return causeOfFailure;
}
public void setCauseOfFailure(Integer causeOfFailure) {
this.causeOfFailure = causeOfFailure;
}
public String getExternalMaintenanceUnit() {
return externalMaintenanceUnit;
}
public void setExternalMaintenanceUnit(String externalMaintenanceUnit) {
this.externalMaintenanceUnit = externalMaintenanceUnit;
}
public String getExternalMaintenancePersonName() {
return externalMaintenancePersonName;
}
public void setExternalMaintenancePersonName(String externalMaintenancePersonName) {
this.externalMaintenancePersonName = externalMaintenancePersonName;
}
public Integer getRepairState() {
return repairState;
}
public void setRepairState(Integer repairState) {
this.repairState = repairState;
}
public Date getRepairStartTime() {
return repairStartTime;
}
public void setRepairStartTime(Date repairStartTime) {
this.repairStartTime = repairStartTime;
}
public Date getRepairEndTime() {
return repairEndTime;
}
public void setRepairEndTime(Date repairEndTime) {
this.repairEndTime = repairEndTime;
}
public Integer getRepairLevel() {
return repairLevel;
}
public void setRepairLevel(Integer repairLevel) {
this.repairLevel = repairLevel;
}
public Integer getShutdown() {
return shutdown;
}
public void setShutdown(Integer shutdown) {
this.shutdown = shutdown;
}
public Double getDownTime() {
return downTime;
}
public void setDownTime(Double downTime) {
this.downTime = downTime;
}
public Integer getAffectedGeneration() {
return affectedGeneration;
}
public void setAffectedGeneration(Integer affectedGeneration) {
this.affectedGeneration = affectedGeneration;
}
public BigDecimal getRepairCost() {
return repairCost;
}
public void setRepairCost(BigDecimal repairCost) {
this.repairCost = repairCost;
}
public String getWorkDescription() {
return workDescription;
}
public void setWorkDescription(String workDescription) {
this.workDescription = workDescription;
}
}

View File

@ -15,8 +15,8 @@ import java.util.Date;
public class InspectionRecordDto { public class InspectionRecordDto {
@ApiModelProperty(value = "送检记录") @ApiModelProperty(value = "送检记录id")
private Integer inspectionId; private String inspectionId;
@ApiModelProperty(value = "送检设备id") @ApiModelProperty(value = "送检设备id")
private Integer inspectionDeviceId; private Integer inspectionDeviceId;
@ -36,13 +36,11 @@ public class InspectionRecordDto {
@ApiModelProperty(value = "检查结果") @ApiModelProperty(value = "检查结果")
private String inspectionText; private String inspectionText;
public String getInspectionId() {
public Integer getInspectionId() {
return inspectionId; return inspectionId;
} }
public void setInspectionId(Integer inspectionId) { public void setInspectionId(String inspectionId) {
this.inspectionId = inspectionId; this.inspectionId = inspectionId;
} }

View File

@ -22,6 +22,18 @@ public class OperatingInstructionsDto {
@ApiModelProperty(value = "操作规程描述") @ApiModelProperty(value = "操作规程描述")
private String opInstructionDescription; private String opInstructionDescription;
@ApiModelProperty("设备id")
@TableField(value = "device_id")
private String deviceId;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getOpInstructionId() { public String getOpInstructionId() {
return opInstructionId; return opInstructionId;
} }

View File

@ -31,6 +31,17 @@ public class ReportRecordDto {
@ApiModelProperty(value = "故障描述") @ApiModelProperty(value = "故障描述")
private String reportDescription; private String reportDescription;
@ApiModelProperty(value = "故障发生时间")
private String faultOccurrenceTime;
public String getFaultOccurrenceTime() {
return faultOccurrenceTime;
}
public void setFaultOccurrenceTime(String faultOccurrenceTime) {
this.faultOccurrenceTime = faultOccurrenceTime;
}
public String getReportRepairId() { public String getReportRepairId() {
return reportRepairId; return reportRepairId;
} }

View File

@ -80,9 +80,9 @@
left join ent_post_task ept on epl.post_list_id = ept.ent_list_id left join ent_post_task ept on epl.post_list_id = ept.ent_list_id
left join in_list il on epl.list_id = il.list_id left join in_list il on epl.list_id = il.list_id
where epl.enterprise_id = #{enterpriseId} where epl.enterprise_id = #{enterpriseId}
<if test="null != userId and '' != userId"> <if test="null != userId and '' != userId">
and epl.ent_user_id = #{userId} and epl.ent_user_id = #{userId}
</if> </if>
<if test="null != listId and '' != listId"> <if test="null != listId and '' != listId">
and epl.list_id = #{listId} and epl.list_id = #{listId}
</if> </if>

View File

@ -30,7 +30,10 @@
</sql> </sql>
<select id="selectEntUserPostTask" resultMap="BaseResultMap"> <select id="selectEntUserPostTask" resultMap="BaseResultMap">
select * from ent_post_task where ent_user_id = #{entUserId} and enterprise_id = #{enterpriseId} select * from ent_post_task where enterprise_id = #{enterpriseId}
<if test="null != entUserId and '' != entUserId">
and ent_user_id = #{entUserId}
</if>
<if test="listId != null and '' != listId"> <if test="listId != null and '' != listId">
and list_id = #{listId} and list_id = #{listId}
</if> </if>

View File

@ -22,7 +22,7 @@
repair_plan_id, repair_device_id, repair_level, repair_state, last_time_repair, repair_time, description, create_time, create_by, modify_time, modify_by repair_plan_id, repair_device_id, repair_level, repair_state, last_time_repair, repair_time, description, create_time, create_by, modify_time, modify_by
</sql> </sql>
<select id="selectRepairPlan"> <select id="selectRepairPlan" resultMap="BaseResultMap">
select * from ent_repair_plan where repair_device_id = #{deviceId} select * from ent_repair_plan where repair_device_id = #{deviceId}
</select> </select>

View File

@ -31,8 +31,13 @@
repair_record_id, device_id, repair_code, repair_time, cause_of_failure, external_maintenance_unit, external_maintenance_person_name, repair_state, repair_start_time, repair_end_time, repair_level, shutdown, down_time, affected_generation, repair_cost, work_description, create_by, create_time, modify_by, modify_time repair_record_id, device_id, repair_code, repair_time, cause_of_failure, external_maintenance_unit, external_maintenance_person_name, repair_state, repair_start_time, repair_end_time, repair_level, shutdown, down_time, affected_generation, repair_cost, work_description, create_by, create_time, modify_by, modify_time
</sql> </sql>
<select id="repairRecord"> <select id="repairRecord" resultMap="BaseResultMap">
select * from ent_report_repair where device_id = #{deviceId} select * from ent_repair_record where device_id = #{deviceId}
</select> </select>
<update id="repairRecordUpdate">
update ent_report_repair set device_id = #{deviceId},repair_code = #{repairCode}, repair_time = #{repairTime}, cause_of_failure = #{causeOfFailure}, external_maintenance_unit = #{externalMaintenanceUnit}, external_maintenance_person_name = #{externalMaintenancePersonName}, repair_state = #{repairState}, repair_start_time = #{repairStartTime}, repair_end_time = #{repairEndTime}, repair_level = #{repairLevel}, shutdown = #{shutdown}, down_time = #{downTime}, affected_generation = #{affectedGeneration}, repair_cost = #{repairCost}, work_description = #{workDescription},modify_by = #{modifyBy}, modify_time= #{modifyTime}
where repair_record_id = #{repairRecordId}
</update>
</mapper> </mapper>

View File

@ -328,7 +328,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('inspectionRecord:update')") @PreAuthorize("hasAnyAuthority('inspectionRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord:update"},name = "送检操作") @MethodAnnotation(authorizations = {"inspectionRecord:update"},name = "送检操作")
@ResponseBody @ResponseBody
public SingleResult submitInspection(InspectionRecordDto inspectionRecordDto)throws Exception{ public SingleResult submitInspection(@RequestBody InspectionRecordDto inspectionRecordDto)throws Exception{
return pcBusinessService.submitInspection(inspectionRecordDto); return pcBusinessService.submitInspection(inspectionRecordDto);
} }
@ -354,11 +354,11 @@ public class EnterpriseEquipmentController extends BaseController {
* @throws Exception * @throws Exception
**/ **/
@ApiOperation(value = "维修计划-新增,修改", notes = "维修计划-新增,修改") @ApiOperation(value = "维修计划-新增,修改", notes = "维修计划-新增,修改")
@GetMapping(value = "/repairPlanAddOrUpdate") @PostMapping(value = "/repairPlanAddOrUpdate")
@PreAuthorize("hasAnyAuthority('repairPlan:update')") @PreAuthorize("hasAnyAuthority('repairPlan:update')")
@MethodAnnotation(authorizations = {"repairPlan:update"},name = "维修计划-新增,修改") @MethodAnnotation(authorizations = {"repairPlan:update"},name = "维修计划-新增,修改")
@ResponseBody @ResponseBody
public SingleResult repairPlanAddOrUpdate(EntRepairPlanDto entRepairPlanDto)throws Exception{ public SingleResult repairPlanAddOrUpdate(@RequestBody EntRepairPlanDto entRepairPlanDto)throws Exception{
return pcBusinessService.repairPlanUpdate(entRepairPlanDto); return pcBusinessService.repairPlanUpdate(entRepairPlanDto);
} }
@ -379,6 +379,21 @@ public class EnterpriseEquipmentController extends BaseController {
return pcBusinessService.repairRecord(page,pageSize,deviceId); return pcBusinessService.repairRecord(page,pageSize,deviceId);
} }
/**
* 维修记录修改/新增
* @return int
* @throws Exception
**/
@ApiOperation(value = "维修记录修改/新增", notes = "维修记录修改/新增")
@PostMapping(value = "/repairRecordUpdate")
@PreAuthorize("hasAnyAuthority('repairRecord:update')")
@MethodAnnotation(authorizations = {"repairRecord:update"},name = "维修记录修改/新增")
@ResponseBody
public SingleResult repairRecordUpdate(@RequestBody EntRepairRecordDto entRepairRecordDto)throws Exception{
return pcBusinessService.repairRecordUpdate(entRepairRecordDto);
}
/** /**
* 报修记录 * 报修记录
* @return 报修记录 * @return 报修记录
@ -393,6 +408,9 @@ public class EnterpriseEquipmentController extends BaseController {
return pcBusinessService.reportRecord(page,pageSize,deviceId); return pcBusinessService.reportRecord(page,pageSize,deviceId);
} }
/** /**
* 新增报修 * 新增报修
* @throws Exception * @throws Exception

View File

@ -445,7 +445,7 @@ public class PersonalController extends BaseController{
@ResponseBody @ResponseBody
public SingleResult<List<EntPostList>> entListGroupByListId(@RequestParam(required = true) String enterpriseId, public SingleResult<List<EntPostList>> entListGroupByListId(@RequestParam(required = true) String enterpriseId,
String listId, String listId,
@RequestParam(required = true) String userId)throws Exception{ String userId)throws Exception{
return pcBusinessService.entListGroupByListId(enterpriseId,listId,userId); return pcBusinessService.entListGroupByListId(enterpriseId,listId,userId);
} }

View File

@ -127,7 +127,6 @@ public class PcBusinessService extends BaseController {
List<EntPostList>list = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(),entUserPostListDto.getFinishedState(), List<EntPostList>list = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(),entUserPostListDto.getFinishedState(),
entUserPostListDto.getPostId(),entUserPostListDto.getPage(),entUserPostListDto.getPageSize()); entUserPostListDto.getPostId(),entUserPostListDto.getPage(),entUserPostListDto.getPageSize());
return list; return list;
} }
@ -613,14 +612,19 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public SingleResult repairPlanUpdate(EntRepairPlanDto entRepairPlanDto){ public SingleResult repairPlanUpdate(EntRepairPlanDto entRepairPlanDto) throws Exception {
SingleResult singleResult = new SingleResult(); SingleResult singleResult = new SingleResult();
EntRepairPlan entRepairPlan = new EntRepairPlan(); EntRepairPlan entRepairPlan = new EntRepairPlan();
BeanUtils.copyProperties(entRepairPlanDto,entRepairPlan); BeanUtils.copyProperties(entRepairPlanDto,entRepairPlan);
int result = 0; int result = 0;
if (null != entRepairPlanDto && null != entRepairPlan.getRepairPlanId()){ if (null != entRepairPlanDto && null != entRepairPlan.getRepairPlanId()){
entRepairPlan.setModifyBy(getUserId());
entRepairPlan.setModifyTime(new Date());
result = entRepairPlanMapper.updateRepairPlan(entRepairPlan); result = entRepairPlanMapper.updateRepairPlan(entRepairPlan);
}else{ }else{
entRepairPlan.setRepairPlanId(RandomNumber.getUUid());
entRepairPlan.setCreateBy(getUserId());
entRepairPlan.setCreateTime(new Date());
result = entRepairPlanMapper.insert(entRepairPlan); result = entRepairPlanMapper.insert(entRepairPlan);
} }
if (result != 1 ){ if (result != 1 ){
@ -630,14 +634,19 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public SingleResult submitInspection(InspectionRecordDto inspectionRecordDto){ public SingleResult submitInspection(InspectionRecordDto inspectionRecordDto) throws Exception {
SingleResult singleResult = new SingleResult(); SingleResult singleResult = new SingleResult();
EntInspectionRecord entInspectionRecord = new EntInspectionRecord(); EntInspectionRecord entInspectionRecord = new EntInspectionRecord();
BeanUtils.copyProperties(inspectionRecordDto,entInspectionRecord); BeanUtils.copyProperties(inspectionRecordDto,entInspectionRecord);
int result = 0; int result = 0;
if (null != inspectionRecordDto && null != entInspectionRecord.getInspectionId()){ if (null != inspectionRecordDto && null != entInspectionRecord.getInspectionId()){
entInspectionRecord.setModifyBy(getUserId());
entInspectionRecord.setModifyTime(new Date());
result = entInspectionRecordMapper.updateEntInspectionRecord(entInspectionRecord); result = entInspectionRecordMapper.updateEntInspectionRecord(entInspectionRecord);
}else { }else {
entInspectionRecord.setInspectionId(RandomNumber.getUUid());
entInspectionRecord.setCreateBy(getUserId());
entInspectionRecord.setCreateTime(new Date());
result = entInspectionRecordMapper.insert(entInspectionRecord); result = entInspectionRecordMapper.insert(entInspectionRecord);
} }
if (result != 1 ){ if (result != 1 ){
@ -774,7 +783,7 @@ public class PcBusinessService extends BaseController {
Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,year); Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,year);
//2代表已完成状态 //2代表已完成状态
Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,year); Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,year);
if (null != finishCount && finishCount > 0 ){ if (null != finishCount && finishCount >= 0 ){
double finishPercent = Arith.div(finishCount,total) * 100; double finishPercent = Arith.div(finishCount,total) * 100;
singleResult.setData(finishPercent); singleResult.setData(finishPercent);
} }
@ -790,13 +799,20 @@ public class PcBusinessService extends BaseController {
long total = entPostTaskMapper.selectEntPostTaskTotal(enterpriseId,listId,year); long total = entPostTaskMapper.selectEntPostTaskTotal(enterpriseId,listId,year);
//2代表已完成状态 //2代表已完成状态
EntPostTaskStatistic entPostTaskStatistic = entPostTaskMapper.selectEntPostTaskByState(enterpriseId,listId,year); EntPostTaskStatistic entPostTaskStatistic = entPostTaskMapper.selectEntPostTaskByState(enterpriseId,listId,year);
double finishPercent = Arith.div(entPostTaskStatistic.getFinished(),total) * 100; if (null != entPostTaskStatistic){
map.put("finished",finishPercent); double finishPercent = Arith.div(entPostTaskStatistic.getFinished(),total) * 100;
double unfinishedPercent = Arith.div(entPostTaskStatistic.getOvertime(),total) * 100; map.put("finished",finishPercent);
map.put("unfinished",unfinishedPercent); double unfinishedPercent = Arith.div(entPostTaskStatistic.getOvertime(),total) * 100;
double haveInHand = Arith.div(entPostTaskStatistic.getHaveInHand(),total) * 100; map.put("unfinished",unfinishedPercent);
map.put("haveInHand",haveInHand); double haveInHand = Arith.div(entPostTaskStatistic.getHaveInHand(),total) * 100;
singleResult.setData(map); map.put("haveInHand",haveInHand);
singleResult.setData(map);
}else {
map.put("finished",0);
map.put("unfinished",0);
map.put("haveInHand",0);
singleResult.setData(map);
}
return singleResult; return singleResult;
} }
@ -807,14 +823,17 @@ public class PcBusinessService extends BaseController {
* */ * */
private String getUserPostId() throws Exception { private String getUserPostId() throws Exception {
String userId = getUserId(); String userId = getUserId();
Object object = redisUtil.get("postId:userId"+userId); if (StringUtils.isNotBlank(userId)){
if (null == object){ Object object = redisUtil.get("postId:userId"+userId);
EntUser entUser = entUserMapper.selectById(userId); if (null == object){
redisUtil.set("postId:userId"+userId,entUser.getPostId()); EntUser entUser = entUserMapper.selectById(userId);
return entUser.getPostId(); redisUtil.set("postId:userId"+userId,entUser.getPostId());
}else { return entUser.getPostId();
return (String)object; }else {
return (String)object;
}
} }
return null;
} }
public SingleResult entListGroupByListId(String enterpriseId,String listId,String userId){ public SingleResult entListGroupByListId(String enterpriseId,String listId,String userId){
@ -990,6 +1009,23 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public SingleResult repairRecordUpdate(EntRepairRecordDto entRepairRecordDto){
SingleResult singleResult = new SingleResult();
EntRepairRecord entRepairRecord = new EntRepairRecord();
BeanUtils.copyProperties(entRepairRecordDto,entRepairRecord);
int result = 0;
if (null != entRepairRecordDto && null != entRepairRecordDto.getRepairRecordId()){
result =entRepairRecordMapper.repairRecordUpdate(entRepairRecord);
}else {
result = entRepairRecordMapper.insert(entRepairRecord);
}
if (result <= 0){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
return singleResult;
}
} }