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

This commit is contained in:
79493 2022-11-18 17:44:17 +08:00
parent 4114fe9533
commit e2d4699a4a
21 changed files with 207 additions and 43 deletions

View File

@ -24,6 +24,17 @@ public class CertificatesPageDto {
@ApiModelProperty(value = "每页条数",required = true,example = "10")
private Integer pageSize;//每页显示多少条
@ApiModelProperty(value = "过期状态 1、正常 2、即将到期 3、已到期",required = false)
private String state;
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getEnterpriseId() {
return enterpriseId;
}

View File

@ -19,7 +19,7 @@ import java.util.List;
public interface EntCertificatesMapper extends BaseMapper<EntCertificates> {
/*证件列表*/
List<EntCertificates> certificatesList(@Param("enterpriseId") String enterpriseId);
List<EntCertificates> certificatesList(@Param("enterpriseId") String enterpriseId,@Param("state") String[] state);
List<EntCertificates> findAll();

View File

@ -31,9 +31,10 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
* @param keyContent 关键字
* @param postId 岗位id
* @param enterpriseId 企业id
* @param userType 用户类型
* @return EntUser 企业用户实体
* */
List<EntUser>selectEntUserList(@Param("keyContent") String keyContent,@Param("postId")String postId,@Param("enterpriseId") String enterpriseId);
List<EntUser>selectEntUserList(@Param("keyContent") String keyContent,@Param("postId")String postId,@Param("enterpriseId") String enterpriseId,@Param("userType")Integer userType);
/**
@ -60,4 +61,14 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
* @return int 成功或失败
* */
EntUser validName(@Param("name")String name);
/**
* 查询企业用户不分页
* @param name 名字
* @param enterpriseId 公司id
* @return list
* */
List<EntUser> selectEntUserListNoPage(@Param("name") String name,@Param("enterpriseId")String enterpriseId);
}

View File

@ -155,6 +155,17 @@ public class EntDevice implements Serializable {
@TableField(exist = false)
private Integer recordNumber;
@TableField(exist = false)
private EntDeviceType deviceType;
public EntDeviceType getDeviceType() {
return deviceType;
}
public void setDeviceType(EntDeviceType deviceType) {
this.deviceType = deviceType;
}
public Integer getFrequency() {
return frequency;
}

View File

@ -5,6 +5,8 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -24,16 +26,18 @@ public class EntDeviceMaintenancePlan implements Serializable {
@ApiModelProperty(value = "保养计划")
@TableId("maintenance_plan_id")
private Integer maintenancePlanId;
private String maintenancePlanId;
@ApiModelProperty(value = "1.日常保养 2.常规润滑 3.二级检修保养 4.三级检修保养 5.项目检修保养 6.年度检修保养")
@TableField("maintenance_plan_level")
private Integer maintenancePlanLevel;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "计划开始时间")
@TableField("maintenance_plan_start_time")
private Date maintenancePlanStartTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "计划结束时间")
@TableField("maintenance_plan_end_time")
private Date maintenancePlanEndTime;
@ -74,13 +78,36 @@ public class EntDeviceMaintenancePlan implements Serializable {
@TableField("modify_time")
private Date modifyTime;
public Integer getMaintenancePlanId() {
@TableField("device_id")
private String deviceId;
@TableField(exist = false)
private String entUserName;
public String getEntUserName() {
return entUserName;
}
public void setEntUserName(String entUserName) {
this.entUserName = entUserName;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getMaintenancePlanId() {
return maintenancePlanId;
}
public void setMaintenancePlanId(Integer maintenancePlanId) {
public void setMaintenancePlanId(String maintenancePlanId) {
this.maintenancePlanId = maintenancePlanId;
}
public Integer getMaintenancePlanLevel() {
return maintenancePlanLevel;
}

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -34,10 +36,13 @@ public class EntDeviceMaintenanceRecord implements Serializable {
@TableField("maintenance_level")
private Integer maintenanceLevel;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间")
@TableField("start_time")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "结束时间")
@TableField("ent_time")
private Date entTime;

View File

@ -14,7 +14,7 @@ import java.util.Date;
public class EntDeviceMaintenancePlanDto {
@ApiModelProperty(value = "保养计划")
private Integer maintenancePlanId;
private String maintenancePlanId;
@ApiModelProperty(value = "1.日常保养 2.常规润滑 3.二级检修保养 4.三级检修保养 5.项目检修保养 6.年度检修保养")
private Integer maintenancePlanLevel;
@ -40,14 +40,25 @@ public class EntDeviceMaintenancePlanDto {
@ApiModelProperty(value = "备件id")
private String sparePartId;
@ApiModelProperty(value = "设备id")
private String deviceId;
@ApiModelProperty(value = "计划描述")
private String maintenanceDescription;
public Integer getMaintenancePlanId() {
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getMaintenancePlanId() {
return maintenancePlanId;
}
public void setMaintenancePlanId(Integer maintenancePlanId) {
public void setMaintenancePlanId(String maintenancePlanId) {
this.maintenancePlanId = maintenancePlanId;
}

View File

@ -16,7 +16,7 @@ public class EntDeviceMaintenanceRecordDto {
@ApiModelProperty(value = "保养记录")
private String recordId;
@ApiModelProperty(value = "保养状态")
@ApiModelProperty(value = "保养状态 1.保养中 2.已完成")
private Integer maintenanceStatus;
@ApiModelProperty(value = "1.日常保养 2.常规润滑 3.二级检修保养 4.三级检修保养 5.项目检修保养 6.年度检修保养")
@ -52,6 +52,17 @@ public class EntDeviceMaintenanceRecordDto {
@ApiModelProperty(value = "工作描述")
private String jobDescription;
@ApiModelProperty(value = "设备id")
private String deviceId;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getRecordId() {
return recordId;
}

View File

@ -25,6 +25,12 @@
<select id="certificatesList" resultMap="BaseResultMap">
SELECT * FROM ent_certificates ec
WHERE ec.`enterprise_id` = #{enterpriseId}
<if test="null != state and state.length >0">
and `state` in
<foreach collection='state' open='(' item='id' separator=',' close=')'>
#{id}
</foreach>
</if>
ORDER BY ec.`modify_time` DESC
</select>

View File

@ -18,6 +18,7 @@
<result column="create_time" property="createTime" />
<result column="modify_by" property="modifyBy" />
<result column="modify_time" property="modifyTime" />
<result column="name" property="entUserName" />
</resultMap>
<!-- 通用查询结果列 -->
@ -31,7 +32,8 @@
where maintenance_plan_id = #{maintenancePlanId}
</update>
<select id="selectEntDeviceMaintenancePlanList">
select * from ent_device_maintenance_plan where device_id = #{deviceId}
<select id="selectEntDeviceMaintenancePlanList" resultMap="BaseResultMap">
select edmp.*,eu.name from ent_device_maintenance_plan edmp left join ent_user eu on edmp.maintenance_people_id = eu.ent_user_id
where device_id = #{deviceId}
</select>
</mapper>

View File

@ -57,8 +57,8 @@
<select id="selectEntEquipmentOverdue" resultMap="entEquipmentOverdueMap">
select ed.*,cycle.frequency,cycle.recordNumber from ent_device ed
left join (select edic.frequency,count(eir.ins_record_id)as recordNumber from ent_device_ins_cycle edic ed on ed.device_id = edic.device_id
left join ent_ins_record eir on edic.inspection_id = eir.cycle_id order by create_time desc limit 1)as cycle
left join (select edic.device_id,edic.frequency,count(eir.ins_record_id)as recordNumber from ent_device_ins_cycle edic
left join ent_ins_record eir on edic.inspection_id = eir.cycle_id)as cycle on ed.device_id = cycle.device_id
where ed.enterprise_id = #{enterpriseId} and overdue_inspection = 2
</select>

View File

@ -33,7 +33,7 @@
<update id="updateEntEquipment" >
update ent_device_type set name = #{entDeviceType.name},logo = #{entDeviceType.logo},parent_id = #{entDeviceType.parentId},parent_path = #{entDeviceType.parentPath},parent_name = #{entDeviceType.parentName},sort_id = #{entDeviceType.sortId},
modify_by = #{modifyBy},modify_time = #{modifyTime}
modify_by = #{entDeviceType.modifyBy},modify_time = #{entDeviceType.modifyTime}
where type_id = #{entDeviceType.typeId}
</update>

View File

@ -23,7 +23,7 @@
</sql>
<select id="selectInspectionRecord" resultMap="BaseResultMap">
select * from ent_inspection_record where device_id = #{deviceId}
select * from ent_inspection_record where inspection_device_id = #{deviceId}
<if test="startTime != null and '' != startTime">
and start_time = #{startTime}
</if>

View File

@ -75,15 +75,18 @@
</resultMap>
<select id="selectEntListGroupByListId" resultMap="EntListGroupMap">
select epl.list_id,epl.item_title,count(ept.task_id)as totalTaskNumber,sum(case when task_state = 1 then 1 else 0 end)as haveInHand
select epl.list_id,il.name as item_title,count(ept.task_id)as totalTaskNumber,sum(case when task_state = 1 then 1 else 0 end)as haveInHand
from ent_post_list epl
left join ent_post_task ept on epl.post_list_id = ept.ent_list_id
where epl.enterprise_id = #{enterpriseId} and epl.ent_user_id = #{userId}
left join in_list il on epl.list_id = il.list_id
where epl.enterprise_id = #{enterpriseId}
<if test="null != userId and '' != userId">
and epl.ent_user_id = #{userId}
</if>
<if test="null != listId and '' != listId">
and epl.list_id = #{listId}
</if>
group by epl.list_id,epl.item_title
group by il.list_id
</select>

View File

@ -23,7 +23,7 @@
</sql>
<select id="selectRepairPlan">
select * from ent_repair_plan where device_id = #{deviceId}
select * from ent_repair_plan where repair_device_id = #{deviceId}
</select>
<update id="updateRepairPlan">

View File

@ -75,6 +75,9 @@
<if test="null != postId and '' != postId">
and eu.post_path like concat('%',#{postId},'%')
</if>
<if test="null != userType and '' != userType">
and eu.user_type = #{userType}
</if>
<if test="null != enterpriseId and '' != enterpriseId">
and eu.enterprise_id = #{enterpriseId}
</if>
@ -83,6 +86,16 @@
group by t1.ent_user_id
</select>
<select id="selectEntUserListNoPage" resultMap="BaseResultMap">
select * from ent_user eu where eu.user_type = 2
<if test="null != name and '' != name">
and eu.name like concat('%',#{name},'%')
</if>
<if test="null != enterpriseId and '' != enterpriseId">
and eu.enterprise_id = #{enterpriseId}
</if>
</select>
<update id="updateEntUser" parameterType="com.rzyc.model.ent.EntUser">
update ent_user set post_id = #{entUser.postId},
enterprise_id = #{entUser.enterpriseId},
@ -110,8 +123,4 @@
<select id="validName" resultMap="BaseResultMap">
select ent_user_id,name,mobile from ent_user where name = #{name}
</select>
</mapper>

View File

@ -1197,6 +1197,7 @@ public class BaseController {
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setItemContent(entPostList.getItemContent());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
@ -1233,6 +1234,7 @@ public class BaseController {
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setItemContent(entPostList.getItemContent());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
@ -1272,6 +1274,7 @@ public class BaseController {
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setItemContent(entPostList.getItemContent());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
@ -1310,6 +1313,7 @@ public class BaseController {
SysUser sysUser = getUser(sysUserId);
String subject = year+"年第"+index+"月工作任务:"+entPostList.getFrequency();
ept.setItemTitle(subject);
ept.setItemContent(entPostList.getItemContent());
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());

View File

@ -452,8 +452,8 @@ public class EnterpriseEquipmentController extends BaseController {
@ApiImplicitParam(name = "enterpriseId", value = "企业id",required = true, dataType = "string"),
})
@ResponseBody
public SingleResult selectEntEquipmentOverdue(@RequestParam("enterpriseId") String enterpriseId)throws Exception{
return pcBusinessService.selectEntEquipmentOverdue(enterpriseId);
public SingleResult<List<EntDevice>> selectEntEquipmentOverdue(@RequestParam("enterpriseId") String enterpriseId,Integer state ,Integer deviceName)throws Exception{
return pcBusinessService.selectEntEquipmentOverdue(enterpriseId,state,deviceName);
}

View File

@ -753,7 +753,13 @@ public class PcCompanyController extends BaseController{
public SingleResult<Pager<EntCertificates>> certificatesPage(@Valid CertificatesPageDto certificatesPageDto)throws Exception{
SingleResult<Pager<EntCertificates>> result = new SingleResult<>();
PageHelper.startPage(certificatesPageDto.getPage(), certificatesPageDto.getPageSize());
Page<EntCertificates> page = (Page<EntCertificates>)entCertificatesMapper.certificatesList(certificatesPageDto.getEnterpriseId());
Page<EntCertificates> page ;
if (null != certificatesPageDto.getState()){
page = (Page<EntCertificates>)entCertificatesMapper.certificatesList(certificatesPageDto.getEnterpriseId(),certificatesPageDto.getState().split(","));
}else {
page = (Page<EntCertificates>)entCertificatesMapper.certificatesList(certificatesPageDto.getEnterpriseId(),null);
}
Pager<EntCertificates> pager = new Pager<>();
getDatePage(pager,page);
result.setData(pager);

View File

@ -267,7 +267,7 @@ public class PersonalController extends BaseController{
*/
@ApiOperation(value = "企业用户证照表", notes = "企业用户证照表")
@ApiImplicitParams({
@ApiImplicitParam(name = "entUserId", value = "企业用户id",required = true, dataType = "string"),
@ApiImplicitParam(name = "entUserId", value = "企业用户id",required = false, dataType = "string"),
@ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"),
@ApiImplicitParam(name = "pageSize", value = "pageSize",required = true, dataType = "int"),
@ApiImplicitParam(name = "credentialState", value = "证件过期 1.未过期 2.已超时",required = false, dataType = "int"),
@ -340,11 +340,37 @@ public class PersonalController extends BaseController{
@RequestParam(required = false) String postId,
@RequestParam(required = true) Integer page,
@RequestParam(required = true) Integer pageSize,
@RequestParam(required = false) String enterpriseId)throws Exception{
return pcBusinessService.entUserList(keyContent,page,pageSize,postId,enterpriseId);
@RequestParam(required = false) String enterpriseId,
@RequestParam(required = false) Integer userType)throws Exception{
return pcBusinessService.entUserList(keyContent,page,pageSize,postId,enterpriseId,userType);
}
/**
* 企业岗位人员不分页
* @param name
* @param enterpriseId
* @return list
* @throws Exception
*/
@ApiOperation(value = "企业岗位人员不分页", notes = "企业岗位人员不分页")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "姓名",required = false, dataType = "string"),
@ApiImplicitParam(name = "enterpriseId", value = "企业id",required = false, dataType = "string"),
})
@GetMapping(value = "/entUserListNoPage")
@PreAuthorize("hasAnyAuthority('entUserList','entUserList:update')")
@MethodAnnotation(authorizations = {"entUserList","entUserList:update"},name = "企业岗位人员不分页")
@ResponseBody
public SingleResult<List<EntUser>> entUserList(@RequestParam(required = false) String name,
@RequestParam(required = true) String enterpriseId)throws Exception{
return pcBusinessService.entUserListNoPage(name,enterpriseId);
}
/**
* 新增和修改公司岗位人员
* @param addOrUpdateEntUserDto
@ -363,6 +389,8 @@ public class PersonalController extends BaseController{
/**
* 手动企业分配任务
* @param listDto

View File

@ -195,9 +195,9 @@ public class PcBusinessService extends BaseController {
}
@PageOperation
public SingleResult entUserList(String keyContent,Integer page,Integer pageSize,String postId,String enterpriseId){
public SingleResult entUserList(String keyContent,Integer page,Integer pageSize,String postId,String enterpriseId,Integer userType){
SingleResult singleResult = new SingleResult();
Page<EntUser>users = (Page<EntUser>) entUserMapper.selectEntUserList(keyContent,postId,enterpriseId);
Page<EntUser>users = (Page<EntUser>) entUserMapper.selectEntUserList(keyContent,postId,enterpriseId,userType);
//计算履职百分比,后期这里使用redis来读取履职进度
for (EntUser e:users.getResult()) {
Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask();
@ -210,6 +210,13 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult entUserListNoPage(String name,String enterpriseId){
SingleResult singleResult = new SingleResult();
List<EntUser>users = entUserMapper.selectEntUserListNoPage(name,enterpriseId);
singleResult.setData(users);
return singleResult;
}
public SingleResult addOrUpdateEntUser(AddOrUpdateEntUserDto addOrUpdateEntUserDto) throws Exception {
SingleResult singleResult = new SingleResult();
//正则验证手机号
@ -231,7 +238,7 @@ public class PcBusinessService extends BaseController {
entUser.setPostPath(entPost.getPostPath());
entUser.setPostPathName(entPost.getPostId());
//密码为用户名加手机号
entUser.setPasswd(MD5.md5(entUser.getName() + entUser.getMobile()));
entUser.setPasswd(MD5.md5(entUser.getMobile()));
int result = 0 ;
if (StringUtils.isNotBlank(entUser.getEntUserId())){
EntUser phone = entUserMapper.validMobile(entUser.getMobile(),entUser.getEntUserId());
@ -323,6 +330,7 @@ public class PcBusinessService extends BaseController {
entPostMap.put("name",entDeviceType.getName());
entPostMap.put("parentId",entDeviceType.getParentId());
entPostMap.put("parentPath",entDeviceType.getParentPath());
entPostMap.put("parentName",entDeviceType.getParentName());
entPostMap.put("logo",entDeviceType.getLogo());
data.add(entPostMap);
}
@ -341,6 +349,8 @@ public class PcBusinessService extends BaseController {
public SingleResult deviceDetail(String deviceId){
SingleResult singleResult = new SingleResult();
EntDevice entDevice = entDeviceMapper.selectById(deviceId);
EntDeviceType entDeviceType = entDeviceTypeMapper.selectById(entDevice.getTypeId());
entDevice.setDeviceType(entDeviceType);
singleResult.setData(entDevice);
return singleResult;
}
@ -376,6 +386,14 @@ public class PcBusinessService extends BaseController {
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
//更新redis
List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(addOrUpdateEntPostDto.getEnterpriseId());
//树结构处理
JSONArray jsonArray = handleEntEquipment(entDeviceTypes);
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
singleResult.setData(posts);
//存redis
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),addOrUpdateEntPostDto.getEnterpriseId()),posts,0);
return singleResult;
}
@ -399,16 +417,15 @@ public class PcBusinessService extends BaseController {
if (result != 1 ){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}else {
}
//更新redis
List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(addOrUpdateEntEquipmentTypeDto.getEnterpriseId());
//树结构处理
JSONArray jsonArray = handleEntEquipment(entDeviceTypes);
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
singleResult.setData(posts);
List<EntDeviceType>types = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntDeviceType.class);
singleResult.setData(types);
//存redis
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),addOrUpdateEntEquipmentTypeDto.getEnterpriseId()),posts,0);
}
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),addOrUpdateEntEquipmentTypeDto.getEnterpriseId()),types,0);
return singleResult;
}
@ -536,6 +553,7 @@ public class PcBusinessService extends BaseController {
if (null != entDeviceMaintenancePlanDto && null != entDeviceMaintenancePlan.getMaintenancePlanId()){
result = entDeviceMaintenancePlanMapper.updateEntDeviceMaintenancePlan(entDeviceMaintenancePlan);
}else {
entDeviceMaintenancePlan.setMaintenancePlanId(RandomNumber.getUUid());
result = entDeviceMaintenancePlanMapper.insert(entDeviceMaintenancePlan);
}
if (result != 1 ){
@ -716,6 +734,7 @@ public class PcBusinessService extends BaseController {
entPostList.setCreateBy(getUserId());
entPostList.setCreateTime(new Date());
entPostList.setDelState(DelState.NOT_DEL.getState());
entPostList.setPostListId(RandomNumber.getUUid());
int result = entPostListMapper.insert(entPostList);
if (result != 1 ){
singleResult.setCode(Code.ERROR.getCode());
@ -962,7 +981,7 @@ public class PcBusinessService extends BaseController {
return date;
}
public SingleResult selectEntEquipmentOverdue(String enterpriseId){
public SingleResult selectEntEquipmentOverdue(String enterpriseId,Integer state ,Integer deviceName){
SingleResult singleResult = new SingleResult();
List<EntDevice>devices = entDeviceMapper.selectEntEquipmentOverdue(enterpriseId);
singleResult.setData(devices);