server/dmvisit_admin/src/main/java/com/doumee/api/common/PublicController.java
@@ -6,6 +6,7 @@ import com.doumee.core.annotation.trace.Trace; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.FtpUtil; import com.doumee.core.utils.aliyun.ALiYunUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -14,20 +15,21 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; 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; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.UUID; /** * @author Eva.Caesar Liu @@ -45,52 +47,113 @@ private SystemDictDataBiz systemDictDataBiz; @ApiOperation(value = "ä¸ä¼ ", notes = "ä¸ä¼ ", httpMethod = "POST", position = 6) @ApiImplicitParams({ @ApiImplicitParam(name = "folder", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), }) @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") public void uploadMobile(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; upload(multipartRequest, response, folder + "/", systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); } // @ApiOperation(value = "ä¸ä¼ ", notes = "ä¸ä¼ ", httpMethod = "POST", position = 6) // @ApiImplicitParams({ // @ApiImplicitParam(name = "folder", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), // }) // @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") // public void uploadMobile(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { // MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; // upload(multipartRequest, response, folder + "/", // systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); // } // // // @ApiOperation(value = "ä¸ä¼ å¾ç", notes = "ä¸ä¼ å¾ç", httpMethod = "POST", position = 6) // @ApiImplicitParams({ // @ApiImplicitParam(name = "folder", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), // }) // @PostMapping(value = "/uploadPicture", headers = "content-type=multipart/form-data") // public void uploadPicture(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { // MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; // Iterator<String> fileNames = multipartRequest.getFileNames(); // Map<String, Object> context = new HashMap<>(); // while (fileNames.hasNext()){ // MultipartFile file = multipartRequest.getFile(fileNames.next()); // String fileName = file.getOriginalFilename(); // String suffix = fileName.substring(fileName.lastIndexOf(".")); // if ( !StringUtils.equalsIgnoreCase(suffix, ".jpg") || !StringUtils.equalsIgnoreCase(suffix, ".png")) { // context.put("code", 0); // context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼ä¸ä¼ æè¯¯ï¼"); // } // } // upload(multipartRequest, response, folder + "/", // systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), // systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); // } @ApiOperation(value = "ä¸ä¼ å¾ç", notes = "ä¸ä¼ å¾ç", httpMethod = "POST", position = 6) @ApiImplicitParams({ @ApiImplicitParam(name = "folder", value = "banner/ ï¼è½®æï¼goods/ (åå)member/ (ç¨æ·ï¼shop/ ï¼åºéºï¼system/ (ç³»ç»é ç½®çï¼activity/ ï¼åç°ï¼commet/ (è¯è®ºï¼other/ ï¼å ¶ä»ï¼aftersale/ï¼å®åï¼", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), }) @PostMapping(value = "/uploadPicture", headers = "content-type=multipart/form-data") public void uploadPicture(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; Iterator<String> fileNames = multipartRequest.getFileNames(); public static FtpUtil ftp = null; @ApiOperation(value = "ä¸ä¼ æä»¶å°FTP") @RequestMapping(method= RequestMethod.POST,value="upload") @ResponseBody public void upload(HttpServletRequest request, HttpServletResponse response, String folder) throws Exception { // folder = systemDictDataBiz.queryByCode(Constants.FTP,folder).getCode(); String prefixPath = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode(); InputStream is = null; response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); Map<String, Object> context = new HashMap<>(); while (fileNames.hasNext()){ MultipartFile file = multipartRequest.getFile(fileNames.next()); String fileName = file.getOriginalFilename(); String suffix = fileName.substring(fileName.lastIndexOf(".")); if ( !StringUtils.equalsIgnoreCase(suffix, ".jpg") || !StringUtils.equalsIgnoreCase(suffix, ".png")) { context.put("code", 0); context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼ä¸ä¼ æè¯¯ï¼"); try { if(ftp == null){ ftp = new FtpUtil(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_HOST).getCode(), Integer.parseInt(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PORT).getCode()), systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_USERNAME).getCode(), systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PWD).getCode()); }else{ ftp.connect(); } CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); if (multipartResovler.isMultipart(request)) { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; Iterator<String> it = multipartRequest.getFileNames(); while (it.hasNext()) { MultipartFile file = multipartRequest.getFile(it.next()); is = file.getInputStream(); String date = DateUtil.getNowShortDate(); String fName = date+"/"+ UUID.randomUUID()+".jpg"; String fileName = folder+fName; boolean r = ftp.uploadInputstream(is,fileName); if(r){ context.put("success", true); context.put("code", 200); context.put("errno",0); JSONObject fileJSON = new JSONObject(); fileJSON.put("halfPath", fName); fileJSON.put("prefixPath", prefixPath); fileJSON.put("folder", folder); context.put("data",fileJSON); context.put("message","è¯·æ±æå"); writerJson(response, context); return; } } } } catch (Exception e) { log.error("ãä¸ä¼ FTP失败ã======================"+e.getMessage()); } upload(multipartRequest, response, folder + "/", systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); context.put("code", 0); context.put("message", "ä¸ä¼ 失败"); context.put("errno",0); writerJson(response, context); return; } public void upload(HttpServletRequest request, HttpServletResponse response, String folder, String bucketName, String access_id, String access_key, String resourcePath, String endpoint) throws Exception { String access_id, String access_key, String resourcePath, String endpoint) throws Exception { response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); Map<String, Object> context = new HashMap<>(); @@ -182,6 +245,8 @@ e.printStackTrace(); } } public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception { @@ -308,6 +373,4 @@ writerJson(response, context); return; } } server/dmvisit_admin/src/main/resources/application.yml
@@ -67,7 +67,7 @@ compression: enabled: true mime-types: application/json port: 10033 port: 10028 tomcat: max-swallow-size: -1 servlet: server/dmvisit_service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.biz.system.SystemUserBiz; import com.doumee.core.annotation.excel.ExcelImporter; import com.doumee.core.exception.BusinessException; @@ -46,6 +47,8 @@ @Autowired private SystemDepartmentService systemDepartmentService; @Autowired private SystemDictDataBiz systemDictDataBiz; @Transactional(rollbackFor = {Exception.class,BusinessException.class}) @Override @@ -111,13 +114,12 @@ @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public void create(CreateSystemUserDTO systemUser) { // éªè¯ç¨æ·å systemUser.setUsername(systemUser.getMobile()); SystemUser queryUserDto = new SystemUser(); queryUserDto.setUsername(systemUser.getUsername()); queryUserDto.setDeleted(Boolean.FALSE); SystemUser user = systemUserService.findOne(queryUserDto); if (user != null) { throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "çµè¯ã"+systemUser.getUsername()+"ãä¸è½éå¤"); throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "ç¨æ·åã"+systemUser.getUsername()+"ãä¸è½éå¤"); } // éªè¯å·¥å· if (StringUtils.isNotBlank(systemUser.getEmpNo())) { @@ -132,7 +134,7 @@ // çæå¯ç ç String salt = RandomStringUtils.randomAlphabetic(6); // çæå¯ç systemUser.setPassword(Utils.Secure.encryptPassword(systemUser.getMobile().substring(5), salt)); systemUser.setPassword(Utils.Secure.encryptPassword(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.INITIAL_PASSWORD).getCode(), salt)); systemUser.setSalt(salt); // åå»ºç¨æ·è®°å½ server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -45,9 +45,12 @@ public static final String EDS_PWD ="!@#$%^&QWERTY" ; public static final String ROOT_PATH = ""; public static final String FILE_DIR = ""; public static final String INITIAL_PASSWORD = "INITIAL_PASSWORD"; // 访客æ¥è®¿é ç½® public static final String VISIT_CONFIG = "VISIT_CONFIG"; public static final String MEMBER_IMG = "MEMBER_IMG"; public static final String VISIT_NOTICE = "VISIT_NOTICE"; //å¥åº·è¯é ç½® public static final String LW_HEALTH_CARD = "LW_HEALTH_CARD"; public static final String HEALTH_CARD = "HEALTH_CARD"; @@ -388,7 +391,7 @@ * å°åæ°è½æºè½¦ * 1ãå¹é æ°è½æºè½¦è¾6ä½è½¦ç */ SMALL_NEW_ENERGY_VEHICLE(5, "å°åæ°è½æºè½¦ç", Pattern.compile("^[京津åæèè¾½å黿²ªèæµçé½èµ£é²è±«éæ¹ç²¤æ¡ç¼å·è´µäºæ¸èéçé宿°]{1}[A-Z]{1}[DF]{1}[0-9a-zA-Z]{5}$")), SMALL_NEW_ENERGY_VEHICLE(5, "å°åæ°è½æºè½¦ç", Pattern.compile("^[京津åæèè¾½å黿²ªèæµçé½èµ£é²è±«éæ¹ç²¤æ¡ç¼å·è´µäºæ¸èéçé宿°]{1}[A-Z]{1}[A-Z]{1}[0-9a-zA-Z]{5}$")), /** * å¤§åæ°è½æºè½¦ */ @@ -415,10 +418,10 @@ } public static void main(String[] args) { System.out.println(Constants.getVehiclePlateNo("æ¹BD40D17").getDescription()); System.out.println(Constants.getVehiclePlateNo("çAA10991").getDescription()); System.out.println(Constants.getVehiclePlateNo("æ¹B140D17").getDescription()); System.out.println(Constants.getVehiclePlateNo("宿AP0637").getDescription()); // System.out.println(Constants.getVehiclePlateNo("æ¹B140D17").getDescription()); // System.out.println(Constants.getVehiclePlateNo("宿AP0637").getDescription()); } server/dmvisit_service/src/main/java/com/doumee/dao/admin/request/VisitConfigDTO.java
@@ -36,4 +36,6 @@ @ApiModelProperty(value = "çé¢è¯´æ") private String description; @ApiModelProperty(value = "å ¥åé¡»ç¥") private String visitNotice; } server/dmvisit_service/src/main/java/com/doumee/dao/business/model/Visits.java
@@ -236,6 +236,8 @@ @ExcelColumn(name="å建人ç¼ç ï¼å ³èmember表)") private Integer createMemberId; @ApiModelProperty(value = "æ¥æºç±»åï¼0=æ¬ç³»ç»ï¼1=ERP", example = "1") private Integer sourceType; @ApiModelProperty(value = "æ®é访客ç³è¯·é访人å") @TableField(exist = false) server/dmvisit_service/src/main/java/com/doumee/dao/web/reqeust/ErpVisitDTO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,74 @@ package com.doumee.dao.web.reqeust; import com.doumee.core.annotation.excel.ExcelColumn; import com.doumee.core.haikang.model.param.BaseRequst; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; import java.util.List; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2024/2/29 14:26 */ @Data @ApiModel("ERP访客ç³è¯·ä¸»ç±»") public class ErpVisitDTO extends BaseRequst { @ApiModelProperty(value = "ERPè®°å½ä¸»é®") private String erpId; @ApiModelProperty(value = "访客å§å") private String name; @ApiModelProperty(value = "ææºå·") private String phone; @ApiModelProperty(value = "è¯ä»¶ç±»å 0èº«ä»½è¯ 1港澳è¯ä»¶ 2æ¤ç §") private Integer idcardType; @ApiModelProperty(value = "è¯ä»¶å·") private String idcardNo; @ApiModelProperty(value = "人è¸ç §ç") private String faceImg; @ApiModelProperty(value = "å¥åº·è¯") private String imgurl; @ApiModelProperty(value = "å ¬å¸åç§°") private String companyName; @ApiModelProperty(value = "被访人 erp ä¸»é® ") private String receptMemberId; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "é¨ç¦æææå¼å§") private Date starttime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "é¨ç¦ææææªæ¢") private Date endtime; @ApiModelProperty(value = "é¨ç¦ç¼ç 海康系ç»ä¸»é® ï¼å¤ä¸ªç¨è±æéå·éå¼") private String doors; @ApiModelProperty(value = "æ¥è®¿äºç±") private String reason; @ApiModelProperty(value = "车çå·") private String carNos; @ApiModelProperty(value = "é访人åä¿¡æ¯") List<ErpWithVisitDTO> erpWithVisitDTOList; } server/dmvisit_service/src/main/java/com/doumee/dao/web/reqeust/ErpWithVisitDTO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,47 @@ package com.doumee.dao.web.reqeust; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2024/2/29 14:26 */ @Data @ApiModel("ERP访客ç³è¯· é访人信æ¯") public class ErpWithVisitDTO { @ApiModelProperty(value = "访客å§å") private String name; @ApiModelProperty(value = "ææºå·") private String phone; @ApiModelProperty(value = "è¯ä»¶ç±»å 0èº«ä»½è¯ 1港澳è¯ä»¶ 2æ¤ç §") private Integer idcardType; @ApiModelProperty(value = "è¯ä»¶å·") private String idcardNo; @ApiModelProperty(value = "人è¸ç §ç") private String faceImg; @ApiModelProperty(value = "å¥åº·è¯") private String imgurl; @ApiModelProperty(value = "å ¬å¸åç§°") private String companyName; @ApiModelProperty(value = "车çå·") private String carNos; } server/dmvisit_service/src/main/java/com/doumee/service/business/VisitsService.java
@@ -4,6 +4,7 @@ import com.doumee.core.model.PageWrap; import com.doumee.dao.business.model.Visits; import com.doumee.dao.web.reqeust.AuditApproveDTO; import com.doumee.dao.web.reqeust.ErpVisitDTO; import com.doumee.dao.web.reqeust.VisitRecordDTO; import com.doumee.dao.web.response.VisitDetailVO; import com.doumee.dao.web.response.VisitRecordVO; @@ -27,6 +28,8 @@ Integer createFk(Visits visits); void createFKForErp(ErpVisitDTO erpVisitDTO); /** * 主é®å é¤ * server/dmvisit_service/src/main/java/com/doumee/service/business/impl/EmpowerServiceImpl.java
@@ -118,9 +118,10 @@ queryWrapper /* .eq(Empower::getIsdeleted, Constants.ZERO)*/ .and(StringUtils.isNotBlank(pageWrap.getModel().getMemberName()), ms->ms.like(Member::getName,pageWrap.getModel().getMemberName()) .or().like(Member::getPhone,pageWrap.getModel().getCompanyName())); .or().like(Member::getPhone,pageWrap.getModel().getMemberName())); queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getSendStatus()),Empower::getSendStatus,pageWrap.getModel().getSendStatus()); queryWrapper.eq(StringUtils.isNotBlank(pageWrap.getModel().getCompanyId()),Company::getId,pageWrap.getModel().getCompanyId()); queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getCompanyName()),Company::getName,pageWrap.getModel().getCompanyName()); queryWrapper.ge(Objects.nonNull(pageWrap.getModel().getSendStartDate()),Empower::getSendDate,pageWrap.getModel().getSendStartDate()); queryWrapper.le(Objects.nonNull(pageWrap.getModel().getSendEndDate()),Empower::getSendDate,pageWrap.getModel().getSendEndDate()); server/dmvisit_service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -1031,7 +1031,10 @@ .exists(" select 1 from park_book p where p.origin = 0 and p.car_code = retention.car_no and p.ISDELETED = 0 ") )); stagingHeadVO.setVisitorCarCount(stagingHeadVO.getPresenceCarCount() - stagingHeadVO.getLongCarCount()); stagingHeadVO.setSupplierCount(companyMapper.selectCount(new QueryWrapper<Company>().lambda().eq(Company::getIsdeleted,Constants.ZERO))); stagingHeadVO.setSupplierCount(companyMapper.selectCount(new QueryWrapper<Company>().lambda() .eq(Company::getIsdeleted,Constants.ZERO) .eq(Company::getType,Constants.ZERO) )); return stagingHeadVO; } server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -34,6 +34,8 @@ import com.doumee.dao.business.join.VisitsJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.web.reqeust.AuditApproveDTO; import com.doumee.dao.web.reqeust.ErpVisitDTO; import com.doumee.dao.web.reqeust.ErpWithVisitDTO; import com.doumee.dao.web.reqeust.VisitRecordDTO; import com.doumee.dao.web.response.InternalHomeVO; import com.doumee.dao.web.response.VisitDetailVO; @@ -94,11 +96,92 @@ @Autowired private WxPlatNotice wxPlatNotice; @Autowired private InterfaceLogService interfaceLogService; @Override public Integer create(Visits visits) { visitsMapper.insert(visits); return visits.getId(); } @Override @Transactional(rollbackFor = {BusinessException.class,Exception.class}) public void createFKForErp(ErpVisitDTO erpVisitDTO){ try { if (Objects.isNull(erpVisitDTO) || StringUtils.isBlank(erpVisitDTO.getName()) || StringUtils.isBlank(erpVisitDTO.getPhone()) || Objects.isNull(erpVisitDTO.getIdcardType()) || StringUtils.isBlank(erpVisitDTO.getIdcardNo()) || Objects.isNull(erpVisitDTO.getStarttime()) || Objects.isNull(erpVisitDTO.getEndtime()) || StringUtils.isBlank(erpVisitDTO.getFaceImg()) || Objects.isNull(erpVisitDTO.getReceptMemberId()) || Objects.isNull(erpVisitDTO.getErpId()) ) { throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对ä¸èµ·ï¼ä¿¡æ¯å¡«å䏿£ç¡®ï¼"); } if (erpVisitDTO.getEndtime().getTime() <= erpVisitDTO.getStarttime().getTime()) { throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对ä¸èµ·ï¼é¢çº¦ç»ææ¶é´å¿ 须大äºå¼å§æ¶é´ï¼"); } if (Constants.equalsInteger(Constants.ZERO, erpVisitDTO.getIdcardType()) && erpVisitDTO.getIdcardNo().length() != 18 //&&!IdcardUtil.isValidCard(visits.getIdcardNo()) ) { throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对ä¸èµ·ï¼èº«ä»½è¯å·ç æè¯¯ï¼è¯·æ ¸å®åéè¯ï¼"); } Visits visits = new Visits(); //æ ¹æ®è¢«è®¿é®äººERP䏻鮿¥è¯¢ç³»ç»å 人å主é®ä¿¡æ¯ Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda() .eq(Member::getIsdeleted, Constants.ZERO).eq(Member::getType, Constants.memberType.internal) .eq(Member::getErpId, erpVisitDTO.getReceptMemberId()).last("limit 1")); if (Objects.isNull(member)) { throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "æªæ¥è¯¢å°è¢«è®¿é®äººä¿¡æ¯"); } if (Objects.isNull(member.getCanVisit()) || member.getCanVisit().equals(Constants.ZERO)) { throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "å½å被访é®äººæ æ³è¢«è®¿é®"); } BeanUtils.copyProperties(erpVisitDTO, visits); //设置å é¨ç³»ç»äººåä¸»é® visits.setReceptMemberId(member.getId()); visits.setSourceType(Constants.ONE); List<ErpWithVisitDTO> erpWithVisitDTOList = erpVisitDTO.getErpWithVisitDTOList(); if (CollectionUtils.isNotEmpty(erpWithVisitDTOList)) { List<Visits> visitsList = new ArrayList<>(); for (ErpWithVisitDTO erpWithVisitDTO : erpWithVisitDTOList) { Visits withVisits = new Visits(); BeanUtils.copyProperties(erpWithVisitDTO, withVisits); visitsList.add(withVisits); } visits.setWithUserList(visitsList); } this.createFk(visits); }catch (BusinessException e){ throw e; }finally { saveInterfaceLog(erpVisitDTO,"/visitBiz/resource/crateVisit",null,Constants.ZERO); } } private void saveInterfaceLog(Object param, String path,String result,Integer type) { InterfaceLog interfaceLog=new InterfaceLog(); interfaceLog.setType(type); interfaceLog.setCreateDate(new Date()); interfaceLog.setIsdeleted(Constants.ZERO); if(param!=null){ interfaceLog.setRequest(JSONObject.toJSONString(param)); } interfaceLog.setPlat(Constants.ONE); interfaceLog.setRepose(result); interfaceLog.setName(path); interfaceLog.setUrl(path); interfaceLogService.create(interfaceLog); } /** * æ®é访客ç³è¯· @@ -135,22 +218,27 @@ initVisitInfo(visits,date); visitsMapper.insert(visits); //åèµ·ERP审æ¹ç³è¯· String erpId = startSendErpCheck(visits,visitMember); if(StringUtils.isNotBlank(erpId)){ visits.setErpId(erpId); visits.setStatus(Constants.VisitStatus.submitCheck); visitsMapper.updateById(visits); if(visits.getSourceType().equals(Constants.ZERO)){ String erpId = startSendErpCheck(visits,visitMember); if(StringUtils.isNotBlank(erpId)){ visits.setErpId(erpId); visits.setStatus(Constants.VisitStatus.submitCheck); visitsMapper.updateById(visits); }else{ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼åèµ·æè®¿å®¡æ¹ç³è¯·å¤±è´¥ï¼"); } //åéå¾®ä¿¡å ¬ä¼å·éç¥ wxPlatNotice.sendVisitAuditTemplateNotice(visits, systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_PREFIX).getCode(), systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_AUDIT_VISIT).getCode()); }else{ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼åèµ·æè®¿å®¡æ¹ç³è¯·å¤±è´¥ï¼"); visits.setStatus(Constants.VisitStatus.pass); visitsMapper.updateById(visits); } initWithVisitInfo(visits); updateProblemLog(visits,problemLog,member); //å建审æ¹è®°å½ // createApprove(visits,visitMember); //åéå¾®ä¿¡å ¬ä¼å·éç¥ wxPlatNotice.sendVisitAuditTemplateNotice(visits, systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_PREFIX).getCode(), systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_AUDIT_VISIT).getCode()); return visits.getId(); } @@ -554,7 +642,8 @@ v.setDoors(visits.getDoors()); v.setType(visits.getType()); v.setVisitType(visits.getVisitType()); v.setStatus(Constants.VisitStatus.submitCheck); v.setStatus(visits.getStatus()); v.setSourceType(visits.getSourceType()); } //æ¹éæå ¥æ°æ® visitsMapper.insertBatchSomeColumn(visits.getWithUserList()); @@ -833,7 +922,7 @@ private ProblemLog isValidProblemLog(Visits visits) { String required = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROBLEM_VISIT_REQUIRED).getCode(); if(StringUtils.equals(required,Constants.ONE+"")){ if(StringUtils.equals(required,Constants.ONE+"")&&visits.getSourceType()==Constants.ZERO){ //å¦æå¿ é¡»çé¢ï¼æ¥æ¾çé¢è®°å½ if(visits.getUserAnswerId() == null){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对ä¸èµ·ï¼è¯·å æè¦æ±è¿è¡å®å ¨ç¥è¯çé¢ï¼"); server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
@@ -340,11 +340,11 @@ Date date = new Date(); int num =0; for(ErpUserListResponse response : list){ if(isDebug){ response.setPhone("1534569100"+num); response.setFaceImg("20223402/DM1005.png"); response.setIdNo("34112219880427200"+num); } // if(isDebug){ // response.setPhone("1534569100"+num); // response.setFaceImg("20223402/DM1005.png"); // response.setIdNo("34112219880427200"+num); // } num++; Company company = new Company(); if(StringUtils.isNotBlank(response.getOrgId())){ @@ -1074,7 +1074,6 @@ ){ } if(Objects.isNull(param) ||Objects.isNull(param.getId()) ||Objects.isNull(param.getStatus())){ server/dmvisit_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java
@@ -167,11 +167,18 @@ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"访客çé¢ä¸»é¢ åå ¸ä¸åå¨"); } visitConfigDTO.setTheme(theme.getCode()); SystemDictData description = systemDictList.stream().filter(m->m.getLabel().equals(Constants.DESCRIPTION)).findFirst().get(); if(Objects.isNull(description)){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"访客çé¢è¯´æ åå ¸ä¸åå¨"); } visitConfigDTO.setDescription(description.getCode()); SystemDictData visitNotice = systemDictList.stream().filter(m->m.getLabel().equals(Constants.VISIT_NOTICE)).findFirst().get(); if(Objects.isNull(visitNotice)){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"å ¥åé¡»ç¥ åå ¸ä¸åå¨"); } visitConfigDTO.setVisitNotice(visitNotice.getCode()); return visitConfigDTO; } @@ -223,11 +230,19 @@ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"访客çé¢ä¸»é¢ åå ¸ä¸åå¨"); } theme.setCode(visitConfigDTO.getTheme()); SystemDictData description = systemDictList.stream().filter(m->m.getLabel().equals(Constants.DESCRIPTION)).findFirst().get(); if(Objects.isNull(description)){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"访客çé¢è¯´æ åå ¸ä¸åå¨"); } description.setCode(visitConfigDTO.getDescription()); SystemDictData visitNotice = systemDictList.stream().filter(m->m.getLabel().equals(Constants.VISIT_NOTICE)).findFirst().get(); if(Objects.isNull(visitNotice)){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"å ¥åé¡»ç¥ åå ¸ä¸åå¨"); } visitNotice.setCode(visitConfigDTO.getVisitNotice()); systemDictDataMapper.updateById(reservationWay); systemDictDataMapper.updateById(checkVisit); @@ -235,6 +250,7 @@ systemDictDataMapper.updateById(isAnswer); systemDictDataMapper.updateById(theme); systemDictDataMapper.updateById(description); systemDictDataMapper.updateById(visitNotice); } server/dmvisit_service/src/main/resources/application-testHS.yml
@@ -38,7 +38,7 @@ title: ${project.name}æ¥å£ææ¡£ description: ${project.name}æ¥å£ææ¡£ enabled: true context-path: /erp_api context-path: /erp_interface # ç¦ç¨swaggeræ¶çéå®åå°å redirect-uri: / server/dmvisit_web/src/main/java/com/doumee/api/web/VisitorController.java
@@ -63,6 +63,7 @@ @ApiOperation(value = "è®¿å®¢è®°å½æäº¤", notes = "访客æäº¤") @PostMapping("/createFk") public ApiResponse createFk(@RequestBody Visits visits) { visits.setSourceType(Constants.ZERO); return ApiResponse.success("æ¥è¯¢æå", visitsService.createFk(visits)); } server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java
@@ -8,6 +8,8 @@ import com.doumee.core.erp.model.openapi.request.*; import com.doumee.core.erp.model.openapi.response.*; import com.doumee.core.utils.Constants; import com.doumee.dao.web.reqeust.ErpVisitDTO; import com.doumee.service.business.VisitsService; import com.doumee.service.business.ext.ERPSyncService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -39,6 +41,9 @@ @Autowired private SystemDictDataBiz systemDictDataBiz; @Autowired private VisitsService visitsService; @ApiOperation(value = "è°ç¨åæ®è·åæ¥å£", notes = "访客端æä¾ï¼ä¾ERP端è°ç¨ï¼åERPæä¾ç»æ¥å£è°ç¨åè¯") @@ -155,6 +160,17 @@ return ApiResponse.success(null); } @ErpLoginRequired @ApiOperation(value = "å起访客ç³è¯·", notes = "访客端æä¾ï¼ä¾ERP端è°ç¨ï¼ERP端å起访客ç³è¯·") @PostMapping("/resource/createVisit") @ApiImplicitParams({ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "æætokenå¼", required = true) }) public ApiResponse createVisit(@RequestBody ErpVisitDTO param) { param.setToken(this.getToken()); visitsService.createFKForErp(param); return ApiResponse.success("æä½æå"); } @ApiOperation(value = "FTPè´¦æ·ä¿¡æ¯", notes = "访客端æä¾ï¼ä¾ERP端è°ç¨ï¼FTPè´¦æ·ä¿¡æ¯,å ¶ä¸ãFTPèµæºè®¿é®æ å°å°åãç¨äºå¾çåæ¾ä½¿ç¨ï¼" +