Browse Source

工资条

master
zy_Java 4 years ago
parent
commit
950b6f3a10
  1. 100
      src/main/java/com/ccsens/defaultwbs/api/SalaryController.java
  2. 12
      src/main/java/com/ccsens/defaultwbs/bean/dto/RoleDto.java
  3. 29
      src/main/java/com/ccsens/defaultwbs/bean/dto/SalaryDto.java
  4. 205
      src/main/java/com/ccsens/defaultwbs/bean/po/ProMemberSalary.java
  5. 1231
      src/main/java/com/ccsens/defaultwbs/bean/po/ProMemberSalaryExample.java
  6. 7
      src/main/java/com/ccsens/defaultwbs/bean/vo/ClockingInVo.java
  7. 12
      src/main/java/com/ccsens/defaultwbs/bean/vo/ProMemberSalaryVo.java
  8. 248
      src/main/java/com/ccsens/defaultwbs/bean/vo/SalaryVo.java
  9. 22
      src/main/java/com/ccsens/defaultwbs/persist/dao/ProMemberSalaryDao.java
  10. 30
      src/main/java/com/ccsens/defaultwbs/persist/mapper/ProMemberSalaryMapper.java
  11. 25
      src/main/java/com/ccsens/defaultwbs/service/ClockingInService.java
  12. 36
      src/main/java/com/ccsens/defaultwbs/service/ISalaryService.java
  13. 227
      src/main/java/com/ccsens/defaultwbs/service/SalaryService.java
  14. 5
      src/main/java/com/ccsens/defaultwbs/util/DefaultCodeError.java
  15. 3
      src/main/resources/application-prod.yml
  16. 4
      src/main/resources/application.yml
  17. 17
      src/main/resources/mapper_dao/ProMemberSalaryDao.xml
  18. 403
      src/main/resources/mapper_raw/ProMemberSalaryMapper.xml
  19. 3
      src/main/resources/mbg.xml

100
src/main/java/com/ccsens/defaultwbs/api/SalaryController.java

@ -0,0 +1,100 @@
package com.ccsens.defaultwbs.api;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.defaultwbs.bean.dto.ClockingInDto;
import com.ccsens.defaultwbs.bean.dto.RoleDto;
import com.ccsens.defaultwbs.bean.dto.SalaryDto;
import com.ccsens.defaultwbs.bean.vo.ClockingInVo;
import com.ccsens.defaultwbs.bean.vo.ProjectVo;
import com.ccsens.defaultwbs.bean.vo.SalaryVo;
import com.ccsens.defaultwbs.service.ISalaryService;
import com.ccsens.defaultwbs.util.Constant;
import com.ccsens.defaultwbs.util.DefaultCodeError;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.PropUtil;
import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.Date;
import java.util.List;
/**
* @author
*/
@Api(tags = "工资相关")
@RestController
@RequestMapping("/salary")
@Slf4j
public class SalaryController {
@Resource
private ISalaryService salaryService;
@MustLogin
@ApiOperation(value = "导入员工工资表",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx")
@ApiImplicitParams({
})
@RequestMapping(value = "import", method = RequestMethod.POST)
public JsonResponse<ProjectVo.ProjectInfo> importSalary(QueryDto<MultipartFile> params, Long projectId) throws Exception {
MultipartFile f = params.getParam();
String ext = FileUtil.extName(f.getOriginalFilename());
if(StrUtil.isEmpty(ext) || !Constant.WbsExcel.WBS_FILE_FORMAT.contains(ext)){
throw new BaseException(DefaultCodeError.FILE_FORMAT_ERROR);
}
//文件路径
String dir = PropUtil.path + "salary/";
String extraPath = DateUtil.format(new Date(), "yyyyMMdd");
String path = extraPath + File.separator + IdUtil.simpleUUID() + "." + ext;
//转成file
File file = new File(dir + extraPath);
if (!file.exists()) {
file.mkdirs();
}
String fullPath = dir + File.separator + path;
FileUtil.writeFromStream(f.getInputStream(), fullPath);
//导入数据库
log.info("导入员工工资表--文件路径{}--项目id{}",fullPath,projectId);
salaryService.importSalary(fullPath,params.getUserId(),projectId);
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "查看员工工资信息", notes = "")
@RequestMapping(value = "/getMemberSalary", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<SalaryVo.MemberSalary> getMemberSalary(@ApiParam @Validated @RequestBody QueryDto<SalaryDto.SocialSecurity> params) throws Exception{
log.info("查看员工工资信息:{}",params);
SalaryVo.MemberSalary memberSalary = salaryService.getMemberSalary(params.getParam(), params.getUserId());
log.info("查看员工工资信息返回:{}",memberSalary);
return JsonResponse.newInstance().ok(memberSalary);
}
@MustLogin
@ApiOperation(value = "查看项目下所有员工的工资信息", notes = "")
@RequestMapping(value = "/queryMemberSalary", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<SalaryVo.MemberSalary>> queryMemberSalary(@ApiParam @Validated @RequestBody QueryDto<SalaryDto.SocialSecurity> params) throws Exception{
log.info("查看项目下所有员工的工资信息:{}",params);
List<SalaryVo.MemberSalary> memberSalaryList = salaryService.queryMemberSalary(params.getParam(), params.getUserId());
log.info("查看项目下所有员工的工资信息返回:{}",memberSalaryList);
return JsonResponse.newInstance().ok(memberSalaryList);
}
}

12
src/main/java/com/ccsens/defaultwbs/bean/dto/RoleDto.java

@ -7,6 +7,9 @@ import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author
*/
@Data
public class RoleDto {
@Data
@ -40,4 +43,13 @@ public class RoleDto {
this.userId = userId;
}
}
@Data
@ApiModel("成员id")
public static class Member{
@NotNull(message = "成员Id不能为空")
@ApiModelProperty("成员Id")
private Long memberId;
}
}

29
src/main/java/com/ccsens/defaultwbs/bean/dto/SalaryDto.java

@ -0,0 +1,29 @@
package com.ccsens.defaultwbs.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Map;
/**
* @author
*/
@Data
public class SalaryDto {
@Data
@ApiModel("查询员工的工资信息")
public static class SocialSecurity{
@NotNull(message = "请传入项目信息")
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("成员id")
private Long memberId;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
}
}

205
src/main/java/com/ccsens/defaultwbs/bean/po/ProMemberSalary.java

@ -0,0 +1,205 @@
package com.ccsens.defaultwbs.bean.po;
import java.io.Serializable;
import java.util.Date;
public class ProMemberSalary implements Serializable {
private Long id;
private Long memberId;
private Long basicWage;
private String position;
private Integer workingTime;
private Long shareOption;
private Long receiveDividends;
private Long medicalInsurance;
private Long maternityInsurance;
private Long employmentInjuryInsurance;
private Long endowmentInsurance;
private Long unemploymentInsurance;
private Long housingFund;
private Long operator;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getBasicWage() {
return basicWage;
}
public void setBasicWage(Long basicWage) {
this.basicWage = basicWage;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position == null ? null : position.trim();
}
public Integer getWorkingTime() {
return workingTime;
}
public void setWorkingTime(Integer workingTime) {
this.workingTime = workingTime;
}
public Long getShareOption() {
return shareOption;
}
public void setShareOption(Long shareOption) {
this.shareOption = shareOption;
}
public Long getReceiveDividends() {
return receiveDividends;
}
public void setReceiveDividends(Long receiveDividends) {
this.receiveDividends = receiveDividends;
}
public Long getMedicalInsurance() {
return medicalInsurance;
}
public void setMedicalInsurance(Long medicalInsurance) {
this.medicalInsurance = medicalInsurance;
}
public Long getMaternityInsurance() {
return maternityInsurance;
}
public void setMaternityInsurance(Long maternityInsurance) {
this.maternityInsurance = maternityInsurance;
}
public Long getEmploymentInjuryInsurance() {
return employmentInjuryInsurance;
}
public void setEmploymentInjuryInsurance(Long employmentInjuryInsurance) {
this.employmentInjuryInsurance = employmentInjuryInsurance;
}
public Long getEndowmentInsurance() {
return endowmentInsurance;
}
public void setEndowmentInsurance(Long endowmentInsurance) {
this.endowmentInsurance = endowmentInsurance;
}
public Long getUnemploymentInsurance() {
return unemploymentInsurance;
}
public void setUnemploymentInsurance(Long unemploymentInsurance) {
this.unemploymentInsurance = unemploymentInsurance;
}
public Long getHousingFund() {
return housingFund;
}
public void setHousingFund(Long housingFund) {
this.housingFund = housingFund;
}
public Long getOperator() {
return operator;
}
public void setOperator(Long operator) {
this.operator = operator;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", basicWage=").append(basicWage);
sb.append(", position=").append(position);
sb.append(", workingTime=").append(workingTime);
sb.append(", shareOption=").append(shareOption);
sb.append(", receiveDividends=").append(receiveDividends);
sb.append(", medicalInsurance=").append(medicalInsurance);
sb.append(", maternityInsurance=").append(maternityInsurance);
sb.append(", employmentInjuryInsurance=").append(employmentInjuryInsurance);
sb.append(", endowmentInsurance=").append(endowmentInsurance);
sb.append(", unemploymentInsurance=").append(unemploymentInsurance);
sb.append(", housingFund=").append(housingFund);
sb.append(", operator=").append(operator);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append("]");
return sb.toString();
}
}

1231
src/main/java/com/ccsens/defaultwbs/bean/po/ProMemberSalaryExample.java

File diff suppressed because it is too large

7
src/main/java/com/ccsens/defaultwbs/bean/vo/ClockingInVo.java

@ -114,8 +114,13 @@ public class ClockingInVo {
this.time = time;
this.type = type;
}
public NotClockingIn() {
}
}
@Data
public static class Holidays{
private List<String> workday;
private List<String> nonWorkday;
}
}

12
src/main/java/com/ccsens/defaultwbs/bean/vo/ProMemberSalaryVo.java

@ -0,0 +1,12 @@
package com.ccsens.defaultwbs.bean.vo;
import com.ccsens.defaultwbs.bean.po.ProMemberSalary;
import lombok.Data;
/**
* @author
*/
@Data
public class ProMemberSalaryVo extends ProMemberSalary {
private String memberName;
}

248
src/main/java/com/ccsens/defaultwbs/bean/vo/SalaryVo.java

@ -0,0 +1,248 @@
package com.ccsens.defaultwbs.bean.vo;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* @author
*/
@Data
public class SalaryVo {
@Data
@ApiModel("成员工资信息")
public static class MemberSalary{
@ApiModelProperty("成员Id")
private Long memberId;
@ApiModelProperty("成员名")
private String memberName;
@ApiModelProperty("固定工资")
private Long fixedSalary = 0L;
@ApiModelProperty("固定工资分项")
private FixedSalaryOption fixedSalaryOption;
@ApiModelProperty("绩效工资")
private Long performance = 0L;
@ApiModelProperty("绩效工资分项")
private PerformanceOption performanceOption;
@ApiModelProperty("主人翁收入")
private Long stockRights = 0L;
@ApiModelProperty("主人翁收入分项")
private StockRightsOption stockRightsOption;
@ApiModelProperty("应发工资")
private Long shouldSalary = 0L;
@ApiModelProperty("社保支出")
private Long socialSecurity = 0L;
@ApiModelProperty("社保支出分项")
private SocialSecurityOption socialSecurityOption;
@ApiModelProperty("扣税")
private Long personalTax = 0L;
@ApiModelProperty("实发工资")
private Long realSalary = 0L;
public MemberSalary(FixedSalaryOption fixedSalaryOption, PerformanceOption performanceOption, StockRightsOption stockRightsOption, SocialSecurityOption socialSecurityOption) {
this.fixedSalaryOption = fixedSalaryOption;
this.performanceOption = performanceOption;
this.stockRightsOption = stockRightsOption;
this.socialSecurityOption = socialSecurityOption;
}
public MemberSalary() {
}
public Long getFixedSalary() {
Long f = fixedSalary;
//固定工资 = 基本工资 + 岗位工资 + 工龄工资
if(ObjectUtil.isNotNull(fixedSalaryOption)){
f = fixedSalaryOption.getBasicWage() + fixedSalaryOption.getPositionWage() + fixedSalaryOption.getWorkingTimeWage();
}
return f;
}
public Long getPerformance() {
Long p = performance;
//绩效工资 = 项目奖金 + 补助 + 提成 + 考核
if(ObjectUtil.isNotNull(performanceOption)){
p = performanceOption.getProjectBonus() + performanceOption.getSubsidy() + performanceOption.getPushMoney() + performanceOption.getAssess();
}
return p;
}
public Long getStockRights() {
Long s = stockRights;
//主人翁收入 = 分红
if(ObjectUtil.isNotNull(stockRightsOption)){
s = stockRightsOption.getReceiveDividends();
}
return s;
}
public Long getShouldSalary() {
//应发工资 = 固定工资 + 绩效工资 + 主人翁收入
return getFixedSalary() + getPerformance() + getStockRights();
}
public Long getSocialSecurity() {
Long s = socialSecurity;
//社保支出 = 五险一金的总数
if(ObjectUtil.isNotNull(socialSecurityOption)){
s = socialSecurityOption.getEmploymentInjuryInsurance() + socialSecurityOption.getEndowmentInsurance() + socialSecurityOption.getHousingFund() + socialSecurityOption.getMaternityInsurance() + socialSecurityOption.getMedicalInsurance() + socialSecurityOption.getUnemploymentInsurance();
}
return s;
}
public Long getPersonalTax() {
//TODO 扣税计算不明
return personalTax;
}
public Long getRealSalary() {
//实发工资 = 应发工资 - 社保支出 - 扣税
return getShouldSalary() - getSocialSecurity() - getPersonalTax();
}
}
@Data
@ApiModel("固定工资分项")
public static class FixedSalaryOption{
@ApiModelProperty("基本工资")
private Long basicWage = 0L;
@ApiModelProperty("考勤信息")
private Basic basic;
@ApiModelProperty("岗位工资")
private Long positionWage = 0L;
@ApiModelProperty("岗位工资列表")
private Map<String,String> position = new HashMap<>();
@ApiModelProperty("工龄工资")
private Long workingTimeWage = 0L;
@ApiModelProperty("工龄工资列表")
private Map<String,String> workingTime = new HashMap<>();
{
position.put("P1","2000");
position.put("P2","3000");
position.put("P3","4000");
position.put("P4","5000");
position.put("P5","6000");
}
{
workingTime.put("1年","300");
workingTime.put("2年","500");
workingTime.put("3年","700");
workingTime.put("3年以上","1000");
}
public void setPositionWage(String p) {
if(p == null){
return;
}
String s = position.get(p);
if(ObjectUtil.isNotNull(s)){
this.positionWage = Long.parseLong(s);
}
}
public void setWorkingTimeWage(Integer w) {
if(w == null){
return;
}
long l = 0L;
switch (w){
case 0:
l = 300L;
break;
case 1:
l = 500L;
break;
case 2:
l = 700L;
break;
case 3:
l = 1000L;
break;
default:
break;
}
this.workingTimeWage = l;
}
public FixedSalaryOption(Long basicWage, Basic basic) {
this.basicWage = basicWage == null ? 0 : basicWage;
this.basic = basic;
}
public FixedSalaryOption() {
}
}
@Data
@ApiModel("考勤信息")
public static class Basic{
@ApiModelProperty("应出勤天数")
private int shouldAttendanceDay;
@ApiModelProperty("实际出勤天数")
private int realAttendanceDay;
@ApiModelProperty("弹性天数")
private int elasticityDay;
@ApiModelProperty("请假天数")
private int askForLeaveDay;
}
@Data
@ApiModel("绩效工资分项")
public static class PerformanceOption{
@ApiModelProperty("项目奖金")
private Long projectBonus = 0L;
@ApiModelProperty("补助")
private Long subsidy = 0L;
@ApiModelProperty("提成")
private Long pushMoney = 0L;
@ApiModelProperty("考核")
private Long assess = 0L;
}
@Data
@ApiModel("主人翁收入分项")
public static class StockRightsOption{
@ApiModelProperty("期权置换")
private Long sharePtion = 0L;
@ApiModelProperty("分红")
private Long receiveDividends = 0L;
public StockRightsOption(Long sharePtion, Long receiveDividends) {
this.sharePtion = sharePtion == null ? 0 : sharePtion;
this.receiveDividends = receiveDividends == null ? 0 : receiveDividends;
}
public StockRightsOption() {
}
}
@Data
@ApiModel("社保支出分项")
public static class SocialSecurityOption{
@ApiModelProperty("医疗保险")
private Long medicalInsurance = 0L;
@ApiModelProperty("生育保险")
private Long maternityInsurance = 0L;
@ApiModelProperty("工伤保险")
private Long employmentInjuryInsurance = 0L;
@ApiModelProperty("养老保险")
private Long endowmentInsurance = 0L;
@ApiModelProperty("失业保险")
private Long unemploymentInsurance = 0L;
@ApiModelProperty("住房公积金")
private Long housingFund = 0L;
public SocialSecurityOption(Long medicalInsurance, Long maternityInsurance, Long employmentInjuryInsurance, Long endowmentInsurance, Long unemploymentInsurance, Long housingFund) {
this.medicalInsurance = medicalInsurance == null ? 0 : medicalInsurance;
this.maternityInsurance = maternityInsurance == null ? 0 : maternityInsurance;
this.employmentInjuryInsurance = employmentInjuryInsurance == null ? 0 : employmentInjuryInsurance;
this.endowmentInsurance = endowmentInsurance == null ? 0 : endowmentInsurance;
this.unemploymentInsurance = unemploymentInsurance == null ? 0 : unemploymentInsurance;
this.housingFund = housingFund == null ? 0 : housingFund;
}
public SocialSecurityOption() {
}
}
}

22
src/main/java/com/ccsens/defaultwbs/persist/dao/ProMemberSalaryDao.java

@ -0,0 +1,22 @@
package com.ccsens.defaultwbs.persist.dao;
import com.ccsens.defaultwbs.bean.vo.ProMemberSalaryVo;
import com.ccsens.defaultwbs.persist.mapper.ProMemberSalaryMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface ProMemberSalaryDao extends ProMemberSalaryMapper {
/**
* 查询项目下所有成员的工资信息
* @param projectId 项目id
* @return 返回成员的工资信息
*/
List<ProMemberSalaryVo> queryByProjectId(@Param("projectId") Long projectId);
}

30
src/main/java/com/ccsens/defaultwbs/persist/mapper/ProMemberSalaryMapper.java

@ -0,0 +1,30 @@
package com.ccsens.defaultwbs.persist.mapper;
import com.ccsens.defaultwbs.bean.po.ProMemberSalary;
import com.ccsens.defaultwbs.bean.po.ProMemberSalaryExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ProMemberSalaryMapper {
long countByExample(ProMemberSalaryExample example);
int deleteByExample(ProMemberSalaryExample example);
int deleteByPrimaryKey(Long id);
int insert(ProMemberSalary record);
int insertSelective(ProMemberSalary record);
List<ProMemberSalary> selectByExample(ProMemberSalaryExample example);
ProMemberSalary selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") ProMemberSalary record, @Param("example") ProMemberSalaryExample example);
int updateByExample(@Param("record") ProMemberSalary record, @Param("example") ProMemberSalaryExample example);
int updateByPrimaryKeySelective(ProMemberSalary record);
int updateByPrimaryKey(ProMemberSalary record);
}

25
src/main/java/com/ccsens/defaultwbs/service/ClockingInService.java

@ -437,12 +437,12 @@ public class ClockingInService implements IClockingInService {
@Override
public ClockingInVo.ExcelUrl exportRecord1(ClockingInDto.QueryClockingIn params, Long userId) throws Exception {
//根据时间生成日期列表(工作日)
List<String> dateList = getDateList(params.getStartTime(), params.getEndTime());
ClockingInVo.Holidays holidays = getDateList(params.getStartTime(), params.getEndTime());
//查询需要的成员的记录
List<ClockingInVo.ClockMember> clockMembers = clockingInDao.queryMemberClockingIn(params.getMemberIdList(), params.getRoleId(), params.getStartTime(), params.getEndTime());
//生成导入数据
List<List<PoiUtil.PoiUtilCell>> list = createCell(dateList, clockMembers);
List<List<PoiUtil.PoiUtilCell>> list = createCell(holidays, clockMembers);
//获取模板
ResourceLoader resourceLoader = new DefaultResourceLoader();
@ -473,7 +473,7 @@ public class ClockingInService implements IClockingInService {
return excelUrl;
}
private List<List<PoiUtil.PoiUtilCell>> createCell(List<String> dateList, List<ClockingInVo.ClockMember> clockMembers) {
private List<List<PoiUtil.PoiUtilCell>> createCell(ClockingInVo.Holidays holidays, List<ClockingInVo.ClockMember> clockMembers) {
//整体数据
List<List<PoiUtil.PoiUtilCell>> list = new ArrayList<>();
//第一行(标题)
@ -488,7 +488,7 @@ public class ClockingInService implements IClockingInService {
// 循环成员
for (ClockingInVo.ClockMember clockMember : clockMembers) {
//计算工作日未打卡的记录
List<ClockingInVo.NotClockingIn> notList = notClocking(dateList, clockMember);
List<ClockingInVo.NotClockingIn> notList = notClocking(holidays.getWorkday(), clockMember);
//实际出勤天数row
List<PoiUtil.PoiUtilCell> clockingInTimes = new ArrayList<>();
//序号
@ -576,8 +576,11 @@ public class ClockingInService implements IClockingInService {
return notList;
}
private List<String> getDateList(Long startTime, Long endTime) {
List<String> dateList = new ArrayList<>();
private ClockingInVo.Holidays getDateList(Long startTime, Long endTime) {
ClockingInVo.Holidays holidays = new ClockingInVo.Holidays();
//工作日
List<String> workday = new ArrayList<>();
List<String> nonWorkday = new ArrayList<>();
DateFormat df = new SimpleDateFormat("MM-dd");
String isHoliday = "";
String overDay = "";
@ -589,7 +592,6 @@ public class ClockingInService implements IClockingInService {
isHoliday = sysHolidays.get(0).getHoliday();
overDay = sysHolidays.get(0).getWorkday();
}
Calendar min = Calendar.getInstance();
Calendar max = Calendar.getInstance();
min.setTime(new Date(startTime));
@ -599,11 +601,14 @@ public class ClockingInService implements IClockingInService {
int i = min.get(Calendar.DAY_OF_WEEK);
//是调休 || (不是周末 && 不是节假日)
if (overDay.contains(df.format(min.getTime())) || ((i != 1 && i != 7) && !isHoliday.contains(df.format(min.getTime())))) {
dateList.add(new SimpleDateFormat("yyyy-MM-dd").format(min.getTime()));
workday.add(new SimpleDateFormat("yyyy-MM-dd").format(min.getTime()));
}else {
nonWorkday.add(new SimpleDateFormat("yyyy-MM-dd").format(min.getTime()));
}
min.add(Calendar.DATE, 1);
}
return dateList;
holidays.setWorkday(workday);
holidays.setNonWorkday(nonWorkday);
return holidays;
}
}

36
src/main/java/com/ccsens/defaultwbs/service/ISalaryService.java

@ -0,0 +1,36 @@
package com.ccsens.defaultwbs.service;
import com.ccsens.defaultwbs.bean.dto.RoleDto;
import com.ccsens.defaultwbs.bean.dto.SalaryDto;
import com.ccsens.defaultwbs.bean.vo.SalaryVo;
import java.util.List;
/**
* @author
*/
public interface ISalaryService {
/**
* 导入工资表
* @param fullPath 文件路径
* @param userId userId
* @param projectId 项目id
*/
void importSalary(String fullPath, Long userId, Long projectId) throws Exception;
/**
* 通过id查找成员工资信息
* @param param 成员id
* @param userId userId
* @return 返回成员工资信息
*/
SalaryVo.MemberSalary getMemberSalary(SalaryDto.SocialSecurity param, Long userId);
/**
* 查看项目下所有员工的工资信息
* @param param 项目id和时间
* @param userId userId
* @return 返回所有员工的工资信息
*/
List<SalaryVo.MemberSalary> queryMemberSalary(SalaryDto.SocialSecurity param, Long userId);
}

227
src/main/java/com/ccsens/defaultwbs/service/SalaryService.java

@ -0,0 +1,227 @@
package com.ccsens.defaultwbs.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.common.bean.po.ProMember;
import com.ccsens.common.bean.po.ProMemberExample;
import com.ccsens.common.bean.po.ProTaskDetail;
import com.ccsens.common.persist.dao.ProMemberDao;
import com.ccsens.common.persist.dao.ProTaskDetailDao;
import com.ccsens.defaultwbs.bean.dto.SalaryDto;
import com.ccsens.defaultwbs.bean.po.ProMemberSalary;
import com.ccsens.defaultwbs.bean.po.ProMemberSalaryExample;
import com.ccsens.defaultwbs.bean.vo.ProMemberSalaryVo;
import com.ccsens.defaultwbs.bean.vo.SalaryVo;
import com.ccsens.defaultwbs.persist.dao.ProMemberSalaryDao;
import com.ccsens.defaultwbs.persist.mapper.ProMemberSalaryMapper;
import com.ccsens.defaultwbs.util.DefaultCodeError;
import com.ccsens.util.ExcelUtil;
import com.ccsens.util.StringUtil;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class SalaryService implements ISalaryService{
@Resource
private ProTaskDetailDao taskDetailDao;
@Resource
private ProMemberDao proMemberDao;
@Resource
private ProMemberSalaryDao memberSalaryDao;
@Resource
private Snowflake snowflake;
@Override
public void importSalary(String fullPath, Long userId, Long projectId) throws Exception {
//判断项目是否存在
if(ObjectUtil.isNull(projectId)){
throw new BaseException(DefaultCodeError.NOT_PROJECT);
}
ProTaskDetail taskDetail = taskDetailDao.selectByPrimaryKey(projectId);
if(ObjectUtil.isNull(taskDetail)){
throw new BaseException(DefaultCodeError.NOT_PROJECT);
}
//获取文件
InputStream is = new FileInputStream(fullPath);
XSSFWorkbook workbook = new XSSFWorkbook(is);
if(ObjectUtil.isNull(workbook)){
throw new BaseException(DefaultCodeError.EXCEL_ERROR);
}
//读取第一个sheet
XSSFSheet sheetAt = workbook.getSheetAt(0);
if(ObjectUtil.isNull(sheetAt)){
throw new BaseException(DefaultCodeError.EXCEL_ERROR);
}
//循环读取每一行
for (int i = 2; i <= sheetAt.getLastRowNum(); i++) {
//获取行
XSSFRow row = sheetAt.getRow(i);
if (row == null) {
continue;
}
//获取成员姓名
String memberName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1)));
log.info("成员名:{}",memberName);
if(StrUtil.isEmpty(memberName)){
continue;
}
//获取成员信息,检查项目下是否有该成员
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo(memberName);
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
if(CollectionUtil.isEmpty(memberList)){
throw new BaseException(DefaultCodeError.PROJECT_NOT_MEMBER.addMsg("第" + (i + 1) + "行"));
}
ProMember member = memberList.get(0);
//获取其他工资信息
//职位
String position = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2)));
//工作时间
String workingTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3)));
//基本工资
String basicWage = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4)));
//期权置换
String shareOption = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5)));
//分红
String receiveDividends = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6)));
//医疗保险
String medicalInsurance = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(7)));
//剩余保险
String maternityInsurance = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(8)));
//工伤保险
String employmentInjuryInsurance = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(9)));
//养老保险
String endowmentInsurance = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(10)));
//失业保险
String unemploymentInsurance = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(11)));
//住房公积金
String housingFund = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(12)));
ProMemberSalary salary = new ProMemberSalary();
//检查员工工资信息是否存在
ProMemberSalaryExample memberSalaryExample = new ProMemberSalaryExample();
memberSalaryExample.createCriteria().andMemberIdEqualTo(member.getId());
List<ProMemberSalary> proMemberSalaries = memberSalaryDao.selectByExample(memberSalaryExample);
if(CollectionUtil.isNotEmpty(proMemberSalaries)){
salary = proMemberSalaries.get(0);
}
//将成员工资信息存入数据库
salary.setMemberId(member.getId());
salary.setPosition(position);
salary.setWorkingTime(Integer.parseInt(StrUtil.isEmpty(workingTime) ? "0" : workingTime));
salary.setBasicWage(Long.parseLong(StrUtil.isEmpty(basicWage) ? "0" : basicWage));
salary.setShareOption(Long.parseLong(StrUtil.isEmpty(shareOption) ? "0" : shareOption));
salary.setReceiveDividends(Long.parseLong(StrUtil.isEmpty(receiveDividends) ? "0" : receiveDividends));
salary.setMedicalInsurance(Long.parseLong(StrUtil.isEmpty(medicalInsurance) ? "0" : medicalInsurance));
salary.setMaternityInsurance(Long.parseLong(StrUtil.isEmpty(maternityInsurance) ? "0" : maternityInsurance));
salary.setEmploymentInjuryInsurance(Long.parseLong(StrUtil.isEmpty(employmentInjuryInsurance) ? "0" : employmentInjuryInsurance));
salary.setEndowmentInsurance(Long.parseLong(StrUtil.isEmpty(endowmentInsurance) ? "0" : endowmentInsurance));
salary.setUnemploymentInsurance(Long.parseLong(StrUtil.isEmpty(unemploymentInsurance) ? "0" : unemploymentInsurance));
salary.setHousingFund(Long.parseLong(StrUtil.isEmpty(housingFund) ? "0" : housingFund));
if(ObjectUtil.isNotNull(salary.getId())){
//以前存在则修改
memberSalaryDao.updateByPrimaryKeySelective(salary);
}else{
//不存在则添加
salary.setId(snowflake.nextId());
memberSalaryDao.insertSelective(salary);
}
}
}
@Override
public SalaryVo.MemberSalary getMemberSalary(SalaryDto.SocialSecurity param, Long userId) {
//成员信息或成员工资信息为空,返回错误信息
ProMember member = null;
if(ObjectUtil.isNull(param.getMemberId())){
//不传memberId 查询当前用户自身的信息
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andUserIdEqualTo(userId);
List<ProMember> memberList = proMemberDao.selectByExample(memberExample);
if(CollectionUtil.isNotEmpty(memberList)){
member = memberList.get(0);
}
}else {
member = proMemberDao.selectByPrimaryKey(param.getMemberId());
}
if(ObjectUtil.isNull(member)){
throw new BaseException(DefaultCodeError.PROJECT_NOT_MEMBER);
}
//根据成员id查找成员工资信息
ProMemberSalaryExample memberSalaryExample = new ProMemberSalaryExample();
memberSalaryExample.createCriteria().andMemberIdEqualTo(member.getId());
List<ProMemberSalary> proMemberSalaries = memberSalaryDao.selectByExample(memberSalaryExample);
if(CollectionUtil.isEmpty(proMemberSalaries)){
throw new BaseException(DefaultCodeError.NOT_MEMBER_SALARIES);
}
ProMemberSalary salary = proMemberSalaries.get(0);
//返回
return getMemberSalaryVo(param, salary, member.getId(), member.getName());
}
private SalaryVo.MemberSalary getMemberSalaryVo(SalaryDto.SocialSecurity param, ProMemberSalary salary, Long id, String name) {
//TODO 查询成员的打卡信息
SalaryVo.Basic basic = clockingIn(id, param.getStartTime(), param.getEndTime(), param.getProjectId());
//固定工资
SalaryVo.FixedSalaryOption fixedSalaryOption = new SalaryVo.FixedSalaryOption(salary.getBasicWage(), basic);
fixedSalaryOption.setPositionWage(salary.getPosition());
fixedSalaryOption.setWorkingTimeWage(salary.getWorkingTime());
//绩效工资
SalaryVo.PerformanceOption performanceOption = new SalaryVo.PerformanceOption();
//主人翁收入
SalaryVo.StockRightsOption stockRightsOption = new SalaryVo.StockRightsOption(salary.getShareOption(), salary.getReceiveDividends());
//社保支出
SalaryVo.SocialSecurityOption socialSecurityOption = new SalaryVo.SocialSecurityOption(salary.getMedicalInsurance(), salary.getMaternityInsurance(), salary.getEmploymentInjuryInsurance(), salary.getEndowmentInsurance(), salary.getUnemploymentInsurance(), salary.getHousingFund());
//总的工资信息
SalaryVo.MemberSalary memberSalary = new SalaryVo.MemberSalary(fixedSalaryOption, performanceOption, stockRightsOption, socialSecurityOption);
memberSalary.setMemberId(id);
memberSalary.setMemberName(name);
return memberSalary;
}
private SalaryVo.Basic clockingIn(Long memberId, Long startTime, Long endTime, Long projectId) {
SalaryVo.Basic basic = new SalaryVo.Basic();
return basic;
}
@Override
public List<SalaryVo.MemberSalary> queryMemberSalary(SalaryDto.SocialSecurity param, Long userId) {
List<SalaryVo.MemberSalary> memberSalaryList = new ArrayList<>();
//查询项目下所有的成员的工资信息
List<ProMemberSalaryVo> proMemberSalaryVoList = memberSalaryDao.queryByProjectId(param.getProjectId());
if(CollectionUtil.isNotEmpty(proMemberSalaryVoList)){
proMemberSalaryVoList.forEach(salary -> {
//TODO 查询成员的打卡信息
SalaryVo.MemberSalary memberSalary = getMemberSalaryVo(param, salary, salary.getMemberId(), salary.getMemberName());
memberSalaryList.add(memberSalary);
});
}
return memberSalaryList;
}
}

