Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
b9f2fa04
Commit
b9f2fa04
authored
Jun 30, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同
parent
4c0e4303
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
937 additions
and
272 deletions
+937
-272
TEmployeeContractInfo.java
...d/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
+331
-240
EmployeeExportVO.java
...yifu/cloud/plus/v1/yifu/archives/vo/EmployeeExportVO.java
+1
-1
EmployeeLeaveVO.java
.../yifu/cloud/plus/v1/yifu/archives/vo/EmployeeLeaveVO.java
+2
-2
EmployeeProjectExportVO.java
...oud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
+1
-1
EmployeeVO.java
...a/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeVO.java
+3
-3
ErrorMessageVO.java
...m/yifu/cloud/plus/v1/yifu/archives/vo/ErrorMessageVO.java
+1
-1
EmployeeContractConstants.java
...v1/yifu/archives/Constants/EmployeeContractConstants.java
+14
-0
TEmployeeContractInfoController.java
.../archives/controller/TEmployeeContractInfoController.java
+16
-16
TEmployeeContractInfoMapper.java
.../v1/yifu/archives/mapper/TEmployeeContractInfoMapper.java
+11
-0
TEmployeeContractInfoService.java
...1/yifu/archives/service/TEmployeeContractInfoService.java
+17
-0
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+217
-2
TEmployeeContractInfoMapper.xml
...src/main/resources/mapper/TEmployeeContractInfoMapper.xml
+43
-1
CacheConstants.java
...oud.plus.v1/yifu/common/core/constant/CacheConstants.java
+6
-0
ExcelAttributeConstants.java
...v1/yifu/common/core/constant/ExcelAttributeConstants.java
+72
-0
ResultConstants.java
...ud.plus.v1/yifu/common/core/constant/ResultConstants.java
+24
-0
Common.java
.../com/yifu.cloud.plus.v1/yifu/common/core/util/Common.java
+61
-5
ExcelAttributeValidityUtil.java
.../v1/yifu/common/core/util/ExcelAttributeValidityUtil.java
+117
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeContractInfo.java
View file @
b9f2fa04
This diff is collapsed.
Click to expand it.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeExportVO.java
View file @
b9f2fa04
...
...
@@ -44,7 +44,7 @@ public class EmployeeExportVO extends BaseEntity {
@ExcelProperty
(
value
=
"员工类型"
)
private
String
empNatrue
;
@ExcelProperty
(
value
=
"姓名"
)
@ExcelProperty
(
value
=
"
员工
姓名"
)
private
String
empName
;
@ColumnWidth
(
20
)
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeLeaveVO.java
View file @
b9f2fa04
...
...
@@ -35,8 +35,8 @@ public class EmployeeLeaveVO implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@ExcelProperty
(
value
=
"姓名"
)
@Size
(
max
=
20
,
message
=
"姓名不可超过20位"
)
@ExcelProperty
(
value
=
"
员工
姓名"
)
@Size
(
max
=
20
,
message
=
"
员工
姓名不可超过20位"
)
private
String
empName
;
@ExcelProperty
(
value
=
"身份证号"
)
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectExportVO.java
View file @
b9f2fa04
...
...
@@ -48,7 +48,7 @@ public class EmployeeProjectExportVO{
/**
* 员工姓名
*/
@ExcelProperty
(
value
=
"姓名"
)
@ExcelProperty
(
value
=
"
员工
姓名"
)
private
String
empName
;
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeVO.java
View file @
b9f2fa04
...
...
@@ -45,10 +45,10 @@ public class EmployeeVO implements Serializable {
private
String
empNatrue
;
/**
* 姓名
*
员工
姓名
*/
@ExcelProperty
(
value
=
"姓名"
)
@Size
(
max
=
20
,
message
=
"姓名不可超过20位"
)
@ExcelProperty
(
value
=
"
员工
姓名"
)
@Size
(
max
=
20
,
message
=
"
员工
姓名不可超过20位"
)
private
String
empName
;
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/ErrorMessageVO.java
View file @
b9f2fa04
...
...
@@ -36,7 +36,7 @@ public class ErrorMessageVO implements Serializable {
@Schema
(
description
=
"行号"
)
private
int
lineNum
;
@Schema
(
description
=
"姓名"
)
@Schema
(
description
=
"
员工
姓名"
)
private
String
empName
;
@Schema
(
description
=
"身份证号"
)
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/Constants/EmployeeContractConstants.java
0 → 100644
View file @
b9f2fa04
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
Constants
;
public
class
EmployeeContractConstants
{
public
static
final
String
searchEmpContractInfo
=
" 查询对应的员工合同信息!"
;
public
static
final
String
sameEmpOnlyOneStandContract
=
"同一员工只允许一个在用标准合同,请按员工编码:"
;
public
static
final
String
exportTip
=
"数据导入解析!数据行数:"
;
public
final
static
String
ContractUpdateFailInfo
=
"合同更新失败:合同更新同步更新派单数据更新失败!"
;
public
final
static
String
UTF8
=
"UTF-8"
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeContractInfoController.java
View file @
b9f2fa04
...
...
@@ -17,10 +17,10 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -31,6 +31,8 @@ import org.springframework.http.HttpHeaders;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 员工合同
...
...
@@ -40,7 +42,7 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/temployeecontrctinfo"
)
@RequestMapping
(
"/temployeecontr
a
ctinfo"
)
@Tag
(
name
=
"员工合同管理"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
public
class
TEmployeeContractInfoController
{
...
...
@@ -50,15 +52,14 @@ public class TEmployeeContractInfoController {
/**
* 分页查询
*
* @param page 分页对象
* @param page
分页对象
* @param tEmployeeContractInfo 员工合同
* @return
*/
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@pms.hasPermission('contract_temployeecontrctinfo_get')"
)
public
R
getTEmployeeContrctInfoPage
(
Page
<
TEmployeeContractInfo
>
page
,
TEmployeeContractInfo
tEmployeeContractInfo
)
{
return
new
R
<>(
tEmployeeContractInfoService
.
getTEmployeeContractInfoPage
(
page
,
tEmployeeContractInfo
));
public
R
gettemployeecontractinfoPage
(
Page
<
TEmployeeContractInfo
>
page
,
TEmployeeContractInfo
tEmployeeContractInfo
)
{
return
new
R
<>(
tEmployeeContractInfoService
.
getTEmployeeContractInfoPage
(
page
,
tEmployeeContractInfo
));
}
...
...
@@ -68,9 +69,8 @@ public class TEmployeeContractInfoController {
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('
contract_temployeecontr
ctinfo_get')"
)
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('
temployeecontra
ctinfo_get')"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('contract_temployeecontrctinfo_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tEmployeeContractInfoService
.
getById
(
id
));
}
...
...
@@ -81,12 +81,12 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同
* @return R
*/
@Operation
(
summary
=
"新增员工合同"
,
description
=
"新增员工合同:hasPermission('
contract_temployeecontr
ctinfo_add')"
)
@Operation
(
summary
=
"新增员工合同"
,
description
=
"新增员工合同:hasPermission('
temployeecontra
ctinfo_add')"
)
@SysLog
(
"新增员工合同"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('
contract_temployeecontr
ctinfo_add')"
)
public
R
save
(
@RequestBody
TEmployeeContractInfo
tEmployeeContractInfo
)
{
return
R
.
ok
(
tEmployeeContractInfoService
.
save
(
tEmployeeContractInfo
)
);
@PreAuthorize
(
"@pms.hasPermission('
temployeecontra
ctinfo_add')"
)
public
R
<
List
<
ErrorMessage
>>
save
(
@RequestBody
TEmployeeContractInfo
tEmployeeContractInfo
)
{
return
tEmployeeContractInfoService
.
saveNewContract
(
tEmployeeContractInfo
);
}
/**
...
...
@@ -95,10 +95,10 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同
* @return R
*/
@Operation
(
summary
=
"修改员工合同"
,
description
=
"修改员工合同:hasPermission('
contract_temployeecontr
ctinfo_edit')"
)
@Operation
(
summary
=
"修改员工合同"
,
description
=
"修改员工合同:hasPermission('
temployeecontra
ctinfo_edit')"
)
@SysLog
(
"修改员工合同"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('
contract_temployeecontr
ctinfo_edit')"
)
@PreAuthorize
(
"@pms.hasPermission('
temployeecontra
ctinfo_edit')"
)
public
R
updateById
(
@RequestBody
TEmployeeContractInfo
tEmployeeContractInfo
)
{
return
R
.
ok
(
tEmployeeContractInfoService
.
updateById
(
tEmployeeContractInfo
));
}
...
...
@@ -109,10 +109,10 @@ public class TEmployeeContractInfoController {
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除员工合同"
,
description
=
"通过id删除员工合同:hasPermission('
contract_temployeecontr
ctinfo_del')"
)
@Operation
(
summary
=
"通过id删除员工合同"
,
description
=
"通过id删除员工合同:hasPermission('
temployeecontra
ctinfo_del')"
)
@SysLog
(
"通过id删除员工合同"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('
contract_temployeecontr
ctinfo_del')"
)
@PreAuthorize
(
"@pms.hasPermission('
temployeecontra
ctinfo_del')"
)
public
R
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
tEmployeeContractInfoService
.
removeById
(
id
));
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeContractInfoMapper.java
View file @
b9f2fa04
...
...
@@ -41,4 +41,15 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
*/
IPage
<
TEmployeeContractInfo
>
getTEmployeeContractInfoPage
(
Page
<
TEmployeeContractInfo
>
page
,
@Param
(
"tEmployeeContractInfo"
)
TEmployeeContractInfo
tEmployeeContractInfo
);
/**
* 更新合同在用状态
* @Author fxj
* @Date 2019-10-17
* @param empId
* @param id
* @param status
* @return
**/
int
updateInUseStatusById
(
@Param
(
"empId"
)
String
empId
,
@Param
(
"id"
)
String
id
,
@Param
(
"status"
)
String
status
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeContractInfoService.java
View file @
b9f2fa04
...
...
@@ -21,6 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.util.List
;
/**
* 员工合同
...
...
@@ -38,4 +43,16 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
*/
IPage
<
TEmployeeContractInfo
>
getTEmployeeContractInfoPage
(
Page
<
TEmployeeContractInfo
>
page
,
TEmployeeContractInfo
tEmployeeContractInfo
);
R
<
List
<
ErrorMessage
>>
saveNewContract
(
TEmployeeContractInfo
tEmployeeContractInfo
);
/**
* 保存员工合同表及附件关系表
* @Author fxj
* @Date 2019-09-09
* @param tEmployeeContractInfo
* @param tEmployeeInfo
* @return
**/
boolean
saveContractAndAtta
(
TEmployeeContractInfo
tEmployeeContractInfo
,
TEmployeeInfo
tEmployeeInfo
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
b9f2fa04
This diff is collapsed.
Click to expand it.
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeContractInfoMapper.xml
View file @
b9f2fa04
...
...
@@ -70,6 +70,12 @@
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"updateBy"
column=
"UPDATE_BY"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
/>
<result
property=
"unitName"
column=
"UNIT_NAME"
/>
<result
property=
"unitNo"
column=
"UNIT_NO"
/>
<result
property=
"deptName"
column=
"DEPT_NAME"
/>
<result
property=
"deptNo"
column=
"DEPT_NO"
/>
<result
property=
"applyNo"
column=
"APPLY_NO"
/>
<result
property=
"auditStatus"
column=
"AUDIT_STATUS"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.ID,
...
...
@@ -117,7 +123,14 @@
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
a.UPDATE_TIME,
a.UNIT_ID,
a.UNIT_NAME,
a.UNIT_NO,
a.DEPT_NAME,
a.DEPT_NO,
a.AUDIT_STATUS,
a.APPLY_NO
</sql>
<sql
id=
"tEmployeeContractInfo_where"
>
<if
test=
"tEmployeeContractInfo != null"
>
...
...
@@ -259,6 +272,29 @@
<if
test=
"tEmployeeContractInfo.updateTime != null"
>
AND a.UPDATE_TIME = #{tEmployeeContractInfo.updateTime}
</if>
<if
test=
"tEmployeeContractInfo.unitId != null and tEmployeeContractInfo.unitId.trim() != ''"
>
AND a.UNIT_ID = #{tEmployeeContractInfo.unitId}
</if>
<if
test=
"tEmployeeContractInfo.unitName != null and tEmployeeContractInfo.unitName.trim() != ''"
>
AND a.UNIT_NAME like concat('%',#{tEmployeeContractInfo.unitName},'%')
</if>
<if
test=
"tEmployeeContractInfo.unitNo != null and tEmployeeContractInfo.unitNo.trim() != ''"
>
AND a.UNIT_NO = #{tEmployeeContractInfo.unitNo}
</if>
<if
test=
"tEmployeeContractInfo.deptName != null and tEmployeeContractInfo.deptName.trim() != ''"
>
AND a.DEPT_NAME like concat('%',#{tEmployeeContractInfo.deptName},'%')
</if>
<if
test=
"tEmployeeContractInfo.deptNo != null and tEmployeeContractInfo.deptNo.trim() != ''"
>
AND a.DEPT_NO = #{tEmployeeContractInfo.deptNo}
</if>
<if
test=
"tEmployeeContractInfo.applyNo != null and tEmployeeContractInfo.applyNo.trim() != ''"
>
AND a.APPLY_NO = #{tEmployeeContractInfo.applyNo}
</if>
<if
test=
"tEmployeeContractInfo.auditStatus != null"
>
AND a.AUDIT_STATUS = #{tEmployeeContractInfo.auditStatus}
</if>
</if>
</sql>
<!--tEmployeeContractInfo简单分页查询-->
...
...
@@ -271,4 +307,10 @@
<include
refid=
"tEmployeeContractInfo_where"
/>
</where>
</select>
<!-- 根据员工ID更新合同在用状态 -->
<update
id=
"updateInUseStatusById"
>
update t_employee_contract_info set IN_USE = #{status} where EMP_ID = #{empId} and ID != #{id}
</update>
</mapper>
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CacheConstants.java
View file @
b9f2fa04
...
...
@@ -84,5 +84,11 @@ public interface CacheConstants {
* @Date: 2022/6/21 17:09
**/
String
EVERYDAY_EMP_CODE
=
"everyday_emp_code"
;
/**
* @Description: 每日员工合同的 申请编码 缓存
* @Author: hgw
* @Date: 2022/6/21 17:09
**/
String
EVERYDAY_EMP_CONTRACT_CODE
=
"everyday_emp_contract_code"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/ExcelAttributeConstants.java
View file @
b9f2fa04
...
...
@@ -29,4 +29,76 @@ public class ExcelAttributeConstants {
// 公积金状态
public
static
final
String
FUND_STATUS
=
"fund_status"
;
//员工合同类型
public
static
final
String
EMPLOYEE_CONTRACT_TYPE
=
"employee_contract_type"
;
//员工合同工时制 1标准工时 2 综合工时 3不定时工时制
public
static
final
String
WORKING_HOURS
=
"working_hours"
;
//员工合同续签情况
public
static
final
String
EMPLOYEE_SITUATION_TYPE
=
"situation_type"
;
//商险结算类型
public
static
final
String
SETTLEMENT_TYPE
=
"settlementType"
;
//商险订单状态
public
static
final
String
INSURANCE_RECORD_STATUS
=
"Insurance_record_status"
;
//社保大病是否收取费用 0 是 1 否
public
static
final
String
IS_ILLNESS
=
"is_illness"
;
//社保大病取值方式 0 按比例 1按定值
public
static
final
String
VALUE_TYPE
=
"value_type"
;
public
static
final
String
NATION
=
"nation"
;
//家庭信息:与本人关系
public
static
final
String
RELATIONSHIP_SELF
=
"relationship_self"
;
//员工档案:性别
public
static
final
String
SEX
=
"sex"
;
//员工档案:户口性质
public
static
final
String
HOUSEHOLD_NATURE
=
"household_nature"
;
//员工档案:客户性质
public
static
final
String
NATURE
=
"nature"
;
//员工档案:婚姻状况
public
static
final
String
MARITAL_STATUS
=
"marital_status"
;
//员工档案:人员类型
public
static
final
String
PERSONNEL_TYPE
=
"personnel_type"
;
//员工档案:员工标签
public
static
final
String
EMPLOYEE_LABLE
=
"employee_lable"
;
//员工档案:政治面貌
public
static
final
String
POLITICAL_STATUS
=
"political_status"
;
//审核状态
public
static
final
String
AUDIT_STATUS
=
"audit_status"
;
//是否委托
public
static
final
String
IS_ENTRUST
=
"is_entrust"
;
//系统用户
public
static
final
String
SYS_USER
=
"sys_user"
;
//区域
public
static
final
String
SYS_AREA
=
"sys_area"
;
//员工档案:银行
public
static
final
String
BANK
=
"bank"
;
//通用状态标识 0 是 1 否
public
static
final
String
STATUS_FLAG
=
"status_flag"
;
//学历信息:学历类型
public
static
final
String
EDUCATION_TYPE
=
"education_type"
;
//职业资格:资格类型
public
static
final
String
QUALIFICATION_TYPE
=
"qualification_type"
;
//职业资格:资格等级
public
static
final
String
QUALIFICATION_LEVEL
=
"qualification_level"
;
//员工伤残:伤残等级
public
static
final
String
DISABILITY_GRADE
=
"disability_grade"
;
//工作履历:工作类型 如兼职、全职等
public
static
final
String
WORK_TYPE
=
"work_type"
;
//职业资格:获取方式
public
static
final
String
OBTAIN_TYPE
=
"obtain_type"
;
//学历信息:学制
public
static
final
String
EDUCATION_SYSTEM
=
"education_system"
;
//工资形式 1.计时工资 2.计件工资 3.其他
public
static
final
String
SALARY_TYPE
=
"salary_type"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/ResultConstants.java
0 → 100644
View file @
b9f2fa04
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
constant
;
import
lombok.experimental.UtilityClass
;
@UtilityClass
public
class
ResultConstants
{
public
static
final
String
SAVE_SUCCESS
=
"保存成功!"
;
public
static
final
String
SAVE_FAIL
=
"保存失败!"
;
public
static
final
String
MODIFY_SUCCESS
=
"修改成功!"
;
public
static
final
String
MODIFY_FAIL
=
"修改失败!"
;
public
static
final
String
VALIDITY_FAIL
=
"校验失败"
;
public
static
final
String
NO_USER
=
"获取登录用户信息失败!"
;
public
static
final
String
SUCCESS_INFO
=
"操作成功!"
;
public
static
final
String
FAIL_INFO_NO_MODEL
=
"操作失败无此实体信息!"
;
public
static
final
String
FAIL_INFO_HAVE
=
"操作失败记录已存在!"
;
public
static
final
String
FAIL_INFO_PARAM_NULL
=
"操作失败,参数为空!"
;
public
static
final
String
FAIL_INFO_RELATION_FOLLOW
=
"已关联跟进记录,禁止删除!"
;
public
static
final
String
FAIL_INFO_RELATION_CONTACT
=
"已关联联系人,禁止删除!"
;
public
static
final
String
REQUEST_LOCK_FAIL
=
"获取锁失败"
;
public
static
final
String
DATA_IMPORT_PARSING_RESULT
=
"数据导入解析!数据行数:"
;
public
static
final
String
NO_SELECT_DATA
=
"请选择数据"
;
public
static
final
String
NO_GETLOCK_DATA
=
"获取锁失败,10秒后重试!"
;
public
static
final
String
NO_ID
=
"操作失败,id不能为空!"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/Common.java
View file @
b9f2fa04
...
...
@@ -3,8 +3,10 @@ package com.yifu.cloud.plus.v1.yifu.common.core.util;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -29,6 +31,7 @@ public class Common {
public
static
boolean
isEmpty
(
String
str
)
{
return
null
==
str
||
""
.
equals
(
str
.
trim
())
||
"null"
.
equals
(
str
.
trim
())
||
"undefinded"
.
equals
(
str
.
trim
());
}
/**
* 对象null
*
...
...
@@ -49,7 +52,7 @@ public class Common {
}
public
static
boolean
isNotNull
(
String
obj
)
{
if
(
null
!=
obj
&&
!
""
.
equals
(
obj
)
&&
!
"undefined"
.
equals
(
obj
)){
if
(
null
!=
obj
&&
!
""
.
equals
(
obj
)
&&
!
"undefined"
.
equals
(
obj
))
{
return
true
;
}
return
false
;
...
...
@@ -62,33 +65,37 @@ public class Common {
Matcher
match
=
pattern
.
matcher
(
str
);
return
match
.
matches
()
!=
false
;
}
/**
* 允许上传的文件类型
*
* @Author pwang
* @Date 2020-01-07 15:52
* @param null
* @return
**/
private
static
final
String
suffixList
=
"gif|jpg|jpeg|png|bmp|xls|xlsx|csv|pdf|docx|doc|m4a|mp3|zip|rar|txt"
;
/**
* 判断是否为允许的上传文件类型,true表示允许
*/
public
static
boolean
checkFile
(
String
fileName
)
{
// 获取文件后缀
String
suffix
=
getSuffix
(
fileName
);
if
(
null
!=
suffix
)
{
if
(
null
!=
suffix
)
{
if
(
suffixList
.
contains
(
suffix
.
trim
().
toLowerCase
()))
{
return
true
;
}
}
return
false
;
}
/**
* 判断是否为允许的上传文件类型,true表示允许
*/
public
static
String
getSuffix
(
String
fileName
)
{
if
(
isEmpty
(
fileName
)
||
fileName
.
lastIndexOf
(
CommonConstants
.
SPOT_CHAR
)
<
0
)
{
if
(
isEmpty
(
fileName
)
||
fileName
.
lastIndexOf
(
CommonConstants
.
SPOT_CHAR
)
<
0
)
{
return
null
;
}
// 获取文件后缀
...
...
@@ -155,15 +162,64 @@ public class Common {
return
result
;
}
public
static
<
T
>
boolean
isNotNull
(
Collection
<
T
>
obj
)
{
public
static
<
T
>
boolean
isNotNull
(
Collection
<
T
>
obj
)
{
return
null
!=
obj
&&
obj
.
size
()
>
0
;
}
public
static
List
<
String
>
getList
(
String
ids
)
{
List
<
String
>
idList
=
null
;
if
(
Common
.
isNotNull
(
ids
)){
if
(
Common
.
isNotNull
(
ids
))
{
idList
=
Common
.
initStrToList
(
ids
,
CommonConstants
.
COMMA_STRING
);
}
return
idList
;
}
/**
* 对象转string
*
* @param param
* @return
*/
public
static
String
getStringValByObject
(
Object
param
)
{
if
(
null
==
param
)
{
return
null
;
}
else
if
(
param
instanceof
Integer
)
{
return
Integer
.
toString
(((
Integer
)
param
).
intValue
());
}
else
if
(
param
instanceof
String
)
{
return
(
String
)
param
;
}
else
if
(
param
instanceof
Double
)
{
return
Double
.
toString
(((
Double
)
param
).
doubleValue
());
}
else
if
(
param
instanceof
Float
)
{
return
Float
.
toString
(((
Float
)
param
).
floatValue
());
}
else
if
(
param
instanceof
Long
)
{
return
Long
.
toString
(((
Long
)
param
).
longValue
());
}
else
if
(
param
instanceof
Boolean
)
{
return
Boolean
.
toString
(((
Boolean
)
param
).
booleanValue
());
}
else
if
(
param
instanceof
Date
)
{
return
DateUtil
.
formatDate
((
Date
)
param
);
}
else
{
return
param
.
toString
();
}
}
/**
* 根据属性名获取属性值
*
* @param fieldName
* @param o
* @return
*/
public
static
Object
getFieldValueByName
(
String
fieldName
,
Object
o
)
{
try
{
String
firstLetter
=
fieldName
.
substring
(
0
,
1
).
toUpperCase
();
String
getter
=
"get"
+
firstLetter
+
fieldName
.
substring
(
1
);
Method
method
=
o
.
getClass
().
getMethod
(
getter
);
Object
value
=
method
.
invoke
(
o
);
return
value
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/ExcelAttributeValidityUtil.java
0 → 100644
View file @
b9f2fa04
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants
;
import
java.lang.reflect.Field
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
ExcelAttributeValidityUtil
<
T
>
{
private
Class
<
T
>
clazz
;
/**
* 用于返回错误信息
*/
private
List
<
ErrorMessage
>
errorInfo
;
public
ExcelAttributeValidityUtil
(
Class
<
T
>
clazz
)
{
this
.
clazz
=
clazz
;
}
public
void
ValidityObj
(
T
obj
)
{
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<>();
// 得到类的所有field
Field
[]
allFields
=
clazz
.
getDeclaredFields
();
// 定义一个map用于存放列的序号和field
Map
<
Integer
,
Field
>
fieldsMap
=
new
HashMap
<>();
for
(
int
i
=
0
,
index
=
0
;
i
<
allFields
.
length
;
i
++)
{
Field
field
=
allFields
[
i
];
// 将有注解的field存放到map中
if
(
field
.
isAnnotationPresent
(
ExcelAttribute
.
class
))
{
// 设置类的私有字段属性可访问
field
.
setAccessible
(
true
);
fieldsMap
.
put
(
index
,
field
);
index
++;
}
}
String
error
=
""
;
String
val
=
null
;
try
{
for
(
int
j
=
0
;
j
<
fieldsMap
.
size
();
j
++)
{
// 从map中得到对应列的field
Field
field
=
fieldsMap
.
get
(
j
);
//获取属性对应的注解属性
ExcelAttribute
attr
=
field
.
getAnnotation
(
ExcelAttribute
.
class
);
val
=
Common
.
getStringValByObject
(
Common
.
getFieldValueByName
(
field
.
getName
(),
obj
));
//校验字段是否符合要求
error
=
ValidityFiled
(
val
,
attr
);
if
(
null
!=
error
)
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
error
));
}
}
}
catch
(
Exception
e
)
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
e
.
getMessage
()));
}
this
.
setErrorInfo
(
errorList
);
}
private
String
ValidityFiled
(
String
c
,
ExcelAttribute
attr
)
{
//非空校验
if
(
attr
.
isNotEmpty
()
&&
Common
.
isEmpty
(
c
))
{
return
(
attr
.
name
()
+
"_字段不可为空"
);
}
if
(
Common
.
isNotNull
(
c
)
&&
Common
.
isNotNull
(
c
.
trim
()))
{
//日期格式校验
if
(
attr
.
isDate
())
{
try
{
DateUtil
.
parseDate
(
c
.
trim
(),
attr
.
dateFormat
());
}
catch
(
ParseException
e
)
{
return
(
Common
.
isEmpty
(
attr
.
errorInfo
())
?
attr
.
name
()
+
"_日期格式错误:"
+
attr
.
dateFormat
()
:
attr
.
errorInfo
());
}
}
//手机号码校验
if
(
attr
.
isPhone
())
{
if
(!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
ValidityConstants
.
MOBILE_PATTERN
:
attr
.
pattern
()))
{
return
(
Common
.
isEmpty
(
attr
.
errorInfo
())
?
attr
.
name
()
+
"_手机号码有误"
:
attr
.
errorInfo
());
}
}
//身份证校验
if
(
attr
.
isIdCard
())
{
if
(!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
ValidityConstants
.
IDCARD_PATTERN
:
attr
.
pattern
()))
{
return
(
attr
.
name
()
+
"_身份证格式有误"
);
}
}
//邮箱验证
if
(
attr
.
isEmail
())
{
if
(!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
ValidityConstants
.
EMAIL_PATTERN
:
attr
.
pattern
()))
{
return
(
Common
.
isEmpty
(
attr
.
errorInfo
())
?
attr
.
name
()
+
"_邮箱格式有误"
:
attr
.
errorInfo
());
}
}
//integer 验证
if
(
attr
.
isInteger
())
{
if
(!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
ValidityConstants
.
INTEGER_PATTERN
:
attr
.
pattern
()))
{
return
(
Common
.
isEmpty
(
attr
.
errorInfo
())
?
attr
.
name
()
+
"_整数格式有误"
:
attr
.
errorInfo
());
}
}
//float、double 验证
if
(
attr
.
isFloat
())
{
if
(!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
ValidityConstants
.
FLOAT_PATTERN
:
attr
.
pattern
()))
{
return
(
Common
.
isEmpty
(
attr
.
errorInfo
())
?
attr
.
name
()
+
"_数字格式有误"
:
attr
.
errorInfo
());
}
}
}
return
null
;
}
public
List
<
ErrorMessage
>
getErrorInfo
()
{
return
errorInfo
;
}
public
void
setErrorInfo
(
List
<
ErrorMessage
>
errorInfo
)
{
this
.
errorInfo
=
errorInfo
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment