Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
1d69b537d6
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.system.api;
|
||||
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.factory.RemoteUakUtilsFallbackFactory;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 考勤机指令下发
|
||||
* 主要是人员下发、修改、删除
|
||||
* 考勤机新增后 人员
|
||||
*
|
||||
* @author 黑子
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUakUtilsService", value = ServiceNameConstants.UAK_SERVICE, fallbackFactory = RemoteUakUtilsFallbackFactory.class)
|
||||
public interface RemoteUakUtilsService {
|
||||
/**
|
||||
* 新增-修改人员触发
|
||||
* @param userId
|
||||
* @param proId
|
||||
* @param update
|
||||
* @param source
|
||||
*/
|
||||
@PostMapping(value = "/business/sendUserToDevice")
|
||||
public void sendUserToDevice(@RequestParam(value = "userId") int userId, @RequestParam(value = "proId")int proId,
|
||||
@RequestParam(value = "update")String update, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 新增考勤机触发
|
||||
* @param deviceCode
|
||||
* @param userId
|
||||
* @param source
|
||||
*/
|
||||
@PostMapping(value = "/business/getUserSendToDev")
|
||||
public void getUserSendToDev(@RequestParam(value = "deviceCode") String deviceCode, @RequestParam(value = "userId")int userId,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 人员出场触发
|
||||
* @param userId
|
||||
* @param proId
|
||||
* @param source
|
||||
*/
|
||||
@PostMapping(value = "/business/delUserByDevice")
|
||||
public void delUserByDevice(@RequestParam(value = "userId") int userId, @RequestParam(value = "proId")int proId,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.bonus.common.core.constant.ServiceNameConstants;
|
|||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.factory.RemoteFileFallbackFactory;
|
||||
import com.bonus.system.api.factory.RemoteUploadUtilsFallbackFactory;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
|
|
@ -18,8 +19,9 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author 黑子
|
||||
* 文件上传工具类
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUploadUtilsService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||
@FeignClient(contextId = "remoteUploadUtilsService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteUploadUtilsFallbackFactory.class)
|
||||
public interface RemoteUploadUtilsService {
|
||||
|
||||
/**
|
||||
|
|
@ -132,4 +134,20 @@ public interface RemoteUploadUtilsService {
|
|||
public R<Integer> delFileListById(@RequestParam(value = "id") String id, @RequestParam(value = "sourceId")String sourceId,
|
||||
@RequestParam(value = "sourceTable")String sourceTable, @RequestParam(value = "sourceType")String sourceTyp
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* id /source 必传一个
|
||||
* @param id -选择性必填 依据fileid删除
|
||||
* @param sourceId --选择性必填 依据资源id删除
|
||||
* @param sourceTable --非必填 依据资源id和 表机构id删除
|
||||
* @param sourceTyp --非必填 依据资源id和 表机构id删除-及文件类型删除
|
||||
* @param source 内部接口 SecurityConstants.INNER
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/uploadFile/getFileBast64")
|
||||
public R<UploadFileVo> getFileBast64(@RequestParam(value = "id") String id, @RequestParam(value = "sourceId")String sourceId,
|
||||
@RequestParam(value = "sourceTable")String sourceTable, @RequestParam(value = "sourceType")String sourceTyp
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.system.api.factory;
|
||||
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.RemoteUakUtilsService;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 考勤机 服务降级处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Component
|
||||
public class RemoteUakUtilsFallbackFactory implements FallbackFactory<RemoteUakUtilsService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteUakUtilsFallbackFactory.class);
|
||||
@Override
|
||||
public RemoteUakUtilsService create(Throwable throwable) {
|
||||
log.error("考勤机服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUakUtilsService(){
|
||||
|
||||
@Override
|
||||
public void sendUserToDevice(int userId, int proId, String update, String source) {
|
||||
R.fail("人员入场:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUserSendToDev(String deviceCode, int userId, String source) {
|
||||
R.fail("新增考勤机:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delUserByDevice(int userId, int proId, String source) {
|
||||
R.fail("人员出场:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
* 文件上传工具类 服务降级处理
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
|
|
@ -63,6 +63,11 @@ public class RemoteUploadUtilsFallbackFactory implements FallbackFactory<RemoteU
|
|||
return R.fail("文件删除失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<UploadFileVo> getFileBast64(String id, String sourceId, String sourceTable, String sourceTyp, String source) {
|
||||
return R.fail("文件bast64获取失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,15 @@ public class UploadFileVo {
|
|||
private String url;
|
||||
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 获取bast64文件
|
||||
*/
|
||||
private String bast64;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,3 +10,5 @@ com.bonus.system.api.factory.RemotePostFallbackFactory
|
|||
com.bonus.system.api.factory.RemoteRoleFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteNoticeFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteProfileFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteUakUtilsFallbackFactory
|
||||
com.bonus.system.api.factory.RemoteUploadUtilsFallbackFactory
|
||||
|
|
|
|||
|
|
@ -164,4 +164,15 @@ public class Constants
|
|||
* 分包商信息表
|
||||
*/
|
||||
public static final String PM_SUB = "pm_sub";
|
||||
|
||||
|
||||
/**
|
||||
* 分包商合同信息
|
||||
*/
|
||||
public static final String BM_SUB_CONTRACT = "bm_sub_contract";
|
||||
|
||||
/**
|
||||
* 分包班组入场信息
|
||||
*/
|
||||
public static final String PM_SUB_TEAM_CONTRACT = "pm_sub_team_contract";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,4 +21,9 @@ public class ServiceNameConstants
|
|||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "bonus-file";
|
||||
|
||||
/**
|
||||
* 考勤机服务模块
|
||||
*/
|
||||
public static final String UAK_SERVICE = "bonus-uak";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
import com.bonus.bmw.service.BmSubContractService;
|
||||
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;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
|
|
@ -11,11 +16,12 @@ import com.bonus.common.security.annotation.InnerAuth;
|
|||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -47,4 +53,81 @@ public class BmSubContractController extends BaseController {
|
|||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增和修改分包商合同信息
|
||||
*/
|
||||
/* @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:edit"))*/
|
||||
@PostMapping("/addOrUpdateSubContract")
|
||||
@SysLog(title = "分包商合同信息", businessType = OperaType.UPDATE, logType = 0, module = "分包商合同信息->新增和修改分包商合同信息")
|
||||
public AjaxResult addOrUpdateSubContract(@RequestParam(value = "files",required = false) MultipartFile[] files, @RequestParam(value = "fileMsg",required = false) String fileMsg, @RequestParam(value = "params")String params) {
|
||||
try {
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
BmSubContract bmSubContract = FastJsonHelper.jsonStrToBean(params, BmSubContract.class);
|
||||
int res = bmSubContractService.addOrUpdateSubContract(bmSubContract,new FileBasicMsgDto(listFile, files));
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
} else if (res==2) {
|
||||
return error("分包下存在班组未出场");
|
||||
}else {
|
||||
return error("分包商合同信息已存在");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分包商合同信息
|
||||
*/
|
||||
/*@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:del"))*/
|
||||
@PostMapping("/delSubContract")
|
||||
@SysLog(title = "分包商合同信息", businessType = OperaType.UPDATE, logType = 0, module = "分包商合同信息->删除分包商合同信息")
|
||||
public AjaxResult delSubContract(@Validated @RequestBody BmSubContract bmSubContract) {
|
||||
try {
|
||||
int res = bmSubContractService.delSubContract(bmSubContract);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("公司下面存在未删除的分公司");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分包商合同信息详情
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:contract:list"))
|
||||
@GetMapping("/getSubContractById")
|
||||
@SysLog(title = "分包商合同信息详情", businessType = OperaType.QUERY, logType = 0, module = "分包商合同信息->项目部列表")
|
||||
public AjaxResult getSubContractById(BmSubContract bmSubContract) {
|
||||
try {
|
||||
BmSubContractVo bmSubContractVo = bmSubContractService.getSubContractById(bmSubContract);
|
||||
return success(bmSubContractVo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分包商合同信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@SysLog(title = "包商合同信息", businessType = OperaType.EXPORT, logType = 0, module = "包商合同信息->导出包商合同信息")
|
||||
public void export(HttpServletResponse response, BmSubContract bmSubContract) {
|
||||
try {
|
||||
List<BmSubContractVo> list = bmSubContractService.selectSubContractList(bmSubContract);
|
||||
ExcelUtil<BmSubContractVo> util = new ExcelUtil<BmSubContractVo>(BmSubContractVo.class);
|
||||
util.exportExcel(response, list, "包商出入场");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmAttDevice;
|
||||
import com.bonus.bmw.domain.vo.PmAttDeviceVo;
|
||||
import com.bonus.bmw.service.PmAttDeviceService;
|
||||
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;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/pmAttDevice")
|
||||
public class PmAttDeviceController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private PmAttDeviceService pmAttDeviceService;
|
||||
|
||||
/**
|
||||
* 考勤机列表
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("att:device:list"))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "考勤机", businessType = OperaType.QUERY, logType = 0, module = "考勤机->考勤机列表")
|
||||
public TableDataInfo list(PmAttDevice pmAttDevice) {
|
||||
try {
|
||||
startPage();
|
||||
List<PmAttDeviceVo> list = pmAttDeviceService.selectPmAttDeviceList(pmAttDevice);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增考勤机
|
||||
*/
|
||||
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:contract:list"))
|
||||
@GetMapping("/addPmAttDevice")
|
||||
@SysLog(title = "考勤机", businessType = OperaType.QUERY, logType = 0, module = "考勤机->新增考勤机")
|
||||
public AjaxResult addPmAttDevice(PmAttDevice pmAttDevice) {
|
||||
try {
|
||||
int res = pmAttDeviceService.addPmAttDevice(pmAttDevice);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("考勤机已存在");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增考勤机
|
||||
*/
|
||||
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:contract:list"))
|
||||
@GetMapping("/updatePmAttDevice")
|
||||
@SysLog(title = "考勤机", businessType = OperaType.QUERY, logType = 0, module = "考勤机->新增考勤机")
|
||||
public AjaxResult updatePmAttDevice(PmAttDevice pmAttDevice) {
|
||||
try {
|
||||
int res = pmAttDeviceService.updatePmAttDevice(pmAttDevice);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("考勤机操作失败");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除考勤机
|
||||
*/
|
||||
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:contract:list"))
|
||||
@GetMapping("/delPmAttDevice")
|
||||
@SysLog(title = "考勤机", businessType = OperaType.QUERY, logType = 0, module = "考勤机->删除考勤机")
|
||||
public AjaxResult delPmAttDevice(PmAttDevice pmAttDevice) {
|
||||
try {
|
||||
int res = pmAttDeviceService.delPmAttDevice(pmAttDevice);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("考勤机操作失败");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分包商合同信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@SysLog(title = "考勤机", businessType = OperaType.EXPORT, logType = 0, module = "考勤机->导出考勤机")
|
||||
public void export(HttpServletResponse response, PmAttDevice pmAttDevice) {
|
||||
try {
|
||||
List<PmAttDeviceVo> list = pmAttDeviceService.selectPmAttDeviceList(pmAttDevice);
|
||||
ExcelUtil<PmAttDeviceVo> util = new ExcelUtil<PmAttDeviceVo>(PmAttDeviceVo.class);
|
||||
util.exportExcel(response, list, "考勤机");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -57,9 +57,9 @@ public class PmSubController extends BaseController {
|
|||
* 新增和修改分包商
|
||||
*/
|
||||
/* @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:edit"))*/
|
||||
@PostMapping("/addOrUpdateSubCompany")
|
||||
@PostMapping("/addOrUpdateSub")
|
||||
@SysLog(title = "分包商管理", businessType = OperaType.UPDATE, logType = 0, module = "分包商管理->新增和修改分包商")
|
||||
public AjaxResult addOrUpdateSub(@RequestParam(value = "files") MultipartFile[] files, @RequestParam(value = "fileMsg") String fileMsg, @RequestParam(value = "params")String params) {
|
||||
public AjaxResult addOrUpdateSub(@RequestParam(value = "files",required = false) MultipartFile[] files, @RequestParam(value = "fileMsg",required = false) String fileMsg, @RequestParam(value = "params")String params) {
|
||||
try {
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
PmSub pmSub = FastJsonHelper.jsonStrToBean(params, PmSub.class);
|
||||
|
|
@ -81,13 +81,13 @@ public class PmSubController extends BaseController {
|
|||
/*@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:del"))*/
|
||||
@PostMapping("/delSub")
|
||||
@SysLog(title = "分包商管理", businessType = OperaType.UPDATE, logType = 0, module = "分包商管理->删除分包商")
|
||||
public AjaxResult delSubCompany(@Validated @RequestBody PmSub pmSub) {
|
||||
public AjaxResult delSub(@Validated @RequestBody PmSub pmSub) {
|
||||
try {
|
||||
int res = pmSubService.delSub(pmSub);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("公司下面存在未删除的分公司");
|
||||
return error("公司下面有未出场工程");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -96,6 +96,22 @@ public class PmSubController extends BaseController {
|
|||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分包商列表
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:sub:list"))
|
||||
@GetMapping("/listAll")
|
||||
@SysLog(title = "分包商管理", businessType = OperaType.QUERY, logType = 0, module = "分包商管理->分包商列表")
|
||||
public TableDataInfo listAll(PmSub pmSub) {
|
||||
try {
|
||||
List<PmSub> list = pmSubService.selectSubList(pmSub);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分包商
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
import com.bonus.bmw.service.PmSubTeamContractService;
|
||||
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;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/subTeamContract")
|
||||
public class PmSubTeamContractController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private PmSubTeamContractService pmSubTeamContractService;
|
||||
|
||||
/**
|
||||
* 分包班组信息入场信息列表
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:teamContract:list"))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "分包班组入场信息管理", businessType = OperaType.QUERY, logType = 0, module = "分包班组入场信息管理->分包班组入场信息列表")
|
||||
public TableDataInfo list(PmSubTeamContract pmSubTeamContract) {
|
||||
try {
|
||||
startPage();
|
||||
List<PmSubTeamContract> list = pmSubTeamContractService.selectSubTeamContractList(pmSubTeamContract);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增和出场班组
|
||||
*/
|
||||
/* @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:edit"))*/
|
||||
@PostMapping("/addOrUpdateSubTeamContract")
|
||||
@SysLog(title = "分包班组入场信息管理", businessType = OperaType.UPDATE, logType = 0, module = "分包班组入场信息管理->新增和修改分包班组信息")
|
||||
public AjaxResult addOrUpdateSubTeamContract(@RequestParam(value = "files",required = false) MultipartFile[] files, @RequestParam(value = "fileMsg",required = false) String fileMsg, @RequestParam(value = "params")String params) {
|
||||
try {
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
PmSubTeamContract pmSubTeamContract = FastJsonHelper.jsonStrToBean(params, PmSubTeamContract.class);
|
||||
int res = pmSubTeamContractService.addOrUpdateSubTeamContract(pmSubTeamContract,new FileBasicMsgDto(listFile, files));
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("分包商合同信息已存在");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分包班组信息入场详情
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:teamContract:list"))
|
||||
@GetMapping("/getSubTeamContractById")
|
||||
@SysLog(title = "分包班组入场信息管理", businessType = OperaType.QUERY, logType = 0, module = "分包班组入场信息管理->分包班组信息入场详情")
|
||||
public AjaxResult getSubTeamContractById(PmSubTeamContract pmSubTeamContract) {
|
||||
try {
|
||||
PmSubTeamContract pmSubTeamContractRes = pmSubTeamContractService.getSubTeamContractById(pmSubTeamContract);
|
||||
return success(pmSubTeamContractRes);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分包班组入场信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@SysLog(title = "分包班组入场信息", businessType = OperaType.EXPORT, logType = 0, module = "分包班组信息->导出分包班组入场信息")
|
||||
public void export(HttpServletResponse response, PmSubTeamContract pmSubTeamContract) {
|
||||
try {
|
||||
List<PmSubTeamContract> list = pmSubTeamContractService.selectSubTeamContractList(pmSubTeamContract);
|
||||
ExcelUtil<PmSubTeamContract> util = new ExcelUtil<PmSubTeamContract>(PmSubTeamContract.class);
|
||||
util.exportExcel(response, list, "分包班组入场信息");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmSubTeam;
|
||||
import com.bonus.bmw.service.PmSubTeamService;
|
||||
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;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/pmSubTeam")
|
||||
public class PmSubTeamController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private PmSubTeamService pmSubTeamService;
|
||||
|
||||
/**
|
||||
* 分包班组信息列表
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("sub:team:list"))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "分包班组信息管理", businessType = OperaType.QUERY, logType = 0, module = "分包班组信息管理->分包班组信息列表")
|
||||
public TableDataInfo list(PmSubTeam pmSubTeam) {
|
||||
try {
|
||||
startPage();
|
||||
List<PmSubTeam> list = pmSubTeamService.selectSubTeamList(pmSubTeam);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增和修改分包班组信息
|
||||
*/
|
||||
/* @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:edit"))*/
|
||||
@PostMapping("/addOrUpdateSubTeam")
|
||||
@SysLog(title = "分包班组信息", businessType = OperaType.UPDATE, logType = 0, module = "分包班组信息->新增和修改分包班组信息")
|
||||
public AjaxResult addOrUpdateSubTeam(@Validated @RequestBody PmSubTeam pmSubTeam) {
|
||||
try {
|
||||
int res = pmSubTeamService.addOrUpdateSubTeam(pmSubTeam);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error("分包班组名称重复");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分包班组信息
|
||||
*/
|
||||
/*@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pm:company:del"))*/
|
||||
@PostMapping("/delSubTeam")
|
||||
@SysLog(title = "分包班组信息", businessType = OperaType.UPDATE, logType = 0, module = "分包班组信息->删除分包班组信息")
|
||||
public AjaxResult delSubTeam(@Validated @RequestBody PmSubTeam pmSubTeam) {
|
||||
try {
|
||||
int res = pmSubTeamService.delSubTeam(pmSubTeam);
|
||||
if (res>0){
|
||||
return toAjax(res);
|
||||
}else {
|
||||
return error();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分包班组信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@SysLog(title = "分包班组信息", businessType = OperaType.EXPORT, logType = 0, module = "分包班组信息->导出分包班组信息")
|
||||
public void export(HttpServletResponse response, PmSubTeam pmSubTeam) {
|
||||
try {
|
||||
List<PmSubTeam> list = pmSubTeamService.selectSubTeamList(pmSubTeam);
|
||||
ExcelUtil<PmSubTeam> util = new ExcelUtil<PmSubTeam>(PmSubTeam.class);
|
||||
util.exportExcel(response, list, "分包班组信息");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package com.bonus.bmw.domain.po;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -20,31 +22,47 @@ public class BmSubContract {
|
|||
/**
|
||||
* 分包合同编码
|
||||
*/
|
||||
@Excel(name = "分包合同编码",sort = 1)
|
||||
private String subContractCode;
|
||||
|
||||
/**
|
||||
* 分包合同名称
|
||||
*/
|
||||
@Excel(name = "分包合同名称",sort = 2)
|
||||
private String subContractName;
|
||||
|
||||
/**
|
||||
* 分包id
|
||||
*/
|
||||
private String subId;
|
||||
private Integer subId;
|
||||
|
||||
/**
|
||||
* 分包商名称
|
||||
*/
|
||||
@Excel(name = "分包商名称",sort = 3)
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private String proId;
|
||||
private Integer proId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称",sort = 4)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 分包入场日期
|
||||
*/
|
||||
@Excel(name = "分包入场时间",sort = 6)
|
||||
private String subEinTime;
|
||||
|
||||
/**
|
||||
* 分包出场时间
|
||||
*/
|
||||
@Excel(name = "分包入场时间",sort = 7)
|
||||
private String subExitTime;
|
||||
|
||||
/**
|
||||
|
|
@ -77,6 +95,12 @@ public class BmSubContract {
|
|||
/**
|
||||
*1 已入场 2 已离场
|
||||
*/
|
||||
@Excel(name = "出入场状态",sort = 5,readConverterExp = "1=在场,2=出场")
|
||||
private String subEinStatus;
|
||||
|
||||
/**
|
||||
* 删除文件id集合
|
||||
*/
|
||||
List<String> fileIdList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.bmw.domain.po;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Data
|
||||
public class PmAttDevice {
|
||||
|
||||
/**
|
||||
* 设备编码(唯一、必填-从硬件上获取查看)
|
||||
*/
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 设备名
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Integer proId;
|
||||
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
*修改人
|
||||
*/
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String devModel;
|
||||
|
||||
/**
|
||||
* 在线状态
|
||||
*/
|
||||
private String onLine;
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package com.bonus.bmw.domain.po;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -103,4 +105,14 @@ public class PmSub {
|
|||
*关键字搜索
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*/
|
||||
List<UploadFileVo> contractFile;
|
||||
|
||||
/**
|
||||
* 删除文件id集合
|
||||
*/
|
||||
List<String> fileIdList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bonus.bmw.domain.po;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Data
|
||||
public class PmSubTeam {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@Excel(name = "班组名称",sort = 2)
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 分包id
|
||||
*/
|
||||
private Integer subId;
|
||||
|
||||
/**
|
||||
* 分包商名称
|
||||
*/
|
||||
@Excel(name = "分包商名称",sort = 1)
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 班组长
|
||||
*/
|
||||
@Excel(name = "班组长",sort = 3)
|
||||
private String teamLeader;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
@Excel(name = "联系方式",sort = 4)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 0未入场 1 已入场 2 已离场
|
||||
*/
|
||||
private String teamEinStatus;
|
||||
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
*修改人
|
||||
*/
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private Integer isActive;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.bonus.bmw.domain.po;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Data
|
||||
public class PmSubTeamContract {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Integer teamId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@Excel(name = "班组名称",sort = 2)
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Integer subId;
|
||||
|
||||
/**
|
||||
* 分包商名称
|
||||
*/
|
||||
@Excel(name = "分包商名称",sort = 1)
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Integer proId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "班组入场工程名称",sort = 3)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 班组入场时间
|
||||
*/
|
||||
@Excel(name = "班组入场时间",sort = 5)
|
||||
private String teamEinTime;
|
||||
|
||||
/**
|
||||
* 1 已入场 2 已离场
|
||||
*/
|
||||
@Excel(name = "出入场状态",sort = 4,readConverterExp = "1=在场,2=出场")
|
||||
private Integer teamEinStatus;
|
||||
|
||||
/**
|
||||
* 班组出场时间
|
||||
*/
|
||||
@Excel(name = "班组出场时间",sort = 6)
|
||||
private String teamExitTime;
|
||||
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
*修改人
|
||||
*/
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private Integer isActive;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*/
|
||||
List<UploadFileVo> contractFile;
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -89,4 +91,9 @@ public class BmSubContractVo {
|
|||
*/
|
||||
private String subEinStatus;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*/
|
||||
List<UploadFileVo> contractFile;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Data
|
||||
public class PmAttDeviceVo {
|
||||
|
||||
/**
|
||||
* 设备编码(唯一、必填-从硬件上获取查看)
|
||||
*/
|
||||
@Excel(name = "考勤机编号",sort = 1)
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 设备名
|
||||
*/
|
||||
@Excel(name = "考勤机名称",sort = 2)
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Integer proId;
|
||||
|
||||
/**
|
||||
*工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称",sort = 3)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 是否上海项目 1 是 0 不是
|
||||
*/
|
||||
@Excel(name = "是否上海项目",sort = 4)
|
||||
private Integer isShanghai;
|
||||
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
*修改人
|
||||
*/
|
||||
@Excel(name = "绑定人",sort = 5)
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Excel(name = "绑定时间",sort = 6,dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String devModel;
|
||||
|
||||
/**
|
||||
* 在线状态
|
||||
*/
|
||||
private String onLine;
|
||||
}
|
||||
|
|
@ -1,10 +1,42 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BmSubContractMapper {
|
||||
/**
|
||||
* 分包商合同信息列表
|
||||
*/
|
||||
List<BmSubContractVo> selectSubContractList(BmSubContract bmSubContract);
|
||||
/**
|
||||
* 分包商合同信息修改
|
||||
*/
|
||||
int updateSubContract(BmSubContract bmSubContract);
|
||||
/**
|
||||
* 分包商合同信息新增
|
||||
*/
|
||||
int addSubContract(BmSubContract bmSubContract);
|
||||
|
||||
BmSubContract getSubContractBySubContractName(BmSubContract bmSubContract);
|
||||
/**
|
||||
* 根据合同名称获取合同信息
|
||||
*/
|
||||
int delSubContract(BmSubContract bmSubContract);
|
||||
|
||||
/**
|
||||
* 根据id获取合同信息
|
||||
* @param bmSubContract
|
||||
* @return
|
||||
*/
|
||||
BmSubContractVo getSubContractById(BmSubContract bmSubContract);
|
||||
|
||||
/**
|
||||
* 后驱班组出入场信息
|
||||
* @param bmSubContract
|
||||
* @return
|
||||
*/
|
||||
List<PmSubTeamContract> getSubTeamContract(BmSubContract bmSubContract);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmAttDevice;
|
||||
import com.bonus.bmw.domain.vo.PmAttDeviceVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmAttDeviceMapper {
|
||||
List<PmAttDeviceVo> selectPmAttDeviceList(PmAttDevice pmAttDevice);
|
||||
|
||||
|
||||
PmAttDevice getPmAttDeviceByCoode(PmAttDevice pmAttDevice);
|
||||
|
||||
int addPmAttDevice(PmAttDevice pmAttDevice);
|
||||
|
||||
int updatePmAttDevice(PmAttDevice pmAttDevice);
|
||||
|
||||
int delPmAttDevice(PmAttDevice pmAttDevice);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmSubTeamContractMapper {
|
||||
List<PmSubTeamContract> selectSubTeamContractList(PmSubTeamContract pmSubTeamContract);
|
||||
|
||||
int updateSubTeamContract(PmSubTeamContract pmSubTeamContract);
|
||||
|
||||
PmSubTeamContract getSubTeamContractById(PmSubTeamContract pmSubTeamContract);
|
||||
|
||||
int addSubTeamContract(PmSubTeamContract pmSubTeamContract);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmSubTeam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmSubTeamMapper {
|
||||
|
||||
/**
|
||||
* 分包班组信息列表
|
||||
*/
|
||||
List<PmSubTeam> selectSubTeamList(PmSubTeam pmSubTeam);
|
||||
|
||||
/**
|
||||
* 修改分包班组信息
|
||||
*/
|
||||
int updateSubTeam(PmSubTeam pmSubTeam);
|
||||
|
||||
/**
|
||||
* 新增分包班组信息
|
||||
*/
|
||||
int addSubTeam(PmSubTeam pmSubTeam);
|
||||
|
||||
/**
|
||||
* 删除分包班组信息
|
||||
*/
|
||||
int delSubTeam(PmSubTeam pmSubTeam);
|
||||
}
|
||||
|
|
@ -1,10 +1,30 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BmSubContractService {
|
||||
|
||||
/**
|
||||
* 分包商合同信息列表
|
||||
*/
|
||||
List<BmSubContractVo> selectSubContractList(BmSubContract bmSubContract);
|
||||
|
||||
/**
|
||||
* 新增和修改分包商合同信息
|
||||
*/
|
||||
int addOrUpdateSubContract(BmSubContract bmSubContract, FileBasicMsgDto fileBasicMsgDto);
|
||||
|
||||
/**
|
||||
* 删除分包商合同信息
|
||||
*/
|
||||
int delSubContract(BmSubContract bmSubContract);
|
||||
|
||||
/**
|
||||
* 分包商合同信息详情
|
||||
*/
|
||||
BmSubContractVo getSubContractById(BmSubContract bmSubContract);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmAttDevice;
|
||||
import com.bonus.bmw.domain.vo.PmAttDeviceVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmAttDeviceService {
|
||||
List<PmAttDeviceVo> selectPmAttDeviceList(PmAttDevice pmAttDevice);
|
||||
|
||||
int addPmAttDevice(PmAttDevice pmAttDevice);
|
||||
|
||||
int updatePmAttDevice(PmAttDevice pmAttDevice);
|
||||
|
||||
int delPmAttDevice(PmAttDevice pmAttDevice);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmSubTeamContractService {
|
||||
List<PmSubTeamContract> selectSubTeamContractList(PmSubTeamContract pmSubTeamContract);
|
||||
|
||||
int addOrUpdateSubTeamContract(PmSubTeamContract pmSubTeamContract, FileBasicMsgDto fileBasicMsgDto);
|
||||
|
||||
PmSubTeamContract getSubTeamContractById(PmSubTeamContract pmSubTeamContract);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmSubTeam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmSubTeamService {
|
||||
/**
|
||||
* 分包班组信息列表
|
||||
*/
|
||||
List<PmSubTeam> selectSubTeamList(PmSubTeam pmSubTeam);
|
||||
|
||||
/**
|
||||
* 新增和修改分包班组信息
|
||||
*/
|
||||
int addOrUpdateSubTeam(PmSubTeam pmSubTeam);
|
||||
|
||||
/**
|
||||
* 删除分包班组信息
|
||||
*/
|
||||
int delSubTeam(PmSubTeam pmSubTeam);
|
||||
}
|
||||
|
|
@ -1,13 +1,23 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
import com.bonus.bmw.mapper.BmSubContractMapper;
|
||||
import com.bonus.bmw.service.BmSubContractService;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -21,9 +31,105 @@ public class BmSubContractServiceImpl implements BmSubContractService {
|
|||
@Resource
|
||||
private BmSubContractMapper bmSubContractMapper;
|
||||
|
||||
@Resource
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分包商合同信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<BmSubContractVo> selectSubContractList(BmSubContract bmSubContract) {
|
||||
return bmSubContractMapper.selectSubContractList(bmSubContract);
|
||||
List<BmSubContractVo> bmSubContractVoList = bmSubContractMapper.selectSubContractList(bmSubContract);
|
||||
if (bmSubContractVoList.size()>0){
|
||||
for (BmSubContractVo bmSubContractVo:bmSubContractVoList) {
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", bmSubContractVo.getId().toString(), Constants.BM_SUB_CONTRACT, "");
|
||||
bmSubContractVo.setContractFile(contractFile);
|
||||
}
|
||||
}
|
||||
return bmSubContractVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增和修改分包商合同信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int addOrUpdateSubContract(BmSubContract bmSubContract, FileBasicMsgDto fileBasicMsgDto) {
|
||||
//BmSubContract bmSubContractOld = bmSubContractMapper.getSubContractBySubContractName(bmSubContract);
|
||||
int res =0;
|
||||
//存在则删除后新增,不存在则新增
|
||||
if(StringUtils.isNotNull(bmSubContract.getId())){
|
||||
/*if (StringUtils.isNotNull(bmSubContractOld) && !bmSubContractOld.getId().equals(bmSubContract.getId())){
|
||||
return res;
|
||||
}*/
|
||||
bmSubContract.setUpdateUser(SecurityUtils.getUsername());
|
||||
bmSubContract.setUpdateTime(new Date());
|
||||
//出场时获取当前时间
|
||||
if ("2".equals(bmSubContract.getSubEinStatus())){
|
||||
bmSubContract.setSubExitTime(DateUtils.getDate());
|
||||
//判断下面的班组是否全部出场
|
||||
List<PmSubTeamContract> pmSubTeamContractList = bmSubContractMapper.getSubTeamContract(bmSubContract);
|
||||
if (pmSubTeamContractList.size()>0){
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
res = bmSubContractMapper.updateSubContract(bmSubContract);
|
||||
if (!bmSubContract.getFileIdList().isEmpty()){
|
||||
for (String fileId:bmSubContract.getFileIdList()
|
||||
) {
|
||||
//删除合同图片 删除minio文件
|
||||
fileUploadUtils.delFileListById(fileId, bmSubContract.getId().toString(), Constants.BM_SUB_CONTRACT,"");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
/*if (StringUtils.isNotNull(bmSubContractOld)){
|
||||
return res;
|
||||
}*/
|
||||
bmSubContract.setSubEinTime(DateUtils.getDate());
|
||||
bmSubContract.setCreateUser(SecurityUtils.getUsername());
|
||||
bmSubContract.setCreateTime(new Date());
|
||||
bmSubContract.setUpdateUser(SecurityUtils.getUsername());
|
||||
bmSubContract.setUpdateTime(new Date());
|
||||
res = bmSubContractMapper.addSubContract(bmSubContract);
|
||||
}
|
||||
//添加到文件库和minio上
|
||||
if(res > 0 && StringUtils.isNotNull(fileBasicMsgDto.getFiles())){
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = fileBasicMsgDto.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(fileBasicMsgDto.getFiles(), Constants.BM_SUB_CONTRACT, bmSubContract.getId().toString(), type,"", "");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分包商合同信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int delSubContract(BmSubContract bmSubContract) {
|
||||
//删除数据和合同图片
|
||||
int i = bmSubContractMapper.delSubContract(bmSubContract);
|
||||
//删除合同图片 删除minio文件
|
||||
fileUploadUtils.delFileListById("", bmSubContract.getId().toString(), Constants.BM_SUB_CONTRACT,"");
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分包商合同信息详情
|
||||
*/
|
||||
@Override
|
||||
public BmSubContractVo getSubContractById(BmSubContract bmSubContract) {
|
||||
BmSubContractVo bmSubContractVo =bmSubContractMapper.getSubContractById(bmSubContract);
|
||||
if (StringUtils.isNotNull(bmSubContractVo)){
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", bmSubContractVo.getId().toString(), Constants.PM_SUB_TEAM_CONTRACT, "");
|
||||
bmSubContractVo.setContractFile(contractFile);
|
||||
}
|
||||
return bmSubContractVo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,5 +159,13 @@ public class FileUploadUtils {
|
|||
return String.valueOf(R.FAIL);
|
||||
}
|
||||
|
||||
public UploadFileVo getFileBast64( String id,String sourceId,String sourceTable,String sourceTyp){
|
||||
R<UploadFileVo> res=service.getFileBast64(id,sourceId,sourceTable,sourceTyp, SecurityConstants.INNER);
|
||||
if(res.getCode()==R.SUCCESS){
|
||||
UploadFileVo vo=res.getData();
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmAttDevice;
|
||||
import com.bonus.bmw.domain.vo.PmAttDeviceVo;
|
||||
import com.bonus.bmw.mapper.PmAttDeviceMapper;
|
||||
import com.bonus.bmw.service.PmAttDeviceService;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PmAttDeviceServiceImpl implements PmAttDeviceService {
|
||||
|
||||
@Resource
|
||||
private PmAttDeviceMapper pmAttDeviceMapper;
|
||||
|
||||
@Override
|
||||
public List<PmAttDeviceVo> selectPmAttDeviceList(PmAttDevice pmAttDevice) {
|
||||
return pmAttDeviceMapper.selectPmAttDeviceList(pmAttDevice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addPmAttDevice(PmAttDevice pmAttDevice) {
|
||||
//查看是否存在
|
||||
PmAttDevice pmAttDeviceOld = pmAttDeviceMapper.getPmAttDeviceByCoode(pmAttDevice);
|
||||
if (StringUtils.isNotNull(pmAttDeviceOld)){
|
||||
return 0;
|
||||
}
|
||||
pmAttDevice.setCreateUser(SecurityUtils.getUsername());
|
||||
pmAttDevice.setCreateTime(new Date());
|
||||
pmAttDevice.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmAttDevice.setUpdateTime(new Date());
|
||||
return pmAttDeviceMapper.addPmAttDevice(pmAttDevice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePmAttDevice(PmAttDevice pmAttDevice) {
|
||||
pmAttDevice.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmAttDevice.setUpdateTime(new Date());
|
||||
return pmAttDeviceMapper.updatePmAttDevice(pmAttDevice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delPmAttDevice(PmAttDevice pmAttDevice) {
|
||||
return pmAttDeviceMapper.delPmAttDevice(pmAttDevice);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,10 @@ package com.bonus.bmw.service.impl;
|
|||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.BmSubContract;
|
||||
import com.bonus.bmw.domain.po.PmSub;
|
||||
import com.bonus.bmw.domain.vo.BmSubContractVo;
|
||||
import com.bonus.bmw.mapper.BmSubContractMapper;
|
||||
import com.bonus.bmw.mapper.PmSubMapper;
|
||||
import com.bonus.bmw.service.PmSubService;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
|
|
@ -11,6 +14,7 @@ import com.bonus.common.security.utils.SecurityUtils;
|
|||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
|
@ -30,12 +34,23 @@ public class PmSubServiceImpl implements PmSubService {
|
|||
@Resource
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
@Resource
|
||||
private BmSubContractMapper bmSubContractMapper;
|
||||
|
||||
@Override
|
||||
public List<PmSub> selectSubList(PmSub pmSub) {
|
||||
return pmSubMapper.selectSubList(pmSub);
|
||||
List<PmSub> pmSubList = pmSubMapper.selectSubList(pmSub);
|
||||
if (pmSubList.size()>0){
|
||||
for (PmSub pmSubRes:pmSubList) {
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", pmSubRes.getId().toString(), Constants.PM_SUB, "");
|
||||
pmSubRes.setContractFile(contractFile);
|
||||
}
|
||||
}
|
||||
return pmSubList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int addOrUpdateSub(PmSub pmSub, FileBasicMsgDto fileBasicMsgDto) {
|
||||
PmSub pmSubOld = pmSubMapper.getSubBySubName(pmSub);
|
||||
int res =0;
|
||||
|
|
@ -47,6 +62,13 @@ public class PmSubServiceImpl implements PmSubService {
|
|||
pmSub.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmSub.setUpdateTime(new Date());
|
||||
res = pmSubMapper.updateSub(pmSub);
|
||||
//判断是否修改图片信息
|
||||
if (!pmSub.getFileIdList().isEmpty()){
|
||||
for (String fileId:pmSub.getFileIdList()) {
|
||||
//删除合同图片 删除minio文件
|
||||
fileUploadUtils.delFileListById(fileId, pmSub.getId().toString(), Constants.PM_SUB,"");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (StringUtils.isNotNull(pmSubOld)){
|
||||
return res;
|
||||
|
|
@ -58,7 +80,7 @@ public class PmSubServiceImpl implements PmSubService {
|
|||
res = pmSubMapper.addSub(pmSub);
|
||||
}
|
||||
//添加到文件库和minio上
|
||||
if(res > 0){
|
||||
if(res > 0 && ! StringUtils.isNotNull(fileBasicMsgDto.getFiles())){
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = fileBasicMsgDto.getFileMsg();
|
||||
String[] type = new String[fileMsg.size()];
|
||||
|
|
@ -71,14 +93,20 @@ public class PmSubServiceImpl implements PmSubService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int delSub(PmSub pmSub) {
|
||||
//查看当前分公司公司下面是否有项目部
|
||||
/* PmOrg pmOrg = new PmOrg();
|
||||
pmOrg.setSubComId(pmSubCompany.getId());
|
||||
List<PmOrgVo> pmOrgList = pmOrgMapper.selectPmOrgList(pmOrg);
|
||||
if (pmOrgList.size()>0){
|
||||
//查看当前分包下是否出入场
|
||||
BmSubContract bmSubContract = new BmSubContract();
|
||||
bmSubContract.setSubId(pmSub.getId());
|
||||
bmSubContract.setSubEinStatus("1");
|
||||
List<BmSubContractVo> BmSubContractVos = bmSubContractMapper.selectSubContractList(bmSubContract);
|
||||
if (BmSubContractVos.size()>0){
|
||||
return 0;
|
||||
}*/
|
||||
return pmSubMapper.delSub(pmSub);
|
||||
}
|
||||
int res = pmSubMapper.delSub(pmSub);
|
||||
//删除合同图片 删除minio文件
|
||||
fileUploadUtils.delFileListById("", pmSub.getId().toString(), Constants.PM_SUB,"");
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.dto.FileBasicMsgDto;
|
||||
import com.bonus.bmw.domain.dto.WebFileDto;
|
||||
import com.bonus.bmw.domain.po.PmSubTeamContract;
|
||||
import com.bonus.bmw.mapper.PmSubTeamContractMapper;
|
||||
import com.bonus.bmw.service.PmSubTeamContractService;
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author 马三炮
|
||||
*@date 2025/8/15
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PmSubTeamContractServiceImpl implements PmSubTeamContractService {
|
||||
|
||||
@Resource
|
||||
private PmSubTeamContractMapper pmSubTeamContractMapper;
|
||||
@Resource
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
|
||||
@Override
|
||||
public List<PmSubTeamContract> selectSubTeamContractList(PmSubTeamContract pmSubTeamContract) {
|
||||
List<PmSubTeamContract> PmSubTeamContractList = pmSubTeamContractMapper.selectSubTeamContractList(pmSubTeamContract);
|
||||
if (PmSubTeamContractList.size()>0){
|
||||
for (PmSubTeamContract subTeamContract:PmSubTeamContractList) {
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", subTeamContract.getId().toString(), Constants.BM_SUB_CONTRACT, "");
|
||||
subTeamContract.setContractFile(contractFile);
|
||||
}
|
||||
}
|
||||
return PmSubTeamContractList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int addOrUpdateSubTeamContract(PmSubTeamContract pmSubTeamContract, FileBasicMsgDto fileBasicMsgDto) {
|
||||
int res =0;
|
||||
if (StringUtils.isNotNull(pmSubTeamContract.getId())){
|
||||
pmSubTeamContract.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmSubTeamContract.setUpdateTime(new Date());
|
||||
pmSubTeamContract.setTeamExitTime(DateUtils.getDate());
|
||||
res = pmSubTeamContractMapper.updateSubTeamContract(pmSubTeamContract);
|
||||
//添加到文件库和minio上
|
||||
if(res > 0 && StringUtils.isNotNull(fileBasicMsgDto.getFiles())){
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = fileBasicMsgDto.getFileMsg();
|
||||
String[] type = new String[fileMsg.size()];
|
||||
for (int i = 0; i < fileMsg.size(); i++) {
|
||||
type[i] = fileMsg.get(i).getType();
|
||||
}
|
||||
fileUploadUtils.uploadFile(fileBasicMsgDto.getFiles(), Constants.PM_SUB_TEAM_CONTRACT, pmSubTeamContract.getId().toString(), type,"", "");
|
||||
}
|
||||
}else {
|
||||
pmSubTeamContract.setCreateUser(SecurityUtils.getUsername());
|
||||
pmSubTeamContract.setCreateTime(new Date());
|
||||
pmSubTeamContract.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmSubTeamContract.setUpdateTime(new Date());
|
||||
pmSubTeamContract.setTeamEinTime(DateUtils.getDate());
|
||||
res = pmSubTeamContractMapper.addSubTeamContract(pmSubTeamContract);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PmSubTeamContract getSubTeamContractById(PmSubTeamContract pmSubTeamContract) {
|
||||
PmSubTeamContract subTeamContract = pmSubTeamContractMapper.getSubTeamContractById(pmSubTeamContract);
|
||||
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", subTeamContract.getId().toString(), Constants.BM_SUB_CONTRACT, "");
|
||||
subTeamContract.setContractFile(contractFile);
|
||||
return subTeamContract;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import com.bonus.bmw.domain.po.PmSubTeam;
|
||||
import com.bonus.bmw.mapper.PmSubTeamMapper;
|
||||
import com.bonus.bmw.service.PmSubTeamService;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/8/15
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PmSubTeamServiceImpl implements PmSubTeamService {
|
||||
|
||||
@Resource
|
||||
private PmSubTeamMapper pmSubTeamMapper;
|
||||
|
||||
/**
|
||||
* 分包班组信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<PmSubTeam> selectSubTeamList(PmSubTeam pmSubTeam) {
|
||||
return pmSubTeamMapper.selectSubTeamList(pmSubTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增和修改分包班组信息
|
||||
*/
|
||||
@Override
|
||||
public int addOrUpdateSubTeam(PmSubTeam pmSubTeam) {
|
||||
|
||||
//存在则删除后新增,不存在则新增
|
||||
if(StringUtils.isNotNull(pmSubTeam.getId())){
|
||||
pmSubTeam.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmSubTeam.setUpdateTime(new Date());
|
||||
return pmSubTeamMapper.updateSubTeam(pmSubTeam);
|
||||
}else {
|
||||
pmSubTeam.setCreateUser(SecurityUtils.getUsername());
|
||||
pmSubTeam.setCreateTime(new Date());
|
||||
pmSubTeam.setUpdateUser(SecurityUtils.getUsername());
|
||||
pmSubTeam.setUpdateTime(new Date());
|
||||
return pmSubTeamMapper.addSubTeam(pmSubTeam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分包班组信息
|
||||
*/
|
||||
@Override
|
||||
public int delSubTeam(PmSubTeam pmSubTeam) {
|
||||
return pmSubTeamMapper.delSubTeam(pmSubTeam);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,33 @@
|
|||
<?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.bonus.bmw.mapper.BmSubContractMapper">
|
||||
<insert id="addSubContract" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into bm_sub_contract (sub_contract_code, sub_contract_name, sub_id,pro_id,sub_ein_time,sub_exit_time,
|
||||
create_user, update_user, create_time, update_time,sub_ein_status)
|
||||
values (#{subContractCode}, #{subContractName},#{subId},#{proId},#{subEinTime},#{subExitTime},
|
||||
#{createUser}, #{updateUser}, #{createTime}, #{updateTime},#{subEinStatus})
|
||||
</insert>
|
||||
<update id="updateSubContract">
|
||||
update bm_sub_contract
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="subEinStatus!= null " >
|
||||
sub_ein_status=#{subEinStatus},
|
||||
</if>
|
||||
<if test="subExitTime!= null " >
|
||||
sub_exit_time=#{subExitTime},
|
||||
</if>
|
||||
<if test="subContractCode!= null " >
|
||||
sub_contract_code=#{subContractCode},
|
||||
</if>
|
||||
<if test="subContractName!= null " >
|
||||
sub_contract_name=#{subContractName},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="delSubContract">
|
||||
update bm_sub_contract set is_active = '0' where id =#{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectSubContractList" resultType="com.bonus.bmw.domain.vo.BmSubContractVo">
|
||||
select bsc.id as id,
|
||||
|
|
@ -17,5 +44,64 @@
|
|||
left join pm_sub ps on bsc.sub_id = ps.id
|
||||
left join pm_project pp on bsc.pro_id = pp.id
|
||||
where bsc.is_active = '1'
|
||||
<if test="subContractCode!=null and subContractCode!=''">
|
||||
and bsc.sub_contract_code LIKE CONCAT('%', #{subContractCode}, '%')
|
||||
</if>
|
||||
<if test="subContractName!=null and subContractName!=''">
|
||||
and bsc.sub_contract_name LIKE CONCAT('%', #{subContractName}, '%')
|
||||
</if>
|
||||
<if test="subName!=null and subName!=''">
|
||||
and ps.sub_name LIKE CONCAT('%', #{subName}, '%')
|
||||
</if>
|
||||
<if test="proName!=null and proName!=''">
|
||||
and pp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="subEinStatus!=null and subEinStatus!=''">
|
||||
and bsc.sub_ein_status =#{subEinStatus}
|
||||
</if>
|
||||
<if test="subId!=null and subId!=''">
|
||||
and bsc.sub_id =#{subId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getSubContractBySubContractName" resultType="com.bonus.bmw.domain.po.BmSubContract">
|
||||
select bsc.id as id,
|
||||
bsc.sub_contract_code as subContractCode,
|
||||
bsc.sub_contract_name as subContractName,
|
||||
bsc.sub_id as subId,
|
||||
ps.sub_name as subName,
|
||||
bsc.pro_id as proId,
|
||||
pp.pro_name as proName,
|
||||
bsc.sub_ein_time as subEinTime,
|
||||
bsc.sub_exit_time as subExitTime,
|
||||
bsc.sub_ein_status as subEinStatus
|
||||
from bm_sub_contract bsc
|
||||
left join pm_sub ps on bsc.sub_id = ps.id
|
||||
left join pm_project pp on bsc.pro_id = pp.id
|
||||
where bsc.is_active = '1' and
|
||||
(bsc.sub_contract_code = #{subContractCode} or bsc.sub_contract_name = #{subContractName})
|
||||
</select>
|
||||
<select id="getSubContractById" resultType="com.bonus.bmw.domain.vo.BmSubContractVo">
|
||||
select bsc.id as id,
|
||||
bsc.sub_contract_code as subContractCode,
|
||||
bsc.sub_contract_name as subContractName,
|
||||
bsc.sub_id as subId,
|
||||
ps.sub_name as subName,
|
||||
bsc.pro_id as proId,
|
||||
pp.pro_name as proName,
|
||||
bsc.sub_ein_time as subEinTime,
|
||||
bsc.sub_exit_time as subExitTime,
|
||||
bsc.sub_ein_status as subEinStatus
|
||||
from bm_sub_contract bsc
|
||||
left join pm_sub ps on bsc.sub_id = ps.id
|
||||
left join pm_project pp on bsc.pro_id = pp.id
|
||||
where bsc.is_active = '1' and bsc.id = #{id}
|
||||
</select>
|
||||
<select id="getSubTeamContract" resultType="com.bonus.bmw.domain.po.PmSubTeamContract">
|
||||
select pstc.team_id as teamId,
|
||||
pstc.team_name as teamName,
|
||||
pstc.sub_id as subId
|
||||
from pm_sub_team_contract pstc
|
||||
left join bm_sub_contract bsc on bsc.sub_id = pstc.sub_id and bsc.pro_id = pstc.pro_id
|
||||
where bsc.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<?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.bonus.bmw.mapper.PmAttDeviceMapper">
|
||||
<insert id="addPmAttDevice">
|
||||
insert into pm_att_device (device_code, device_name, pro_id,create_user, update_user,
|
||||
create_time, update_time,dev_model,on_line)
|
||||
values (#{deviceCode}, #{deviceName},#{proId}, #{createUser}, #{updateUser},
|
||||
#{createTime}, #{updateTime},#{devModel},#{onLine})
|
||||
</insert>
|
||||
<update id="updatePmAttDevice">
|
||||
update pm_att_device set pro_id = #{proId},update_time = #{updateTime},update_user = #{updateUser}
|
||||
where is_active = '0' and device_code = #{deviceCode}
|
||||
</update>
|
||||
<delete id="delPmAttDevice">
|
||||
update pm_att_device set is_active = '0' where device_code = #{deviceCode}
|
||||
</delete>
|
||||
|
||||
<select id="selectPmAttDeviceList" resultType="com.bonus.bmw.domain.vo.PmAttDeviceVo">
|
||||
select pad2.device_code as deviceCode,
|
||||
pad2.device_name as deviceName,
|
||||
pad2.pro_id as proId,
|
||||
pp.pro_name as proName,
|
||||
pp.is_shanghai as isShanghai,
|
||||
pad2.update_user as updateUser,
|
||||
pad2.update_time as updateTime
|
||||
from pm_att_device pad2
|
||||
left join pm_project pp on pp.id = pad2.pro_id
|
||||
where pad2.is_active = '1'
|
||||
<if test="deviceCode!=null and deviceCode!=''">
|
||||
and pad2.device_code LIKE CONCAT('%', #{deviceCode}, '%')
|
||||
</if>
|
||||
<if test="deviceName!=null and deviceName!=''">
|
||||
and pad2.device_name LIKE CONCAT('%', #{deviceName}, '%')
|
||||
</if>
|
||||
<if test="proName!=null and proName!=''">
|
||||
and pp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="isShanghai!=null and isShanghai!=''">
|
||||
and pp.is_shanghai LIKE CONCAT('%', #{isShanghai}, '%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="getPmAttDeviceByCoode" resultType="com.bonus.bmw.domain.po.PmAttDevice">
|
||||
select pad2.device_code as deviceCode,
|
||||
pad2.device_name as deviceName,
|
||||
pad2.pro_id as proId,,
|
||||
pad2.update_user as updateUser,
|
||||
pad2.update_time as updateTime
|
||||
from pm_att_device pad2
|
||||
where pad2.is_active = '1' and pad2.device_code = #{deviceCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -55,15 +55,24 @@
|
|||
</delete>
|
||||
|
||||
<select id="selectSubList" resultType="com.bonus.bmw.domain.po.PmSub">
|
||||
select id,sub_name,legal_person,legal_person_phone,sub_address,business_license,electronic_seal,
|
||||
id_card_front,id_card_reverse,corporate_seal,sub_ein_status
|
||||
select id as id,
|
||||
sub_name as subName,
|
||||
legal_person as legalPerson,
|
||||
legal_person_phone as legalPersonPhone,
|
||||
sub_address as subAddress,
|
||||
business_license as businessLicense,
|
||||
electronic_seal as electronicSeal,
|
||||
id_card_front as idCardFront,
|
||||
id_card_reverse as idCardReverse,
|
||||
corporate_seal as corporateSeal,
|
||||
sub_ein_status as subEinStatus
|
||||
from pm_sub where is_active='1'
|
||||
<if test="keyWord !=null and keyWord!= ''" >
|
||||
and (
|
||||
sub_name like concat('%', #{keyWord}, '%')
|
||||
or legal_person like concat('%', #{keyWord}, '%')
|
||||
or legal_person_phone like concat('%', #{keyWord}, '%')
|
||||
or legsub_addressal_person_phone like concat('%', #{keyWord}, '%')
|
||||
or sub_address like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
<?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.bonus.bmw.mapper.PmSubTeamContractMapper">
|
||||
<insert id="addSubTeamContract" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pm_sub_team_contract (team_id,team_name, sub_id,sub_name,pro_id,pro_name,team_ein_time,team_ein_status,
|
||||
team_exit_time,create_user, update_user, create_time, update_time)
|
||||
values (#{teamId},#{teamName}, #{subId},#{subName},#{proId},#{proName},#{teamEinTime},#{teamEinStatus},
|
||||
#{teamExitTime},#{createUser}, #{updateUser}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
<update id="updateSubTeamContract">
|
||||
update pm_sub_team_contract
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="teamEinStatus!= null " >
|
||||
team_ein_status=#{teamEinStatus},
|
||||
</if>
|
||||
<if test="teamExitTime!= null and teamExitTime != ''" >
|
||||
team_exit_time=#{teamExitTime},
|
||||
</if>
|
||||
<if test="updateUser!= null " >
|
||||
update_user=#{updateUser},
|
||||
</if>
|
||||
<if test="updateTime!= null " >
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectSubTeamContractList" resultType="com.bonus.bmw.domain.po.PmSubTeamContract">
|
||||
select id,team_id,team_name,sub_id,sub_name,pro_id,pro_name,team_ein_time,team_ein_status,team_exit_time
|
||||
from pm_sub_team_contract where is_active = '1'
|
||||
<if test="teamName!=null and teamName!= ''">
|
||||
and team_name LIKE CONCAT('%', #{teamName}, '%')
|
||||
</if>
|
||||
<if test="subName!=null and subName!= ''">
|
||||
and sub_name LIKE CONCAT('%', #{subName}, '%')
|
||||
</if>
|
||||
<if test="proName!=null and proName!= ''">
|
||||
and pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="teamEinStatus!=null and teamEinStatus!= ''">
|
||||
and team_ein_status LIKE CONCAT('%', #{teamEinStatus}, '%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="getSubTeamContractById" resultType="com.bonus.bmw.domain.po.PmSubTeamContract">
|
||||
select id,team_id,team_name,sub_id,sub_name,pro_id,pro_name,team_ein_time,team_ein_status,team_exit_time
|
||||
from pm_sub_team_contract where is_active = '1' and id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?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.bonus.bmw.mapper.PmSubTeamMapper">
|
||||
<insert id="addSubTeam" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pm_sub_team (team_name,sub_id, team_leader,phone,team_ein_status, create_user, update_user, create_time, update_time)
|
||||
values (#{teamName},#{subId}, #{teamLeader},#{phone},#{teamEinStatus}, #{createUser}, #{updateUser}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
<update id="updateSubTeam">
|
||||
update pm_sub_team
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="teamName!= null " >
|
||||
team_name=#{teamName},
|
||||
</if>
|
||||
<if test="teamLeader!= null and teamLeader != ''" >
|
||||
team_leader=#{teamLeader},
|
||||
</if>
|
||||
<if test="phone!= null and phone != ''" >
|
||||
phone=#{phone},
|
||||
</if>
|
||||
<if test="teamEinStatus!= null " >
|
||||
team_ein_status=#{teamEinStatus},
|
||||
</if>
|
||||
<if test="updateUser!= null " >
|
||||
update_user=#{updateUser},
|
||||
</if>
|
||||
<if test="updateTime!= null " >
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="delSubTeam">
|
||||
update pm_sub_team set is_active = '0' where id =#{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectSubTeamList" resultType="com.bonus.bmw.domain.po.PmSubTeam">
|
||||
select pst.id as id,
|
||||
pst.team_name as teamName,
|
||||
pst.sub_id as subId,
|
||||
ps.sub_name as subName,
|
||||
pst.team_leader as teamLeader,
|
||||
pst.phone as phone,
|
||||
pst.team_ein_status as teamEinStatus
|
||||
from pm_sub_team pst
|
||||
left join pm_sub ps on ps.id = pst.sub_id
|
||||
where pst.is_active = '1'
|
||||
<if test="keyWord !=null and keyWord!= ''" >
|
||||
and (
|
||||
ps.sub_name like concat('%', #{keyWord}, '%')
|
||||
or pst.team_name like concat('%', #{keyWord}, '%')
|
||||
or pst.team_leader like concat('%', #{keyWord}, '%')
|
||||
or pst.phone like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -90,6 +90,8 @@ public class FileUtilController {
|
|||
return R.fail("文件上传报错");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param files 文件
|
||||
|
|
@ -205,4 +207,29 @@ public class FileUtilController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个文件的bast64
|
||||
* @param id
|
||||
* @param sourceId
|
||||
* @param sourceTable
|
||||
* @param sourceType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getFileBast64")
|
||||
public R<UploadFileVo> getFileBast64(String id,String sourceId,String sourceTable,String sourceType) {
|
||||
try {
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
if (ObjectUtil.isEmpty(sourceId)) {
|
||||
return R.fail("资源表id不能为空");
|
||||
}
|
||||
}
|
||||
UploadFileVo num= service.getFileBast64( id,sourceId,sourceTable,sourceType);
|
||||
return R.ok(num);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
return R.fail("文件删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,11 +418,20 @@ public class FileUtilsServiceImpl {
|
|||
// 无效的Base64编码
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件bast64
|
||||
* @param id
|
||||
* @param sourceId
|
||||
* @param sourceTable
|
||||
* @param sourceType
|
||||
* @return
|
||||
*/
|
||||
public UploadFileVo getFileBast64(String id, String sourceId, String sourceTable, String sourceType) {
|
||||
List<UploadFileVo> list=mapper.getFileList(id,sourceId,sourceType,sourceTable);
|
||||
UploadFileVo vo=list.get(0);
|
||||
String bast64=minioUtils.getMinioBast64(vo.getBucketName(),vo.getFilePath());
|
||||
vo.setBast64(bast64);
|
||||
return vo;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,6 +289,30 @@ public class MinioUtil {
|
|||
.method(Method.GET)
|
||||
.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件bast64
|
||||
* @param bucketName
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows(Exception.class)
|
||||
public String getMinioBast64(String bucketName,String path) {
|
||||
InputStream inputStream= minioClient.getObject(GetObjectArgs.builder().bucket(bucketName).object(path).build());
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
byte[] bytes = outputStream.toByteArray();
|
||||
String bast64= Base64.getEncoder().encodeToString(bytes);
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
return bast64;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.urk.config;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CommonUtils {
|
||||
/**
|
||||
* 获取request输入流byte[]
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static byte[] GetRequestStreamBytes(HttpServletRequest request) {
|
||||
int lenContent = request.getContentLength();
|
||||
byte[] byteRequestBin = new byte[0];
|
||||
if (lenContent < 1) {
|
||||
return byteRequestBin;
|
||||
}
|
||||
try {
|
||||
byteRequestBin = IoUtil.readBytes(request.getInputStream());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return byteRequestBin;
|
||||
}
|
||||
|
||||
public static Map<String, String> getHeaderMap(HttpServletRequest req) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
Enumeration headerNames = req.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String key = (String) headerNames.nextElement();
|
||||
String value = req.getHeader(key);
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public static String getRequestBodyKey(HttpServletRequest req) {
|
||||
Map<String, String> headerMap = getHeaderMap(req);
|
||||
StringBuilder key = new StringBuilder();
|
||||
key.append(headerMap.get(Constant.DEVICE_HEADER_DEV_ID)).append("_")
|
||||
.append(headerMap.get(Constant.DEVICE_HEADER_TRANS_ID)).append("_")
|
||||
.append(headerMap.get(Constant.DEVICE_HEADER_REQUEST_CODE)).append("_")
|
||||
.append(headerMap.get(Constant.DEVICE_HEADER_CONTENT_LENGTH));
|
||||
return key.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -98,13 +99,41 @@ public class Constant {
|
|||
NO_SEND_SMS_STORE_SET.add("46");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 没结果返回命令
|
||||
*/
|
||||
|
||||
public static final LinkedList<String> noResList=new LinkedList<>();
|
||||
/**
|
||||
* 有结果返回命令
|
||||
*/
|
||||
public static final LinkedList<String> reslutList=new LinkedList<>();
|
||||
static {
|
||||
noResList.add("SET_TIME");
|
||||
noResList.add("RESET_FK");
|
||||
noResList.add("CLEAR_LOG_DATA");
|
||||
noResList.add("RESET_DEVICE");
|
||||
noResList.add("UPDATE_FIRMWARE");
|
||||
noResList.add("ENTER_ENROLL");
|
||||
noResList.add("SET_DEVICE_SETTING");
|
||||
noResList.add("CLEAR_MANAGER");
|
||||
noResList.add("SET_DOOR_STATUS");
|
||||
noResList.add("SET_ROOM_NUM");
|
||||
noResList.add("SET_TTS_STRING");
|
||||
reslutList.add("SET_USER_INFO");
|
||||
reslutList.add("GET_USER_ID_LIST");
|
||||
reslutList.add("GET_USER_INFO");
|
||||
reslutList.add("GET_LOG_DATA");
|
||||
reslutList.add("DELETE_USER");
|
||||
reslutList.add("GET_DEVICE_INFO");
|
||||
reslutList.add("GET_DEVICE_SETTING");
|
||||
}
|
||||
/**
|
||||
* 没结果返回命令
|
||||
*/
|
||||
public static final Set<InstructEnum> noResultInstruct = new HashSet<>();
|
||||
/**
|
||||
* 有结果返回命令
|
||||
*/
|
||||
|
||||
public static final Set<InstructEnum> hasResultInstruct = new HashSet<>();
|
||||
static {
|
||||
noResultInstruct.add(InstructEnum.SET_TIME);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.urk.config;
|
||||
|
||||
/**
|
||||
* Redis所有Keys
|
||||
*
|
||||
* @author eqzcy@163.com
|
||||
*/
|
||||
public class RedisKeys {
|
||||
|
||||
public static String getSysConfigKey(String key){
|
||||
return "sys:config:" + key;
|
||||
}
|
||||
|
||||
public static String getSysUserTokenKey(String key){
|
||||
return "sys:userToken:" + key;
|
||||
}
|
||||
public static String getSysUserKey(String key){
|
||||
return "sys:user:info:" + key;
|
||||
}
|
||||
|
||||
public static String getUserPermKey(String key){
|
||||
return "sys:user:perm:" + key;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.bonus.urk.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Redis工具类
|
||||
*
|
||||
* @author eqzcy@163.com
|
||||
*/
|
||||
@Component
|
||||
public class RedisUtils {
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
@Autowired
|
||||
private ValueOperations<String, String> valueOperations;
|
||||
@Autowired
|
||||
private HashOperations<String, String, Object> hashOperations;
|
||||
@Autowired
|
||||
private ListOperations<String, Object> listOperations;
|
||||
@Autowired
|
||||
private SetOperations<String, Object> setOperations;
|
||||
@Autowired
|
||||
private ZSetOperations<String, Object> zSetOperations;
|
||||
/** 默认过期时长,单位:秒 */
|
||||
public final static long DEFAULT_EXPIRE = 60 * 60 * 24;
|
||||
/** 不设置过期时长 */
|
||||
public final static long NOT_EXPIRE = -1;
|
||||
private final static Gson gson = new Gson();
|
||||
|
||||
public void set(String key, Object value, long expire){
|
||||
valueOperations.set(key, toJson(value));
|
||||
if(expire != NOT_EXPIRE){
|
||||
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
public void set(String key, Object value){
|
||||
set(key, value, DEFAULT_EXPIRE);
|
||||
}
|
||||
|
||||
public <T> T get(String key, Class<T> clazz, long expire) {
|
||||
String value = valueOperations.get(key);
|
||||
if(expire != NOT_EXPIRE){
|
||||
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
|
||||
}
|
||||
return value == null ? null : fromJson(value, clazz);
|
||||
}
|
||||
|
||||
public <T> T get(String key, Class<T> clazz) {
|
||||
return get(key, clazz, NOT_EXPIRE);
|
||||
}
|
||||
|
||||
public String get(String key, long expire) {
|
||||
String value = valueOperations.get(key);
|
||||
if(expire != NOT_EXPIRE){
|
||||
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String get(String key) {
|
||||
return get(key, NOT_EXPIRE);
|
||||
}
|
||||
|
||||
public void delete(String key) {
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断key是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
try {
|
||||
return redisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Object转成JSON数据
|
||||
*/
|
||||
private String toJson(Object object){
|
||||
if(object instanceof Integer || object instanceof Long || object instanceof Float ||
|
||||
object instanceof Double || object instanceof Boolean || object instanceof String){
|
||||
return String.valueOf(object);
|
||||
}
|
||||
return gson.toJson(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON数据,转成Object
|
||||
*/
|
||||
private <T> T fromJson(String json, Class<T> clazz){
|
||||
return gson.fromJson(json, clazz);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.bonus.urk.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Api(tags = "考勤机业务员指令接口")
|
||||
@RestController("business")
|
||||
@RequestMapping
|
||||
@Slf4j
|
||||
public class BusinessController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.bonus.urk.controller;
|
||||
|
||||
import com.bonus.urk.service.SendUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Api(tags = "考勤机业务员指令接口-人员下发及删除")
|
||||
@RestController("business")
|
||||
@RequestMapping
|
||||
@Slf4j
|
||||
public class SendUserController {
|
||||
|
||||
@Autowired
|
||||
private SendUserService service;
|
||||
|
||||
/**
|
||||
* 人员下发 及人员修改时触发
|
||||
* @param userId
|
||||
* @param proId
|
||||
* @param update
|
||||
*/
|
||||
@PostMapping("sendUserToDevice")
|
||||
public void sendUserToDevice(int userId,int proId,String update) {
|
||||
try {
|
||||
service.sendUserToDevice(userId,proId, update);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增考勤机 时触发
|
||||
* @param deviceCode
|
||||
*/
|
||||
@PostMapping("getUserSendToDev")
|
||||
public void sendUserToDevice(String deviceCode,int proId) {
|
||||
try {
|
||||
service.getUserSendToDev(deviceCode,proId);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 人员出场时触发
|
||||
*/
|
||||
@PostMapping("delUserByDevice")
|
||||
public void delUserByDevice(int userId ,int proId ) {
|
||||
try {
|
||||
service.delUserByDevice(userId,proId);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ package com.bonus.urk.handle;
|
|||
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.urk.config.Constant;
|
||||
import com.bonus.urk.mapper.BusinessMapper;
|
||||
import com.bonus.urk.mapper.DeviceMapper;
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class DeviceHandle {
|
||||
|
||||
@Autowired
|
||||
private BusinessMapper mapper;
|
||||
private DeviceMapper mapper;
|
||||
|
||||
|
||||
public DeviceVo handel(HttpServletRequest req, HttpServletResponse resp){
|
||||
|
|
@ -31,7 +31,7 @@ public class DeviceHandle {
|
|||
//设备型号
|
||||
String devModel = req.getHeader(Constant.DEVICE_HEADER_DEV_MODEL);
|
||||
if(StringUtils.isEmpty(devId)) {
|
||||
log.error("请求头不含设备编号, 不能处理数据");
|
||||
log.error("请求头不含设备编号,不能处理数据");
|
||||
return null;
|
||||
}
|
||||
//验证设备是否存在
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package com.bonus.urk.handle;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.bonus.urk.config.CacheConstant;
|
||||
import com.bonus.urk.config.Constant;
|
||||
import com.bonus.urk.config.InstructEnum;
|
||||
import com.bonus.urk.config.TaskStatusEnum;
|
||||
import com.bonus.urk.mapper.BusinessMapper;
|
||||
import com.bonus.urk.mapper.TaskMapper;
|
||||
import com.bonus.urk.service.TaskService;
|
||||
import com.bonus.urk.vo.DeviceTaskVo;
|
||||
|
|
@ -18,12 +15,10 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.urk.config.InstructEnum.RESET_FK;
|
||||
import static com.bonus.urk.config.InstructEnum.SET_TIME;
|
||||
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
* 设备信通处理器
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
@ -123,7 +118,6 @@ public class ReceiveCmd {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
package com.bonus.urk.handle;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.urk.config.CommonUtils;
|
||||
import com.bonus.urk.config.Constant;
|
||||
import com.bonus.urk.config.TaskStatusEnum;
|
||||
import com.bonus.urk.service.ResultService;
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* 数据回调接口
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ResultHandle {
|
||||
|
||||
@Autowired
|
||||
private ResultService service;
|
||||
|
||||
/**
|
||||
* 数据统一回调事件
|
||||
* @param req
|
||||
* @param resp
|
||||
*/
|
||||
public void dealTrans(HttpServletRequest req, HttpServletResponse resp) {
|
||||
//任务识别号
|
||||
String asTransId = req.getHeader(Constant.DEVICE_HEADER_TRANS_ID);
|
||||
String isok = req.getHeader("cmd_return_code");
|
||||
try{
|
||||
KqCmdTaskVo taskVo=service.getTaskVoById(asTransId);
|
||||
//存在任务
|
||||
if(taskVo!=null){
|
||||
//任务失败了
|
||||
if (!isok.equals(Constant.OK)) {
|
||||
//执行失败
|
||||
taskVo.setTransStatus(TaskStatusEnum.ERROR.ordinal());
|
||||
taskVo.setUpdateTime(DateUtils.getTime());
|
||||
service.updateTaskById(taskVo);
|
||||
}else{
|
||||
String cmdCode = taskVo.getCmdCode();
|
||||
if (Constant.noResList.contains(cmdCode)) {
|
||||
log.info("cmdCode:{}", cmdCode);
|
||||
try {
|
||||
String jsonStr = null;
|
||||
// String key = CommonUtils.getRequestBodyKey(req);
|
||||
byte[] deviceReturnData = CommonUtils.GetRequestStreamBytes(req);
|
||||
jsonStr = new String(deviceReturnData, Constant.CHART_SET);
|
||||
log.info("设备反馈信息:{}", jsonStr);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}else{
|
||||
//设备携带数据返回的
|
||||
// 获得注册人员列表
|
||||
switch (taskVo.getCmdCode()) {
|
||||
case "GET_USER_ID_LIST":
|
||||
service.insertUserIdList(taskVo, req, resp);
|
||||
break;
|
||||
case "SET_USER_INFO":
|
||||
service.insertUserInfoList(taskVo, req, resp);
|
||||
break;
|
||||
case "GET_LOG_DATA":
|
||||
// 获取记录数据
|
||||
service.insertLogData(taskVo, req, resp);
|
||||
break;
|
||||
case "GET_DEVICE_INFO":
|
||||
// 获取设备基本信息
|
||||
service.insertDeviceInfo(taskVo, req, resp);
|
||||
break;
|
||||
|
||||
case "GET_DEVICE_SETTING":
|
||||
// 获取设备设置参数
|
||||
service.insertDeviceSetting(taskVo, req, resp);
|
||||
break;
|
||||
case "GET_USER_INFO":
|
||||
// 获取考勤机用户信息
|
||||
service.insertUserInfo(taskVo, req, resp);
|
||||
break;
|
||||
case "DELETE_USER":
|
||||
// 删除人员的反馈
|
||||
service.insertDeleteUser(taskVo, req, resp);
|
||||
break;
|
||||
default:
|
||||
taskVo.setMsg("未知命令");
|
||||
break;
|
||||
}
|
||||
//更新 ,再进行删除任务记录
|
||||
service.updateCmdTaskStatus(taskVo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.err.println("asTransId---->"+asTransId);
|
||||
System.err.println("isok---->"+isok);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.bonus.urk.handle;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import com.bonus.urk.config.CommonUtils;
|
||||
import com.bonus.urk.config.Constant;
|
||||
import com.bonus.urk.service.UserFaceHandleService;
|
||||
import com.bonus.urk.vo.BmWorkerEinUserVo;
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* 人脸识别处理器
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserFaceHandle {
|
||||
|
||||
public static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserFaceHandleService service;
|
||||
|
||||
/**
|
||||
* 人员数据处理
|
||||
* @param deviceVo
|
||||
* @param req
|
||||
* @param resp
|
||||
*/
|
||||
@Async
|
||||
public void addUserAttendance(DeviceVo deviceVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
try{
|
||||
// 解析request输入流
|
||||
String jsonStr = getRequestBody(req);
|
||||
log.info("出入记录:{}", jsonStr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
||||
if(null == jsonObject) {
|
||||
log.error("出入记录没数据");
|
||||
return;
|
||||
}
|
||||
//用户id
|
||||
String userId=jsonObject.getString("userId");
|
||||
String devCode= deviceVo.getDevCode();
|
||||
DateTime datetime= DateUtil.parse(jsonObject.getString("time"), DatePattern.PURE_DATETIME_FORMAT);
|
||||
String time=sdf.format(datetime);
|
||||
String bast64 = "";
|
||||
if(jsonObject.getString("logPhoto")!=null) {
|
||||
//文件图片
|
||||
bast64= jsonObject.getString("logPhoto");
|
||||
// fileService.uploadBast64(bast64,"bm_att_person","bm_att_person")
|
||||
}
|
||||
//验证用户是否入场
|
||||
BmWorkerEinUserVo vo=service.getOnUserInfo(userId);
|
||||
if(vo==null){
|
||||
log.error("人员未入场");
|
||||
return;
|
||||
}
|
||||
vo.setAttPhoto(bast64);
|
||||
vo.setAttTime(time);
|
||||
vo.setDevCode(devCode);
|
||||
vo.setDevName(deviceVo.getDeviceName());
|
||||
service.addAttendInfo(vo);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getRequestBody(HttpServletRequest req) {
|
||||
// String key = CommonUtils.getRequestBodyKey(req);
|
||||
// if(redisUtils.hasKey(key)) {
|
||||
// return redisUtils.get(key);
|
||||
// } else {
|
||||
byte[] requestData = CommonUtils.GetRequestStreamBytes(req);
|
||||
String jsonStr = null;
|
||||
try {
|
||||
jsonStr = new String(requestData, Constant.CHART_SET);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonStr;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.vo.DeviceTaskVo;
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Mapper
|
||||
public interface BusinessMapper {
|
||||
|
||||
|
||||
DeviceVo getDeviceVoById(@Param("devId") String devId);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param deviceVo
|
||||
*/
|
||||
int insertDeviceVo(DeviceVo deviceVo);
|
||||
|
||||
/**
|
||||
* 查询待执行的设备指令
|
||||
* @param devCode
|
||||
* @return
|
||||
*/
|
||||
List<DeviceTaskVo> selectCmdTaskList(@Param("devCode") String devCode);
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
* @param task
|
||||
*/
|
||||
void updateById(DeviceTaskVo task);
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.config.DeviceUserDto;
|
||||
import com.bonus.urk.vo.DeviceTaskVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
|
|
@ -16,4 +19,6 @@ public interface CmdLogMapper {
|
|||
* @param body
|
||||
*/
|
||||
void insertCmdLogs(@Param("taskVo") DeviceTaskVo taskVo,@Param("body") String body);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceMapper {
|
||||
|
||||
|
||||
DeviceVo getDeviceVoById(@Param("devId") String devId);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param deviceVo
|
||||
*/
|
||||
int insertDeviceVo(DeviceVo deviceVo);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
* 数据返回 数据
|
||||
*/
|
||||
@Mapper
|
||||
public interface ResultMapper {
|
||||
|
||||
/**
|
||||
* 查询任务信息
|
||||
* @param asTransId
|
||||
* @return
|
||||
*/
|
||||
KqCmdTaskVo getTaskVoById(@Param("taskId") String asTransId);
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
* @param taskVo
|
||||
*/
|
||||
void updateTaskById(KqCmdTaskVo taskVo);
|
||||
|
||||
void updateTaskHisById(KqCmdTaskVo taskVo);
|
||||
|
||||
/**
|
||||
* r任务下发后进行状态跟新·
|
||||
* @param taskVo
|
||||
* @param i
|
||||
*/
|
||||
void updateUserIssuedStatus(@Param("taskVo") KqCmdTaskVo taskVo,@Param("result") int i);
|
||||
|
||||
/**
|
||||
* 删除任务信息记录
|
||||
* @param taskVo
|
||||
*/
|
||||
void delCmdTaskId(KqCmdTaskVo taskVo);
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Mapper
|
||||
public interface SendUserMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 新增任务-及任务记录
|
||||
* @param taskVo
|
||||
*/
|
||||
void insertCmdTask(KqCmdTaskVo taskVo);
|
||||
/**
|
||||
* 新增任务-及任务记录
|
||||
* @param taskVo
|
||||
*/
|
||||
void insertCmdTaskHistory(KqCmdTaskVo taskVo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前工程全部在场人员
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
List<String> getOnSiteUser(@Param("proId") int proId);
|
||||
|
||||
/**
|
||||
* 批量插入 任务人员管理表
|
||||
* @param list
|
||||
* @param taskVo
|
||||
*/
|
||||
|
||||
void insertCmdTaskUser(@Param("list") List<String> list,@Param("param") KqCmdTaskVo taskVo);
|
||||
|
||||
/**
|
||||
* 批量插入 设备任务记录
|
||||
* @param list
|
||||
*/
|
||||
void insertCmdTaskByDevice(@Param("list")List<KqCmdTaskVo> list);
|
||||
|
||||
/**
|
||||
* 批量插入任务数据
|
||||
* @param list
|
||||
*/
|
||||
void insertCmdTaskByDeviceHistory(@Param("list")List<KqCmdTaskVo> list);
|
||||
|
||||
|
||||
/**
|
||||
* 任务下发的用户信息
|
||||
* @param list
|
||||
* @param userId
|
||||
*/
|
||||
void insertTaskUser(@Param("list")List<KqCmdTaskVo> list,@Param("userId") int userId);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询工程数据
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
List<DeviceVo> getDeviceVoByProId(@Param("proId") int proId);
|
||||
|
||||
/**
|
||||
* 查询工程是否史上海工程
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
Integer getProType(@Param("proId") int proId);
|
||||
|
||||
/**
|
||||
* 查询全部上海工程的考勤机
|
||||
* @return
|
||||
*/
|
||||
List<DeviceVo> getDeviceVoByProBySh();
|
||||
|
||||
/**
|
||||
* 查询上海工程的全部人员
|
||||
* @return
|
||||
*/
|
||||
List<String> getOnSiteUserBySh();
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.config.DeviceUserDto;
|
||||
import com.bonus.urk.vo.DeviceTaskVo;
|
||||
import com.bonus.urk.vo.TaskUserVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -39,4 +40,11 @@ public interface TaskMapper {
|
|||
* @return
|
||||
*/
|
||||
List<TaskUserVo> getTaskUserInfoList(@Param("taskId")String id);
|
||||
|
||||
/**
|
||||
* 用户下发记录
|
||||
* @param taskVo
|
||||
* @param userList
|
||||
*/
|
||||
void insertUserIssued(@Param("taskVo") DeviceTaskVo taskVo,@Param("list") List<DeviceUserDto> userList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.vo.BmWorkerEinUserVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserFaceHandleMapper {
|
||||
/**
|
||||
* 查询用户在岗
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
BmWorkerEinUserVo getOnUserInfo(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 新增人员考勤数据
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
int insertAttPerson(BmWorkerEinUserVo vo);
|
||||
|
||||
/**
|
||||
* 插入考勤记录
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
int insertAttRecord(BmWorkerEinUserVo vo);
|
||||
|
||||
/**
|
||||
* 看看今日是否已经考勤
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
Integer getTodayIsExit(BmWorkerEinUserVo vo);
|
||||
}
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
package com.bonus.urk.service;
|
||||
|
||||
import com.bonus.urk.config.DeviceUserDto;
|
||||
import com.bonus.urk.mapper.CmdLogMapper;
|
||||
import com.bonus.urk.vo.DeviceTaskVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
|
|
@ -35,4 +38,6 @@ public class CmdLogService {
|
|||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
package com.bonus.urk.service;
|
||||
|
||||
import com.bonus.urk.mapper.ResultMapper;
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 数据返回处理 业务层
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ResultService {
|
||||
|
||||
@Autowired
|
||||
private ResultMapper mapper;
|
||||
|
||||
/**
|
||||
* 查询任务 记录
|
||||
* @param asTransId
|
||||
* @return
|
||||
*/
|
||||
public KqCmdTaskVo getTaskVoById(String asTransId) {
|
||||
try{
|
||||
return mapper.getTaskVoById(asTransId);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
* @param taskVo
|
||||
*/
|
||||
@Async
|
||||
public void updateTaskById(KqCmdTaskVo taskVo) {
|
||||
try{
|
||||
mapper.updateTaskById(taskVo);
|
||||
mapper.updateTaskHisById(taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertUserIdList(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
}
|
||||
|
||||
public void insertLogData(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
}
|
||||
|
||||
public void insertDeviceInfo(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
}
|
||||
|
||||
public void insertDeviceSetting(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
}
|
||||
|
||||
public void insertUserInfo(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
}
|
||||
|
||||
public void insertDeleteUser(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员下发回调
|
||||
* @param taskVo
|
||||
* @param req
|
||||
* @param resp
|
||||
*/
|
||||
public void insertUserInfoList(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
try{
|
||||
//跟新任务状态
|
||||
mapper.updateUserIssuedStatus(taskVo,1);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
@Async
|
||||
public void updateCmdTaskStatus(KqCmdTaskVo taskVo) {
|
||||
try{
|
||||
//跟新任务状态
|
||||
mapper.delCmdTaskId(taskVo);
|
||||
mapper.updateTaskHisById(taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package com.bonus.urk.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.urk.config.TaskStatusEnum;
|
||||
import com.bonus.urk.mapper.SendUserMapper;
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SendUserService {
|
||||
|
||||
public final static int PAGE_SIZE=200;
|
||||
|
||||
|
||||
@Resource
|
||||
private SendUserMapper mapper;
|
||||
|
||||
|
||||
public void getUserSendToDev(String deviceCode,int proId) {
|
||||
try{
|
||||
String createTime= DateUtils.getTime();
|
||||
KqCmdTaskVo taskVo=new KqCmdTaskVo();
|
||||
taskVo.setProId(String.valueOf(proId));
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("SET_USER_INFO");
|
||||
taskVo.setDeviceCode(deviceCode);
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
//分页查询
|
||||
getUserSendToDev(proId,1,taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void getUserSendToDev(int proId,int pageNum, KqCmdTaskVo taskVo){
|
||||
try{
|
||||
List<String> list;
|
||||
Integer isSh=mapper.getProType(proId);
|
||||
PageHelper.startPage(pageNum, PAGE_SIZE);
|
||||
if(isSh!=null && isSh==1){
|
||||
list=mapper.getOnSiteUserBySh();
|
||||
}else{
|
||||
list=mapper.getOnSiteUser(proId);
|
||||
}
|
||||
PageInfo<String> pageInfo =new PageInfo<String>(list);
|
||||
//分页查询全部在场用户
|
||||
if (!list.isEmpty()){
|
||||
taskVo.setCmdParam(JSON.toJSONString(list));
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
//添加人员
|
||||
mapper.insertCmdTaskUser(list,taskVo);
|
||||
|
||||
int pageSize=pageInfo.getPageNum();
|
||||
int pageTotal=pageInfo.getPages();
|
||||
if(pageSize<pageTotal){
|
||||
pageNum++;
|
||||
getUserSendToDev(proId,pageNum,taskVo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发用户给全部的考勤机相关工程的考勤机
|
||||
* @param userId
|
||||
* @param proId
|
||||
*/
|
||||
public void sendUserToDevice(int userId,int proId,String update) {
|
||||
try{
|
||||
|
||||
String createTime= DateUtils.getTime();
|
||||
KqCmdTaskVo taskVo=new KqCmdTaskVo();
|
||||
//是否是修改的
|
||||
if(ObjectUtil.isNotEmpty(update)){
|
||||
taskVo.setUpdateStatus("1");
|
||||
}
|
||||
List<Integer> userList=new ArrayList<>();
|
||||
userList.add(userId);
|
||||
String json= JSON.toJSONString(userList);
|
||||
taskVo.setProId(String.valueOf(proId));
|
||||
taskVo.setCmdParam(json);
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("SET_USER_INFO");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
//分页查询
|
||||
sendUserToDevice(userId,proId,1,taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 下发人员分页
|
||||
* @param userId
|
||||
* @param proId
|
||||
* @param pageNum
|
||||
* @param taskVo
|
||||
*/
|
||||
public void sendUserToDevice(int userId,int proId,int pageNum, KqCmdTaskVo taskVo){
|
||||
Integer isSh=mapper.getProType(proId);
|
||||
List<DeviceVo> list;
|
||||
PageHelper.startPage(pageNum, PAGE_SIZE);
|
||||
//是上海的工程
|
||||
if(isSh!=null && isSh==1){
|
||||
list=mapper.getDeviceVoByProBySh();
|
||||
}else{
|
||||
list=mapper.getDeviceVoByProId(proId);
|
||||
}
|
||||
PageInfo<DeviceVo> pageInfo =new PageInfo<DeviceVo>(list);
|
||||
//分页查询+
|
||||
if (!list.isEmpty()){
|
||||
List<KqCmdTaskVo> taskVos=new ArrayList<>();
|
||||
for (DeviceVo vo:list){
|
||||
taskVo.setDeviceCode(vo.getDevCode());
|
||||
taskVos.add(taskVo);
|
||||
}
|
||||
// 任务下发新增
|
||||
mapper.insertCmdTaskByDevice(taskVos);
|
||||
mapper.insertCmdTaskByDeviceHistory(taskVos);
|
||||
// 任务人员关联
|
||||
mapper.insertTaskUser(taskVos,userId);
|
||||
|
||||
int pageSize=pageInfo.getPageNum();
|
||||
int pageTotal=pageInfo.getPages();
|
||||
if(pageSize<pageTotal){
|
||||
pageNum++;
|
||||
sendUserToDevice(userId,proId,pageNum,taskVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员 出场 --删除人员
|
||||
*
|
||||
* * @param userId
|
||||
* @param proId
|
||||
*/
|
||||
public void delUserByDevice(int userId, int proId) {
|
||||
try{
|
||||
List<Integer> userList=new ArrayList<>();
|
||||
String createTime= DateUtils.getTime();
|
||||
KqCmdTaskVo taskVo=new KqCmdTaskVo();
|
||||
userList.add(userId);
|
||||
String json= JSON.toJSONString(userList);
|
||||
taskVo.setProId(String.valueOf(proId));
|
||||
taskVo.setCmdParam(json);
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("DELETE_USER");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
//分页查询
|
||||
sendUserToDevice(userId,proId,1,taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -7,7 +7,12 @@ import cn.hutool.core.date.DateUtil;
|
|||
import cn.hutool.core.io.FileUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import com.bonus.urk.config.Constant;
|
||||
import com.bonus.urk.config.DeviceUserDto;
|
||||
import com.bonus.urk.config.TaskStatusEnum;
|
||||
|
|
@ -17,10 +22,13 @@ import com.bonus.urk.vo.DeviceVo;
|
|||
import com.bonus.urk.vo.TaskUserVo;
|
||||
import com.itextpdf.text.pdf.PRAcroForm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
|
@ -44,11 +52,17 @@ public class TaskService {
|
|||
@Autowired
|
||||
private CmdLogService service;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TaskMapper mapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private RemoteUploadUtilsService fileService;
|
||||
|
||||
public static SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
|
||||
public void updateTime(DeviceTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
String body = "";
|
||||
|
|
@ -361,14 +375,17 @@ public class TaskService {
|
|||
}
|
||||
|
||||
user.setPrivilege(0);
|
||||
//人脸图片转成bast64
|
||||
if(StringUtils.isNotBlank(userVo.getPhoto())) {
|
||||
|
||||
String bast64=getFileBast64("pm_worker",userVo.getUserId(),"1");
|
||||
if(StringUtils.isNotBlank(bast64)) {
|
||||
user.setPhoto_base64(bast64);
|
||||
user.setPhotoEnroll(1);
|
||||
}
|
||||
}
|
||||
|
||||
userList.add(user);
|
||||
}
|
||||
try {
|
||||
taskService.insertUserIssued(task, userList);
|
||||
// body
|
||||
// 组装body的json部分
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
|
@ -398,6 +415,7 @@ public class TaskService {
|
|||
log.info("设备:{}, 写入用户指令下达", task.getDeviceCode());
|
||||
}
|
||||
|
||||
|
||||
public void getUserInfo(DeviceTaskVo task, HttpServletRequest req, HttpServletResponse resp) {
|
||||
String body = "";
|
||||
// body
|
||||
|
|
@ -434,15 +452,39 @@ public class TaskService {
|
|||
}
|
||||
|
||||
|
||||
public void dealTrans(HttpServletRequest req, HttpServletResponse resp) {
|
||||
// 任务识别号
|
||||
String asTransId = req.getHeader(Constant.DEVICE_HEADER_TRANS_ID);
|
||||
String isok = req.getHeader("cmd_return_code");
|
||||
|
||||
|
||||
|
||||
System.err.println("asTransId---->"+asTransId);
|
||||
System.err.println("isok---->"+isok);
|
||||
/**
|
||||
* 获取人员头像
|
||||
*/
|
||||
public String getFileBast64(String sourceId, String sourceTable, String sourceTyp){
|
||||
R<UploadFileVo> res=fileService.getFileBast64(null,sourceId,sourceTable,sourceTyp, SecurityConstants.INNER);
|
||||
if(res.getCode()==R.SUCCESS){
|
||||
UploadFileVo vo=res.getData();
|
||||
return vo.getBast64();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户下发 -操作记录
|
||||
* @param id
|
||||
* @param userList
|
||||
*/
|
||||
/**
|
||||
* 人员下发
|
||||
* 用户下发记录
|
||||
* @param taskVo
|
||||
* @param userList
|
||||
*/
|
||||
@Async
|
||||
public void insertUserIssued(DeviceTaskVo taskVo, List<DeviceUserDto> userList) {
|
||||
try{
|
||||
taskVo.setCreateTime(DateUtils.getTime());
|
||||
mapper.insertUserIssued(taskVo,userList);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
package com.bonus.urk.service;
|
||||
|
||||
import com.alibaba.ttl.threadpool.agent.internal.javassist.runtime.Inner;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import com.bonus.urk.mapper.UserFaceHandleMapper;
|
||||
import com.bonus.urk.vo.BmWorkerEinUserVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*
|
||||
* 人脸下发
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserFaceHandleService {
|
||||
|
||||
@Autowired
|
||||
private UserFaceHandleMapper mapper;
|
||||
|
||||
@Resource
|
||||
private RemoteUploadUtilsService fileService;
|
||||
|
||||
/**
|
||||
* 依据用户id 查询施工工程信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public BmWorkerEinUserVo getOnUserInfo(String userId) {
|
||||
try{
|
||||
BmWorkerEinUserVo vo=mapper.getOnUserInfo(userId);
|
||||
if(vo!=null && StringUtils.isNotEmpty(vo.getUserId())){
|
||||
return vo;
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增考勤数据
|
||||
* @param vo
|
||||
*/
|
||||
@Async
|
||||
public void addAttendInfo(BmWorkerEinUserVo vo) {
|
||||
try{
|
||||
String id=StringUtils.randomUUID();
|
||||
vo.setId(id);
|
||||
vo.setAttMonth(DateUtils.getCurrentMonth());
|
||||
vo.setAttDay(DateUtils.getDate());
|
||||
vo.setCreateTime(DateUtils.getTime());
|
||||
Integer num=mapper.getTodayIsExit(vo);
|
||||
//每日新增一条考勤信息
|
||||
if(num==null || num ==0){
|
||||
R<UploadFileVo> res=fileService.uploadBast64(vo.getAttPhoto(),"bm_att_person",vo.getId(),"1", "attr",null,SecurityConstants.INNER);
|
||||
if(res.getCode()==R.SUCCESS){
|
||||
UploadFileVo uploadFileVo=res.getData();
|
||||
vo.setImage(uploadFileVo.getPath());
|
||||
mapper.insertAttPerson(vo);
|
||||
}
|
||||
}
|
||||
//新增考勤记录
|
||||
R<UploadFileVo> res=fileService.uploadBast64(vo.getAttPhoto(),"bm_att_record",vo.getId(),"1", "attr",null,SecurityConstants.INNER);
|
||||
if(res.getCode()==R.SUCCESS){
|
||||
UploadFileVo uploadFileVo=res.getData();
|
||||
vo.setImage(uploadFileVo.getPath());
|
||||
mapper.insertAttRecord(vo);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -10,8 +10,11 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.bonus.urk.config.CacheConstant;
|
||||
import com.bonus.urk.config.Constant;
|
||||
import com.bonus.urk.config.DeviceUserDto;
|
||||
import com.bonus.urk.config.RedisUtils;
|
||||
import com.bonus.urk.handle.DeviceHandle;
|
||||
import com.bonus.urk.handle.ReceiveCmd;
|
||||
import com.bonus.urk.handle.ResultHandle;
|
||||
import com.bonus.urk.handle.UserFaceHandle;
|
||||
import com.bonus.urk.service.TaskService;
|
||||
import com.bonus.urk.vo.DeviceVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -48,12 +51,22 @@ public class DeviceServlet extends HttpServlet {
|
|||
private DeviceHandle deviceHandle;
|
||||
@Autowired
|
||||
private ReceiveCmd receiveCmd;
|
||||
/**
|
||||
* 用户人脸处理器
|
||||
*/
|
||||
@Autowired
|
||||
private UserFaceHandle userFaceHandle;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private ZSetOperations<String, Object> zSetOperations;
|
||||
private ResultHandle resultHandle;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 用于spring容器注入
|
||||
* @param config
|
||||
|
|
@ -73,25 +86,30 @@ public class DeviceServlet extends HttpServlet {
|
|||
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.ERROR_NO_CMD);
|
||||
return;
|
||||
}
|
||||
redisUtils.set("att_dev:status",1,600);
|
||||
String asTransId = req.getHeader(Constant.DEVICE_HEADER_TRANS_ID);
|
||||
String requestCode = req.getHeader(Constant.DEVICE_HEADER_REQUEST_CODE);
|
||||
zSetOperations.add(CacheConstant.DEVICE_ONLINE_SET_CACHE, deviceVo.getDevCode(), System.currentTimeMillis());
|
||||
// zSetOperations.add(CacheConstant.DEVICE_ONLINE_SET_CACHE, deviceVo.getDevCode(), System.currentTimeMillis());
|
||||
switch (requestCode){
|
||||
//心跳处理
|
||||
case "receive_cmd":
|
||||
receiveCmd.dealCmdReceiveHandle(deviceVo,req,resp);
|
||||
break;
|
||||
//人脸识别
|
||||
case "realtime_glog":
|
||||
receiveCmd.dealCmdReceiveHandle(deviceVo,req,resp);
|
||||
userFaceHandle.addUserAttendance(deviceVo,req,resp);
|
||||
break;
|
||||
//实时登记数据传输
|
||||
case "realtime_enroll_data":
|
||||
receiveCmd.dealCmdReceiveHandle(deviceVo,req,resp);
|
||||
break;
|
||||
default:
|
||||
if(StringHelper.isNullOrEmptyString(asTransId)){
|
||||
log.info("设备:{}, 请求未能识别的request_code:{}",deviceVo.getDevCode(), requestCode);
|
||||
}else{
|
||||
taskService.dealTrans(req,resp);
|
||||
resultHandle.dealTrans(req,resp);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
package com.bonus.urk.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 当前工程在场的人员
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerEinUserVo {
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private String proId;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String teamName;
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private String teamId;
|
||||
/**
|
||||
* 分包名称
|
||||
*/
|
||||
private String subName;
|
||||
/**
|
||||
* 分包id
|
||||
*/
|
||||
private String subId;
|
||||
/**
|
||||
* 项目部id
|
||||
*/
|
||||
private String orgId;
|
||||
/**
|
||||
* 岗位id
|
||||
*/
|
||||
private String postId;
|
||||
/**
|
||||
* 项目部名称
|
||||
*/
|
||||
private String orgName;
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private String attMonth;
|
||||
/**
|
||||
* 日
|
||||
*/
|
||||
private String attDay;
|
||||
/**
|
||||
* 日薪
|
||||
*/
|
||||
private String dailyWage;
|
||||
/**
|
||||
* 是否补卡
|
||||
*/
|
||||
private String isRepair="0";
|
||||
|
||||
private String image;
|
||||
/**
|
||||
* 考勤时间
|
||||
*/
|
||||
private String attTime;
|
||||
/**
|
||||
* 考前突破
|
||||
*/
|
||||
private String attPhoto;
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String idNumber;
|
||||
/**
|
||||
* 合同信息
|
||||
*/
|
||||
private String contractId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 考勤设备名称
|
||||
*/
|
||||
private String devName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.urk.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class KqCmdTaskVo {
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* 指令编码
|
||||
*/
|
||||
private String cmdCode;
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private String cmdParam;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String deviceCode;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private int transStatus=0;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 是否修改状态
|
||||
*/
|
||||
private String updateStatus;
|
||||
/**
|
||||
* 消息信息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private String proId;
|
||||
/**
|
||||
* 更新事件
|
||||
*/
|
||||
private String updateTime;
|
||||
}
|
||||
|
|
@ -2,21 +2,19 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.urk.mapper.BusinessMapper">
|
||||
<mapper namespace="com.bonus.urk.mapper.DeviceMapper">
|
||||
<insert id="insertDeviceVo">
|
||||
insert into pm_att_device(device_code,device_name,dev_model,on_line,is_active)values (
|
||||
#{devCode},#{deviceName},#{devModel},#{onLine},1 )
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
<!--查询设备基础信息-->
|
||||
<select id="getDeviceVoById" resultType="com.bonus.urk.vo.DeviceVo">
|
||||
select device_code devCode,device_name deviceName, pro_id proId,
|
||||
dev_model devModel,on_line onLine
|
||||
from pm_att_device
|
||||
where device_code=#{devId} and is_active=1
|
||||
limit 1
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?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.bonus.urk.mapper.ResultMapper">
|
||||
<update id="updateTaskById">
|
||||
update kq_cmd_task set trans_status_update_time=#{updateTime},trans_status=#{transStatus}
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateTaskHisById">
|
||||
update kq_cmd_task_history set trans_status_update_time=#{updateTime},trans_status=#{transStatus}
|
||||
where id=#{id}
|
||||
</update>
|
||||
<update id="updateUserIssuedStatus">
|
||||
update pm_worker_user_issued set result=#{result}
|
||||
where task_id=#{taskVo.id}
|
||||
|
||||
</update>
|
||||
<delete id="delCmdTaskId">
|
||||
delete from kq_cmd_task where id=#{id}
|
||||
</delete>
|
||||
|
||||
<select id="getTaskVoById" resultType="com.bonus.urk.vo.KqCmdTaskVo">
|
||||
select id,cmd_code cmdCode,device_code deviceCode
|
||||
from kq_cmd_task
|
||||
where id=#{taskId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?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.bonus.urk.mapper.SendUserMapper">
|
||||
<insert id="insertDeviceVo">
|
||||
insert into pm_att_device(device_code,device_name,dev_model,on_line,is_active)values (
|
||||
#{devCode},#{deviceName},#{devModel},#{onLine},1 )
|
||||
|
||||
</insert>
|
||||
<insert id="insertCmdTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into kq_cmd_task (
|
||||
cmd_code, cmd_param, device_code, trans_status,
|
||||
create_time, update_state, msg, pro_id
|
||||
)values (#{cmdCode},#{cmdParam},#{deviceCode},#{transStatus},#{createTime},#{updateStatus},#{msg},#{proId}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertCmdTaskHistory">
|
||||
insert into kq_cmd_task (id,
|
||||
cmd_code, cmd_param, device_code, trans_status,
|
||||
create_time, update_state, msg, pro_id
|
||||
)values (#{id},#{cmdCode},#{cmdParam},#{deviceCode},#{transStatus},#{createTime},#{updateStatus},#{msg},#{proId}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertTaskUser">
|
||||
insert into kq_task_user_list(
|
||||
task_id,user_id )values
|
||||
<foreach collection="list" item="item" separator=",">(
|
||||
#{item.id},#{userId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--新增考勤机 下发人员-->
|
||||
<insert id="insertCmdTaskUser">
|
||||
insert into kq_task_user_list(
|
||||
task_id,user_id )values
|
||||
<foreach collection="list" item="item" separator=",">(
|
||||
#{param.id}, #{item}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--任务批量插入-->
|
||||
<insert id="insertCmdTaskByDevice" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into kq_cmd_task (
|
||||
cmd_code, cmd_param, device_code, trans_status, create_time, update_state, msg, pro_id
|
||||
)values
|
||||
<foreach collection="list" item="item" separator=",">(
|
||||
(#{item.cmdCode},#{item.cmdParam},#{item.deviceCode},#{item.transStatus},#{item.createTime},#{item.updateStatus},#{item.msg},#{item.proId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--任务 记录批量插入-->
|
||||
<insert id="insertCmdTaskByDeviceHistory" >
|
||||
insert into kq_cmd_task (
|
||||
id,cmd_code, cmd_param, device_code, trans_status,create_time, update_state, msg, pro_id
|
||||
)values
|
||||
<foreach collection="list" item="item" separator=",">(
|
||||
(#{item.id},#{item.cmdCode},#{item.cmdParam},#{item.deviceCode},#{item.transStatus},#{item.createTime},#{item.updateStatus},#{item.msg},#{item.proId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--查询设备基础信息-->
|
||||
<select id="getDeviceVoById" resultType="com.bonus.urk.vo.DeviceVo">
|
||||
select device_code devCode,device_name deviceName, pro_id proId,
|
||||
dev_model devModel,on_line onLine
|
||||
from pm_att_device
|
||||
where device_code=#{devId} and is_active=1
|
||||
limit 1
|
||||
</select>
|
||||
<!--分页查询设备数据-->
|
||||
<select id="getDeviceVoByProId" resultType="com.bonus.urk.vo.DeviceVo">
|
||||
select device_code devCode,device_name deviceName, pro_id proId,
|
||||
dev_model devModel,on_line onLine
|
||||
from pm_att_device
|
||||
where pro_id=#{proId} and is_active=1
|
||||
</select>
|
||||
<select id="getOnSiteUser" resultType="java.lang.String">
|
||||
select worker_id
|
||||
from bm_worker_ein_msg
|
||||
where pro_id=#{proId}
|
||||
|
||||
</select>
|
||||
<select id="getProType" resultType="java.lang.Integer">
|
||||
select is_shanghai
|
||||
FROM pm_project
|
||||
WHERE id=#{proId}
|
||||
|
||||
</select>
|
||||
<select id="getDeviceVoByProBySh" resultType="com.bonus.urk.vo.DeviceVo">
|
||||
select td.device_code devCode, td.device_name deviceName, td.pro_id proId,
|
||||
td.dev_model devModel, td.on_line onLine
|
||||
from pm_att_device td
|
||||
LEFT join pm_project pro on pro.id=td.pro_id
|
||||
where pro.is_shanghai=1
|
||||
</select>
|
||||
<select id="getOnSiteUserBySh" resultType="java.lang.String">
|
||||
select bwem.worker_id
|
||||
from bm_worker_ein_msg bwem
|
||||
left join pm_project pro on pro.id=bwem.pro_id
|
||||
where pro.is_shanghai=1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -3,6 +3,17 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.urk.mapper.TaskMapper">
|
||||
|
||||
<!--用户下发信息记录-->
|
||||
<insert id="insertUserIssued">
|
||||
insert into pm_worker_user_issued(
|
||||
user_id, dev_id, create_time, task_id, result
|
||||
)values
|
||||
<foreach collection="list" index="item" separator=",">
|
||||
(#{item.userId},#{taskVo.deviceCode},#{taskVo.createTime},#{taskVo.id},'-1'
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="selectCmdTaskList" resultType="com.bonus.urk.vo.DeviceTaskVo">
|
||||
select id, cmd_code cmdCode,
|
||||
cmd_param cmdParam,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
<?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.bonus.urk.mapper.UserFaceHandleMapper">
|
||||
<!--人员考勤数据-->
|
||||
<insert id="insertAttPerson">
|
||||
insert into bm_att_person(
|
||||
id, worker_id, device_code,dev_name, id_number, name, pro_id, pro_name, sub_id, sub_name, team_id, team_name,org_id, org_name,
|
||||
att_month, att_day, daily_wage, att_time, att_photo, is_repair, create_time, is_active,contract_id
|
||||
)values (#{id},#{userId},#{devCode},#{devName},#{idNumber},#{userName},#{proId},#{proName},#{subId},#{subName},#{teamId},#{teamName},#{orgId},#{orgName},
|
||||
#{attMonth},#{attDay,#{dailyWage},#{attTime},#{image},#{isRepair},#{createTime},1,#{contractId}
|
||||
)
|
||||
|
||||
</insert>
|
||||
|
||||
<insert id="insertAttRecord">
|
||||
insert into bm_att_record(
|
||||
id, worker_id, device_code, id_number, dev_name,name, pro_id, pro_name, sub_id, sub_name, team_id, team_name,org_id, org_name,
|
||||
att_month, att_day, daily_wage, att_time, att_photo, is_repair, create_time, is_active,contract_id
|
||||
)values (#{id},#{userId},#{devCode},#{idNumber},#{devName},#{userName},#{proId},#{proName},#{subId},#{subName},#{teamId},#{teamName},#{orgId},#{orgName},
|
||||
#{attMonth},#{attDay,#{dailyWage},#{attTime},#{image},#{isRepair},#{createTime},1,#{contractId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getOnUserInfo" resultType="com.bonus.urk.vo.BmWorkerEinUserVo">
|
||||
select bwem.worker_id userId,bwem.pro_name proName,bwem.pro_id proId,pw.`name` userName,
|
||||
bwem.team_name teamName,bwem.team_id teamId,pw.id_number,
|
||||
bwem.sub_id subId,bwem.sub_name subName,bwem.post_id postId,bwem.contract_id,bwc.day_rate dailyWage
|
||||
from bm_worker_ein_msg bwem
|
||||
left join pm_worker pw on pw.id=bwem.worker_id
|
||||
LEFT JOIN bm_worker_contract bwc on bwc.worker_id=bwem.worker_id and bwc.is_active=1
|
||||
where bwem.worker_id=#{userId}
|
||||
</select>
|
||||
<select id="getTodayIsExit" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from bm_att_person
|
||||
where worker_id=#{userId} and is_active=1 and att_day=#{attDay}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue