From e7289591db5505063d869ce9a1090123844585ea Mon Sep 17 00:00:00 2001 From: 79493 <794930212@qq.com> Date: Tue, 8 Nov 2022 18:09:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AB=AF=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=A8=A1=E5=9D=97->=E5=92=8C=E5=89=8D=E7=AB=AF=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=8E=A5=E5=8F=A3,=E5=88=86=E9=A1=B5=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=8F=AA=E8=AF=95=E7=94=A8before=E5=88=87=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E8=BF=94=E5=9B=9E=E4=B8=8D=E8=BF=9B=E8=A1=8C=E5=88=87?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=90=A6=E5=88=99=E8=AF=AD=E6=B3=95=E4=B8=8D?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB=E5=8A=A0=E5=85=A5=E6=96=B0=E7=9A=84=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E5=99=A8=E6=96=B9=E6=B3=95=E6=9D=A5=E5=B0=81=E8=A3=85pager?= =?UTF-8?q?=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rzyc/mapper/EntUserCredentialMapper.java | 4 +- .../com/rzyc/mapper/EntUserTypeMapper.java | 27 ++++ .../com/rzyc/mapper/ent/EntPostMapper.java | 8 + .../com/rzyc/mapper/ent/EntUserMapper.java | 7 +- .../rzyc/mapper/ent/SysEnterpriseMapper.java | 8 + .../main/java/com/rzyc/model/EntUserType.java | 66 ++++++++ .../rzyc/model/dto/AddOrUpdateEntUserDto.java | 2 +- .../main/java/com/rzyc/model/ent/EntUser.java | 40 ++++- .../mapper/EntDeviceInsCycleMapper.xml | 2 +- .../main/resources/mapper/EntDeviceMapper.xml | 1 + .../resources/mapper/EntInsRecordMapper.xml | 4 +- .../resources/mapper/EntPostListMapper.xml | 2 +- .../resources/mapper/EntPostTaskMapper.xml | 9 +- .../mapper/EntUserCredentialMapper.xml | 2 +- .../resources/mapper/EntUserTypeMapper.xml | 21 +++ .../resources/mapper/ent/EntPostMapper.xml | 4 + .../resources/mapper/ent/EntUserMapper.xml | 19 ++- .../mapper/ent/SysEnterpriseMapper.xml | 4 + .../main/java/com/rzyc/config/PageAspect.java | 17 +-- .../com/rzyc/controller/BaseController.java | 4 + .../EnterpriseEquipmentController.java | 61 ++++---- .../rzyc/controller/PersonalController.java | 31 ++-- .../com/rzyc/service/PcBusinessService.java | 141 ++++++++++++------ .../rzyc/service/UserDetailsServiceImpl.java | 4 +- .../com/rzyc/service/UserLoginService.java | 2 +- utils/pom.xml | 6 + .../com/common/utils/model/SingleResult.java | 13 ++ 27 files changed, 375 insertions(+), 134 deletions(-) create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/EntUserTypeMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/EntUserType.java create mode 100644 inventory-dao/src/main/resources/mapper/EntUserTypeMapper.xml diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntUserCredentialMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntUserCredentialMapper.java index 30cacec..fc5dccb 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/EntUserCredentialMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntUserCredentialMapper.java @@ -24,11 +24,9 @@ public interface EntUserCredentialMapper extends BaseMapper { * 企业用户岗位职责 * @param enterpriseId 企业id * @param entUserId 企业用户id - * @param page 页码 - * @param pageSize 条数 * @return EntUserCredential 企业用户证照 * */ - ListselectEntUserCredential(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId,@Param("page") Integer page,@Param("pageSize")Integer pageSize); + ListselectEntUserCredential(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId); /** diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntUserTypeMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntUserTypeMapper.java new file mode 100644 index 0000000..1eb561e --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntUserTypeMapper.java @@ -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; + +/** + *

+ * 人员类型 Mapper 接口 + *

+ * + * @author + * @since 2022-11-08 + */ +@Repository +public interface EntUserTypeMapper extends BaseMapper { + + /** + * 查询用户类型 + * @return list + * + * */ + ListselectEntUserType(); + +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java index 8304986..8a5ab9d 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java @@ -43,4 +43,12 @@ public interface EntPostMapper extends BaseMapper { * */ int insertEntPost(@Param("data") EntPost entPost); + + /** + * 获取上级岗位对象 + * @param postId 获取上级岗位对象 + * @return int + * */ + EntPost getParentPost(@Param("postId") String postId); + } diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java index 7ab78cb..2a43e79 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java @@ -29,12 +29,10 @@ public interface EntUserMapper extends BaseMapper { /** * 查询企业用户表 * @param keyContent 关键字 - * @param page 页码 - * @param pageSize 条数 * @param postId 岗位id * @return EntUser 企业用户实体 * */ - ListselectEntUserList(@Param("keyContent") String keyContent,@Param("page")Integer page,@Param("pageSize")Integer pageSize,@Param("postId")String postId); + ListselectEntUserList(@Param("keyContent") String keyContent,@Param("postId")String postId); /** @@ -50,9 +48,10 @@ public interface EntUserMapper extends BaseMapper { /** * 验证用户电话和名字 * @param mobile 电话 + * @param entUserId 用户id * @return int 成功或失败 * */ - EntUser validMobile(@Param("mobile") String mobile); + EntUser validMobile(@Param("mobile") String mobile,@Param("entUserId")String entUserId); /** * 验证用户电话和名字 diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/SysEnterpriseMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/SysEnterpriseMapper.java index 9659745..1d02633 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/SysEnterpriseMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/SysEnterpriseMapper.java @@ -348,4 +348,12 @@ public interface SysEnterpriseMapper extends BaseMapper { * @return SysEnterprise 企业表 * */ SysEnterprise findEnterpriseByName(@Param("entUserName")String entUserName); + + + /** + * 通过企业用户名手机号查询企业 + * @param entUserPhone 企业用户名 + * @return SysEnterprise 企业表 + * */ + SysEnterprise findEnterpriseByPhoneNumber(@Param("entUserPhone")String entUserPhone); } diff --git a/inventory-dao/src/main/java/com/rzyc/model/EntUserType.java b/inventory-dao/src/main/java/com/rzyc/model/EntUserType.java new file mode 100644 index 0000000..31e1b3d --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/EntUserType.java @@ -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; + +/** + *

+ * 人员类型 + *

+ * + * @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 + + "}"; + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntUserDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntUserDto.java index 2311baa..6c441d7 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntUserDto.java +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntUserDto.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.Date; import java.util.List; @@ -37,7 +38,6 @@ public class AddOrUpdateEntUserDto { @ApiModelProperty(value = "人员类型") private Integer userType; - @NotNull @ApiModelProperty(value = "年龄") private Integer age; diff --git a/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java b/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java index 3eef317..05c2f4d 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java +++ b/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java @@ -7,6 +7,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; @@ -52,13 +54,14 @@ public class EntUser implements Serializable { @TableField("age") private Integer age; + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "从业时间") @TableField("work_time") private Date workTime; @ApiModelProperty(value = "登录密码") - @TableField("passwd") - private String passwd; + @TableField("password") + private String password; @ApiModelProperty(value = "岗位路径") @TableField("post_path") @@ -112,7 +115,6 @@ public class EntUser implements Serializable { @ApiModelProperty(value = "工号") private String jobNumber; - @TableField(exist = false) private String token; @@ -120,6 +122,30 @@ public class EntUser implements Serializable { @TableField(exist = false) 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() { return entPostName; } @@ -250,11 +276,11 @@ public class EntUser implements Serializable { this.workTime = workTime; } public String getPasswd() { - return passwd; + return password; } - public void setPasswd(String passwd) { - this.passwd = passwd; + public void setPasswd(String password) { + this.password = password; } public String getPostPath() { return postPath; @@ -310,7 +336,7 @@ public class EntUser implements Serializable { ", userType=" + userType + ", age=" + age + ", workTime=" + workTime + - ", passwd=" + passwd + + ", password=" + password + ", postPath=" + postPath + ", postPathName=" + postPathName + ", createTime=" + createTime + diff --git a/inventory-dao/src/main/resources/mapper/EntDeviceInsCycleMapper.xml b/inventory-dao/src/main/resources/mapper/EntDeviceInsCycleMapper.xml index 2e3c7e1..c5e3634 100644 --- a/inventory-dao/src/main/resources/mapper/EntDeviceInsCycleMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntDeviceInsCycleMapper.xml @@ -29,7 +29,7 @@ diff --git a/inventory-dao/src/main/resources/mapper/EntInsRecordMapper.xml b/inventory-dao/src/main/resources/mapper/EntInsRecordMapper.xml index 2e43b7a..f1c3248 100644 --- a/inventory-dao/src/main/resources/mapper/EntInsRecordMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntInsRecordMapper.xml @@ -30,9 +30,9 @@ diff --git a/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml b/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml index 88ab46c..94e1ce4 100644 --- a/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml @@ -63,7 +63,7 @@ and finish_state = #{state} - and `year` = #{year} + and `year_num` = #{year} diff --git a/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml b/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml index dc8f911..d89fb17 100644 --- a/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml @@ -56,14 +56,7 @@ limit #{page},#{pageSize} - + - select * from ent_user_credential where ent_user_id = #{entUserId} limit #{page},#{pageSize} + select * from ent_user_credential where ent_user_id = #{entUserId} diff --git a/inventory-dao/src/main/resources/mapper/EntUserTypeMapper.xml b/inventory-dao/src/main/resources/mapper/EntUserTypeMapper.xml new file mode 100644 index 0000000..170ca2b --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/EntUserTypeMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + id, name, create_time + + + + + diff --git a/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml b/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml index 8f59e62..7009267 100644 --- a/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml @@ -45,4 +45,8 @@ #{data.createTime},#{data.createBy}) + + diff --git a/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml b/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml index b687cab..5a1fad9 100644 --- a/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ - 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 - 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 = 2 then 1 else 0 end)as overtime , 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_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_user_type eut on eut.id = eu.user_type where eu.name like concat('%',#{keyContent},'%') or eu.job_number like concat('%',#{keyContent},'%') @@ -72,7 +75,6 @@ and eu.post_path like concat('%',#{postId},'%') - limit #{page},#{pageSize} @@ -83,7 +85,7 @@ user_type = #{entUser.userType}, age = #{entUser.age}, work_time = #{entUser.workTime}, - passwd = #{entUser.passwd}, + password = #{entUser.password}, post_path = #{entUser.postPath}, post_path_name = #{entUser.postPathName}, job_number = #{entUser.jobNumber}, @@ -93,7 +95,10 @@ + + diff --git a/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java b/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java index 66d704a..3407f0a 100644 --- a/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java +++ b/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java @@ -6,9 +6,11 @@ import com.common.utils.model.Pager; import com.common.utils.model.SingleResult; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; +import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; @@ -27,22 +29,13 @@ public class PageAspect { @Pointcut("@annotation(com.common.utils.pager.PageOperation)execution(* com.rzyc..*.*(..))") public void page() {} - @Around("page()") - public Object pageOperation(ProceedingJoinPoint joinPoint) throws Throwable { + @Before("page()") + public void pageOperation(JoinPoint joinPoint) throws Throwable { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Object[] args = joinPoint.getArgs(); String[] paramNames = signature.getParameterNames(); //搜寻参数,设置分页参数 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++) { 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){ continue; } diff --git a/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java b/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java index 7dd2430..7caff23 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java @@ -527,6 +527,10 @@ public class BaseController { @Autowired protected InEntListMapper inEntListMapper; + //企业行业清单 + @Autowired + protected EntUserTypeMapper entUserTypeMapper; + /** * 新都文件地址处理 * @param url diff --git a/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java b/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java index 01f9f29..f1cce50 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java @@ -1,14 +1,9 @@ package com.rzyc.controller; -import com.common.utils.model.Pager; 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.model.EntDevice; -import com.rzyc.model.EntDeviceType; -import com.rzyc.model.EntOperatingInstruction; +import com.rzyc.model.*; import com.rzyc.model.dto.*; import com.rzyc.service.PcBusinessService; import io.swagger.annotations.Api; @@ -20,8 +15,6 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - -import javax.validation.constraints.NotNull; import java.util.List; /** @@ -38,6 +31,8 @@ public class EnterpriseEquipmentController extends BaseController { PcBusinessService pcBusinessService; + + public EnterpriseEquipmentController(PcBusinessService pcBusinessService) { this.pcBusinessService = pcBusinessService; } @@ -56,7 +51,7 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('entEquipmentTypeList','entEquipmentList:update')") @MethodAnnotation(authorizations = {"entEquipmentTypeList","entEquipmentList:update"},name = "企业设备类型列表") @ResponseBody - public SingleResult> entEquipmentTypeList(@NotNull(message = "公司id不能为null") String enterpriseId)throws Exception{ + public SingleResult> entEquipmentTypeList(@RequestParam(required = true) String enterpriseId)throws Exception{ return pcBusinessService.entEquipmentTypeList(enterpriseId); } @@ -71,13 +66,15 @@ public class EnterpriseEquipmentController extends BaseController { @ApiOperation(value = "企业设备列表", notes = "企业设备列表") @ApiImplicitParams({ @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") @PreAuthorize("hasAnyAuthority('entEquipmentList','entEquipmentList:update')") @MethodAnnotation(authorizations = {"entEquipmentList","entEquipmentList:update"},name = "企业设备列表") @ResponseBody - public Object entEquipmentList(@NotNull(message = "公司id不能为null") String enterpriseId, String typeId,Integer page,Integer pageSize)throws Exception{ + public SingleResult> entEquipmentList(@RequestParam(required = true) String enterpriseId, String typeId,Integer page,Integer pageSize)throws Exception{ return pcBusinessService.entEquipmentList(enterpriseId,typeId,page,pageSize); } @@ -98,7 +95,7 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('entEquipmentStatistic')") @MethodAnnotation(authorizations = {"entEquipmentStatistic"},name = "企业设备保养和维修检查记录统计") @ResponseBody - public SingleResult> entEquipmentStatistic(@NotNull(message = "公司id不能为null") String enterpriseId, String deviceId)throws Exception{ + public SingleResult> entEquipmentStatistic(@RequestParam(required = true) String enterpriseId, String deviceId)throws Exception{ return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId); } @@ -143,8 +140,8 @@ public class EnterpriseEquipmentController extends BaseController { @ApiImplicitParam(name = "inspectionName", value = "巡检名", required = false, dataType = "string") }) @ResponseBody - public Object deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.deviceInspectionCycle(inspectionName,page,pageSize); + public SingleResult> deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize)throws Exception{ + return pcBusinessService.deviceInspectionCycle(inspectionName,page,pageSize); } @@ -182,12 +179,12 @@ public class EnterpriseEquipmentController extends BaseController { * @throws Exception */ @ApiOperation(value = "设备巡检记录", notes = "设备巡检记录") - @PostMapping(value = "/inspectionRecord") - @PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')") - @MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "设备巡检记录") + @PostMapping(value = "/insRecord") + @PreAuthorize("hasAnyAuthority('insRecord','insRecord:update')") + @MethodAnnotation(authorizations = {"insRecord","insRecord:update"},name = "设备巡检记录") @ResponseBody - public Object inspectionRecord(String inspectionRecordName,Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.selectInspectionRecord(inspectionRecordName,page,pageSize); + public SingleResult> inspectionRecord(String inspectionRecordName,Integer page,Integer pageSize)throws Exception{ + return pcBusinessService.selectInsRecord(inspectionRecordName,page,pageSize); } @@ -202,8 +199,8 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('sparePartList','sparePartList:update')") @MethodAnnotation(authorizations = {"sparePartList","sparePartList:update"},name = "备件列表") @ResponseBody - public Object sparePartList(String name,Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.sparePartList(name,page,pageSize); + public SingleResult> sparePartList(String name, Integer page, Integer pageSize)throws Exception{ + return pcBusinessService.sparePartList(name,page,pageSize); } @@ -247,8 +244,8 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('entDeviceMaintenancePlan','entDeviceMaintenancePlan:update')") @MethodAnnotation(authorizations = {"entDeviceMaintenancePlan","entDeviceMaintenancePlan:update"},name = "保养计划列表") @ResponseBody - public Object entDeviceMaintenancePlan(Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.entDeviceMaintenancePlan(page,pageSize); + public SingleResult> entDeviceMaintenancePlan(Integer page, Integer pageSize)throws Exception{ + return pcBusinessService.entDeviceMaintenancePlan(page,pageSize) ; } @@ -280,7 +277,7 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('entDeviceMaintenanceRecord','entDeviceMaintenanceRecord:update')") @MethodAnnotation(authorizations = {"entDeviceMaintenanceRecord","entDeviceMaintenanceRecord:update"},name = "保养记录") @ResponseBody - public Object entDeviceMaintenanceRecord(Integer page,Integer pageSize)throws Exception{ + public SingleResult> entDeviceMaintenanceRecord(Integer page,Integer pageSize)throws Exception{ return pcBusinessService.entDeviceMaintenanceRecord(page,pageSize); } @@ -296,8 +293,8 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')") @MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "送检记录") @ResponseBody - public Object inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime,Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.inspectionRecord(startTime,endTime,page,pageSize); + public SingleResult> inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime,Integer page,Integer pageSize)throws Exception { + return pcBusinessService.inspectionRecord(startTime, endTime, page, pageSize); } @@ -327,8 +324,8 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('repairPlan','repairPlan:update')") @MethodAnnotation(authorizations = {"repairPlan","repairPlan:update"},name = "维修计划") @ResponseBody - public Object repairPlan(Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.repairPlan(page,pageSize); + public SingleResult repairPlan(Integer page,Integer pageSize)throws Exception{ + return pcBusinessService.repairPlan(page,pageSize); } /** @@ -358,7 +355,7 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('repairRecord','repairRecord:update')") @MethodAnnotation(authorizations = {"repairRecord","repairRecord:update"},name = "维修记录") @ResponseBody - public Object repairRecord(Integer page,Integer pageSize)throws Exception{ + public SingleResult repairRecord(Integer page,Integer pageSize)throws Exception{ return pcBusinessService.repairRecord(page,pageSize); } @@ -372,8 +369,8 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('reportRecord','reportRecord:update')") @MethodAnnotation(authorizations = {"reportRecord","reportRecord:update"},name = "报修记录") @ResponseBody - public Object reportRecord(Integer page,Integer pageSize)throws Exception{ - return pcBusinessService.reportRecord(page,pageSize); + public SingleResult reportRecord(Integer page,Integer pageSize)throws Exception{ + return pcBusinessService.reportRecord(page,pageSize); } /** @@ -404,7 +401,7 @@ public class EnterpriseEquipmentController extends BaseController { @PreAuthorize("hasAnyAuthority('operatingInstructions','operatingInstructions:update')") @MethodAnnotation(authorizations = {"operatingInstructions","operatingInstructions:update"},name = "操作规程") @ResponseBody - public Object operatingInstructions(@RequestBody OperatingInstructionDto operatingInstructionDto)throws Exception{ + public SingleResult operatingInstructions(@RequestBody OperatingInstructionDto operatingInstructionDto)throws Exception{ return pcBusinessService.operatingInstructions(operatingInstructionDto); } diff --git a/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java b/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java index 61e7f41..0219a9d 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java @@ -59,10 +59,7 @@ public class PersonalController extends BaseController{ RedisUtil redisUtil; - /** - *只允许使用page注解的使用此静态包装 - */ - final static SingleResult singleResult = new SingleResult(); + @Autowired public PersonalController(UserLoginService userLoginService, PcBusinessService pcBusinessService, RedisUtil redisUtil) { @@ -202,6 +199,7 @@ public class PersonalController extends BaseController{ @MethodAnnotation(authorizations = {"entUserPostList","entUserPostList:update"},name = "企业用户工作要务") @ResponseBody public SingleResult> entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{ + SingleResult singleResult = new SingleResult(); singleResult.setData(pcBusinessService.entUserPostList(entUserPostListDto)); return singleResult; } @@ -218,6 +216,7 @@ public class PersonalController extends BaseController{ @MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户日常工作清单") @ResponseBody public SingleResult> entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{ + SingleResult singleResult = new SingleResult(); singleResult.setData(pcBusinessService.entUserPostTask(entUserPostTaskDto)); return singleResult; } @@ -235,6 +234,7 @@ public class PersonalController extends BaseController{ @MethodAnnotation(authorizations = {"entUserPostDuty","entUserPostDuty:update"},name = "企业用户岗位职责") @ResponseBody public SingleResult> entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{ + SingleResult singleResult = new SingleResult(); singleResult.setData(pcBusinessService.entUserPostDuty(entUserPostDutyDto)); return singleResult; } @@ -336,7 +336,7 @@ public class PersonalController extends BaseController{ @MethodAnnotation(authorizations = {"addOrUpdateEntUser:update"},name = "新增和修改公司岗位人员") @ResponseBody @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); } @@ -395,13 +395,28 @@ public class PersonalController extends BaseController{ @ResponseBody public SingleResult> entListGroupByListId(@RequestParam(required = true) String enterpriseId, String listId, - @RequestParam(required = true) String userId - )throws Exception{ + @RequestParam(required = true) String userId)throws Exception{ 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> entListGroupByListId()throws Exception{ + return pcBusinessService.entUserTypeList(); + } + + + @@ -409,6 +424,4 @@ public class PersonalController extends BaseController{ - - } diff --git a/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java b/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java index dcb6e36..0dde357 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java +++ b/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java @@ -9,6 +9,7 @@ import com.common.utils.model.Message; import com.common.utils.model.SingleResult; import com.common.utils.pager.PageOperation; import com.github.pagehelper.Page; +import com.rzyc.advice.CustomException; import com.rzyc.config.RedisUtil; import com.rzyc.controller.BaseController; import com.rzyc.enums.RedisKeys; @@ -110,6 +111,7 @@ public class PcBusinessService extends BaseController { entPostMap.put("name",entPost.getName()); entPostMap.put("parentId",entPost.getParentId()); entPostMap.put("subordinates",entPost.getSubordinates()); + entPostMap.put("postPath",entPost.getPostPath()); data.add(entPostMap); } 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; } - + @PageOperation public SingleResult entUserCredential(String enterpriseId, String entUserId,Integer page,Integer pageSize){ SingleResult singleResult = new SingleResult(); - page = pageSize * (page - 1); - Listlist = entUserCredentialMapper.selectEntUserCredential(enterpriseId,entUserId,page,pageSize); - singleResult.setData(list); + Pagelist = (Page) entUserCredentialMapper.selectEntUserCredential(enterpriseId,entUserId); + singleResult.setDataPager(list); return singleResult; } @@ -189,18 +190,19 @@ public class PcBusinessService extends BaseController { return singleResult; } - + @PageOperation public SingleResult entUserList(String keyContent,Integer page,Integer pageSize,String postId){ SingleResult singleResult = new SingleResult(); - page = pageSize * (page - 1); - Listusers = entUserMapper.selectEntUserList(keyContent,page,pageSize,postId); + Pageusers = (Page) entUserMapper.selectEntUserList(keyContent,postId); //计算履职百分比,后期这里使用redis来读取履职进度 - for (EntUser e:users) { + for (EntUser e:users.getResult()) { Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask(); - double percent = Arith.div(total,e.getFinishTask()) * 100; - e.setEntUserTaskPercent(percent); + if (null != total && total > 0){ + double percent = Arith.div(e.getFinishTask(),total) * 100; + e.setEntUserTaskPercent(percent); + } } - singleResult.setData(users); + singleResult.setDataPager(users); return singleResult; } @@ -225,9 +227,17 @@ public class PcBusinessService extends BaseController { entUser.setPasswd(MD5.md5(entUser.getName() + entUser.getMobile())); int result = 0 ; if (StringUtils.isNotBlank(entUser.getEntUserId())){ + EntUser phone = entUserMapper.validMobile(entUser.getMobile(),entUser.getEntUserId()); + if (null != phone){ + throw new CustomException("手机号已经存在"); + } result = entUserMapper.updateEntUser(entUser); }else { - result = entUserMapper.insert(entUser); + EntUser phone = entUserMapper.validMobile(entUser.getMobile(),null); + if (null != phone){ + throw new CustomException("手机号已经存在"); + } + result = entUserMapper.insert(entUser); } if (result != 1){ singleResult.setCode(Code.ERROR.getCode()); @@ -252,7 +262,7 @@ public class PcBusinessService extends BaseController { singleResult.setMessage(Message.MOBILE_IS_ILLEGAL); return singleResult; } - EntUser entUser = entUserMapper.validMobile(mobile); + EntUser entUser = entUserMapper.validMobile(mobile,null); if (entUser != null && !entUserId.equals(entUser.getEntUserId()) ){ singleResult.setCode(Code.ERROR.getCode()); singleResult.setMessage(Message.REGISTERED); @@ -280,10 +290,10 @@ public class PcBusinessService extends BaseController { List entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(enterpriseId); //树结构处理 JSONArray jsonArray = handleEntEquipment(entDeviceTypes); - Listposts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class); - singleResult.setData(posts); + Listtype = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntDeviceType.class); + singleResult.setData(type); //存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; } @@ -307,10 +317,12 @@ public class PcBusinessService extends BaseController { return result; } - - public Object entEquipmentList(String enterpriseId, String typeId,Integer page,Integer pageSize){ + @PageOperation + public SingleResult entEquipmentList(String enterpriseId, String typeId,Integer page,Integer pageSize){ + SingleResult singleResult = new SingleResult(); Page devices = (Page) entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId); - return devices; + singleResult.setDataPager(devices); + return singleResult; } public SingleResult entEquipmentStatistic(String enterpriseId, String deviceId){ @@ -328,11 +340,16 @@ public class PcBusinessService extends BaseController { if (null != addOrUpdateEntPostDto && null != addOrUpdateEntPostDto.getPostId()){ entPost.setModifyBy(getUserId()); entPost.setModifyTime(new Date()); + EntPost post = entPostMapper.getParentPost(addOrUpdateEntPostDto.getPostId()); + entPost.setPostPath(post.getPostPath() + "," + addOrUpdateEntPostDto.getPostId()); result = entPostMapper.updateEntPost(entPost); }else { - entPost.setPostId(RandomNumber.getUUid()); + String uuid = RandomNumber.getUUid(); + entPost.setPostId(uuid); entPost.setCreateTime(new Date()); entPost.setCreateBy(getUserId()); + EntPost post = entPostMapper.getParentPost(addOrUpdateEntPostDto.getPostId()); + entPost.setPostPath(post.getPostPath() + "," + uuid); result = entPostMapper.insertEntPost(entPost); } if (result != 1 ){ @@ -399,9 +416,12 @@ public class PcBusinessService extends BaseController { 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(); Pagelist = (Page) entDeviceInsCycleMapper.deviceInspectionCycle(inspectionName); - return list; + singleResult.setDataPager(list); + return singleResult; } public SingleResult addOrUpdateDeviceInspectionCycle(AddOrUpdateDeviceInspectionCycleDto addOrUpdateDeviceInspectionCycleDto){ @@ -438,14 +458,21 @@ public class PcBusinessService extends BaseController { 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 entInsRecords = (Page) 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(); PagesparePartList = (Page) sparePartMapper.sparePartList(name); - return sparePartList; + singleResult.setDataPager(sparePartList); + return singleResult; } public SingleResult sparePartUpdate(SparePartDto sparePartDto){ @@ -482,9 +509,12 @@ public class PcBusinessService extends BaseController { return singleResult; } - public Object entDeviceMaintenancePlan(Integer page,Integer pageSize){ + @PageOperation + public SingleResult entDeviceMaintenancePlan(Integer page,Integer pageSize){ + SingleResult singleResult = new SingleResult(); Page list = (Page) entDeviceMaintenancePlanMapper.selectEntDeviceMaintenancePlanList(); - return list; + singleResult.setDataPager(list); + return singleResult; } public SingleResult entDeviceMaintenanceRecordUpdate(EntDeviceMaintenanceRecordDto entDeviceMaintenanceRecordDto){ @@ -505,18 +535,27 @@ public class PcBusinessService extends BaseController { } @PageOperation - public Object entDeviceMaintenanceRecord(Integer page,Integer pageSize){ + public SingleResult entDeviceMaintenanceRecord(Integer page,Integer pageSize){ + SingleResult singleResult = new SingleResult(); Page list = (Page) 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(); PageinspectionRecords = (Page) 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(); PageentRepairPlans = (Page) entRepairPlanMapper.selectRepairPlan(); - return entRepairPlans; + singleResult.setDataPager(entRepairPlans); + return singleResult; } public SingleResult repairPlanUpdate(EntRepairPlanDto entRepairPlanDto){ @@ -554,15 +593,19 @@ public class PcBusinessService extends BaseController { } @PageOperation - public Object repairRecord(Integer page,Integer pageSize){ + public SingleResult repairRecord(Integer page,Integer pageSize){ + SingleResult singleResult = new SingleResult(); Page repairRecords = (Page) entRepairRecordMapper.repairRecord(); - return repairRecords; + singleResult.setDataPager(repairRecords); + return singleResult; } @PageOperation - public Object reportRecord(Integer page,Integer pageSize){ + public SingleResult reportRecord(Integer page,Integer pageSize){ + SingleResult singleResult = new SingleResult(); PagereportRepairs = (Page) entReportRepairMapper.reportRecord(); - return reportRepairs; + singleResult.setDataPager(reportRepairs); + return singleResult; } public SingleResult addOrUpdateReportRecord(ReportRecordDto reportRecordDto){ @@ -583,9 +626,11 @@ public class PcBusinessService extends BaseController { } @PageOperation - public Object operatingInstructions(OperatingInstructionDto operatingInstructionDto){ + public SingleResult operatingInstructions(OperatingInstructionDto operatingInstructionDto){ + SingleResult SingleResult = new SingleResult(); Page page = (Page) 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); //2代表已完成状态 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); Listtasks = entPostTaskMapper.selectEntUserPostTaskByListId(enterpriseId,listId,keyWord,page,pageSize); map.put("list",tasks); @@ -649,8 +694,11 @@ public class PcBusinessService extends BaseController { Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,year); //2代表已完成状态 Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,year); - double finishPercent = Arith.div(finishCount,total) * 100; - singleResult.setData(finishPercent); + if (null != finishCount && finishCount > 0 ){ + double finishPercent = Arith.div(finishCount,total) * 100; + singleResult.setData(finishPercent); + } + return singleResult; } @@ -696,6 +744,13 @@ public class PcBusinessService extends BaseController { return singleResult; } + public SingleResult entUserTypeList(){ + SingleResult singleResult = new SingleResult(); + Listlist = entUserTypeMapper.selectEntUserType(); + singleResult.setData(list); + return singleResult; + } + diff --git a/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java b/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java index d7c73a7..7abf7f8 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java +++ b/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java @@ -71,8 +71,8 @@ public class UserDetailsServiceImpl implements UserDetailsService { @Override public UserDetails loadUserByUsername(String name){ - //判断数据库用户 - EntUser entUser = entUserMapper.selectByName(name); + //判断数据库手机号 + EntUser entUser = entUserMapper.validMobile(name,null); if (Objects.isNull(entUser)){ throw new CustomException("用户名不存在"); diff --git a/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java b/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java index d0bc977..951a5c3 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java +++ b/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java @@ -70,7 +70,7 @@ public class UserLoginService { if (Objects.isNull(userDetails)) { throw new CustomException("账号不存在"); } - SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByName(username); + SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByPhoneNumber(username); if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){ throw new CustomException("企业不存在或已经禁用"); } diff --git a/utils/pom.xml b/utils/pom.xml index 488bf46..82fef27 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -312,6 +312,12 @@ 2.10.2 compile + + com.github.pagehelper + pagehelper + 5.1.4 + compile + diff --git a/utils/src/main/java/com/common/utils/model/SingleResult.java b/utils/src/main/java/com/common/utils/model/SingleResult.java index 1fc37f0..14ec424 100644 --- a/utils/src/main/java/com/common/utils/model/SingleResult.java +++ b/utils/src/main/java/com/common/utils/model/SingleResult.java @@ -1,5 +1,7 @@ package com.common.utils.model; +import com.github.pagehelper.Page; + /** * @version 0.1.0 * @since 0.1.0 @@ -17,4 +19,15 @@ public class SingleResult extends Result { 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; + } + }