5
src/main/java/com/ccsens/defaultwbs/util/DefaultCodeError.java

@ -24,6 +24,11 @@ public class DefaultCodeError extends CodeError {
public static final Code FEIGN_ERROR = new Code(13,"导入项目失败", true);
public static final Code NOT_CLOCKING_IN = new Code(514,"打卡记录不存在", true);
public static final Code NOT_PROJECT = new Code(515,"项目不存在,请检查项目信息", true);
public static final Code EXCEL_ERROR = new Code(516,"表格读取异常", true);
public static final Code PROJECT_NOT_MEMBER = new Code(516,"未找到对应的成员信息", true);
public static final Code NOT_MEMBER_SALARIES = new Code(516,"该员工没有基本工资信息,请补充后再查询", true);

3
src/main/resources/application-prod.yml

@ -29,7 +29,8 @@ swagger:
enable: true
eureka:
instance:
ip-address: 121.36.106.168
# ip-address: 121.36.106.168
ip-address: 101.201.226.21
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/

4
src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: common, util-dev
active: prod
include: common, util-prod

17
src/main/resources/mapper_dao/ProMemberSalaryDao.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.defaultwbs.persist.dao.ProMemberSalaryDao">
<select id="queryByProjectId" resultType="com.ccsens.defaultwbs.bean.vo.ProMemberSalaryVo">
SELECT
m.id as memberId,
m.`name` as memberName,
s.*
FROM
t_pro_member m
LEFT JOIN t_pro_member_salary s on s.member_id = m.id and s.rec_status = 0
WHERE
m.project_id = #{projectId}
and m.rec_status = 0
</select>
</mapper>

403
src/main/resources/mapper_raw/ProMemberSalaryMapper.xml

@ -0,0 +1,403 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.defaultwbs.persist.mapper.ProMemberSalaryMapper">
<resultMap id="BaseResultMap" type="com.ccsens.defaultwbs.bean.po.ProMemberSalary">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="member_id" jdbcType="BIGINT" property="memberId" />
<result column="basic_wage" jdbcType="BIGINT" property="basicWage" />
<result column="position" jdbcType="VARCHAR" property="position" />
<result column="working_time" jdbcType="INTEGER" property="workingTime" />
<result column="share_option" jdbcType="BIGINT" property="shareOption" />
<result column="receive_dividends" jdbcType="BIGINT" property="receiveDividends" />
<result column="medical_insurance" jdbcType="BIGINT" property="medicalInsurance" />
<result column="maternity_insurance" jdbcType="BIGINT" property="maternityInsurance" />
<result column="employment_injury_insurance" jdbcType="BIGINT" property="employmentInjuryInsurance" />
<result column="endowment_insurance" jdbcType="BIGINT" property="endowmentInsurance" />
<result column="unemployment_insurance" jdbcType="BIGINT" property="unemploymentInsurance" />
<result column="housing_fund" jdbcType="BIGINT" property="housingFund" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, member_id, basic_wage, position, working_time, share_option, receive_dividends,
medical_insurance, maternity_insurance, employment_injury_insurance, endowment_insurance,
unemployment_insurance, housing_fund, operator, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalaryExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_pro_member_salary
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_pro_member_salary
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_pro_member_salary
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalaryExample">
delete from t_pro_member_salary
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalary">
insert into t_pro_member_salary (id, member_id, basic_wage,
position, working_time, share_option,
receive_dividends, medical_insurance, maternity_insurance,
employment_injury_insurance, endowment_insurance,
unemployment_insurance, housing_fund, operator,
created_at, updated_at, rec_status
)
values (#{id,jdbcType=BIGINT}, #{memberId,jdbcType=BIGINT}, #{basicWage,jdbcType=BIGINT},
#{position,jdbcType=VARCHAR}, #{workingTime,jdbcType=INTEGER}, #{shareOption,jdbcType=BIGINT},
#{receiveDividends,jdbcType=BIGINT}, #{medicalInsurance,jdbcType=BIGINT}, #{maternityInsurance,jdbcType=BIGINT},
#{employmentInjuryInsurance,jdbcType=BIGINT}, #{endowmentInsurance,jdbcType=BIGINT},
#{unemploymentInsurance,jdbcType=BIGINT}, #{housingFund,jdbcType=BIGINT}, #{operator,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalary">
insert into t_pro_member_salary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="memberId != null">
member_id,
</if>
<if test="basicWage != null">
basic_wage,
</if>
<if test="position != null">
position,
</if>
<if test="workingTime != null">
working_time,
</if>
<if test="shareOption != null">
share_option,
</if>
<if test="receiveDividends != null">
receive_dividends,
</if>
<if test="medicalInsurance != null">
medical_insurance,
</if>
<if test="maternityInsurance != null">
maternity_insurance,
</if>
<if test="employmentInjuryInsurance != null">
employment_injury_insurance,
</if>
<if test="endowmentInsurance != null">
endowment_insurance,
</if>
<if test="unemploymentInsurance != null">
unemployment_insurance,
</if>
<if test="housingFund != null">
housing_fund,
</if>
<if test="operator != null">
operator,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="memberId != null">
#{memberId,jdbcType=BIGINT},
</if>
<if test="basicWage != null">
#{basicWage,jdbcType=BIGINT},
</if>
<if test="position != null">
#{position,jdbcType=VARCHAR},
</if>
<if test="workingTime != null">
#{workingTime,jdbcType=INTEGER},
</if>
<if test="shareOption != null">
#{shareOption,jdbcType=BIGINT},
</if>
<if test="receiveDividends != null">
#{receiveDividends,jdbcType=BIGINT},
</if>
<if test="medicalInsurance != null">
#{medicalInsurance,jdbcType=BIGINT},
</if>
<if test="maternityInsurance != null">
#{maternityInsurance,jdbcType=BIGINT},
</if>
<if test="employmentInjuryInsurance != null">
#{employmentInjuryInsurance,jdbcType=BIGINT},
</if>
<if test="endowmentInsurance != null">
#{endowmentInsurance,jdbcType=BIGINT},
</if>
<if test="unemploymentInsurance != null">
#{unemploymentInsurance,jdbcType=BIGINT},
</if>
<if test="housingFund != null">
#{housingFund,jdbcType=BIGINT},
</if>
<if test="operator != null">
#{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalaryExample" resultType="java.lang.Long">
select count(*) from t_pro_member_salary
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_pro_member_salary
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.memberId != null">
member_id = #{record.memberId,jdbcType=BIGINT},
</if>
<if test="record.basicWage != null">
basic_wage = #{record.basicWage,jdbcType=BIGINT},
</if>
<if test="record.position != null">
position = #{record.position,jdbcType=VARCHAR},
</if>
<if test="record.workingTime != null">
working_time = #{record.workingTime,jdbcType=INTEGER},
</if>
<if test="record.shareOption != null">
share_option = #{record.shareOption,jdbcType=BIGINT},
</if>
<if test="record.receiveDividends != null">
receive_dividends = #{record.receiveDividends,jdbcType=BIGINT},
</if>
<if test="record.medicalInsurance != null">
medical_insurance = #{record.medicalInsurance,jdbcType=BIGINT},
</if>
<if test="record.maternityInsurance != null">
maternity_insurance = #{record.maternityInsurance,jdbcType=BIGINT},
</if>
<if test="record.employmentInjuryInsurance != null">
employment_injury_insurance = #{record.employmentInjuryInsurance,jdbcType=BIGINT},
</if>
<if test="record.endowmentInsurance != null">
endowment_insurance = #{record.endowmentInsurance,jdbcType=BIGINT},
</if>
<if test="record.unemploymentInsurance != null">
unemployment_insurance = #{record.unemploymentInsurance,jdbcType=BIGINT},
</if>
<if test="record.housingFund != null">
housing_fund = #{record.housingFund,jdbcType=BIGINT},
</if>
<if test="record.operator != null">
operator = #{record.operator,jdbcType=BIGINT},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedAt != null">
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_pro_member_salary
set id = #{record.id,jdbcType=BIGINT},
member_id = #{record.memberId,jdbcType=BIGINT},
basic_wage = #{record.basicWage,jdbcType=BIGINT},
position = #{record.position,jdbcType=VARCHAR},
working_time = #{record.workingTime,jdbcType=INTEGER},
share_option = #{record.shareOption,jdbcType=BIGINT},
receive_dividends = #{record.receiveDividends,jdbcType=BIGINT},
medical_insurance = #{record.medicalInsurance,jdbcType=BIGINT},
maternity_insurance = #{record.maternityInsurance,jdbcType=BIGINT},
employment_injury_insurance = #{record.employmentInjuryInsurance,jdbcType=BIGINT},
endowment_insurance = #{record.endowmentInsurance,jdbcType=BIGINT},
unemployment_insurance = #{record.unemploymentInsurance,jdbcType=BIGINT},
housing_fund = #{record.housingFund,jdbcType=BIGINT},
operator = #{record.operator,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalary">
update t_pro_member_salary
<set>
<if test="memberId != null">
member_id = #{memberId,jdbcType=BIGINT},
</if>
<if test="basicWage != null">
basic_wage = #{basicWage,jdbcType=BIGINT},
</if>
<if test="position != null">
position = #{position,jdbcType=VARCHAR},
</if>
<if test="workingTime != null">
working_time = #{workingTime,jdbcType=INTEGER},
</if>
<if test="shareOption != null">
share_option = #{shareOption,jdbcType=BIGINT},
</if>
<if test="receiveDividends != null">
receive_dividends = #{receiveDividends,jdbcType=BIGINT},
</if>
<if test="medicalInsurance != null">
medical_insurance = #{medicalInsurance,jdbcType=BIGINT},
</if>
<if test="maternityInsurance != null">
maternity_insurance = #{maternityInsurance,jdbcType=BIGINT},
</if>
<if test="employmentInjuryInsurance != null">
employment_injury_insurance = #{employmentInjuryInsurance,jdbcType=BIGINT},
</if>
<if test="endowmentInsurance != null">
endowment_insurance = #{endowmentInsurance,jdbcType=BIGINT},
</if>
<if test="unemploymentInsurance != null">
unemployment_insurance = #{unemploymentInsurance,jdbcType=BIGINT},
</if>
<if test="housingFund != null">
housing_fund = #{housingFund,jdbcType=BIGINT},
</if>
<if test="operator != null">
operator = #{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.defaultwbs.bean.po.ProMemberSalary">
update t_pro_member_salary
set member_id = #{memberId,jdbcType=BIGINT},
basic_wage = #{basicWage,jdbcType=BIGINT},
position = #{position,jdbcType=VARCHAR},
working_time = #{workingTime,jdbcType=INTEGER},
share_option = #{shareOption,jdbcType=BIGINT},
receive_dividends = #{receiveDividends,jdbcType=BIGINT},
medical_insurance = #{medicalInsurance,jdbcType=BIGINT},
maternity_insurance = #{maternityInsurance,jdbcType=BIGINT},
employment_injury_insurance = #{employmentInjuryInsurance,jdbcType=BIGINT},
endowment_insurance = #{endowmentInsurance,jdbcType=BIGINT},
unemployment_insurance = #{unemploymentInsurance,jdbcType=BIGINT},
housing_fund = #{housingFund,jdbcType=BIGINT},
operator = #{operator,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

3
src/main/resources/mbg.xml

@ -81,7 +81,8 @@
<!-- <table tableName="t_pro_deliver" domainObjectName="ProDeliver"></table>-->
<!-- <table tableName="t_pro_deliver_checker" domainObjectName="ProDeliverChecker"></table>-->
<!-- <table tableName="t_pro_clocking_in" domainObjectName="ProClockingIn"></table>-->
<table tableName="t_sys_holidays" domainObjectName="SysHolidays"></table>
<!-- <table tableName="t_sys_holidays" domainObjectName="SysHolidays"></table>-->
<table tableName="t_pro_member_salary" domainObjectName="ProMemberSalary"></table>
<!-- 有些表的字段需要指定java类型
<table schema="" tableName="">

Loading…
Cancel
Save