合同与工资卡图片处理
This commit is contained in:
parent
cec8d6aad2
commit
c90df5e56b
|
|
@ -138,4 +138,15 @@ public class Constants
|
|||
* 指定集合的大小
|
||||
*/
|
||||
public static final int COMMON_COLLECTION_SIZE = 16;
|
||||
|
||||
//文件上传表的固定值
|
||||
/**
|
||||
* 合同表
|
||||
*/
|
||||
public static final String FILE_UPLOAD_CONTRACT = "bm_worker_contract";
|
||||
|
||||
/**
|
||||
* 工资卡表
|
||||
*/
|
||||
public static final String FILE_UPLOAD_WAGE_CARD = "bm_worker_wage_card";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
package com.bonus.bmw.controller;
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.service.BmWorkerContractService;
|
||||
import com.bonus.bmw.service.impl.BmWorkerContractServiceImpl;
|
||||
import com.bonus.bmw.service.impl.FileUploadUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
|
|
@ -20,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -36,7 +42,7 @@ public class BmWorkerContractController extends BaseController {
|
|||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private BmWorkerContractServiceImpl service;
|
||||
private BmWorkerContractService service;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
|
|
@ -89,7 +95,7 @@ public class BmWorkerContractController extends BaseController {
|
|||
AjaxResult ajax = AjaxResult.success();
|
||||
BmWorkerContract o = new BmWorkerContract();
|
||||
o.setId(id);
|
||||
List<BmWorkerContract> list = service.selectContractListByWorkerId(o);
|
||||
List<BmWorkerContract> list = service.selectContractListById(o);
|
||||
ajax.put("data", list);
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
|
|
@ -99,22 +105,27 @@ public class BmWorkerContractController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改合同信息
|
||||
*/
|
||||
//, requiresPermissions = @RequiresPermissions("system:contract:edit")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth)
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "合同管理", businessType = OperaType.UPDATE, logType = 0, module = "施工人员->红绿灯管理->合同管理", details = "修改合同")
|
||||
public AjaxResult edit(@RequestParam(value = "files") MultipartFile[] files,@RequestParam(value = "fileMsg") String fileMsg, @RequestParam(value = "params")String params) {
|
||||
public AjaxResult edit(@RequestParam(value = "files") MultipartFile[] files,@RequestParam(value = "fileMsg") String fileMsg, @RequestParam(value = "params")String params) {
|
||||
try {
|
||||
System.out.println("fileMsg:"+fileMsg);
|
||||
System.out.println(files.length);
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
BmWorkerContract o = FastJsonHelper.jsonStrToBean(params, BmWorkerContract.class);
|
||||
return toAjax(service.updateByPrimaryKey(o));
|
||||
return toAjax(service.updateByPrimaryKey(o,new FileBasicMsgDto(listFile, files)));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同信息
|
||||
*/
|
||||
//, requiresPermissions = @RequiresPermissions("system:contract:remove")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth)
|
||||
@PostMapping("/delete/{id}")
|
||||
|
|
@ -128,4 +139,38 @@ public class BmWorkerContractController extends BaseController {
|
|||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 单独查看文件
|
||||
*/
|
||||
//, requiresPermissions = @RequiresPermissions("system:contract:remove")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth)
|
||||
@PostMapping("/lookFile/{id}")
|
||||
@SysLog(title = "合同管理", businessType = OperaType.QUERY, logType = 0, module = "施工人员->红绿灯管理->合同管理", details = "单独查看文件")
|
||||
public AjaxResult lookFile(@PathVariable("id") Integer id) {
|
||||
try {
|
||||
return service.lookFileByPrimaryKey(id);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 合同信息导出
|
||||
*/
|
||||
// @RequiresPermissions("system:user:export")
|
||||
@PostMapping("/contractExport")
|
||||
@SysLog(title = "合同信息导出", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->红绿灯管理->合同管理", details = "合同信息导出")
|
||||
public void export(HttpServletResponse response, BmWorkerContract o) {
|
||||
try {
|
||||
List<BmWorkerContract> list = service.selectContractList(o);
|
||||
ExcelUtil<BmWorkerContract> util = new ExcelUtil<>(BmWorkerContract.class);
|
||||
util.exportExcel(response, list, "合同信息导出");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
|
|
@ -13,6 +17,7 @@ import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -56,9 +61,28 @@ public class BmWorkerWageCardController extends BaseController {
|
|||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth)
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "工资卡管理", businessType = OperaType.UPDATE, logType = 0, module = "施工人员->红绿灯管理->工资卡管理", details = "修改工资卡")
|
||||
public AjaxResult edit(@Validated @RequestBody BmWorkerWageCard o) {
|
||||
public AjaxResult edit(@RequestParam(value = "files") MultipartFile[] files, @RequestParam(value = "fileMsg") String fileMsg, @RequestParam(value = "params")String params) {
|
||||
try {
|
||||
return toAjax(service.updateByPrimaryKey(o));
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
BmWorkerWageCard o = FastJsonHelper.jsonStrToBean(params, BmWorkerWageCard.class);
|
||||
return toAjax(service.updateByPrimaryKey(o,new FileBasicMsgDto(listFile, files)));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单独查看文件
|
||||
*/
|
||||
//, requiresPermissions = @RequiresPermissions("system:contract:remove")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth)
|
||||
@PostMapping("/lookFile/{id}")
|
||||
@SysLog(title = "工资卡管理", businessType = OperaType.QUERY, logType = 0, module = "施工人员->红绿灯管理->工资卡管理", details = "单独查看文件")
|
||||
public AjaxResult lookFile(@PathVariable("id") Integer id) {
|
||||
try {
|
||||
return service.lookFileByPrimaryKey(id);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.bmw.domain.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FileBasicMsgDto {
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
* bg.png
|
||||
*/
|
||||
private List<WebFileDto> fileMsg;
|
||||
|
||||
/**
|
||||
* 文件
|
||||
*/
|
||||
private MultipartFile[] files;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.bmw.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: fly
|
||||
* @date: 2025/08/14
|
||||
*/
|
||||
@Data
|
||||
public class WebFileDto {
|
||||
|
||||
/**
|
||||
* 文件类型名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 文件类型下级编号
|
||||
*/
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -8,6 +13,10 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
public class BmWorkerContract {
|
||||
|
||||
//用于excel导出的序号一列,不需要业务逻辑处理
|
||||
@Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT,sort = 1)
|
||||
int sequence;
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
|
|
@ -19,8 +28,9 @@ public class BmWorkerContract {
|
|||
private Integer workerId;
|
||||
|
||||
/**
|
||||
* 合同编码
|
||||
* 合同编号
|
||||
*/
|
||||
@Excel(name = "合同编号", type = Excel.Type.EXPORT, sort = 4)
|
||||
private String contractCode;
|
||||
|
||||
/**
|
||||
|
|
@ -31,11 +41,14 @@ public class BmWorkerContract {
|
|||
/**
|
||||
* 合同开始时间
|
||||
*/
|
||||
@Excel(name = "合同生效时间", type = Excel.Type.EXPORT, sort = 9)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date contractStartDate;
|
||||
|
||||
/**
|
||||
* 合同结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date contractStopDate;
|
||||
|
||||
/**
|
||||
|
|
@ -56,6 +69,7 @@ public class BmWorkerContract {
|
|||
/**
|
||||
* 合同上传时间
|
||||
*/
|
||||
|
||||
private Date contractUploadDate;
|
||||
|
||||
/**
|
||||
|
|
@ -86,31 +100,37 @@ public class BmWorkerContract {
|
|||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Excel(name = "姓名", type = Excel.Type.EXPORT, sort = 2)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@Excel(name = "身份证号码", type = Excel.Type.EXPORT, sort = 3)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", type = Excel.Type.EXPORT, sort = 5)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@Excel(name = "班组名称", type = Excel.Type.EXPORT, sort = 7)
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 分包名称
|
||||
*/
|
||||
@Excel(name = "分包名称", type = Excel.Type.EXPORT, sort = 6)
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 是否签合同
|
||||
*/
|
||||
@Excel(name = "是否签合同", type = Excel.Type.EXPORT, sort = 8,readConverterExp = "已签订=1,未签订=0")
|
||||
private String isSign;
|
||||
|
||||
/**
|
||||
|
|
@ -120,4 +140,6 @@ public class BmWorkerContract {
|
|||
|
||||
private String einStatus;
|
||||
|
||||
private List<UploadFileVo> files;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.bmw.mapper;
|
|||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -43,4 +44,18 @@ public interface BmWorkerContractMapper {
|
|||
BmWorkerContract selectContractListByWorkerIdAndValid(BmWorkerContract o);
|
||||
|
||||
int deleteByWorkerId(Integer id);
|
||||
|
||||
/**
|
||||
* 更新 Ein 记录的关联合同ID
|
||||
* @param id
|
||||
* @param workerId
|
||||
*/
|
||||
void updateEinRecordContractId(@Param("contractId") Integer id,@Param("workerId") Integer workerId);
|
||||
|
||||
/**
|
||||
* 获取合同
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<BmWorkerContract> selectContractListById(BmWorkerContract o);
|
||||
}
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -26,7 +29,7 @@ public interface BmWorkerContractService{
|
|||
* @param record
|
||||
* @return
|
||||
*/
|
||||
int updateByPrimaryKey(BmWorkerContract record);
|
||||
int updateByPrimaryKey(BmWorkerContract record, FileBasicMsgDto files);
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
|
|
@ -48,4 +51,13 @@ public interface BmWorkerContractService{
|
|||
* @return
|
||||
*/
|
||||
BmWorkerContract selectContractListByWorkerIdAndValid(BmWorkerContract o);
|
||||
|
||||
List<BmWorkerContract> selectContractListById(BmWorkerContract o);
|
||||
|
||||
/**
|
||||
* 查询合同文件
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
AjaxResult lookFileByPrimaryKey(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -11,7 +13,7 @@ public interface BmWorkerWageCardService {
|
|||
* @param record
|
||||
* @return
|
||||
*/
|
||||
int updateByPrimaryKey(BmWorkerWageCard record);
|
||||
int updateByPrimaryKey(BmWorkerWageCard record, FileBasicMsgDto files);
|
||||
|
||||
/**
|
||||
* 修改工资卡
|
||||
|
|
@ -47,5 +49,12 @@ public interface BmWorkerWageCardService {
|
|||
* @return
|
||||
*/
|
||||
void updateLightByWorkerId(Integer id);
|
||||
|
||||
/**
|
||||
* 查询文件
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
AjaxResult lookFileByPrimaryKey(Integer id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -8,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import com.bonus.bmw.mapper.BmWorkerContractMapper;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.service.BmWorkerContractService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
|
@ -20,6 +27,9 @@ public class BmWorkerContractServiceImpl implements BmWorkerContractService{
|
|||
@Autowired
|
||||
private BmWorkerContractMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
return mapper.deleteByPrimaryKey(id);
|
||||
|
|
@ -35,13 +45,13 @@ public class BmWorkerContractServiceImpl implements BmWorkerContractService{
|
|||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateByPrimaryKey(BmWorkerContract record) {
|
||||
public int updateByPrimaryKey(BmWorkerContract record,FileBasicMsgDto files) {
|
||||
//如果有旧的有效合同执行删除
|
||||
if(record.getId() != null){
|
||||
deleteByPrimaryKey(record.getId());
|
||||
}
|
||||
//存文件 TODO
|
||||
record.setCreateUser(SecurityUtils.getUsername());
|
||||
//判断是日合同还是月合同
|
||||
if ("月".equals(record.getWageApprovedWay())) {
|
||||
|
|
@ -55,7 +65,17 @@ public class BmWorkerContractServiceImpl implements BmWorkerContractService{
|
|||
record.setDayRate(dayRate.doubleValue());
|
||||
}
|
||||
int insert = mapper.insert(record);
|
||||
//将合同id保存到入场表 TODO
|
||||
if(insert > 0){
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = files.getFileMsg();
|
||||
String[] type = new String[fileMsg.size()];
|
||||
for (int i = 0; i < fileMsg.size(); i++) {
|
||||
type[i] = fileMsg.get(i).getType();
|
||||
}
|
||||
List<UploadFileVo> uploadFileVos = fileUploadUtils.uploadFile(files.getFiles(), Constants.FILE_UPLOAD_CONTRACT, record.getId().toString(), type,"", "");
|
||||
}
|
||||
//将合同id保存到入场表
|
||||
mapper.updateEinRecordContractId(record.getId(),record.getWorkerId());
|
||||
return insert;
|
||||
}
|
||||
|
||||
|
|
@ -84,4 +104,18 @@ public class BmWorkerContractServiceImpl implements BmWorkerContractService{
|
|||
return mapper.selectContractListByWorkerIdAndValid(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BmWorkerContract> selectContractListById(BmWorkerContract o) {
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", o.getId().toString(), Constants.FILE_UPLOAD_CONTRACT, "");
|
||||
List<BmWorkerContract> bmWorkerContracts = mapper.selectContractListById(o);
|
||||
bmWorkerContracts.get(0).setFiles(contractFile);
|
||||
return bmWorkerContracts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult lookFileByPrimaryKey(Integer id) {
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", id.toString(), Constants.FILE_UPLOAD_CONTRACT, "");
|
||||
return AjaxResult.success(contractFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.mapper.BmWorkerWageCardMapper;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -20,6 +26,8 @@ public class BmWorkerWageCardServiceImpl implements BmWorkerWageCardService {
|
|||
@Resource
|
||||
private BmWorkerWageCardMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
/**
|
||||
* 新增工资卡
|
||||
*
|
||||
|
|
@ -27,14 +35,24 @@ public class BmWorkerWageCardServiceImpl implements BmWorkerWageCardService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateByPrimaryKey(BmWorkerWageCard record) {
|
||||
public int updateByPrimaryKey(BmWorkerWageCard record, FileBasicMsgDto files) {
|
||||
//存在则删除后新增,不存在则新增
|
||||
if(record.getId() != null){
|
||||
deleteByPrimaryKey(record.getId());
|
||||
}
|
||||
record.setCreateUser(SecurityUtils.getUsername());
|
||||
//添加到文件库和minio上 TODO
|
||||
return mapper.insert(record);
|
||||
int insert = mapper.insert(record);
|
||||
//添加到文件库和minio上
|
||||
if(insert > 0){
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = files.getFileMsg();
|
||||
String[] type = new String[fileMsg.size()];
|
||||
for (int i = 0; i < fileMsg.size(); i++) {
|
||||
type[i] = fileMsg.get(i).getType();
|
||||
}
|
||||
List<UploadFileVo> uploadFileVos = fileUploadUtils.uploadFile(files.getFiles(), Constants.FILE_UPLOAD_WAGE_CARD, record.getId().toString(), type,"", "");
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -77,8 +95,8 @@ public class BmWorkerWageCardServiceImpl implements BmWorkerWageCardService {
|
|||
public int deleteByPrimaryKey(Integer id) {
|
||||
//删除数据和工资卡图片
|
||||
int i = mapper.deleteByPrimaryKey(id);
|
||||
//删除工资卡图片 TODO
|
||||
//删除minio文件
|
||||
//删除工资卡图片 删除minio文件
|
||||
fileUploadUtils.delFileListById("", id.toString(), Constants.FILE_UPLOAD_WAGE_CARD,"");
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +115,12 @@ public class BmWorkerWageCardServiceImpl implements BmWorkerWageCardService {
|
|||
mapper.updateEinMsgByWorkerId(id, lightStatus, now);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult lookFileByPrimaryKey(Integer id) {
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", id.toString(), Constants.FILE_UPLOAD_WAGE_CARD, "");
|
||||
return AjaxResult.success(contractFile);
|
||||
}
|
||||
|
||||
private int selectWageCardAndContract(Integer id) {
|
||||
return mapper.selectWageCardAndContract(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
if(bmWorkerContract != null && StringUtil.isNotEmpty(bmWorkerContract.getContractCode())){
|
||||
bmWorkerContract.setCreateUser(SecurityUtils.getUsername());
|
||||
bmWorkerContract.setWorkerId(record.getId());
|
||||
contractService.updateByPrimaryKey(bmWorkerContract);
|
||||
// contractService.updateByPrimaryKey(bmWorkerContract);
|
||||
record.setContractId(bmWorkerContract.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,15 +107,14 @@
|
|||
bwc.contract_code,
|
||||
bwc.contract_start_date,
|
||||
bwc.is_active,
|
||||
bwc.contract_stop_date,
|
||||
bwc.contract_term_type,
|
||||
bwc.contract_upload_date,
|
||||
bwc.contract_invalid_date,
|
||||
bwc.wage_approved_way,
|
||||
bwc.wage_criterion
|
||||
bwepr.pro_name,
|
||||
bwepr.team_name,
|
||||
bwepr.sub_name
|
||||
FROM
|
||||
bm_worker_contract bwc
|
||||
left join bm_worker_ein_pro_record bwepr on bwc.worker_id = bwepr.worker_id and bwc.id = bwepr.contract_id
|
||||
<where>
|
||||
bwepr.pro_name is not null
|
||||
<if test="workerId != null">
|
||||
AND bwc.worker_id = #{workerId}
|
||||
</if>
|
||||
|
|
@ -154,4 +153,34 @@
|
|||
bwc.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateEinRecordContractId">
|
||||
update bm_worker_ein_pro_record set contract_id = #{contractId}
|
||||
where worker_id = #{workerId} and is_active = 1 and is_last = 1;
|
||||
update bm_worker_ein_msg set contract_id = #{contractId}
|
||||
where worker_id = #{workerId};
|
||||
</update>
|
||||
|
||||
<select id="selectContractListById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
bwc.id,
|
||||
bwc.contract_code,
|
||||
bwc.contract_start_date,
|
||||
bwc.is_active,
|
||||
bwc.contract_stop_date,
|
||||
bwc.contract_term_type,
|
||||
bwc.contract_upload_date,
|
||||
bwc.contract_invalid_date,
|
||||
bwc.wage_approved_way,
|
||||
bwc.wage_criterion
|
||||
FROM
|
||||
bm_worker_contract bwc
|
||||
<where>
|
||||
<if test="id != null">
|
||||
AND bwc.id = #{id}
|
||||
</if>
|
||||
</where>
|
||||
order by
|
||||
bwc.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue