Commit c41ebc2e authored by fangxinjiang's avatar fangxinjiang

ekp-common

parent a29573d3
package com.yifu.cloud.plus.v1.yifu.salary.entity; package com.yifu.cloud.plus.v1.yifu.salary.entity;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
...@@ -47,12 +45,14 @@ public class TMinSalary extends BaseEntity { ...@@ -47,12 +45,14 @@ public class TMinSalary extends BaseEntity {
*/ */
@ExcelAttribute(name = "市") @ExcelAttribute(name = "市")
@ExcelProperty(value = "市") @ExcelProperty(value = "市")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Integer city; private Integer city;
/** /**
* 县 * 县
*/ */
@ExcelAttribute(name = "县") @ExcelAttribute(name = "县")
@ExcelProperty(value = "县") @ExcelProperty(value = "县")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Integer town; private Integer town;
/** /**
* 最低工资标准 * 最低工资标准
......
...@@ -39,14 +39,14 @@ public class TSpecialDeducationSum extends BaseEntity { ...@@ -39,14 +39,14 @@ public class TSpecialDeducationSum extends BaseEntity {
*/ */
@NotBlank(message = "导入月份不能为空") @NotBlank(message = "导入月份不能为空")
@Length(max = 6, message = "导入月份不能超过6个字符") @Length(max = 6, message = "导入月份不能超过6个字符")
@ExcelAttribute(name = "导入月份", isNotEmpty = true, errorInfo = "导入月份不能为空", maxLength = 6) @ExcelAttribute(name = "导入月份", maxLength = 6)
@ExcelProperty(value = "导入月份") @ExcelProperty(value = "导入月份")
private String createMonth; private String createMonth;
/** /**
* 申报单位 * 申报单位
*/ */
@Length(max = 20, message = "申报单位不能超过20个字符") @Length(max = 20, message = "申报单位不能超过20个字符")
@ExcelAttribute(name = "申报单位", maxLength = 20) @ExcelAttribute(name = "申报单位", maxLength = 20, isNotEmpty = true)
@ExcelProperty(value = "申报单位") @ExcelProperty(value = "申报单位")
private String declareTitle; private String declareTitle;
/** /**
...@@ -60,35 +60,35 @@ public class TSpecialDeducationSum extends BaseEntity { ...@@ -60,35 +60,35 @@ public class TSpecialDeducationSum extends BaseEntity {
* 姓名 * 姓名
*/ */
@Length(max = 20, message = "姓名不能超过20个字符") @Length(max = 20, message = "姓名不能超过20个字符")
@ExcelAttribute(name = "姓名", maxLength = 20) @ExcelAttribute(name = "姓名", maxLength = 20, isNotEmpty = true)
@ExcelProperty(value = "姓名") @ExcelProperty(value = "姓名")
private String name; private String name;
/** /**
* 证照类型 * 证照类型
*/ */
@Length(max = 20, message = "证照类型不能超过20个字符") @Length(max = 20, message = "证照类型不能超过20个字符")
@ExcelAttribute(name = "证照类型", maxLength = 20) @ExcelAttribute(name = "证照类型", maxLength = 20, isNotEmpty = true)
@ExcelProperty(value = "证照类型") @ExcelProperty(value = "证照类型")
private String type; private String type;
/** /**
* 证照号码 * 证照号码
*/ */
@Length(max = 20, message = "证照号码不能超过20个字符") @Length(max = 20, message = "证照号码不能超过20个字符")
@ExcelAttribute(name = "证照号码", maxLength = 20) @ExcelAttribute(name = "证照号码", maxLength = 20, isNotEmpty = true)
@ExcelProperty(value = "证照号码") @ExcelProperty(value = "证照号码")
private String idNumber; private String idNumber;
/** /**
* 所得期间起 * 所得期间起
*/ */
@Length(max = 20, message = "所得期间起不能超过20个字符") @Length(max = 20, message = "所得期间起不能超过20个字符")
@ExcelAttribute(name = "所得期间起", maxLength = 20) @ExcelAttribute(name = "所得期间起", maxLength = 20, isNotEmpty = true, isDate = true)
@ExcelProperty(value = "所得期间起") @ExcelProperty(value = "所得期间起")
private String createStart; private String createStart;
/** /**
* 所得期间止 * 所得期间止
*/ */
@Length(max = 20, message = "所得期间止不能超过20个字符") @Length(max = 20, message = "所得期间止不能超过20个字符")
@ExcelAttribute(name = "所得期间止", maxLength = 20) @ExcelAttribute(name = "所得期间止", maxLength = 20, isNotEmpty = true, isDate = true)
@ExcelProperty(value = "所得期间止") @ExcelProperty(value = "所得期间止")
private String createEnd; private String createEnd;
/** /**
......
package com.yifu.cloud.plus.v1.yifu.salary.controller; package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
...@@ -68,14 +73,8 @@ public class TMinSalaryController { ...@@ -68,14 +73,8 @@ public class TMinSalaryController {
@Operation(description = "新增(wxhr:tminsalary_add)") @Operation(description = "新增(wxhr:tminsalary_add)")
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('wxhr:tminsalary_add')") @PreAuthorize("@pms.hasPermission('wxhr:tminsalary_add')")
public R save(@Valid @RequestBody TMinSalary tMinSalary) { public R<Boolean> save(@Valid @RequestBody TMinSalary tMinSalary) {
YifuUser user = SecurityUtils.getUser(); return tMinSalaryService.saveDiy(tMinSalary);
if (null == user || null == user.getId()) {
return R.failed("获取登录用户信息失败!");
}
tMinSalary.setCreateTime(LocalDateTime.now());
tMinSalary.setCreateBy(String.valueOf(user.getId()));
return new R<>(tMinSalaryService.save(tMinSalary));
} }
/** /**
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
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.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSpecialDeducationSum; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSpecialDeducationSum;
...@@ -13,8 +14,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSpecialDeducationSumService; ...@@ -13,8 +14,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSpecialDeducationSumService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -116,7 +119,7 @@ public class TSpecialDeducationSumController { ...@@ -116,7 +119,7 @@ public class TSpecialDeducationSumController {
@SysLog("上传专项扣除") @SysLog("上传专项扣除")
@PostMapping("/uploadSds") @PostMapping("/uploadSds")
//@PreAuthorize("@pms.hasPermission('wxhr:salary_upload')") //@PreAuthorize("@pms.hasPermission('wxhr:salary_upload')")
public R uploadSds(@RequestBody List<TSpecialDeducationSum> savList) { public R<List<ErrorMessage>> uploadSds(@RequestBody List<TSpecialDeducationSum> savList) {
return tSpecialDeducationSumService.uploadSds(savList); return tSpecialDeducationSumService.uploadSds(savList);
} }
......
...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service; ...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TMinSalary; import com.yifu.cloud.plus.v1.yifu.salary.entity.TMinSalary;
/** /**
...@@ -22,4 +23,5 @@ public interface TMinSalaryService extends IService<TMinSalary> { ...@@ -22,4 +23,5 @@ public interface TMinSalaryService extends IService<TMinSalary> {
IPage<TMinSalary> getTMinSalaryPage(Page<TMinSalary> page, TMinSalary tMinSalary); IPage<TMinSalary> getTMinSalaryPage(Page<TMinSalary> page, TMinSalary tMinSalary);
R<Boolean> saveDiy(TMinSalary tMinSalary);
} }
...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service; ...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
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.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSpecialDeducationSum; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSpecialDeducationSum;
...@@ -73,7 +74,7 @@ public interface TSpecialDeducationSumService extends IService<TSpecialDeducatio ...@@ -73,7 +74,7 @@ public interface TSpecialDeducationSumService extends IService<TSpecialDeducatio
* @Date: 2019/10/14 14:48 * @Date: 2019/10/14 14:48
* @return: com.yifu.cloud.v1.common.core.util.R * @return: com.yifu.cloud.v1.common.core.util.R
**/ **/
R uploadSds(List<TSpecialDeducationSum> sdsList); R<List<ErrorMessage>> uploadSds(List<TSpecialDeducationSum> sdsList);
} }
package com.yifu.cloud.plus.v1.yifu.salary.service.impl; package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TMinSalary; import com.yifu.cloud.plus.v1.yifu.salary.entity.TMinSalary;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TMinSalaryMapper; import com.yifu.cloud.plus.v1.yifu.salary.mapper.TMinSalaryMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TMinSalaryService; import com.yifu.cloud.plus.v1.yifu.salary.service.TMinSalaryService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
/** /**
* @Author fxj * @Author fxj
* @Description 各地市最低工资标准 * @Description 各地市最低工资标准
...@@ -28,4 +36,31 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal ...@@ -28,4 +36,31 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
return baseMapper.getTMinSalaryPage(page,tMinSalary); return baseMapper.getTMinSalaryPage(page,tMinSalary);
} }
@Override
public R<Boolean> saveDiy(TMinSalary tMinSalary) {
YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) {
return R.failed("获取登录用户信息失败!");
}
tMinSalary.setCreateTime(LocalDateTime.now());
tMinSalary.setCreateBy(String.valueOf(user.getId()));
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(tMinSalary.getProvince())){
query.eq(TMinSalary::getProvince,tMinSalary.getProvince());
}
if (Common.isNotNull(tMinSalary.getCity())){
query.eq(TMinSalary::getCity,tMinSalary.getCity());
}
if (Common.isNotNull(tMinSalary.getTown())){
query.eq(TMinSalary::getTown,tMinSalary.getTown());
}
query.eq(TMinSalary::getStatus, CommonConstants.ONE_INT);
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT){
return R.failed("已存在对应区域在用的配置信息");
}
baseMapper.insert(tMinSalary);
return R.ok(true,CommonConstants.SAVE_SUCCESS);
}
} }
...@@ -5,9 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,9 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSpecialDeducationSum; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSpecialDeducationSum;
...@@ -16,6 +14,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSpecialDeducationSumService; ...@@ -16,6 +14,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSpecialDeducationSumService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -107,10 +106,13 @@ public class TSpecialDeducationSumServiceImpl extends ServiceImpl<TSpecialDeduca ...@@ -107,10 +106,13 @@ public class TSpecialDeducationSumServiceImpl extends ServiceImpl<TSpecialDeduca
* @return: com.yifu.cloud.v1.common.core.util.R * @return: com.yifu.cloud.v1.common.core.util.R
**/ **/
@Override @Override
public R uploadSds(List<TSpecialDeducationSum> sdsList) { public R<List<ErrorMessage>> uploadSds(List<TSpecialDeducationSum> sdsList) {
if (sdsList != null && sdsList.size() > CommonConstants.ZERO_INT) { if (Common.isNotNull(sdsList)) {
TSpecialDeducationSum sds = null; List<ErrorMessage> errorMessages = new ArrayList<>();
int rowNum = sdsList.size(); errorMessages = checkImport(sdsList,errorMessages);
if (Common.isNotNull(errorMessages)) {
return R.ok(errorMessages);
}
String nowYearMonth = DateUtil.getCurrentDateString("yyyyMM"); String nowYearMonth = DateUtil.getCurrentDateString("yyyyMM");
String yearMonth = DateUtil.getYearMonth(sdsList.get(0).getCreateStart()); String yearMonth = DateUtil.getYearMonth(sdsList.get(0).getCreateStart());
if (Common.isNotNull(yearMonth)) { if (Common.isNotNull(yearMonth)) {
...@@ -144,9 +146,32 @@ public class TSpecialDeducationSumServiceImpl extends ServiceImpl<TSpecialDeduca ...@@ -144,9 +146,32 @@ public class TSpecialDeducationSumServiceImpl extends ServiceImpl<TSpecialDeduca
s.setCreateTime(nowDate); s.setCreateTime(nowDate);
s.setCreateBy(String.valueOf(user.getId())); s.setCreateBy(String.valueOf(user.getId()));
} }
return new R<>(this.saveBatch(sdsList)); if (this.saveBatch(sdsList)){
return R.failed(CommonConstants.SAVE_SUCCESS);
}else {
return R.failed(CommonConstants.SAVE_FAILED);
}
} }
return R.failed("数据不可为空"); return R.failed("数据不可为空");
} }
private List<ErrorMessage> checkImport(List<TSpecialDeducationSum> sdsList,List<ErrorMessage> errorMessages) {
ErrorMessage errorMessage;
ExcelUtil<TSpecialDeducationSum> util1 = new ExcelUtil<>(TSpecialDeducationSum.class);
int i =0;
for (TSpecialDeducationSum data: sdsList) {
i++;
errorMessage = util1.checkEntity(data, -1);
if (Common.isNotNull(errorMessage)) {
errorMessages.add(errorMessage);
}else {
continue;
}
}
if (Common.isNotNull(errorMessages)){
return errorMessages;
}
return null;
}
} }
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
<if test="tDeptSee.deptName != null and tDeptSee.deptName.trim() != ''"> <if test="tDeptSee.deptName != null and tDeptSee.deptName.trim() != ''">
AND a.DEPT_NAME = #{tDeptSee.deptName} AND a.DEPT_NAME = #{tDeptSee.deptName}
</if> </if>
<if test="tDeptSee.deptNo != null and tDeptSee.deptNo.trim() != ''">
AND a.DEPT_NO = #{tDeptSee.deptNo}
</if>
<if test="tDeptSee.canSee != null"> <if test="tDeptSee.canSee != null">
AND a.CAN_SEE = #{tDeptSee.canSee} AND a.CAN_SEE = #{tDeptSee.canSee}
</if> </if>
...@@ -81,6 +84,7 @@ ...@@ -81,6 +84,7 @@
<where> <where>
1=1 1=1
<include refid="tDeptSee_where"/> <include refid="tDeptSee_where"/>
order by a.CREATE_TIME DESC
</where> </where>
</select> </select>
</mapper> </mapper>
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
AND create_user = #{tMinSalary.createBy} AND create_user = #{tMinSalary.createBy}
</if> </if>
</where> </where>
ORDER BY CREATE_TIME DESC
</select> </select>
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<where> <where>
1=1 1=1
<include refid="tSalaryConfigStandard_where"/> <include refid="tSalaryConfigStandard_where"/>
order by CREATE_TIME DESC
</where> </where>
</select> </select>
......
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
<where> <where>
1=1 1=1
<include refid="tSpecialDeducationSum_where"/> <include refid="tSpecialDeducationSum_where"/>
ORDER BY CREATE_TIME
</where> </where>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment