企业端设备模块->和前端调试接口,分页规则只试用before切面,返回不进行切面,否则语法不方便操作,工具类加入新的构造器方法来封装pager,

This commit is contained in:
79493 2022-11-08 18:09:46 +08:00
parent a279ce4315
commit e7289591db
27 changed files with 375 additions and 134 deletions

View File

@ -24,11 +24,9 @@ public interface EntUserCredentialMapper extends BaseMapper<EntUserCredential> {
* 企业用户岗位职责 * 企业用户岗位职责
* @param enterpriseId 企业id * @param enterpriseId 企业id
* @param entUserId 企业用户id * @param entUserId 企业用户id
* @param page 页码
* @param pageSize 条数
* @return EntUserCredential 企业用户证照 * @return EntUserCredential 企业用户证照
* */ * */
List<EntUserCredential>selectEntUserCredential(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId,@Param("page") Integer page,@Param("pageSize")Integer pageSize); List<EntUserCredential>selectEntUserCredential(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId);
/** /**

View File

@ -0,0 +1,27 @@
package com.rzyc.mapper;
import com.rzyc.model.EntUserType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 人员类型 Mapper 接口
* </p>
*
* @author
* @since 2022-11-08
*/
@Repository
public interface EntUserTypeMapper extends BaseMapper<EntUserType> {
/**
* 查询用户类型
* @return list
*
* */
List<EntUserType>selectEntUserType();
}

View File

@ -43,4 +43,12 @@ public interface EntPostMapper extends BaseMapper<EntPost> {
* */ * */
int insertEntPost(@Param("data") EntPost entPost); int insertEntPost(@Param("data") EntPost entPost);
/**
* 获取上级岗位对象
* @param postId 获取上级岗位对象
* @return int
* */
EntPost getParentPost(@Param("postId") String postId);
} }

View File

@ -29,12 +29,10 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
/** /**
* 查询企业用户表 * 查询企业用户表
* @param keyContent 关键字 * @param keyContent 关键字
* @param page 页码
* @param pageSize 条数
* @param postId 岗位id * @param postId 岗位id
* @return EntUser 企业用户实体 * @return EntUser 企业用户实体
* */ * */
List<EntUser>selectEntUserList(@Param("keyContent") String keyContent,@Param("page")Integer page,@Param("pageSize")Integer pageSize,@Param("postId")String postId); List<EntUser>selectEntUserList(@Param("keyContent") String keyContent,@Param("postId")String postId);
/** /**
@ -50,9 +48,10 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
/** /**
* 验证用户电话和名字 * 验证用户电话和名字
* @param mobile 电话 * @param mobile 电话
* @param entUserId 用户id
* @return int 成功或失败 * @return int 成功或失败
* */ * */
EntUser validMobile(@Param("mobile") String mobile); EntUser validMobile(@Param("mobile") String mobile,@Param("entUserId")String entUserId);
/** /**
* 验证用户电话和名字 * 验证用户电话和名字

View File

@ -348,4 +348,12 @@ public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> {
* @return SysEnterprise 企业表 * @return SysEnterprise 企业表
* */ * */
SysEnterprise findEnterpriseByName(@Param("entUserName")String entUserName); SysEnterprise findEnterpriseByName(@Param("entUserName")String entUserName);
/**
* 通过企业用户名手机号查询企业
* @param entUserPhone 企业用户名
* @return SysEnterprise 企业表
* */
SysEnterprise findEnterpriseByPhoneNumber(@Param("entUserPhone")String entUserPhone);
} }

View File

@ -0,0 +1,66 @@
package com.rzyc.model;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 人员类型
* </p>
*
* @author
* @since 2022-11-08
*/
@TableName("ent_user_type")
@ApiModel(value="EntUserType对象", description="人员类型")
public class EntUserType implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员类型主键")
@TableId("id")
private Integer id;
@ApiModelProperty(value = "人员类型名称")
@TableField("name")
private String name;
@TableField("create_time")
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "EntUserType{" +
"id=" + id +
", name=" + name +
", createTime=" + createTime +
"}";
}
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -37,7 +38,6 @@ public class AddOrUpdateEntUserDto {
@ApiModelProperty(value = "人员类型") @ApiModelProperty(value = "人员类型")
private Integer userType; private Integer userType;
@NotNull
@ApiModelProperty(value = "年龄") @ApiModelProperty(value = "年龄")
private Integer age; private Integer age;

View File

@ -7,6 +7,8 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -52,13 +54,14 @@ public class EntUser implements Serializable {
@TableField("age") @TableField("age")
private Integer age; private Integer age;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "从业时间") @ApiModelProperty(value = "从业时间")
@TableField("work_time") @TableField("work_time")
private Date workTime; private Date workTime;
@ApiModelProperty(value = "登录密码") @ApiModelProperty(value = "登录密码")
@TableField("passwd") @TableField("password")
private String passwd; private String password;
@ApiModelProperty(value = "岗位路径") @ApiModelProperty(value = "岗位路径")
@TableField("post_path") @TableField("post_path")
@ -112,7 +115,6 @@ public class EntUser implements Serializable {
@ApiModelProperty(value = "工号") @ApiModelProperty(value = "工号")
private String jobNumber; private String jobNumber;
@TableField(exist = false) @TableField(exist = false)
private String token; private String token;
@ -120,6 +122,30 @@ public class EntUser implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String entPostName; private String entPostName;
@ApiModelProperty(value = "用户类型名")
@TableField(exist = false)
private String userTypeName;
@ApiModelProperty(value = "岗位名")
@TableField(exist = false)
private String postName;
public String getPostName() {
return postName;
}
public void setPostName(String postName) {
this.postName = postName;
}
public String getUserTypeName() {
return userTypeName;
}
public void setUserTypeName(String userTypeName) {
this.userTypeName = userTypeName;
}
public String getEntPostName() { public String getEntPostName() {
return entPostName; return entPostName;
} }
@ -250,11 +276,11 @@ public class EntUser implements Serializable {
this.workTime = workTime; this.workTime = workTime;
} }
public String getPasswd() { public String getPasswd() {
return passwd; return password;
} }
public void setPasswd(String passwd) { public void setPasswd(String password) {
this.passwd = passwd; this.password = password;
} }
public String getPostPath() { public String getPostPath() {
return postPath; return postPath;
@ -310,7 +336,7 @@ public class EntUser implements Serializable {
", userType=" + userType + ", userType=" + userType +
", age=" + age + ", age=" + age +
", workTime=" + workTime + ", workTime=" + workTime +
", passwd=" + passwd + ", password=" + password +
", postPath=" + postPath + ", postPath=" + postPath +
", postPathName=" + postPathName + ", postPathName=" + postPathName +
", createTime=" + createTime + ", createTime=" + createTime +

View File

@ -29,7 +29,7 @@
</sql> </sql>
<select id="deviceInspectionCycle" resultMap="BaseResultMap"> <select id="deviceInspectionCycle" resultMap="BaseResultMap">
select * from ent_device_ins_cycle select * from ent_device_ins_cycle where 1=1
<if test="null != inspectionName and '' != inspectionName"> <if test="null != inspectionName and '' != inspectionName">
and inspection_name like concat('%',#{inspectionName},'%') and inspection_name like concat('%',#{inspectionName},'%')
</if> </if>

View File

@ -32,6 +32,7 @@
<if test="null != typeId and '' != typeId"> <if test="null != typeId and '' != typeId">
and type_id = #{typeId} and type_id = #{typeId}
</if> </if>
</select> </select>

View File

@ -30,9 +30,9 @@
</update> </update>
<select id="selectInspectionRecord"> <select id="selectInspectionRecord">
select * from ent_ins_record select * from ent_ins_record where 1=1
<if test="null != inspectionName and '' != inspectionName"> <if test="null != inspectionName and '' != inspectionName">
and inspection_name like concat('%',inspectionName,'%') and inspection_name like concat('%',#{inspectionName},'%')
</if> </if>
</select> </select>

View File

@ -63,7 +63,7 @@
and finish_state = #{state} and finish_state = #{state}
</if> </if>
<if test="null != year"> <if test="null != year">
and `year` = #{year} and `year_num` = #{year}
</if> </if>
</select> </select>

View File

@ -56,14 +56,7 @@
limit #{page},#{pageSize} limit #{page},#{pageSize}
</select> </select>
<select id="selectEntPostTaskTotal" resultType="java.lang.Long">
select count(ept.task_id) from ent_post_task ept
left join ent_post_list epl on ept.ent_list_id = epl.post_list_id
where epl.enterprise_id = #{enterpriseId}
<if test="null != year">
and epl.year_num = #{year}
</if>
</select>
<select id="selectEntPostTaskTotal" resultType="java.lang.Long"> <select id="selectEntPostTaskTotal" resultType="java.lang.Long">
select count(ept.task_id) from ent_post_task ept select count(ept.task_id) from ent_post_task ept

View File

@ -23,7 +23,7 @@
</sql> </sql>
<select id="selectEntUserCredential" resultMap="BaseResultMap"> <select id="selectEntUserCredential" resultMap="BaseResultMap">
select * from ent_user_credential where ent_user_id = #{entUserId} limit #{page},#{pageSize} select * from ent_user_credential where ent_user_id = #{entUserId}
</select> </select>
<update id="updateEntUserCredential" parameterType="com.rzyc.model.EntUserCredential"> <update id="updateEntUserCredential" parameterType="com.rzyc.model.EntUserCredential">

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.rzyc.mapper.EntUserTypeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.rzyc.model.EntUserType">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="create_time" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, create_time
</sql>
<select id="selectEntUserType" resultMap="BaseResultMap">
select * from ent_user_type
</select>
</mapper>

View File

@ -45,4 +45,8 @@
#{data.createTime},#{data.createBy}) #{data.createTime},#{data.createBy})
</insert> </insert>
<select id="getParentPost" resultMap="BaseResultMap">
select ep2.* from ent_post ep inner join ent_post ep2 on ep2.post_id = ep.parent_id where ep.post_id = #{postId}
</select>
</mapper> </mapper>

View File

@ -12,7 +12,7 @@
<result column="user_type" property="userType" /> <result column="user_type" property="userType" />
<result column="age" property="age" /> <result column="age" property="age" />
<result column="work_time" property="workTime" /> <result column="work_time" property="workTime" />
<result column="passwd" property="passwd" /> <result column="password" property="password" />
<result column="post_path" property="postPath" /> <result column="post_path" property="postPath" />
<result column="post_path_name" property="postPathName" /> <result column="post_path_name" property="postPathName" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
@ -23,7 +23,7 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
ent_user_id, post_id, enterprise_id, name, mobile, user_type, age, work_time, passwd, post_path, post_path_name, create_time, create_by, modify_time, modify_by ent_user_id, post_id, enterprise_id, name, mobile, user_type, age, work_time, password, post_path, post_path_name, create_time, create_by, modify_time, modify_by
</sql> </sql>
<select id="selectByName" resultMap="BaseResultMap"> <select id="selectByName" resultMap="BaseResultMap">
@ -39,7 +39,7 @@
<result column="user_type" property="userType" /> <result column="user_type" property="userType" />
<result column="age" property="age" /> <result column="age" property="age" />
<result column="work_time" property="workTime" /> <result column="work_time" property="workTime" />
<result column="passwd" property="passwd" /> <result column="password" property="password" />
<result column="post_path" property="postPath" /> <result column="post_path" property="postPath" />
<result column="post_path_name" property="postPathName" /> <result column="post_path_name" property="postPathName" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
@ -51,10 +51,12 @@
<result column="ongoingTask" property="ongoingTask"/> <result column="ongoingTask" property="ongoingTask"/>
<result column="finishTask" property="finishTask"/> <result column="finishTask" property="finishTask"/>
<result column="overTimeTask" property="overTimeTask"/> <result column="overTimeTask" property="overTimeTask"/>
<result column="userTypeName" property="userTypeName"/>
<result column="postName" property="postName"/>
</resultMap> </resultMap>
<select id="selectEntUserList" resultMap="entUserListStatistic"> <select id="selectEntUserList" resultMap="entUserListStatistic">
select eu.*,ep.name postName, select eu.*,ep.name postName,eut.name userTypeName,
sum(case when credential_state = 1 then 1 else 0 end)as noTimeout, sum(case when credential_state = 1 then 1 else 0 end)as noTimeout,
sum(case when credential_state = 2 then 1 else 0 end)as overtime , sum(case when credential_state = 2 then 1 else 0 end)as overtime ,
sum(case when task_state = 1 then 1 else 0 end) as ongoingTask, sum(case when task_state = 1 then 1 else 0 end) as ongoingTask,
@ -64,6 +66,7 @@
left join ent_post ep on eu.post_id = ep.post_id left join ent_post ep on eu.post_id = ep.post_id
left join ent_user_credential euc on eu.ent_user_id = euc.ent_user_id left join ent_user_credential euc on eu.ent_user_id = euc.ent_user_id
left join ent_post_task ept on eu.ent_user_id = ept.ent_user_id left join ent_post_task ept on eu.ent_user_id = ept.ent_user_id
left join ent_user_type eut on eut.id = eu.user_type
<if test="null != keyContent and '' != keyContent"> <if test="null != keyContent and '' != keyContent">
where eu.name like concat('%',#{keyContent},'%') where eu.name like concat('%',#{keyContent},'%')
or eu.job_number like concat('%',#{keyContent},'%') or eu.job_number like concat('%',#{keyContent},'%')
@ -72,7 +75,6 @@
<if test="null != postId and '' != postId"> <if test="null != postId and '' != postId">
and eu.post_path like concat('%',#{postId},'%') and eu.post_path like concat('%',#{postId},'%')
</if> </if>
limit #{page},#{pageSize}
</select> </select>
<update id="updateEntUser" parameterType="com.rzyc.model.ent.EntUser"> <update id="updateEntUser" parameterType="com.rzyc.model.ent.EntUser">
@ -83,7 +85,7 @@
user_type = #{entUser.userType}, user_type = #{entUser.userType},
age = #{entUser.age}, age = #{entUser.age},
work_time = #{entUser.workTime}, work_time = #{entUser.workTime},
passwd = #{entUser.passwd}, password = #{entUser.password},
post_path = #{entUser.postPath}, post_path = #{entUser.postPath},
post_path_name = #{entUser.postPathName}, post_path_name = #{entUser.postPathName},
job_number = #{entUser.jobNumber}, job_number = #{entUser.jobNumber},
@ -93,7 +95,10 @@
</update> </update>
<select id="validMobile" resultMap="BaseResultMap"> <select id="validMobile" resultMap="BaseResultMap">
select ent_user_id,name,mobile from ent_user where mobile = #{mobile} select ent_user_id,name,mobile,password,post_id from ent_user where mobile = #{mobile}
<if test="null != entUserId and '' != entUserId" >
and ent_user_id != #{entUserId}
</if>
</select> </select>
<select id="validName" resultMap="BaseResultMap"> <select id="validName" resultMap="BaseResultMap">

View File

@ -2559,5 +2559,9 @@
select sysent.EntName,sysent.state,sysent.SysEnterpriseId from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.name = #{entUserName} select sysent.EntName,sysent.state,sysent.SysEnterpriseId from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.name = #{entUserName}
</select> </select>
<select id="findEnterpriseByPhoneNumber" resultMap="BaseResultMap">
select sysent.EntName,sysent.state,sysent.SysEnterpriseId from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.mobile = #{entUserPhone}
</select>
</mapper> </mapper>

View File

@ -6,9 +6,11 @@ import com.common.utils.model.Pager;
import com.common.utils.model.SingleResult; import com.common.utils.model.SingleResult;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -27,22 +29,13 @@ public class PageAspect {
@Pointcut("@annotation(com.common.utils.pager.PageOperation)execution(* com.rzyc..*.*(..))") @Pointcut("@annotation(com.common.utils.pager.PageOperation)execution(* com.rzyc..*.*(..))")
public void page() {} public void page() {}
@Around("page()") @Before("page()")
public Object pageOperation(ProceedingJoinPoint joinPoint) throws Throwable { public void pageOperation(JoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
String[] paramNames = signature.getParameterNames(); String[] paramNames = signature.getParameterNames();
//搜寻参数,设置分页参数 //搜寻参数,设置分页参数
boolean isPage = setPageParams(args, paramNames); boolean isPage = setPageParams(args, paramNames);
Object proceed = joinPoint.proceed();
if (isPage){
Page page = (Page) proceed;
Pager pager = new Pager();
pager.setRows(page.getResult());
pager.setTotal(page.getTotal());
return pager;
}
return proceed;
} }
@ -58,7 +51,7 @@ public class PageAspect {
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
Object arg = args[i]; Object arg = args[i];
//自定义对象 //自定义对象
if (arg.getClass().getClassLoader()!=null){ if (null != arg && null != arg.getClass().getClassLoader()){
if (List.class.isAssignableFrom(arg.getClass())||arg instanceof List){ if (List.class.isAssignableFrom(arg.getClass())||arg instanceof List){
continue; continue;
} }

View File

@ -527,6 +527,10 @@ public class BaseController {
@Autowired @Autowired
protected InEntListMapper inEntListMapper; protected InEntListMapper inEntListMapper;
//企业行业清单
@Autowired
protected EntUserTypeMapper entUserTypeMapper;
/** /**
* 新都文件地址处理 * 新都文件地址处理
* @param url * @param url

View File

@ -1,14 +1,9 @@
package com.rzyc.controller; package com.rzyc.controller;
import com.common.utils.model.Pager;
import com.common.utils.model.SingleResult; import com.common.utils.model.SingleResult;
import com.common.utils.pager.PageOperation;
import com.github.pagehelper.Page;
import com.rzyc.config.MethodAnnotation; import com.rzyc.config.MethodAnnotation;
import com.rzyc.model.EntDevice; import com.rzyc.model.*;
import com.rzyc.model.EntDeviceType;
import com.rzyc.model.EntOperatingInstruction;
import com.rzyc.model.dto.*; import com.rzyc.model.dto.*;
import com.rzyc.service.PcBusinessService; import com.rzyc.service.PcBusinessService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -20,8 +15,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
@ -38,6 +31,8 @@ public class EnterpriseEquipmentController extends BaseController {
PcBusinessService pcBusinessService; PcBusinessService pcBusinessService;
public EnterpriseEquipmentController(PcBusinessService pcBusinessService) { public EnterpriseEquipmentController(PcBusinessService pcBusinessService) {
this.pcBusinessService = pcBusinessService; this.pcBusinessService = pcBusinessService;
} }
@ -56,7 +51,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entEquipmentTypeList','entEquipmentList:update')") @PreAuthorize("hasAnyAuthority('entEquipmentTypeList','entEquipmentList:update')")
@MethodAnnotation(authorizations = {"entEquipmentTypeList","entEquipmentList:update"},name = "企业设备类型列表") @MethodAnnotation(authorizations = {"entEquipmentTypeList","entEquipmentList:update"},name = "企业设备类型列表")
@ResponseBody @ResponseBody
public SingleResult<List<EntDeviceType>> entEquipmentTypeList(@NotNull(message = "公司id不能为null") String enterpriseId)throws Exception{ public SingleResult<List<EntDeviceType>> entEquipmentTypeList(@RequestParam(required = true) String enterpriseId)throws Exception{
return pcBusinessService.entEquipmentTypeList(enterpriseId); return pcBusinessService.entEquipmentTypeList(enterpriseId);
} }
@ -71,13 +66,15 @@ public class EnterpriseEquipmentController extends BaseController {
@ApiOperation(value = "企业设备列表", notes = "企业设备列表") @ApiOperation(value = "企业设备列表", notes = "企业设备列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string"), @ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string"),
@ApiImplicitParam(name = "typeId", value = "设备类型id", required = false, dataType = "string") @ApiImplicitParam(name = "typeId", value = "设备类型id", required = false, dataType = "string"),
@ApiImplicitParam(name = "page", value = "page", required = true, dataType = "string"),
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "string")
}) })
@GetMapping(value = "/entEquipmentList") @GetMapping(value = "/entEquipmentList")
@PreAuthorize("hasAnyAuthority('entEquipmentList','entEquipmentList:update')") @PreAuthorize("hasAnyAuthority('entEquipmentList','entEquipmentList:update')")
@MethodAnnotation(authorizations = {"entEquipmentList","entEquipmentList:update"},name = "企业设备列表") @MethodAnnotation(authorizations = {"entEquipmentList","entEquipmentList:update"},name = "企业设备列表")
@ResponseBody @ResponseBody
public Object entEquipmentList(@NotNull(message = "公司id不能为null") String enterpriseId, String typeId,Integer page,Integer pageSize)throws Exception{ public SingleResult<List<EntDevice>> entEquipmentList(@RequestParam(required = true) String enterpriseId, String typeId,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entEquipmentList(enterpriseId,typeId,page,pageSize); return pcBusinessService.entEquipmentList(enterpriseId,typeId,page,pageSize);
} }
@ -98,7 +95,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entEquipmentStatistic')") @PreAuthorize("hasAnyAuthority('entEquipmentStatistic')")
@MethodAnnotation(authorizations = {"entEquipmentStatistic"},name = "企业设备保养和维修检查记录统计") @MethodAnnotation(authorizations = {"entEquipmentStatistic"},name = "企业设备保养和维修检查记录统计")
@ResponseBody @ResponseBody
public SingleResult<List<EntDevice>> entEquipmentStatistic(@NotNull(message = "公司id不能为null") String enterpriseId, String deviceId)throws Exception{ public SingleResult<List<EntDevice>> entEquipmentStatistic(@RequestParam(required = true) String enterpriseId, String deviceId)throws Exception{
return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId); return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId);
} }
@ -143,7 +140,7 @@ public class EnterpriseEquipmentController extends BaseController {
@ApiImplicitParam(name = "inspectionName", value = "巡检名", required = false, dataType = "string") @ApiImplicitParam(name = "inspectionName", value = "巡检名", required = false, dataType = "string")
}) })
@ResponseBody @ResponseBody
public Object deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize)throws Exception{ public SingleResult<List<EntDeviceInsCycle>> deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.deviceInspectionCycle(inspectionName,page,pageSize); return pcBusinessService.deviceInspectionCycle(inspectionName,page,pageSize);
} }
@ -182,12 +179,12 @@ public class EnterpriseEquipmentController extends BaseController {
* @throws Exception * @throws Exception
*/ */
@ApiOperation(value = "设备巡检记录", notes = "设备巡检记录") @ApiOperation(value = "设备巡检记录", notes = "设备巡检记录")
@PostMapping(value = "/inspectionRecord") @PostMapping(value = "/insRecord")
@PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')") @PreAuthorize("hasAnyAuthority('insRecord','insRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "设备巡检记录") @MethodAnnotation(authorizations = {"insRecord","insRecord:update"},name = "设备巡检记录")
@ResponseBody @ResponseBody
public Object inspectionRecord(String inspectionRecordName,Integer page,Integer pageSize)throws Exception{ public SingleResult<List<EntInsRecord>> inspectionRecord(String inspectionRecordName,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.selectInspectionRecord(inspectionRecordName,page,pageSize); return pcBusinessService.selectInsRecord(inspectionRecordName,page,pageSize);
} }
@ -202,7 +199,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('sparePartList','sparePartList:update')") @PreAuthorize("hasAnyAuthority('sparePartList','sparePartList:update')")
@MethodAnnotation(authorizations = {"sparePartList","sparePartList:update"},name = "备件列表") @MethodAnnotation(authorizations = {"sparePartList","sparePartList:update"},name = "备件列表")
@ResponseBody @ResponseBody
public Object sparePartList(String name,Integer page,Integer pageSize)throws Exception{ public SingleResult<List<SparePart>> sparePartList(String name, Integer page, Integer pageSize)throws Exception{
return pcBusinessService.sparePartList(name,page,pageSize); return pcBusinessService.sparePartList(name,page,pageSize);
} }
@ -247,7 +244,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entDeviceMaintenancePlan','entDeviceMaintenancePlan:update')") @PreAuthorize("hasAnyAuthority('entDeviceMaintenancePlan','entDeviceMaintenancePlan:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenancePlan","entDeviceMaintenancePlan:update"},name = "保养计划列表") @MethodAnnotation(authorizations = {"entDeviceMaintenancePlan","entDeviceMaintenancePlan:update"},name = "保养计划列表")
@ResponseBody @ResponseBody
public Object entDeviceMaintenancePlan(Integer page,Integer pageSize)throws Exception{ public SingleResult<List<EntDeviceMaintenancePlan>> entDeviceMaintenancePlan(Integer page, Integer pageSize)throws Exception{
return pcBusinessService.entDeviceMaintenancePlan(page,pageSize) ; return pcBusinessService.entDeviceMaintenancePlan(page,pageSize) ;
} }
@ -280,7 +277,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entDeviceMaintenanceRecord','entDeviceMaintenanceRecord:update')") @PreAuthorize("hasAnyAuthority('entDeviceMaintenanceRecord','entDeviceMaintenanceRecord:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenanceRecord","entDeviceMaintenanceRecord:update"},name = "保养记录") @MethodAnnotation(authorizations = {"entDeviceMaintenanceRecord","entDeviceMaintenanceRecord:update"},name = "保养记录")
@ResponseBody @ResponseBody
public Object entDeviceMaintenanceRecord(Integer page,Integer pageSize)throws Exception{ public SingleResult<List<EntDeviceMaintenanceRecord>> entDeviceMaintenanceRecord(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entDeviceMaintenanceRecord(page,pageSize); return pcBusinessService.entDeviceMaintenanceRecord(page,pageSize);
} }
@ -296,7 +293,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')") @PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "送检记录") @MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "送检记录")
@ResponseBody @ResponseBody
public Object inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime,Integer page,Integer pageSize)throws Exception{ public SingleResult<List<EntInspectionRecord>> inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime,Integer page,Integer pageSize)throws Exception {
return pcBusinessService.inspectionRecord(startTime, endTime, page, pageSize); return pcBusinessService.inspectionRecord(startTime, endTime, page, pageSize);
} }
@ -327,7 +324,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('repairPlan','repairPlan:update')") @PreAuthorize("hasAnyAuthority('repairPlan','repairPlan:update')")
@MethodAnnotation(authorizations = {"repairPlan","repairPlan:update"},name = "维修计划") @MethodAnnotation(authorizations = {"repairPlan","repairPlan:update"},name = "维修计划")
@ResponseBody @ResponseBody
public Object repairPlan(Integer page,Integer pageSize)throws Exception{ public SingleResult<EntRepairPlan> repairPlan(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.repairPlan(page,pageSize); return pcBusinessService.repairPlan(page,pageSize);
} }
@ -358,7 +355,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('repairRecord','repairRecord:update')") @PreAuthorize("hasAnyAuthority('repairRecord','repairRecord:update')")
@MethodAnnotation(authorizations = {"repairRecord","repairRecord:update"},name = "维修记录") @MethodAnnotation(authorizations = {"repairRecord","repairRecord:update"},name = "维修记录")
@ResponseBody @ResponseBody
public Object repairRecord(Integer page,Integer pageSize)throws Exception{ public SingleResult<EntRepairRecord> repairRecord(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.repairRecord(page,pageSize); return pcBusinessService.repairRecord(page,pageSize);
} }
@ -372,7 +369,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('reportRecord','reportRecord:update')") @PreAuthorize("hasAnyAuthority('reportRecord','reportRecord:update')")
@MethodAnnotation(authorizations = {"reportRecord","reportRecord:update"},name = "报修记录") @MethodAnnotation(authorizations = {"reportRecord","reportRecord:update"},name = "报修记录")
@ResponseBody @ResponseBody
public Object reportRecord(Integer page,Integer pageSize)throws Exception{ public SingleResult<EntReportRepair> reportRecord(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.reportRecord(page,pageSize); return pcBusinessService.reportRecord(page,pageSize);
} }
@ -404,7 +401,7 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('operatingInstructions','operatingInstructions:update')") @PreAuthorize("hasAnyAuthority('operatingInstructions','operatingInstructions:update')")
@MethodAnnotation(authorizations = {"operatingInstructions","operatingInstructions:update"},name = "操作规程") @MethodAnnotation(authorizations = {"operatingInstructions","operatingInstructions:update"},name = "操作规程")
@ResponseBody @ResponseBody
public Object operatingInstructions(@RequestBody OperatingInstructionDto operatingInstructionDto)throws Exception{ public SingleResult<EntOperatingInstruction> operatingInstructions(@RequestBody OperatingInstructionDto operatingInstructionDto)throws Exception{
return pcBusinessService.operatingInstructions(operatingInstructionDto); return pcBusinessService.operatingInstructions(operatingInstructionDto);
} }

View File

@ -59,10 +59,7 @@ public class PersonalController extends BaseController{
RedisUtil redisUtil; RedisUtil redisUtil;
/**
*只允许使用page注解的使用此静态包装
*/
final static SingleResult singleResult = new SingleResult();
@Autowired @Autowired
public PersonalController(UserLoginService userLoginService, PcBusinessService pcBusinessService, RedisUtil redisUtil) { public PersonalController(UserLoginService userLoginService, PcBusinessService pcBusinessService, RedisUtil redisUtil) {
@ -202,6 +199,7 @@ public class PersonalController extends BaseController{
@MethodAnnotation(authorizations = {"entUserPostList","entUserPostList:update"},name = "企业用户工作要务") @MethodAnnotation(authorizations = {"entUserPostList","entUserPostList:update"},name = "企业用户工作要务")
@ResponseBody @ResponseBody
public SingleResult<List<EntPostList>> entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{ public SingleResult<List<EntPostList>> entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{
SingleResult singleResult = new SingleResult();
singleResult.setData(pcBusinessService.entUserPostList(entUserPostListDto)); singleResult.setData(pcBusinessService.entUserPostList(entUserPostListDto));
return singleResult; return singleResult;
} }
@ -218,6 +216,7 @@ public class PersonalController extends BaseController{
@MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户日常工作清单") @MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户日常工作清单")
@ResponseBody @ResponseBody
public SingleResult<List<EntPostTask>> entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{ public SingleResult<List<EntPostTask>> entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{
SingleResult singleResult = new SingleResult();
singleResult.setData(pcBusinessService.entUserPostTask(entUserPostTaskDto)); singleResult.setData(pcBusinessService.entUserPostTask(entUserPostTaskDto));
return singleResult; return singleResult;
} }
@ -235,6 +234,7 @@ public class PersonalController extends BaseController{
@MethodAnnotation(authorizations = {"entUserPostDuty","entUserPostDuty:update"},name = "企业用户岗位职责") @MethodAnnotation(authorizations = {"entUserPostDuty","entUserPostDuty:update"},name = "企业用户岗位职责")
@ResponseBody @ResponseBody
public SingleResult<List<EntPostDuty>> entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{ public SingleResult<List<EntPostDuty>> entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{
SingleResult singleResult = new SingleResult();
singleResult.setData(pcBusinessService.entUserPostDuty(entUserPostDutyDto)); singleResult.setData(pcBusinessService.entUserPostDuty(entUserPostDutyDto));
return singleResult; return singleResult;
} }
@ -336,7 +336,7 @@ public class PersonalController extends BaseController{
@MethodAnnotation(authorizations = {"addOrUpdateEntUser:update"},name = "新增和修改公司岗位人员") @MethodAnnotation(authorizations = {"addOrUpdateEntUser:update"},name = "新增和修改公司岗位人员")
@ResponseBody @ResponseBody
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public SingleResult addOrUpdateEntUser(@RequestBody AddOrUpdateEntUserDto addOrUpdateEntUserDto)throws Exception{ public SingleResult addOrUpdateEntUser(@RequestBody @Valid AddOrUpdateEntUserDto addOrUpdateEntUserDto)throws Exception{
return pcBusinessService.addOrUpdateEntUser(addOrUpdateEntUserDto); return pcBusinessService.addOrUpdateEntUser(addOrUpdateEntUserDto);
} }
@ -395,13 +395,26 @@ 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 @RequestParam(required = true) String userId)throws Exception{
)throws Exception{
return pcBusinessService.entListGroupByListId(enterpriseId,listId,userId); return pcBusinessService.entListGroupByListId(enterpriseId,listId,userId);
} }
/**
* 人员类型列表
* @return list
* @throws Exception
*/
@ApiOperation(value = "人员类型列表", notes = "人员类型列表")
@GetMapping(value = "/entUserTypeList")
@PreAuthorize("hasAnyAuthority('entUserTypeList')")
@MethodAnnotation(authorizations = {"entUserTypeList"},name = "人员类型列表")
@ResponseBody
public SingleResult<List<EntPostList>> entListGroupByListId()throws Exception{
return pcBusinessService.entUserTypeList();
}

View File

@ -9,6 +9,7 @@ import com.common.utils.model.Message;
import com.common.utils.model.SingleResult; import com.common.utils.model.SingleResult;
import com.common.utils.pager.PageOperation; import com.common.utils.pager.PageOperation;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.rzyc.advice.CustomException;
import com.rzyc.config.RedisUtil; import com.rzyc.config.RedisUtil;
import com.rzyc.controller.BaseController; import com.rzyc.controller.BaseController;
import com.rzyc.enums.RedisKeys; import com.rzyc.enums.RedisKeys;
@ -110,6 +111,7 @@ public class PcBusinessService extends BaseController {
entPostMap.put("name",entPost.getName()); entPostMap.put("name",entPost.getName());
entPostMap.put("parentId",entPost.getParentId()); entPostMap.put("parentId",entPost.getParentId());
entPostMap.put("subordinates",entPost.getSubordinates()); entPostMap.put("subordinates",entPost.getSubordinates());
entPostMap.put("postPath",entPost.getPostPath());
data.add(entPostMap); data.add(entPostMap);
} }
com.alibaba.fastjson.JSONArray result = TypeConversion.listToTree(com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(data)),"postId","parentId","children"); com.alibaba.fastjson.JSONArray result = TypeConversion.listToTree(com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(data)),"postId","parentId","children");
@ -146,12 +148,11 @@ public class PcBusinessService extends BaseController {
return list; return list;
} }
@PageOperation
public SingleResult entUserCredential(String enterpriseId, String entUserId,Integer page,Integer pageSize){ public SingleResult entUserCredential(String enterpriseId, String entUserId,Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult(); SingleResult singleResult = new SingleResult();
page = pageSize * (page - 1); Page<EntUserCredential>list = (Page<EntUserCredential>) entUserCredentialMapper.selectEntUserCredential(enterpriseId,entUserId);
List<EntUserCredential>list = entUserCredentialMapper.selectEntUserCredential(enterpriseId,entUserId,page,pageSize); singleResult.setDataPager(list);
singleResult.setData(list);
return singleResult; return singleResult;
} }
@ -189,18 +190,19 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
@PageOperation
public SingleResult entUserList(String keyContent,Integer page,Integer pageSize,String postId){ public SingleResult entUserList(String keyContent,Integer page,Integer pageSize,String postId){
SingleResult singleResult = new SingleResult(); SingleResult singleResult = new SingleResult();
page = pageSize * (page - 1); Page<EntUser>users = (Page<EntUser>) entUserMapper.selectEntUserList(keyContent,postId);
List<EntUser>users = entUserMapper.selectEntUserList(keyContent,page,pageSize,postId);
//计算履职百分比,后期这里使用redis来读取履职进度 //计算履职百分比,后期这里使用redis来读取履职进度
for (EntUser e:users) { for (EntUser e:users.getResult()) {
Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask(); Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask();
double percent = Arith.div(total,e.getFinishTask()) * 100; if (null != total && total > 0){
double percent = Arith.div(e.getFinishTask(),total) * 100;
e.setEntUserTaskPercent(percent); e.setEntUserTaskPercent(percent);
} }
singleResult.setData(users); }
singleResult.setDataPager(users);
return singleResult; return singleResult;
} }
@ -225,8 +227,16 @@ public class PcBusinessService extends BaseController {
entUser.setPasswd(MD5.md5(entUser.getName() + entUser.getMobile())); entUser.setPasswd(MD5.md5(entUser.getName() + entUser.getMobile()));
int result = 0 ; int result = 0 ;
if (StringUtils.isNotBlank(entUser.getEntUserId())){ if (StringUtils.isNotBlank(entUser.getEntUserId())){
EntUser phone = entUserMapper.validMobile(entUser.getMobile(),entUser.getEntUserId());
if (null != phone){
throw new CustomException("手机号已经存在");
}
result = entUserMapper.updateEntUser(entUser); result = entUserMapper.updateEntUser(entUser);
}else { }else {
EntUser phone = entUserMapper.validMobile(entUser.getMobile(),null);
if (null != phone){
throw new CustomException("手机号已经存在");
}
result = entUserMapper.insert(entUser); result = entUserMapper.insert(entUser);
} }
if (result != 1){ if (result != 1){
@ -252,7 +262,7 @@ public class PcBusinessService extends BaseController {
singleResult.setMessage(Message.MOBILE_IS_ILLEGAL); singleResult.setMessage(Message.MOBILE_IS_ILLEGAL);
return singleResult; return singleResult;
} }
EntUser entUser = entUserMapper.validMobile(mobile); EntUser entUser = entUserMapper.validMobile(mobile,null);
if (entUser != null && !entUserId.equals(entUser.getEntUserId()) ){ if (entUser != null && !entUserId.equals(entUser.getEntUserId()) ){
singleResult.setCode(Code.ERROR.getCode()); singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.REGISTERED); singleResult.setMessage(Message.REGISTERED);
@ -280,10 +290,10 @@ public class PcBusinessService extends BaseController {
List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(enterpriseId); List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(enterpriseId);
//树结构处理 //树结构处理
JSONArray jsonArray = handleEntEquipment(entDeviceTypes); JSONArray jsonArray = handleEntEquipment(entDeviceTypes);
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class); List<EntDeviceType>type = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntDeviceType.class);
singleResult.setData(posts); singleResult.setData(type);
//存redis //存redis
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),enterpriseId),posts,0); boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),enterpriseId),type,0);
return singleResult; return singleResult;
} }
@ -307,10 +317,12 @@ public class PcBusinessService extends BaseController {
return result; return result;
} }
@PageOperation
public Object entEquipmentList(String enterpriseId, String typeId,Integer page,Integer pageSize){ public SingleResult entEquipmentList(String enterpriseId, String typeId,Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntDevice> devices = (Page<EntDevice>) entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId); Page<EntDevice> devices = (Page<EntDevice>) entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId);
return devices; singleResult.setDataPager(devices);
return singleResult;
} }
public SingleResult entEquipmentStatistic(String enterpriseId, String deviceId){ public SingleResult entEquipmentStatistic(String enterpriseId, String deviceId){
@ -328,11 +340,16 @@ public class PcBusinessService extends BaseController {
if (null != addOrUpdateEntPostDto && null != addOrUpdateEntPostDto.getPostId()){ if (null != addOrUpdateEntPostDto && null != addOrUpdateEntPostDto.getPostId()){
entPost.setModifyBy(getUserId()); entPost.setModifyBy(getUserId());
entPost.setModifyTime(new Date()); entPost.setModifyTime(new Date());
EntPost post = entPostMapper.getParentPost(addOrUpdateEntPostDto.getPostId());
entPost.setPostPath(post.getPostPath() + "," + addOrUpdateEntPostDto.getPostId());
result = entPostMapper.updateEntPost(entPost); result = entPostMapper.updateEntPost(entPost);
}else { }else {
entPost.setPostId(RandomNumber.getUUid()); String uuid = RandomNumber.getUUid();
entPost.setPostId(uuid);
entPost.setCreateTime(new Date()); entPost.setCreateTime(new Date());
entPost.setCreateBy(getUserId()); entPost.setCreateBy(getUserId());
EntPost post = entPostMapper.getParentPost(addOrUpdateEntPostDto.getPostId());
entPost.setPostPath(post.getPostPath() + "," + uuid);
result = entPostMapper.insertEntPost(entPost); result = entPostMapper.insertEntPost(entPost);
} }
if (result != 1 ){ if (result != 1 ){
@ -399,9 +416,12 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public Object deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize){ @PageOperation
public SingleResult deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntDeviceInsCycle>list = (Page<EntDeviceInsCycle>) entDeviceInsCycleMapper.deviceInspectionCycle(inspectionName); Page<EntDeviceInsCycle>list = (Page<EntDeviceInsCycle>) entDeviceInsCycleMapper.deviceInspectionCycle(inspectionName);
return list; singleResult.setDataPager(list);
return singleResult;
} }
public SingleResult addOrUpdateDeviceInspectionCycle(AddOrUpdateDeviceInspectionCycleDto addOrUpdateDeviceInspectionCycleDto){ public SingleResult addOrUpdateDeviceInspectionCycle(AddOrUpdateDeviceInspectionCycleDto addOrUpdateDeviceInspectionCycleDto){
@ -438,14 +458,21 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public Object selectInspectionRecord(String inspectionRecordName,Integer page,Integer pageSize){
@PageOperation
public SingleResult selectInsRecord(String inspectionRecordName,Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntInsRecord> entInsRecords = (Page<EntInsRecord>) entInsRecordMapper.selectInspectionRecord(inspectionRecordName); Page<EntInsRecord> entInsRecords = (Page<EntInsRecord>) entInsRecordMapper.selectInspectionRecord(inspectionRecordName);
return entInsRecords; singleResult.setDataPager(entInsRecords);
return singleResult;
} }
public Object sparePartList(String name,Integer page,Integer pageSize){ @PageOperation
public SingleResult sparePartList(String name, Integer page, Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<SparePart>sparePartList = (Page<SparePart>) sparePartMapper.sparePartList(name); Page<SparePart>sparePartList = (Page<SparePart>) sparePartMapper.sparePartList(name);
return sparePartList; singleResult.setDataPager(sparePartList);
return singleResult;
} }
public SingleResult sparePartUpdate(SparePartDto sparePartDto){ public SingleResult sparePartUpdate(SparePartDto sparePartDto){
@ -482,9 +509,12 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public Object entDeviceMaintenancePlan(Integer page,Integer pageSize){ @PageOperation
public SingleResult entDeviceMaintenancePlan(Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntDeviceMaintenancePlan> list = (Page<EntDeviceMaintenancePlan>) entDeviceMaintenancePlanMapper.selectEntDeviceMaintenancePlanList(); Page<EntDeviceMaintenancePlan> list = (Page<EntDeviceMaintenancePlan>) entDeviceMaintenancePlanMapper.selectEntDeviceMaintenancePlanList();
return list; singleResult.setDataPager(list);
return singleResult;
} }
public SingleResult entDeviceMaintenanceRecordUpdate(EntDeviceMaintenanceRecordDto entDeviceMaintenanceRecordDto){ public SingleResult entDeviceMaintenanceRecordUpdate(EntDeviceMaintenanceRecordDto entDeviceMaintenanceRecordDto){
@ -505,18 +535,27 @@ public class PcBusinessService extends BaseController {
} }
@PageOperation @PageOperation
public Object entDeviceMaintenanceRecord(Integer page,Integer pageSize){ public SingleResult entDeviceMaintenanceRecord(Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntDeviceMaintenanceRecord> list = (Page<EntDeviceMaintenanceRecord>) entDeviceMaintenanceRecordMapper.selectEntDeviceMaintenanceRecord(); Page<EntDeviceMaintenanceRecord> list = (Page<EntDeviceMaintenanceRecord>) entDeviceMaintenanceRecordMapper.selectEntDeviceMaintenanceRecord();
return list; singleResult.setDataPager(list);
return singleResult;
} }
public Object inspectionRecord(String startTime,String endTime,Integer page,Integer pageSize){ @PageOperation
public SingleResult inspectionRecord(String startTime,String endTime,Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntInspectionRecord>inspectionRecords = (Page<EntInspectionRecord>) entInspectionRecordMapper.selectInspectionRecord(startTime,endTime); Page<EntInspectionRecord>inspectionRecords = (Page<EntInspectionRecord>) entInspectionRecordMapper.selectInspectionRecord(startTime,endTime);
return inspectionRecords; singleResult.setDataPager(inspectionRecords);
return singleResult;
} }
public Object repairPlan(Integer page,Integer pageSize){
@PageOperation
public SingleResult repairPlan(Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntRepairPlan>entRepairPlans = (Page<EntRepairPlan>) entRepairPlanMapper.selectRepairPlan(); Page<EntRepairPlan>entRepairPlans = (Page<EntRepairPlan>) entRepairPlanMapper.selectRepairPlan();
return entRepairPlans; singleResult.setDataPager(entRepairPlans);
return singleResult;
} }
public SingleResult repairPlanUpdate(EntRepairPlanDto entRepairPlanDto){ public SingleResult repairPlanUpdate(EntRepairPlanDto entRepairPlanDto){
@ -554,15 +593,19 @@ public class PcBusinessService extends BaseController {
} }
@PageOperation @PageOperation
public Object repairRecord(Integer page,Integer pageSize){ public SingleResult repairRecord(Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntRepairRecord> repairRecords = (Page<EntRepairRecord>) entRepairRecordMapper.repairRecord(); Page<EntRepairRecord> repairRecords = (Page<EntRepairRecord>) entRepairRecordMapper.repairRecord();
return repairRecords; singleResult.setDataPager(repairRecords);
return singleResult;
} }
@PageOperation @PageOperation
public Object reportRecord(Integer page,Integer pageSize){ public SingleResult reportRecord(Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
Page<EntReportRepair>reportRepairs = (Page<EntReportRepair>) entReportRepairMapper.reportRecord(); Page<EntReportRepair>reportRepairs = (Page<EntReportRepair>) entReportRepairMapper.reportRecord();
return reportRepairs; singleResult.setDataPager(reportRepairs);
return singleResult;
} }
public SingleResult addOrUpdateReportRecord(ReportRecordDto reportRecordDto){ public SingleResult addOrUpdateReportRecord(ReportRecordDto reportRecordDto){
@ -583,9 +626,11 @@ public class PcBusinessService extends BaseController {
} }
@PageOperation @PageOperation
public Object operatingInstructions(OperatingInstructionDto operatingInstructionDto){ public SingleResult operatingInstructions(OperatingInstructionDto operatingInstructionDto){
SingleResult SingleResult = new SingleResult();
Page<EntOperatingInstruction> page = (Page<EntOperatingInstruction>) entOperatingInstructionMapper.selectOperatingInstructions(operatingInstructionDto.getName()); Page<EntOperatingInstruction> page = (Page<EntOperatingInstruction>) entOperatingInstructionMapper.selectOperatingInstructions(operatingInstructionDto.getName());
return page; SingleResult.setDataPager(page);
return SingleResult;
} }
@ -629,7 +674,7 @@ public class PcBusinessService extends BaseController {
Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,null); Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,null);
//2代表已完成状态 //2代表已完成状态
Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,null); Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,null);
double finishPercent = Arith.div(total,finishCount) * 100; double finishPercent = Arith.div(finishCount,total) * 100;
map.put("finishPercent",finishPercent); map.put("finishPercent",finishPercent);
List<EntPostTask>tasks = entPostTaskMapper.selectEntUserPostTaskByListId(enterpriseId,listId,keyWord,page,pageSize); List<EntPostTask>tasks = entPostTaskMapper.selectEntUserPostTaskByListId(enterpriseId,listId,keyWord,page,pageSize);
map.put("list",tasks); map.put("list",tasks);
@ -649,8 +694,11 @@ 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 ){
double finishPercent = Arith.div(finishCount,total) * 100; double finishPercent = Arith.div(finishCount,total) * 100;
singleResult.setData(finishPercent); singleResult.setData(finishPercent);
}
return singleResult; return singleResult;
} }
@ -696,6 +744,13 @@ public class PcBusinessService extends BaseController {
return singleResult; return singleResult;
} }
public SingleResult entUserTypeList(){
SingleResult singleResult = new SingleResult();
List<EntUserType>list = entUserTypeMapper.selectEntUserType();
singleResult.setData(list);
return singleResult;
}

View File

@ -71,8 +71,8 @@ public class UserDetailsServiceImpl implements UserDetailsService {
@Override @Override
public UserDetails loadUserByUsername(String name){ public UserDetails loadUserByUsername(String name){
//判断数据库用户 //判断数据库手机号
EntUser entUser = entUserMapper.selectByName(name); EntUser entUser = entUserMapper.validMobile(name,null);
if (Objects.isNull(entUser)){ if (Objects.isNull(entUser)){
throw new CustomException("用户名不存在"); throw new CustomException("用户名不存在");

View File

@ -70,7 +70,7 @@ public class UserLoginService {
if (Objects.isNull(userDetails)) { if (Objects.isNull(userDetails)) {
throw new CustomException("账号不存在"); throw new CustomException("账号不存在");
} }
SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByName(username); SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByPhoneNumber(username);
if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){ if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){
throw new CustomException("企业不存在或已经禁用"); throw new CustomException("企业不存在或已经禁用");
} }

View File

@ -312,6 +312,12 @@
<version>2.10.2</version> <version>2.10.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.4</version>
<scope>compile</scope>
</dependency>
<!--分页 end--> <!--分页 end-->
</dependencies> </dependencies>

View File

@ -1,5 +1,7 @@
package com.common.utils.model; package com.common.utils.model;
import com.github.pagehelper.Page;
/** /**
* @version 0.1.0 * @version 0.1.0
* @since 0.1.0 * @since 0.1.0
@ -17,4 +19,15 @@ public class SingleResult<T> extends Result {
this.data = data; this.data = data;
} }
/**
* @author Xuwanxin
* @date 2022/11/8
* 封装分页*/
public void setDataPager(Page page) {
Pager pager = new Pager();
pager.setRows(page.getResult());
pager.setTotal(page.getTotal());
this.data = (T) pager;
}
} }